From bbd55a7466e770e7acb86ccc9d83ab20bde17980 Mon Sep 17 00:00:00 2001
From: IPC-610 <IPC-610@DESKTOP-6LEOOS3>
Date: 星期四, 26 九月 2024 19:30:45 +0800
Subject: [PATCH] 增加申请空托跺出库接口
---
Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs | 679 ++++++++++++++++++++++++++++++++++++++++++++++++++++
Wms/WMS.IBLL/IPdaServer/IPdaSoServer.cs | 10
Wms/Wms/Controllers/DownApiController.cs | 32 ++
Wms/WMS.BLL/BllAsnServer/PalletBindServer.cs | 2
4 files changed, 721 insertions(+), 2 deletions(-)
diff --git a/Wms/WMS.BLL/BllAsnServer/PalletBindServer.cs b/Wms/WMS.BLL/BllAsnServer/PalletBindServer.cs
index 6079f7a..7a2a466 100644
--- a/Wms/WMS.BLL/BllAsnServer/PalletBindServer.cs
+++ b/Wms/WMS.BLL/BllAsnServer/PalletBindServer.cs
@@ -1618,7 +1618,7 @@
- var areaNoStr = "A07";
+ var areaNoStr = "A03";
var allotLocate = new AllotLocation();
#region 鏍规嵁sku纭鍖哄煙鍒掑垎
diff --git a/Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs b/Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs
index ad272a5..908c485 100644
--- a/Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs
+++ b/Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs
@@ -1676,6 +1676,685 @@
}
+ /// <summary>
+ /// WCS鐢宠绌烘墭鍑哄簱
+ /// </summary>
+ /// <param name="model"> </param>
+ /// <param name="userId"> </param>
+ /// <param name="url"> </param>
+ /// <returns></returns>
+ /// <exception cref="Exception"></exception>
+ public List<OutCommandDto> IssuePlnOutHouseWcs(OutModePalletVm model, int userId)
+ {
+ try
+ {
+ string strMsg = "";
+ var outDto1 = new List<OutCommandDto>(); //鍏堝嚭搴撴暟鎹殑闆嗗悎锛堟繁搴︿负1鐨勫偍浣嶏級
+ var outDto2 = new List<OutCommandDto>(); //鍚庡嚭搴撴暟鎹殑闆嗗悎锛堟繁搴︿负2鐨勫偍浣嶏級
+ var moveDto = new List<OutCommandDto>(); //瑕佺Щ搴撴暟鎹殑闆嗗悎
+ //鑾峰彇褰撳墠鏃堕棿
+ DateTime serverTime = Db.GetDate();
+ //鑾峰彇搴撳瓨鏄庣粏鏄惁灏忎簬绛変簬璇ュ灈鏁�
+ string str = "select * from DataStockDetail where IsDel = '0' and SkuNo = '100099' and Status = '0' ";
+ var stockDetail = Db.Ado.SqlQuery<DataStockDetail>(str);
+ if (stockDetail.Count > 0)
+ {
+ //鍒ゆ柇鏄惁澶т簬闇�瑕佸灈鏁�
+ if (stockDetail.Count < int.Parse(model.Num))
+ {
+ throw new Exception("闇�瑕佸灈鏁板ぇ浜庡簱瀛樺灈鏁帮紝璇烽噸鏂拌緭鍏�!");
+ }
+ }
+ //鑾峰彇搴撳瓨鎬昏〃淇℃伅
+ var stock = Db.Queryable<DataStock>().First(s => s.IsDel == "0" && s.SkuNo == "100099");
+ //楠岃瘉搴撳瓨鎬昏〃鏄惁涓虹┖
+ if (stock == null)
+ {
+ throw new Exception("搴撳瓨淇℃伅涓嶅瓨鍦紝璇锋牳鏌�!");
+ }
+
+ var com = new Common();
+ Db.BeginTran();
+
+ //閬嶅巻搴撳瓨淇℃伅
+ foreach (var s in stockDetail)
+ {
+ //if (outDto1.Contains(m=>m.PalletNo == s.PalletNo) >0)
+ //{
+ // continue;
+ //}
+ //鑾峰彇鍌ㄤ綅淇℃伅
+ var locat = Db.Queryable<SysStorageLocat>().First(l => l.LocatNo == s.LocatNo && l.IsDel == "0" && l.WareHouseNo == "W01");
+ if (locat == null)
+ {
+ continue;
+ }
+
+ ////鏇存敼鍌ㄤ綅鐘舵�佷负鍑哄簱涓�
+ //locat.Status = "3"; //3 鍑哄簱涓�
+ //locat.UpdateTime = serverTime; //淇敼鏃堕棿
+ //locat.UpdateUser = userId; //淇敼浜�
+ ////淇敼鍌ㄤ綅淇℃伅
+ //Db.Updateable(locat).ExecuteCommand();
+
+ if (locat.Status == "1")
+ {
+ if (locat.Depth == "01") //娣卞害涓�1
+ {
+ #region 鏀瑰彉搴撳瓨
+
+ //澧炲姞搴撳瓨閿佸畾鏁伴噺
+ stock.LockQty += (int)s.Qty; //閿佸畾鏁伴噺
+ stock.UpdateTime = serverTime; //淇敼鏃堕棿
+ stock.UpdateUser = 0; //淇敼浜�
+ Db.Updateable(stock).ExecuteCommand();//淇敼搴撳瓨鎬昏〃淇℃伅
+
+ //澧炲姞搴撳瓨鏄庣粏閿佸畾鏁伴噺
+ s.LockQty += (int)s.Qty; //閿佸畾鏁伴噺
+ s.UpdateTime = serverTime; //淇敼鏃堕棿
+ s.UpdateUser = userId; //淇敼浜�
+ s.Status = "2"; //2 宸插垎閰�
+ Db.Updateable(s).ExecuteCommand();//淇敼搴撳瓨鏄庣粏淇℃伅
+
+ #endregion
+
+ #region 鍒嗛厤
+
+ //娣诲姞鍒嗛厤琛ㄤ俊鎭�
+ var allot = new BllExportAllot
+ {
+ SONo = "",
+ WaveNo = "",
+ SODetailNo = 0,
+ StockId = s.Id,
+ LotNo = "",
+ LotText = "",
+ SupplierLot = "",
+ SkuNo = s.SkuNo,
+ SkuName = s.SkuName,
+ Standard = s.Standard,
+ PalletNo = s.PalletNo,
+ IsBale = "0", //鏄惁瑁瑰寘
+ IsBelt = "0", //鏄惁鎵撳甫
+
+ //BoxexQty = s.Qty,
+ Qty = (int)s.Qty,
+ CompleteQty = 0,
+ Status = "1",
+ LogisticsId = 0,
+ IsAdvance = "0",
+ OutMode = model.OutMode,//鍑哄簱鍙�
+
+ CreateUser = userId,
+ CreateTime = DateTime.Now
+ };
+ Db.Insertable(allot).ExecuteCommand();
+
+ #endregion
+
+ #region 娣诲姞鍑哄簱浠诲姟淇℃伅
+
+ var taskNo = new Common().GetMaxNo("TK");
+ var exTask = new LogTask //鍑哄簱浠诲姟
+ {
+ TaskNo = taskNo,
+ Sender = "WMS",
+ Receiver = "WCS",
+ IsSuccess = 1, //鏄惁涓嬪彂鎴愬姛 0澶辫触 1鎴愬姛
+
+ StartLocat = locat == null ? "" : s.LocatNo,//璧峰浣嶇疆
+ EndLocat = model.OutMode,//鐩爣浣嶇疆
+ PalletNo = s.PalletNo,//鎵樼洏鐮�
+ IsSend = 1,//鏄惁鍙啀娆′笅鍙�
+ IsCancel = 1,//鏄惁鍙彇娑�
+ IsFinish = 1,//鏄惁鍙畬鎴�
+ Type = "1",//浠诲姟绫诲瀷 0 鍏ュ簱浠诲姟 1 鍑哄簱浠诲姟 2 绉诲簱浠诲姟
+ Status = "1",//浠诲姟鐘舵��0锛氱瓑寰呮墽琛�1姝e湪鎵ц2鎵ц瀹屾垚
+ OrderType = "1",//0 鍏ュ簱鍗� 1 鍑哄簱鍗� 2 鐩樼偣鍗� 3 绉诲簱鍗�
+ CreateTime = serverTime, //鍒涘缓鏃堕棿
+ CreateUser = userId, //鍒涘缓浜�
+ Msg = "WCS绌烘墭浠�" + locat == null ? "" : s.LocatNo + "鍒�" + model.OutMode + "鐨勫嚭搴撲换鍔�", //鍏抽敭淇℃伅
+ //FinishDate = serverTime, //瀹屾垚鏃堕棿
+ };
+ outDto1.Add(new OutCommandDto()
+ {
+ PalletNo = exTask.PalletNo,//鎵樼洏鍙�
+ StartLocate = exTask.StartLocat, // 璧峰浣嶇疆
+ StartRoadway = locat.RoadwayNo, //鎵�灞炲贩閬�
+ EndLocate = model.OutMode, // 鐩爣浣嶇疆
+ TaskNo = exTask.TaskNo, // 浠诲姟鍙�
+ TaskType = "1",// 浠诲姟绫诲瀷 (鍑哄簱)
+ OutMode = model.OutMode, //鐩爣鍦板潃
+ Order = 1
+ });
+ Db.Insertable(exTask).ExecuteCommand();
+
+ #endregion
+
+ #region 鍌ㄤ綅鐘舵�佸彉鏇�
+ //鏇存敼鍌ㄤ綅鐘舵�佷负鍑哄簱涓�
+ locat.Status = "3"; //3 鍑哄簱涓�
+ Db.Updateable(locat).ExecuteCommand();//淇敼鍌ㄤ綅淇℃伅
+ #endregion
+ }
+ else if (locat.Depth == "02") //娣卞害涓�2
+ {
+ //鑾峰彇鍑哄簱娣卞害涓�2鍌ㄤ綅鍓嶉潰鐨勫偍浣嶄俊鎭�
+ var sql2 = $@"select * from SysStorageLocat where WareHouseNo = '{locat.WareHouseNo}' and row = {locat.Row} and [Column] = {locat.Column} and Layer = {locat.Layer} and Depth = '01'; ";
+ var slotBefore = Db.Ado.SqlQuery<SysStorageLocat>(sql2).First();
+ if (slotBefore == null)
+ {
+ #region 鏀瑰彉搴撳瓨
+
+ //澧炲姞搴撳瓨閿佸畾鏁伴噺
+ stock.LockQty += (int)s.Qty; //閿佸畾鏁伴噺
+ stock.UpdateTime = serverTime; //淇敼鏃堕棿
+ //stock.UpdateUser = userId; //淇敼浜�
+ Db.Updateable(stock).ExecuteCommand();//淇敼搴撳瓨鎬昏〃淇℃伅
+
+ //澧炲姞搴撳瓨鏄庣粏閿佸畾鏁伴噺
+ s.LockQty += (int)s.Qty; //閿佸畾鏁伴噺
+ s.UpdateTime = serverTime; //淇敼鏃堕棿
+ s.UpdateUser = userId; //淇敼浜�
+ s.Status = "2"; //2 宸插垎閰�
+ Db.Updateable(s).ExecuteCommand();//淇敼搴撳瓨鏄庣粏淇℃伅
+
+ #endregion
+
+ #region 鍒嗛厤
+
+ //娣诲姞鍒嗛厤琛ㄤ俊鎭�
+ var allot = new BllExportAllot
+ {
+ SONo = "",
+ WaveNo = "",
+ SODetailNo = 0,
+ StockId = s.Id,
+ LotNo = "",
+ LotText = "",
+ SupplierLot = "",
+ SkuNo = s.SkuNo,
+ SkuName = s.SkuName,
+ Standard = s.Standard,
+ PalletNo = s.PalletNo,
+ IsBale = "0", //鏄惁瑁瑰寘
+ IsBelt = "0", //鏄惁鎵撳甫
+
+ //BoxexQty = s.Qty,
+ Qty = (int)s.Qty,
+ CompleteQty = 0,
+ Status = "1",
+ LogisticsId = 0,
+ IsAdvance = "0",
+ OutMode = model.OutMode,//鍑哄簱鍙�
+
+ CreateUser = userId,
+ CreateTime = DateTime.Now
+ };
+ Db.Insertable(allot).ExecuteCommand();
+
+ #endregion
+
+ #region 娣诲姞鍑哄簱浠诲姟淇℃伅
+
+ var taskNo = new Common().GetMaxNo("TK");
+ var exTask = new LogTask //鍑哄簱浠诲姟
+ {
+ TaskNo = taskNo,
+ Sender = "WMS",
+ Receiver = "WCS",
+ IsSuccess = 1, //鏄惁涓嬪彂鎴愬姛 0澶辫触 1鎴愬姛
+
+ StartLocat = locat == null ? "" : s.LocatNo,//璧峰浣嶇疆
+ EndLocat = model.OutMode,//鐩爣浣嶇疆
+ PalletNo = s.PalletNo,//鎵樼洏鐮�
+ IsSend = 1,//鏄惁鍙啀娆′笅鍙�
+ IsCancel = 1,//鏄惁鍙彇娑�
+ IsFinish = 1,//鏄惁鍙畬鎴�
+ Type = "1",//浠诲姟绫诲瀷 0 鍏ュ簱浠诲姟 1 鍑哄簱浠诲姟 2 绉诲簱浠诲姟
+ Status = "1",//浠诲姟鐘舵��0锛氱瓑寰呮墽琛�1姝e湪鎵ц2鎵ц瀹屾垚
+ OrderType = "1",//0 鍏ュ簱鍗� 1 鍑哄簱鍗� 2 鐩樼偣鍗� 3 绉诲簱鍗�
+ CreateTime = serverTime, //鍒涘缓鏃堕棿
+ CreateUser = userId, //鍒涘缓浜�
+ Msg = "WCS绌烘墭浠�" + locat == null ? "" : s.LocatNo + "鍒�" + model.OutMode + "鐨勫嚭搴撲换鍔�", //鍏抽敭淇℃伅
+ //FinishDate = serverTime, //瀹屾垚鏃堕棿
+ };
+ outDto1.Add(new OutCommandDto()
+ {
+ PalletNo = exTask.PalletNo,//鎵樼洏鍙�
+ StartLocate = exTask.StartLocat, // 璧峰浣嶇疆
+ StartRoadway = locat.RoadwayNo, //鎵�灞炲贩閬�
+ EndLocate = model.OutMode, // 鐩爣浣嶇疆
+ TaskNo = exTask.TaskNo, // 浠诲姟鍙�
+ TaskType = "1",// 浠诲姟绫诲瀷 (鍑哄簱)
+ OutMode = model.OutMode, //鐩爣鍦板潃
+ Order = 1
+ });
+ Db.Insertable(exTask).ExecuteCommand();
+
+ #endregion
+
+ #region 鍌ㄤ綅鐘舵�佸彉鏇�
+ //鏇存敼鍌ㄤ綅鐘舵�佷负鍑哄簱涓�
+ locat.Status = "3"; //3 鍑哄簱涓�
+ Db.Updateable(locat).ExecuteCommand();//淇敼鍌ㄤ綅淇℃伅
+ #endregion
+ }
+ else
+ {
+ //鍒ゆ柇鍌ㄤ綅鐘舵��
+ if (slotBefore.Status == "0")
+ {
+ #region 鏀瑰彉搴撳瓨
+
+ //澧炲姞搴撳瓨閿佸畾鏁伴噺
+ stock.LockQty += (int)s.Qty; //閿佸畾鏁伴噺
+ stock.UpdateTime = serverTime; //淇敼鏃堕棿
+ //stock.UpdateUser = userId; //淇敼浜�
+ Db.Updateable(stock).ExecuteCommand();//淇敼搴撳瓨鎬昏〃淇℃伅
+
+ //澧炲姞搴撳瓨鏄庣粏閿佸畾鏁伴噺
+ s.LockQty += (int)s.Qty; //閿佸畾鏁伴噺
+ s.UpdateTime = serverTime; //淇敼鏃堕棿
+ s.UpdateUser = userId; //淇敼浜�
+ s.Status = "2"; //2 宸插垎閰�
+ Db.Updateable(s).ExecuteCommand();//淇敼搴撳瓨鏄庣粏淇℃伅
+
+ #endregion
+
+ #region 鍒嗛厤
+
+ //娣诲姞鍒嗛厤琛ㄤ俊鎭�
+ var allot = new BllExportAllot
+ {
+ SONo = "",
+ WaveNo = "",
+ SODetailNo = 0,
+ StockId = s.Id,
+ LotNo = "",
+ LotText = "",
+ SupplierLot = "",
+ SkuNo = s.SkuNo,
+ SkuName = s.SkuName,
+ Standard = s.Standard,
+ PalletNo = s.PalletNo,
+ IsBale = "0", //鏄惁瑁瑰寘
+ IsBelt = "0", //鏄惁鎵撳甫
+
+ //BoxexQty = s.Qty,
+ Qty = (int)s.Qty,
+ CompleteQty = 0,
+ Status = "1",
+ LogisticsId = 0,
+ IsAdvance = "0",
+ OutMode = model.OutMode,//鍑哄簱鍙�
+
+ CreateUser = userId,
+ CreateTime = DateTime.Now
+ };
+ Db.Insertable(allot).ExecuteCommand();
+
+ #endregion
+
+ #region 娣诲姞鍑哄簱浠诲姟淇℃伅
+
+ var taskNo = new Common().GetMaxNo("TK");
+ var exTask = new LogTask //鍑哄簱浠诲姟
+ {
+ TaskNo = taskNo,
+ Sender = "WMS",
+ Receiver = "WCS",
+ IsSuccess = 1, //鏄惁涓嬪彂鎴愬姛 0澶辫触 1鎴愬姛
+
+ StartLocat = locat == null ? "" : s.LocatNo,//璧峰浣嶇疆
+ EndLocat = model.OutMode,//鐩爣浣嶇疆
+ PalletNo = s.PalletNo,//鎵樼洏鐮�
+ IsSend = 1,//鏄惁鍙啀娆′笅鍙�
+ IsCancel = 1,//鏄惁鍙彇娑�
+ IsFinish = 1,//鏄惁鍙畬鎴�
+ Type = "1",//浠诲姟绫诲瀷 0 鍏ュ簱浠诲姟 1 鍑哄簱浠诲姟 2 绉诲簱浠诲姟
+ Status = "1",//浠诲姟鐘舵��0锛氱瓑寰呮墽琛�1姝e湪鎵ц2鎵ц瀹屾垚
+ OrderType = "1",//0 鍏ュ簱鍗� 1 鍑哄簱鍗� 2 鐩樼偣鍗� 3 绉诲簱鍗�
+ CreateTime = serverTime, //鍒涘缓鏃堕棿
+ CreateUser = userId, //鍒涘缓浜�
+ Msg = "WCS绌烘墭浠�" + locat == null ? "" : s.LocatNo + "鍒�" + model.OutMode + "鐨勫嚭搴撲换鍔�", //鍏抽敭淇℃伅
+ //FinishDate = serverTime, //瀹屾垚鏃堕棿
+ };
+ outDto1.Add(new OutCommandDto()
+ {
+ PalletNo = exTask.PalletNo,//鎵樼洏鍙�
+ StartLocate = exTask.StartLocat, // 璧峰浣嶇疆
+ StartRoadway = locat.RoadwayNo, //鎵�灞炲贩閬�
+ EndLocate = model.OutMode, // 鐩爣浣嶇疆
+ TaskNo = exTask.TaskNo, // 浠诲姟鍙�
+ TaskType = "1",// 浠诲姟绫诲瀷 (鍑哄簱)
+ OutMode = model.OutMode, //鐩爣鍦板潃
+ Order = 1
+ });
+ Db.Insertable(exTask).ExecuteCommand();
+
+ #endregion
+
+ #region 鍌ㄤ綅鐘舵�佸彉鏇�
+ //鏇存敼鍌ㄤ綅鐘舵�佷负鍑哄簱涓�
+ locat.Status = "3"; //3 鍑哄簱涓�
+ Db.Updateable(locat).ExecuteCommand();//淇敼鍌ㄤ綅淇℃伅
+ #endregion
+ }
+ else if (slotBefore.Status == "1")
+ {
+ //鍒ゆ柇鎵樼洏涓婄墿鏂�
+ var pallSku = Db.Queryable<DataStockDetail>().First(m => m.SkuNo == "100099" && m.LocatNo == slotBefore.LocatNo);
+ if (pallSku == null) //绉诲簱
+ {
+ #region 鍒嗛厤
+
+ //娣诲姞鍒嗛厤琛ㄤ俊鎭�
+ var allot = new BllExportAllot
+ {
+ SONo = "",
+ WaveNo = "",
+ SODetailNo = 0,
+ StockId = s.Id,
+ LotNo = "",
+ LotText = "",
+ SupplierLot = "",
+ SkuNo = s.SkuNo,
+ SkuName = s.SkuName,
+ Standard = s.Standard,
+ PalletNo = s.PalletNo,
+ IsBale = "0", //鏄惁瑁瑰寘
+ IsBelt = "0", //鏄惁鎵撳甫
+
+ //BoxexQty = s.Qty,
+ Qty = (int)s.Qty,
+ CompleteQty = 0,
+ Status = "1",
+ LogisticsId = 0,
+ IsAdvance = "0",
+ OutMode = model.OutMode,//鍑哄簱鍙�
+
+ CreateUser = userId,
+ CreateTime = DateTime.Now
+ };
+ Db.Insertable(allot).ExecuteCommand();
+
+ #endregion
+
+ #region 娣诲姞绉诲簱浠诲姟淇℃伅
+
+ var taskNo = new Common().GetMaxNo("TK");
+ var exTask = new LogTask //鍑哄簱浠诲姟
+ {
+ TaskNo = taskNo,
+ Sender = "WMS",
+ Receiver = "WCS",
+ IsSuccess = 1, //鏄惁涓嬪彂鎴愬姛 0澶辫触 1鎴愬姛
+
+ StartLocat = locat == null ? "" : s.LocatNo,//璧峰浣嶇疆
+ EndLocat = model.OutMode,//鐩爣浣嶇疆
+ PalletNo = s.PalletNo,//鎵樼洏鐮�
+ IsSend = 1,//鏄惁鍙啀娆′笅鍙�
+ IsCancel = 1,//鏄惁鍙彇娑�
+ IsFinish = 1,//鏄惁鍙畬鎴�
+ Type = "2",//浠诲姟绫诲瀷 0 鍏ュ簱浠诲姟 1 鍑哄簱浠诲姟 2 绉诲簱浠诲姟
+ Status = "1",//浠诲姟鐘舵��0锛氱瓑寰呮墽琛�1姝e湪鎵ц2鎵ц瀹屾垚
+ OrderType = "1",//0 鍏ュ簱鍗� 1 鍑哄簱鍗� 2 鐩樼偣鍗� 3 绉诲簱鍗�
+ CreateTime = serverTime, //鍒涘缓鏃堕棿
+ CreateUser = userId, //鍒涘缓浜�
+ Msg = "WCS绌烘墭浠�" + locat == null ? "" : s.LocatNo + "鍒�" + model.OutMode + "鐨勭Щ搴撲换鍔�", //鍏抽敭淇℃伅
+ //FinishDate = serverTime, //瀹屾垚鏃堕棿
+ };
+ moveDto.Add(new OutCommandDto()
+ {
+ PalletNo = exTask.PalletNo,//鎵樼洏鍙�
+ StartLocate = exTask.StartLocat, // 璧峰浣嶇疆
+ StartRoadway = locat.RoadwayNo, //鎵�灞炲贩閬�
+ EndLocate = model.OutMode, // 鐩爣浣嶇疆
+ TaskNo = exTask.TaskNo, // 浠诲姟鍙�
+ TaskType = "2",// 浠诲姟绫诲瀷 (鍑哄簱)
+ OutMode = model.OutMode, //鐩爣鍦板潃
+ Order = 1
+ });
+ Db.Insertable(exTask).ExecuteCommand();
+
+ #endregion
+
+ #region 鍌ㄤ綅鐘舵�佸彉鏇�
+ //鏇存敼鍌ㄤ綅鐘舵�佷负绉诲嚭涓�
+ slotBefore.Status = "5"; //5 绉诲嚭涓�
+ Db.Updateable(slotBefore).ExecuteCommand();//淇敼鍌ㄤ綅淇℃伅
+ #endregion
+ }
+ else //鍑哄簱
+ {
+ #region 鏀瑰彉搴撳瓨
+
+ //澧炲姞搴撳瓨閿佸畾鏁伴噺
+ stock.LockQty += (int)s.Qty; //閿佸畾鏁伴噺
+ stock.UpdateTime = serverTime; //淇敼鏃堕棿
+ //stock.UpdateUser = userId; //淇敼浜�
+ Db.Updateable(stock).ExecuteCommand();//淇敼搴撳瓨鎬昏〃淇℃伅
+
+ //澧炲姞搴撳瓨鏄庣粏閿佸畾鏁伴噺
+ s.LockQty += (int)s.Qty; //閿佸畾鏁伴噺
+ s.UpdateTime = serverTime; //淇敼鏃堕棿
+ s.UpdateUser = userId; //淇敼浜�
+ s.Status = "2"; //2 宸插垎閰�
+ Db.Updateable(s).ExecuteCommand();//淇敼搴撳瓨鏄庣粏淇℃伅
+
+ #endregion
+
+ #region 鍒嗛厤
+
+ //娣诲姞鍒嗛厤琛ㄤ俊鎭�
+ var allot = new BllExportAllot
+ {
+ SONo = "",
+ WaveNo = "",
+ SODetailNo = 0,
+ StockId = s.Id,
+ LotNo = "",
+ LotText = "",
+ SupplierLot = "",
+ SkuNo = s.SkuNo,
+ SkuName = s.SkuName,
+ Standard = s.Standard,
+ PalletNo = s.PalletNo,
+ IsBale = "0", //鏄惁瑁瑰寘
+ IsBelt = "0", //鏄惁鎵撳甫
+
+ //BoxexQty = s.Qty,
+ Qty = (int)s.Qty,
+ CompleteQty = 0,
+ Status = "1",
+ LogisticsId = 0,
+ IsAdvance = "0",
+ OutMode = model.OutMode,//鍑哄簱鍙�
+
+ CreateUser = userId,
+ CreateTime = DateTime.Now
+ };
+ Db.Insertable(allot).ExecuteCommand();
+
+ #endregion
+
+ #region 娣诲姞鍑哄簱浠诲姟淇℃伅
+
+ var taskNo = new Common().GetMaxNo("TK");
+ var exTask = new LogTask //鍑哄簱浠诲姟
+ {
+ TaskNo = taskNo,
+ Sender = "WMS",
+ Receiver = "WCS",
+ IsSuccess = 1, //鏄惁涓嬪彂鎴愬姛 0澶辫触 1鎴愬姛
+
+ StartLocat = locat == null ? "" : s.LocatNo,//璧峰浣嶇疆
+ EndLocat = model.OutMode,//鐩爣浣嶇疆
+ PalletNo = s.PalletNo,//鎵樼洏鐮�
+ IsSend = 1,//鏄惁鍙啀娆′笅鍙�
+ IsCancel = 1,//鏄惁鍙彇娑�
+ IsFinish = 1,//鏄惁鍙畬鎴�
+ Type = "1",//浠诲姟绫诲瀷 0 鍏ュ簱浠诲姟 1 鍑哄簱浠诲姟 2 绉诲簱浠诲姟
+ Status = "1",//浠诲姟鐘舵��0锛氱瓑寰呮墽琛�1姝e湪鎵ц2鎵ц瀹屾垚
+ OrderType = "1",//0 鍏ュ簱鍗� 1 鍑哄簱鍗� 2 鐩樼偣鍗� 3 绉诲簱鍗�
+ CreateTime = serverTime, //鍒涘缓鏃堕棿
+ CreateUser = userId, //鍒涘缓浜�
+ Msg = "WCS绌烘墭浠�" + locat == null ? "" : s.LocatNo + "鍒�" + model.OutMode + "鐨勫嚭搴撲换鍔�", //鍏抽敭淇℃伅
+ //FinishDate = serverTime, //瀹屾垚鏃堕棿
+ };
+ outDto2.Add(new OutCommandDto()
+ {
+ PalletNo = exTask.PalletNo,//鎵樼洏鍙�
+ StartLocate = exTask.StartLocat, // 璧峰浣嶇疆
+ StartRoadway = locat.RoadwayNo, //鎵�灞炲贩閬�
+ EndLocate = model.OutMode, // 鐩爣浣嶇疆
+ TaskNo = exTask.TaskNo, // 浠诲姟鍙�
+ TaskType = "1",// 浠诲姟绫诲瀷 (鍑哄簱)
+ OutMode = model.OutMode, //鐩爣鍦板潃
+ Order = 1
+ });
+ Db.Insertable(exTask).ExecuteCommand();
+
+ #endregion
+ #region 鍌ㄤ綅鐘舵�佸彉鏇�
+ //鏇存敼鍌ㄤ綅鐘舵�佷负鍑哄簱涓�
+ slotBefore.Status = "3"; //3 鍑哄簱涓�
+ Db.Updateable(slotBefore).ExecuteCommand();//淇敼鍌ㄤ綅淇℃伅
+ #endregion
+ }
+ if (int.Parse(model.Num) == outDto1.Count + outDto2.Count)
+ {
+ break;//闇�姹傚灈鏁板凡杈惧埌 鍙互鍑哄簱浜�
+ }
+ else
+ {
+ #region 鏀瑰彉搴撳瓨
+
+ //澧炲姞搴撳瓨閿佸畾鏁伴噺
+ stock.LockQty += (int)s.Qty; //閿佸畾鏁伴噺
+ stock.UpdateTime = serverTime; //淇敼鏃堕棿
+ //stock.UpdateUser = userId; //淇敼浜�
+ Db.Updateable(stock).ExecuteCommand();//淇敼搴撳瓨鎬昏〃淇℃伅
+
+ //澧炲姞搴撳瓨鏄庣粏閿佸畾鏁伴噺
+ s.LockQty += (int)s.Qty; //閿佸畾鏁伴噺
+ s.UpdateTime = serverTime; //淇敼鏃堕棿
+ s.UpdateUser = userId; //淇敼浜�
+ s.Status = "2"; //2 宸插垎閰�
+ Db.Updateable(s).ExecuteCommand();//淇敼搴撳瓨鏄庣粏淇℃伅
+
+ #endregion
+
+ #region 鍒嗛厤
+
+ //娣诲姞鍒嗛厤琛ㄤ俊鎭�
+ var allot = new BllExportAllot
+ {
+ SONo = "",
+ WaveNo = "",
+ SODetailNo = 0,
+ StockId = s.Id,
+ LotNo = "",
+ LotText = "",
+ SupplierLot = "",
+ SkuNo = s.SkuNo,
+ SkuName = s.SkuName,
+ Standard = s.Standard,
+ PalletNo = s.PalletNo,
+ IsBale = "0", //鏄惁瑁瑰寘
+ IsBelt = "0", //鏄惁鎵撳甫
+
+ //BoxexQty = s.Qty,
+ Qty = (int)s.Qty,
+ CompleteQty = 0,
+ Status = "1",
+ LogisticsId = 0,
+ IsAdvance = "0",
+ OutMode = model.OutMode,//鍑哄簱鍙�
+
+ CreateUser = userId,
+ CreateTime = DateTime.Now
+ };
+ Db.Insertable(allot).ExecuteCommand();
+
+ #endregion
+
+ #region 娣诲姞鍑哄簱浠诲姟淇℃伅
+
+ var taskNo = new Common().GetMaxNo("TK");
+ var exTask = new LogTask //鍑哄簱浠诲姟
+ {
+ TaskNo = taskNo,
+ Sender = "WMS",
+ Receiver = "WCS",
+ IsSuccess = 1, //鏄惁涓嬪彂鎴愬姛 0澶辫触 1鎴愬姛
+
+ StartLocat = locat == null ? "" : s.LocatNo,//璧峰浣嶇疆
+ EndLocat = model.OutMode,//鐩爣浣嶇疆
+ PalletNo = s.PalletNo,//鎵樼洏鐮�
+ IsSend = 1,//鏄惁鍙啀娆′笅鍙�
+ IsCancel = 1,//鏄惁鍙彇娑�
+ IsFinish = 1,//鏄惁鍙畬鎴�
+ Type = "1",//浠诲姟绫诲瀷 0 鍏ュ簱浠诲姟 1 鍑哄簱浠诲姟 2 绉诲簱浠诲姟
+ Status = "1",//浠诲姟鐘舵��0锛氱瓑寰呮墽琛�1姝e湪鎵ц2鎵ц瀹屾垚
+ OrderType = "1",//0 鍏ュ簱鍗� 1 鍑哄簱鍗� 2 鐩樼偣鍗� 3 绉诲簱鍗�
+ CreateTime = serverTime, //鍒涘缓鏃堕棿
+ CreateUser = userId, //鍒涘缓浜�
+ Msg = "WCS绌烘墭浠�" + locat == null ? "" : s.LocatNo + "鍒�" + model.OutMode + "鐨勫嚭搴撲换鍔�", //鍏抽敭淇℃伅
+ //FinishDate = serverTime, //瀹屾垚鏃堕棿
+ };
+ outDto2.Add(new OutCommandDto()
+ {
+ PalletNo = exTask.PalletNo,//鎵樼洏鍙�
+ StartLocate = exTask.StartLocat, // 璧峰浣嶇疆
+ StartRoadway = locat.RoadwayNo, //鎵�灞炲贩閬�
+ EndLocate = model.OutMode, // 鐩爣浣嶇疆
+ TaskNo = exTask.TaskNo, // 浠诲姟鍙�
+ TaskType = "1",// 浠诲姟绫诲瀷 (鍑哄簱)
+ OutMode = model.OutMode, //鐩爣鍦板潃
+ Order = 1
+ });
+ Db.Insertable(exTask).ExecuteCommand();
+
+ #endregion
+ #region 鍌ㄤ綅鐘舵�佸彉鏇�
+
+ //鏇存敼鍌ㄤ綅鐘舵�佷负鍑哄簱涓�
+ locat.Status = "3"; //3 鍑哄簱涓�
+ Db.Updateable(locat).ExecuteCommand();//淇敼鍌ㄤ綅淇℃伅
+ #endregion
+ }
+ }
+ }
+ }
+ }
+ if (int.Parse(model.Num) == outDto1.Count + outDto2.Count)
+ {
+ break;//闇�姹傚灈鏁板凡杈惧埌 鍙互鍑哄簱浜�
+ }
+ }
+ outDto1.AddRange(moveDto);
+ outDto1.AddRange(outDto2);
+ if (outDto1.Count <= 0)
+ {
+ throw new Exception("鏆傛棤鍑哄簱浠诲姟锛岃鏍告煡!");
+ }
+
+ //娣诲姞鎿嶄綔鏃ュ織璁板綍
+ var k = new OperationSOServer().AddLogOperationSo("PDA妯″潡", "绌烘墭鍑哄簱", int.Parse(model.Num) + "", "涓嬪彂", $"WCS涓嬪彂浜� {int.Parse(model.Num)} 涓┖鎵樺灈", userId);
+ Db.CommitTran();
+
+ return outDto1;
+ }
+ catch (Exception e)
+ {
+ Db.RollbackTran();
+ throw new Exception(e.Message);
+ }
+ }
+
+
public string MoveAddress(string oldAddress, string roadWay, string skuNo)//01020201 鎺�-鍒�-灞�-娣卞害
{
string nowAddress = "";
diff --git a/Wms/WMS.IBLL/IPdaServer/IPdaSoServer.cs b/Wms/WMS.IBLL/IPdaServer/IPdaSoServer.cs
index 9192e5c..0e8e0a5 100644
--- a/Wms/WMS.IBLL/IPdaServer/IPdaSoServer.cs
+++ b/Wms/WMS.IBLL/IPdaServer/IPdaSoServer.cs
@@ -96,6 +96,16 @@
/// <returns></returns>
string IssuePlnOutHouse(OutModePalletVm model, int userId,string url);
+ /// <summary>
+ /// WCS鐢宠绌烘墭鍑哄簱
+ /// </summary>
+ /// <param name="model"> </param>
+ /// <param name="userId"> </param>
+ /// <param name="url"> </param>
+ /// <returns></returns>
+ /// <exception cref="Exception"></exception>
+ List<OutCommandDto> IssuePlnOutHouseWcs(OutModePalletVm model, int userId);
+
/// <summary>
/// 鑾峰彇骞冲簱鎵樼洏淇℃伅
diff --git a/Wms/Wms/Controllers/DownApiController.cs b/Wms/Wms/Controllers/DownApiController.cs
index 99f3998..f407a96 100644
--- a/Wms/Wms/Controllers/DownApiController.cs
+++ b/Wms/Wms/Controllers/DownApiController.cs
@@ -14,6 +14,8 @@
using WMS.IBLL.ILogServer;
using Wms.Tools;
using System.Collections.Generic;
+using Model.ModelVm.PdaVm;
+using WMS.IBLL.IPdaServer;
namespace Wms.Controllers
{
@@ -29,13 +31,16 @@
private readonly IPalletBindServer _asnPalletBindSvc;//鎵樼洏缁戝畾Svc
private readonly IStockCheckServer _crCheckSvc;//鎵樼洏缁戝畾Svc
private readonly ITaskServer _taskSvc;//浠诲姟Svc
- public DownApiController(IOptions<ApiUrlConfig> setting, IExportNoticeServer exNoticeSvc, IPalletBindServer asnPalletBindSvc, IStockCheckServer crCheckSvc, ITaskServer taskSvc)
+ private readonly IPdaSoServer _pdaSoSvc;//绌烘墭鍑哄簱Svc
+
+ public DownApiController(IOptions<ApiUrlConfig> setting, IExportNoticeServer exNoticeSvc, IPalletBindServer asnPalletBindSvc, IStockCheckServer crCheckSvc, ITaskServer taskSvc, IPdaSoServer pdaSoSvc)
{
_config = setting.Value;
_exNoticeSvc = exNoticeSvc;
_asnPalletBindSvc = asnPalletBindSvc;
_crCheckSvc = crCheckSvc;
_taskSvc = taskSvc;
+ _pdaSoSvc = pdaSoSvc;
}
#region WMS鎺ュ彛 璋冪敤涓嬫父绯荤粺鎺ュ彛
@@ -532,6 +537,31 @@
}
}
+ /// <summary>
+ /// WCS鐢宠绌烘墭鍑哄簱
+ /// </summary>
+ /// <param name="model"></param>
+ /// <returns></returns>
+ [AllowAnonymous]
+ [HttpPost]
+ public IActionResult IssuePlnOutHouseWcs(OutModePalletVm model)
+ {
+ var logStr = $@".\log\WCS\WCS鐢宠绌烘墭鍑哄簱" + DateTime.Now.ToString("yyyyMMdd") + ".txt";
+ try
+ {
+ List<OutCommandDto> _list = _pdaSoSvc.IssuePlnOutHouseWcs(model,0);
+
+ return Ok(new { Success = 0, Message = "绌烘墭鐩樺嚭搴撴垚鍔�", TaskList = _list });
+ }
+ catch (Exception e)
+ {
+ LogFile.SaveLogToFile($"WCS鐢宠绌烘墭鍑哄簱寮傚父杩斿洖锛�( {e.Message} ),", logStr);
+
+ return Ok(new ErpModel { Success = -1, Message = e.Message });
+ }
+ }
+
+
///// <summary>
///// 鎴愬搧绠辩爜鎷嗗灈鎷h揣
///// </summary>
--
Gitblit v1.8.0