From fd56fa51fe25f26ce5b518c6f3afb81fbc19553a Mon Sep 17 00:00:00 2001
From: zzr99 <1940172413@qq.com>
Date: 星期一, 25 七月 2022 17:04:53 +0800
Subject: [PATCH] 盘点
---
WebAPI/Controllers/SCGL/Sc_ComplementGoodsController.cs | 33 +++++++++++++++++++++++++++++----
1 files changed, 29 insertions(+), 4 deletions(-)
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 = "鏂板鍗曟嵁鎴愬姛锛�";
--
Gitblit v1.9.1