From 44abd42a36a8265fb6f91849df7a5a05383b3c63 Mon Sep 17 00:00:00 2001
From: 啊鑫 <t2856754968@163.com>
Date: 星期二, 03 九月 2024 17:39:49 +0800
Subject: [PATCH] 生产领料
---
MES.Service/service/Warehouse/MesInvItemOutCDetailsManager.cs | 77 +++++++++++++-------------------------
1 files changed, 26 insertions(+), 51 deletions(-)
diff --git a/MES.Service/service/Warehouse/MesInvItemOutCDetailsManager.cs b/MES.Service/service/Warehouse/MesInvItemOutCDetailsManager.cs
index 8015c77..6425341 100644
--- a/MES.Service/service/Warehouse/MesInvItemOutCDetailsManager.cs
+++ b/MES.Service/service/Warehouse/MesInvItemOutCDetailsManager.cs
@@ -81,46 +81,36 @@
public MesInvItemOutCDetails GetOutList(WarehouseQuery query)
{
-
-
-
var mesInvItemBarcodes = Db.Queryable<MesInvItemBarcodes>()
.Where(s => s.ItemBarcode == query.barcode).Count();
- if (mesInvItemBarcodes <= 0)
- {
- throw new Exception("鏉$爜涓嶅瓨鍦�");
- }
+ if (mesInvItemBarcodes <= 0) throw new Exception("鏉$爜涓嶅瓨鍦�");
var mesInvItemOutCDetails = Db.Queryable<MesInvItemOutCDetails>()
- .Where(s => s.ItemBarcode == query.barcode && s.Receive == 0).Count();
+ .Where(s => s.ItemBarcode == query.barcode && s.Receive == 0)
+ .Count();
-
- if (mesInvItemOutCDetails <= 0)
- {
- throw new Exception("鏉$爜涓嶇鍚堟帴鏀舵潯浠�,璇锋鏌ワ紒");
- }
+ if (mesInvItemOutCDetails <= 0) throw new Exception("鏉$爜涓嶇鍚堟帴鏀舵潯浠�,璇锋鏌ワ紒");
-
- var entity = Db.Queryable<MesInvItemOutCDetails, MesInvItemOuts, MesItems>((a, b, c) =>
- new JoinQueryInfos(JoinType.Left, a.ItemOutId == b.Id,
- JoinType.Left, a.ItemNo == c.ItemNo))
- .Where((a, b, c) => a.ItemBarcode == query.barcode)
- .Select((a, b, c) => new MesInvItemOutCDetails
- {
- PbillNo = b.ItemOutNo,
- WorkNo = a.WorkNo,
- ItemNo = a.ItemNo,
- ItemName = c.ItemName,
- Quantity = a.Quantity
- }).First();
+ var entity = Db
+ .Queryable<MesInvItemOutCDetails, MesInvItemOuts, MesItems>(
+ (a, b, c) =>
+ new JoinQueryInfos(JoinType.Left, a.ItemOutId == b.Id,
+ JoinType.Left, a.ItemNo == c.ItemNo))
+ .Where((a, b, c) => a.ItemBarcode == query.barcode)
+ .Select((a, b, c) => new MesInvItemOutCDetails
+ {
+ PbillNo = b.ItemOutNo,
+ WorkNo = a.WorkNo,
+ ItemNo = a.ItemNo,
+ ItemName = c.ItemName,
+ Quantity = a.Quantity
+ }).First();
if (entity == null)
- {
throw new Exception("鍑哄簱鏉$爜" + query.barcode + " 涓嶅瓨鍦紝璇风‘璁�!");
- }
return entity;
@@ -132,19 +122,16 @@
var mesInvItemBarcodes = Db.Queryable<MesInvItemBarcodes>()
.Where(s => s.ItemBarcode == query.barcode).Count();
- if (mesInvItemBarcodes <= 0)
- {
- throw new Exception("鏉$爜涓嶅瓨鍦�");
- }
+ if (mesInvItemBarcodes <= 0) throw new Exception("鏉$爜涓嶅瓨鍦�");
var mesInvItemOutCDetails = Db.Queryable<MesInvItemOutCDetails>()
.Where(s => s.ItemBarcode == query.barcode).First();
- MaterialReceipt entity = new MaterialReceipt
+ var entity = new MaterialReceipt
{
- InvItemoutCDetails = GetMesInvItemOutCDetails(mesInvItemOutCDetails.PbillNo),
+ InvItemoutCDetails =
+ GetMesInvItemOutCDetails(mesInvItemOutCDetails.PbillNo),
ItemOuts = GetMesInvItemOuts(mesInvItemOutCDetails.PbillNo)
-
};
return entity;
@@ -154,40 +141,30 @@
public MesInvItemOutCDetails confirmReceipt(WarehouseQuery query)
{
if (string.IsNullOrWhiteSpace(query.barcode))
- {
throw new Exception("璇锋壂鍑哄簱鏉$爜锛�");
- }
if (string.IsNullOrWhiteSpace(query.billNo))
- {
throw new Exception("鍑哄簱鍗曟嵁涓嶈兘涓虹┖锛�");
- }
-
-
var barcodeInfo = GetBarcodeInfo(query.barcode);
- if (barcodeInfo.Receive == 1)
- {
- throw new Exception("姝ゆ潯鐮佸凡缁忔帴鏀�,璇锋鏌ワ紒");
- }
+ if (barcodeInfo.Receive == 1) throw new Exception("姝ゆ潯鐮佸凡缁忔帴鏀�,璇锋鏌ワ紒");
UseTransaction(db =>
{
-
var count = db.Updateable<MesInvItemOutCDetails>()
- .SetColumns(s => s.Receive == 1)
- .Where(s => s.ItemBarcode == barcodeInfo.ItemBarcode).ExecuteCommand();
+ .SetColumns(s => s.Receive == 1)
+ .Where(s => s.ItemBarcode == barcodeInfo.ItemBarcode)
+ .ExecuteCommand();
return 1;
});
return barcodeInfo;
}
-
public List<MesInvItemOutCDetails> GetMesInvItemOutCDetails(string billno)
@@ -203,12 +180,10 @@
}
-
private MesInvItemOutCDetails GetBarcodeInfo(string itemBarcode)
{
// Get barcode information
return Db.Queryable<MesInvItemOutCDetails>()
.First(b => b.ItemBarcode == itemBarcode);
}
-
}
\ No newline at end of file
--
Gitblit v1.9.3