From 02e4718a9a3f03e2385d4e26ffbedf1ceb89908e Mon Sep 17 00:00:00 2001
From: yanjinhui <3306209981@qq.com>
Date: 星期三, 19 十一月 2025 09:32:27 +0800
Subject: [PATCH] 优化人工入库,防止人工出现散件
---
新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Check.cs | 27 ++++++++++++++++++---------
1 files changed, 18 insertions(+), 9 deletions(-)
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Check.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Check.cs"
index ee73c0a..0e53a22 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Check.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Check.cs"
@@ -33,11 +33,18 @@
//List<Dt_SupplyTask> supplyTasks = new List<Dt_SupplyTask>();
List<Dt_SupplyTask> supplyTasks1 = new List<Dt_SupplyTask>();
List<Dt_InventoryInfo> _InventoryInfos = new List<Dt_InventoryInfo>();
- List<Dt_Inventory_Batch> inventory_Batches = _inventory_BatchServices.Repository.QueryData(x => keys.Contains(x.Id));
+ List<Dt_Inventory_Batch> inventory_Batches = _inventory_BatchServices.Repository.QueryData(x => keys.Contains(x.Id)).ToList();
foreach (var item in inventory_Batches)
{
var supplyTasks = _supplyTaskService.Repository.QueryData(x => x.MaterielCode == item.MaterielCode && x.BatchNo == item.BatchNo && x.TaskStatus == SupplyStatusEnum.NewCheck.ObjToInt()).ToList();
- if (item.SupplyQuantity != 0) throw new Exception($"鐗╂枡缂栧彿銆恵item.MaterielCode}銆戞壒娆″彿銆恵item.BatchNo}銆戝凡瀛樺湪鐩樼偣宸紓!");
+ //if (item.SupplyQuantity != 0) throw new Exception($"鐗╂枡缂栧彿銆恵item.MaterielCode}銆戞壒娆″彿銆恵item.BatchNo}銆戝凡瀛樺湪鐩樼偣宸紓!");
+ if (item.SupplyQuantity != 0)
+ {
+ item.SupplyQuantity = 0;
+ // 杩欓噷闇�瑕佹洿鏂版壒娆¤〃鐨勫樊寮傛暟閲�
+ _inventory_BatchServices.UpdateData(item);
+ }
+
if (supplyTasks.Count > 0) throw new Exception($"鐗╂枡缂栧彿銆恵item.MaterielCode}銆戞壒娆″彿銆恵item.BatchNo}銆戝凡瀛樺湪鐩樼偣浠诲姟锛岃鍏堝畬鎴愬綋鍓嶇洏鐐逛换鍔�");
supplyTasks = _supplyTaskService.Repository.QueryData(x => x.MaterielCode == item.MaterielCode && x.BatchNo == item.BatchNo && x.TaskStatus == SupplyStatusEnum.NewOut.ObjToInt()).ToList();
if (supplyTasks.Count > 0) throw new Exception($"鐗╂枡缂栧彿銆恵item.MaterielCode}銆戞壒娆″彿銆恵item.BatchNo}銆戝凡瀛樺湪鍑哄簱浠诲姟锛岃鍏堝畬鎴愬綋鍓嶅嚭搴撲换鍔�");
@@ -79,6 +86,8 @@
#region 鍒涘缓鐩樼偣浠诲姟
foreach (var inventory in items)
{
+ //鍦ㄥ垱寤虹洏鐐逛换鍔℃椂閲嶇疆搴撳瓨鐨勭洏鐐瑰樊寮備负0
+ inventory.SupplyQuantity = 0;
Dt_SupplyTask supplyTask = new Dt_SupplyTask()
{
WarehouseCode = inventory.WarehouseCode,
@@ -167,7 +176,7 @@
/// </summary>
/// <param name="saveModel"></param>
/// <returns></returns>
- public WebResponseContent GetCheckOutTasks(SaveModel saveModel)
+ public WebResponseContent CheckOutTasks(SaveModel saveModel)
{
WebResponseContent content = new WebResponseContent();
try
@@ -206,7 +215,7 @@
{
var LocationCode = saveModel.MainData["locationCode"].ToString();
var TaskId = saveModel.MainData["taskId"].ObjToInt();
- var qty = saveModel.MainData["qty"].ObjToInt();
+ var qty = saveModel.MainData["qty"].ObjToDecimal();
Dt_SupplyTask supplyTask = _supplyTaskService.Repository.QueryFirst(x => x.TaskId == TaskId && x.TaskStatus == SupplyStatusEnum.NewCheck.ObjToInt());
if (supplyTask == null) throw new Exception("褰撳墠鐩樼偣浠诲姟宸插畬鎴�");
if (supplyTask.LocationCode != LocationCode) throw new Exception($"褰撳墠鐩樼偣璐т綅銆恵LocationCode}銆戜笌浠诲姟鍒嗛厤璐т綅涓嶅尮閰�");
@@ -235,7 +244,7 @@
Dt_MaterielInfo materielInfo = _materielInfoService.Repository.QueryFirst(x => x.MaterielCode == cabinOrderDetail.Goods_no);
if (materielInfo == null) return WebResponseContent.Instance.Error($"璇风淮鎶ょ墿鏂欑紪鍙枫�恵cabinOrderDetail.Goods_no}銆戠殑鐗╂枡淇℃伅");
cabinOrderDetail.Order_Outqty += supplyTask.SupplyQuantity;
- #region 骞冲簱鐩樼偣鍙兘鍑虹幇鏁寸宸紓
+ #region 骞冲簱锛堝ぇ浠跺簱锛夌洏鐐瑰彧鑳藉嚭鐜版暣绠卞樊寮�
if (supplyTask.WarehouseCode == WarehouseEnum.澶т欢搴�.ObjToInt().ToString("000") && materielInfo.MaterielSourceType != MaterielSourceTypeEnum.PurchasePart)
{
var Qty = supplyTask.SupplyQuantity % materielInfo.BoxQty;
@@ -249,8 +258,8 @@
#endregion
#region 搴撳瓨
- List<Dt_Inventory_Batch> inventory_Batchs = _inventory_BatchServices.Repository.QueryData(x => cabinOrder.Details.Select(x => x.Goods_no).Contains(x.MaterielCode));
- List<Dt_InventoryInfo> inventoryInfos = _inventoryInfoService.Repository.QueryData(x => cabinOrder.Details.Select(x => x.Goods_no).Contains(x.MaterielCode) && x.WarehouseCode == supplyTask.WarehouseCode && x.StockStatus == StockStatusEmun.鐩樼偣閿佸畾.ObjToInt());
+ List<Dt_Inventory_Batch> inventory_Batchs = _inventory_BatchServices.Repository.QueryData(x => cabinOrder.Details.Select(x => x.Goods_no).Contains(x.MaterielCode)).ToList();
+ List<Dt_InventoryInfo> inventoryInfos = _inventoryInfoService.Repository.QueryData(x => cabinOrder.Details.Select(x => x.Goods_no).Contains(x.MaterielCode) && x.WarehouseCode == supplyTask.WarehouseCode && x.StockStatus == StockStatusEmun.鐩樼偣閿佸畾.ObjToInt()).ToList();
Dt_InventoryInfo? inventoryInfo = new();
List<Dt_InventoryInfo> inventoryInfosDel = new List<Dt_InventoryInfo>();
if (supplyTask.WarehouseCode != WarehouseEnum.绔嬪簱.ObjToInt().ToString("000"))
@@ -263,7 +272,7 @@
inventoryInfo = inventoryInfos.FirstOrDefault(x => x.BatchNo == cabinOrderDetail.Batch_num && x.MaterielCode == cabinOrderDetail.Goods_no);
}
if (inventoryInfo == null) return WebResponseContent.Instance.Error($"鏈壘鍒扮珛搴撶殑搴撳瓨淇℃伅");
- inventoryInfo.SupplyQuantity = supplyTask.SupplyQuantity - inventoryInfo.StockQuantity;
+ inventoryInfo.SupplyQuantity = supplyTask.SupplyQuantity - inventoryInfo.StockQuantity;//鐩樼偣宸紓鏁�
#endregion
List<Dt_SupplyTask> supplyTasks = _supplyTaskService.Repository.QueryData(x => x.OrderNo == supplyTask.OrderNo && x.TaskStatus == SupplyStatusEnum.NewCheck.ObjToInt() && x.TaskId != supplyTask.TaskId).ToList();//鏌ユ壘褰撳墠鐩樼偣鍗曠殑鐩樼偣浠诲姟
@@ -275,7 +284,7 @@
#region 澶勭悊褰撳墠鐗╂枡鎵规鐨勫簱瀛樺拰鎵规淇℃伅
Dt_Inventory_Batch inventory_Batch = inventory_Batchs.First(x => x.BatchNo == inventoryInfo.BatchNo && x.MaterielCode == inventoryInfo.MaterielCode);
var SupplyQuantitys = inventoryInfos.Where(x => x.BatchNo == inventoryInfo.BatchNo && x.MaterielCode == inventoryInfo.MaterielCode).Sum(x => x.SupplyQuantity);
- if (SupplyQuantitys == 0)
+ if (SupplyQuantitys == 0)//涓嶅瓨鍦ㄧ洏鐐瑰樊寮�
{
foreach (var item in inventoryInfos.Where(x => x.BatchNo == inventoryInfo.BatchNo && x.MaterielCode == inventoryInfo.MaterielCode))
{
--
Gitblit v1.9.3