From 2075957d9c0c87e66b0392fdc0a2d5b9290dfee5 Mon Sep 17 00:00:00 2001
From: 南骏 池 <chiffly@163.com>
Date: 星期五, 14 二月 2025 08:22:54 +0800
Subject: [PATCH] 1.成品入库后台完成 2.报工后台优化
---
service/Warehouse/MesInvItemOutsManager.cs | 67 ++++++++-------------------------
1 files changed, 17 insertions(+), 50 deletions(-)
diff --git a/service/Warehouse/MesInvItemOutsManager.cs b/service/Warehouse/MesInvItemOutsManager.cs
index 59c5394..413e251 100644
--- a/service/Warehouse/MesInvItemOutsManager.cs
+++ b/service/Warehouse/MesInvItemOutsManager.cs
@@ -340,9 +340,7 @@
}
if (!UtilityHelper.CheckGuid(parsedGuid))
- {
throw new ApplicationException("鏇存柊閿欒锛屾暟鎹槸涓嶅悎娉曠殑");
- }
var userName = entity.userName ?? "system";
return Db.Updateable<MesInvItemOuts>()
@@ -382,10 +380,7 @@
message.Pid = newGuid;
var executeReturnIdentity =
Db.Insertable(message).IgnoreColumns(true).ExecuteCommand();
- if (executeReturnIdentity > 0)
- {
- return message;
- }
+ if (executeReturnIdentity > 0) return message;
throw new Exception("鑾峰彇鏁版嵁澶辫触");
}
@@ -410,7 +405,7 @@
var dto = new OutItemDto();
- dto.SumItem = GetItems(query);
+ //dto.SumItem = GetItems(query);
var mesInvItemStocks = Db.Queryable<MesInvItemStocks>()
.Where(a => a.ItemBarcode == query.barcode).Single();
@@ -528,7 +523,7 @@
FUnitID = d.Fnumber,
FLot = b.WorkNo,
F_MES_ENTRYID = b.Guid,
- FsrcEntryId = e.Guid.ToString(),
+ FsrcEntryId = e.Guid.ToString()
}).ToList();
@@ -537,13 +532,13 @@
var jsonEntries = materials.Select(d => new
{
- FMaterialId = d.FMaterialId,
- FRMREALQTY = d.FRMREALQTY,
- FStockId = d.FStockId,
- FUnitID = d.FUnitID,
- FLot = d.FLot,
+ d.FMaterialId,
+ d.FRMREALQTY,
+ d.FStockId,
+ d.FUnitID,
+ d.FLot,
F_MES_ENTRYID = d.F_MES_ENTRYID.ToString(),
- FsrcEntryId = d.FsrcEntryId,
+ d.FsrcEntryId
}).ToList();
var fdate = DateTime.Now.ToString("yyyy-MM-dd");
var jsonString = JsonConvert.SerializeObject(jsonEntries);
@@ -642,10 +637,7 @@
//璋冪敤瀛樺偍杩囩▼
var prcRfPdaBarcodeCgth = PrcRfPdaBarcodeCgth(query);
- if (!prcRfPdaBarcodeCgth)
- {
- throw new Exception("鎵ц澶辫触");
- }
+ if (!prcRfPdaBarcodeCgth) throw new Exception("鎵ц澶辫触");
// 鍙橀噺鐢ㄤ簬淇濆瓨鏌ヨ缁撴灉
decimal? C_SQ_QTY = 0;
@@ -687,10 +679,7 @@
var commit = UseTransaction(db =>
{
- if (string.IsNullOrEmpty(p_bill_no))
- {
- throw new Exception("璇烽�夊彇鍗曟嵁鍙凤紒");
- }
+ if (string.IsNullOrEmpty(p_bill_no)) throw new Exception("璇烽�夊彇鍗曟嵁鍙凤紒");
// Retrieve mes_inv_item_outs
var c_mes_inv_item_outs = db.Queryable<MesInvItemOuts>()
@@ -698,19 +687,13 @@
.First();
if (c_mes_inv_item_outs == null)
- {
throw new Exception("璇烽�夋嫨鎴栨壂鎻忔纭殑閲囪喘閫�璐у崟锛�");
- }
if (c_mes_inv_item_outs.Status == 0)
- {
throw new Exception("閲囪喘閫�璐х敵璇峰崟鏈鏍革紒");
- }
if (c_mes_inv_item_outs.Nflag == 1)
- {
throw new Exception("閲囪喘閫�璐у崟宸插畬缁撴帹閫丒RP,涓嶈兘鎿嶄綔锛�");
- }
// Check for duplicate barcode scan
c_num = db.Queryable<MesInvItemOutCDetails>()
@@ -719,10 +702,7 @@
b.ItemOutId == c_mes_inv_item_outs.Guid)
.Count();
- if (c_num > 0)
- {
- throw new Exception("姝ゆ潯鐮佸凡閲囪喘閫�璐ф壂鐮佸畬鎴愶紒");
- }
+ if (c_num > 0) throw new Exception("姝ゆ潯鐮佸凡閲囪喘閫�璐ф壂鐮佸畬鎴愶紒");
// Query item stock info
var c_mes_inv_item_stocks = db.Queryable<MesInvItemStocks>()
@@ -730,17 +710,13 @@
.First();
if (c_mes_inv_item_stocks == null)
- {
throw new Exception($"搴撳瓨涓棤姝ゆ潯鐮侊紝璇锋牳瀵癸紒{p_item_barcode}");
- }
// Validate depot codes
if (c_mes_inv_item_outs.DepotCode !=
c_mes_inv_item_stocks.DepotsCode)
- {
throw new Exception(
$"姝ゆ潯鐮佸睘浜庝粨搴� {c_mes_inv_item_stocks.DepotsCode} 涓庨噰璐��璐х敵璇蜂粨搴� {c_mes_inv_item_outs.DepotCode} 涓嶄竴鑷达紝璇锋牳瀵癸紒");
- }
C_STOCKNUM = c_mes_inv_item_stocks.Quantity.Value;
@@ -748,7 +724,7 @@
var quantities = db.Queryable<MesInvItemOutItems, MesInvItemOuts>(
(s, d) => new object[]
{
- JoinType.Left, s.ItemOutId == d.Guid,
+ JoinType.Left, s.ItemOutId == d.Guid
})
.Where((s, d) =>
d.ItemOutNo == p_bill_no &&
@@ -763,9 +739,7 @@
.First();
if (quantities == null)
- {
throw new Exception("閲囪喘閫�鏂欏崟 '" + p_bill_no + "'鏈鏍�");
- }
C_SQTY = quantities.TotalQuantity ?? 0;
C_OKQTY = quantities.CompletedQuantity ?? 0;
@@ -774,7 +748,7 @@
if (C_CQTY < C_STOCKNUM) return 1;
// Handle barcode reduction
- decimal p_number2 = C_STOCKNUM;
+ var p_number2 = C_STOCKNUM;
var itemOutItems = db.Queryable<MesInvItemOutItems>()
.Where(s =>
s.ItemOutId == c_mes_inv_item_outs.Guid &&
@@ -799,9 +773,7 @@
.First();
if (c_mes_inv_item_arn_detail == null)
- {
throw new Exception("鏈壘鍒伴噰璐��鏂欐潵婧愬崟鎹�");
- }
if (CMI.Quantity - CMI.TlQty <= p_number2)
{
@@ -862,15 +834,13 @@
TaskNo = CMI.WorkNo,
ItemId = c_mes_inv_item_stocks.ItemId,
EbelnK3id = c_mes_inv_item_stocks.EbelnK3id,
- LineK3id = c_mes_inv_item_stocks.LineK3id,
+ LineK3id = c_mes_inv_item_stocks.LineK3id
}).IgnoreColumns(true).ExecuteCommand();
if (p_number2 == 0)
- {
db.Deleteable<MesInvItemStocks>()
.Where(s => s.Guid == c_mes_inv_item_outs.Guid)
.ExecuteCommand();
- }
}
else
{
@@ -935,16 +905,13 @@
SuppId = c_mes_inv_item_outs.SuppId.ToString(),
ItemId = c_mes_inv_item_stocks.ItemId,
EbelnK3id = c_mes_inv_item_stocks.EbelnK3id,
- LineK3id = c_mes_inv_item_stocks.LineK3id,
+ LineK3id = c_mes_inv_item_stocks.LineK3id
}).IgnoreColumns(true).ExecuteCommand();
p_number2 = 0;
}
}
- if (p_number2 > 0)
- {
- throw new Exception("鐗╂枡鏁伴噺灏嗚秴閲囪喘閫�鏂欑敵璇峰崟鏁伴噺,鏃犳硶鍑哄簱");
- }
+ if (p_number2 > 0) throw new Exception("鐗╂枡鏁伴噺灏嗚秴閲囪喘閫�鏂欑敵璇峰崟鏁伴噺,鏃犳硶鍑哄簱");
return 1;
});
--
Gitblit v1.9.3