From 250ae3deeabd8e0818f4adf57f747b71fefd5ef3 Mon Sep 17 00:00:00 2001
From: 啊鑫 <t2856754968@163.com>
Date: 星期一, 30 十二月 2024 16:54:56 +0800
Subject: [PATCH] 11
---
service/Warehouse/MesItemQtrkManager.cs | 66 +++++---------------------------
1 files changed, 11 insertions(+), 55 deletions(-)
diff --git a/service/Warehouse/MesItemQtrkManager.cs b/service/Warehouse/MesItemQtrkManager.cs
index c6baffe..b5d74c2 100644
--- a/service/Warehouse/MesItemQtrkManager.cs
+++ b/service/Warehouse/MesItemQtrkManager.cs
@@ -54,16 +54,13 @@
return details;
}
- public String ScanInDepotsQT(WarehouseQuery query)
+ public string ScanInDepotsQT(WarehouseQuery query)
{
var sectionCode = query.sectionCode;
var billNo = query.billNo;
// 1. 楠岃瘉搴撲綅鏉$爜鏄惁涓虹┖
- if (string.IsNullOrEmpty(sectionCode))
- {
- throw new Exception("璇锋壂搴撲綅鏉$爜锛�");
- }
+ if (string.IsNullOrEmpty(sectionCode)) throw new Exception("璇锋壂搴撲綅鏉$爜锛�");
// 2. 鏌ヨ搴撲綅瀵瑰簲鐨勪粨搴撶紪鐮�
var depotCode = Db.Queryable<MesDepotSections, MesDepots>(
@@ -74,9 +71,7 @@
.First();
if (depotCode == null)
- {
throw new Exception($"搴撲綅缂栫爜 {sectionCode} 涓嶅瓨鍦紝璇风‘璁わ紒");
- }
// 3. 鏌ヨ鐢宠鍗曞搴旂殑浠撳簱
var qtrk = Db.Queryable<MesItemQtrk>()
@@ -84,16 +79,11 @@
.Select(x => x.Qt011)
.First();
- if (qtrk == null)
- {
- throw new Exception($"搴撲綅缂栫爜 {sectionCode} 涓嶅瓨鍦紝璇风‘璁わ紒");
- }
+ if (qtrk == null) throw new Exception($"搴撲綅缂栫爜 {sectionCode} 涓嶅瓨鍦紝璇风‘璁わ紒");
// 4. 楠岃瘉搴撲綅鏄惁灞炰簬鐢宠浠撳簱
if (depotCode != qtrk)
- {
throw new Exception($"鎵爜搴撲綅 {sectionCode} 涓嶅睘浜庣敵璇锋浠撳簱!");
- }
// 5. 杩斿洖鎴愬姛淇℃伅
return $"浠撳簱锛歿qtrk} 搴撲綅锛歿sectionCode}";
@@ -112,9 +102,7 @@
// 1. 楠岃瘉搴撲綅鏉$爜鏄惁涓虹┖
if (string.IsNullOrEmpty(p_section_code))
- {
throw new Exception("璇锋壂搴撲綅鏉$爜锛�");
- }
// 2. 鏌ヨ搴撲綅瀵瑰簲鐨勪粨搴撶紪鐮佸拰浠撳簱ID
var depotInfo = Db.Queryable<MesDepotSections, MesDepots>(
@@ -125,9 +113,7 @@
.First();
if (depotInfo == null)
- {
throw new Exception($"搴撲綅缂栫爜 {p_section_code} 涓嶅瓨鍦紝璇风‘璁わ紒");
- }
var c_depot_code = depotInfo.DepotCode;
var c_depot_id = depotInfo.DepotId;
@@ -136,45 +122,30 @@
var existsInStock = Db.Queryable<MesInvItemInCDetails>()
.Any(x => x.ItemBarcode == p_item_barcode);
- if (existsInStock)
- {
- throw new Exception("姝ゆ潯鐮佸凡鎵爜鍏ュ簱瀹屾垚,璇锋牳瀵癸紒");
- }
+ if (existsInStock) throw new Exception("姝ゆ潯鐮佸凡鎵爜鍏ュ簱瀹屾垚,璇锋牳瀵癸紒");
// 4. 鏌ヨ鏉$爜淇℃伅
var barcode = Db.Queryable<MesInvItemBarcodes>()
.Where(x => x.ItemBarcode == p_item_barcode)
.First();
- if (barcode == null)
- {
- throw new Exception("鏉$爜涓嶅瓨鍦�,璇锋牳瀵癸紒");
- }
+ if (barcode == null) throw new Exception("鏉$爜涓嶅瓨鍦�,璇锋牳瀵癸紒");
- if (barcode.ComeFlg != 3)
- {
- throw new Exception("鏉$爜涓嶆槸鍏朵粬鍏ュ簱鏉$爜,鏃犳硶鐢ㄥ叾浠栧叆搴擄紒");
- }
+ if (barcode.ComeFlg != 3) throw new Exception("鏉$爜涓嶆槸鍏朵粬鍏ュ簱鏉$爜,鏃犳硶鐢ㄥ叾浠栧叆搴擄紒");
// 楠岃瘉鏉$爜鏄惁宸插湪搴撳瓨涓�
var stockCount = Db.Queryable<MesInvItemStocks>()
.Where(x => x.ItemBarcode == p_item_barcode)
.Count();
- if (stockCount > 0)
- {
- throw new Exception("姝ゆ潯鐮佸凡鎵爜鍏ュ簱瀹屾垚,璇锋牳瀵癸紒");
- }
+ if (stockCount > 0) throw new Exception("姝ゆ潯鐮佸凡鎵爜鍏ュ簱瀹屾垚,璇锋牳瀵癸紒");
// 5. 鏌ヨ鍏朵粬鍏ュ簱鐢宠鍗�
var qtrk = Db.Queryable<MesItemQtrk>()
.Where(x => x.Qtck == p_bill_no)
.First();
- if (qtrk == null)
- {
- throw new Exception("鍏朵粬鍏ュ簱鐢宠鍗曚笉瀛樺湪锛�");
- }
+ if (qtrk == null) throw new Exception("鍏朵粬鍏ュ簱鐢宠鍗曚笉瀛樺湪锛�");
// 6. 鏌ヨ鐢宠鍗曟槑缁�
var detail = Db.Queryable<MesItemQtrrDetail>()
@@ -184,15 +155,11 @@
.First();
if (detail == null)
- {
throw new Exception($"鍏朵粬鍏ュ簱鐢宠鍗晎p_bill_no}鏃犳鐗╂枡{barcode.ItemNo} 璇锋牳瀵癸紒");
- }
// 7. 楠岃瘉鏁伴噺
if (barcode.Quantity > (detail.Qd007 ?? 0) - (detail.Qd008 ?? 0))
- {
throw new Exception("鏉$爜鏁伴噺瓒呰繃鐢宠鏁伴噺,璇锋牳瀵癸紒");
- }
var details = new List<MesItemQtrrDetail>();
@@ -255,7 +222,6 @@
.First();
if (existingItem == null)
- {
// 涓嶅瓨鍦ㄥ垯鏂板鍏ュ簱鏄庣粏
res += db.Insertable(new MesInvItemInCItems
{
@@ -282,9 +248,7 @@
LineK3id = barcode.LineK3id,
ItemId = barcode.ItemId
}).IgnoreColumns(true).ExecuteCommand();
- }
else
- {
// 瀛樺湪鍒欐洿鏂版暟閲�
res += db.Updateable<MesInvItemInCItems>()
.SetColumns(
@@ -294,7 +258,6 @@
&& x.WorkNo == barcode.WorkNo
&& x.WorkLine == barcode.WorkLine)
.ExecuteCommand();
- }
// 鎻掑叆鍏ュ簱鏄庣粏璁板綍
@@ -366,7 +329,7 @@
SuppNo = barcode.SuppNo,
EbelnK3id = barcode.EbelnK3id,
LineK3id = barcode.LineK3id,
- ItemId = barcode.ItemId,
+ ItemId = barcode.ItemId
// SalesOrder = barcode.SalesOrder,
// IsZy = barcode.IsZy,
// OuterBarcode = barcode.OuterBarcode
@@ -398,7 +361,7 @@
EbelnK3id = barcode.EbelnK3id,
LineK3id = barcode.LineK3id,
ItemId = barcode.ItemId,
- BillNo = barcode.BillNo,
+ BillNo = barcode.BillNo
// SalesOrder = barcode.SalesOrder,
// IsZy = barcode.IsZy,
// Visable = 0,
@@ -423,12 +386,10 @@
.First();
if ((detail1.Qd007 ?? 0) - (detail1.Qd008 ?? 0) == barcode.Quantity)
- {
res += db.Updateable<MesItemQtrrDetail>()
.SetColumns(x => x.Qd011 == 1)
.Where(x => x.Guid == detail1.Guid)
.ExecuteCommand();
- }
details = Db.Queryable<MesItemQtrk, MesItemQtrrDetail, MesItems>(
(a, b, c) => new JoinQueryInfos(
@@ -449,17 +410,12 @@
.ToList();
if (CollectionUtil.IsNullOrEmpty(details))
- {
res += db.Updateable<MesItemQtrk>()
.SetColumns(s => s.Qt014 == 1)
.Where(x => x.Qtck == p_bill_no)
.ExecuteCommand();
- }
- if (res < 5)
- {
- throw new Exception("鎻掑叆鎴栨洿鏂板け璐�");
- }
+ if (res < 5) throw new Exception("鎻掑叆鎴栨洿鏂板け璐�");
return res;
});
--
Gitblit v1.9.3