From 8db84793a19b02df61c8fb9e5d539c57b827da45 Mon Sep 17 00:00:00 2001 From: Administrator <Administrator@DESKTOP-5BIMHQ3> Date: 星期五, 28 六月 2024 16:53:58 +0800 Subject: [PATCH] 修改问题 --- Wms/WMS.BLL/BllTransServer/RcsServer.cs | 83 ++++++++++++++++++++++++++++++----------- 1 files changed, 60 insertions(+), 23 deletions(-) diff --git a/Wms/WMS.BLL/BllTransServer/RcsServer.cs b/Wms/WMS.BLL/BllTransServer/RcsServer.cs index f6e21d9..672a451 100644 --- a/Wms/WMS.BLL/BllTransServer/RcsServer.cs +++ b/Wms/WMS.BLL/BllTransServer/RcsServer.cs @@ -58,7 +58,7 @@ if (obj.Result != "0")//鍙敤锛岀敓鎴愬皬杞︽媺鍑�妗朵换鍔� { //鏌ユ壘鏄惁鏈夌┖浣欒剰妗朵綅 - sql = $"select LocatNo from SysStorageLocat where AreaNo like '%04' and WareHouseNo = wareno and Status = 0"; + sql = $"select LocatNo from SysStorageLocat where AreaNo like '%04' and WareHouseNo = '{house}' and Status = 0"; locat = Db.Ado.SqlQuery<SysStorageLocat>(sql).FirstOrDefault(); if (locat == null) { @@ -75,12 +75,12 @@ Startport = item.LocatNo, Endport = locat.LocatNo, Pallno = item.PalletNo, - Type = "4", + Type = "3", Crtype = "0", Noticedetailno = int.Parse(noticeno), }; CreateLotTask(ztask); - return; + continue; } //涓嬪彂灏忚溅浠诲姟 var task2 = new TaskDetial @@ -117,8 +117,8 @@ } noticeno = ArriveMes.Id.ToString();*/ //鏌ユ壘搴撳瓨涓槸鍚︽湁鍙敤鐨勬鎵规鐨勬贩鏂欐《 - sql= $"select PalletNo,LocatNo from DataStockDetail where a.LotNo = '{pallnetmsg.LotNo}'and AreaNo like '%02' " + - $"and a.WareHouseNo = '{house}' and b.status = '0' order by CompleteTime desc"; + sql= $"select PalletNo,LocatNo from DataStockDetail where LotNo = '{pallnetmsg.LotNo}'and AreaNo like '%02' " + + $"and WareHouseNo = '{house}' and status = '0' order by CompleteTime desc"; pallet = Db.Ado.SqlQuery<DataStockDetail>(sql).FirstOrDefault(); if (pallet == null) { @@ -134,7 +134,7 @@ throw new Exception("鎵规鍙蜂负绌猴紒"); } //鏌ユ壘鏄惁鏈夋鎵规鍑哄簱鍗� - sql = $"select * from BllSoNoticeDetail where LotNo = '{pallnetmsg.LotNo}' order by CreateTime desc"; + sql = $"select * from BllExportNoticeDetail where LotNo = '{pallnetmsg.LotNo}' order by CreateTime desc"; bllSo = Db.Ado.SqlQuery<BllExportNoticeDetail>(sql).FirstOrDefault(); if (bllSo == null) { @@ -142,8 +142,8 @@ } noticeno = bllSo.Id.ToString(); //鏌ユ壘搴撳瓨涓槸鍚︽湁姝ゆ壒娆$殑涓嬫枡妗� - sql += $"select PalletNo,LocatNo from DataStockDetail where a.LotNo = '{pallnetmsg.LotNo}'and AreaNo like '%03' " + - $"and a.WareHouseNo = '{house}' and b.status = '0' order by CompleteTime desc"; + sql = $"select PalletNo,LocatNo from DataStockDetail where LotNo = '{pallnetmsg.LotNo}'and AreaNo like '%03' " + + $"and WareHouseNo = '{house}' and status = '0' order by CompleteTime desc"; pallet = Db.Ado.SqlQuery<DataStockDetail>(sql).FirstOrDefault(); if (pallet == null) { @@ -166,10 +166,11 @@ { Startport = pallet.LocatNo, Endport = pallnetmsg.Location, - Pallno = pallet.PackagNo, + Pallno = pallet.PalletNo, Type = pallnetmsg.Type, Crtype = "1", Noticedetailno = int.Parse(noticeno), + LotNo = pallnetmsg.LotNo, }; CreateLotTask(task); return; @@ -191,7 +192,7 @@ var sql = $"select LocatNo from SysStorageLocat where status = '0'"; var sql2 = ""; var house = "W01";//鈥︹�﹀彨妗朵綅缃紝鍚庣画鏍规嵁浣嶇疆鍏宠仈鎴栧畾涔夛紝鏉ュ垽鏂彨妗朵綅缃墍灞炶溅闂� - var noticeno = "";//鍑哄叆搴撳崟鎹槑缁咺D + var noticeno = "0";//鍑哄叆搴撳崟鎹槑缁咺D SysStorageLocat loction = new SysStorageLocat(); BllArrivalNoticeDetail ArriveMes = new BllArrivalNoticeDetail(); try @@ -199,7 +200,7 @@ switch (pallnetmsg.Type) { case "0"://鍑�妗剁敵璇峰偍浣� - sql += $"and AreaNo like '%01' and WareHouseNo = {house}"; + sql += $"and AreaNo like '%01' and WareHouseNo = '{house}'"; loction = Db.Ado.SqlQuery<SysStorageLocat>(sql).OrderByDescending(a => a.CreateTime).FirstOrDefault(); if (loction == null) { @@ -220,7 +221,7 @@ throw new Exception("璇ユ壒娆℃病鏈夊搴旂殑鍏ュ簱鍗�"); } noticeno = ArriveMes.Id.ToString();*/ - sql += $"and AreaNo like '%02' and WareHouseNo = {house}"; + sql += $"and AreaNo like '%02' and WareHouseNo = '{house}'"; loction = Db.Ado.SqlQuery<SysStorageLocat>(sql).OrderByDescending(a => a.CreateTime).FirstOrDefault(); if (loction == null) { @@ -235,13 +236,13 @@ } //鏍¢獙姝ゆ壒娆℃槸鍚︽湁鍏ュ簱鍗� sql2 = $"select * from BllArrivalNoticeDetail where LotNo = '{pallnetmsg.LotNo}' order by CreateTime desc"; - ArriveMes = Db.Ado.SqlQuery<BllArrivalNoticeDetail>(sql).FirstOrDefault(); + ArriveMes = Db.Ado.SqlQuery<BllArrivalNoticeDetail>(sql2).FirstOrDefault(); if (ArriveMes == null) { throw new Exception("璇ユ壒娆℃病鏈夊搴旂殑鍏ュ簱鍗�"); } noticeno = ArriveMes.Id.ToString(); - sql += $"and AreaNo like '%03' and WareHouseNo = {house}"; + sql += $"and AreaNo like '%03' and WareHouseNo = '{house}'"; loction = Db.Ado.SqlQuery<SysStorageLocat>(sql).OrderByDescending(a => a.CreateTime).FirstOrDefault(); if (loction == null) { @@ -249,7 +250,7 @@ } break; case "3"://鑴忔《鐢宠鍌ㄤ綅 - sql += $"and AreaNo like '%04' and WareHouseNo = {house}"; + sql += $"and AreaNo like '%04' and WareHouseNo = '{house}'"; loction = Db.Ado.SqlQuery<SysStorageLocat>(sql).OrderByDescending(a => a.CreateTime).FirstOrDefault(); if (loction == null) { @@ -265,6 +266,7 @@ Type = pallnetmsg.Type, Crtype = "0", Noticedetailno = int.Parse(noticeno), + LotNo = pallnetmsg.LotNo, }; CreateLotTask(task); } @@ -367,24 +369,53 @@ { try { + //寮�鍚簨鍔� + Db.BeginTran(); var na = taskDetial.Crtype == "0"?"鍏ュ簱":"鍑哄簱"; + var bz = ""; + switch (taskDetial.Type) + { + case "0": + bz = "鍑�妗�"+na+"浠诲姟"; + break; + case "1": + bz = "棰勬贩鏂欐《" + na + "浠诲姟"; + break; + case "2": + bz = "鍗婃垚鍝佹枡妗�" + na + "浠诲姟"; + break; + case "3": + bz = "鑴忔《" + na + "浠诲姟"; + break; + } var sql = ""; var sql2 = ""; var ordertype = "3"; - if (taskDetial.Type == "2" && taskDetial.Crtype =="1") + //娑夊強鍑哄叆搴撳崟鎹殑鐘舵�佷俊鎭敼鍙� + if (taskDetial.Type == "2" && taskDetial.Crtype =="1")//鍗婃垚鍝佸嚭搴� { ordertype = "1"; + sql = $"UPDATE BllExportNotice SET Status ='1' " + + $"where asnno = (select ASNNO from BllExportNoticeDetail where id = {taskDetial.Noticedetailno})"; + Db.Ado.ExecuteCommand(sql); } - else if(taskDetial.Type =="2" && taskDetial.Crtype == "0") + else if(taskDetial.Type =="2" && taskDetial.Crtype == "0")//鍗婃垚鍝佸叆搴� { ordertype = "0"; + var ArrivalMsg = Db.Queryable<BllArrivalNoticeDetail>().First(it => it.Id == taskDetial.Noticedetailno); + //淇敼鍏ュ簱鍗曟�昏〃涓崟鎹姸鎬佷负姝e湪鎵ц + sql = $"UPDATE BllArrivalNotice SET Status ='1' where asnno = '{ArrivalMsg.ASNNo}'"; + Db.Ado.ExecuteCommand(sql); + //搴撳瓨涓坊鍔犳鎵樼洏鐗╂枡缂栫爜鍜岀紪鐮佸悕绉� + sql2 = $"UPDATE DataStockDetail SET SkuNo = '{ArrivalMsg.SkuNo}',SkuName = '{ArrivalMsg.SkuName}' " + + $"where PalletNo = '{taskDetial.Pallno}'and LotNo = '{taskDetial.LotNo}'"; + Db.Ado.ExecuteCommand(sql2); } - //寮�鍚簨鍔� - Db.BeginTran(); + //鍒ゆ柇浠诲姟鏄惁涓烘柊浠诲姟 if (string.IsNullOrWhiteSpace(taskDetial.Taskno)) { - taskDetial.Taskno = new Common().GetMaxNo("T"); + taskDetial.Taskno = new Common().GetMaxNo("TK"); } var logTaskEntry = new LogTask { @@ -404,7 +435,7 @@ OrderType = ordertype,//鍗曟嵁绫诲瀷 0 鍏ュ簱 1 鍑哄簱 3鍏朵粬 Status = "0",//浠诲姟鐘舵��0锛氱瓑寰呮墽琛�1姝e湪鎵ц2鎵ц瀹屾垚 NoticeDetailNo = int.Parse(taskDetial.Noticedetailno.ToString()), - Msg = $"{taskDetial.Endport}鐨剓na}浠诲姟", //鍏抽敭淇℃伅 + Msg = bz, //鍏抽敭淇℃伅 }; var Agv = new AgvTask { @@ -414,6 +445,7 @@ endPos = taskDetial.Endport, agvCode = "1",//鈥︹�﹂渶瑕佸拰AGV纭姝ゅ瓧娈靛�� }; + //璇锋眰灏忚溅 genAgvSchedulingTaskRep chrep =genAgvSchedulingTask(Agv, "url"); if (chrep.code != "0") @@ -423,14 +455,19 @@ Db.CommitTran(); throw new Exception("RCS浠诲姟涓嬪彂閿欒锛孯CS杩斿洖娑堟伅锛�" + chrep.message); } + //璇锋眰鎴愬姛淇敼浠诲姟琛ㄧ浉搴斿瓧娈电姸鎬� logTaskEntry.IsSuccess = 1; logTaskEntry.BackDate = DateTime.Now; logTaskEntry.Status = "1"; if (taskDetial.Crtype == "0") { sql = $"UPDATE SysStorageLocat SET Status = '2' where LocatNo = '{taskDetial.Endport}'"; - sql2 = $"UPDATE DataStockDetail SET PalletStatus = '{taskDetial.Type}' where PalletNo = '{taskDetial.Pallno}'"; - Db.Ado.ExecuteCommand(sql2); + if (taskDetial.Type == "2") + { + sql2 = $"UPDATE DataStockDetail SET PalletStatus = '{taskDetial.Type}',LotNo = '{taskDetial.LotNo}' " + + $"where PalletNo = '{taskDetial.Pallno}'"; + Db.Ado.ExecuteCommand(sql2); + } } else { -- Gitblit v1.8.0