From d1b14d00d9ee4ff4a1b271e6b4fe094f5049a55f Mon Sep 17 00:00:00 2001 From: duhe <226547893@qq.com> Date: 星期一, 17 三月 2025 09:23:16 +0800 Subject: [PATCH] 采购入库单:下推采购退料单 --- WebAPI/Controllers/JHGL/Gy_RoutingBillController.cs | 406 +++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 373 insertions(+), 33 deletions(-) diff --git a/WebAPI/Controllers/JHGL/Gy_RoutingBillController.cs b/WebAPI/Controllers/JHGL/Gy_RoutingBillController.cs index 5248988..cdb438b 100644 --- a/WebAPI/Controllers/JHGL/Gy_RoutingBillController.cs +++ b/WebAPI/Controllers/JHGL/Gy_RoutingBillController.cs @@ -282,28 +282,37 @@ else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0) { //淇敼 - //淇敼 - DataSet dss; - dss = oCN.RunProcReturn("select * from Gy_RoutingBillMain where HInterID=" + HInterID + " and HBillNo='" + HBillNo + "'", "Gy_RoutingBillMain"); - //鍒ゆ柇鏄惁鍙紪杈� - if ((dss.Tables[0].Rows[0]["HChecker"].ToString() != "" && dss.Tables[0].Rows[0]["HChecker"] != null) || (dss.Tables[0].Rows[0]["HBillStatus"].ToString() != "1"&& dss.Tables[0].Rows[0]["HBillStatus"].ToString() != "0")) + if (oSystemParameter.omodel.WMS_CampanyName == "涔斾竴") { - objJsonResult.code = "0"; - objJsonResult.count = 0; - objJsonResult.Message = "姝ゅ崟鎹姸鎬佹湭鍦ㄥ垱寤猴紝涓嶅厑璁镐慨鏀癸紒"; - objJsonResult.data = 1; - return objJsonResult; + } - dss = oCN.RunProcReturn("select COUNT(*) as number from Sc_ProcessExchangeBillMain where HRoutingBillID = " + HInterID, "Gy_RoutingBillMain"); - //鍒ゆ柇鏄惁鍙紪杈� - if (dss.Tables[0].Rows[0]["number"].ToString() != "0") + else { - objJsonResult.code = "0"; - objJsonResult.count = 0; - objJsonResult.Message = "姝ゅ崟鎹凡缁忚寮曠敤锛屼笉鍏佽淇敼锛�"; - objJsonResult.data = 1; - return objJsonResult; + //淇敼 + DataSet dss; + dss = oCN.RunProcReturn("select * from Gy_RoutingBillMain where HInterID=" + HInterID + " and HBillNo='" + HBillNo + "'", "Gy_RoutingBillMain"); + //鍒ゆ柇鏄惁鍙紪杈� + if ((dss.Tables[0].Rows[0]["HChecker"].ToString() != "" && dss.Tables[0].Rows[0]["HChecker"] != null) || (dss.Tables[0].Rows[0]["HBillStatus"].ToString() != "1" && dss.Tables[0].Rows[0]["HBillStatus"].ToString() != "0" && dss.Tables[0].Rows[0]["HBillStatus"].ToString() != "5")) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ゅ崟鎹姸鎬佹湭鍦ㄥ垱寤猴紝涓嶅厑璁镐慨鏀癸紒"; + objJsonResult.data = 1; + return objJsonResult; + } + + dss = oCN.RunProcReturn("select COUNT(*) as number from Sc_ProcessExchangeBillMain where HRoutingBillID = " + HInterID, "Gy_RoutingBillMain"); + //鍒ゆ柇鏄惁鍙紪杈� + if (dss.Tables[0].Rows[0]["number"].ToString() != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ゅ崟鎹凡缁忚寮曠敤锛屼笉鍏佽淇敼锛�"; + objJsonResult.data = 1; + return objJsonResult; + } } + oCN.RunProc("update Gy_RoutingBillMain set " + "HDate='" + HDate + @@ -370,14 +379,16 @@ } - - //鏄惁鍕鹃�夐粯璁ゅ伐鑹鸿矾绾� - if (HStandard) + if (oSystemParameter.omodel.WMS_CampanyName == "涔斾竴") { - //璁剧疆榛樿宸ヨ壓璺嚎 - oCN.RunProc("exec h_p_Gy_RoutingBillCheck " + HInterID + ",'" + user + "'"); + //鏄惁鍕鹃�夐粯璁ゅ伐鑹鸿矾绾� + if (HStandard) + { + //璁剧疆榛樿宸ヨ壓璺嚎 + oCN.RunProc("exec h_p_Gy_RoutingBillCheck " + HInterID + ",'" + user + "'"); + } } - + //鍒ゆ柇鏄惁閲嶅宸ュ簭鍙� ds = oCN.RunProcReturn("exec h_p_Gy_RoutingCtrl " + HInterID, "h_p_Gy_RoutingCtrl"); @@ -456,7 +467,7 @@ ",HPackStd,HPack,HPutArea,HMyWorkDays,HMyFixWorkDays,HPassRate" + ",HTechnologyParameter,HPicNum,HProcCheckNote" + ",HOverRate,HProcWorkNum,HBadWHID,HWasterWHID, HWHID,HIsTime,HEstimate " + - ",HWorkTimes_S,HSortProcFlag " + + ",HWorkTimes_S,HSortProcFlag,HSubStdEmpAvg_S" + ") values(" + HInterID + "," + i + "," + oSub.HProcID.ToString() + ",'" + oSub.HProcNo + "'," + oSub.HSupID.ToString() + "," + Convert.ToString(oSub.HSupFlag ? 1 : 0) + "" + "," + oSub.HWorkQty.ToString() + "," + oSub.HCenterID.ToString() + ",'" + oSub.HTimeUnit.ToString() + "'," + oSub.HUnitTime.ToString() + @@ -469,7 +480,7 @@ ",'" + oSub.HPackStd + "','" + oSub.HPack + "','" + oSub.HPutArea + "'," + oSub.HMyWorkDays.ToString() + "," + oSub.HMyFixWorkDays.ToString() + "," + oSub.HPassRate.ToString() + ",'" + oSub.HTechnologyParameter.ToString() + "','" + oSub.HPicNum.ToString() + "','" + oSub.HProcCheckNote.ToString() + "', " + oSub.HOverRate.ToString() + ",'" + oSub.HProcWorkNum.ToString() + "'," + oSub.HBadWHID.ToString() + "," + oSub.HWasterWHID.ToString() + "," + oSub.HWHID.ToString() + "," + Convert.ToString(oSub.HIsTime ? 1 : 0) + "," + oSub.HEstimate.ToString() + - ", " + oSub.HWorkTimes_S.ToString() + "," + Convert.ToString(oSub.HSortProcFlag ? 1 : 0) + + ", " + oSub.HWorkTimes_S.ToString() + "," + Convert.ToString(oSub.HSortProcFlag ? 1 : 0) + "," + oSub.HSubStdEmpAvg_S + ") "); //璁′环鏂瑰紡涓嶄负璁℃椂锛屽垯鎶婅鏃舵殏浼板瓧娈垫洿鏂颁负绌� if (oSub.HIsTime == false) @@ -499,7 +510,7 @@ ",HTechnologyParameter,HPicNum,HProcCheckNote" + ",HOverRate,HProcWorkNum,HBadWHID,HWasterWHID, HWHID,HEstimate,HIsTime" + ",HQCSchemeID_Fst,HQCSchemeID_Proc,HQCSchemeID_Patrol" + - ",HWorkTimes_S,HSortProcFlag,HSNCtrl,HQCFst,HQCProc,HQCPatrol,HMaterToSourceCtrl " + + ",HWorkTimes_S,HSortProcFlag,HSNCtrl,HQCFst,HQCProc,HQCPatrol,HMaterToSourceCtrl,HSubStdEmpAvg_S" + ") values(" + HInterID + "," + i + "," + oSub.HProcID.ToString() + ",'" + oSub.HProcNo + "'," + oSub.HSupID.ToString() + "," + Convert.ToString(oSub.HSupFlag ? 1 : 0) + "" + "," + oSub.HWorkQty.ToString() + "," + oSub.HCenterID.ToString() + ",'" + oSub.HTimeUnit.ToString() + "'," + oSub.HUnitTime.ToString() + @@ -513,7 +524,7 @@ ",'" + oSub.HTechnologyParameter.ToString() + "','" + oSub.HPicNum.ToString() + "','" + oSub.HProcCheckNote.ToString() + "', " + oSub.HOverRate.ToString() + ",'" + oSub.HProcWorkNum.ToString() + "'," + oSub.HBadWHID.ToString() + "," + oSub.HWasterWHID.ToString() + "," + oSub.HWHID.ToString() + "," + oSub.HEstimate.ToString() + "," + Convert.ToString(oSub.HIsTime ? 1 : 0) + "," + oSub.HQCSchemeID_Fst + "," + oSub.HQCSchemeID_Proc + "," + oSub.HQCSchemeID_Patrol + - ", " + oSub.HWorkTimes_S.ToString() + "," + Convert.ToString(oSub.HSortProcFlag ? 1 : 0) + "," + Convert.ToString(oSub.HSNCtrl ? 1 : 0) + "," + Convert.ToString(oSub.HQCFst ? 1 : 0) + "," + Convert.ToString(oSub.HQCProc ? 1 : 0) + "," + Convert.ToString(oSub.HQCPatrol ? 1 : 0) + "," + Convert.ToString(oSub.HMaterToSourceCtrl ? 1 : 0) + + ", " + oSub.HWorkTimes_S.ToString() + "," + Convert.ToString(oSub.HSortProcFlag ? 1 : 0) + "," + Convert.ToString(oSub.HSNCtrl ? 1 : 0) + "," + Convert.ToString(oSub.HQCFst ? 1 : 0) + "," + Convert.ToString(oSub.HQCProc ? 1 : 0) + "," + Convert.ToString(oSub.HQCPatrol ? 1 : 0) + "," + Convert.ToString(oSub.HMaterToSourceCtrl ? 1 : 0) + "," + oSub.HSubStdEmpAvg_S + ") "); //璁′环鏂瑰紡涓嶄负璁℃椂锛屽垯鎶婅鏃舵殏浼板瓧娈垫洿鏂颁负绌� if (oSub.HIsTime == false) @@ -558,6 +569,107 @@ return objJsonResult; } + //宸ヨ壓璺嚎瀛欒〃 鏂板 + [Route("Gy_RoutingBillSub/AddWorkQty")] + [HttpPost] + public object AddWorkQty([FromBody] JObject sMainSub) + { + try + { + var _value = sMainSub["sMainSub"].ToString(); + string msg1 = _value.ToString(); + + string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); + string msg2 = sArray[0].ToString(); + string user = sArray[1].ToString(); + + //鍒ゆ柇鏄惁鏈夌紪杈戞潈闄� + if (!DBUtility.ClsPub.Security_Log("Gy_RoutingBill_Edit", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "宸ヨ壓璺嚎鏃犳潈闄愮紪杈�!"; + objJsonResult.data = null; + return objJsonResult; + } + + List<Gy_RoutingBillSub_WorkQty> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Gy_RoutingBillSub_WorkQty>>(msg2); + int i = 0; + + oCN.BeginTran();//寮�濮嬩簨鐗� + + foreach (Gy_RoutingBillSub_WorkQty oSub in DetailColl) + { + i++; + + if (i == 1) + { + //鍏堝垹闄ゅ巻鍙茬粦瀹氭暟鎹悗鍦ㄩ噸鏂颁繚瀛� + oCN.RunProc("delete from Gy_RoutingBillSub_WorkQty where HInterID = " + oSub.HInterID + " and HEntryID = " + oSub.HEntryID); + }; + + oCN.RunProc($"insert into Gy_RoutingBillSub_WorkQty" + + $"(HInterID,HEntryID,HEntrySubID,HSourceID,HWorkQty_Source,HEntryStdEmpQty,HEntryStdEmpAvg,HSortNum,HRemark)" + + $"values({oSub.HInterID},{oSub.HEntryID},{i},{oSub.HSourceID},{oSub.HWorkQty_Source},{oSub.HEntryStdEmpQty}" + + $",{oSub.HEntryStdEmpAvg},{oSub.HSortNum},'{oSub.HRemark}')"); + } + + oCN.Commit();//鎻愪氦浜嬬墿 + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; + + } + catch (Exception e) + { + oCN.RollBack();//鍥炴粴浜嬬墿 + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 宸ヨ壓璺嚎瀛欒〃缂栬緫鑾峰彇鏁版嵁 + [Route("Gy_RoutingBill/EditWorkQty")] + [HttpGet] + public object EditWorkQty(long HInterID,long HEntryID) + { + try + { + + ds = oCN.RunProcReturn($"select * from h_v_Gy_RoutingBillSub_WorkQtyEdit where hmainid={HInterID} and hsubid={HEntryID} order by HEntrySubID asc", "h_v_Gy_RoutingBillSub_WorkQtyEdit"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + 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 涓存椂瀹氶鎶ヨ〃 @@ -1278,7 +1390,7 @@ if (oSystemParameter.omodel.WMS_CampanyName == "娣诲悍绉戞妧") //绯荤粺鍙傛暟 { //鍒锋柊榛樿宸ヨ壓璺嚎 - oCN.RunProc("exec h_p_Gy_RoutingBillCheck " + HInterID); + oCN.RunProc("exec h_p_Gy_RoutingBillCheck " + HInterID + ",'" + CurUserName + "'"); } } @@ -1339,6 +1451,16 @@ var ds = oCN.RunProcReturn("select * from Gy_RoutingBillMain where HInterID=" + HInterID, "Gy_RoutingBillMain"); if (ds.Tables[0].Rows.Count > 0) { + string HBillStatus = Convert.ToString(ds.Tables[0].Rows[0]["HBillStatus"]); + //string hdeleteman = Convert.ToString(ds.Tables[0].Rows[0]["hdeleteman"]); + if (HBillStatus == "6") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鍦ㄥ鏍镐腑,涓嶈兘鍏抽棴锛�"; + objJsonResult.data = null; + return objJsonResult; + } if (IsAudit == 0) //鍏抽棴鍒ゆ柇 { if (ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "") @@ -1567,7 +1689,7 @@ " LEFT JOIN Gy_RoutingBillMain as po ON a.hmainid = po.HInterID" + " LEFT JOIN Xt_CheckItem as i ON i.HItemID = c.HCheckItemID" + " LEFT JOIN Xt_CheckUserRight as cr ON cr.HCheckItemID = i.HItemID and cr.HCheckFlowInterID = m.HInterID" + - " where po.HBillStatus = 6 and po.HCheckItemNowID = i.HItemID and cr.HUserID = '" + userid + "'"; + " where 宸ュ簭浠g爜 != '9999' and a.HBillSubType<>'SUB' and po.HBillStatus = 6 and po.HCheckItemNowID = i.HItemID and cr.HUserID = '" + userid + "'"; ds = oCN.RunProcReturn(sql, "h_v_Gy_RoutingBillList"); foreach (DataColumn col in ds.Tables[0].Columns) { @@ -1614,10 +1736,11 @@ return objJsonResult; } //鎼滅储闇�瑕佸鏍哥殑 - string sql = " select DISTINCT a.*,c.HItemID as HCheckFlowStatusID,m.HName as 瀹℃壒娴�,c.HCheckFlowID,i.HName as 瀹℃壒椤圭洰鍚嶇О,c.HCheckItemID,c.HChecker as 椤圭洰瀹℃牳浜�,c.HCheckNote as 瀹℃壒娴佸鏍稿缓璁�,c.HCheckDate 瀹℃壒娴佸鏍告棩鏈� from h_v_Gy_RoutingBillList AS a LEFT JOIN Xt_BillCheckFlowStatus AS c ON a.hmainid = c.HBillInterID and a.鍗曟嵁绫诲瀷 = c.HBillTypeID" + + string sql = "select TOP 1000 a.*,c.HItemID as HCheckFlowStatusID,m.HName as 瀹℃壒娴�,c.HCheckFlowID,i.HName as 瀹℃壒椤圭洰鍚嶇О,c.HCheckItemID,c.HChecker as 椤圭洰瀹℃牳浜�,c.HCheckNote as 瀹℃壒娴佸鏍稿缓璁�,c.HCheckDate 瀹℃壒娴佸鏍告棩鏈� from h_v_Gy_RoutingBillList AS a LEFT JOIN Xt_BillCheckFlowStatus AS c ON a.hmainid = c.HBillInterID and a.鍗曟嵁绫诲瀷 = c.HBillTypeID" + " LEFT JOIN Xt_CheckFlowMain as m ON m.HInterID = c.HCheckFlowID" + " LEFT JOIN Xt_CheckItem as i ON i.HItemID = c.HCheckItemID" + - " where c.HCheckDate is not NUll and c.HChecker = '" + user + "'"; + " where 宸ュ簭浠g爜 != '9999' and a.HBillSubType<>'SUB' and c.HCheckDate is not NUll and c.HChecker = '" + user + "'"+ + " ORDER BY a.hmainid DESC;"; ds = oCN.RunProcReturn(sql, "h_v_Gy_RoutingBillList"); foreach (DataColumn col in ds.Tables[0].Columns) { @@ -2037,6 +2160,17 @@ objJsonResult.count = CountConstant.SUCCEED; objJsonResult.Message = "瀹℃牳鎴愬姛"; objJsonResult.data = null; + //鑾峰彇绯荤粺鍙傛暟 + string Ret = ""; + if (oSystemParameter.ShowBill(ref Ret)) + { + //鍒ゆ柇瀹㈡埛 + if (oSystemParameter.omodel.WMS_CampanyName == "娣诲悍绉戞妧") //绯荤粺鍙傛暟 + { + //鍒锋柊榛樿宸ヨ壓璺嚎 + oCN.RunProc("exec h_p_Gy_RoutingBillCheck " + HInterID + ",'" + CurUserName + "'"); + } + } } else { @@ -2292,7 +2426,7 @@ return objJsonResult; } SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); - ds = oCN.RunProcReturn("select * from h_v_Gy_RoutingBillList where 瀹氶绫诲瀷 = '涓存椂瀹氶' and 澶辨晥鏃堕棿 BETWEEN NOW() - INTERVAL 15 DAY AND NOW() " + sWhere + " order by hmainid desc", "h_v_Gy_RoutingBillList"); + ds = oCN.RunProcReturn("select * from h_v_Gy_RoutingBillList where 瀹氶绫诲瀷 = '涓存椂瀹氶' and 鐘舵��!= '鍏抽棴' and 澶辨晥鏃堕棿 BETWEEN CAST(GETDATE() AS DATE) AND DATEADD(DAY, 15, GETDATE()) " + sWhere + " order by hmainid desc", "h_v_Gy_RoutingBillList"); foreach (DataColumn col in ds.Tables[0].Columns) { Type dataType = col.DataType; @@ -2320,5 +2454,211 @@ } #endregion + + #region 宸ヨ壓璺嚎(闆嗕綋) 鎵归噺澶氱骇瀹℃牳 + [Route("Gy_Routing/CheckAllFlow")] + [HttpGet] + public object CheckAll(string HInterIDS, int IsAudit, string CurUserName, string CurUserID) + { + try + { + //澶勭悊瀛楃涓� + if (!string.IsNullOrEmpty(HInterIDS)) + { + int[] idArray = Array.ConvertAll(HInterIDS.Split(','), int.Parse); + // 澶勭悊idArray... + for (int i = 0; i < idArray.Length; i++) + { + objJsonResult = (json)AuditGy_Routing_Flow(idArray[i], IsAudit, CurUserName, CurUserID);//瀹℃牳鎵ц + if (objJsonResult.count == 0) + { + objJsonResult.Message += "绗�" + (i + 1) + "琛屽嚭鐜伴棶棰樻棤娉曠户缁畬鎴�"; + return objJsonResult; + } + } + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "璇烽�夋嫨姝g‘琛�"; + objJsonResult.data = null; + return objJsonResult; + } + + objJsonResult.code = CodeConstant.SUCCEED; + objJsonResult.count = CountConstant.SUCCEED; + objJsonResult.Message = "鎵ц鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; + } + catch (Exception e) + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳鎴栧弽瀹℃牳宸ヨ壓璺嚎澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 宸ヨ壓璺嚎 鎵归噺椹冲洖 + [Route("Gy_Routing/RejectAllCheckFlow")] + [HttpGet] + public object RejectAllCheckFlow(string HInterIDS,string CurUserID) + { + try + { + //澶勭悊瀛楃涓� + if (!string.IsNullOrEmpty(HInterIDS)) + { + int[] idArray = Array.ConvertAll(HInterIDS.Split(','), int.Parse); + // 澶勭悊idArray... + for (int i = 0; i < idArray.Length; i++) + { + objJsonResult = (json)RejectCheckFlow(idArray[i].ToString(),CurUserID);//瀹℃牳鎵ц + if (objJsonResult.count == 0) + { + objJsonResult.Message += "绗�" + (i + 1) + "琛屽嚭鐜伴棶棰樻棤娉曠户缁畬鎴�"; + return objJsonResult; + } + } + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "璇烽�夋嫨姝g‘琛�"; + objJsonResult.data = null; + return objJsonResult; + } + + objJsonResult.code = CodeConstant.SUCCEED; + objJsonResult.count = CountConstant.SUCCEED; + 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("Gy_Routing/WithdrawCheckFlow")] + [HttpGet] + public object WithdrawCheckFlow(string HInterID, string user) + { + try + { + Int64 lngBillKey = 0; + lngBillKey = DBUtility.ClsPub.isLong(HInterID); //瀵笻InterID杩涜绫诲瀷鐨勮浆鎹� + DAL.ClsGy_RoutingBill oBill = new DAL.ClsGy_RoutingBill(); //瀹炰緥鍖栧崟鎹搷浣滅被锛岀敤浜庤繘琛岀浉鍏虫搷浣� + //鑾峰彇绯荤粺鍙傛暟鍒ゆ柇宸ヨ壓璺嚎鏄惁鍚敤澶氱骇瀹℃壒绂佺敤 + Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); + string sReturn = ""; + if (oSystemParameter.ShowBill(ref sReturn) == true) + { + if (oSystemParameter.omodel.Gy_RoutingBill_EnableMultiLevel.ToUpper() == "N") //绯荤粺鍙傛暟 鏈惎鐢ㄨ嚜鍔ㄥ鏍� + { + objJsonResult.code = CodeConstant.FAIL; + objJsonResult.count = CountConstant.FAIL; + objJsonResult.Message = "宸ヨ壓璺嚎鏈惎鐢ㄥ绾у鎵圭鐢�"; + objJsonResult.data = null; + return objJsonResult; + } + } + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //鏍规嵁HInterID鑾峰彇璇ュ崟鎹殑鏁版嵁 + { + if (oBill.omodel.HBillStatus != 6) + { + objJsonResult.code = CodeConstant.FAIL; + objJsonResult.count = CountConstant.FAIL; + objJsonResult.Message = "鍗曟嵁鏈湪瀹℃牳涓笉鑳芥挙鍥�"; + objJsonResult.data = null; + return objJsonResult; + } + //鍒ゆ柇鏄惁鏈夌紪杈戞潈闄� + if (!DBUtility.ClsPub.Security_Log("Gy_RoutingBill_Edit", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "宸ヨ壓璺嚎鏃犳潈闄愭挙鍥�!"; + objJsonResult.data = null; + return objJsonResult; + } + } + else + { + objJsonResult.code = CodeConstant.FAIL; + objJsonResult.count = CountConstant.FAIL; + objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + //鍒ゆ柇鏄惁瀛樺湪瀹℃牳杩囩殑椤圭洰 + string sql0 = "select * from Xt_BillCheckFlowStatus where HBillInterID = " + lngBillKey + " and HBillTypeID = '" + oBill.BillType + "' and ISNULL(HChecker,'') <> ''"; + DataSet ds0 = oCN.RunProcReturn(sql0, "Xt_BillCheckFlowStatus"); + if (ds0 != null && ds0.Tables[0].Rows.Count == 0) + { + oCN.BeginTran(); + //鑾峰彇闇�瑕侀┏鍥炵殑瀹℃牳椤圭洰 + string sql1 = "select c.* from Xt_CheckFlowMain as a " + + "inner join Xt_CheckFlowSub as b on a.HInterID = b.HInterID " + + "inner join Xt_BillCheckFlowStatus as c on a.HBillTypeID = c.HBillTypeID and b.HCheckItemID = c.HCheckItemID " + + "where c.HBillTypeID = '" + this.BillType + "' and c.HBillInterID = " + lngBillKey + " " + + "order by b.HFlowNo asc"; + DataSet ds1= oCN.RunProcReturn(sql1, "Xt_BillCheckFlowStatus"); + if (ds1 == null || ds1.Tables[0].Rows.Count == 0) + { + sReturn = "鎾ゅ洖澶辫触!鍘熷洜:鏈彂璧峰鎵癸紒锛�"; + return false; + } + //鑾峰彇褰撳墠瀹℃牳椤圭洰 + string HCheckFlowID = ds1.Tables[0].Rows[0]["HCheckFlowID"].ToString(); //瀹℃壒娴佸唴鐮� + sql0 = "select * from Gy_RoutingBillMain " + " where HInterID = " + lngBillKey; + ds0 = oCN.RunProcReturn(sql0, "Gy_RoutingBillMain"); + string HCheckItemNowID = ds0.Tables[0].Rows[0]["HCheckItemNowID"].ToString(); //褰撳墠瀹℃壒椤圭洰鍐呯爜 + //鏇存柊 椹冲洖鍒犻櫎瀹℃牳娴佺姸鎬佽〃 + string sql02 = "Delete Xt_BillCheckFlowStatus where HBillTypeID = '" + this.BillType + "' and HBillInterID=" + lngBillKey + " and HCheckFlowID=" + HCheckFlowID; + oCN.RunProc(sql02); + oCN.RunProc(" Update Gy_RoutingBillMain" + " set HChecker='',HCheckDate=null,HBillStatus=1,HCheckItemNowID = 0,HCheckItemNextID = 0 Where HInterID=" + lngBillKey.ToString()); + oCN.Commit(); + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鎾ゅ洖鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; ; + } + else + { + objJsonResult.code = CodeConstant.FAIL; + objJsonResult.count = CountConstant.FAIL; + objJsonResult.Message = "鎾ゅ洖澶辫触!鍘熷洜:鍗曟嵁瀛樺湪宸茬粡瀹℃牳鐨勯」鐩紒锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + } + catch (Exception e) + { + oCN.RollBack(); + objJsonResult.code = CodeConstant.FAIL; + objJsonResult.count = CountConstant.FAIL; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + } } \ No newline at end of file -- Gitblit v1.9.1