using NFine.Application.WMS; using System; using System.Collections.Generic; using System.Data; using System.IO; using System.Linq; using System.Web; using System.Web.Mvc; using NFine.Code; using System.Data.SqlClient; using NFine.Data.Extensions; using System.Data.OleDb; using System.Configuration; using ICS.Application.Entity; namespace NFine.Web.Areas.WMS.Controllers { public class PickMaterialController : ControllerBase { // GET: WMS/PickMaterial PickMaterialApp App = new PickMaterialApp(); public ActionResult ICSMOPickMerge() { return View(); } [HttpGet] [HandlerAjaxOnly] public ActionResult GetGridJson(Pagination pagination, string queryJson, string Type) { DataTable ListData = new DataTable(); if (Type == "1")//工单 { ListData = App.GetGridJson(queryJson, ref pagination); } if (Type == "2")//工单发料 { ListData = App.GetGridJson2(queryJson, ref pagination); } if (Type == "12")//售后领料 { ListData = App.GetGridJson12(queryJson, ref pagination); } if (Type == "3")//工单材料出库 { ListData = App.GetGridJson3(queryJson, ref pagination); } if (Type == "4")//委外备料 { ListData = App.GetGridJson4(queryJson, ref pagination); } if (Type == "5")//委外领料 { ListData = App.GetGridJson5(queryJson, ref pagination); } if (Type == "6")//委外材料出库 { ListData = App.GetGridJson6(queryJson, ref pagination); } if (Type == "7")//销售发货 { ListData = App.GetGridJson7(queryJson, ref pagination); } if (Type == "8")//其它出库 { ListData = App.GetGridJson8(queryJson, ref pagination); } if (Type == "9")//借用单 { ListData = App.GetGridJson9(queryJson, ref pagination); } if (Type == "10")//物料调拨 { ListData = App.GetGridJson10(queryJson, ref pagination); } if (Type == "11")//两步调出 { ListData = App.GetGridJson11(queryJson, ref pagination); } var JsonData = new { total = pagination.total, page = pagination.page, records = pagination.records, rows = ListData, }; return Content(JsonData.ToJson()); } //子表查询 [HttpGet] [HandlerAjaxOnly] public ActionResult GetSubGridJson(Pagination pagination, string Code, string queryJson, string Type) { DataTable ListData = new DataTable(); if (Type == "1") { ListData = App.GetSubGridJson1(Code); }//工单 if (Type == "2") { ListData = App.GetSubGridJson2(queryJson, Code, ref pagination); }//工单发料 if (Type == "12") { ListData = App.GetSubGridJson12(queryJson, Code); }//工单发料 if (Type == "3") { ListData = App.GetSubGridJson3(Code); }//材料出库 if (Type == "4") { ListData = App.GetSubGridJson4(Code); }//委外备料 if (Type == "5") { ListData = App.GetSubGridJson5(Code, queryJson, ref pagination); }//委外领料 if (Type == "6") { ListData = App.GetSubGridJson6(Code); }//委外材料出库 if (Type == "7") { ListData = App.GetSubGridJson7(Code, queryJson, ref pagination); }//销售发货 if (Type == "8") { ListData = App.GetSubGridJson8(Code, queryJson, ref pagination); }//其它出库 if (Type == "9") { ListData = App.GetSubGridJson9(Code); }//借用单 if (Type == "10") { ListData = App.GetSubGridJson10(Code, queryJson, ref pagination); }//物料调拨 if (Type == "11") { ListData = App.GetSubGridJson11(Code); }//两步调出 var JsonData = new { total = pagination.total, page = pagination.page, records = pagination.records, rows = ListData, }; return Content(JsonData.ToJson()); } [HttpGet] [HandlerAjaxOnly] public ActionResult GetICSMOPickMergeTemp(Pagination pagination, string ID, string Type, string flag) { try { DataTable ListData = new DataTable(); if (flag == "1") { ListData = App.GetICSMOPickMergeTemp(ID, Type); } else { ListData = App.GetICSMOPickMergeTemp2(ID, Type); } var JsonData = new { total = pagination.total, page = pagination.page, records = pagination.records, rows = ListData, msg="", }; return Content(JsonData.ToJson()); } catch (Exception ex) { var JsonData = new { total = 0, page = 0, records = 0, rows = "", msg=ex.Message, }; return Content(JsonData.ToJson()); } } /// /// 合并拣料的接口 /// /// /// /// [HttpPost] [HandlerAjaxOnly] public ActionResult MergeMaterial(string keyValue, string Type) { string msg = App.MergeMaterial(keyValue, Type); if (!string.IsNullOrEmpty(msg)) { return Error(msg); } else { return Success("添加成功!"); } } /// /// 取消合并拣料的接口 /// /// /// /// [HttpPost] [HandlerAjaxOnly] public ActionResult CancelMergeMaterial(string keyValue, string Type) { string msg = App.CancelMergeMaterial(keyValue, Type); if (!string.IsNullOrEmpty(msg)) { return Error(msg); } else { return Success("取消成功!"); } } [HttpPost] public ActionResult CheckQty(string objArr) { string i = App.CheckQty(objArr); var JsonData = new { count = i }; return Content(JsonData.ToJson()); } [HttpPost] [HandlerAjaxOnly] [ValidateAntiForgeryToken] public ActionResult DelPickLog(string objCode) { string msg = App.DelPickLog(objCode); if (string.IsNullOrEmpty(msg)) { return Success("取消占料成功!"); } else { return Error(msg); } } [HttpPost] public ActionResult SeachPickLog(string objCode) { string Falg = ""; objCode = objCode.TrimEnd(','); string[] parameters = objCode.Split(','); int parameterCount = parameters.Length; int i = App.SeachPickLog(objCode); if (i == 0) { Falg = "0";//代表全部未占料 } if (i != parameterCount && i != 0) { Falg = "1";//代表有占料跟非占料的 同时存在 } else if (i == parameterCount) { Falg = "2";//代表全部已占料 } var JsonData = new { count = Falg }; return Content(JsonData.ToJson()); } /// /// 记录打印次数 /// /// /// [HttpPost] [HandlerAjaxOnly] public ActionResult PrintCount(string objCode,string type) { try { objCode = objCode.TrimEnd(','); string[] parameters = objCode.Split(','); int parameterCount = parameters.Length; int i = App.PrintCount(objCode, type); if (i > 0) { return Success("记录成功!"); } else { return Error("记录失败!"); } } catch (Exception ex) { return Error(ex.Message); } } [HttpGet] [HandlerAjaxOnly] public ActionResult GetPickLogInfo(Pagination pagination, string ID) { DataTable ListData = new DataTable(); ListData = App.GetPickLogInfo(ID); var JsonData = new { total = pagination.total, page = pagination.page, records = pagination.records, rows = ListData, }; return Content(JsonData.ToJson()); } } }