From 48d66a079c307356997fb400d27907ff6d363b7b Mon Sep 17 00:00:00 2001 From: liudl <673013083@qq.com> Date: 星期一, 20 一月 2025 08:35:37 +0800 Subject: [PATCH] 修改2楼分拣和1楼拆垛时获取拆垛信息接口 --- Admin.NET/WCS.Application/PLC/PLCService.cs | 19 +++++---- Admin.NET/WCS.Application/OpenApi/DemoOpenApi.cs | 49 +++++++++++++++--------- Admin.NET/WCS.Application/Util/HttpService.cs | 1 Admin.NET/WCS.Application/PLC/PLCCommon.cs | 4 +- Admin.NET/WCS.Application/PLC/PLCTaskAction.cs | 2 Admin.NET/WCS.Application/Entity/WcsBoxInfoLog.cs | 8 +++ Admin.NET/WCS.Application/Model/TaskRequest.cs | 24 +++++++++++- 7 files changed, 74 insertions(+), 33 deletions(-) diff --git a/Admin.NET/WCS.Application/Entity/WcsBoxInfoLog.cs b/Admin.NET/WCS.Application/Entity/WcsBoxInfoLog.cs index 5d46e23..4af5222 100644 --- a/Admin.NET/WCS.Application/Entity/WcsBoxInfoLog.cs +++ b/Admin.NET/WCS.Application/Entity/WcsBoxInfoLog.cs @@ -121,5 +121,11 @@ /// </summary> [SugarColumn(ColumnName = "Level", ColumnDescription = "鍖呰绾у埆", Length = 3)] public string? Level { get; set; } - + + /// <summary> + /// 鍖呰鏁伴噺 + /// </summary> + [SugarColumn(ColumnName = "QtyCount", ColumnDescription = "鍖呰鏁伴噺", Length = 3)] + public int? QtyCount { get; set; } + } diff --git a/Admin.NET/WCS.Application/Model/TaskRequest.cs b/Admin.NET/WCS.Application/Model/TaskRequest.cs index 399ae21..5d2af81 100644 --- a/Admin.NET/WCS.Application/Model/TaskRequest.cs +++ b/Admin.NET/WCS.Application/Model/TaskRequest.cs @@ -483,9 +483,9 @@ public class RequestBoxInfoCheckAll { - public string Success { get; set; } + public int Success { get; set; } public string Message { get; set; } - public List<RequestBoxInfoCheck> list { get; set; } + public List<RequestBoxInfoCheck> data { get; set; } } public class RequestBoxInfoCheck { @@ -545,3 +545,23 @@ /// </summary> public string loadingAddre { get; set; } } +public class FumaJiepiModel +{ + /// <summary> + /// 鐗╂枡缂栫爜 + /// </summary> + public string SkuNo { get; set; } + /// <summary> + /// 鐗╂枡鍚嶇О + /// </summary> + public string SkuName { get; set; } + /// <summary> + /// 鎵规鍙� + /// </summary> + public string LotNo { get; set; } + /// <summary> + /// 瀹屽伐鏁伴噺 + /// </summary> + public string FinishQty { get; set; } + +} diff --git a/Admin.NET/WCS.Application/OpenApi/DemoOpenApi.cs b/Admin.NET/WCS.Application/OpenApi/DemoOpenApi.cs index e3d0acf..67583ce 100644 --- a/Admin.NET/WCS.Application/OpenApi/DemoOpenApi.cs +++ b/Admin.NET/WCS.Application/OpenApi/DemoOpenApi.cs @@ -1,4 +1,5 @@ -锘縰sing DocumentFormat.OpenXml.Presentation; +锘縰sing Dm.filter; +using DocumentFormat.OpenXml.Presentation; using Elastic.Clients.Elasticsearch; using Furion.Logging; using Newtonsoft.Json; @@ -178,6 +179,7 @@ Qty = item.Qty, TaskType = (TaskTypeEnum)item.TaskType, CreateTime = DateTime.Now, + Status = TaskStatusEnum.Wait, }; _db.Insertable(orderAdd).ExecuteCommand(); //} @@ -350,34 +352,45 @@ /// <summary> /// WCS鎺ュ彈璧嬬爜绯荤粺鎺ㄩ�佺殑缁撴壒鎬绘暟閲� /// </summary> - /// <param name="models">绠辩爜淇℃伅</param> + /// <param name="models">缁撴壒鏁伴噺淇℃伅</param> /// <returns>鍙嶉淇℃伅</returns> [HttpPost] [AllowAnonymous] - public ResponseFuMaModel HttpTotalNum(FumaBoxInfoInput models) + public ResponseFuMaModel HttpTotalNum(FumaJiepiModel models) { try { string str = JsonConvert.SerializeObject(models); - Log.Information("鎺ユ敹璧嬬爜鎺ㄩ�佺殑缁撴壒鎬绘暟閲忥細" + str); - var num = _db.Queryable<WcsBoxInfo>().Where(m => m.BoxNo == models.BoxNo && m.IsDelete == false).ToList(); - if (num.Count > 0) + Log.Information("鎺ユ敹璧嬬爜鎺ㄩ�佺殑瀹屽伐缁撴壒鎬绘暟閲忥細" + str); + //鏌ョ湅璧嬬爜涓嬪彂鐨勪换鍔′俊鎭槸鍚︽鍦ㄥ垎鎷� + var num = _db.Queryable<WcsCheckTask>().Where(m => m.SkuNo == models.SkuNo &&m.LotNo == models.LotNo && m.Status == "1").ToList(); + if (num.Count < 1) { - //WCS瀛樺湪绠辩爜淇℃伅锛屾洿鏂扮鐮佷俊鎭�(闇�鍒ゆ柇绠辩爜鏄惁宸茬粍鐩樺叆搴�) - var num2 = num.Count(m => m.Status != "0" || !string.IsNullOrWhiteSpace(m.PalletNo)); - if (num2 > 0) - { - throw new Exception("璇ョ宸茬洏鍏ュ簱锛屼笉鍙洿鏂颁俊鎭�"); - } - } - if (num.Count == 0) - { - throw new Exception("鏈壘鍒拌绠辩爜锛岀鐮佺Щ闄ゅけ璐ワ紒"); + return new ResponseFuMaModel() { Success = "-1", Message = "璇ユ壒娆℃湭杩涜鍒嗘嫞鎴栧凡缁撴壒" }; } - _db.Deleteable(num).ExecuteCommand(); - return new ResponseFuMaModel() { Success = "0", Message = "绉婚櫎绠辩爜鎴愬姛" }; + //鑾峰彇鍖呰鏁伴噺 + int Fqty = int.Parse(models.FinishQty); + var boxinfolog = _db.Queryable<WcsBoxInfoLog>().Where(m => m.SkuNo == models.SkuNo && m.LotNo == models.LotNo && m.BitBoxMark == "0").First(); + if (boxinfolog == null) + { + var boxinfo = _db.Queryable<WcsBoxInfo>().Where(m => m.SkuNo == models.SkuNo && m.LotNo == models.LotNo && m.BitBoxMark == "0").First(); + Fqty = (int)(Fqty /boxinfo.QtyCount); + } + else + { + Fqty = (int)(Fqty / boxinfolog.QtyCount); + } + + //鍐欏叆璇ヤ换鍔″畬鎴愭暟閲� + foreach (var item in num) + { + item.FinishQty = Fqty; + } + _db.Updateable(num).ExecuteCommand(); + + return new ResponseFuMaModel() { Success = "0", Message = "鎺ュ彈瀹屽伐缁撴壒鏁伴噺鎴愬姛" }; } catch (Exception ex) { diff --git a/Admin.NET/WCS.Application/PLC/PLCCommon.cs b/Admin.NET/WCS.Application/PLC/PLCCommon.cs index b862c2c..b1be205 100644 --- a/Admin.NET/WCS.Application/PLC/PLCCommon.cs +++ b/Admin.NET/WCS.Application/PLC/PLCCommon.cs @@ -24,7 +24,7 @@ public static PlcTaskInfo GetCTaskInfo(string endLocat,string taskType,string roadWay,string endRoadWay) { // 鍚勫眰杈撻�佺嚎璺烘満鏀捐揣宸ヤ綅闆嗗悎 - var conveyList1 = new List<string>() { "033", "039", "044", "051", "059" }; + var conveyList1 = new List<string>() { "033", "039", "044", "051", "059","009" }; var conveyList2 = new List<string>() { "205", "234" }; var conveyList3 = new List<string>() { "440", "443" }; @@ -330,7 +330,7 @@ { startStation = startStation.PadLeft(3, '0'); string strIp = ""; - var conveyList1 = new List<string>() { "147", "145", "139", "137", "129", "127", "121", "119", "111", "109", "103", "101", "093", "091", "085", "083", "075", "073", "067", "065","033","039","044" ,"051","059"}; + var conveyList1 = new List<string>() { "147", "145", "139", "137", "129", "127", "121", "119", "111", "109", "103", "101", "093", "091", "085", "083", "075", "073", "067", "065","033","039","044" ,"051","059","009"}; var conveyList2 = new List<string>() { "205", "234", "252", "254", "260", "262", "270", "272", "278", "280", "288", "290", "294", "301", "307", "309", "315", "317", "325", "327", "331", "337" }; var conveyList3 = new List<string>() { "401", "402", "405", "406", "409", "410", "413", "414", "417", "418", "421", "422", "425", "426", "429", "430", "433", "434", "437", "438", "440", "443" }; if (conveyList1.Contains(startStation)) diff --git a/Admin.NET/WCS.Application/PLC/PLCService.cs b/Admin.NET/WCS.Application/PLC/PLCService.cs index 11c55a9..e563b98 100644 --- a/Admin.NET/WCS.Application/PLC/PLCService.cs +++ b/Admin.NET/WCS.Application/PLC/PLCService.cs @@ -2237,6 +2237,7 @@ } var rowCount = _db.Updateable(boxInfo).ExecuteCommand(); + Log.Information(string.Format("鎻掔爜鎴愬姛锛岀鐮佹槸锛�"+ boxNo, modDevice.StationNum)); if (rowCount > 0) { // 鎻掔爜鎴愬姛 @@ -2381,12 +2382,12 @@ } break; } + // 缁勬墭鎴愬姛鍚庡皢淇℃伅瀛樺埌log琛� string sqlStr = $"insert into WCSBoxInfoLog select * from WCSBoxInfo where IsDelete=0 and PalletNo='{palletNo}'"; int insertCount = _db.Ado.ExecuteCommand(sqlStr); if (insertCount > 0) { - // 缁勬墭鎴愬姛鍚庡皢淇℃伅瀛樺埌log琛� - string sqlStr2 = $"delete from WCSBoxInfoLog where IsDelete=0 and PalletNo='{palletNo}'"; + string sqlStr2 = $"delete from WCSBoxInfo where IsDelete=0 and PalletNo='{palletNo}'"; _db.Ado.ExecuteCommand(sqlStr2); } @@ -2487,7 +2488,7 @@ private static void StackingRobot(WcsDeviceDto modDevice) { var plcConn = modDevice.PLCUtil; - if (modDevice.DbNumber == "DB131" && modDevice.DbNumber == "DB132" && modDevice.DbNumber == "DB133" && modDevice.DbNumber == "DB134") + if (modDevice.DbNumber == "DB131" || modDevice.DbNumber == "DB132" || modDevice.DbNumber == "DB133" || modDevice.DbNumber == "DB134") { switch (modDevice.Value.ToString()) { @@ -2507,7 +2508,7 @@ // 鏍规嵁浠诲姟鍙疯幏鍙栦换鍔′俊鎭� if (res1.IsSucceed) { - var modTask = _db.Queryable<WcsTask>().First(m => m.Status == TaskStatusEnum.Doing && m.TaskNo == tasknoVal && m.EndLocate == "009" && m.IsDelete == false); + var modTask = _db.Queryable<WcsTask>().First(m => m.TaskNo == tasknoVal && m.EndLocate == "009" && m.IsDelete == false); if (modTask == null) { Log.Error(string.Format($"鍑哄簱浠诲姟鏈笅鍙戯紝璇蜂汉宸ュ鐞嗭紝鏃犳硶鎷嗗灈锛�")); @@ -2517,22 +2518,22 @@ //閫氳繃浠诲姟鍙峰拰鎵樼洏鍙峰悜WMS鐢宠姝ゆ墭鐩樼殑鎷嗗灈淇℃伅 var http = new HttpService(); RequestBoxInfoCheckAll tasklist = http.RequestBoxCheckinfo(palletVal, tasknoVal); - if (!tasklist.Success.Contains("-1")) + if (tasklist.Success != -1) { //鑾峰彇鎷嗗灈鐗╂枡鍝佺(闇�瑕佸鍔犵墿鏂欏垽鏂紝鍚屼竴涓墿鏂欏彿鍙兘浼氬嚭鐜颁笉鍚岀殑鐮佸灈瑙勫垯) - var pz = _db.Queryable<WcsMateialPzInfo>().First(m => m.SkuNo == tasklist.list[0].SkuNo); + var pz = _db.Queryable<WcsMateialPzInfo>().First(m => m.SkuNo == tasklist.data[0].SkuNo); //涓嬪彂鎷嗘墭瑙勬牸锛屾媶绠辨暟鍜屾墭鐩樹笂鎬荤鏁帮紙涓嶇粦瀹氭満鍣ㄤ汉锛屾媶鍨涗换鍔′俊鎭彧涓嬪彂涓�娆★級 // 缁橮LC鍐欏叆浠诲姟鏁版嵁 var listResult = new List<Result>(); // 鑾峰彇鎵樼洏瑙勫垯 var Standard = modDevice.listStation.FirstOrDefault(m => m.Text == "瑙勬牸"); - listResult.Add(plcConn.SetPlcDBValue(Standard.PosType, modDevice.DbNumber, Standard.PlcPos, tasklist.list[0].Standard)); + listResult.Add(plcConn.SetPlcDBValue(Standard.PosType, modDevice.DbNumber, Standard.PlcPos, pz.PZNo)); //鎶撶鏁� var qty = modDevice.listStation.FirstOrDefault(m => m.Text == "鎷嗙鏁伴噺"); - listResult.Add(plcConn.SetPlcDBValue(qty.PosType, modDevice.DbNumber, qty.PlcPos, tasklist.list[0].Qty.ToString())); + listResult.Add(plcConn.SetPlcDBValue(qty.PosType, modDevice.DbNumber, qty.PlcPos, tasklist.data[0].Qty.ToString())); //鎬荤鏁� var qtycount = modDevice.listStation.FirstOrDefault(m => m.Text == "鎬荤鏁�"); - listResult.Add(plcConn.SetPlcDBValue(qtycount.PosType, modDevice.DbNumber, qtycount.PlcPos, tasklist.list[0].QtyCount.ToString())); + listResult.Add(plcConn.SetPlcDBValue(qtycount.PosType, modDevice.DbNumber, qtycount.PlcPos, tasklist.data[0].QtyCount.ToString())); // 鏄惁鍐欏叆鎴愬姛 diff --git a/Admin.NET/WCS.Application/PLC/PLCTaskAction.cs b/Admin.NET/WCS.Application/PLC/PLCTaskAction.cs index 451a68d..311e7ce 100644 --- a/Admin.NET/WCS.Application/PLC/PLCTaskAction.cs +++ b/Admin.NET/WCS.Application/PLC/PLCTaskAction.cs @@ -72,7 +72,7 @@ // var strMsg = new HttpService().RequestPackWcs("LN000001"); cts.Cancel(); listPlc = _db.Queryable<WcsPlc>() - .Where(s => s.Type == PLCTypeEnum.StackingMachine || s.Type == PLCTypeEnum.ConveyorLine || s.Type == PLCTypeEnum.BoxConveyorLine) + .Where(s => s.Type == PLCTypeEnum.StackingMachine || s.Type == PLCTypeEnum.ConveyorLine || s.Type == PLCTypeEnum.BoxConveyorLine || s.Type == PLCTypeEnum.StackingRobot) .Where(s => s.Enable == YesNoEnum.Y) .ToList(); listPlcDevice = _db.Queryable<WcsDevice>().ToList(); diff --git a/Admin.NET/WCS.Application/Util/HttpService.cs b/Admin.NET/WCS.Application/Util/HttpService.cs index 2b7e7dd..fde3f28 100644 --- a/Admin.NET/WCS.Application/Util/HttpService.cs +++ b/Admin.NET/WCS.Application/Util/HttpService.cs @@ -137,6 +137,7 @@ _db.Insertable(taskAdd).ExecuteCommand(); endLocat = result.TaskList.EndRoadway; returnStr = result.TaskList.EndLocate; + taskNo = result.TaskList.TaskNo; } else { -- Gitblit v1.8.0