From fb8b33fd8115592efa524b015e0d9889b696c70a Mon Sep 17 00:00:00 2001
From: kyy <3283105747@qq.com>
Date: 星期三, 15 十月 2025 11:03:36 +0800
Subject: [PATCH] pda周转箱调拨
---
service/Warehouse/MesItemTblManager.cs | 667 ++++++++++---------------------------------------------
1 files changed, 121 insertions(+), 546 deletions(-)
diff --git a/service/Warehouse/MesItemTblManager.cs b/service/Warehouse/MesItemTblManager.cs
index b31d262..f3c05df 100644
--- a/service/Warehouse/MesItemTblManager.cs
+++ b/service/Warehouse/MesItemTblManager.cs
@@ -20,15 +20,34 @@
/// 鑾峰彇鐢熶骇閫�鏂欏崟鍙峰垪琛�
/// </summary>
/// <returns>閫�鏂欏崟鍙峰垪琛�</returns>
- public List<string> GetSCTLBillNo(WarehouseQuery query)
+ public dynamic GetSCTLBillNo(WarehouseQuery query, dynamic RequestInfo)
{
- var list = Db.Queryable<MesItemTbl>()
- .Where(s => (s.Tbl013 ?? 0) == 1 // 瀹℃牳閫氳繃
- && (s.Tbl020 ?? 0) == 0
- && s.Tbl008 == query.Type)
- .Select(s => s.BillNo).ToList();
+ var orgId = RequestInfo.OrgId;
- return list;
+ if (orgId == null)
+ throw new Exception("缁勭粐涓嶅瓨鍦紒");
+
+ // 鑾峰彇鏈畬鎴愮殑閫�鏂欏崟鍙峰垪琛�
+ var parameters = new[]
+ {
+ new SugarParameter("@pi_orgId", orgId),
+ new SugarParameter("@type", query.Type),
+ new SugarParameter("@inP1", null),
+ new SugarParameter("@inP2", null),
+ new SugarParameter("@inP3", null),
+ new SugarParameter("@inP4", null)
+ };
+ try
+ {
+ // 杩斿洖鍗曞彿瀛楃涓插垪琛�
+ var blDetails = Db.Ado.SqlQuery<string>(
+ "EXEC prc_pda_sctl_list @pi_orgId,@type,@inP1,@inP2,@inP3,@inP4", parameters);
+ return blDetails;
+ }
+ catch (Exception ex)
+ {
+ throw new Exception($"{ex.Message}");
+ }
}
/// <summary>
@@ -36,45 +55,50 @@
/// </summary>
/// <param name="query">浠撳簱鏌ヨ鍙傛暟</param>
/// <returns>鐗╂枡鏄庣粏鍒楄〃</returns>
- public ProductionPickDto GetMesItemTblDetailByBillNo(
- WarehouseQuery query)
+ public dynamic GetMesItemTblDetailByBillNo(dynamic query, dynamic RequestInfo)
{
- // 鍏宠仈鏌ヨ鐗╂枡琛ㄣ�佺墿鏂欐槑缁嗚〃鍜岀墿鏂欏熀纭�淇℃伅琛�
- var mesItemTblDetails = Db
- .Queryable<MesItemTbl, MesItemTblDetail, MesItems>(
- (a, b, c) => new JoinQueryInfos(
- JoinType.Left,
- a.Id == b.Tlmid,
- JoinType.Left,
- b.Tld009 == c.Id)
- ).Where((a, b, c) => a.BillNo == query.billNo && (a.Tbl013 ?? 0) == 1)
- .Select<ItemDetailModel>((a, b, c) => new ItemDetailModel
- {
- FQty = b.Tld005 ?? 0, // 寰呴��鏁伴噺
- SQty = b.Tld006 ?? 0, // 宸查��鏁伴噺
- DSQty = (b.Tld005 ?? 0) - (b.Tld006 ?? 0),
- ItemNo = c.ItemNo, // 鐗╂枡缂栧彿
- ItemName = c.ItemName, // 鐗╂枡鍚嶇О
- ItemModel = c.ItemModel // 鐗╂枡鍨嬪彿
- }).ToList();
+ if (string.IsNullOrEmpty(query.billNo))
+ throw new Exception("璇烽�夊崟鎹彿锛�");
+ if (query == null)
+ throw new ArgumentNullException(nameof(query), "鍙傛暟瀵硅薄涓嶈兘涓簄ull");
- if (mesItemTblDetails.Count<1)
- throw new Exception("璇ョ敵璇峰崟銆�" + query.billNo + "銆� 鏄庣粏涓嶅瓨鍦紝璇风‘璁わ紒");
+ if (string.IsNullOrEmpty(query.billNo?.ToString()))
+ throw new ArgumentException("鍗曟嵁鍙蜂笉鑳戒负绌�", nameof(query.billNo));
- var DS_list = mesItemTblDetails.Where(s => s.DSQty > 0).ToList();
+ var orgId = RequestInfo.OrgId;
- var YS_list = mesItemTblDetails.Where(s => s.SQty > 0).ToList();
+ if (orgId == null)
+ throw new Exception("缁勭粐涓嶅瓨鍦紒");
- var itemTblDetails = new ProductionPickDto
+ // 鑾峰彇鏈畬鎴愮殑閿�鍞��璐ф槑缁�
+ var parameters = new[]
+{
+ new SugarParameter("@billNo", query.billNo),
+ new SugarParameter("@pi_orgId",orgId),
+ new SugarParameter("@inP1", null),
+ new SugarParameter("@inP2", null),
+ new SugarParameter("@inP3", null),
+ new SugarParameter("@inP4", null)
+ };
+ try
{
- items = DS_list,
- Ysitems = YS_list
- // yisao = mesInvItemOutCDetailsList
- };
-
-
- return itemTblDetails;
+ List<dynamic>? blDetails = Db.Ado.SqlQuery<dynamic>(
+ "EXEC prc_pda_sctl_detailList @billNo,@pi_orgId,@inP1,@inP2,@inP3,@inP4", parameters);
+ var items = blDetails.Where(x => x.DSQty > 0).ToList(); // 寰呮壂鐗╂枡
+ var ysitems = blDetails.Where(x => x.SQty > 0).ToList(); // 宸叉壂鐗╂枡
+ return new
+ {
+ items = items,
+ ysitems = ysitems,
+ Count = items.Count + ysitems.Count
+ };
+ }
+ catch (Exception ex)
+ {
+ // 淇濆紓甯稿鐞嗛�昏緫
+ throw new Exception($"{ex.Message}");
+ }
}
/// <summary>
@@ -109,24 +133,23 @@
/// </summary>
/// <param name="query">浠撳簱鏌ヨ鍙傛暟</param>
/// <returns>澶勭悊缁撴灉</returns>
- public WarehouseQuery SctlScanBarcode(WarehouseQuery query)
+ public dynamic SctlScanBarcode(WarehouseQuery query,dynamic RequestInfo)
{
-
- // 2. 楠岃瘉鏉$爜淇℃伅
+ // 楠岃瘉鏉$爜淇℃伅
var barcode = Db.Queryable<MesInvItemBarcodes>()
.Where(x => x.ItemBarcode == query.barcode)
.First();
if (barcode == null)
throw new Exception($"鏃犳鏉$爜锛岃鏍稿锛亄query.barcode}");
- // 3. 楠岃瘉鐗╂枡淇℃伅
+ // 楠岃瘉鐗╂枡淇℃伅
var item = Db.Queryable<MesItems>()
.Where(x => x.Id == barcode.ItemId)
.First();
if (item == null)
throw new Exception($"鏃犳鐗╂枡锛岃鏍稿锛亄query.barcode}");
- // 4. 楠岃瘉閫�鏂欏崟淇℃伅
+ // 楠岃瘉閫�鏂欏崟淇℃伅
var returnOrder = Db.Queryable<MesItemTbl>()
.Where(x => x.BillNo == query.billNo && (x.Tbl013 ?? 0) == 1)
.First();
@@ -136,512 +159,64 @@
if (returnOrder.Tbl020 == 1)
throw new Exception("鎵爜瀹屾垚,鐢宠鍗曞凡瀹岀粨!");
- // 5. 浣跨敤瀛樺偍杩囩▼澶勭悊鐢熶骇閫�鏂�
- var parameters = new SqlParameter[]
+ // 楠岃瘉缁勭粐鏄惁瀛樺湪
+ var orgId = RequestInfo.OrgId;
+
+ if (orgId == null)
+ throw new Exception("缁勭粐涓嶅瓨鍦紒");
+
+ // 鐢熶骇閫�鏂�
+ using (var conn = new SqlConnection(DbHelperSQL.strConn))
+ using (var cmd = new SqlCommand("PRC_PDA_SCTL", conn))
{
- new SqlParameter("@pi_user", query.userName),
- new SqlParameter("@pi_barcode", query.barcode),
- new SqlParameter("@pi_bill_no", query.billNo),
- new SqlParameter("@pi_section_code", query.DepotCode),
- new SqlParameter("@PI_INP1", DBNull.Value), // 澶囩敤鍙傛暟1
- new SqlParameter("@PI_INP2", DBNull.Value), // 澶囩敤鍙傛暟2
- new SqlParameter("@PO_OUT_MSG", SqlDbType.NVarChar, 2000) { Direction = ParameterDirection.Output },
- new SqlParameter("@PO_OUT_SUM", SqlDbType.Int) { Direction = ParameterDirection.Output },
- new SqlParameter("@PO_ITEM_NO", SqlDbType.NVarChar, 100) { Direction = ParameterDirection.Output },
- new SqlParameter("@PO_QUANTITY", SqlDbType.Decimal) { Direction = ParameterDirection.Output }
- };
+ try
+ {
+ conn.Open();
+ cmd.CommandType = CommandType.StoredProcedure;
- string procedureName = "PRC_PDA_SCTL";
- int res = DbHelperSQL.RunProcedure_NonQuery(procedureName, parameters);
+ var parameters = new[]
+ {
+ new SqlParameter("@PI_USER", query.userName),
+ new SqlParameter("@PI_BARCODE", query.barcode),
+ new SqlParameter("@PI_BILL_NO", query.billNo),
+ new SqlParameter("@PI_SECTION_CODE", query.DepotCode),
+ new SqlParameter("@pi_orgId", orgId),
+ new SqlParameter("@PI_INP1", DBNull.Value),
+ new SqlParameter("@PI_INP2", DBNull.Value),
+ new SqlParameter("@PO_OUT_MSG", SqlDbType.NVarChar) { Direction = ParameterDirection.Output, Size = 2000 },
+ new SqlParameter("@PO_OUT_SUM", SqlDbType.Int) { Direction = ParameterDirection.Output },
+ new SqlParameter("@PO_ITEM_NO", SqlDbType.NVarChar) { Direction = ParameterDirection.Output, Size = 100 },
+ new SqlParameter("@PO_QUANTITY", SqlDbType.Decimal)
+ {
+ Direction = ParameterDirection.Output,
+ Precision = 18, // 鏍规嵁瀹為檯鏁版嵁搴撶簿搴﹁皟鏁�
+ Scale = 10 // 鏍规嵁瀹為檯鏁版嵁搴撳皬鏁颁綅璋冩暣
+ }
+ };
- // 鑾峰彇杈撳嚭鍙傛暟
- var outMsg = parameters[6].Value?.ToString() ?? string.Empty;
- var outSum = parameters[7].Value != DBNull.Value ? Convert.ToInt32(parameters[7].Value) : -1;
- var itemNo = parameters[8].Value?.ToString() ?? string.Empty;
- var quantity = parameters[9].Value != DBNull.Value ? Convert.ToDecimal(parameters[9].Value) : 0m;
+ cmd.Parameters.AddRange(parameters);
+ cmd.ExecuteNonQuery();
- // 妫�鏌ュ瓨鍌ㄨ繃绋嬫墽琛岀粨鏋�
- if (outSum == -1)
- {
- throw new Exception(outMsg);
+ var outMsg = parameters[7].Value?.ToString() ?? string.Empty;
+ var outSum = parameters[8].Value != DBNull.Value ? Convert.ToInt32(parameters[8].Value) : -1;
+ var itemNo = parameters[9].Value?.ToString() ?? string.Empty;
+ var quantity = parameters[10].Value != DBNull.Value ? Convert.ToDecimal(parameters[10].Value) : 0m;
+
+ if (outSum == -1) throw new Exception(outMsg);
+
+ query.itemNo = itemNo;
+ query.Num = quantity;
+ query.message = outMsg;
+ return query;
+ }
+ catch (Exception ex)
+ {
+ throw new Exception(ex.Message);
+ }
+ finally
+ {
+ conn.Close();
+ }
}
-
- query.itemNo = itemNo;
- query.Num = quantity;
- return query;
-
-
- //var p_item_barcode = query.barcode; // 鐗╂枡鏉$爜
- //var p_bill_no = query.billNo; // 鍗曟嵁鍙�
- //var p_section_code = query.DepotCode; // 搴撲綅缂栫爜
- //var c_user = query.userName; // 鐢ㄦ埛鍚�
-
- //var p_bill_type_id = 100; // 鍗曟嵁绫诲瀷ID
- //var p_transction_no = 104; // 浜ゆ槗缂栧彿
-
- //// 楠岃瘉搴撲綅鏉$爜
- //if (p_section_code.IsNullOrEmpty()) throw new Exception("璇锋壂搴撲綅鏉$爜锛�");
-
- //// 鑾峰彇搴撲綅淇℃伅
- //var c_depot_code = Db.Queryable<MesDepotSections, MesDepots>((a, b) =>
- // new JoinQueryInfos(JoinType.Inner, a.DepotGuid == b.Guid))
- // .Where((a, b) => a.DepotSectionCode == p_section_code)
- // .Select((a, b) => b.DepotId).First();
-
- //if (!c_depot_code.HasValue)
- // throw new Exception("搴撲綅缂栫爜" + p_section_code + " 涓嶅瓨鍦紝璇风‘璁わ紒");
-
- //// 鑾峰彇搴撲綅鍒嗗尯淇℃伅
- //var mesDepotSections = Db.Queryable<MesDepotSections>()
- // .Where(a => a.DepotSectionCode == p_section_code).First();
-
- //if (mesDepotSections == null)
- // throw new Exception("搴撲綅缂栫爜" + p_section_code + " 涓嶅瓨鍦紝璇风‘璁わ紒");
-
- //// 鑾峰彇搴撲綅鍩虹淇℃伅
- //var c_mes_depots = Db.Queryable<MesDepots>()
- // .Where(b => b.Guid == mesDepotSections.DepotGuid).First();
-
- //if (c_mes_depots == null)
- // throw new Exception("搴撲綅缂栫爜" + p_section_code + " 涓嶅瓨鍦紝璇风‘璁わ紒");
-
- //// 妫�鏌ユ潯鐮佹槸鍚﹀凡鍏ュ簱
- //var c_num = Db.Queryable<MesInvItemIns, MesInvItemInCDetails>((a, b) =>
- // new JoinQueryInfos(JoinType.Inner, a.Guid == b.ItemInId))
- // .Where((a, b) => b.ItemBarcode == p_item_barcode
- // && a.BillTypeId == p_bill_type_id &&
- // a.TransctionNo == p_transction_no.ToString())
- // .Count();
-
- //if (c_num > 0) throw new Exception("姝ゆ潯鐮佸凡鎵叆搴擄紝鍕块噸澶嶆壂鎻忥紒");
-
- //c_num = Db.Queryable<MesInvItemStocks>()
- // .Where(t => t.ItemBarcode == p_item_barcode).Count();
-
- //if (c_num > 0) throw new Exception("姝ゆ潯鐮佸凡鎵叆搴擄紝鍕块噸澶嶆壂鎻忥紒");
-
- //// 鑾峰彇鏉$爜淇℃伅
- //var c_mes_inv_item_barcodes = Db.Queryable<MesInvItemBarcodes>()
- // .Where(t => t.ItemBarcode == p_item_barcode).First();
-
- //if (c_mes_inv_item_barcodes == null)
- // throw new Exception("姝ゆ潯鐮佷笉灞炰簬璇ラ��鏂欏崟锛岃鏍稿锛�");
-
- //if (c_mes_inv_item_barcodes.Memo != "鐢熶骇閫�鏂�")
- // throw new Exception("姝ゆ潯鐮佷笉鏄敓浜ч��鏂欐潯鐮侊紝涓嶅彲浣跨敤鐢熶骇閫�鏂欐ā鍧楋紒");
-
- //// 浣跨敤 String.Equals 鏂规硶杩涜瀛楃涓叉瘮杈冿紝鎸囧畾姣旇緝瑙勫垯涓哄拷鐣ュぇ灏忓啓锛屾彁楂樻瘮杈冪殑鐏垫椿鎬�
- //if (!string.Equals(c_mes_inv_item_barcodes.BillNo, p_bill_no, StringComparison.OrdinalIgnoreCase))
- // throw new Exception($"璇ユ潯鐮佸搴旂殑鐢宠鍙枫�恵c_mes_inv_item_barcodes.BillNo}銆戜笌 褰撳墠鐢宠鍗曞彿銆恵p_bill_no}銆戜笉涓�鑷达紝璇锋牳瀵癸紒");
- //// 鑾峰彇閫�鏂欏崟淇℃伅
- //var C_MES_ITEM_TBL = Db.Queryable<MesItemTbl>()
- // .Where(a => a.BillNo == p_bill_no
- // && (a.Tbl013 ?? 0) == 1).First();
-
-
-
- //// 鑾峰彇閫�鏂欏崟淇℃伅
- //var tbWOMDAA = Db.Queryable<Womdaa>()
- // .Where(a => a.Guid.ToString() == C_MES_ITEM_TBL.Tbl002).First();
-
-
-
- //if (C_MES_ITEM_TBL == null) throw new Exception("鐢宠鍗曞凡鎾ゅ洖,鏃犳硶鎵爜!");
-
- //if (C_MES_ITEM_TBL.Tbl020 == 1) throw new Exception("鎵爜瀹屾垚,鐢宠鍗曞凡瀹岀粨!");
-
- //// 鑾峰彇閫�鏂欏崟鏄庣粏
- //var C_MES_ITEM_TBL_DETAIL = Db.Queryable<MesItemTblDetail>()
- // .Where(a => a.Tlid == c_mes_inv_item_barcodes.AboutGuid)
- // .First();
-
- //if (C_MES_ITEM_TBL_DETAIL == null)
- // throw new Exception("鏉$爜涓嶅睘浜庤鐢宠鍗曟槑缁�,鏃犳硶鎵爜!");
-
- //var CABerpid = Db.Queryable<Womdab>().Where(womdab => womdab.Guid.ToString() == C_MES_ITEM_TBL_DETAIL.Tld013).Select(womdab => womdab.Erpid).First();
-
- //var ownerId = Db.Queryable<Womcab>().Where(womcab => womcab.Erpid == CABerpid.Value).Select(womcab => womcab.OwnerId).First();
-
- //if (ownerId == null) throw new Exception("鐢ㄦ枡娓呭崟璐т富淇℃伅涓嶅瓨鍦�,鏃犳硶鎵爜锛岃鑱旂郴绠$悊鍛�!");
-
- //var owner_type = "";
- //if (Db.Queryable<SysOrganization>().Any(x => x.Fid == ownerId))
- //{
- // owner_type = "BD_OwnerOrg";
- //}
- //else
- //{
- // // 绗簩灞傚垽鏂細妫�鏌� MES_CUSTOMER
- // if (Db.Queryable<MesCustomer>().Any(x => x.Id == Convert.ToInt32(ownerId)))
- // {
- // owner_type = "BD_Customer";
- // }
- // else
- // {
- // // 绗笁灞傚垽鏂細妫�鏌� MES_SUPPLIER
- // if (Db.Queryable<MesSupplier>().Any(x => x.Id == Convert.ToInt32(ownerId)))
- // {
- // owner_type = "BD_Supplier";
- // }
- // else
- // {
- // throw new Exception("鍏ュ簱澶辫触,鐢ㄦ枡娓呭崟璐т富淇℃伅瀛樺湪闂锛岃鑱旂郴绠$悊鍛樿В鍐筹紒");
- // }
- // }
- //}
-
-
- //var c_quantity = c_mes_inv_item_barcodes.Quantity;
-
- //var c_bill_no = "";
- //var c_id = Guid.Empty;
-
- //// 浣跨敤浜嬪姟澶勭悊鏁版嵁鏇存柊
- //UseTransaction(db =>
- //{
- // // 鏌ヨ鍏ュ簱鍗�
- // var mesInvItemIns = db.Queryable<MesInvItemIns>()
- // .Where(d =>
- // d.Status == 0 && d.TransctionNo ==
- // p_transction_no.ToString()
- // && d.TaskNo == c_mes_inv_item_barcodes.BillNo
- // && d.DepotsId == c_depot_code
- // && d.InsDate.Value.ToString("yyyyMMdd") ==
- // DateTime.Now.ToString("yyyyMMdd")).First();
-
- // var totalResult = 0;
-
- // // 濡傛灉鍏ュ簱鍗曚笉瀛樺湪鍒欏垱寤烘柊鐨勫叆搴撳崟
- // if (mesInvItemIns == null)
- // {
- // c_bill_no = BillNo.GetBillNo("SCTL(鐢熶骇閫�鏂�)");
-
- // c_id = Guid.NewGuid();
-
- // totalResult += db.Insertable(new MesInvItemIns
- // {
- // Guid = c_id,
- // BillNo = c_bill_no,
- // BillTypeId = p_bill_type_id,
- // InsDate = DateTime.Now,
- // DepotsId = c_depot_code,
- // UserNoBack = c_user,
- // Reason = C_MES_ITEM_TBL.Tbl005,
- // Remark = C_MES_ITEM_TBL.Tbl006,
- // //InsDate = DateTime.Now,
- // DepotsCode = c_mes_depots.DepotCode,
- // TaskNo = c_mes_inv_item_barcodes.BillNo,
- // //DepotsId = c_depot_code,
- // TransctionNo = p_transction_no.ToString(),
- // CreateBy = c_user,
- // CreateDate = DateTime.Now,
- // LastupdateBy = c_user,
- // LastupdateDate = DateTime.Now,
- // CbillNo = tbWOMDAA.Daa001,
- // InType = "鐢熶骇閫�鏂�",
- // ReceiveOrgId = c_mes_depots.FSubsidiary,
- // Fstatus = 0,
- // Status = 0,
- // WorkNo = tbWOMDAA.Daa021
- // }).IgnoreColumns(true).ExecuteCommand();
- // }
- // else
- // {
- // c_id = mesInvItemIns.Guid;
- // c_bill_no = mesInvItemIns.BillNo;
- // }
-
- // // 妫�鏌ユ槸鍚︿负鍚堝苟鎵撳嵃鏉$爜
- // var hbdy = c_mes_inv_item_barcodes.Hbdy ?? 0;
- // if (hbdy == 1) throw new Exception("涓嶆敮鎸佸悎骞舵墦鍗扮殑鏉$爜:" + p_item_barcode);
-
-
- // // 妫�鏌ユ槸鍚﹀瓨鍦ㄤ簬 MES_INV_ITEM_IN_C_ITEMS 琛�
- // var existingCount = db.Queryable<MesInvItemInCItems>()
- // .Where(it =>
- // it.ItemInId == c_id &&
- // it.ItemId == C_MES_ITEM_TBL_DETAIL.Tld009 &&
- // it.DepotId == c_depot_code.ToString())
- // .Count();
-
- // if (existingCount == 0)
- // // 涓嶅瓨鍦ㄦ椂鎻掑叆鏂拌褰�
- // db.Insertable(new MesInvItemInCItems
- // {
- // ItemInId = c_id,
- // Quantity = c_mes_inv_item_barcodes.Quantity,
- // CreateBy = c_user,
- // CreateDate = DateTime.Now,
- // ItemNo = c_mes_inv_item_barcodes.ItemNo,
- // //DepotCode = mesDepost.DepotCode,
- // ItemSname = c_mes_inv_item_barcodes.ItemSname,
- // Unit = c_mes_inv_item_barcodes.Unit,
- // Ebeln = c_mes_inv_item_barcodes.WorkNo,
- // BillNo = c_bill_no,
- // WorkNo = c_mes_inv_item_barcodes.WorkNo,
- // EbelnLineNo = c_mes_inv_item_barcodes.WorkLine,
- // CbillNo = c_mes_inv_item_barcodes.BillNo,
- // WorkLine = c_mes_inv_item_barcodes.WorkLine,
- // SuppId = c_mes_inv_item_barcodes.SuppId,
- // SuppNo = c_mes_inv_item_barcodes.SuppNo,
- // Remark = c_mes_inv_item_barcodes.Memo,
- // EbelnK3id = c_mes_inv_item_barcodes.EbelnK3id,
- // LineK3id = c_mes_inv_item_barcodes.LineK3id,
- // ItemId = c_mes_inv_item_barcodes.ItemId,
- // DepotCode = c_mes_depots.DepotCode,
- // DepotId = c_depot_code.ToString(),
- // itemDabid = C_MES_ITEM_TBL_DETAIL.Tlid.ToString()
- // }).IgnoreColumns(true).ExecuteCommand();
- // else
- // // 瀛樺湪鏃舵洿鏂版暟閲�
- // db.Updateable<MesInvItemInCItems>()
- // .SetColumns(it => new MesInvItemInCItems
- // {
- // Quantity = SqlFunc.IsNull(it.Quantity, 0) + c_mes_inv_item_barcodes.Quantity // 纭繚 Quantity 涓嶄负 null
- // })
- // .Where(it =>
- // it.ItemInId == c_id &&
- // it.ItemId == C_MES_ITEM_TBL_DETAIL.Tld009 &&
- // it.DepotId == c_depot_code.ToString())
- // //.IgnoreColumns(true) // 淇濈暀 IgnoreColumns
- // .ExecuteCommand();
-
-
- // // 鎻掑叆 mes_inv_item_in_c_details 琛�
- // totalResult += db.Insertable(new MesInvItemInCDetails
- // {
- // ItemInId = c_id,
- // BillNo = c_bill_no,
- // ItemBarcode = p_item_barcode,
- // Quantity = c_mes_inv_item_barcodes.Quantity,
- // BarcodeFlag = true,
- // EpFlag = true,
- // WorkType = 1,
- // ItemNo = c_mes_inv_item_barcodes.ItemNo,
- // //LotNo = cgddDetails.BatchNumber,--鎵瑰彿锛岄��鏂欎笉璁剧疆鎵瑰彿
- // SuppId = c_mes_inv_item_barcodes.SuppId,
- // SuppNo = c_mes_inv_item_barcodes.SuppNo,
- // //DepotCode = mesDepost.DepotCode,
- // DepotSectionCode = p_section_code,
- // ItemSname = c_mes_inv_item_barcodes.ItemSname,
- // Unit = c_mes_inv_item_barcodes.Unit,
- // CreateBy = c_user,
- // CreateDate = DateTime.Now,
- // LastupdateBy = c_user,
- // LastupdateDate = DateTime.Now,
- // Remark = c_mes_inv_item_barcodes.Memo,
- // Ebeln = c_mes_inv_item_barcodes.Mblnr,
- // EbelnLineNo = c_mes_inv_item_barcodes.Zeile,
- // WorkNo = c_mes_inv_item_barcodes.WorkNo,
- // WorkLine = c_mes_inv_item_barcodes.WorkLine,
- // CbillNo = c_mes_inv_item_barcodes.BillNo,
- // UrgentFlag = c_mes_inv_item_barcodes.UrgentFlag,
- // BoardStyle = c_mes_inv_item_barcodes.BoardStyle,
- // TaskNo = c_mes_inv_item_barcodes.TaskNo,
- // EbelnK3id = c_mes_inv_item_barcodes.EbelnK3id,
- // LineK3id = c_mes_inv_item_barcodes.LineK3id,
- // ItemId = c_mes_inv_item_barcodes.ItemId,
- // Ischeck = true,
- // //CheckDate = C_MES_ITEM_TBL_DETAIL.CheckDate,
- // //CheckRes = C_MES_ITEM_TBL_DETAIL.CheckRes,
- // //CheckStates = C_MES_ITEM_TBL_DETAIL.CheckStates,--妫�楠屼俊鎭�
- // ReceiveOrgId = c_mes_depots.FSubsidiary,
- // DepotCode = c_mes_depots.DepotCode,
- // DepotId = Convert.ToInt64(c_depot_code)
- // }).IgnoreColumns(true).ExecuteCommand();
-
- // // 鎻掑叆涓氬姟璁板綍
- // totalResult += db.Insertable(new MesInvBusiness2
- // {
- // Guid = Guid.NewGuid(),
- // Status = 1,
- // BillTypeId = p_bill_type_id,
- // TransactionCode = p_transction_no.ToString(),
- // BusinessType = 1,
- // ItemBarcode = p_item_barcode,
- // ItemNo = c_mes_inv_item_barcodes.ItemNo,
- // LotNo = c_mes_inv_item_barcodes.LotNo,
- // EpFlag = true,
- // Quantity = c_mes_inv_item_barcodes.Quantity,
- // ToInvDepotsCode = c_mes_depots.DepotCode,
- // InvDepotId = c_depot_code,
- // ToInvDepotSectionsCode = p_section_code,
- // Description = "鐢熶骇閫�鏂�",
- // CreateBy = c_user,
- // CreateDate = DateTime.Now,
- // LastupdateBy = c_user,
- // LastupdateDate = DateTime.Now,
- // TaskNo = c_mes_inv_item_barcodes.TaskNo,
- // BillNo = c_bill_no,
- // WorkNo = c_mes_inv_item_barcodes.WorkNo,
- // WorkLine = c_mes_inv_item_barcodes.WorkLine,
- // SuppId = c_mes_inv_item_barcodes.SuppId,
- // SuppNo = c_mes_inv_item_barcodes.SuppNo,
- // ItemId = c_mes_inv_item_barcodes.ItemId
- // }).IgnoreColumns(true).ExecuteCommand();
-
- // // 鎻掑叆搴撳瓨璁板綍
- // totalResult += db.Insertable(new MesInvItemStocks
- // {
- // Guid = Guid.NewGuid(),
- // TaskNo = c_mes_inv_item_barcodes.TaskNo,
- // ItemBarcode = p_item_barcode,
- // ItemNo = c_mes_inv_item_barcodes.ItemNo,
- // LotNo = c_mes_inv_item_barcodes.LotNo,
- // Quantity = c_mes_inv_item_barcodes.Quantity,
- // //EpFlag = c_mes_inv_item_barcodes.EpFlag.Value
- // // ? (byte)1
- // // : (byte)0,
- // DepotId = c_mes_depots.DepotId,
- // DepotsCode = c_mes_depots.DepotCode,
- // DepotSectionsCode = p_section_code,
- // CheckDate = c_mes_inv_item_barcodes.CreateDate,
- // IndepDate = DateTime.Now,
- // BoardStyle = c_mes_inv_item_barcodes.BoardStyle,
- // WorkNo = c_mes_inv_item_barcodes.WorkNo,
- // WorkLine = c_mes_inv_item_barcodes.WorkLine,
- // SuppNo = c_mes_inv_item_barcodes.SuppNo,
- // ItemId = c_mes_inv_item_barcodes.ItemId,
- // BillNo = c_mes_inv_item_barcodes.BillNo,
- // //DepotId = Convert.ToInt32(c_depot_code),
- // OwnerId = ownerId,
- // OwnerType = owner_type,
- // StockOrgId = c_mes_depots.FSubsidiary,
- // IndepUserCode = c_user
- // }).IgnoreColumns(true).ExecuteCommand();
-
- // // 鏍规嵁閫�鏂欑被鍨�(鑹搧閫�鏂欍�佹潵鏂欎笉鑹��鏂欍�佷綔涓氫笉鑹��鏂�)鏇存柊鐩稿叧鏁版嵁
- // if (C_MES_ITEM_TBL.Tbl005 is "鑹搧閫�鏂�" or "鏉ユ枡涓嶈壇閫�鏂�")
- // {
- // // 鑹搧閫�鏂� - 鏇存柊宸ュ崟琛�(WOMDAB)鐩稿叧鏁伴噺
- // if (C_MES_ITEM_TBL.Tbl005 == "鑹搧閫�鏂�")
- // totalResult += Db.Updateable<Womdab>()
- // .SetColumns(it => new Womdab
- // {
- // Dab007 = it.Dab007 -
- // c_mes_inv_item_barcodes.Quantity, // 鍑忓皯宸ュ崟鏁伴噺
- // Dab022 = (it.Dab022 ?? 0) +
- // c_mes_inv_item_barcodes.Quantity, // 澧炲姞閫�鏂欐暟閲�
- // LpTl = (it.LpTl ?? 0) +
- // (int)c_mes_inv_item_barcodes
- // .Quantity, // 澧炲姞鑹搧閫�鏂欐暟閲�
- // Dab020 = (it.Dab020 ?? 0) -
- // c_mes_inv_item_barcodes.Quantity // 鍑忓皯宸插彂鏂欐暟閲�
- // })
- // .Where(it => it.Dab001 == c_mes_inv_item_barcodes.WorkNo
- // && it.Dab002 == c_mes_inv_item_barcodes
- // .WorkLine
- // && it.Dab003 == c_mes_inv_item_barcodes
- // .ItemId.ToString())
- // .ExecuteCommand();
- // // 鏉ユ枡涓嶈壇閫�鏂� - 鏇存柊宸ュ崟琛�(WOMDAB)鐩稿叧鏁伴噺
- // else if (C_MES_ITEM_TBL.Tbl005 == "鏉ユ枡涓嶈壇閫�鏂�")
- // totalResult += Db.Updateable<Womdab>()
- // .SetColumns(it => new Womdab
- // {
- // Dab007 = it.Dab007 -
- // c_mes_inv_item_barcodes.Quantity, // 鍑忓皯宸ュ崟鏁伴噺
- // Dab022 = (it.Dab022 ?? 0) +
- // c_mes_inv_item_barcodes.Quantity, // 澧炲姞閫�鏂欐暟閲�
- // LlBl = (it.LlBl ?? 0) +
- // (int)c_mes_inv_item_barcodes
- // .Quantity, // 澧炲姞鏉ユ枡涓嶈壇鏁伴噺
- // Dab020 = (it.Dab020 ?? 0) -
- // c_mes_inv_item_barcodes.Quantity // 鍑忓皯宸插彂鏂欐暟閲�
- // })
- // .Where(it => it.Dab001 == c_mes_inv_item_barcodes.WorkNo
- // && it.Dab002 == c_mes_inv_item_barcodes
- // .WorkLine
- // && it.Dab003 == c_mes_inv_item_barcodes
- // .ItemId.ToString())
- // .ExecuteCommand();
-
- // // 鏇存柊閫�鏂欏崟鏄庣粏琛ㄥ凡閫�鏁伴噺
- // totalResult += Db.Updateable<MesItemTblDetail>()
- // .SetColumns(it => new MesItemTblDetail
- // {
- // Tld006 = (it.Tld006 ?? 0) +
- // (int)c_mes_inv_item_barcodes.Quantity // 澧炲姞宸查��鏁伴噺
- // })
- // .Where(it => it.Tlmid == C_MES_ITEM_TBL.Id &&
- // it.Tlid == c_mes_inv_item_barcodes.AboutGuid)
- // .ExecuteCommand();
- // }
- // // 浣滀笟涓嶈壇閫�鏂� - 鏇存柊宸ュ崟琛ㄥ拰閫�鏂欏崟鏄庣粏琛�
- // else if (C_MES_ITEM_TBL.Tbl005 == "浣滀笟涓嶈壇閫�鏂�")
- // {
- // totalResult += Db.Updateable<Womdab>()
- // .SetColumns(it => new Womdab
- // {
- // Dab022 = (it.Dab022 ?? 0) +
- // c_mes_inv_item_barcodes.Quantity, // 澧炲姞閫�鏂欐暟閲�
- // ZyBl = (it.ZyBl ?? 0) +
- // (int)c_mes_inv_item_barcodes
- // .Quantity, // 澧炲姞浣滀笟涓嶈壇鏁伴噺
- // Dab020 = (it.Dab020 ?? 0) -
- // c_mes_inv_item_barcodes.Quantity // 鍑忓皯宸插彂鏂欐暟閲�
- // })
- // .Where(it => it.Dab001 == c_mes_inv_item_barcodes.WorkNo
- // && it.Dab002 ==
- // c_mes_inv_item_barcodes.WorkLine
- // && it.Dab003 == c_mes_inv_item_barcodes.ItemId
- // .ToString())
- // .ExecuteCommand();
-
- // // 鏇存柊閫�鏂欏崟鏄庣粏琛ㄥ凡閫�鏁伴噺
- // totalResult += Db.Updateable<MesItemTblDetail>()
- // .SetColumns(it => new MesItemTblDetail
- // {
- // Tld006 = (it.Tld006 ?? 0) +
- // (int)c_mes_inv_item_barcodes.Quantity // 澧炲姞宸查��鏁伴噺
- // })
- // .Where(it => it.Tlmid == C_MES_ITEM_TBL.Id &&
- // it.Tlid == c_mes_inv_item_barcodes.AboutGuid)
- // .ExecuteCommand();
- // }
-
- // // 濡傛灉寰呴��鏁伴噺绛変簬鏈閫�鏂欐暟閲忥紝鍒欐洿鏂版槑缁嗗畬鎴愮姸鎬�
- // if ((C_MES_ITEM_TBL_DETAIL.Tld005 ?? 0) -
- // (C_MES_ITEM_TBL_DETAIL.Tld006 ?? 0) ==
- // c_mes_inv_item_barcodes.Quantity)
- // totalResult += Db.Updateable<MesItemTblDetail>()
- // .SetColumns(it => new MesItemTblDetail
- // { Tld008 = 1 }) // 璁剧疆瀹屾垚鏍囧織
- // .Where(it => it.Tlid == C_MES_ITEM_TBL_DETAIL.Tlid)
- // .ExecuteCommand();
-
- // // 妫�鏌ラ��鏂欏崟鏄惁鎵�鏈夋槑缁嗛兘宸插畬鎴�
- // var remainingCount = Db.Queryable<MesItemTbl, MesItemTblDetail>(
- // (a, b) =>
- // new JoinQueryInfos(JoinType.Left, a.Id == b.Tlmid))
- // .Where((a, b) =>
- // a.BillNo == p_bill_no &&
- // (b.Tld005 ?? 0) - (b.Tld006 ?? 0) > 0)
- // .Count();
-
- // // 濡傛灉鎵�鏈夋槑缁嗛兘宸插畬鎴愶紝鍒欐洿鏂伴��鏂欏崟鐘舵�佷负宸插畬鎴�
- // if (remainingCount < 1)
- // totalResult += Db.Updateable<MesItemTbl>()
- // .SetColumns(it => it.Tbl020 == 1) // 璁剧疆瀹屾垚鏍囧織
- // .Where(it => it.BillNo == p_bill_no)
- // .ExecuteCommand();
-
- // // 妫�鏌ュ繀瑕佺殑鎻掑叆鎿嶄綔鏄惁閮芥垚鍔熸墽琛�
- // var minimumExpectedOperations = 3; // 鑷冲皯闇�瑕佹墽琛岀殑鎻掑叆鎿嶄綔鏁�
- // if (totalResult < minimumExpectedOperations)
- // throw new Exception(
- // $"鍏抽敭鏁版嵁鎻掑叆澶辫触锛岄鏈熻嚦灏憑minimumExpectedOperations}涓搷浣滐紝瀹為檯鎵ц{totalResult}涓搷浣�");
-
- // // 鍒涘缓 鎻掑叆鏃ュ織
- // var logService = new LogService();
- // var LogMsg = "[PDA]鐢熶骇閫�鏂欍�傛潯鐮併��" + query.barcode + "銆� 閫�鏂欏崟鍙枫��" + c_bill_no + "銆�";
- // logService.CreateLog(db, query.userName, tbWOMDAA.Guid.ToString(), "WOMDAA", LogMsg, tbWOMDAA.Daa001);
-
- // return totalResult;
- //});
-
- //query.itemNo = itemNo;
- //query.Num = quantity;
- //return query;
}
}
\ No newline at end of file
--
Gitblit v1.9.3