From a77971157668faab57170e93f4e54c6ef7953da5 Mon Sep 17 00:00:00 2001 From: yangle <admin@YINMOU> Date: 星期二, 16 八月 2022 18:18:13 +0800 Subject: [PATCH] 维护 --- WebAPI/Controllers/SCGL/Sc_ComplementGoodsController.cs | 131 +++++++++++++++++++++++++++---------------- WebAPI/Controllers/SCGL/Sc_ComplementGoodBillController.cs | 2 WebAPI/Config/kdapi.config | 6 +- WebAPI/Controllers/POStockInBillController.cs | 4 4 files changed, 88 insertions(+), 55 deletions(-) diff --git a/WebAPI/Config/kdapi.config b/WebAPI/Config/kdapi.config index 897fcfa..45e2a70 100644 --- a/WebAPI/Config/kdapi.config +++ b/WebAPI/Config/kdapi.config @@ -4,7 +4,7 @@ <add key="DbId" value="6204a70eba35fc"></add> <add key="UserName" value="Administrator"></add> <add key="PassWord" value="qaz!@#123"></add> - <add key="KDApiUrl" value="http://47.96.97.237/K3Cloud/"></add> - <add key="DataBaseName" value="AIS20210811135644"></add> - </appSettings> + <add key="KDApiUrl" value="http://47.96.97.237/K3Cloud/"></add> + <add key="DataBaseName" value="AIS20210811135644"></add> + </appSettings> </configuration> \ No newline at end of file diff --git a/WebAPI/Controllers/POStockInBillController.cs b/WebAPI/Controllers/POStockInBillController.cs index 17ea1cf..e0a4d2b 100644 --- a/WebAPI/Controllers/POStockInBillController.cs +++ b/WebAPI/Controllers/POStockInBillController.cs @@ -1328,7 +1328,7 @@ }; var loginRet = InvokeHelper.Login(); var isSuccess = JObject.Parse(loginRet)["LoginResultType"].Value<int>(); - if (isSuccess == 0) + if (isSuccess < 0) { objjson.code = "0"; objjson.count = 0; @@ -1336,7 +1336,7 @@ objjson.data = null; return objjson; } - LogService.Write("jsonRoot:" + jsonRoot.ToString()); + //LogService.Write("jsonRoot:" + jsonRoot.ToString()); var result = InvokeHelper.Save("PUR_ReceiveBill", jsonRoot.ToString()); //LogService.Write(result); if (JObject.Parse(result)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() == "TRUE") diff --git a/WebAPI/Controllers/SCGL/Sc_ComplementGoodBillController.cs b/WebAPI/Controllers/SCGL/Sc_ComplementGoodBillController.cs index f29456c..8b4ad48 100644 --- a/WebAPI/Controllers/SCGL/Sc_ComplementGoodBillController.cs +++ b/WebAPI/Controllers/SCGL/Sc_ComplementGoodBillController.cs @@ -68,7 +68,7 @@ //鍙嶅簭鍒楀寲浼犻�掔殑鍊� ComplementGoodBill com = JsonConvert.DeserializeObject<ComplementGoodBill>(sWhere.ToString()); - ds = oCN.RunProcReturn($"exec h_p_JIT_CallGoodsPlatForm_Query '{com.HSeOrderBillNo}','{com.DepartmentName}','{com.MaterialNumber}','{com.MaterialName}'," + + ds = oCN.RunProcReturn($"exec h_p_JIT_CallGoodsPlatForm_Query '{com.HSeOrderBillNo}','{com.DepartmentName}','{com.MaterialNumber}','{com.MaterialName}'," + $"'{com.MaterialModel}','{com.HICMOBillNo}','{com.CPNumber}','{com.CPName}','{com.CPModel}','{com.HBeginDate}','{com.HEndDate.AddDays(1).AddSeconds(-1)}'," + $"{com.ps},{com.Organization},'{com.user}' ", "h_p_JIT_CallGoodsPlatForm_Query"); diff --git a/WebAPI/Controllers/SCGL/Sc_ComplementGoodsController.cs b/WebAPI/Controllers/SCGL/Sc_ComplementGoodsController.cs index 83be190..cc5ddc0 100644 --- a/WebAPI/Controllers/SCGL/Sc_ComplementGoodsController.cs +++ b/WebAPI/Controllers/SCGL/Sc_ComplementGoodsController.cs @@ -257,15 +257,15 @@ } } - bool flag = false; - flag = AddSendGoodsBill(listCa, SourceInterID, SourceBillNo, user, ref DBUtility.ClsPub.sExeReturnInfo); + + objJsonResult = AddSendGoodsBill(listCa, SourceInterID, SourceBillNo, user); - if (flag) + if (objJsonResult.count==1) { objJsonResult.code = "1"; objJsonResult.count = 1; - objJsonResult.Message = "閰嶉�佹垚鍔�!"; + objJsonResult.Message = "璋冩嫧鍗曠敓鎴愭垚鍔�!"; objJsonResult.data = null; return objJsonResult; } @@ -273,7 +273,7 @@ { objJsonResult.code = "0"; objJsonResult.count = 0; - objJsonResult.Message = "閰嶉�佸け璐�!"; + objJsonResult.Message = "璋冩嫧鍗曠敓鎴愬け璐�"; objJsonResult.data = null; return objJsonResult; } @@ -288,15 +288,11 @@ } } //鏂板 - public bool AddSendGoodsBill(List<SendGoodsBill> listCa, string SourceInterID, string SourceBillNo, string user, ref string sReturn) + public json AddSendGoodsBill(List<SendGoodsBill> listCa, string SourceInterID, string SourceBillNo, string user) { try { oCN.BeginTran(); - - //oCN.RunProc($"delete from JIT_SendGoodsBillMain where HMainSourceInterID={SourceInterID} and HMainSourceBillNo='{SourceBillNo}' and HBillStatus=1"); - - //oCN.RunProc($"delete from JIT_SendGoodsBillSub where HInterID in (select HInterID from JIT_SendGoodsBillMain where HMainSourceInterID={SourceInterID} and HMainSourceBillNo='{SourceBillNo}' and HBillStatus=1)"); ds = oCN.RunProcReturn($"select a.HMainSourceEntryID,b.HMaterID from JIT_SendGoodsBillMain a with(nolock) inner join JIT_SendGoodsBillSub b with(nolock) on a.HInterID = b.HInterID where a.HMainSourceInterID={SourceInterID} and a.HBillStatus=1", "JIT_SendGoodsBillMain"); @@ -304,16 +300,6 @@ string HBillNo = ""; for (int i = 0; i < listCa.Count; i++) { - //int a = -1; - //for (int j = 0; j < ds.Tables[0].Rows.Count; j++) - //{ - // if (ds.Tables[0].Rows[j]["HMaterID"].ToString() == listCa[i].HMaterID.ToString() && ds.Tables[0].Rows[j]["HMainSourceEntryID"].ToString() == listCa[i].HEntryID.ToString()) - // { - // a = j; - // break; - // } - //} - // 鍒欎唬琛ㄩ厤閫佸崟娌℃湁鏁版嵁 闇�瑕佹坊鍔犳暟鎹� if (ds.Tables[0].Rows.Count == 0) { @@ -335,12 +321,6 @@ ",HMaterID,HQty,HWHID,HSPID,HISCheck,HCheckSubMan,HCheckSubDate,HStockOutOrgID,HStockInOrgID,HSCWHID)" + $"values({InterID},'{HBillNo}',{i + 1}, {listCa[i].HMaterID},{listCa[i].鏈鎷f枡鏁伴噺}," + $" {listCa[i].HWHID},{listCa[i].HSPID},0,'{user}', GETDATE(),{listCa[i].HStockOutOrgID},{listCa[i].HStockInOrgID},{listCa[i].HSCWHID})"); - - //鍚屾閲戣澏鐩存帴璋冩嫧鍗� - if (AddSendGoodsBillSynChronizAtion(HBillNo, ref DBUtility.ClsPub.sExeReturnInfo)) - { - - } } else { @@ -379,20 +359,41 @@ } } - sReturn = "鏂板鍗曟嵁鎴愬姛锛�"; + objJsonResult = AddSendGoodsBillSynChronizAtion(HBillNo); + oCN.Commit(); - return true; + + if (objJsonResult.count == 1) + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = null; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = null; + objJsonResult.data = null; + return objJsonResult; + } } catch (Exception e) { oCN.RollBack(); - sReturn = e.Message; + + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = e.Message; + return objJsonResult; throw (e); } } //鍚屾閲戣澏鐩存帴璋冩嫧鍗� - public bool AddSendGoodsBillSynChronizAtion(string HBillNo, ref string sReturn) + public json AddSendGoodsBillSynChronizAtion(string HBillNo) { ds = oCN.RunProcReturn("exec JIT_SendGoodsBillSynChronizAtion '" + HBillNo + "'", "JIT_SendGoodsBillSynChronizAtion"); @@ -410,23 +411,25 @@ model.Add("FStockOutOrgId", new JObject() { ["Fnumber"] = dr["FStockOutOrgId"].ToString() }); JArray Fentity = new JArray(); - JObject FentityModel = new JObject(); - FentityModel.Add("FMaterialId", new JObject() { ["Fnumber"] = dr["FMaterialId"].ToString() }); - FentityModel.Add("FUnitID", new JObject() { ["Fnumber"] = dr["FUnitID"].ToString() }); - FentityModel.Add("FBaseUnitId", new JObject() { ["Fnumber"] = dr["FBaseUnitId"].ToString() }); - FentityModel.Add("FOwnerTypeId", dr["FOwnerTypeId"].ToString()); - FentityModel.Add("FOwnerId", new JObject() { ["Fnumber"] = dr["FOwnerId"].ToString() }); - FentityModel.Add("FOwnerTypeOutId", dr["FOwnerTypeOutId"].ToString()); - FentityModel.Add("FOwnerOutId", new JObject() { ["Fnumber"] = dr["FOwnerOutId"].ToString() }); - FentityModel.Add("FKeeperTypeId", dr["FKeeperTypeId"].ToString()); - FentityModel.Add("FKeeperId", new JObject() { ["Fnumber"] = dr["FKeeperId"].ToString() }); - FentityModel.Add("FKeeperTypeOutId", dr["FKeeperTypeOutId"].ToString()); - FentityModel.Add("FKeeperOutId", new JObject() { ["Fnumber"] = dr["FKeeperOutId"].ToString() }); - FentityModel.Add("FDestStockId", new JObject() { ["Fnumber"] = dr["FDestStockId"].ToString() }); - FentityModel.Add("FSrcStockId", new JObject() { ["Fnumber"] = dr["FSrcStockId"].ToString() }); - FentityModel.Add("FQty", dr["FQty"].ToString()); - - Fentity.Add(FentityModel); + foreach (DataRow item in ds.Tables[1].Rows) + { + JObject FentityModel = new JObject(); + FentityModel.Add("FMaterialId", new JObject() { ["Fnumber"] = item["FMaterialId"].ToString() }); + FentityModel.Add("FUnitID", new JObject() { ["Fnumber"] = item["FUnitID"].ToString() }); + FentityModel.Add("FBaseUnitId", new JObject() { ["Fnumber"] = item["FBaseUnitId"].ToString() }); + FentityModel.Add("FOwnerTypeId", item["FOwnerTypeId"].ToString()); + FentityModel.Add("FOwnerId", new JObject() { ["Fnumber"] = item["FOwnerId"].ToString() }); + FentityModel.Add("FOwnerTypeOutId", item["FOwnerTypeOutId"].ToString()); + FentityModel.Add("FOwnerOutId", new JObject() { ["Fnumber"] = item["FOwnerOutId"].ToString() }); + FentityModel.Add("FKeeperTypeId", item["FKeeperTypeId"].ToString()); + FentityModel.Add("FKeeperId", new JObject() { ["Fnumber"] = item["FKeeperId"].ToString() }); + FentityModel.Add("FKeeperTypeOutId", item["FKeeperTypeOutId"].ToString()); + FentityModel.Add("FKeeperOutId", new JObject() { ["Fnumber"] = item["FKeeperOutId"].ToString() }); + FentityModel.Add("FDestStockId", new JObject() { ["Fnumber"] = item["FDestStockId"].ToString() }); + FentityModel.Add("FSrcStockId", new JObject() { ["Fnumber"] = item["FSrcStockId"].ToString() }); + FentityModel.Add("FQty", item["FQty"].ToString()); + Fentity.Add(FentityModel); + } model.Add("FBillEntry", Fentity); JObject jsonRoot = new JObject() @@ -439,9 +442,39 @@ ["IsVerifyBaseDataField"] = "false", ["Model"] = model }; - + var loginRet = InvokeHelper.Login(); + var isSuccess = JObject.Parse(loginRet)["LoginResultType"].Value<int>(); + if (isSuccess < 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = loginRet; + objJsonResult.data = null; + return objJsonResult; + } + var result = InvokeHelper.Save("STK_TransferDirect", jsonRoot.ToString()); + if (JObject.Parse(result)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() == "TRUE") + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = null; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = result; + objJsonResult.data = null; + return objJsonResult; + } } - return true; + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = null; + objJsonResult.data = null; + return objJsonResult; } #endregion -- Gitblit v1.9.1