From a770206c91e495b802b3e9371e06834586ad7715 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期四, 30 十月 2025 20:17:30 +0800
Subject: [PATCH] 1
---
新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/InventoryServices.cs | 355 +++++++++++++++++++++++++++++++++++++++--------------------
1 files changed, 235 insertions(+), 120 deletions(-)
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/InventoryServices.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/InventoryServices.cs"
index e0d0715..6611878 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/InventoryServices.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/InventoryServices.cs"
@@ -4,8 +4,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Reflection.Metadata;
using System.Text;
using System.Threading.Tasks;
+using WIDESEA_Common.OrderEnum;
using WIDESEA_Common.StockEnum;
using WIDESEA_Common.TaskEnum;
using WIDESEA_Common.WareHouseEnum;
@@ -52,7 +54,7 @@
if (response.resultCode != "0")
{
- SendErrorToUpstream(8, "", response.resultMsg ?? "涓婃父鎺ュ彛杩斿洖澶辫触", "");
+ //SendErrorToUpstream(8, "", response.resultMsg ?? "涓婃父鎺ュ彛杩斿洖澶辫触", "");
return responseContent.Error(response.resultMsg ?? "涓婃父鎺ュ彛杩斿洖澶辫触");
}
@@ -80,7 +82,7 @@
catch (Exception ex)
{
Db.Ado.RollbackTran();
- SendErrorToUpstream(8, "", ex.Message, "");
+ //SendErrorToUpstream(8, "", ex.Message, "");
return responseContent.Error("鍚屾澶辫触: " + ex.Message);
}
}
@@ -101,7 +103,7 @@
{
return new ApiResponse<Dt_InventoryInfo> { code = "500", msg = "璇锋眰鍙傛暟鏃犳晥" };
}
-
+ var reslut = WarehouseEnum.绔嬪簱.ObjToInt().ToString("000");
// 2锔忊儯 寮�鍚簨鍔�
BaseDal.Db.Ado.BeginTran();
foreach (var detail in request.details)
@@ -122,143 +124,255 @@
case "1": //鍏ュ簱
{
#region 澶勭悊鍏ュ簱璁㈠崟
- var reslut = WarehouseEnum.绔嬪簱.ObjToInt().ToString("000");
- Dt_CabinOrder cabinOrder = Db.Queryable<Dt_CabinOrder>().Where(x => x.Order_no == request.orderNo && x.Warehouse_no ==reslut).Includes(x => x.Details).First();
- //Dt_CabinOrder cabinOrder = Db.Queryable<Dt_CabinOrder>().Where(x => x.Order_no == request.orderNo && x.Warehouse_no == "001").Includes(x => x.Details).First();
- if (cabinOrder == null || cabinOrder.OdrderStatus == "宸插畬鎴�")
- throw new Exception($"鍏ュ簱鍗曞凡瀹屾垚");
- Dt_CabinOrderDetail cabinOrderDetail = cabinOrder.Details.Where(x => x.Goods_no == detail.productCode && x.Batch_num == detail.batchNo && x.Status == 1).First();
- if (cabinOrderDetail == null || cabinOrderDetail.OrderDetailStatus == "宸插畬鎴�")
- throw new Exception($"鍏ュ簱鍗曟槑缁嗗凡瀹屾垚");
- cabinOrderDetail.Order_Inqty += orderQty;
- if (cabinOrderDetail.Order_Inqty > cabinOrderDetail.Order_qty)
- throw new Exception($"鍏ュ簱鏁伴噺涓嶅彲瓒呭嚭鍗曟嵁鏁伴噺");
- cabinOrder.OdrderStatus = "寮�濮�";
- cabinOrderDetail.OrderDetailStatus = "寮�濮�";
- if (cabinOrderDetail.Order_Inqty == cabinOrderDetail.Order_qty)
- cabinOrderDetail.OrderDetailStatus = "宸插畬鎴�";
- BaseDal.Db.Updateable(cabinOrderDetail).ExecuteCommand();
- var cabinOrder1 = BaseDal.Db.Queryable<Dt_CabinOrder>().Where(x => x.Order_no == cabinOrder.Order_no && x.Warehouse_no == reslut).Includes(x => x.Details).First();
- if (!cabinOrder1.Details.Where(x => x.OrderDetailStatus != "宸插畬鎴�").Any())
- cabinOrder.OdrderStatus = "宸插畬鎴�";
- BaseDal.Db.Updateable(cabinOrder).ExecuteCommand();
- #endregion
- #region 鍒涘缓搴撳瓨淇℃伅
- // 5锔忊儯 鏌ヨ搴撳瓨璇︽儏
- var inventoryInfo = BaseDal.Db.Queryable<Dt_InventoryInfo>()
- .First(x => x.MaterielCode == cabinOrderDetail.Goods_no && x.BatchNo == cabinOrderDetail.Batch_num && x.LocationCode == "绔嬪簱");
- if (inventoryInfo != null)
+ Dt_CabinOrder cabinOrder = Db.Queryable<Dt_CabinOrder>().Where(x => x.Order_no == request.externalOrderNo && x.Warehouse_no == reslut).Includes(x => x.Details).First();
+ if (cabinOrder == null) throw new Exception($"鏈壘鍒板叆搴撳崟鍙枫�恵request.externalOrderNo}銆戠殑鍏ュ簱鍗曚俊鎭�");
+ #region 鍒ゆ柇鏄惁涓虹洏鐩堝叆搴撳崟
+ if (cabinOrder.Order_type == "5")
{
- inventoryInfo.StockQuantity += orderQty;
- inventoryInfo.AvailableQuantity += orderQty;
- inventoryInfo.InDate = DateTime.Now;
- BaseDal.Db.Updateable(inventoryInfo).ExecuteCommand();
- }
- else
- {
- inventoryInfo = new Dt_InventoryInfo
+ foreach (var item in cabinOrder.Details)
{
- PalletCode = detail.orderDetails?.FirstOrDefault()?.palletCode ?? "",
- WarehouseCode = "001",
- LocationCode = "绔嬪簱",
- StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt(),
- MaterielCode = goods.MaterielCode,
- MaterielName = goods.MaterielName,
- MaterielSpec = goods.MaterielSpec,
- BatchNo = detail.batchNo,
- StockQuantity = orderQty,
- OutboundQuantity = 0,
- SupplyQuantity = 0,
- AvailableQuantity = orderQty,
- InDate = DateTime.Now,
- ProductionDate = detail.finishDate.ToString("yyyy-MM-dd"),
- ShelfLife = 0,
- ValidityPeriod = cabinOrderDetail.Exp_date,
- Remark = "WCS鍥炰紶鍒涘缓"
- };
- BaseDal.Db.Insertable(inventoryInfo).ExecuteCommand();
+ Dt_InventoryInfo inventoryInfo = BaseDal.Db.Queryable<Dt_InventoryInfo>()
+ .First(x => x.MaterielCode == item.Goods_no && x.BatchNo == item.Batch_num && x.LocationCode == reslut);
+ var qty = inventoryInfo.SupplyQuantity - inventoryInfo.StockQuantity;
+ if (orderQty != qty)
+ throw new Exception($"鐩樼泩鍏ュ簱鏁伴噺涓嶄竴鑷�,涓婁紶鏁伴噺銆恵orderQty}銆�,搴撳瓨鐩樼泩鏁伴噺銆恵qty}銆�");
+ inventoryInfo.StockQuantity = inventoryInfo.SupplyQuantity;
+ inventoryInfo.SupplyQuantity = 0;
+ inventoryInfo.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
+ #region 娣诲姞鐩樼泩鍏ュ簱浠诲姟
+ Dt_SupplyTask_Hty supplyTask_Hty = new Dt_SupplyTask_Hty()
+ {
+ WarehouseCode = inventoryInfo.WarehouseCode,
+ OperateType = OperateTypeEnum.鑷姩瀹屾垚.ToString(),
+ InsertTime = DateTime.Now,
+ TaskStatus = SupplyStatusEnum.InFinish.ObjToInt(),
+ BatchNo = inventoryInfo.BatchNo,
+ MaterielName = inventoryInfo.MaterielName,
+ MaterielCode = inventoryInfo.MaterielCode,
+ MaterielSpec = inventoryInfo.MaterielSpec,
+ TaskType = TaskTypeEnum.ChenckIn.ObjToInt(),
+ CreateDate = DateTime.Now,
+ Creater = App.User.UserName,
+ LocationCode = inventoryInfo.LocationCode,
+ OrderNo = cabinOrder.Order_no,
+ StockQuantity = orderQty,
+ SupplyQuantity = 0,
+ Remark = "鐩樼泩鍏ュ簱"
+ };
+ #endregion
+ var inventory_Batch = BaseDal.Db.Queryable<Dt_Inventory_Batch>()
+ .First(x => x.MaterielCode == inventoryInfo.MaterielCode && x.BatchNo == inventoryInfo.BatchNo);
+ inventory_Batch.StockQuantity = inventory_Batch.SupplyQuantity;
+ inventory_Batch.SupplyQuantity = 0;
+ item.OrderDetailStatus = "宸插畬鎴�";
+ BaseDal.Db.Updateable(item).ExecuteCommand();
+ BaseDal.Db.Updateable(inventoryInfo).ExecuteCommand();
+ BaseDal.Db.Updateable(inventory_Batch).ExecuteCommand();
+ BaseDal.Db.Insertable(supplyTask_Hty).ExecuteCommand();
+ }
+ var cabinOrder1 = BaseDal.Db.Queryable<Dt_CabinOrder>().Where(x => x.Id == cabinOrder.Id).Includes(x => x.Details).First();
+ if (!cabinOrder1.Details.Where(x => x.OrderDetailStatus != "宸插畬鎴�").Any())
+ cabinOrder.OdrderStatus = "宸插畬鎴�";
+ BaseDal.Db.Updateable(cabinOrder).ExecuteCommand();
}
#endregion
-
- #region 鍒涘缓搴撳瓨鎵规淇℃伅
- // 6锔忊儯 鏌ヨ搴撳瓨鎵规淇℃伅
- var inventory_Batch = BaseDal.Db.Queryable<Dt_Inventory_Batch>()
- .First(x => x.MaterielCode == inventoryInfo.MaterielCode && x.BatchNo == inventoryInfo.BatchNo);
-
- if (inventory_Batch != null)
- {
- inventory_Batch.StockQuantity += orderQty;
- inventory_Batch.AvailableQuantity += orderQty;
- BaseDal.Db.Updateable(inventory_Batch).ExecuteCommand();
- }
else
{
- inventory_Batch = new Dt_Inventory_Batch
+ if (cabinOrder == null || cabinOrder.OdrderStatus == "宸插畬鎴�")
+ throw new Exception($"鍏ュ簱鍗曞凡瀹屾垚");
+ Dt_CabinOrderDetail cabinOrderDetail = cabinOrder.Details.Where(x => x.Goods_no == detail.productCode && x.Batch_num == detail.batchNo && x.Status == 1).First();
+ if (cabinOrderDetail == null || cabinOrderDetail.OrderDetailStatus == "宸插畬鎴�")
+ throw new Exception($"鍏ュ簱鍗曟槑缁嗗凡瀹屾垚");
+ cabinOrderDetail.Order_Inqty += orderQty;
+ if (cabinOrderDetail.Order_Inqty > cabinOrderDetail.Order_qty)
+ throw new Exception($"鍏ュ簱鏁伴噺涓嶅彲瓒呭嚭鍗曟嵁鏁伴噺");
+ cabinOrder.OdrderStatus = "寮�濮�";
+ cabinOrderDetail.OrderDetailStatus = "寮�濮�";
+ if (cabinOrderDetail.Order_Inqty == cabinOrderDetail.Order_qty)
+ cabinOrderDetail.OrderDetailStatus = "宸插畬鎴�";
+ BaseDal.Db.Updateable(cabinOrderDetail).ExecuteCommand();
+ var cabinOrder1 = BaseDal.Db.Queryable<Dt_CabinOrder>().Where(x => x.Order_no == cabinOrder.Order_no && x.Warehouse_no == reslut).Includes(x => x.Details).First();
+ if (!cabinOrder1.Details.Where(x => x.OrderDetailStatus != "宸插畬鎴�").Any())
+ cabinOrder.OdrderStatus = "宸插畬鎴�";
+ BaseDal.Db.Updateable(cabinOrder).ExecuteCommand();
+ #endregion
+
+ #region 鍒涘缓搴撳瓨淇℃伅
+ // 5锔忊儯 鏌ヨ搴撳瓨璇︽儏
+ var inventoryInfo = BaseDal.Db.Queryable<Dt_InventoryInfo>()
+ .First(x => x.MaterielCode == cabinOrderDetail.Goods_no && x.BatchNo == cabinOrderDetail.Batch_num && x.LocationCode == "绔嬪簱");
+ if (inventoryInfo != null)
{
- MaterielCode = inventoryInfo.MaterielCode,
- MaterielName = inventoryInfo.MaterielName,
- MaterielSpec = inventoryInfo.MaterielSpec,
+ inventoryInfo.StockQuantity += orderQty;
+ inventoryInfo.AvailableQuantity += orderQty;
+ inventoryInfo.InDate = DateTime.Now;
+ BaseDal.Db.Updateable(inventoryInfo).ExecuteCommand();
+ }
+ else
+ {
+ inventoryInfo = new Dt_InventoryInfo
+ {
+ PalletCode = detail.orderDetails?.FirstOrDefault()?.palletCode ?? "",
+ WarehouseCode = "001",
+ LocationCode = "绔嬪簱",
+ StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt(),
+ MaterielCode = goods.MaterielCode,
+ MaterielName = goods.MaterielName,
+ MaterielSpec = goods.MaterielSpec,
+ BatchNo = detail.batchNo,
+ StockQuantity = orderQty,
+ OutboundQuantity = 0,
+ SupplyQuantity = 0,
+ AvailableQuantity = orderQty,
+ InDate = DateTime.Now,
+ ProductionDate = detail.finishDate.ToString("yyyy-MM-dd"),
+ ShelfLife = 0,
+ ValidityPeriod = cabinOrderDetail.Exp_date,
+ Remark = "鏅鸿兘绔嬪簱"
+ };
+ BaseDal.Db.Insertable(inventoryInfo).ExecuteCommand();
+ }
+ #endregion
+
+ #region 鍒涘缓搴撳瓨鎵规淇℃伅 鍙湁涓嶆槸璋冩嫧鍏ュ簱鍗曪紙115锛夋墠瀵规壒娆′俊鎭繘琛屼慨鏀�
+ if (cabinOrder.Order_type != InOrderTypeEnum.Allocat.ObjToInt().ToString())
+ {
+ // 6锔忊儯 鏌ヨ搴撳瓨鎵规淇℃伅
+ var inventory_Batch = BaseDal.Db.Queryable<Dt_Inventory_Batch>()
+ .First(x => x.MaterielCode == inventoryInfo.MaterielCode && x.BatchNo == inventoryInfo.BatchNo);
+
+ if (inventory_Batch != null)
+ {
+ inventory_Batch.StockQuantity += orderQty;
+ inventory_Batch.AvailableQuantity += orderQty;
+ BaseDal.Db.Updateable(inventory_Batch).ExecuteCommand();
+ }
+ else
+ {
+ inventory_Batch = new Dt_Inventory_Batch
+ {
+ MaterielCode = inventoryInfo.MaterielCode,
+ MaterielName = inventoryInfo.MaterielName,
+ MaterielSpec = inventoryInfo.MaterielSpec,
+ BatchNo = inventoryInfo.BatchNo,
+ StockQuantity = inventoryInfo.StockQuantity,
+ OutboundQuantity = inventoryInfo.OutboundQuantity,
+ AvailableQuantity = inventoryInfo.AvailableQuantity,
+ SupplyQuantity = inventoryInfo.SupplyQuantity,
+ ERPStockQuantity = 0,
+ Status = false,
+ ProductionDate = detail.finishDate.ToString("yyyy-MM-dd"),
+ ValidityPeriod = inventoryInfo.ValidityPeriod.ObjToDate(),
+ Remark = "鑷姩鍒涘缓"
+ };
+ BaseDal.Db.Insertable(inventory_Batch).ExecuteCommand();
+ }
+ }
+ #endregion
+
+ #region 娣诲姞鍏ュ簱浠诲姟鍘嗗彶
+ Dt_SupplyTask_Hty supplyTask_Hty = new Dt_SupplyTask_Hty()
+ {
+ WarehouseCode = inventoryInfo.WarehouseCode,
+ TaskNum = cabinOrderDetail.Id,
+ OperateType = OperateTypeEnum.鑷姩瀹屾垚.ToString(),
+ InsertTime = DateTime.Now,
+ TaskStatus = SupplyStatusEnum.InFinish.ObjToInt(),
BatchNo = inventoryInfo.BatchNo,
- StockQuantity = inventoryInfo.StockQuantity,
- OutboundQuantity = inventoryInfo.OutboundQuantity,
- AvailableQuantity = inventoryInfo.AvailableQuantity,
- SupplyQuantity = inventoryInfo.SupplyQuantity,
- ERPStockQuantity = 0,
- Status = false,
- ProductionDate = detail.finishDate.ToString("yyyy-MM-dd"),
- ValidityPeriod = inventoryInfo.ValidityPeriod,
- Remark = "鑷姩鍒涘缓"
+ MaterielName = inventoryInfo.MaterielName,
+ MaterielCode = inventoryInfo.MaterielCode,
+ MaterielSpec = inventoryInfo.MaterielSpec,
+ TaskType = cabinOrder.Order_type == "1" ? TaskTypeEnum.In.ObjToInt() : TaskTypeEnum.OutReturn.ObjToInt(),
+ CreateDate = DateTime.Now,
+ Creater = App.User.UserName,
+ LocationCode = inventoryInfo.LocationCode,
+ OrderNo = cabinOrder.Order_no,
+ StockQuantity = orderQty,
+ SupplyQuantity = 0,
+ Remark = "鍏ュ簱"
};
- BaseDal.Db.Insertable(inventory_Batch).ExecuteCommand();
+ //杩欓噷杩欓噷鐨勫叆搴撹皟鎷ㄥ崟鐘舵�佹槸115锛屽氨灏嗚皟鎷ㄤ换鍔$姸鎬佹敼涓�7
+ if (cabinOrder.Order_type == InOrderTypeEnum.Allocat.ObjToInt().ToString()) supplyTask_Hty.TaskType = TaskTypeEnum.AllocatIn.ObjToInt();
+ BaseDal.Db.Insertable(supplyTask_Hty).ExecuteCommand();
+ #endregion
}
- #endregion
-
- #region 娣诲姞鍏ュ簱浠诲姟鍘嗗彶
- Dt_SupplyTask_Hty supplyTask_Hty = new Dt_SupplyTask_Hty()
- {
- WarehouseCode = inventoryInfo.WarehouseCode,
- TaskNum = cabinOrderDetail.Id,
- OperateType = OperateTypeEnum.鑷姩瀹屾垚.ToString(),
- InsertTime = DateTime.Now,
- TaskStatus = SupplyStatusEnum.InFinish.ObjToInt(),
- BatchNo = inventoryInfo.BatchNo,
- MaterielName = inventoryInfo.MaterielName,
- MaterielCode = inventoryInfo.MaterielCode,
- MaterielSpec = inventoryInfo.MaterielSpec,
- TaskType = TaskTypeEnum.InPick.ObjToInt(),
- CreateDate = DateTime.Now,
- Creater = App.User.UserName,
- LocationCode = inventoryInfo.LocationCode,
- OrderNo = cabinOrder.Order_no,
- StockQuantity = orderQty,
- SupplyQuantity = 0,
- Remark = "鍏ュ簱"
- };
- BaseDal.Db.Insertable(supplyTask_Hty).ExecuteCommand();
- #endregion
-
- //UpdateInboundOrderDetailStatus(request.orderNo, detail.batchNo, detail.productCode);
}
break;
case "2":
{
- #region 鎵惧嚭搴撲换鍔�
- Dt_SupplyTask supplyTask = Db.Queryable<Dt_SupplyTask>().Where(x => x.MaterielCode == detail.productCode && x.BatchNo == detail.batchNo && x.OrderNo == request.orderNo && x.WarehouseCode == WarehouseEnum.绔嬪簱.ObjToInt().ToString("000") && x.TaskStatus == SupplyStatusEnum.NewOut.ObjToInt()).First();
- if (supplyTask == null) throw new Exception($"鏈壘鍒拌鍗曞彿銆恵request.orderNo}銆戠墿鏂欑紪鍙枫�恵detail.productCode}銆戠殑鍑哄簱浠诲姟");
- if (supplyTask.StockQuantity != orderQty) throw new Exception($"璁㈠崟鍙枫�恵request.orderNo}銆戠墿鏂欑紪鍙枫�恵detail.productCode}銆戠殑鍑哄簱鏁伴噺涓庡嚭搴撲换鍔℃暟閲忎笉鐩哥瓑");
- #endregion
+ Dt_DeliveryOrder cabinOrder = Db.Queryable<Dt_DeliveryOrder>().Where(x => x.Out_no == request.externalOrderNo && x.Warehouse_no == reslut).Includes(x => x.Details).First();
+ if (cabinOrder == null) throw new Exception($"鏈壘鍒板嚭搴撳崟鍙枫�恵request.externalOrderNo}銆戠殑鍏ュ簱鍗曚俊鎭�");
- #region 澶勭悊鍑哄簱鍗曘�佸簱瀛樹俊鎭�佸嚭搴撲换鍔°�佽皟鎷ㄤ换鍔�
- _deliveryOrderServices.OutTaskFinish(supplyTask);
- #endregion
+ if (cabinOrder.Out_type == "6")
+ {
+ foreach (var item in cabinOrder.Details)
+ {
+ Dt_InventoryInfo inventoryInfo = BaseDal.Db.Queryable<Dt_InventoryInfo>()
+ .First(x => x.MaterielCode == item.Goods_no && x.BatchNo == item.Batch_num && x.LocationCode == reslut);
+ var qty = inventoryInfo.StockQuantity - inventoryInfo.SupplyQuantity;
+ if (orderQty != qty)
+ throw new Exception($"鐩樹簭鍑哄簱鏁伴噺涓嶄竴鑷�,涓婁紶鏁伴噺銆恵orderQty}銆�,搴撳瓨鐩樹簭鏁伴噺銆恵qty}銆�");
+ inventoryInfo.StockQuantity = inventoryInfo.SupplyQuantity;
+ inventoryInfo.SupplyQuantity = 0;
+ inventoryInfo.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
+ #region 娣诲姞鐩樹簭鍑哄簱浠诲姟
+ Dt_SupplyTask_Hty supplyTask_Hty = new Dt_SupplyTask_Hty()
+ {
+ WarehouseCode = inventoryInfo.WarehouseCode,
+ OperateType = OperateTypeEnum.鑷姩瀹屾垚.ToString(),
+ InsertTime = DateTime.Now,
+ TaskStatus = SupplyStatusEnum.OutFinish.ObjToInt(),
+ BatchNo = inventoryInfo.BatchNo,
+ MaterielName = inventoryInfo.MaterielName,
+ MaterielCode = inventoryInfo.MaterielCode,
+ MaterielSpec = inventoryInfo.MaterielSpec,
+ TaskType = TaskTypeEnum.ChenckOut.ObjToInt(),
+ CreateDate = DateTime.Now,
+ Creater = App.User.UserName,
+ LocationCode = inventoryInfo.LocationCode,
+ OrderNo = cabinOrder.Out_no,
+ StockQuantity = orderQty,
+ SupplyQuantity = 0,
+ Remark = "鐩樹簭鍑哄簱"
+ };
+ #endregion
+ var inventory_Batch = BaseDal.Db.Queryable<Dt_Inventory_Batch>()
+ .First(x => x.MaterielCode == inventoryInfo.MaterielCode && x.BatchNo == inventoryInfo.BatchNo);
+ inventory_Batch.StockQuantity = inventory_Batch.SupplyQuantity;
+ inventory_Batch.SupplyQuantity = 0;
+ item.OotDetailStatus = "宸插畬鎴�";
+ BaseDal.Db.Updateable(item).ExecuteCommand();
+ BaseDal.Db.Updateable(inventoryInfo).ExecuteCommand();
+ BaseDal.Db.Updateable(inventory_Batch).ExecuteCommand();
+ BaseDal.Db.Insertable(supplyTask_Hty).ExecuteCommand();
+ }
+ var cabinOrder1 = BaseDal.Db.Queryable<Dt_DeliveryOrder>().Where(x => x.Id == cabinOrder.Id).Includes(x => x.Details).First();
+ if (!cabinOrder1.Details.Where(x => x.OotDetailStatus != "宸插畬鎴�").Any())
+ cabinOrder.OutStatus = "宸插畬鎴�";
+ BaseDal.Db.Updateable(cabinOrder).ExecuteCommand();
+ }
+ else
+ {
+ #region 鎵惧嚭搴撲换鍔�
+ Dt_SupplyTask supplyTask = Db.Queryable<Dt_SupplyTask>().Where(x => x.MaterielCode == detail.productCode && x.BatchNo == detail.batchNo && x.OrderNo == request.externalOrderNo && x.WarehouseCode == reslut && x.TaskStatus == SupplyStatusEnum.NewOut.ObjToInt()).First();
+ if (supplyTask == null) throw new Exception($"鏈壘鍒拌鍗曞彿銆恵request.externalOrderNo}銆戠墿鏂欑紪鍙枫�恵detail.productCode}銆戠殑鍑哄簱浠诲姟");
+ if (supplyTask.StockQuantity != orderQty) throw new Exception($"璁㈠崟鍙枫�恵request.orderNo}銆戠墿鏂欑紪鍙枫�恵detail.productCode}銆戠殑鍑哄簱鏁伴噺涓庡嚭搴撲换鍔℃暟閲忎笉鐩哥瓑");
+ #endregion
+
+ #region 澶勭悊鍑哄簱鍗曘�佸簱瀛樹俊鎭�佸嚭搴撲换鍔°�佽皟鎷ㄤ换鍔�
+ var content = _deliveryOrderServices.OutTaskFinish(supplyTask);
+ if (!content.Status) throw new Exception(content.Message);
+ #endregion
+ }
}
break;
case "3": // 鐩樼偣
{
+ var WarehouseLK = WarehouseEnum.绔嬪簱.ObjToInt().ToString("000");
#region 鎵剧洏鐐逛换鍔�
- Dt_SupplyTask supplyTask = Db.Queryable<Dt_SupplyTask>().Where(x => x.MaterielCode == detail.productCode && x.BatchNo == detail.batchNo && x.OrderNo == request.orderNo && x.WarehouseCode == WarehouseEnum.绔嬪簱.ObjToInt().ToString("000") && x.TaskStatus == SupplyStatusEnum.NewCheck.ObjToInt()).First();
- if (supplyTask == null) throw new Exception($"鏈壘鍒拌鍗曞彿銆恵request.orderNo}銆戠墿鏂欑紪鍙枫�恵detail.productCode}銆戠殑鐩樼偣浠诲姟");
+ Dt_SupplyTask supplyTask = Db.Queryable<Dt_SupplyTask>().Where(x => x.MaterielCode == detail.productCode && x.BatchNo == detail.batchNo && x.OrderNo == request.externalOrderNo && x.WarehouseCode == WarehouseLK && x.TaskStatus == SupplyStatusEnum.NewCheck.ObjToInt()).First();
+ if (supplyTask == null) throw new Exception($"鏈壘鍒拌鍗曞彿銆恵request.externalOrderNo}銆戠墿鏂欑紪鍙枫�恵detail.productCode}銆戠殑鐩樼偣浠诲姟");
#endregion
if (detail.isLossOrProfit == 1) // 鐩樹簭
{
@@ -272,7 +386,8 @@
{
supplyTask.SupplyQuantity = supplyTask.StockQuantity;
}
- _deliveryOrderServices.CheckTaskFinish(supplyTask);
+ var content = _deliveryOrderServices.CheckTaskFinish(supplyTask);
+ if (!content.Status) throw new Exception(content.Message);
}
break;
}
--
Gitblit v1.9.3