From 170dc25004f6d0a22add0d71fdec602545902999 Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期二, 11 十一月 2025 10:38:18 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API
---
WebAPI/Controllers/BaseSet/Gy_MaterialController.cs | 171 ++++++++++++++++++++++++++++++++++++---------------------
1 files changed, 108 insertions(+), 63 deletions(-)
diff --git a/WebAPI/Controllers/BaseSet/Gy_MaterialController.cs b/WebAPI/Controllers/BaseSet/Gy_MaterialController.cs
index b6107d7..de0a660 100644
--- a/WebAPI/Controllers/BaseSet/Gy_MaterialController.cs
+++ b/WebAPI/Controllers/BaseSet/Gy_MaterialController.cs
@@ -4377,11 +4377,11 @@
if (!tb2.Columns.Contains("鐘舵��"))
error += "娌℃湁鎵惧埌銆愮姸鎬併�戠殑鏍囬,";
- if (!tb2.Columns.Contains("榛樿浠撳簱"))
- error += "娌℃湁鎵惧埌銆愰粯璁や粨搴撱�戠殑鏍囬,";
+ //if (!tb2.Columns.Contains("榛樿浠撳簱"))
+ // error += "娌℃湁鎵惧埌銆愰粯璁や粨搴撱�戠殑鏍囬,";
- if (!tb2.Columns.Contains("榛樿浠撲綅"))
- error += "娌℃湁鎵惧埌銆愰粯璁や粨浣嶃�戠殑鏍囬,";
+ //if (!tb2.Columns.Contains("榛樿浠撲綅"))
+ // error += "娌℃湁鎵惧埌銆愰粯璁や粨浣嶃�戠殑鏍囬,";
if (!tb2.Columns.Contains("鐗堟湰鍙�"))
error += "娌℃湁鎵惧埌銆愮増鏈彿銆戠殑鏍囬,";
@@ -4442,8 +4442,8 @@
HMaterName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["瀵瑰簲ERP鐗╂枡"].ToString());
HUnitName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["璁¢噺鍗曚綅"].ToString());
HDeptName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["浣跨敤閮ㄩ棬"].ToString());
- HWHName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["榛樿浠撳簱"].ToString());
- HSPName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["榛樿浠撲綅"].ToString());
+ HWHName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["榛樿浠撳簱"].ToString());
+ HSPName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["榛樿浠撲綅"].ToString());
HSupName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["渚涘簲鍟�"].ToString());
HSupNumber = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["渚涘簲鍟嗕唬鐮�"].ToString());
HMadeSupName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["鍒堕�犲晢"].ToString());
@@ -4534,67 +4534,83 @@
{
tb2.Rows[i]["HDeptID"] = ds.Tables[0].Rows[0]["HItemID"].ToString();
}
- //鏌ヨ浠撳簱
- ds = oCN.RunProcReturn("select * from Gy_Warehouse where HName='" + HWHName + "' and HUSEORGID=" + HORGid + "", "Gy_Warehouse");
+ if (HWHName != "")
+ {
+ //鏌ヨ浠撳簱
+ ds = oCN.RunProcReturn("select * from Gy_Warehouse where HName='" + HWHName + "' and HUSEORGID=" + HORGid + "", "Gy_Warehouse");
- if (ds.Tables[0].Rows.Count == 0)
- {
- objJsonResult.code = "0";
- objJsonResult.count = 0;
- objJsonResult.Message = "绗�" + index + "琛�,璇�" + HORGName + "缁勭粐,浠撳簱:" + HWHName + ",涓嶅瓨鍦紒";
- objJsonResult.data = null;
- return objJsonResult;
- }
- else
- {
- tb2.Rows[i]["HWHID"] = ds.Tables[0].Rows[0]["HSPGroupID"].ToString();
- }
- string HWHID = tb2.Rows[i]["HWHID"].ToString();
- //鏌ヨ浠撲綅
- ds = oCN.RunProcReturn("select * from Gy_StockPlace where HName='" + HSPName + "'and HSPGroupID=" + HWHID+ " and HUSEORGID=" + HORGid + "", "Gy_StockPlace");
+ if (ds.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "绗�" + index + "琛�,璇�" + HORGName + "缁勭粐,浠撳簱:" + HWHName + ",涓嶅瓨鍦紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ tb2.Rows[i]["HWHID"] = ds.Tables[0].Rows[0]["HItemID"].ToString();
+ }
+
+ string HWHID = tb2.Rows[i]["HWHID"].ToString();
+ if (HWHID != "")
+ {
+ //鏌ヨ浠撲綅
+ ds = oCN.RunProcReturn("select * from Gy_StockPlace where HName='" + HSPName + "'and HSPGroupID=" + HWHID + " and HUSEORGID=" + HORGid + "", "Gy_StockPlace");
- if (ds.Tables[0].Rows.Count == 0)
- {
- objJsonResult.code = "0";
- objJsonResult.count = 0;
- objJsonResult.Message = "绗�" + index + "琛�,璇�" + HORGName + "缁勭粐,浠撲綅:" + HSPName + ",涓嶅瓨鍦紒";
- objJsonResult.data = null;
- return objJsonResult;
+ if (ds.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "绗�" + index + "琛�,璇�" + HORGName + "缁勭粐,浠撲綅:" + HSPName + ",涓嶅瓨鍦紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ tb2.Rows[i]["HSPID"] = ds.Tables[0].Rows[0]["HItemID"].ToString();
+ }
+ }
+
}
- else
+ if(HSupName!="")
{
- tb2.Rows[i]["HSPID"] = ds.Tables[0].Rows[0]["HItemID"].ToString();
+ ds = oCN.RunProcReturn("select * from Gy_Supplier where HNumber='" + HSupNumber + "' and HUSEORGID=" + HORGid + "", "Gy_Supplier");
+
+ if (ds.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "绗�" + index + "琛�,璇�" + HORGName + "缁勭粐,渚涘簲鍟�:" + HSupName + ",涓嶅瓨鍦紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ tb2.Rows[i]["HSupID"] = ds.Tables[0].Rows[0]["HItemID"].ToString();
+ }
}
//鏌ヨ渚涘簲鍟�
- ds = oCN.RunProcReturn("select * from Gy_Supplier where HNumber='" + HSupNumber + "' and HUSEORGID=" + HORGid + "", "Gy_Supplier");
+ if(HMadeSupName!="")
+ {
+ //鏌ヨ鍒堕�犲晢
+ ds = oCN.RunProcReturn("select * from Gy_Supplier where HName='" + HMadeSupName + "' and HUSEORGID=" + HORGid + "", "Gy_Supplier");
- if (ds.Tables[0].Rows.Count == 0)
- {
- objJsonResult.code = "0";
- objJsonResult.count = 0;
- objJsonResult.Message = "绗�" + index + "琛�,璇�" + HORGName + "缁勭粐,渚涘簲鍟�:" + HSupName + ",涓嶅瓨鍦紒";
- objJsonResult.data = null;
- return objJsonResult;
+ if (ds.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "绗�" + index + "琛�,璇�" + HORGName + "缁勭粐,鍒堕�犲晢:" + HMadeSupName + ",涓嶅瓨鍦紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ tb2.Rows[i]["HMadeSupID"] = ds.Tables[0].Rows[0]["HItemID"].ToString();
+ }
}
- else
- {
- tb2.Rows[i]["HSupID"] = ds.Tables[0].Rows[0]["HItemID"].ToString();
- }
- //鏌ヨ鍒堕�犲晢
- ds = oCN.RunProcReturn("select * from Gy_Supplier where HName='" + HMadeSupName + "' and HUSEORGID=" + HORGid + "", "Gy_Supplier");
-
- if (ds.Tables[0].Rows.Count == 0)
- {
- objJsonResult.code = "0";
- objJsonResult.count = 0;
- objJsonResult.Message = "绗�" + index + "琛�,璇�" + HORGName + "缁勭粐,鍒堕�犲晢:" + HMadeSupName + ",涓嶅瓨鍦紒";
- objJsonResult.data = null;
- return objJsonResult;
- }
- else
- {
- tb2.Rows[i]["HMadeSupID"] = ds.Tables[0].Rows[0]["HItemID"].ToString();
- }
+
+
//鍣ㄥ叿妗f鍚嶇О
if (HMouldName == "")
@@ -4704,15 +4720,19 @@
long HUnitID = int.Parse(item["HUnitID"].ToString());
DateTime HOutComDate = DateTime.Now;
string HOutComNo = item["鍣ㄥ叿鍑哄巶缂栧彿"].ToString();
- long HDeptID = int.Parse(item["HDeptID"].ToString());
- long HSupID = int.Parse(item["HSupID"].ToString());
+ var HDeptID_temp = item["HDeptID"].ToString() == "" ? "0" : item["HDeptID"].ToString();
+ long HDeptID = int.Parse(HDeptID_temp);
+ var HSupID_temp = item["HSupID"].ToString() == "" ? "0" : item["HSupID"].ToString();
+ long HSupID = int.Parse(HSupID_temp);
string HMouldStatus = item["鐘舵��"].ToString();
- long HWHID = int.Parse(item["HWHID"].ToString());
+ var HWHID_TEMP = item["HWHID"].ToString() == "" ? "0" : item["HWHID"].ToString();
+ long HWHID = int.Parse(HWHID_TEMP);
long HRoutingID = 0;//宸ヨ壓璺嚎id
long HBOMID = 0;
string HVersion = "";//鐗堟湰
long HSPGroupID = 0;//榛樿浠撲綅缁�
- long HSPID = int.Parse(item["HSPID"].ToString());//浠撲綅id
+ var HSPID_temp = item["HSPID"].ToString() == "" ? "0" : item["HSPID"].ToString();
+ long HSPID = int.Parse(HSPID_temp);//浠撲綅id
Double HDesignLife = item["璁捐瀵垮懡"].ToString()=="" ? 0: double.Parse(item["璁捐瀵垮懡"].ToString());
Double HUseLife = item["浣跨敤瀵垮懡"].ToString() == "" ? 0 : double.Parse(item["浣跨敤瀵垮懡"].ToString());
Double HInitLife = 0;//涓婄嚎鍒濆鍖栧鍛�
@@ -4855,5 +4875,30 @@
#endregion
#endregion
+
+ //鏍规嵁鏉$爜鎵剧墿鏂欎俊鎭�
+ [Route("Gy_Material/findMaterialByNumber")]
+ [HttpGet]
+ public object findMaterialByNumber(string HbarCode,string HSTOCKORGID)
+ {
+ try
+ {
+ ds = oCN.RunProcReturn($"select * from Gy_BarCodeBill where HBarCode='{HbarCode}' ", "Gy_Material");
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鎴愬姛";
+ objJsonResult.data = ds.Tables[0];
+ return objJsonResult;
+ }
+ catch (Exception)
+ {
+
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍒濆鍖栧け璐ワ紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
}
}
\ No newline at end of file
--
Gitblit v1.9.1