From 6ea7ec9920a6c5d1a678170f9b11cb68fe2b5a8f Mon Sep 17 00:00:00 2001
From: cnf <3283105747@qq.com>
Date: 星期一, 15 十二月 2025 15:45:45 +0800
Subject: [PATCH] 修改合并领料查询
---
service/Warehouse/MesBarCFManager.cs | 92 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 92 insertions(+), 0 deletions(-)
diff --git a/service/Warehouse/MesBarCFManager.cs b/service/Warehouse/MesBarCFManager.cs
index b7e431b..2efe965 100644
--- a/service/Warehouse/MesBarCFManager.cs
+++ b/service/Warehouse/MesBarCFManager.cs
@@ -100,4 +100,96 @@
}
}
}
+
+ //鍏ュ簱鍓嶆媶鍒�
+ public dynamic GetBarInfoBefore(WarehouseQuery unity)
+ {
+
+ // 浣跨敤鍙傛暟鍖栨煡璇㈤槻姝QL娉ㄥ叆
+ var sqlParams = new List<SugarParameter> { new("@barcode", unity.barcode) };
+
+ var sql1 = @"SELECT 1 FROM MES_INV_ITEM_STOCKS WHERE ITEM_BARCODE =@barcode ";
+
+ var KcInfo = Db.Ado.SqlQuery<dynamic>(sql1, sqlParams);
+
+ if (KcInfo.Count > 0) throw new Exception("璇ユ潯鐮佸凡鍏ュ簱涓嶈兘杩涜鍏ュ簱鍓嶆媶鍒嗭紒");
+
+ var sql2 = @"SELECT ITEM_ID,QUANTITY FROM MES_INV_ITEM_BARCODES WHERE ITEM_BARCODE =@barcode ";
+
+ var barInfo = Db.Ado.SqlQuery<dynamic>(sql2, sqlParams).FirstOrDefault();
+
+ if (barInfo is null) throw new Exception("璇ユ潯鐮佷俊鎭笉瀛樺湪锛�");
+
+ return barInfo;
+ }
+ //鍏ュ簱鍓嶆媶鍒�
+ public ProductionPickDto BarCfBefore(WarehouseQuery unity)
+ {
+ var _strMsg = "";
+ var _intSum = "";
+ var _cfBar = "";//鎷嗗垎鍚庢潯鐮�
+ using (var conn = new SqlConnection(DbHelperSQL.strConn))
+ {
+ if (unity.userName.IsNullOrEmpty()) throw new Exception("鐢ㄦ埛鍚嶄笉鍏佽涓虹┖");
+ if (unity.CfNum <= 0) throw new Exception("鎷嗗垎鏁伴噺闇�澶т簬绛変簬0");
+ if (unity.barcode.IsNullOrEmpty()) throw new Exception("鏉$爜涓嶅厑璁镐负绌�");
+
+ using (var cmd = new SqlCommand("[prc_pda_bar_cf_before]", conn))
+ {
+ try
+ {
+ conn.Open();
+ cmd.CommandType = CommandType.StoredProcedure;
+ SqlParameter[] parameters =
+ {
+ new("@outMsg", SqlDbType.NVarChar, 300),
+ new("@outSum", SqlDbType.NVarChar, 300),
+ new("@barcode_new", SqlDbType.NVarChar, 300),
+ new("@c_user", unity.userName),
+ new("@p_old_barcode", unity.barcode),
+ new("@p_qty", unity.CfNum),
+
+ };
+ parameters[0].Direction = ParameterDirection.Output;
+ parameters[1].Direction = ParameterDirection.Output;
+ parameters[2].Direction = ParameterDirection.Output;
+
+ foreach (var parameter in parameters)
+ cmd.Parameters.Add(parameter);
+ cmd.ExecuteNonQuery();
+ _strMsg = parameters[0].Value.ToString();
+ _intSum = parameters[1].Value.ToString();
+ _cfBar = parameters[2].Value.ToString();
+
+
+ var result = Convert.ToInt32(_intSum);
+ if (result <= 0) throw new Exception(_strMsg);
+
+ var dto = new ProductionPickDto
+ {
+ barcode = unity.barcode,//鍘熸潯鐮�
+ cfBarcode = _cfBar//鎷嗗垎鍚庢潯鐮�
+ };
+ return dto;
+
+ //var result = Convert.ToInt32(_intSum);
+ //if (result <= 0) throw new Exception(_strMsg);
+
+ //return _strMsg;
+
+ //return 0;
+
+ }
+ catch (Exception ex)
+ {
+ throw new Exception(ex.Message);
+ }
+ finally
+ {
+ conn.Close();
+ }
+ }
+ }
+ }
+
}
\ No newline at end of file
--
Gitblit v1.9.3