From 34971d1815420aab6548d1603fee08c787d53a23 Mon Sep 17 00:00:00 2001
From: wxw <Administrator@DESKTOP-5BIMHQ3>
Date: 星期二, 25 十一月 2025 09:07:42 +0800
Subject: [PATCH] 优化叫脏桶处理逻辑
---
Wms/WMS.BLL/BllTransServer/RcsServer.cs | 140 ++++++++++++++++++++++++----------------------
1 files changed, 72 insertions(+), 68 deletions(-)
diff --git a/Wms/WMS.BLL/BllTransServer/RcsServer.cs b/Wms/WMS.BLL/BllTransServer/RcsServer.cs
index caab7f1..4a17d93 100644
--- a/Wms/WMS.BLL/BllTransServer/RcsServer.cs
+++ b/Wms/WMS.BLL/BllTransServer/RcsServer.cs
@@ -14,6 +14,7 @@
using WMS.BLL.LogServer;
using WMS.DAL;
using WMS.Entity.BllAsnEntity;
+using WMS.Entity.BllQualityEntity;
using WMS.Entity.BllSoEntity;
using WMS.Entity.Context;
using WMS.Entity.DataEntity;
@@ -234,7 +235,7 @@
}
break;
case "3"://娓呮礂璁惧鍙剰妗�
- {
+ {
//鍙《鐩爣鍌ㄤ綅鍦板潃淇℃伅
endLoction = Db.Queryable<SysStorageLocat>().First(w => w.IsDel == "0" && w.WareHouseNo == houseNo && w.AreaNo == deviceInfo.AreaNo && w.Column == 1);// Column=1 娓呮礂鍌ㄤ綅锛孋olumn=2 娓呮礂瀹屾枡鍌ㄤ綅
if (endLoction == null)
@@ -265,6 +266,7 @@
throw new Exception("鏆傛棤鑴忔《鍙垎閰�");
}
taskMsg = "璁惧鍙剰妗朵换鍔�";
+ int callResult = 0;//鏄惁鍙剰妗舵垚鍔�
//閬嶅巻搴撳瓨鑴忔《锛岃繑鍥濵ES楠岃瘉
foreach (var item in palletList)
{
@@ -285,6 +287,7 @@
//淇敼璇ユ《搴撳瓨鐘舵��
Db.Updateable(item).ExecuteCommand();
+ callResult = 1;
continue;
}
}
@@ -295,76 +298,23 @@
#endregion
item.Status = "2";//鍒嗛厤鐘舵�� 0:寰呭垎閰嶏紝1锛氶儴鍒嗗垎閰� 锛� 2:宸插垎閰�
- //鏇存柊妗跺簱瀛樻槑缁�
+ //鏇存柊妗跺簱瀛樻槑缁�
Db.Updateable(item).ExecuteCommand();
- //璧峰鍌ㄤ綅鍦板潃淇℃伅
- var startLoction2 = Db.Queryable<SysStorageLocat>().First(w => w.IsDel == "0" && w.LocatNo == item.LocatNo);
- if (startLoction2 == null)
- {
- throw new Exception($"璧峰鐩爣鍌ㄤ綅淇℃伅涓嶅瓨鍦紝妗跺彿锛歿item.LocatNo}");
- }
- taskNo = new Common().GetMaxNo("TN");//浠诲姟鍙�
- var logTaskEntry2 = new LogTask
- {
- TaskNo = taskNo,
- Sender = "WMS",
- Receiver = "RCS",
- //IsSuccess = 1, //鏄惁涓嬪彂鎴愬姛 0澶辫触 1鎴愬姛
- SendDate = DateTime.Now, //鍙戦�佹椂闂�
- //BackDate = DateTime.Now, //杩斿洖鏃堕棿
- StartLocat = item.LocatNo,//璧峰浣嶇疆
- EndLocat = endLoction.LocatNo,//鐩爣浣嶇疆
- PalletNo = item.PalletNo,//鎵樼洏鐮�
- IsSend = 1,//鏄惁鍙啀娆′笅鍙�
- IsCancel = 1,//鏄惁鍙彇娑�
- IsFinish = 1,//鏄惁鍙畬鎴�
- Type = "1",//浠诲姟绫诲瀷 0 鍏ュ簱浠诲姟 1 鍑哄簱浠诲姟 2 绉诲簱浠诲姟
- OrderType = "3",//鍗曟嵁绫诲瀷 0 鍏ュ簱 1 鍑哄簱 3 绉诲簱
- Status = "0",//浠诲姟鐘舵��0锛氱瓑寰呮墽琛�1姝e湪鎵ц2鎵ц瀹屾垚
- NoticeDetailNo = int.Parse(noticeNo),
- Msg = taskMsg, //鍏抽敭淇℃伅
- LotNo = item.LotNo//鎵规鍙�
- };
- //缁勭粐涓嬪彂灏忚溅浠诲姟淇℃伅
- var task2 = new TaskDetial
- {
- Taskno = taskNo,//浠诲姟鍙�
- Startport = item.LocatNo,
- Endport = model.Location,//endLoction.LocatNo,
- Pallno = item.PalletNo,
- Crtype = "1",//鍙《
- WareHouseNo = houseNo
- };
- //缁欎笅杞︿笅鍙戜换鍔�
- logTaskEntry2.SendDate = DateTime.Now;//鍙戦�佹椂闂�
- var agvResult2 = CreateTaskForAgv(task2, url, out agvMsg);
- if (agvResult2)//鎴愬姛
- {
- //璇锋眰鎴愬姛淇敼浠诲姟琛ㄧ浉搴斿瓧娈电姸鎬�
- logTaskEntry2.IsSuccess = 1;
- logTaskEntry2.IsSend = 0;
- //logTaskEntry2.IsCancel = 0;
- logTaskEntry2.BackDate = DateTime.Now;
- logTaskEntry2.Status = "1";
- Db.Insertable(logTaskEntry2).ExecuteCommand();
-
- startLoction2.Status = "3";//鍑哄簱涓�
- Db.Updateable(startLoction2).ExecuteCommand();
-
- endLoction.Status = "2";//鍏ュ簱涓�
- Db.Updateable(endLoction).ExecuteCommand();
- }
- else//澶辫触
- {
- logTaskEntry2.IsSuccess = 0;
- logTaskEntry2.Information = agvMsg;
- Db.Insertable(logTaskEntry2).ExecuteCommand();
-
- }
+ pallet = item;
+
+ callResult = 2;
+ break;
+ }
+ if (callResult == 1)
+ {
//鎻愪氦浜嬪姟
Db.CommitTran();
- return;
+ throw new Exception("鏆傛棤鑴忔《鍙垎閰�");
+ }
+ else if (callResult == 0)
+ {
+ throw new Exception("鏆傛棤鑴忔《鍙垎閰�");
}
}
break;
@@ -375,7 +325,7 @@
var startLoction = Db.Queryable<SysStorageLocat>().First(w => w.IsDel == "0" && w.LocatNo == pallet.LocatNo);
if (startLoction == null)
{
- throw new Exception($"璧峰鐩爣鍌ㄤ綅淇℃伅涓嶅瓨鍦紝妗跺彿锛歿pallet.LocatNo}");
+ throw new Exception($"璧峰鐩爣鍌ㄤ綅淇℃伅涓嶅瓨鍦紝妗跺彿锛歿pallet.PalletNo}");
}
taskNo = new Common().GetMaxNo("TN");//浠诲姟鍙�
@@ -1621,5 +1571,59 @@
throw new Exception(e.Message);
}
}
+
+ /// <summary>
+ /// 璐ㄩ噺缁撴灉涓嬪彂
+ /// </summary>
+ /// <param name="model"></param>
+ /// <returns></returns>
+ /// <exception cref="Exception"></exception>
+ public void QualityResult(QualityResultVm model)
+ {
+ try
+ {
+ //楠岃瘉鎵规鍙锋槸鍚︿负绌�
+ if (string.IsNullOrEmpty(model.LotNo))
+ {
+ throw new Exception("鎵规鍙蜂笉鍙负绌猴紝璇锋牳鏌ワ紒");
+ }
+ //寮�鍚簨鍔�
+ Db.BeginTran();
+
+ BllQualityInspect inspectModel = new BllQualityInspect();
+ inspectModel.InspectNo = "";
+ inspectModel.ASNNo = "";
+ inspectModel.LotNo = model.LotNo;
+ inspectModel.IsQualified = model.IsQualified;
+ inspectModel.Origin = "LIMS"; //鏉ユ簮
+ inspectModel.CreateTime = Db.GetDate(); //鍒涘缓鏃ユ湡
+ inspectModel.SkuNo = ""; //鐗╂枡鍙�
+ inspectModel.SkuName = ""; //鐗╂枡鍚嶇О
+ inspectModel.PassQty = 0; //鍚堟牸鏁伴噺
+ inspectModel.FailQty = 0; //涓嶅悎鏍兼暟閲�
+ inspectModel.Standard = ""; //瑙勬牸
+ inspectModel.CreateUser = 0;
+ //鎻掑叆璐ㄦ淇℃伅
+ Db.Insertable(inspectModel).ExecuteCommand();
+
+ //鏌ユ壘搴撳瓨鏄庣粏淇℃伅
+ List<DataStockDetail> detail = Db.Queryable<DataStockDetail>().Where(m => m.IsDel == "0" && m.LotNo == model.LotNo).ToList();
+ foreach (var item in detail)
+ {
+ item.InspectStatus = model.IsQualified == "1" ? "1" : "2";//0:寰呮楠岋紝1锛氬悎鏍硷紝2锛氫笉鍚堟牸
+
+ Db.Updateable(item).ExecuteCommand();
+ }
+
+ //鎻愪氦浜嬪姟
+ Db.CommitTran();
+ }
+ catch (Exception ex)
+ {
+ //鍥炴粴浜嬪姟
+ Db.RollbackTran();
+ throw new Exception(ex.Message);
+ }
+ }
}
}
--
Gitblit v1.8.0