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(); } public ActionResult ICSMOPickMergeSeach() { return View(); } //[HttpGet] //[HandlerAjaxOnly] public ActionResult GetGridJson(Pagination pagination, string queryJson, string Type) { DataTable ListData = new DataTable(); if (Type == "1")//工单1 { ListData = App.GetGridJson(queryJson, ref pagination); } if (Type=="2")//工单发料 { ListData = App.GetGridJson2(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); } if (Type == "12")//补料 { ListData = App.GetGridJson12(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(string Code, string Type, string Mechanism, string InvCode, Pagination pagination) { DataTable ListData = new DataTable(); if (Type == "1") { ListData = App.GetSubGridJson1(Code, Mechanism, InvCode, ref pagination); }//工单 if (Type == "2") { ListData = App.GetSubGridJson2(Code, InvCode, ref pagination); }//工单发料 if (Type == "3") { ListData = App.GetSubGridJson3(Code, InvCode, ref pagination); }//材料出库 if (Type == "4") { ListData = App.GetSubGridJson4(Code, InvCode, ref pagination); }//委外备料 if (Type == "5") { ListData = App.GetSubGridJson5(Code, InvCode, ref pagination); }//委外领料 if (Type == "6") { ListData = App.GetSubGridJson6(Code, InvCode, ref pagination); }//委外材料出库 if (Type == "7") { ListData = App.GetSubGridJson7(Code, InvCode, ref pagination); }//销售发货 if (Type == "8") { ListData = App.GetSubGridJson8(Code, InvCode, ref pagination); }//其它出库 if (Type == "9") { ListData = App.GetSubGridJson9(Code, InvCode, ref pagination); }//借用单 if (Type == "10") { ListData = App.GetSubGridJson10(Code, InvCode, ref pagination); }//物料调拨 if (Type == "11") { ListData = App.GetSubGridJson11(Code, InvCode, ref pagination); }//两步调出 if (Type == "12") { ListData = App.GetSubGridJson12(Code, InvCode, ref pagination); }//补料 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,string Mechanism,string InvCode) { DataTable ListData = new DataTable(); if (flag=="1") { ListData = App.GetICSMOPickMergeTemp(ID, Type, Mechanism, InvCode); } else { ListData = App.GetICSMOPickMergeTemp2(ID, Type, Mechanism, InvCode); } var JsonData = new { total = pagination.total, page = pagination.page, records = pagination.records, rows = ListData, }; 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 BackMergeMaterial(string keyValue, string Type) { string msg = App.BackMergeMaterial(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()); } public ActionResult GetPickingListType() { string sql = @"select b.F_ItemCode as Code ,b.F_ItemName as Name from Sys_SRM_Items a left join Sys_SRM_ItemsDetail b on a.F_Id=b.F_ItemId where a.F_EnCode='PL00001' order by cast(b.F_SortCode as int) asc"; DataTable ListData = SqlHelper.GetDataTableBySql(sql); return Content(ListData.ToJson()); } [HttpPost] [HandlerAjaxOnly] public ActionResult SaveSeizeMaterial(string ID,string flag,string Type,string LotNoInfo,string obj) { string msg = string.Empty; if (flag=="1") { msg = App.SaveSeizeMaterial(ID, Type, LotNoInfo, obj); } else { msg = App.SaveSeizeMaterial2(ID, Type, LotNoInfo,obj); } if (!string.IsNullOrEmpty(msg)) { return Error(msg); } else { return Success("添加成功!"); } } [HttpPost] public ActionResult SeachPickingListType(string Type) { object Falg = App.SeachPickingListType(Type); var JsonData = new { count = Falg }; return Content(JsonData.ToJson()); } //查询占料 public ActionResult GetGridJsonSeizeM(Pagination pagination, string queryJson, string Type) { DataTable ListData = new DataTable(); if (Type == "1")//工单 { ListData = App.GetGridJsonSeizeM(queryJson, ref pagination); } if (Type == "2")//工单发料 { ListData = App.GetGridJsonSeizeM2(queryJson, ref pagination); } if (Type == "3")//工单材料出库 { ListData = App.GetGridJsonSeizeM3(queryJson, ref pagination); } if (Type == "4")//委外备料 { ListData = App.GetGridJsonSeizeM4(queryJson, ref pagination); } if (Type == "5")//委外领料 { ListData = App.GetGridJsonSeizeM5(queryJson, ref pagination); } if (Type == "6")//委外材料出库 { ListData = App.GetGridJsonSeizeM6(queryJson, ref pagination); } if (Type == "7")//销售发货 { ListData = App.GetGridJsonSeizeM7(queryJson, ref pagination); } if (Type == "8")//其它出库 { ListData = App.GetGridJsonSeizeM8(queryJson, ref pagination); } if (Type == "9")//借用单 { ListData = App.GetGridJsonSeizeM9(queryJson, ref pagination); } if (Type == "10")//物料调拨 { ListData = App.GetGridJsonSeizeM10(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 GetSubGridJsonSeizeM(string Code, string Type, Pagination pagination) { DataTable ListData = new DataTable(); if (Type == "1") { ListData = App.GetSubGridJsonSeizeM1(Code, ref pagination); }//工单 if (Type == "2") { ListData = App.GetSubGridJsonSeizeM2(Code, ref pagination); }//工单发料 if (Type == "3") { ListData = App.GetSubGridJsonSeizeM3(Code, ref pagination); }//材料出库 if (Type == "4") { ListData = App.GetSubGridJsonSeizeM4(Code, ref pagination); }//委外备料 if (Type == "5") { ListData = App.GetSubGridJsonSeizeM5(Code, ref pagination); }//委外领料 if (Type == "6") { ListData = App.GetSubGridJsonSeizeM6(Code, ref pagination); }//委外材料出库 if (Type == "7") { ListData = App.GetSubGridJsonSeizeM7(Code, ref pagination); }//销售发货 if (Type == "8") { ListData = App.GetSubGridJsonSeizeM8(Code, ref pagination); }//其它出库 if (Type == "9") { ListData = App.GetSubGridJsonSeizeM9(Code, ref pagination); }//借用单 if (Type == "10") { ListData = App.GetSubGridJsonSeizeM10(Code, ref pagination); }//物料调拨 if (Type == "11") { ListData = App.GetSubGridJsonSeizeM11(Code, ref pagination); }//两步调出 var JsonData = new { total = pagination.total, page = pagination.page, records = pagination.records, rows = ListData, }; 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); } } } }