From cee9fb315dfcf89956fecee9ed2031ad9357e228 Mon Sep 17 00:00:00 2001
From: Demo <Demo@DESKTOP-CPA90BF>
Date: 星期三, 17 七月 2024 19:25:23 +0800
Subject: [PATCH] 修改申请巷道方法
---
Wms/WMS.BLL/BllAsnServer/PalletBindServer.cs | 256 +++++++++++++++++++++++++++++++++++++-------------
1 files changed, 189 insertions(+), 67 deletions(-)
diff --git a/Wms/WMS.BLL/BllAsnServer/PalletBindServer.cs b/Wms/WMS.BLL/BllAsnServer/PalletBindServer.cs
index 7921784..7cce4c8 100644
--- a/Wms/WMS.BLL/BllAsnServer/PalletBindServer.cs
+++ b/Wms/WMS.BLL/BllAsnServer/PalletBindServer.cs
@@ -823,6 +823,11 @@
OutMode = "", //鐩爣鍦板潃
Order = 1
};
+ if (beingTask.IsSuccess == 0)
+ {
+ beingTask.IsSuccess = 1;
+ Db.Updateable(beingTask).ExecuteCommand();
+ }
return comDto;
}
if (haveLocate != null)
@@ -872,6 +877,34 @@
throw new Exception($"{palletNo}鎵樼洏鏉$爜涓嶅叿鏈夌鐮佷俊鎭紝涓嶅彲鍏ュ簱锛�");
}
skuNo = stockDetail.First().SkuNo;
+
+ #region 鍒ゆ柇浠诲姟鏄惁宸茬粡瀛樺湪锛岃嫢瀛樺湪鐩存帴杩斿洖浠诲姟锛�
+ var beingTask = Db.Queryable<LogTask>().First(m => m.IsDel == "0"
+ && (m.Status == "0" || m.Status == "1") && m.PalletNo == palletNo && m.Type == "0");
+ if (beingTask != null)
+ {
+ comDto = new OutCommandDto()
+ {
+ PalletNo = palletNo,//鎵樼洏鍙�
+ StartRoadway = beingTask.StartRoadway, // 璧峰宸烽亾
+ StartLocate = "", // 璧峰浣嶇疆
+ EndLocate = beingTask.EndLocat, // 鐩爣浣嶇疆
+ EndRoadway = beingTask.EndRoadway, // 鐩爣宸烽亾
+ TaskNo = beingTask.TaskNo, // 浠诲姟鍙�
+ TaskType = "0",// 浠诲姟绫诲瀷 (鍑哄簱)
+ OutMode = "", //鐩爣鍦板潃
+ Order = 1
+ };
+ if (beingTask.IsSuccess == 0)
+ {
+ beingTask.IsSuccess = 1;
+ beingTask.Status = "1";
+ Db.Updateable(beingTask).ExecuteCommand();
+ }
+
+ return comDto;
+ }
+ #endregion
//鑾峰彇瀵瑰簲鍥炲簱瑙勫垯
var function = Db.Queryable<SysFunSetting>().First(a => a.IsDel == "0" && a.FunSetNo == "Fun041" && a.IsEnable == "NO");
@@ -1096,14 +1129,30 @@
};
Db.Insertable(exTask).ExecuteCommand();
-
+ //// 娣诲姞鎵樼洏缁戝畾琛ㄦ墭鐩樺叆搴撲换鍔″彿 liudl
+ //if (palletBindList.Count < 1)
+ //{
+ // foreach (DataStockDetail stockModel in stockDetail)
+ // {
+ // var bindModel = Db.Queryable<BllPalletBind>().First(m => m.IsDel == "0" && m.Status == "2"
+ // && m.PalletNo == stockModel.PalletNo && m.ASNNo == stockModel.ASNNo && m.ASNDetailNo == stockModel.ASNDetailNo);
+ // if (bindModel != null && string.IsNullOrWhiteSpace(bindModel.TaskNo))
+ // {
+ // bindModel.TaskNo = taskNo;
+ // bindModel.WareHouseNo = houseNo;
+ // bindModel.RoadwayNo = roadNo;
+ // Db.Updateable(bindModel).ExecuteCommand();
+ // }
+ // }
+ //}
if (palletBindList.Count >= 1)
{
foreach (var item in palletBindList)
{
item.WareHouseNo = houseNo;
item.RoadwayNo = roadNo;
- item.TaskNo = "";
+ item.TaskNo = taskNo;
+ item.Status = "1";
}
Db.Updateable(palletBindList).ExecuteCommand();
}
@@ -1178,20 +1227,11 @@
var skuCategoryList = Db.Queryable<SysMaterialCategory>().Where(m => m.IsDel == "0").ToList();
var skuNo = ""; //鍏ュ簱鐗╂枡
-
+ var isAddTask = true; //鏄惁娣诲姞鏂颁换鍔�
+ var oldTaskNo = ""; //鏃т换鍔″彿
+ var stockDetail = Db.Queryable<DataStockDetail>().Where(m => m.PalletNo == palletNo).ToList();
if (palletBindList.Count >= 1) //姝e父鍏ュ簱
{
- //var bindIdList = palletBindList.Select(m => m.Id).ToList();
- //鍒ゆ柇鏄惁鏈夐浂绠�
- //foreach (var item in bindIdList)
- //{
- // var boxInfo = Db.Queryable<BllBoxInfo>().Where(m => m.IsDel == "0" && m.BindNo == item);
- // if (boxInfo.Count(m => m.BitBoxMark == "1") > 0)
- // {
- // throw new Exception($"{palletNo}鎵樼洏涓婃湁闆剁锛岃鍏ラ浂绠卞簱锛�");
- // }
- //}
-
var palletBind = palletBindList.FirstOrDefault(m => m.Status == "1");
if (palletBind != null)
{
@@ -1200,19 +1240,38 @@
{
throw new Exception("璇ユ墭鐩樻鍦ㄥ叆搴擄紝浣嗘湭鏌ヨ鍒颁换鍔′俊鎭�");
}
- comDto = new OutCommandDto()
+ if (!string.IsNullOrWhiteSpace(beingTask.EndLocat))
{
- PalletNo = palletNo,//鎵樼洏鍙�
- StartRoadway = beingTask.StartRoadway, // 璧峰宸烽亾
- StartLocate = "", // 璧峰浣嶇疆
- EndLocate = beingTask.EndLocat, // 鐩爣浣嶇疆
- EndRoadway = beingTask.EndRoadway, // 鐩爣宸烽亾
- TaskNo = beingTask.TaskNo, // 浠诲姟鍙�
- TaskType = "0",// 浠诲姟绫诲瀷 (鍑哄簱)
- OutMode = "", //鐩爣鍦板潃
- Order = 1
- };
- return comDto;
+ comDto = new OutCommandDto()
+ {
+ PalletNo = palletNo,//鎵樼洏鍙�
+ StartRoadway = beingTask.StartRoadway, // 璧峰宸烽亾
+ StartLocate = "", // 璧峰浣嶇疆
+ EndLocate = beingTask.EndLocat, // 鐩爣浣嶇疆
+ EndRoadway = beingTask.EndRoadway, // 鐩爣宸烽亾
+ TaskNo = beingTask.TaskNo, // 浠诲姟鍙�
+ TaskType = "0",// 浠诲姟绫诲瀷 (鍑哄簱)
+ OutMode = "", //鐩爣鍦板潃
+ Order = 1
+ };
+ if (beingTask.IsSuccess == 0)
+ {
+ beingTask.IsSuccess = 1;//濡傛灉浠诲姟涓嬪彂鐘舵�佹槸鏈笅鍙戞洿鏀逛负宸蹭笅鍙�
+ Db.Updateable(beingTask).ExecuteCommand();
+ }
+ return comDto;
+
+ }
+ else
+ {
+ if (string.IsNullOrWhiteSpace(roadwayNo))
+ {
+ roadwayNo = beingTask.EndRoadway;
+ }
+ isAddTask = false;
+ oldTaskNo = beingTask.TaskNo;
+ }
+
}
if (haveLocate != null)
{
@@ -1253,7 +1312,7 @@
}
else //鍥炴祦鍏ュ簱
{
- var stockDetail = Db.Queryable<DataStockDetail>().Where(m => m.PalletNo == palletNo).ToList();
+
if (stockDetail.Count == 0)
{
throw new Exception($"{palletNo}鎵樼洏鏉$爜涓嶅叿鏈夌鐮佷俊鎭紝涓嶅彲鍏ュ簱锛�");
@@ -1277,6 +1336,42 @@
}
}
+ var beingTask = Db.Queryable<LogTask>().First(m => m.IsDel == "0"
+ && (m.Status == "0" || m.Status == "1") && m.PalletNo == palletNo && m.Type == "0");
+ if (beingTask != null)
+ {
+ if (!string.IsNullOrWhiteSpace(beingTask.EndLocat))
+ {
+ comDto = new OutCommandDto()
+ {
+ PalletNo = palletNo,//鎵樼洏鍙�
+ StartRoadway = beingTask.StartRoadway, // 璧峰宸烽亾
+ StartLocate = "", // 璧峰浣嶇疆
+ EndLocate = beingTask.EndLocat, // 鐩爣浣嶇疆
+ EndRoadway = beingTask.EndRoadway, // 鐩爣宸烽亾
+ TaskNo = beingTask.TaskNo, // 浠诲姟鍙�
+ TaskType = "0",// 浠诲姟绫诲瀷 (鍑哄簱)
+ OutMode = "", //鐩爣鍦板潃
+ Order = 1
+ };
+ if (beingTask.IsSuccess == 0)
+ {
+ beingTask.IsSuccess = 1;
+ beingTask.Status = "1";
+ Db.Updateable(beingTask).ExecuteCommand();
+ }
+ return comDto;
+ }
+ else
+ {
+ if (string.IsNullOrWhiteSpace(roadwayNo))
+ {
+ roadwayNo = beingTask.EndRoadway;
+ }
+ isAddTask = false;
+ oldTaskNo = beingTask.TaskNo;
+ }
+ }
//鑾峰彇瀵瑰簲鍥炲簱瑙勫垯
var function = Db.Queryable<SysFunSetting>().First(a => a.IsDel == "0" && a.FunSetName == "鎵樼洏鍥炲簱楠岃瘉" && a.IsEnable == "NO");
@@ -1343,46 +1438,73 @@
Db.BeginTran();
try
{
- //if (locate != null)
- //{
- // //娣诲姞宸烽亾浣跨敤璁板綍
- // var log = new SysRoadwayUseLog
- // {
- // RoadwayNo = locate.RoadwayNo,
- // LocateNo = locate.LocatNo,
- // WareHouseNo = locate.WareHouseNo,
- // Row = locate.Row,
- // Column = locate.Column,
- // Layer = locate.Layer,
- // Depth = locate.Depth
- // };
- // Db.Insertable(log).ExecuteCommand();
- //}
-
- var taskNo = new Common().GetMaxNo("TK");
- var exTask = new LogTask //鍏ュ簱浠诲姟
+ if (isAddTask)
{
- TaskNo = taskNo,
- Sender = "WMS",
- Receiver = "WCS",
- IsSuccess = 1, //鏄惁涓嬪彂鎴愬姛 0澶辫触 1鎴愬姛
- SendDate = DateTime.Now, //鍙戦�佹椂闂�
- BackDate = DateTime.Now, //杩斿洖鏃堕棿
- StartRoadway = "", // 璧峰宸烽亾
- StartLocat = "",//璧峰浣嶇疆
- EndLocat = locate.LocatNo,//鐩爣浣嶇疆
- EndRoadway = locate.RoadwayNo, // 鐩爣宸烽亾
- PalletNo = palletNo,//鎵樼洏鐮�
- IsSend = 1,//鏄惁鍙啀娆′笅鍙�
- IsCancel = 1,//鏄惁鍙彇娑�
- IsFinish = 1,//鏄惁鍙畬鎴�
- Type = "0",//浠诲姟绫诲瀷 0 鍏ュ簱浠诲姟 1 鍑哄簱浠诲姟 2 绉诲簱浠诲姟
- Status = "1",//浠诲姟鐘舵��0锛氱瓑寰呮墽琛�1姝e湪鎵ц2鎵ц瀹屾垚
- OrderType = "0",//0 鍏ュ簱鍗� 1 鍑哄簱鍗� 2 鐩樼偣鍗� 3 绉诲簱鍗�
- Msg = "鍏ュ簱鍙e埌=>>" + locate.LocatNo + "鐨勫叆搴撲换鍔�", //鍏抽敭淇℃伅
+ var taskNo = new Common().GetMaxNo("TK");
+ var exTask = new LogTask //鍏ュ簱浠诲姟
+ {
+ TaskNo = taskNo,
+ Sender = "WMS",
+ Receiver = "WCS",
+ IsSuccess = 1, //鏄惁涓嬪彂鎴愬姛 0澶辫触 1鎴愬姛
+ SendDate = DateTime.Now, //鍙戦�佹椂闂�
+ BackDate = DateTime.Now, //杩斿洖鏃堕棿
+ StartRoadway = "", // 璧峰宸烽亾
+ StartLocat = "",//璧峰浣嶇疆
+ EndLocat = locate.LocatNo,//鐩爣浣嶇疆
+ EndRoadway = locate.RoadwayNo, // 鐩爣宸烽亾
+ PalletNo = palletNo,//鎵樼洏鐮�
+ IsSend = 1,//鏄惁鍙啀娆′笅鍙�
+ IsCancel = 1,//鏄惁鍙彇娑�
+ IsFinish = 1,//鏄惁鍙畬鎴�
+ Type = "0",//浠诲姟绫诲瀷 0 鍏ュ簱浠诲姟 1 鍑哄簱浠诲姟 2 绉诲簱浠诲姟
+ Status = "1",//浠诲姟鐘舵��0锛氱瓑寰呮墽琛�1姝e湪鎵ц2鎵ц瀹屾垚
+ OrderType = "0",//0 鍏ュ簱鍗� 1 鍑哄簱鍗� 2 鐩樼偣鍗� 3 绉诲簱鍗�
+ Msg = "鍏ュ簱鍙e埌=>>" + locate.LocatNo + "鐨勫叆搴撲换鍔�", //鍏抽敭淇℃伅
- };
- Db.Insertable(exTask).ExecuteCommand();
+ };
+ Db.Insertable(exTask).ExecuteCommand();
+ // 娣诲姞鎵樼洏缁戝畾琛ㄦ墭鐩樺叆搴撲换鍔″彿 liudl
+ foreach (DataStockDetail stockModel in stockDetail)
+ {
+ var bindModel = Db.Queryable<BllPalletBind>().First(m => m.IsDel == "0" && m.Status == "2"
+ && m.PalletNo == stockModel.PalletNo && m.ASNNo == stockModel.ASNNo && m.ASNDetailNo == stockModel.ASNDetailNo);
+ if (bindModel != null && string.IsNullOrWhiteSpace(bindModel.TaskNo))
+ {
+ bindModel.TaskNo = taskNo;
+ bindModel.WareHouseNo = locate.WareHouseNo;
+ bindModel.RoadwayNo = locate.RoadwayNo;
+ bindModel.LocatNo = locate.LocatNo;
+ Db.Updateable(bindModel).ExecuteCommand();
+ }
+ }
+ oldTaskNo = taskNo;
+ }
+ else
+ {
+ var oldTask = Db.Queryable<LogTask>().First(m => m.IsDel == "0" && m.TaskNo == oldTaskNo);
+ oldTask.EndLocat = locate.LocatNo;
+ oldTask.EndRoadway = locate.RoadwayNo;
+ if (oldTask.IsSuccess == 0)
+ {
+ oldTask.IsSuccess = 1;
+ oldTask.Status = "1";
+ }
+ Db.Updateable(oldTask).ExecuteCommand();
+
+ var bindModel = Db.Queryable<BllPalletBind>().First(m => m.IsDel == "0" && m.Status == "2"
+ && m.PalletNo == oldTask.PalletNo && m.TaskNo == oldTaskNo);
+ if (bindModel != null && string.IsNullOrWhiteSpace(bindModel.LocatNo))
+ {
+ bindModel.TaskNo = oldTask.TaskNo;
+ bindModel.WareHouseNo = locate.WareHouseNo;
+ bindModel.RoadwayNo = locate.RoadwayNo;
+ bindModel.LocatNo = locate.LocatNo;
+ Db.Updateable(bindModel).ExecuteCommand();
+ }
+ }
+
+
locate.Status = "2";
Db.Updateable(locate).ExecuteCommand();
if (palletBindList.Count >= 1)
@@ -1393,7 +1515,7 @@
item.WareHouseNo = locate.WareHouseNo;
item.RoadwayNo = locate.RoadwayNo;
item.LocatNo = locate.LocatNo;
- item.TaskNo = taskNo;
+ item.TaskNo = oldTaskNo;
}
Db.Updateable(palletBindList).ExecuteCommand();
}
@@ -1405,7 +1527,7 @@
StartLocate = "", // 璧峰浣嶇疆
EndLocate = locate.LocatNo, // 鐩爣浣嶇疆
EndRoadway = locate.RoadwayNo, // 鐩爣宸烽亾
- TaskNo = exTask.TaskNo, // 浠诲姟鍙�
+ TaskNo = oldTaskNo, // 浠诲姟鍙�
TaskType = "0",// 浠诲姟绫诲瀷 (鍑哄簱)
OutMode = "", //鐩爣鍦板潃
Order = 1
--
Gitblit v1.8.0