From 807bb9a2b4d6db408ebdded1cff41f3094eac11e Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期二, 24 三月 2026 15:00:40 +0800
Subject: [PATCH] 1
---
WebAPI/Controllers/CJGL/Cj_SingleStationController.cs | 184 ++++++++++++++++++++++++++++++---------------
1 files changed, 121 insertions(+), 63 deletions(-)
diff --git a/WebAPI/Controllers/CJGL/Cj_SingleStationController.cs b/WebAPI/Controllers/CJGL/Cj_SingleStationController.cs
index f181774..8b3b977 100644
--- a/WebAPI/Controllers/CJGL/Cj_SingleStationController.cs
+++ b/WebAPI/Controllers/CJGL/Cj_SingleStationController.cs
@@ -376,30 +376,33 @@
{
if (oSystemParameter.omodel.WMS_CampanyName == "鏉窞鏂帿灏�")
{
-
- //鍒ゆ柇褰撳墠娴佽浆鍗� 褰撳墠宸ュ簭鏄惁鏄紑宸�
- ds = oCN.RunProcReturn("select * from Sc_ICMOBillStatus_Tmp where HSourceBillNo='" + HBarCode + "' and HICMOStatus<>'0' and HProcID='"+ HProcID + "'", "Sc_ICMOBillStatus_Tmp");
- //鏌ヤ笉鍒拌瘉鏄庢病鏈夊紑宸ヨ繘鍏ヤ笅涓�鍙ユ煡璇�
- if (ds.Tables[0].Rows.Count == 0)
+ if (HProcID == "90") //娓呮磥宸ュ簭杩涘叆鑷姩寮�宸ユā寮�
{
- //鍒ゆ柇褰撳墠娴佽浆鍗℃槸鍚﹀ⅷ瑗垮摜鐨�
- ds2 = oCN.RunProcReturn("select HPRDORGID from Sc_ProcessExchangeBillMain with(nolock) where HBillNo = '" + HBarCode + "' ", "Sc_ProcessExchangeBillMain");
- if (ds2.Tables[0].Rows[0]["HPRDORGID"].ToString() != "7667152")
+ //鍒ゆ柇褰撳墠娴佽浆鍗� 褰撳墠宸ュ簭鏄惁鏄紑宸�
+ ds = oCN.RunProcReturn("select * from Sc_ICMOBillStatus_Tmp where HSourceBillNo='" + HBarCode + "' and HICMOStatus<>'0' and HProcID='" + HProcID + "'", "Sc_ICMOBillStatus_Tmp");
+ //鏌ヤ笉鍒拌瘉鏄庢病鏈夊紑宸ヨ繘鍏ヤ笅涓�鍙ユ煡璇�
+ if (ds.Tables[0].Rows.Count == 0)
{
- //鑾峰彇鐢熶骇鐘舵�佷复鏃惰〃鏁版嵁
- ds = oCN.RunProcReturn("select * from Sc_ICMOBillStatus_Tmp where HSourceBillNo='" + HBarCode + "' and HProcID='" + HProcID + "'", "Sc_ICMOBillStatus_Tmp");
- //浼犲叆 鐢熶骇鐘舵�佷复鏃惰ˉ 鍗曟嵁绫诲瀷銆佷富id銆佹簮鍗曞瓙ID銆佹簮鍗曞崟鍙枫�佸綋鍓嶇櫥褰曚汉銆佹簮鍗曞崟鎹被鍨�
- objJsonResult = SaveMESBeginWorkFrom_ZD(ds.Tables[0].Rows[0]["HBillType"].ToString(),ds.Tables[0].Rows[0]["HInterID"].ToString(), ds.Tables[0].Rows[0]["HSourceEntryID"].ToString(), ds.Tables[0].Rows[0]["HSourceBillNo"].ToString(),user, ds.Tables[0].Rows[0]["HSourceBillType"].ToString());
- if (objJsonResult.code == "0")
+ //鍒ゆ柇褰撳墠娴佽浆鍗℃槸鍚﹀ⅷ瑗垮摜鐨�
+ ds2 = oCN.RunProcReturn("select HPRDORGID from Sc_ProcessExchangeBillMain with(nolock) where HBillNo = '" + HBarCode + "' ", "Sc_ProcessExchangeBillMain");
+ if (ds2.Tables[0].Rows[0]["HPRDORGID"].ToString() != "7667152")
{
- objJsonResult.code = "0";
- objJsonResult.count = 0;
- objJsonResult.Message = objJsonResult.Message;
- objJsonResult.data = null;
- return objJsonResult;
+ //鑾峰彇鐢熶骇鐘舵�佷复鏃惰〃鏁版嵁
+ ds = oCN.RunProcReturn("select * from Sc_ICMOBillStatus_Tmp where HSourceBillNo='" + HBarCode + "' and HProcID='" + HProcID + "'", "Sc_ICMOBillStatus_Tmp");
+ //浼犲叆 鐢熶骇鐘舵�佷复鏃惰ˉ 鍗曟嵁绫诲瀷銆佷富id銆佹簮鍗曞瓙ID銆佹簮鍗曞崟鍙枫�佸綋鍓嶇櫥褰曚汉銆佹簮鍗曞崟鎹被鍨�
+ objJsonResult = SaveMESBeginWorkFrom_ZD(ds.Tables[0].Rows[0]["HBillType"].ToString(), ds.Tables[0].Rows[0]["HInterID"].ToString(), ds.Tables[0].Rows[0]["HSourceEntryID"].ToString(), ds.Tables[0].Rows[0]["HSourceBillNo"].ToString(), user, ds.Tables[0].Rows[0]["HSourceBillType"].ToString());
+ if (objJsonResult.code == "0")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = objJsonResult.Message;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
}
- }
- }
+ }
+ }
+
}
}
@@ -432,10 +435,26 @@
}
else
{
- objJsonResult.code = "1";
- objJsonResult.count = 1;
- objJsonResult.Message = "[0000-1-037]";
- objJsonResult.data = ds.Tables[0];
+ if (HProcID == "90" || HProcID== "102")
+ {
+ DataSet dataSet = oCN.RunProcReturn(@"exec h_p_Sc_ProcessExchangeBillList2 '" + HBarCode + "'," + HProcID, "h_p_Sc_ProcessExchangeBillList2");
+ if (dataSet.Tables[0].Rows.Count > 0)
+ {
+ objJsonResult.code = "2";
+ objJsonResult.count = 2;
+ objJsonResult.Message = "[0000-1-037]";
+ objJsonResult.data = dataSet.Tables[0];
+ return objJsonResult;
+ }
+ }
+ else
+ {
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "[0000-1-037]";
+ objJsonResult.data = ds.Tables[0];
+ }
+
}
return objJsonResult;
@@ -512,7 +531,7 @@
"(HInterID,HEntryID,HBillNo_bak,HSourceBillNo,HSourceInterID,HSourceEntryID,HMaterID" +
",HProdOrgID,HSourceBillType,HAuxPropID,HProcID,HQty,HBatchNo,HBarCode,HMTONo,HPlanMode) " +
" values(" + HInterID + "," + (i + 1) + ",'" + HBillNo + "','" + tempList[i].HProcExchBillNo + "'," + tempList[i].HProcExchInterID + "," + tempList[i].HProcExchEntryID + "," + tempList[i].HMaterID +
- ",'" + HOrgID + "','',0," + HProcID + "," + tempList[i].HQty + ",'"+ tempList[i].HBatchNo + "','" + tempList[i].HBarCode + "','','') ");
+ ",'" + HOrgID + "','',0," + tempList[i].HProcID + "," + tempList[i].HQty + ",'"+ tempList[i].HBatchNo + "','" + tempList[i].HBarCode + "','','') ");
}
oCN.Commit();
@@ -600,72 +619,76 @@
objJsonResult.data = null;
return objJsonResult;
}
-
- //澧炲姞浜х嚎缁勮杩芥函鍗�
- DataSet ds1 = oCN.RunProcReturn("exec h_p_Gy_BarCodeBillBomList '" + omodel.HProcExchBillNo + "'," + omodel.HProcID, "h_p_Gy_BarCodeBillBomList");
- if (ds1.Tables[0].Rows.Count > 0)
+ if (omodel.HProcID!=90)//鏂帿灏旀媿鐓ф竻娲佸伐搴忚繃婊�
{
- //鍒ら厤浠舵暟閲忔槸鍚︾瓑浜�0
- for (int i = 0; i < ds1.Tables[0].Rows.Count; i++)
+ //澧炲姞浜х嚎缁勮杩芥函鍗�
+ DataSet ds1 = oCN.RunProcReturn("exec h_p_Gy_BarCodeBillBomList '" + omodel.HProcExchBillNo + "'," + omodel.HProcID, "h_p_Gy_BarCodeBillBomList");
+ if (ds1.Tables[0].Rows.Count > 0)
{
- double SYHQty = double.Parse(ds1.Tables[0].Rows[i]["閰嶄欢鏁伴噺"].ToString());
- string HMaterNamePJ = ds1.Tables[0].Rows[i]["閰嶄欢浠g爜"].ToString();
- if (SYHQty == 0)
+ //鍒ら厤浠舵暟閲忔槸鍚︾瓑浜�0
+ for (int i = 0; i < ds1.Tables[0].Rows.Count; i++)
{
- oCN.RollBack();
- objJsonResult.code = "0";
- objJsonResult.count = 0;
- objJsonResult.Message = "[3791-2-020]閰嶄欢浠g爜:" + HMaterNamePJ + ",鏁伴噺涓�0!";
- objJsonResult.data = null;
- return objJsonResult;
+ double SYHQty = double.Parse(ds1.Tables[0].Rows[i]["閰嶄欢鏁伴噺"].ToString());
+ string HMaterNamePJ = ds1.Tables[0].Rows[i]["閰嶄欢浠g爜"].ToString();
+ if (SYHQty == 0)
+ {
+ oCN.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "[3791-2-020]閰嶄欢浠g爜:" + HMaterNamePJ + ",鏁伴噺涓�0!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
}
- }
- ds1 = oCN.RunProcReturn("select * from Sc_AssemblyBillMain WITH(NOLOCK) where HMainSourceInterID =" + omodel.HProcExchInterID + " and HMainSourceEntryID =" + omodel.HProcExchEntryID + " and HBarCode_P = '" + omodel.HBarCode_P + "'", "Sc_AssemblyBillMain");
+ ds1 = oCN.RunProcReturn("select * from Sc_AssemblyBillMain WITH(NOLOCK) where HMainSourceInterID =" + omodel.HProcExchInterID + " and HMainSourceEntryID =" + omodel.HProcExchEntryID + " and HBarCode_P = '" + omodel.HBarCode_P + "'", "Sc_AssemblyBillMain");
- if (ds1.Tables[0].Rows.Count == 0)
- {
- Int64 HInterID1 = DBUtility.ClsPub.CreateBillID("3727", ref DBUtility.ClsPub.sExeReturnInfo);
- string HBillNo1 = DBUtility.ClsPub.CreateBillCode("3727", ref DBUtility.ClsPub.sExeReturnInfo, true);
- string prefix = omodel.HBarCode_P.Substring(0, 10); // 浠庣储寮�0寮�濮嬶紝鎴彇10涓瓧绗� 鍒ゆ柇姣忎釜椤圭洰鐨凮鏄熷湀閰嶄欢鏁伴噺
-
+ if (ds1.Tables[0].Rows.Count == 0)
+ {
+ Int64 HInterID1 = DBUtility.ClsPub.CreateBillID("3727", ref DBUtility.ClsPub.sExeReturnInfo);
+ string HBillNo1 = DBUtility.ClsPub.CreateBillCode("3727", ref DBUtility.ClsPub.sExeReturnInfo, true);
+ string prefix = omodel.HBarCode_P.Substring(0, 10); // 浠庣储寮�0寮�濮嬶紝鎴彇10涓瓧绗� 鍒ゆ柇姣忎釜椤圭洰鐨凮鏄熷湀閰嶄欢鏁伴噺
+
//淇濆瓨鐢熶骇缁勮鍗曚富琛�
- string sql = $@"Insert Into Sc_AssemblyBillMain(HYear,HPeriod,HBillType,HBillSubType,HInterID,HDate
+ string sql = $@"Insert Into Sc_AssemblyBillMain(HYear,HPeriod,HBillType,HBillSubType,HInterID,HDate
,HBillNo,HBillStatus,HMaker,HMakeDate,HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo
,HICMOInterID,HICMOBillNo,HBarCode_P,HMaterID,HUnitID,HAssemblyStatus,HProdOrgID)
values('{DateTime.Now.Year}','{DateTime.Now.Month}','3727','3727',{HInterID1},getdate()
,'{HBillNo1}','1','{user}',getdate(),{omodel.HProcExchInterID.ToString()},{omodel.HProcExchEntryID.ToString()},'{omodel.HProcExchBillNo.ToString()}'
,{omodel.HICMOInterID.ToString()},'{omodel.HICMOBillNo.ToString()}','{omodel.HBarCode_P.ToString()}',{omodel.HMaterID},0,'姹囨姤',{omodel.HProdOrgID})";
- oCN.RunProc(sql);
- if (prefix == "#0TE911124") {
- for (int i = 0; i < sub.Count; i++)
+ oCN.RunProc(sql);
+ if (prefix == "#0TE911124")
{
- //瀛愯〃瀛樺偍
- string sq2 = $@"Insert Into Sc_AssemblyBillSub(HInterID,HBillNo_bak,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo
+ for (int i = 0; i < sub.Count; i++)
+ {
+ //瀛愯〃瀛樺偍
+ string sq2 = $@"Insert Into Sc_AssemblyBillSub(HInterID,HBillNo_bak,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo
,HSourceBillType,HMaterID,HSourceID,HEquipID,HUnitID,HQty
,HGroupID,HWorkerID,HScanDate,HBarCode,HBarCode_P,HSNNumber)
values({HInterID1},'{HBillNo1}',{(i + 1)},0,0,''
,'',{sub[i].HMaterID},0,0,0,3
,0,0,getdate(),'{sub[i].HBarCode}','{omodel.HBarCode_P}','') ";
- oCN.RunProc(sq2);
+ oCN.RunProc(sq2);
+ }
}
- }
- else
- {
- for (int i = 0; i < sub.Count; i++)
+ else
{
- //瀛愯〃瀛樺偍
- string sq2 = $@"Insert Into Sc_AssemblyBillSub(HInterID,HBillNo_bak,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo
+ for (int i = 0; i < sub.Count; i++)
+ {
+ //瀛愯〃瀛樺偍
+ string sq2 = $@"Insert Into Sc_AssemblyBillSub(HInterID,HBillNo_bak,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo
,HSourceBillType,HMaterID,HSourceID,HEquipID,HUnitID,HQty
,HGroupID,HWorkerID,HScanDate,HBarCode,HBarCode_P,HSNNumber)
values({HInterID1},'{HBillNo1}',{(i + 1)},0,0,''
,'',{sub[i].HMaterID},0,0,0,1
,0,0,getdate(),'{sub[i].HBarCode}','{omodel.HBarCode_P}','') ";
- oCN.RunProc(sq2);
+ oCN.RunProc(sq2);
+ }
}
+
}
-
+
}
}
@@ -1371,6 +1394,41 @@
return objJsonResult;
}
}
+ //鏍规嵁涓籭d+宸ュ簭鏌�
+ [Route("Cj_SingleStation/BadRecordsList2")]
+ [HttpGet]
+ public object BadRecordsList2(string HProcExchInterID, string HProcID, string user)
+ {
+ try
+ {
+ //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄�
+ if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Query", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "[0000-1-068]鏃犳煡璇㈡潈闄�!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ ds = oCN.RunProcReturn(@"exec h_p_Gy_BadRecordsList2 " + HProcExchInterID + "," + HProcID, "h_p_Gy_BadRecordsList2");
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "[0000-1-037]";
+ objJsonResult.data = ds;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "[0000-1-010]娌℃湁杩斿洖浠讳綍璁板綍锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
#endregion
#region 宸ュ簭鍗曞搧杩囩珯 鏌ヨ鍚堟牸璁板綍
--
Gitblit v1.9.1