From 9c60b98594f1e685f4d8f99efb4e84d21b3847f3 Mon Sep 17 00:00:00 2001 From: 仲国强 <519541279@qq.com> Date: 星期五, 15 十月 2021 11:29:55 +0800 Subject: [PATCH] 批量委外接收显示明细 --- WebAPI/Controllers/CJGL/Cj_StationEntrustOutBillController.cs | 756 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 710 insertions(+), 46 deletions(-) diff --git a/WebAPI/Controllers/CJGL/Cj_StationEntrustOutBillController.cs b/WebAPI/Controllers/CJGL/Cj_StationEntrustOutBillController.cs index 70eee49..3016d45 100644 --- a/WebAPI/Controllers/CJGL/Cj_StationEntrustOutBillController.cs +++ b/WebAPI/Controllers/CJGL/Cj_StationEntrustOutBillController.cs @@ -14,17 +14,14 @@ public class Cj_StationEntrustOutBillController : ApiController { public DBUtility.ClsPub.Enum_BillStatus BillStatus; + Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); private json objJsonResult = new json(); SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); DataSet ds; - /// <summary> - /// 杩斿洖濮斿宸ュ簭鎺ユ敹鍗曞垪琛� - ///鍙傛暟锛歴tring sql銆� - ///杩斿洖鍊硷細object銆� - /// </summary> + #region 杩斿洖濮斿宸ュ簭鎺ユ敹鍗曞垪琛� [Route("Cj_StationEntrustOutBill/list")] [HttpGet] public object list(string sWhere) @@ -33,7 +30,7 @@ { if (sWhere == null || sWhere.Equals("")) { - ds = oCN.RunProcReturn("select * from h_v_MES_StationEntrustOutBillList " + sWhere, "h_v_MES_StationEntrustOutBillList"); + ds = oCN.RunProcReturn("select * from h_v_MES_StationEntrustOutBillList " + sWhere+ " order by 鎺ユ敹鏃堕棿 desc", "h_v_MES_StationEntrustOutBillList"); } else { @@ -67,12 +64,9 @@ return objJsonResult; } } + #endregion - /// <summary> - /// 鏂板鍗曟嵁-淇濆瓨鎸夐挳 - ///鍙傛暟锛歴tring sql銆� - ///杩斿洖鍊硷細object銆� - /// </summary> + #region 鏂板鍗曟嵁-淇濆瓨鎸夐挳 [Route("Cj_StationEntrustOutBill/AddBill")] [HttpPost] public object AddBill([FromBody] JObject oMain) @@ -84,7 +78,9 @@ //閮ㄩ棬鍩虹璧勬枡鍙嶅簭鍒楀寲 msg1 = "[" + msg1.ToString() + "]"; List<StationBill> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<StationBill>>(msg1); - + long HMainInterID = 0; + HMainInterID = list[0].HMainInterID; + string eventType = list[0].eventType; long HInterID = list[0].HInterID;//閫掑叆type寰楀埌鐨勫崟鎹甀D int HYear = 2021; double HPeriod = list[0].HPeriod;//鍗曚环 @@ -93,8 +89,8 @@ string HInnerBillNo = list[0].HInnerBillNo;//閫佽揣鍗曞彿 string HICMOBillNo = list[0].HICMOBillNo;//鐢熶骇璁㈠崟鍙� long HICMOInterID = list[0].HICMOInterID;//鐢熶骇璁㈠崟鍙稩D - int HProcExchInterID = 0; - int HProcExchEntryID = 0; + long HProcExchInterID = list[0].lngBillKey; + long HProcExchEntryID = list[0].lngBillSubKey; string HProcExchBillNo = list[0].HProcExchBillNo;//娴佽浆鍗� long HProcID = list[0].HProcID;//褰撳墠宸ュ簭 long HMaterID = list[0].HMaterID;//浜у搧ID @@ -111,7 +107,7 @@ double HMoney = list[0].HMoney;//閲戦 string HRemark = list[0].HRemark;//澶囨敞 double HTaxRate = list[0].HTaxRate;//绋庣巼 - string HProcNo = list[0].HProcNo;//娴佹按鍙� + long HProcNo = list[0].HProcNo;//娴佹按鍙� string HOrderProcNO = list[0].HOrderProcNO;//璁㈠崟璺熻釜鍙� int HWWWorkOrderInterID = 0;//濮斿宸ュ崟鍙峰瓙鍐呯爜 int HWWWorkOrderEntryID = 0;//濮斿宸ュ崟鍙蜂富鍐呭悧 @@ -124,7 +120,7 @@ string HBarCode = list[0].HBarCode;//鏉″舰鐮� string HAddr = ""; string HBarCodeMaker = ""; - string BillType = "3791"; + string BillType = "3793"; double HWasterQty = list[0].HWasterQty;//涓嶅悎鏍兼暟閲� long HPlanPieceQty = list[0].HPlanPieceQty;//鍙戝嚭浠舵暟 long HBadPNL = list[0].HBadPNL;//鎶ュ簾浠舵暟 @@ -136,27 +132,163 @@ double HMainSourceInterID = 0; string HMainSourceBillNo = ""; string HMainSourceBillType = "3792"; - + if (HProcExchInterID <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娴佽浆鍗℃病鏈夐�夋嫨锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (HProcExchEntryID <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娴佹按鍙�2娌℃湁閫夋嫨锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (HProcNo <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娴佹按鍙锋病鏈夐�夋嫨锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (HProcExchBillNo == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娴佽浆鍗″彿娌℃湁閫夋嫨锛�"; + objJsonResult.data = null; + return objJsonResult; + } + //if (HInnerBillNo == "") + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鍙戣揣鍙锋病鏈夎緭鍏ワ紒"; + // objJsonResult.data = null; + // return objJsonResult; + //} + if (HProcID <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "褰撳墠宸ュ簭娌℃湁閫夋嫨锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (HMaterID <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "浜у搧娌℃湁閫夋嫨锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (HSupID <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "渚涘簲鍟嗘病鏈夐�夋嫨锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (HQty <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍚堟牸鏁伴噺涓嶈兘灏忎簬绛変簬0锛�"; + objJsonResult.data = null; + return objJsonResult; + } + //if (HWasterQty < 0) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "涓嶅悎鏍兼暟涓嶈兘灏忎簬0锛�"; + // objJsonResult.data = null; + // return objJsonResult; + //} + if (HTaxRate < 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "绋庣巼涓嶈兘涓鸿礋锛�"; + objJsonResult.data = null; + return objJsonResult; + } //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� oCN.BeginTran(); - //涓昏〃 - oCN.RunProc("Insert Into Sc_StationOutBillMain " + - "(HBillType,HBillSubType,HInterID,HBillNo,HBillStatus,HDate,HMaker,HMakeDate" + - ",HYear,HPeriod,HRemark,HInnerBillNo,HSourceName,HPieceQty,HWasterQty,HPlanPieceQty,HBadPNL" + - ",HICMOInterID,HICMOBillNo,HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo,HProcExchInterID,HProcExchEntryID" + - ",HProcExchBillNo,HMaterID,HProcID,HICMOQty,HPlanQty,HStationOutTime,HSourceID" + - ",HGroupID,HDeptID,HEmpID,HBarCode,HAddr,HBarCodeMaker,HBarCodeMakeDate" + - ",HSupID,HTaxRate,HQty,HPrice,HMoney,HPrice_BHS,HMoney_BHS,HBadCount" + - ",HMainSourceInterID,HMainSourceBillNo,HMainSourceBillType,HProcNo,HOrderProcNO,HLastSubProc,HWWWorkOrderBillNo,HWWWorkOrderInterID,HWWWorkOrderEntryID" + - ") " + - " values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "'," + HBillStatus + ",getdate(),'" + HMaker + "',getdate()" + - "," + HYear + "," + HPeriod + ",'" + HRemark + "','" + HInnerBillNo + "','" + HSourceName + "'," + HPieceQty + "," + HWasterQty + "," + HPlanPieceQty + "," + HBadPNL + - "," + HICMOInterID + ",'" + HICMOBillNo + "'," + HProcPlanInterID + "," + HProcPlanEntryID + ",'" + HProcPlanBillNo + "'," + HProcExchInterID + "," + HProcExchEntryID + - ",'" + HProcExchBillNo + "'," + HMaterID + "," + HProcID + "," + HICMOQty + "," + HPlanQty + ",getdate()," + HSourceID + - "," + HGroupID + "," + HDeptID + "," + HEmpID + ",'" + HBarCode + "','" + HAddr + "','" + HBarCodeMaker + "',getdate()" + - "," + HSupID + "," + HTaxRate + "," + HQty + "," + HPrice + "," + HMoney + "," + HPrice_BHS + "," + HMoney_BHS + "," + HBadCount + - "," + HMainSourceInterID + ",'" + HMainSourceBillNo + "','" + HMainSourceBillType + "'," + HProcNo + ",'" + HOrderProcNO + "'," + Convert.ToString(HLastSubProc ? 1 : 0) + ",'" + HWWWorkOrderBillNo + "'," + HWWWorkOrderInterID + "," + HWWWorkOrderEntryID + - ") "); + if ("Add".Equals(eventType)) + { + //楠岃瘉鍗曟嵁鍙锋槸鍚﹂噸澶� + if (!AllowbillNo(HBillNo)) + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒"; + objJsonResult.data = null; + return objJsonResult; + } + //涓昏〃 + oCN.RunProc("Insert Into Sc_StationOutBillMain " + + "(HBillType,HBillSubType,HInterID,HBillNo,HBillStatus,HDate,HMaker,HMakeDate" + + ",HYear,HPeriod,HRemark,HInnerBillNo,HSourceName,HPieceQty,HWasterQty,HPlanPieceQty,HBadPNL" + + ",HICMOInterID,HICMOBillNo,HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo,HProcExchInterID,HProcExchEntryID" + + ",HProcExchBillNo,HMaterID,HProcID,HICMOQty,HPlanQty,HStationOutTime,HSourceID" + + ",HGroupID,HDeptID,HEmpID,HBarCode,HAddr,HBarCodeMaker,HBarCodeMakeDate" + + ",HSupID,HTaxRate,HQty,HPrice,HMoney,HPrice_BHS,HMoney_BHS,HBadCount" + + ",HMainSourceInterID,HMainSourceBillNo,HMainSourceBillType,HProcNo,HOrderProcNO,HLastSubProc,HWWWorkOrderBillNo,HWWWorkOrderInterID,HWWWorkOrderEntryID,HMainInterID" + + ") " + + " values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "'," + HBillStatus + ",getdate(),'" + HMaker + "',getdate()" + + "," + HYear + "," + HPeriod + ",'" + HRemark + "','" + HInnerBillNo + "','" + HSourceName + "'," + HPieceQty + "," + HWasterQty + "," + HPlanPieceQty + "," + HBadPNL + + "," + HICMOInterID + ",'" + HICMOBillNo + "'," + HProcPlanInterID + "," + HProcPlanEntryID + ",'" + HProcPlanBillNo + "'," + HProcExchInterID + "," + HProcExchEntryID + + ",'" + HProcExchBillNo + "'," + HMaterID + "," + HProcID + "," + HICMOQty + "," + HPlanQty + ",getdate()," + HSourceID + + "," + HGroupID + "," + HDeptID + "," + HEmpID + ",'" + HBarCode + "','" + HAddr + "','" + HBarCodeMaker + "',getdate()" + + "," + HSupID + "," + HTaxRate + "," + HQty + "," + HPrice + "," + HMoney + "," + HPrice_BHS + "," + HMoney_BHS + "," + HBadCount + + "," + HMainSourceInterID + ",'" + HMainSourceBillNo + "','" + HMainSourceBillType + "'," + HProcNo + ",'" + HOrderProcNO + "'," + Convert.ToString(HLastSubProc ? 1 : 0) + ",'" + HWWWorkOrderBillNo + "'," + HWWWorkOrderInterID + "," + HWWWorkOrderEntryID + "," + HMainInterID + + ") "); + } + else if ("Modify".Equals(eventType)) + { + oCN.RunProc("exec h_p_Mes_ProcessExchangeRelationQty_Out " + HInterID + ",-1"); + oCN.RunProc("exec h_p_WW_EntrustWorkOrderRelationQty_Out " + HInterID + ",-1"); + //鏇存柊涓昏〃 + oCN.RunProc("UpDate Sc_StationOutBillMain set " + + " HBillNo='" + HBillNo + "'" + + ",HRemark='" + HRemark + "'" + + ",HUpDater='" + HMaker + "'" + + ",HUpDateDate=getdate()" + + ",HInnerBillNo='" + HInnerBillNo + "'" + + ",HSupID=" + HSupID + + ",HQty=" + HQty + + ",HPieceQty=" + HPieceQty + + ",HPrice=" + HPrice + + ",HMoney=" + HMoney + + ",HProcNo=" + HProcNo + + ",HPrice_BHS=" + HPrice_BHS + + ",HMoney_BHS=" + HMoney_BHS + + ",HTaxRate=" + HTaxRate + + ",HOrderProcNO='" + HOrderProcNO + "'" + + ",HMaterID=" + HMaterID + + ",HProcID=" + HProcID + + ",HBadPNL=" + HBadPNL + + ",HWasterQty=" + HWasterQty + + " where HInterID=" + HInterID); + } + else + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鎿嶄綔绫诲瀷鏃犳晥锛�"; + objJsonResult.data = null; + return objJsonResult; + } ds = oCN.RunProcReturn("exec h_p_MES_StationOutBill_QtyCtrl " + HInterID + "", "h_p_MES_StationOutBill_QtyCtrl"); if (ds == null) { @@ -176,18 +308,30 @@ objJsonResult.data = null; return objJsonResult; } - if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) == "2") - { - oCN.RollBack(); - objJsonResult.code = "0"; - objJsonResult.count = 0; - objJsonResult.Message = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]); - objJsonResult.data = null; - return objJsonResult; - } + //if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) == "2") + //{ + // oCN.RollBack(); + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]); + // objJsonResult.data = null; + // return objJsonResult; + //} oCN.RunProc("exec h_p_Mes_ProcessExchangeRelationQty_Out " + HInterID.ToString() + ",1"); oCN.RunProc("exec h_p_WW_EntrustWorkOrderRelationQty_Out " + HInterID.ToString() + ",1"); oCN.Commit(); + string sReturn = ""; + if (oSystemParameter.ShowBill(ref sReturn) == true) + { + if (oSystemParameter.omodel.MES_StationEntrustOutBill_SaveAutoAddnew == "Y") //绯荤粺鍙傛暟 鑷姩瀹℃牳 + { + objJsonResult.Verify = "Y"; + } + else + { + objJsonResult.Verify = "N"; + } + } objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "鏂板鍗曟嵁鎴愬姛锛�"; @@ -196,7 +340,6 @@ } catch (Exception e) { - oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "Exception锛�" + e.ToString(); @@ -205,7 +348,528 @@ } } + //楠岃瘉鍗曟嵁鍙锋槸鍚﹂噸澶� + private bool AllowbillNo(string HBillNo) + { + ds = oCN.RunProcReturn("select HBillNo from Sc_StationOutBillMain where HBillNo = '" + HBillNo + "'", "Sc_StationOutBillMain"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + return true; + } + return false; + } + #endregion - // + #region 缂栬緫椤甸潰鏍规嵁id鑾峰彇濮斿宸ュ簭鎺ユ敹鍗曚俊鎭� + [Route("Cj_StationEntrustOutBill/GetStationEntrustOutBill")] + [HttpGet] + public object GetStationEntrustOutBill(int HInterID) + { + try + { + ds = oCN.RunProcReturn("select * from h_v_GetStationOutBill where HInterID = " + HInterID, "h_v_GetStationOutBill"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "濮斿宸ュ簭鎺ユ敹鍗曚俊鎭幏鍙栧け璐ワ紒"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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 + + #region 鏍规嵁id鍒犻櫎濮斿鎺ユ敹鍗� + [Route("Cj_StationEntrustOutBill/del_StationEntrustOutBill")] + [HttpGet] + public object del_StationEntrustOutBill(long HInterID, string HDeleteMan) + { + try + { + + //缂栬緫鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("MES_StationEntrustOutBill_Delete", 1, true, HDeleteMan)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + DAL.ClsSc_StationEntrustOutBill oBill = new DAL.ClsSc_StationEntrustOutBill(); + if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo)) + { + if (oBill.omodel.HMaker != HDeleteMan && (HDeleteMan != "admin" && HDeleteMan != "Admin")) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍙兘鍒犻櫎鏈汉鐨勫崟鎹紒"; + objJsonResult.data = null; + return objJsonResult; + } + if (oBill.omodel.HChecker != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸茬粡瀹℃牳,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); + DataSet ds; + //鍒ゆ柇鏄惁瀛樺湪 鐩稿悓鍗曟嵁鍙� 鐨勯鏂欏崟 鍒ゆ柇鐢熶骇璁㈠崟鏄惁宸茬粨妗堬紝瑕佹眰璁″垝鎵嬪伐鍙嶇粨妗� + ds = oCn.RunProcReturn("exec h_p_MES_StationOutBill_DelCtrl '" + oBill.omodel.HBillNo + "'", "h_p_MES_StationOutBill_DelCtrl"); + if (ds == null) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒ゆ柇鍏宠仈澶辫触锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (ds.Tables[0].Rows.Count > 0 && Pub_Class.ClsPub.isInt(ds.Tables[0].Rows[0][0]) == 2) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = Pub_Class.ClsPub.isStrNull(ds.Tables[0].Rows[0][1]); + objJsonResult.data = null; + return objJsonResult; + } + + //鍐欏叆鍒犻櫎鏃ュ織 + string WorkList = "鍒犻櫎濮斿鎺ユ敹鍗曪細" + oBill.omodel.HBillNo; + if (!oBill.DeleteBill(oBill.omodel.HInterID, oBill.omodel.HProcExchInterID, oBill.omodel.HProcExchEntryID, ref DBUtility.ClsPub.sExeReturnInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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 = "寮傚父锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 缂栬緫鍓嶅垽鏂� + [Route("Cj_StationEntrustOutBill/set_ShowBillJudge")] + [HttpGet] + public object set_ShowBillJudge(string HBillNo, string CurUserName, long HInterID) + { + try + { + ds = oCN.RunProcReturn("exec h_p_MES_StationOutBill_DelCtrl '" + HBillNo + "'", "h_p_MES_StationOutBill_DelCtrl"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒ゆ柇鍏宠仈澶辫触锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else if (ds.Tables[0].Rows.Count > 0 && Pub_Class.ClsPub.isInt(ds.Tables[0].Rows[0][0]) == 2) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = Pub_Class.ClsPub.isStrNull(ds.Tables[0].Rows[0][1]); + objJsonResult.data = null; + return objJsonResult; + } + + //鍒ゆ柇鏉冮檺 + if (!ClsPub.Security_Log("MES_StationEntrustOutBill_Edit", 1, true, CurUserName)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + ////鍒ゆ柇璇ョ敤鎴峰悕鏄惁鏈夎宸ョ珯鏉冮檺 + //if (BillNew.CheckCenterIDByUser(DBUtility.ClsPub.isLong(66865)) == false) + //{ + // MessageBox.Show("娌℃湁璇ュ伐绔欐潈闄愶紒", "鎻愮ず"); + // return; + //} + ////妫�鏌ユ槸鍚﹀紑绁� + //string d = ""; + //if (BillOld.CheckIsKP(BillOld.omodel.HInterID, ref d) == false) + //{ + // MessageBox.Show(d, "鎻愮ず"); + // return; + //} + string s = ""; + DAL.ClsSc_StationEntrustOutBill BillOld = new DAL.ClsSc_StationEntrustOutBill(); + if (BillOld.ShowBill(HInterID, ref s) == false) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ゅ崟鎹湁閿欒锛�"; + objJsonResult.data = null; + return objJsonResult; + } + //鍒ゆ柇鏄惁鍙紪杈� + if (BillOld.omodel.HChecker != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ゅ崟鎹凡缁忚瀹℃牳锛屼笉鍏佽淇敼锛�"; + objJsonResult.data = null; + return objJsonResult; + } + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = null; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 瀹℃牳 + [Route("Cj_StationEntrustOutBill/set_CheckBill")] + [HttpGet] + public object set_CheckBill(int HInterID, string CurUserName) + { + try + { + //string ModRightNameCheck = "MES_StationEntrustOutBill_Check"; + ////瀹℃牳鏉冮檺 + //if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, true, CurUserName)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�"; + // objJsonResult.data = null; + // return objJsonResult; + //} + if (HInterID == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁ID涓�0锛屼笉鑳藉鏍革紒"; + objJsonResult.data = null; + return objJsonResult; + } + DAL.ClsSc_StationEntrustOutBill oBill = new DAL.ClsSc_StationEntrustOutBill(); + //鏌ョ湅鏄惁宸插鏍�,鍏抽棴,浣滃簾 + if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo)) + { + if (oBill.omodel.HChecker.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘鍐嶆瀹℃牳"; + objJsonResult.data = null; + return objJsonResult; + } + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + //瀹℃牳 + if (Cj_StationEntrustOutBillCheckBill(HInterID, CurUserName, ref DBUtility.ClsPub.sExeReturnInfo)) + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳鎴愬姛!"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + + //瀹℃牳 + public bool Cj_StationEntrustOutBillCheckBill(Int64 lngBillKey, string CurUserName, ref string sReturn) + { + try + { + string HChecker = CurUserName; + string HCheckDate = DBUtility.ClsPub.GetServerDate(-1); + oCN.BeginTran(); + ds = oCN.RunProcReturn("Select * from Sc_StationOutBillMain Where HInterID=" + lngBillKey.ToString(), "Sc_StationOutBillMain"); + if (ds.Tables[0].Rows.Count == 0) + { + sReturn = "鍗曟嵁鏈壘鍒帮紒"; + return false; + } + oCN.RunProc(" Update Sc_StationOutBillMain set HChecker='" + HChecker + "',HCheckDate='" + HCheckDate + "' Where HInterID=" + lngBillKey.ToString()); + oCN.RunProc("exec h_p_Mes_ProcessExchangeRelationQty_Check_Out " + lngBillKey.ToString() + ",1"); + //鍒ゆ柇鏄惁鏄� 鏈亾宸ュ簭 + DataSet ds1; + ds1 = oCN.RunProcReturn(" select HLastProc,HFstProc from Sc_ProcessExchangeBillMain a " + + " inner join Sc_ProcessExchangeBillSub b on a.HInterID=b.HInterID " + + " Where a.HInterID=(Select HProcExchInterID from Sc_StationOutBillMain Where HInterID=" + lngBillKey + ") " + + " and b.HEntryID=(Select HProcExchEntryID from Sc_StationOutBillMain Where HInterID=" + lngBillKey + ")", "Sc_ProcessExchangeBillMain"); + if (ds1 == null || ds1.Tables[0].Rows.Count == 0) + { + } + else if (Pub_Class.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HFstProc"]) == "鏄�") + { + } + sReturn = sReturn + " 瀹℃牳鍔熻兘锛�"; + oCN.Commit(); + return true; + } + catch (Exception e) + { + sReturn = e.Message; + oCN.RollBack(); + return false; ; + } + } + #endregion + + #region 鍙嶅鏍� + [Route("Cj_StationEntrustOutBill/set_AbandonCheck")] + [HttpGet] + public object set_AbandonCheck(int HInterID, string CurUserName) + { + try + { + if (HInterID == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁ID涓�0锛屼笉鑳藉弽瀹℃牳锛�"; + objJsonResult.data = null; + return objJsonResult; + } + DAL.ClsSc_StationEntrustOutBill oBill = new DAL.ClsSc_StationEntrustOutBill(); + //鏌ョ湅鏄惁宸插鏍�,鍏抽棴,浣滃簾 + if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo)) + { + if (oBill.omodel.HChecker.Trim() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶉渶瑕佸弽瀹℃牳!"; + objJsonResult.data = null; + return objJsonResult; + } + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + //鍙嶅鏍� + if (Cj_StationEntrustOutBillAbandonCheckBill(HInterID, CurUserName, ref DBUtility.ClsPub.sExeReturnInfo)) + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅鏍告垚鍔�!"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍙嶅鏍稿け璐ワ紒" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + + //鍙嶅鏍� + public bool Cj_StationEntrustOutBillAbandonCheckBill(Int64 lngBillKey, string CurUserName, ref string sReturn) + { + if (Cj_StationEntrustOutBillisUse(lngBillKey, ref sReturn)) + { + return false; + } + try + { + string HChecker = CurUserName; + string HCheckDate = DBUtility.ClsPub.GetServerDate(-1); + oCN.BeginTran(); + ds = oCN.RunProcReturn("Select * from Sc_StationOutBillMain Where HInterID=" + lngBillKey.ToString(), "Sc_StationOutBillMain"); + if (ds.Tables[0].Rows.Count == 0) + { + sReturn = "鍗曟嵁鏈壘鍒帮紒"; + return false; + } + + oCN.RunProc(" Update Sc_StationOutBillMain set HChecker='',HCheckDate=null Where HInterID=" + lngBillKey.ToString()); + oCN.RunProc("exec h_p_Mes_ProcessExchangeRelationQty_Check_Out " + lngBillKey.ToString() + ",-1"); + //鍒ゆ柇鏄惁鏄� 棣栭亾宸ュ簭 + DataSet ds1; + ds1 = oCN.RunProcReturn("select HLastProc,HFstProc " + + " from Sc_ProcessExchangeBillMain a " + + " inner join Sc_ProcessExchangeBillSub b on a.HInterID=b.HInterID " + + " Where a.HInterID=(Select HProcExchInterID from Sc_StationOutBillMain Where HInterID=" + lngBillKey + ") " + + " and b.HEntryID=(Select HProcExchEntryID from Sc_StationOutBillMain Where HInterID=" + lngBillKey + ")", "Sc_ProcessExchangeBillMain"); + if (ds1 == null || ds1.Tables[0].Rows.Count == 0) + { + } + else if (Pub_Class.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HFstProc"]) == "鏄�") + { + } + sReturn = sReturn + "鍙嶅鏍稿姛鑳斤紒"; + oCN.Commit(); + return true; + } + catch (Exception e) + { + sReturn = e.Message; + oCN.RollBack(); + return false; ; + } + } + + //鏄惁琚叧鑱� + public bool Cj_StationEntrustOutBillisUse(Int64 lngBillKey, ref string sReturn) + { + try + { + //鏌ヨ涓昏〃 + DataSet Ds; + Ds = oCN.RunProcReturn("Select HinterID from Sc_StationOutBillSub Where HInterID=" + lngBillKey.ToString() + " and isnull(HRelationQty,0)<>0 ", "Sc_StationOutBillSub"); + if (Ds.Tables[0].Rows.Count != 0) + { + sReturn = "鍗曟嵁宸茶鍏宠仈,涓嶈兘鎿嶄綔锛�"; + return true; + } + sReturn = ""; + return false; + } + catch (Exception e) + { + sReturn = e.Message; + throw (e); + } + } + #endregion + + //鎵归噺 + #region 鎵归噺濮斿鎺ユ敹妯″潡杩斿洖鏄庣粏淇℃伅鍒楄〃 + [Route("Cj_StationEntrustOutBill/get_BarCodeDetail")] + [HttpGet] + public object get_BarCodeDetail(string HMainInterID) + { + try + { + ds = oCN.RunProcReturn( + "select a.HBillNo,a.HInterID,a.HQty,a.HProcExchBillNo,a.HICMOBillNo" + + ",b.HNumber HMaterNumber,b.HName HMaterName,b.HModel HMaterModel,c.HName HSourceName,d.HName HGroupName" + + ",e.HName HEmpName,a.HMaker,a.HMakeDate " + + " from Sc_StationOutBillMain a " + + " left join Gy_Material b on a.HMaterID = b.HItemID " + + " left join Gy_Source c on a.HSourceID = c.HItemID " + + " left join Gy_Group d on a.HGroupID = d.HItemID " + + " left join Gy_Employee e on a.HEmpID = e.HItemID " + + " where HMainInterID = " + HMainInterID + " order by a.HMakeDate desc", "Sc_StationOutBillMain"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犺繑鍥炶褰曪紒"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "杩斿洖璁板綍鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + 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