From 999e1007eb2b1d4a1f5b19a0addc686b2e30ef2d Mon Sep 17 00:00:00 2001
From: zrg <z1873@LAPTOP-EAVL132E>
Date: 星期三, 26 十一月 2025 16:44:52 +0800
Subject: [PATCH] 优化
---
WebAPI/Controllers/Sc_GroupOrderBillController.cs | 61 +++++++++++++++++++-----------
1 files changed, 38 insertions(+), 23 deletions(-)
diff --git a/WebAPI/Controllers/Sc_GroupOrderBillController.cs b/WebAPI/Controllers/Sc_GroupOrderBillController.cs
index 8b22ef6..5393f18 100644
--- a/WebAPI/Controllers/Sc_GroupOrderBillController.cs
+++ b/WebAPI/Controllers/Sc_GroupOrderBillController.cs
@@ -39,7 +39,7 @@
{
objJsonResult.code = "0";
objJsonResult.count = 0;
- objJsonResult.Message = "璇疯緭鍏ヨ绠辩爜锛�";
+ objJsonResult.Message = "[3783-2-003]璇疯緭鍏ヨ绠辩爜锛�";
objJsonResult.data = null;
return objJsonResult;
}
@@ -51,7 +51,7 @@
{
objJsonResult.code = "0";
objJsonResult.count = 0;
- objJsonResult.Message = ds.Tables[0].Rows[0][1].ToString();//璇ヨ绠卞崟宸叉壂鐮侊紒
+ objJsonResult.Message = "[0000-1-038]" + ds.Tables[0].Rows[0][1].ToString();//璇ヨ绠卞崟宸叉壂鐮侊紒
objJsonResult.data = null;
return objJsonResult;
}
@@ -65,7 +65,7 @@
{
objJsonResult.code = "0";
objJsonResult.count = 0;
- objJsonResult.Message = "false锛佹棤鏁版嵁锛岃纭瑁呯鐮佹槸鍚﹀瓨鍦紒";
+ objJsonResult.Message = "[3783-2-004]false锛佹棤鏁版嵁锛岃纭瑁呯鐮佹槸鍚﹀瓨鍦紒";
objJsonResult.data = null;
return objJsonResult;
}
@@ -73,7 +73,7 @@
{
objJsonResult.code = "1";
objJsonResult.count = 1;
- objJsonResult.Message = "Sucess锛�";
+ objJsonResult.Message = "[0000-1-037]Sucess锛�";
objJsonResult.data = ds.Tables[0];
return objJsonResult;
}
@@ -82,7 +82,7 @@
{
objJsonResult.code = "0";
objJsonResult.count = 0;
- objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.Message = "[0000-1-038]Exception锛�" + e.ToString();
objJsonResult.data = null;
return objJsonResult;
}
@@ -101,20 +101,32 @@
string msg1 = _value.ToString();
try
{
- //濮斿宸ュ簭鍙戝嚭鍙嶅簭鍒楀寲
+
+ //缁勬墭鍗曞弽搴忓垪鍖�
msg1 = "[" + msg1.ToString() + "]";
List<GroupOrderBill> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<GroupOrderBill>>(msg1);
//鑾峰彇骞存湀鏃ュ苟鎷兼帴鎴愬瓧绗︿覆
string year = DateTime.Now.Year.ToString();
- string month = DateTime.Now.Month.ToString();
- string day = DateTime.Now.Day.ToString();
- string nowDate = year + month + day;
+ //string month = DateTime.Now.Month.ToString();
+ //string day = DateTime.Now.Day.ToString();
+ string nowDate = DateTime.Now.ToString("yyyyMMdd");
string HBillType = this.HBillType;//缁勬墭鍗曠被鍨�
long HInterID = list[0].HInterID;//閫掑叆type寰楀埌鐨勫崟鎹甀D
string HBillNo = list[0].HBillNo;//閫掑叆type寰楀埌鐨勫崟鎹甆o
string HMaker = list[0].HMaker;//鍒跺崟浜�
string HBatchNo = list[0].HBatchNo;//鍏ュ簱鎵规
string HBarCode_Cus = list[0].HBarCode_Cus;//瀹㈡埛鏍囩锛堥粦鏍囧彿锛�
+ long HOrgID = list[0].HOrgID;//閫掑叆type寰楀埌鐨勫崟鎹甀D
+ //鏍¢獙榛戞爣鍙峰敮涓�鎬�
+ ds = oCN.RunProcReturn($"select * from Sc_PackUnionBillMain where HBarCode_Cus ='{HBarCode_Cus}'", "Sc_PackUnionBillMain");
+ if (ds.Tables[0].Rows.Count > 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = $"[3783-2-007]榛戞爣鍙穥HBarCode_Cus}宸插瓨鍦�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
//鐢熸垚鍞竴鏉$爜
ds = oCN.RunProcReturn("exec h_p_WMS_GetMaxNo '" + nowDate + "'", "h_p_WMS_GetMaxNo"); //鑾峰彇鏈�澶ф祦姘村彿
oCN.RunProc("exec h_p_WMS_SetMaxNo '" + nowDate + "'");
@@ -127,32 +139,34 @@
"(" +
"HYear, HBillType, HInterID, HBillNo, HMaker" +
", HMakeDate, HPeriod, HDate, HRemark, HICMOInterID" +
- ", HICMOBillNo, HBarCode_Pack, HMaterID, HUnitID,HBatchNo,HBarCode_Cus" +
+ ", HICMOBillNo, HBarCode_Pack, HMaterID, HUnitID,HBatchNo,HBarCode_Cus,HProdOrgID" +
")" +
"values" +
"(" +
"'"+ year + "', '" + HBillType + "'," + HInterID + ", '" + HBillNo + "', '" + HMaker + "'" +
",GETDATE(),0,GETDATE(),' ',0" +
- ",' ','"+ HBarCode_Pack + "',0,0,'" + HBatchNo +"','" + HBarCode_Cus +
+ ",' ','"+ HBarCode_Pack + "',0,0,'" + HBatchNo +"','" + HBarCode_Cus +"','"+ HOrgID+
"')"
);
//鎻掑叆瀛愯〃
oCN.RunProc("exec h_p_SaveGroupOrder " + HInterID + "");
//鏍规嵁瀛愯〃姹囨�荤敓鎴怱c_PackUnionBillSub_Sum琛ㄨ褰�
oCN.RunProc("exec h_p_Sc_PackUnionBill_SumSubBill " + HInterID + ",'','',''");
+ //鎻掑叆鏉$爜妗f琛�
+ oCN.RunProc("exec h_p_SaveGroupOrderCodeToGy_BarCodeBill " + HInterID + "");
oCN.Commit();
objJsonResult.code = "1";
objJsonResult.count = 1;
- objJsonResult.Message = "鏂板鍗曟嵁鎴愬姛锛�";
+ objJsonResult.Message = "[0000-1-050]鏂板鍗曟嵁鎴愬姛锛�";
objJsonResult.data = null;
return objJsonResult;
}
catch (Exception e)
{
- oCN.RollBack();
+ //oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
- objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.Message = "[0000-1-051]Exception锛�" + e.ToString();
objJsonResult.data = null;
return objJsonResult;
}
@@ -187,7 +201,7 @@
{
objJsonResult.code = "0";
objJsonResult.count = 0;
- objJsonResult.Message = "鏃犳暟鎹紒";
+ objJsonResult.Message = "[0000-1-045]鏃犳暟鎹紒";
objJsonResult.data = null;
return objJsonResult;
}
@@ -195,7 +209,7 @@
{
objJsonResult.code = "1";
objJsonResult.count = 1;
- objJsonResult.Message = "Sucess锛�";
+ objJsonResult.Message = "[0000-1-037]Sucess锛�";
objJsonResult.data = ds.Tables[0];
return objJsonResult;
}
@@ -205,7 +219,7 @@
{
objJsonResult.code = "0";
objJsonResult.count = 0;
- objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.Message = "[0000-1-010]Exception锛�" + e.ToString();
objJsonResult.data = null;
return objJsonResult;
}
@@ -305,10 +319,10 @@
try
{
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
- oCn.RunProc("Delete from KF_PonderationBillMain_Temp where HBarCode = " + BarCode + " and HBillType = '2601'");
+ oCn.RunProc("Delete from KF_PonderationBillMain_Temp where HBarCode = '" + BarCode + "' and HBillType = '2601'");
objJsonResult.code = "1";
objJsonResult.count = 1;
- objJsonResult.Message = "鍒犻櫎鎴愬姛锛�";
+ objJsonResult.Message = "[0000-1-008]鍒犻櫎鎴愬姛锛�";
objJsonResult.data = null;
return objJsonResult;
}
@@ -316,7 +330,7 @@
{
objJsonResult.code = "0";
objJsonResult.count = 0;
- objJsonResult.Message = "鍒犻櫎澶辫触锛�";
+ objJsonResult.Message = "[0000-1-007]鍒犻櫎澶辫触锛�";
objJsonResult.data = e.ToString();
return objJsonResult;
}
@@ -336,6 +350,7 @@
{
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
oCN.BeginTran();
+ oCn.RunProc("Delete from Sc_PackUnionBillMain where HInterID = " + HInterID);
oCn.RunProc("Delete from Sc_PackUnionBillSub where HInterID = " + HInterID + " and HEntryID = " + HEntryID);
//閲嶆柊鍒锋柊鏇存柊 姹囨�诲瓙琛� 鐨勮褰曞拰鏉$爜妗f
oCn.RunProc("Delete from Sc_PackUnionBillSub_Sum where HInterID = " + HInterID);
@@ -373,10 +388,10 @@
try
{
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
- oCn.RunProc("update Sc_PackUnionBillMain set HBarCode_Cus = " + HBarCode_Cus + " where HInterID = " + HInterID);
+ oCn.RunProc("update Sc_PackUnionBillMain set HBarCode_Cus = '" + HBarCode_Cus + "' where HInterID = " + HInterID);
objJsonResult.code = "1";
objJsonResult.count = 1;
- objJsonResult.Message = "淇敼鎴愬姛锛�";
+ objJsonResult.Message = "[[0000-1-067]]淇敼鎴愬姛锛�";
objJsonResult.data = null;
return objJsonResult;
}
@@ -384,7 +399,7 @@
{
objJsonResult.code = "0";
objJsonResult.count = 0;
- objJsonResult.Message = "淇敼澶辫触锛�";
+ objJsonResult.Message = "[0000-1-066]淇敼澶辫触锛�";
objJsonResult.data = e.ToString();
return objJsonResult;
}
--
Gitblit v1.9.1