You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
249 lines
7.1 KiB
249 lines
7.1 KiB
using NFine.Application.WMS;
|
|
using NFine.Code;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.Mvc;
|
|
|
|
namespace NFine.Web.Areas.WMS.Controllers
|
|
{
|
|
public class ICSOApplyController : ControllerBase
|
|
{
|
|
ICSOApplyApp App = new ICSOApplyApp();
|
|
// GET: WMS/ICSOApply
|
|
public ActionResult ICSOApplyApplyNeg()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
|
|
|
|
public ActionResult ICSOApplyApplyNegAdd()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
|
|
public ActionResult SeachICSOApply()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
public ActionResult SeachInventory()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
|
|
public ActionResult ICSOApplyApplyNegUpdate()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
[HttpPost]
|
|
[HandlerAjaxOnly]
|
|
[ValidateAntiForgeryToken]
|
|
public ActionResult DeleteOApplyApplyNeg(string keyValue)
|
|
{
|
|
string msg = App.DeleteOApplyApplyNeg(keyValue);
|
|
if (string.IsNullOrEmpty(msg))
|
|
{
|
|
return Success("删除成功!");
|
|
}
|
|
else
|
|
{
|
|
return Error(msg);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 详情
|
|
/// </summary>
|
|
/// <param name="ApplyNegCode"></param>
|
|
/// <param name="pagination"></param>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
[HandlerAjaxOnly]
|
|
public ActionResult GetOApplyApplyNegDetail(string ApplyNegCode, Pagination pagination)
|
|
{
|
|
DataTable ListData = App.GetOApplyApplyNegDetail(ApplyNegCode, ref pagination);
|
|
var JsonData = new
|
|
{
|
|
total = pagination.total,
|
|
page = pagination.page,
|
|
records = pagination.records,
|
|
rows = ListData,
|
|
};
|
|
return Content(JsonData.ToJson());
|
|
}
|
|
public void ClearTemp()
|
|
{
|
|
App.ClearTemp();
|
|
}
|
|
|
|
public ActionResult GetOOCode(string WorkPoint)
|
|
{
|
|
try
|
|
{
|
|
string Code = App.GetOOCode(WorkPoint);
|
|
var JsonData = new
|
|
{
|
|
Code = Code,
|
|
};
|
|
return Content(JsonData.ToJson());
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return Error(ex.Message);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 汇总
|
|
/// </summary>
|
|
/// <param name="pagination"></param>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
public ActionResult GetOApplyApplyNeg(Pagination pagination)
|
|
{
|
|
DataTable ListData = App.GetOApplyApplyNeg(ref pagination);
|
|
var JsonData = new
|
|
{
|
|
total = pagination.total,
|
|
page = pagination.page,
|
|
records = pagination.records,
|
|
rows = ListData,
|
|
};
|
|
return Content(JsonData.ToJson());
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改弹出框的数据来源
|
|
/// </summary>
|
|
/// <param name="ApplyCode"></param>
|
|
/// <param name="pagination"></param>
|
|
/// <returns></returns>
|
|
public ActionResult GetICSOApplyReturnTemporary(string ApplyCode, Pagination pagination)
|
|
{
|
|
DataTable table = App.GetICSOApplyReturnTemporary(ApplyCode);
|
|
var JsonData = new
|
|
{
|
|
total = pagination.total,
|
|
page = pagination.page,
|
|
records = pagination.records,
|
|
rows = table
|
|
};
|
|
return Content(JsonData.ToJson());
|
|
|
|
}
|
|
/// <summary>
|
|
/// 新增
|
|
/// </summary>
|
|
/// <param name="ICSASN"></param>
|
|
/// <returns></returns>
|
|
|
|
[HttpPost]
|
|
[HandlerAjaxOnly]
|
|
public ActionResult SaveICSOApplyApplyNeg(string ICSASN)
|
|
{
|
|
|
|
string msg = App.SaveICSOApplyApplyNeg(ICSASN);
|
|
if (!string.IsNullOrEmpty(msg))
|
|
{
|
|
return Error(msg);
|
|
}
|
|
else
|
|
{
|
|
return Success("添加成功!");
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 修改
|
|
/// </summary>
|
|
/// <param name="ICSASN"></param>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
[HandlerAjaxOnly]
|
|
public ActionResult UpdateICSOApplyApplyNeg(string ICSASN)
|
|
{
|
|
|
|
string msg = App.UpdateICSOApplyApplyNeg(ICSASN);
|
|
if (!string.IsNullOrEmpty(msg))
|
|
{
|
|
return Error(msg);
|
|
}
|
|
else
|
|
{
|
|
return Success("修改成功!");
|
|
}
|
|
|
|
}
|
|
|
|
//库位导入
|
|
[HttpPost]
|
|
/// <summary>
|
|
/// 文件上传到本地
|
|
/// </summary>
|
|
public string UploadFile()
|
|
{
|
|
try
|
|
{
|
|
HttpFileCollection hpFiles = System.Web.HttpContext.Current.Request.Files;
|
|
if (hpFiles != null && hpFiles.Count > 0)
|
|
{
|
|
|
|
string IsXls = System.IO.Path.GetExtension(hpFiles[0].FileName).ToString().ToLower();//System.IO.Path.GetExtension获得文件的扩展名
|
|
if (IsXls != ".xls" && IsXls != ".xlsx")
|
|
{
|
|
|
|
return "只可以选择Excel(.xls .xlsx)文件";//当选择的不是Excel文件时,返回
|
|
}
|
|
string filename = DateTime.Now.ToString("yyyyMMddhhmmss") + Guid.NewGuid() + IsXls; //获取Execle文件名 DateTime日期函数
|
|
string savePath = System.Web.HttpContext.Current.Server.MapPath("~\\File\\UPLoadFile\\" + filename);//Server.MapPath 获得虚拟服务器相对路径
|
|
|
|
int iLen = hpFiles[0].ContentLength;
|
|
if (Directory.Exists(savePath)) return "文件已存在";
|
|
byte[] bData = new byte[iLen];
|
|
hpFiles[0].InputStream.Read(bData, 0, iLen);
|
|
|
|
|
|
FileStream newFile = new FileStream(savePath, FileMode.OpenOrCreate);
|
|
newFile.Write(bData, 0, bData.Length);
|
|
newFile.Flush();
|
|
int _FileSizeTemp = hpFiles[0].ContentLength;
|
|
|
|
newFile.Close();
|
|
newFile.Dispose();
|
|
//bool del = false;
|
|
string mess = "";
|
|
mess = App.SetData_PR(savePath);
|
|
if (System.IO.File.Exists(savePath))//删除文件
|
|
{
|
|
|
|
System.IO.File.Delete(savePath);
|
|
}
|
|
return mess;
|
|
|
|
}
|
|
else
|
|
{
|
|
return "获取文件失败";
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
|
|
return ex.ToString();
|
|
}
|
|
}
|
|
|
|
//导出
|
|
[HttpPost]
|
|
public void ExportAll(string keyValue)
|
|
{
|
|
DataTable dt = App.GetASNListExport();
|
|
AsposeCell.Export(dt);
|
|
}
|
|
}
|
|
}
|