From 0a56001e1b8e9ae7d2f39c982912cd6d10c22032 Mon Sep 17 00:00:00 2001 From: cwjbxqmz <1134865194@qq.com> Date: 星期二, 06 二月 2024 11:35:20 +0800 Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API --- WebAPI/Controllers/XSGL/Xs_SeOutStockBillController.cs | 368 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 355 insertions(+), 13 deletions(-) diff --git a/WebAPI/Controllers/XSGL/Xs_SeOutStockBillController.cs b/WebAPI/Controllers/XSGL/Xs_SeOutStockBillController.cs index 9f2a54d..b139a93 100644 --- a/WebAPI/Controllers/XSGL/Xs_SeOutStockBillController.cs +++ b/WebAPI/Controllers/XSGL/Xs_SeOutStockBillController.cs @@ -18,6 +18,7 @@ //鑾峰彇绯荤粺鍙傛暟 Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); public DBUtility.ClsPub.Enum_BillStatus BillStatus; + public DAL.ClsXs_SeOutStockBill BillOld = new DAL.ClsXs_SeOutStockBill(); private json objJsonResult = new json(); SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); @@ -35,7 +36,7 @@ try { - ds = oCN.RunProcReturn("select * from h_v_IF_SeOutStockBillList where HitemID=" + HInterID, "h_v_IF_SeOutStockBillList"); + ds = oCN.RunProcReturn("select * from h_v_IF_SeOutStockBillList where hmainid=" + HInterID, "h_v_IF_SeOutStockBillList"); if (ds == null || ds.Tables[0].Rows.Count == 0) { objJsonResult.code = "0"; @@ -233,7 +234,9 @@ long HCusID = mainList[0].HCusID; //瀹㈡埛 string HAddress = mainList[0].HAddress;//鍦板潃 long HSSID = mainList[0].HSSID;//缁撶畻鏂瑰紡 - + long HConveyTypeID = mainList[0].HConveyTypeID;//杩愯緭鏂瑰紡 + long HConveyCompID = mainList[0].HConveyCompID;//杩愯緭鍏徃 + long HConveyMoney = (long)mainList[0].HConveyMoney;//杩愯垂 long HDFflag = Convert.ToInt32(mainList[0].HDFflag); //鏄惁鍨粯 @@ -255,36 +258,94 @@ long HDELIVERYORGID = mainList[0].HDELIVERYORGID; long HOWNERID = mainList[0].HOWNERID; string HOWNERTYPEID = mainList[0].HOWNERTYPEID; + string HLinkMan = mainList[0].HLinkMan; + string HLinkPhone = mainList[0].HLinkPhone; + string HSeOrderBillNo_M = mainList[0].HSeOrderBillNo_M; ds = oCN.RunProcReturn("select * from h_v_IF_SeOutStockBillList where hmainid=" + HInterID + " and 鍗曟嵁鍙�='" + HBillNo + "'", "h_v_IF_SeOutStockBillList"); + + + if ((OperationType == 1 || OperationType == 2) && ds.Tables[0].Rows.Count == 0)//鏂板 { + //淇濆瓨鍓嶆帶鍒�========================================= + string HBillNote = ""; + ds = oCN.RunProcReturn("Exec h_p_Xs_SeOutStockBill_BeforeSaveCtrl " + HInterID.ToString() + ", '" + HBillNo + "','" + HBillNote + "',1 ", "h_p_Xs_SeOutStockBill_BeforeSaveCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨澶辫触!鍘熷洜:淇濆瓨鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; + objJsonResult.data = null; + return objJsonResult; + } + + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HBackRemark"].ToString(); ; + objJsonResult.data = null; + return objJsonResult; + } + //========================================================= + + //涓昏〃 - oCN.RunProc(@"Insert Into Xs_SeOutStockBillMain + string sql = $@"Insert Into Xs_SeOutStockBillMain (HInterID,HYear,HPeriod,HBillType,HBillSubType,HDate,HBillNo,HBillStatus ,HCusID,HManagerID,HDeptID,HRemark,HMaker,HMakeDate - ,HAddress,HSSID,HCurID,HWHID,HExRate,HEmpID,HExplanation,HInnerBillNo - ,HSALEORGID,HDELIVERYORGID,HOWNERID,HOWNERTYPEID + ,HAddress,HSSID,HCurID,HWHID,HExRate,HEmpID,HExplanation,HInnerBillNo,HSeOrderBillNo_M + ,HConveyTypeID,HConveyCompID,HConveyMoney,HLinkMan,HLinkPhone + ,HSALEORGID,HDELIVERYORGID,HOWNERID,HOWNERTYPEID ,HChecker,HCheckDate,HCloseMan,HCloseDate,HERPInterID,HERPBillType,HDFflag) values(" + HInterID + "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + 1402 + "','" + 1402 + "','" + HDate + "','" + HBillNo + "'," + HBillStatus + "," + HCusID + "," + HManagerID + "," + HDeptID + ",'" + HRemark + "','" + HMaker + "','" + HMakeDate + "','" + HAddress + "'," + HSSID + "," + HCurID + "," + HWHID + "," + HExRate + "," + HEmpID + ",'" + - HExplanation + "','" + HInnerBillNo + "'," + HSALEORGID + "," + HDELIVERYORGID + "," + HOWNERID + ",'" + HExplanation + "','" + HInnerBillNo + "','" + HSeOrderBillNo_M + "','" + HConveyTypeID + "','" + HConveyCompID + "','" + HConveyMoney + "','" + HLinkMan + "','" + HLinkPhone + "'," + HSALEORGID + "," + HDELIVERYORGID + "," + HOWNERID + ",'" + HOWNERTYPEID + "','" + HChecker + "','" + HCheckDate + "','" + HCloseMan + "','" + HCloseDate + "'," + HERPInterID + - ",'" + HERPBillType + "'," + HDFflag + ")"); + ",'" + HERPBillType + "'," + HDFflag + ")"; + + oCN.RunProc(sql); } else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0) { //淇敼 - oCN.RunProc("update Xs_SeOutStockBillMain set " + - "HRemark='" + HRemark + "', HChecker='" + HMaker + "', HCheckDate=getdate()" + "' where HInterID=" + HInterID); + string sql = $@"update Xs_SeOutStockBillMain set " + + "HRemark='" + HRemark + "', HChecker='" + HMaker + "', HCheckDate=getdate()" + + ",HCurID=" + HCurID + ", HWHID = " + HWHID + + ",HExRate=" + HExRate + ",HEmpID=" + HEmpID + ",HSeOrderBillNo_M=" + HSeOrderBillNo_M + ",HManagerID=" + HManagerID + ",HDeptID=" + HDeptID + ",HOWNERID=" + HOWNERID + + ",HAddress='" + HAddress + "'where HInterID=" + HInterID; + oCN.RunProc(sql); //鍒犻櫎瀛愯〃 oCN.RunProc("delete from Xs_SeOutStockBillSub where HInterID='" + HInterID + "'"); } //淇濆瓨瀛愯〃 objJsonResult = AddBillSub(msg3, HInterID, OperationType); + + + //淇濆瓨鍚庢帶鍒�========================================= + ds = oCN.RunProcReturn("Exec h_p_Xs_SeOutStockBill_AfterSaveCtrl " + HInterID.ToString() + ", '" + HBillNo + "',1 ", "h_p_Xs_SeOutStockBill_AfterSaveCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨澶辫触!鍘熷洜:淇濆瓨鍚庡垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; + objJsonResult.data = null; + return objJsonResult; + } + + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HBackRemark"].ToString(); ; + objJsonResult.data = null; + return objJsonResult; + } + //========================================================= if (objJsonResult.code == "0") { @@ -316,6 +377,7 @@ List<ClsXs_SeOutStockBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsXs_SeOutStockBillSub>>(msg3); int i = 0; + IList list = DetailColl; foreach (ClsXs_SeOutStockBillSub oSub in DetailColl) { i++; @@ -364,14 +426,16 @@ NewHEntryID += 1; } - oCN.RunProc($@"Insert into Xs_SeOutStockBillSub + string sql=$@"Insert into Xs_SeOutStockBillSub (HInterID,HEntryID,HMaterID,HUnitID,HQty,HPrice,HMoney,HWHID,HSPID,HRemark ,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HSeOrderInterID,HSeOrderEntryID,HSeORderBillNo - ,HOWNERID,HOWNERTYPEID,HSETTLEORGID,HMoveStockQty + ,HOWNERID,HOWNERTYPEID,HMoveStockQty ,HRelationQty,HAuxPropID,HBatchNO,HMTONo,HERPInterID,HERPEntryID) values({HInterID},{NewHEntryID},{oSub.HMaterID},{oSub.HUnitID},{oSub.HQty} - ,{oSub.HPrice},{oSub.HMoney},{oSub.HWHID},{oSub.HSPID},'{oSub.HRemark}',{oSub.HSourceInterID},{oSub.HSourceEntryID},'{oSub.HSourceBillNo}','{oSub.HSourceBillType}',{oSub.HSeOrderInterID},{oSub.HSeOrderEntryID},'{oSub.HSeORderBillNo}',{oSub.HOWNERID},'{oSub.HOWNERTYPEID}',{oSub.HSETTLEORGID},{oSub.HMoveStockQty},{oSub.HRelationQty} - ,{oSub.HAuxPropID},'{oSub.HBatchNO}','{oSub.HMTONo}',{oSub.HERPInterID},{oSub.HERPEntryID})"); + ,{oSub.HPrice},{oSub.HMoney},{oSub.HWHID},{oSub.HSPID},'{oSub.HRemark}',{oSub.HSourceInterID},{oSub.HSourceEntryID},'{oSub.HSourceBillNo}','{oSub.HSourceBillType}',{oSub.HSeOrderInterID},{oSub.HSeOrderEntryID},'{oSub.HSeORderBillNo}',{oSub.HOWNERID},'{oSub.HOWNERTYPEID}',{oSub.HMoveStockQty},{oSub.HRelationQty} + ,{oSub.HAuxPropID},'{oSub.HBatchNO}','{oSub.HMTONo}',{oSub.HERPInterID},{oSub.HERPEntryID})"; + + oCN.RunProc(sql); } objJsonResult.code = "1"; @@ -394,6 +458,7 @@ var model = sMainSub["model"].ToString(); var entry = sMainSub["model"]["HENTRY"].ToString(); + LogService.Write("鍙戣揣閫氱煡鍗曞悓姝� sMainSub:" + sMainSub); model = "[" + model.ToString() + "]"; List<ClsXs_SeOutStockBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsXs_SeOutStockBillMain>>(model); List<ClsXs_SeOutStockBillSub> subList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsXs_SeOutStockBillSub>>(entry); @@ -792,5 +857,282 @@ } #endregion + #region 鍙戣揣閫氱煡鍗曞鏍�/鍙嶅鏍稿姛鑳� + [Route("Xs_SeOutStockBill/CheckXs_SeOutStockBill")] + [HttpGet] + public object CheckXs_SeOutStockBill(string HInterID, int Type, string user) + { + try + { + //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄� + if (!DBUtility.ClsPub.Security_Log("Xs_SeOutStockBill_Check", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳潈闄愬鏍�!"; + objJsonResult.data = null; + return objJsonResult; + } + + if (string.IsNullOrWhiteSpace(HInterID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HInterID涓虹┖锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + ClsPub.CurUserName = user; + oCN.BeginTran();//寮�濮嬩簨鍔� + + //Type 1 瀹℃牳 2 鍙嶅鏍� + if (Type == 1) + { + //瀹℃牳鍓嶆帶鍒� + DataSet BeforeDs = oCN.RunProcReturn("Exec h_p_Xs_SeOutStockBill_BeforeCheckCtrl " + HInterID.ToString() + ",'" + user + "'", "h_p_Xs_SeOutStockBill_BeforeCheckCtrl"); + if (BeforeDs == null || BeforeDs.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳鍓嶅垽鏂け璐ワ紒"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + if (DBUtility.ClsPub.isLong(BeforeDs.Tables[0].Rows[0]["HBack"]) == 1) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触锛�" + DBUtility.ClsPub.isStrNull(BeforeDs.Tables[0].Rows[0]["HRemark"]); + objJsonResult.data = null; + return objJsonResult; + } + } + if (!BillOld.CheckBill(int.Parse(HInterID), BillOld.omodel.HBillNo, "h_p_Xs_SeOutStockBill_AfterCheckCtrl", user, ref ClsPub.sExeReturnInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + else + { + //鍙嶅鏍稿墠鎺у埗 + DataSet BeforeDs = oCN.RunProcReturn("Exec h_p_Xs_SeOutStockBill_BeforeUnCheckCtrl " + HInterID.ToString() + ",'" + user + "'", "h_p_Xs_SeOutStockBill_BeforeUnCheckCtrl"); + if (BeforeDs == null || BeforeDs.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍙嶅鏍稿墠鍒ゆ柇澶辫触锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + if (DBUtility.ClsPub.isLong(BeforeDs.Tables[0].Rows[0]["HBack"]) == 1) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍙嶅鏍稿け璐ワ紒" + DBUtility.ClsPub.isStrNull(BeforeDs.Tables[0].Rows[0]["HRemark"]); + objJsonResult.data = null; + return objJsonResult; + } + } + + if (BillOld.AbandonCheck(int.Parse(HInterID), BillOld.omodel.HBillNo, "h_p_Xs_SeOutStockBill_AfterUnCheckCtrl", user, ref ClsPub.sExeReturnInfo)) + { + SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); + //DataSet DSet = oCn.RunProcReturn("exec h_p_Sc_ICMOBill_AbandonCheckCtrl " + int.Parse(HInterID), "h_p_Sc_ICMOBill_AbandonCheckCtrl"); + //if (DBUtility.ClsPub.isInt(DSet.Tables[0].Rows[0]["Hback"]) != 0) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 1; + // objJsonResult.Message = "璇ヤ换鍔″崟宸蹭笅鎺ㄦ祦杞崱锛屼笉鍏佽鍙嶅鏍�" + DBUtility.ClsPub.isStrNull(DSet.Tables[0].Rows[0]["HBackRemark"]); + // objJsonResult.data = null; + // return objJsonResult; + //} + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + + oCN.Commit();//鎻愪氦浜嬪姟 + + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鎵ц鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; ; + + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 鍙戣揣閫氱煡鍗曞叧闂�/鍙嶅叧闂姛鑳� + [Route("Xs_SeOutStockBill/CloseXs_SeOutStockBill")] + [HttpGet] + public object CloseXs_SeOutStockBill(string HInterID, int Type, string user) + { + try + { + //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄� + if (!DBUtility.ClsPub.Security_Log("Xs_SeOutStockBill_Close", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳潈闄愬叧闂�!"; + objJsonResult.data = null; + return objJsonResult; + } + + if (string.IsNullOrWhiteSpace(HInterID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HInterID涓虹┖锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + ClsPub.CurUserName = user; + + oCN.BeginTran();//寮�濮嬩簨鍔� + + //Type 1 鍏抽棴 2 鍙嶅叧闂� + if (Type == 1) + { + if (!BillOld.CloseBill(int.Parse(HInterID), ref ClsPub.sExeReturnInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + else + { + if (!BillOld.CancelClose(int.Parse(HInterID), ref ClsPub.sExeReturnInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + + oCN.Commit();//鎻愪氦浜嬪姟 + + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鎵ц鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; ; + + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 鍙戣揣閫氱煡鍗曚綔搴�/鍙嶄綔搴熷姛鑳� + [Route("Xs_SeOutStockBill/CancellXs_SeOutStockBill")] + [HttpGet] + public object CancellXs_SeOutStockBill(string HInterID, int Type, string user) + { + try + { + //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄� + if (!DBUtility.ClsPub.Security_Log("Xs_SeOutStockBill_Delete", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳潈闄愪綔搴�!"; + objJsonResult.data = null; + return objJsonResult; + } + + if (string.IsNullOrWhiteSpace(HInterID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HInterID涓虹┖锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + ClsPub.CurUserName = user; + + oCN.BeginTran();//寮�濮嬩簨鍔� + + //Type 1 浣滃簾 2 鍙嶄綔搴� + if (Type == 1) + { + if (!BillOld.Cancelltion(int.Parse(HInterID), ref ClsPub.sExeReturnInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "浣滃簾澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + else + { + if (!BillOld.AbandonCancelltion(int.Parse(HInterID), ref ClsPub.sExeReturnInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶄綔搴熷け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + + oCN.Commit();//鎻愪氦浜嬪姟 + + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鎵ц鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; ; + + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + } } \ No newline at end of file -- Gitblit v1.9.1