From 84f084b5b5a4593d4e4e30d2c95b91ca0e0e3384 Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期二, 29 三月 2022 13:23:18 +0800
Subject: [PATCH] 查询过滤 仓库发料 拣料配送列表上查 页面优化
---
WebAPI/Controllers/SCGL/Sc_CallGoodsBackRequestBillController.cs | 48 ++++++++++-
WebAPI/Controllers/SCGL/Sc_ComplementGoodsController.cs | 166 +++++++++++++++++++++++++++++++++++++++++
WebAPI/Controllers/CJGL/Cj_CallGoodsBillBackController.cs | 2
3 files changed, 210 insertions(+), 6 deletions(-)
diff --git a/WebAPI/Controllers/CJGL/Cj_CallGoodsBillBackController.cs b/WebAPI/Controllers/CJGL/Cj_CallGoodsBillBackController.cs
index 7e795b8..18e425f 100644
--- a/WebAPI/Controllers/CJGL/Cj_CallGoodsBillBackController.cs
+++ b/WebAPI/Controllers/CJGL/Cj_CallGoodsBillBackController.cs
@@ -94,7 +94,7 @@
return objJsonResult;
}
- ds = oCN.RunProcReturn($"exec Sc_ComplementGoodBill/Insert_TL_ICStockTuiBill {HInterID},{HEntryID} ", "h_p_JIT_BackGoodsBillList_Delete");
+ ds = oCN.RunProcReturn($"exec h_p_JIT_BackGoodsBillList_Delete {HInterID},{HEntryID} ", "h_p_JIT_BackGoodsBillList_Delete");
objJsonResult.code = ds.Tables[0].Rows[0][0].ToString();
objJsonResult.count = int.Parse(ds.Tables[0].Rows[0][0].ToString());
diff --git a/WebAPI/Controllers/SCGL/Sc_CallGoodsBackRequestBillController.cs b/WebAPI/Controllers/SCGL/Sc_CallGoodsBackRequestBillController.cs
index 3381916..481154e 100644
--- a/WebAPI/Controllers/SCGL/Sc_CallGoodsBackRequestBillController.cs
+++ b/WebAPI/Controllers/SCGL/Sc_CallGoodsBackRequestBillController.cs
@@ -149,6 +149,7 @@
public int? HWHID = 0;
public string 閫�鏂欏師鍥� { get; set; }
public int? 閫�鍥炴暟閲� = 0;
+ public int? HSPID = 0;
}
[Route("Sc_CallGoodsBackRequestBill/JIT_BackGoodsList_PZQR")]
@@ -221,14 +222,51 @@
var _value = msg["msg"].ToString();
string[] sArray = _value.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
string msg2 = sArray[0].ToString();
+ string user = sArray[1].ToString();
try
{
+ msg2 = msg2.Replace("\\", "");
+ msg2 = msg2.Replace("\n", "");
- objJsonResult.code = ds.Tables[0].Rows[0][0].ToString();
- objJsonResult.count = int.Parse(ds.Tables[0].Rows[0][0].ToString());
- objJsonResult.Message = ds.Tables[0].Rows[0][1].ToString();
- objJsonResult.data = ds.Tables[0];
- return objJsonResult;
+ List<JIT_BackGoods_PZQR> listCa = new List<JIT_BackGoods_PZQR>();
+ //鑾峰彇琛ㄦ牸鏁版嵁闆嗗悎
+ listCa = JsonConvert.DeserializeObject<List<JIT_BackGoods_PZQR>>(msg2.ToString());
+
+ int a = 0;
+ for (int i = 0; i < listCa.Count; i++)
+ {
+ ds = oCN.RunProcReturn($"exec h_p_JIT_BackGoods_WHReceive {listCa[i].hmainid},{listCa[i].Hsubid}," +
+ $"{listCa[i].HSPID},{user}", "h_p_JIT_BackGoods_WHReceive");
+
+ if (ds.Tables[0].Rows[0][0].ToString() == "1")
+ {
+ a++;
+ }
+ }
+ if (a == listCa.Count)
+ {
+ objJsonResult.code = ds.Tables[0].Rows[0][0].ToString();
+ objJsonResult.count = int.Parse(ds.Tables[0].Rows[0][0].ToString());
+ objJsonResult.Message = ds.Tables[0].Rows[0][1].ToString();
+ objJsonResult.data = ds.Tables[0];
+ return objJsonResult;
+ }
+ else if (a > 0 && a < listCa.Count)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏈叏閮ㄤ粨搴撴帴鏀�!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.code = ds.Tables[0].Rows[0][0].ToString();
+ objJsonResult.count = int.Parse(ds.Tables[0].Rows[0][0].ToString());
+ objJsonResult.Message = ds.Tables[0].Rows[0][1].ToString();
+ objJsonResult.data = ds.Tables[0];
+ return objJsonResult;
+ }
}
catch (Exception e)
{
diff --git a/WebAPI/Controllers/SCGL/Sc_ComplementGoodsController.cs b/WebAPI/Controllers/SCGL/Sc_ComplementGoodsController.cs
index 07f34a6..7ce0f36 100644
--- a/WebAPI/Controllers/SCGL/Sc_ComplementGoodsController.cs
+++ b/WebAPI/Controllers/SCGL/Sc_ComplementGoodsController.cs
@@ -98,6 +98,17 @@
return objJsonResult;
}
+ ds = oCN.RunProcReturn($"select HISCheck from JIT_SendGoodsBillMain where HMainSourceInterID={HInterID} ", "JIT_SendGoodsBillMain");
+
+ if (ds.Tables[0].Rows.Count>0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "褰撳墠鍗曟嵁宸查厤閫�,涓嶈兘鍒犻櫎!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
oCN.RunProc($"exec Del_ComplementGoodsBillInfo {HInterID},{HEntryID},{HOrgID}");
objJsonResult.code = "1";
@@ -188,5 +199,160 @@
}
}
#endregion
+
+ #region 浠撳簱鍙戞枡
+ //鍙傛暟
+ public class SendGoodsBill {
+ public int? 鏈嫞鏂欐暟閲� = 0;
+ public int? 鏈�澶ф嫞鏂欐暟閲� = 0;
+ public int? 鏈鎷f枡鏁伴噺 = 0;
+ public int? HEntryID = 0;
+ public int? HMaterID = 0;
+ public int? HWHID = 0;
+ public int? HSPID = 0;
+ }
+
+ [Route("Sc_ComplementGoods/JIT_SendGoodsBill")]
+ [HttpPost]
+ public object JIT_SendGoodsBill([FromBody] JObject msg)
+ {
+ var _value = msg["msg"].ToString();
+ string[] sArray = _value.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+ string msg2 = sArray[0].ToString();
+ string user = sArray[1].ToString();
+ string SourceInterID = sArray[2].ToString();
+ string SourceBillNo = sArray[3].ToString();
+ try
+ {
+ msg2 = msg2.Replace("\\", "");
+ msg2 = msg2.Replace("\n", "");
+
+ List<SendGoodsBill> listCa = new List<SendGoodsBill>();
+ //鑾峰彇琛ㄦ牸鏁版嵁闆嗗悎
+ listCa = JsonConvert.DeserializeObject<List<SendGoodsBill>>(msg2.ToString());
+
+ for (int i = 0; i < listCa.Count; i++)
+ {
+ if (listCa[i].鏈鎷f枡鏁伴噺 > listCa[i].鏈�澶ф嫞鏂欐暟閲�)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏈鎷f枡鏁伴噺瓒呰繃鏈�澶ф嫞鏂欐暟閲�!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ if (listCa[i].鏈鎷f枡鏁伴噺 > listCa[i].鏈嫞鏂欐暟閲�)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏈鎷f枡鏁伴噺瓒呰繃鏈嫞鏂欐暟閲�!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+
+ bool flag = false;
+ flag = AddSendGoodsBill(listCa, SourceInterID, SourceBillNo, user, ref DBUtility.ClsPub.sExeReturnInfo);
+
+
+ if (flag)
+ {
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "閰嶉�佹垚鍔�!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "閰嶉�佸け璐�!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ //鏂板
+ public bool AddSendGoodsBill(List<SendGoodsBill> listCa, string SourceInterID, string SourceBillNo, string user, ref string sReturn)
+ {
+ try
+ {
+ oCN.BeginTran();
+
+ oCN.RunProc($"delete from JIT_SendGoodsBillMain where HMainSourceInterID={SourceInterID} and HMainSourceBillNo='{SourceBillNo}'");
+
+ oCN.RunProc($"delete from JIT_SendGoodsBillSub where HInterID in (select HInterID from JIT_SendGoodsBillMain where HMainSourceInterID={SourceInterID} and HMainSourceBillNo='{SourceBillNo}')");
+
+ for (int i = 0; i < listCa.Count; i++)
+ {
+ long InterID = DBUtility.ClsPub.CreateBillID_Prod("460201", ref DBUtility.ClsPub.sExeReturnInfo);
+ string HBillNo = DBUtility.ClsPub.CreateBillCode_Prod("460201", ref DBUtility.ClsPub.sExeReturnInfo, true);
+
+ //娣诲姞涓昏〃鏁版嵁
+ oCN.RunProc("insert into JIT_SendGoodsBillMain(HYear,HPeriod,HBillType,HBillSubType,HInterID,HDate" +
+ ",HBillNo,HBillStatus,HMaker,HMakeDate,HISCheck, HMainSourceInterID, HMainSourceEntryID" +
+ ", HMainSourceBillNo, HMainSourceBillType)" +
+ $"values({DateTime.Now.Year},{DateTime.Now.Month},'460201','460201',{InterID}, GETDATE(), '{HBillNo}'," +
+ $" 0,'{user}', GETDATE(), 0, {SourceInterID}, {listCa[i].HEntryID}, '{SourceBillNo}', '4602')");
+
+ //娣诲姞瀛愯〃鏁版嵁
+ oCN.RunProc("insert into JIT_SendGoodsBillSub(HInterID,HBillNo_bak,HEntryID" +
+ ",HMaterID,HQty,HWHID,HSPID,HISCheck,HCheckSubMan,HCheckSubDate)" +
+ $"values({InterID},'{HBillNo}',{i}, {listCa[i].HMaterID},{listCa[i].鏈鎷f枡鏁伴噺}," +
+ $" {listCa[i].HWHID},{listCa[i].HSPID},0,'{user}', GETDATE())");
+
+ //淇敼璋冩嫧鏁伴噺
+ oCN.RunProc($"update JIT_ComplementGoodsBillSub_LK set HSendQTY={listCa[i].鏈鎷f枡鏁伴噺} where HMaterID={listCa[i].HMaterID} " +
+ $" and HSourceInterID=(select top 1 HSourceInterID from JIT_ComplementGoodsBillSub_LK " +
+ $"where HMaterID={listCa[i].HMaterID} order by HSourceInterID ) and HInterID={SourceInterID}");
+ }
+
+ sReturn = "鏂板鍗曟嵁鎴愬姛锛�";
+ oCN.Commit();
+ return true;
+ }
+ catch (Exception e)
+ {
+ sReturn = e.Message;
+ throw (e);
+ }
+ }
+ #endregion
+
+ #region 涓婃煡
+ [Route("Sc_ComplementGoods/ComplementGoodsList_Sc")]
+ [HttpGet]
+ public object ComplementGoodsList_Sc(string HInterID,string HEntryID)
+ {
+ try
+ {
+
+ ds = oCN.RunProcReturn($"exec h_p_JIT_ComplementGoodsBillList_UpQuery '{HInterID}',{HEntryID}", "h_p_JIT_ComplementGoodsBillList_UpQuery");
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = ds.Tables[0];
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
}
}
\ No newline at end of file
--
Gitblit v1.9.1