using Estsh.Core.Model.Result; using Microsoft.AspNetCore.Mvc; using Estsh.Core.Models; using Estsh.Core.Controllers; using System.Collections; using Estsh.Core.Util; using Estsh.Core.Services.IServices; using Microsoft.AspNetCore.Authorization; namespace Estsh.Core.Web.Controllers { public class KanBanController : BaseController { private IKanBanService service; private IFinishedInventoryQueryService inventoryQueryService; public KanBanController(IKanBanService _service, IFinishedInventoryQueryService _inventoryQueryService) { service = _service; inventoryQueryService = _inventoryQueryService; } [AllowAnonymous] public IActionResult CarLogin() { //int factoryId = CurrentEmp.FactoryId; //List wmsCarArrives = this.service.GetCarArriveList(); string s_date = DateTime.Now.ToString("yyyyMMdd"); List wmsCarArrives = this.service.GetCarInDoor(s_date); foreach (var item in wmsCarArrives) { item.PlanArriveTime = item.PlanArriveTime.PadRight(14, '0'); item.PlanArriveTime = item.PlanArriveTime.Substring(0, 4) + "-" + item.PlanArriveTime.Substring(4, 2) + "-" + item.PlanArriveTime.Substring(6, 2) + " " + item.PlanArriveTime.Substring(8, 2) + ":" + item.PlanArriveTime.Substring(10, 2) + ":" + item.PlanArriveTime.Substring(12); } wmsCarArrives = wmsCarArrives.Where(a => (Convert.ToDateTime(a.PlanArriveTime) > DateTime.Now || a.CarInPlantStatus > 10) && a.Passageway != null && a.CarInPlantStatus != 60).OrderBy(b => b.Passageway).ToList(); List PassagewayList = wmsCarArrives.GroupBy(a => a.Passageway).Select(b => new WmsCarArrive { Passageway = b.Key, CarDesc = b.Count().ToString() }).ToList(); Dictionary> ShowList = new Dictionary>(); for (int i = 0; i < PassagewayList.Count; i++) { List carArrives = wmsCarArrives.Where(a => a.Passageway == PassagewayList[i].Passageway).ToList(); List list = new List(); for (int j = 0; j < 5; j++) { if (carArrives.Count > j) { WmsCarArrive wmsCarArrive = new WmsCarArrive(); wmsCarArrive.SupplierName = carArrives[j].SupplierName; wmsCarArrive.EnumName = carArrives[j].EnumName; wmsCarArrive.RealInPlantTime = carArrives[j].RealInPlantTime; list.Add(wmsCarArrive); } else { WmsCarArrive wmsCarArrive = new WmsCarArrive(); wmsCarArrive.SupplierName = ""; wmsCarArrive.EnumName = ""; wmsCarArrive.RealInPlantTime = ""; list.Add(wmsCarArrive); } } ShowList.Add(PassagewayList[i].Passageway, list); } ViewData["list"] = ShowList; return View("CarLogin"); } [AllowAnonymous] public ActionResult getCarManagerListByPage(string supplierName, string txtStartTime, string txtEndTime, Pager pager, String direction, String sort, string enabled = "Y") { Hashtable result = new Hashtable(); string s_date = DateTime.Now.ToString("yyyyMMdd"); List wmsCarArrives = this.service.GetCarInDoor(s_date); foreach (var item in wmsCarArrives) { item.PlanArriveTime = item.PlanArriveTime.PadRight(14, '0'); item.PlanArriveTime = item.PlanArriveTime.Substring(0, 4) + "-" + item.PlanArriveTime.Substring(4, 2) + "-" + item.PlanArriveTime.Substring(6, 2) + " " + item.PlanArriveTime.Substring(8, 2) + ":" + item.PlanArriveTime.Substring(10, 2) + ":" + item.PlanArriveTime.Substring(12); } wmsCarArrives = wmsCarArrives.Where(a => Convert.ToDateTime(a.PlanArriveTime) < DateTime.Now && a.ArriveStatus == 0).ToList(); result.Add("rows", wmsCarArrives); return Json(result); } [AllowAnonymous] public IActionResult ReceiptBoard() { List wmsSysVendor = this.service.Getdock(); ViewData["dock"] = wmsSysVendor; return View(); } /// /// 收货看板 /// /// /// [AllowAnonymous] public IActionResult ReceiptList(string dock, Pager pager, String direction, String sort, string enabled = "Y") { Hashtable result = new Hashtable(); if (dock == "undefined" || dock == null) { List wmsCarArrives = this.service.GetCarArriveList(enabled, pager, direction, sort); result.Add("rows", wmsCarArrives); result.Add("pager.totalRows", wmsCarArrives.Count); } else { string docks = "'" + dock.Replace(",", "','") + "'"; List wmsCarArrives = this.service.GetCarArriveList(docks, enabled, pager, direction, sort); //List Receive = wmsCarArrives.Where(a => a.RealScanReceiveTime != null).ToList(); result.Add("rows", wmsCarArrives); result.Add("pager.totalRows", wmsCarArrives.Count); } return Json(result); } [AllowAnonymous] public IActionResult ReceiveSum(string dock) { Hashtable result = new Hashtable(); if (dock == "undefined" || dock == null) { } else { string docks = "'" + dock.Replace(",", "','") + "'"; List wmsCarArrives = this.service.GetCarArriveTotal(docks); List Receive = wmsCarArrives.Where(a => a.RealScanReceiveTime != null).ToList(); result.Add("total", wmsCarArrives.Count()); result.Add("ReceiveSum", Receive.Count()); } return Json(result); } /// /// 扫道口码,由准入30 变更为 作业中40 /// /// /// public ActionResult UpdateReceipt40(string dockName) { int ht = this.service.UpdateReceipt40(dockName); return View(); } /// /// 配料看板 /// /// [AllowAnonymous] public IActionResult Preparation() { return View(); } [AllowAnonymous] public IActionResult Preparation2(string flootString) { Hashtable result = new Hashtable(); List WmsMoveHeader = this.service.GetPreparation(); List entities = new List(); for (int i = 0; i < WmsMoveHeader.Count; i++) { string DestZoneName = WmsMoveHeader[i].DestZoneName; string[] locateString = DestZoneName.Split('-'); if (locateString.Length > 0) { string floors = locateString[1]; string floor = floors.Substring(1); int area = Convert.ToInt32(locateString[2]); string areaString = DestZoneName; // service.Getarea(area); //数字转字母 decimal qty = Convert.ToDecimal(WmsMoveHeader[i].Qty); decimal pickqty = Convert.ToDecimal(WmsMoveHeader[i].PickQty); string bfb = String.Empty; if (pickqty == 0) { bfb = "0.00%"; } if (qty == 0) { bfb = "0.00%"; } else { bfb = (pickqty / qty).ToString("0.00%"); } string orderNo = WmsMoveHeader[i].OrderNo; string createtime = WmsMoveHeader[i].CreateTime; string zonDesc = WmsMoveHeader[i].zoneDesc; if (floor == flootString) { KanBanEntity entity = new KanBanEntity(); entity.OrderNo = orderNo; entity.DestArea = areaString; entity.Ratio = bfb; entity.InfoType = floor; entity.createtime = createtime; entity.zoneDesc = zonDesc; entities.Add(entity); } } } result.Add("rows", entities); return Json(result); } [AllowAnonymous] public IActionResult Preparation3() { Hashtable result = new Hashtable(); List WmsMoveHeader = this.service.GetPreparation(); List entities = new List(); for (int i = 0; i < WmsMoveHeader.Count; i++) { string DestZoneName = WmsMoveHeader[i].DestZoneName; string[] locateString = DestZoneName.Split('-'); if (locateString.Length > 0) { string floors = locateString[1]; string floor = floors.Substring(1); int area = Convert.ToInt32(locateString[2]); string areaString = service.Getarea(area); decimal qty = Convert.ToDecimal(WmsMoveHeader[i].Qty); decimal pickqty = Convert.ToDecimal(WmsMoveHeader[i].PickQty); string bfb = String.Empty; if (pickqty == 0) { bfb = "0.00%"; } if (qty == 0) { bfb = "0.00%"; } else { bfb = (pickqty / qty).ToString("0.00%"); } string orderNo = WmsMoveHeader[i].OrderNo; string createtime = WmsMoveHeader[i].CreateTime; if (floor == "3") { KanBanEntity entity = new KanBanEntity(); entity.OrderNo = orderNo; entity.DestArea = areaString; entity.Ratio = bfb; entity.InfoType = floor; entities.Add(entity); } } } result.Add("rows", entities); return Json(result); } [AllowAnonymous] public IActionResult Preparation4() { Hashtable result = new Hashtable(); List WmsMoveHeader = this.service.GetPreparation(); List entities = new List(); for (int i = 0; i < WmsMoveHeader.Count; i++) { string DestZoneName = WmsMoveHeader[i].DestZoneName; string[] locateString = DestZoneName.Split('-'); if (locateString.Length > 0) { string floors = locateString[1]; string floor = floors.Substring(1); int area = Convert.ToInt32(locateString[2]); string areaString = service.Getarea(area); decimal qty = Convert.ToDecimal(WmsMoveHeader[i].Qty); decimal pickqty = Convert.ToDecimal(WmsMoveHeader[i].PickQty); string bfb = String.Empty; if (pickqty == 0) { bfb = "0.00%"; } if (qty == 0) { bfb = "0.00%"; } else { bfb = (pickqty / qty).ToString("0.00%"); } string orderNo = WmsMoveHeader[i].OrderNo; string createtime = WmsMoveHeader[i].CreateTime; if (floor == "4") { KanBanEntity entity = new KanBanEntity(); entity.OrderNo = orderNo; entity.DestArea = areaString; entity.Ratio = bfb; entity.InfoType = floor; entities.Add(entity); } } } result.Add("rows", entities); return Json(result); } /// /// 物料拉动看板 /// /// [AllowAnonymous] public IActionResult MaterialPulling() { return View(); } /// /// 成品下线库存查询 /// /// [AllowAnonymous] public IActionResult FinishedProductOffLine() { return View(); } /// /// 根据分页条件获取用户列表 /// /// /// /// /// /// [AllowAnonymous] public ActionResult getListByPage(string mtoc, Pager pager, String direction, String sort, string enabled = "Y") { Hashtable result = new Hashtable(); Hashtable dataHt = this.inventoryQueryService.getListByPage(mtoc, enabled, pager, direction, sort); result.Add("rows", dataHt["dataList"]); result.Add("pager.totalRows", dataHt["totalCount"]); return Json(result); } [AllowAnonymous] public ActionResult MaterialgetListByPage(Pager pager, String direction, String sort, string enabled = "Y") { Hashtable result = new Hashtable(); Hashtable dataHt = this.service.MaterialgetListByPage(enabled, pager, direction, sort); List WmsMoveHeader = dataHt["dataList"] as List; List entities = new List(); for (int i = 0; i < WmsMoveHeader.Count; i++) { string DestZoneName = WmsMoveHeader[i].DestZoneName; //string[] locateString = DestZoneName.Split('-'); if (DestZoneName.Length > 0) { //string floors = locateString[1]; //string floor = floors.Substring(1); //int area = Convert.ToInt32(locateString[2]); string areaString = DestZoneName; // service.Getarea(area); //数字转字母 decimal qty = Convert.ToDecimal(WmsMoveHeader[i].Qty); decimal pickqty = Convert.ToDecimal(WmsMoveHeader[i].PickQty); string bfb = String.Empty; if (pickqty == 0) { bfb = "0.00%"; } if (qty == 0) { bfb = "0.00%"; } else { bfb = (pickqty / qty).ToString("0.00%"); } string orderNo = WmsMoveHeader[i].OrderNo; string createtime = WmsMoveHeader[i].CreateTime; string zonDesc = WmsMoveHeader[i].zoneDesc; KanBanEntity entity = new KanBanEntity(); entity.OrderNo = orderNo; entity.DestArea = areaString; entity.Ratio = bfb; entity.InfoType = ""; entity.createtime = createtime; entity.zoneDesc = zonDesc; entities.Add(entity); } } result.Add("rows", entities); //result.Add("rows", dataHt["dataList"]); result.Add("pager.totalRows", dataHt["totalCount"]); return Json(result); } } }