From 50bade35ce7a6d9b7e9d1a832662ada666a6d7bd Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期四, 26 五月 2022 09:14:39 +0800
Subject: [PATCH] 叫料平台完善
---
WebAPI/Controllers/SCGL/Sc_ComplementGoodsController.cs | 33 ++++++++++++++--
WebAPI/Controllers/SCGL/Sc_ComplementGoodBillController.cs | 6 +-
WebAPI/Controllers/SCGL/日计划管理/Sc_WorkBillSortBillController.cs | 14 ++++++
WebAPI/Controllers/SCGL/日计划管理/JIT_DayPlanPlatFormImportController.cs | 23 ++++++++++-
4 files changed, 66 insertions(+), 10 deletions(-)
diff --git a/WebAPI/Controllers/SCGL/Sc_ComplementGoodBillController.cs b/WebAPI/Controllers/SCGL/Sc_ComplementGoodBillController.cs
index 8475e02..5c62d7f 100644
--- a/WebAPI/Controllers/SCGL/Sc_ComplementGoodBillController.cs
+++ b/WebAPI/Controllers/SCGL/Sc_ComplementGoodBillController.cs
@@ -396,7 +396,7 @@
ds = oCN.RunProcReturn("select sum(HQty) from JIT_CallGoodsBackRequestBillSub " +
$"where HSourceInterID={listCa[i].HSouceInterID} and HSourceEntryID ={listCa[i].HSourceEntryID} and HSourceBillNo = '{listCa[i].HSourceBillNo}' and HMaterID={listCa[i].HMaterialID}", "JIT_CallGoodsBackRequestBillSub");
- if ((double.Parse(ds.Tables[0].Rows[0][0].ToString())+listCa[i].閫�鏂欐暟閲�) > listCa[i].宸插彨鏂欐暟閲�)
+ if ((double.Parse(ds.Tables[0].Rows[0][0].ToString()==""?"0": ds.Tables[0].Rows[0][0].ToString()) +listCa[i].閫�鏂欐暟閲�) > listCa[i].宸插彨鏂欐暟閲�)
{
objJsonResult.code = "0";
objJsonResult.count = 0;
@@ -533,7 +533,7 @@
ds = oCN.RunProcReturn("select sum(HQty) from JIT_CallGoodsBackRequestBillSub " +
$"where HSourceInterID={listCa[i].HSouceInterID} and HSourceEntryID ={listCa[i].HSourceEntryID} and HSourceBillNo = '{listCa[i].HSourceBillNo}' and HMaterID={listCa[i].HMaterialID}", "JIT_CallGoodsBackRequestBillSub");
- if ((double.Parse(ds.Tables[0].Rows[0][0].ToString()) + listCa[i].閫�鏂欐暟閲�) > listCa[i].宸插彨鏂欐暟閲�)
+ if ((double.Parse(ds.Tables[0].Rows[0][0].ToString() == "" ? "0" : ds.Tables[0].Rows[0][0].ToString()) + listCa[i].閫�鏂欐暟閲�) > listCa[i].宸插彨鏂欐暟閲�)
{
objJsonResult.code = "0";
objJsonResult.count = 0;
@@ -630,7 +630,7 @@
ds = oCN.RunProcReturn("select sum(HQty) from JIT_CallGoodsBackRequestBillSub " +
$"where HSourceInterID={listCa[i].HSouceInterID} and HSourceEntryID ={listCa[i].HSourceEntryID} and HSourceBillNo = '{listCa[i].HSourceBillNo}' and HMaterID={listCa[i].HMaterialID}", "JIT_CallGoodsBackRequestBillSub");
- if ((double.Parse(ds.Tables[0].Rows[0][0].ToString()) + listCa[i].閫�鏂欐暟閲�) > listCa[i].宸插彨鏂欐暟閲�)
+ if ((double.Parse(ds.Tables[0].Rows[0][0].ToString() == "" ? "0" : ds.Tables[0].Rows[0][0].ToString()) + listCa[i].閫�鏂欐暟閲�) > listCa[i].宸插彨鏂欐暟閲�)
{
objJsonResult.code = "0";
objJsonResult.count = 0;
diff --git a/WebAPI/Controllers/SCGL/Sc_ComplementGoodsController.cs b/WebAPI/Controllers/SCGL/Sc_ComplementGoodsController.cs
index 2cc29ad..96f2adb 100644
--- a/WebAPI/Controllers/SCGL/Sc_ComplementGoodsController.cs
+++ b/WebAPI/Controllers/SCGL/Sc_ComplementGoodsController.cs
@@ -332,10 +332,35 @@
oCN.RunProc($"update b set b.HQty=b.HQty+{listCa[i].鏈鎷f枡鏁伴噺} from JIT_SendGoodsBillMain a with(nolock) inner join JIT_SendGoodsBillSub b with(nolock) on a.HInterID = b.HInterID " +
$"where HMainSourceInterID ={SourceInterID} and b.HMaterID ={listCa[i].HMaterID} and a.HBillStatus =1 ");
}
- //淇敼璋冩嫧鏁伴噺
- oCN.RunProc($"update JIT_ComplementGoodsBillSub_LK set HSendQTY=HSendQTY+{listCa[i].鏈鎷f枡鏁伴噺} where HMaterID={listCa[i].HMaterID} " +
- $" and HSourceInterID=(select top 1 HSourceInterID from JIT_ComplementGoodsBillSub_LK " +
- $"where HMaterID={listCa[i].HMaterID} and HInterID={SourceInterID} order by HSourceInterID ) and HInterID={SourceInterID} ");
+
+ DataSet dsTable = new DataSet();
+ //鏌ヨJIT_ComplementGoodsBillSub_LK
+ dsTable = oCN.RunProcReturn($"select * from JIT_ComplementGoodsBillSub_LK where HMaterID={listCa[i].HMaterID} and HInterID={SourceInterID} order by HSourceInterID ", "JIT_ComplementGoodsBillSub_LK");
+
+ for (int j = 0; j < dsTable.Tables[0].Rows.Count; j++)
+ {
+ if (double.Parse(dsTable.Tables[0].Rows[j]["HCallQTY"].ToString()) != double.Parse(dsTable.Tables[0].Rows[j]["HSendQTY"].ToString()))
+ {
+ if (double.Parse(dsTable.Tables[0].Rows[j]["HSendQTY"].ToString()) + listCa[i].鏈鎷f枡鏁伴噺 > double.Parse(dsTable.Tables[0].Rows[j]["HCallQTY"].ToString()))
+ {
+ var HCallQTY = double.Parse(dsTable.Tables[0].Rows[j]["HCallQTY"].ToString()) - double.Parse(dsTable.Tables[0].Rows[j]["HSendQTY"].ToString());
+ //淇敼璋冩嫧鏁伴噺 瓒呭嚭閮ㄥ垎缁欎簣涓嬩竴鍒楁暟鎹�
+ oCN.RunProc($"update JIT_ComplementGoodsBillSub_LK set HSendQTY=HSendQTY+{HCallQTY} where HMaterID={listCa[i].HMaterID} " +
+ $" and HSourceInterID={double.Parse(dsTable.Tables[0].Rows[j]["HSourceInterID"].ToString())} and HInterID={SourceInterID} ");
+
+ oCN.RunProc($"update JIT_ComplementGoodsBillSub_LK set HSendQTY=HSendQTY+{(listCa[i].鏈鎷f枡鏁伴噺 - HCallQTY)} where HMaterID={listCa[i].HMaterID} " +
+ $" and HSourceInterID={dsTable.Tables[0].Rows[j + 1]["HSourceInterID"].ToString()} and HInterID={SourceInterID} ");
+ break;
+ }
+ else
+ {
+ //淇敼璋冩嫧鏁伴噺
+ oCN.RunProc($"update JIT_ComplementGoodsBillSub_LK set HSendQTY=HSendQTY+{listCa[i].鏈鎷f枡鏁伴噺} where HMaterID={listCa[i].HMaterID} " +
+ $" and HSourceInterID={dsTable.Tables[0].Rows[j]["HSourceInterID"].ToString()} and HInterID={SourceInterID} ");
+ break;
+ }
+ }
+ }
}
sReturn = "鏂板鍗曟嵁鎴愬姛锛�";
diff --git "a/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/JIT_DayPlanPlatFormImportController.cs" "b/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/JIT_DayPlanPlatFormImportController.cs"
index dc3d054..f31a9b3 100644
--- "a/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/JIT_DayPlanPlatFormImportController.cs"
+++ "b/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/JIT_DayPlanPlatFormImportController.cs"
@@ -58,6 +58,8 @@
tb2.Columns.Add("HEmpID", typeof(Int32));//鑱屽憳
tb2.Columns.Add("HUnitID", typeof(Int32));//璁¢噺鍗曚綅
tb2.Columns.Add("HSourceID", typeof(Int32));//鐢熶骇璧勬簮id
+ tb2.Columns.Add("ICMOBillHInterID", typeof(Int32));//鐢熶骇璁㈠崟涓籭d
+ tb2.Columns.Add("ICMOBillHEntryID", typeof(Int32));//鐢熶骇璁㈠崟瀛恑d
//娣诲姞鏁版嵁
for (int i = 1; i < ExcelDs.Tables[0].Rows.Count; i++)
@@ -122,6 +124,8 @@
tb2.Rows[i]["鐗╂枡鍚嶇О"] = ds.Tables[0].Rows[0]["浜у搧鍚嶇О"].ToString();
tb2.Rows[i]["瑙勬牸鍨嬪彿"] = ds.Tables[0].Rows[0]["瑙勬牸鍨嬪彿"].ToString();
tb2.Rows[i]["HWorkShopID"] = ds.Tables[0].Rows[0]["HDeptID"].ToString();
+ tb2.Rows[i]["ICMOBillHInterID"] = ds.Tables[0].Rows[0]["hmainid"].ToString();//鐢熶骇璁㈠崟涓籭d
+ tb2.Rows[i]["ICMOBillHEntryID"] = ds.Tables[0].Rows[0]["HEntryID"].ToString();//鐢熶骇璁㈠崟瀛恑d
}
ds = oCN.RunProcReturn("select * from h_v_JIT_Sc_WorkBillSortBillList " +
@@ -270,18 +274,33 @@
var HCompleteQty = list[i]["鎬婚綈濂楁暟閲�"].ToString();
var HOrderType = omdelMian.HOrderType;
var HDate = omdelMian.HDate;
+ var HMainSourceInterID = list[i]["ICMOBillHInterID"].ToString();
+ var HMainSourceEntryID = list[i]["ICMOBillHEntryID"].ToString();
+
+ ds = oCN.RunProcReturn($"select * from Sc_WorkBillSortBillMain where HMainSourceInterID={HMainSourceInterID}" +
+ $" and HMainSourceEntryID={HMainSourceEntryID} and HICMOBillNo='{HICMOBillNo}' and HICMOEntrySEQ={HICMOEntrySEQ} and HSourceID={HSourceID}", "Sc_WorkBillSortBillMain");
+ if (ds.Tables[0].Rows.Count > 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = $"绗瑊i + 1}琛岀敓浜ц祫婧愭湁閲嶅,璇蜂慨鏀�!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
//涓昏〃
oCN.RunProc("insert into Sc_WorkBillSortBillMain(HInterID,HBillNo,HYear,HPeriod,HBillType," +
"HBillSubType,HDate,HBillStatus,HMaker,HMakeDate,HICMOBillNo,HOrderType," +
"HICMOEntrySEQ,HWorkShopID,HSourceID, HYX, HEmpID," +
" HMaterID, HMaterName, HMaterModel, HUnitID, HBatchNo," +
- " HSeOrderBillQty, HOrderNeedQty, HCompleteQty,HPreparatDate)values" +
+ " HSeOrderBillQty, HOrderNeedQty, HCompleteQty,HPreparatDate," +
+ "HMainSourceInterID,HMainSourceEntryID)values" +
$"({HInterID},'{HBillNo}',{DateTime.Now.Year},{DateTime.Now.Month},'{BillType}'," +
$"'{BillType}',GETDATE(),1,'{user}','{HDate}','{HICMOBillNo}','{HOrderType}'," +
$"{(HICMOEntrySEQ == "" ? 0.ToString() : HICMOEntrySEQ)},{(HWorkShopID == "" ? 0.ToString() : HWorkShopID)},{(HSourceID == "" ? 0.ToString() : HSourceID)}, {(HYX == "" ? 0.ToString() : HYX)}, {(HEmpID == "" ? 0.ToString() : HEmpID)}," +
$" {(HMaterID == "" ? 0.ToString() : HMaterID)}, '{HMaterName}', '{HMaterModel}', {(HUnitID == "" ? 0.ToString() : HUnitID)}, '{HBatchNo}'," +
- $" {(HSeOrderBillQty == "" ? 0.ToString() : HSeOrderBillQty)}, {(HOrderNeedQty == "" ? 0.ToString() : HOrderNeedQty)}, {(HCompleteQty == "" ? 0.ToString() : HCompleteQty)},getdate())");
+ $" {(HSeOrderBillQty == "" ? 0.ToString() : HSeOrderBillQty)}, {(HOrderNeedQty == "" ? 0.ToString() : HOrderNeedQty)}, {(HCompleteQty == "" ? 0.ToString() : HCompleteQty)},getdate()," +
+ $" {HMainSourceInterID},{HMainSourceEntryID})");
}
int SumDay = 31; //鍔ㄦ�佷袱鏈堜箣宸� DateTime.Now.AddMonths(1).AddDays(-1).Subtract(DateTime.Now).Days;
diff --git "a/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/Sc_WorkBillSortBillController.cs" "b/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/Sc_WorkBillSortBillController.cs"
index a178ff1..4ca7f3f 100644
--- "a/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/Sc_WorkBillSortBillController.cs"
+++ "b/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/Sc_WorkBillSortBillController.cs"
@@ -91,7 +91,7 @@
string user = sArray[3].ToString();
try
{
- if (!DBUtility.ClsPub.Security_Log("Sc_WorkBillSortBill_Edit", 1, false, user))
+ if (!DBUtility.ClsPub.Security_Log("Sc_WorkBillSortBill_Edit", 1, false, user))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
@@ -140,6 +140,18 @@
}
else if (OperationType == 3)
{
+
+ ds = oCN.RunProcReturn($"select * from Sc_WorkBillSortBillMain where HMainSourceInterID={omdelMian.HMainSourceInterID}" +
+ $" and HMainSourceEntryID={omdelMian.HMainSourceEntryID} and HICMOBillNo='{omdelMian.HICMOBillNo}' and HICMOEntrySEQ={omdelMian.HICMOEntrySEQ} and HSourceID={omdelMian.HSourceID}", "Sc_WorkBillSortBillMain");
+ if ((ds.Tables[0].Rows.Count == 1 && ds.Tables[0].Rows[0]["HInterID"].ToString() != omdelMian.HInterID.ToString()))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鐢熶骇璧勬簮鏈夐噸澶�,璇蜂慨鏀�!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
//淇敼
oCN.RunProc($"update Sc_WorkBillSortBillMain set HDate='{omdelMian.HDate}',HUpDater='{omdelMian.HMaker}',HUpDateDate=GETDATE()" +
$", HRemark='{omdelMian.HRemark}', HPrintQty={(omdelMian.HPrintQty == null ? 0 : omdelMian.HPrintQty)}" +
--
Gitblit v1.9.1