You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

120 lines
4.3 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using System.Collections;
using Aspose.Cells;
using Microsoft.AspNetCore.Mvc;
using Estsh.Core.Services.IServices;
using Estsh.Core.Model.Result;
using Estsh.Core.Models;
using System.Text.Json;
using Estsh.Core.Controllers;
/***************************************************************************************************
*
* 更新人sitong.dong
* 描述:采购周计划导出
* 修改时间2022.06.22
* 修改日志:系统迭代升级
*
**************************************************************************************************/
namespace Estsh.Core.Web.Controllers
{
/// <summary>
/// 采购周计划条码导出
/// </summary>
public class PurchaseExportController : BaseController
{
private IPurchaseExportService service;
public PurchaseExportController(IPurchaseExportService _service)
{
service = _service;
}
public ActionResult Index()
{
return View();
}
/// <summary>
/// 获取采购周计划导出数据
/// </summary>
/// <param name="dtpSeDate"></param>
/// <returns></returns>
public ActionResult getOrderList(String dtpSeDate)
{
dtpSeDate = dtpSeDate.Replace("-", "/");
Hashtable result = new Hashtable();
List<KeyValueResult> orderList = this.service.getOrderList(dtpSeDate);
result.Add("list", orderList);
if (orderList.Count > 0)
{
result.Add("log", "所选择日期内要货单数据查询成功!\r\n请正确选择待导出的要货单号后点击[导出]按钮!");
result.Add("message", "所选择日期内要货单数据查询成功!\r\n请正确选择待导出的要货单号后点击[导出]按钮!");
result.Add("flag", "success");
}
else
{
result.Add("log", "[" + dtpSeDate + "]:所选择日期内没有任何版本的要货单数据!");
result.Add("message", "[" + dtpSeDate + "]:所选择日期内没有任何版本的要货单数据!");
result.Add("flag", "error");
}
return Json(result);
}
/// <summary>
/// 获取要货供应商信息
/// </summary>
/// <param name="dtpSeDate"></param>
/// <returns></returns>
public ActionResult geVendorList(String orderNo)
{
Hashtable result = new Hashtable();
List<KeyValueResult> vendorList = this.service.geVendorList(orderNo);
if (vendorList.Count > 0)
{
KeyValueResult values = new KeyValueResult();
values.key = "all";
values.value= "all";
vendorList.Add(values);
}
result.Add("list", vendorList);
return Json(result);
}
/// <summary>
/// 导出采购周计划条码信息
/// </summary>
/// <returns></returns>
public ActionResult exportData(String orderNo, String vendor)
{
//string excelTemplate = Server.MapPath("../App_Data/Template/SUBARTEMPLATE.xls");
//string saveFolder = Server.MapPath("../App_Data/Temp/");
//Hashtable result = this.service.ExportDataToExcel(saveFolder, orderNo, vendor, excelTemplate);
//return Json(result);
return Json("");
}
/// <summary>
/// 下载采购周计划条码信息文件
/// </summary>
/// <param name="path"></param>
/// <returns></returns>
public ActionResult downLoadFile(String path)
{
//FileInfo file = new System.IO.FileInfo(path);
//Response.Buffer = true;
//Response.AppendHeader("Content-Disposition", "attachment;filename=" + Server.UrlDecode(file.Name));
//Response.ContentEncoding = System.Text.Encoding.UTF8;
//Response.ContentType = "application/zip";
//Response.AddHeader("content-Length", file.Length.ToString());
//Response.WriteFile(file.FullName);
//Response.End();
//Response.Flush();
//if (file.Exists)
//{
// file.Delete();
//}
return Json("");
}
}
}