| | |
| | | using System.Web; |
| | | using System.Web.Http; |
| | | using WebAPI.Models; |
| | | using Newtonsoft.Json.Linq; |
| | | using Model; |
| | | using DBUtility; |
| | | |
| | | namespace WebAPI.Controllers.ä»å管ç.颿åè´§ |
| | | { |
| | |
| | | private json objJsonResult = new json(); |
| | | public DataSet ds = new DataSet(); |
| | | public SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | public DAL.ClsKf_StepFoldOutBill BillOld = new DAL.ClsKf_StepFoldOutBill(); |
| | | |
| | | #region 忥å¼è°åºå æ¥è¯¢ |
| | | #region 忥å¼è°åºå è¿åå表 |
| | | |
| | | [Route("Kf_StepFoldOutBill/GetStepFoldOutBillList")] |
| | | [HttpGet] |
| | | public object GetStepFoldOutBillList(string sWhere, string user, string Organization) |
| | | //public object GetStepFoldOutBillList(string sWhere, string user, string Organization) |
| | | //{ |
| | | // try |
| | | // { |
| | | // //夿æ¯å¦ææ¥è¯¢æé |
| | | // if (!DBUtility.ClsPub.Security_Log("Kf_MoveStockStepOutBillQuery", 1, false, user)) |
| | | // { |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = "æ æ¥è¯¢æé!"; |
| | | // objJsonResult.data = null; |
| | | // return objJsonResult; |
| | | // } |
| | | |
| | | // string sql1 = string.Format("select * from h_v_IF_StepFoldOutBillList where (è°å
¥ç»ç»='" + Organization + "')"); |
| | | // if (sWhere == null || sWhere.Equals("")) |
| | | // { |
| | | // ds = oCn.RunProcReturn(sql1 + " order by hmainid desc", "h_v_IF_StepFoldOutBillList"); |
| | | // } |
| | | // else |
| | | // { |
| | | // string sql = sql1 + sWhere + " order by hmainid desc"; |
| | | // ds = oCn.RunProcReturn(sql, "h_v_IF_StepFoldOutBillList"); |
| | | // } |
| | | |
| | | // //if (ds.Tables[0].Rows.Count != 0 || ds != null) |
| | | // //{ |
| | | // objJsonResult.code = "1"; |
| | | // objJsonResult.count = 1; |
| | | // objJsonResult.Message = "Sucessï¼"; |
| | | // objJsonResult.data = ds.Tables[0]; |
| | | // return objJsonResult; |
| | | // //} |
| | | // //else |
| | | // //{ |
| | | // //objJsonResult.code = "0"; |
| | | // //objJsonResult.count = 0; |
| | | // //objJsonResult.Message = "æ æ°æ®"; |
| | | // //objJsonResult.data = null; |
| | | // //return objJsonResult; |
| | | // //} |
| | | // } |
| | | // catch (Exception ex) |
| | | // { |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = "没æè¿åä»»ä½è®°å½ï¼" + ex.ToString(); |
| | | // objJsonResult.data = null; |
| | | // return objJsonResult; |
| | | // } |
| | | //} |
| | | public object list(string sWhere) |
| | | { |
| | | try |
| | | { |
| | | //夿æ¯å¦ææ¥è¯¢æé |
| | | if (!DBUtility.ClsPub.Security_Log("Kf_MoveStockStepOutBillQuery", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ æ¥è¯¢æé!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | string sql1 = string.Format("select * from h_v_Kf_MoveStockStepOutBillList where (è°å
¥ç»ç»='" + Organization + "')"); |
| | | if (sWhere == null || sWhere.Equals("")) |
| | | { |
| | | ds = oCn.RunProcReturn(sql1 + " order by hmainid desc", "h_v_Kf_MoveStockStepOutBillList"); |
| | | ds = oCn.RunProcReturn("select * from h_v_IF_StepFoldOutBillList order by hmainid desc", "h_v_IF_StepFoldOutBillList"); |
| | | } |
| | | else |
| | | { |
| | | string sql1 = "select * from h_v_IF_StepFoldOutBillList where 1 = 1 "; |
| | | string sql = sql1 + sWhere + " order by hmainid desc"; |
| | | ds = oCn.RunProcReturn(sql, "h_v_Kf_MoveStockStepOutBillList"); |
| | | ds = oCn.RunProcReturn(sql, "h_v_IF_StepFoldOutBillList"); |
| | | } |
| | | |
| | | //if (ds.Tables[0].Rows.Count != 0 || ds != null) |
| | |
| | | //return objJsonResult; |
| | | //} |
| | | } |
| | | catch (Exception ex) |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "没æè¿åä»»ä½è®°å½ï¼" + ex.ToString(); |
| | | objJsonResult.Message = "Exceptionï¼" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 忥å¼è°åºå æ¥è¯¢ |
| | | [Route("Kf_StepFoldOutBill/cx")] |
| | | [HttpGet] |
| | | public object cx(long HInterID) |
| | | { |
| | | try |
| | | { |
| | | |
| | | ds = oCn.RunProcReturn("select * from h_v_IF_StepFoldOutBillList where hmainid =" + HInterID, "h_v_IF_StepFoldOutBillList"); |
| | | 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 忥å¼è°åºå ä¿å/ç¼è¾åè½ |
| | | [Route("Kf_StepFoldOutBill/Kf_StepFoldOutBillEdit")] |
| | | [HttpPost] |
| | | public object StepFoldOutBillEdit([FromBody] JObject sMainSub) |
| | | { |
| | | try |
| | | { |
| | | var _value = sMainSub["sMainSub"].ToString(); |
| | | string msg1 = _value.ToString(); |
| | | oCn.BeginTran(); |
| | | //ä¿å主表 |
| | | objJsonResult = AddBillMain(msg1); |
| | | if (objJsonResult.code == "0") |
| | | { |
| | | oCn.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = objJsonResult.Message; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | 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 = "ä¿å失败ï¼" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | public json AddBillMain(string msg1) |
| | | { |
| | | string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); |
| | | string msg2 = sArray[0].ToString(); //ä¸»è¡¨æ°æ® |
| | | string msg3 = sArray[1].ToString(); //åè¡¨æ°æ® |
| | | int OperationType = int.Parse(sArray[2].ToString()); // æ°æ®ç±»å 1æ·»å 3ä¿®æ¹ |
| | | string user = sArray[3].ToString(); |
| | | string msg_allVal = sArray[4].ToString(); //主表+åè¡¨æææ°æ® |
| | | |
| | | try |
| | | { |
| | | msg2 = "[" + msg2.ToString() + "]"; |
| | | List<ClsKf_StepFoldOutBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsKf_StepFoldOutBillMain>>(msg2); |
| | | |
| | | long HInterID = mainList[0].HInterID;//éå
¥typeå¾å°çåæ®ID |
| | | string HBillNo = mainList[0].HBillNo;//éå
¥typeå¾å°çåæ®å· |
| | | long HPRDORGID = mainList[0].HPRDORGID;//ç»ç» |
| | | DateTime HDate = mainList[0].HDate;//æ¥æ |
| | | string HRemark = mainList[0].HRemark;//夿³¨ |
| | | long HSupID = mainList[0].HSupID;//ä¾åºå |
| | | long HEmpID = mainList[0].HEmpID;//ä»ç®¡å |
| | | long HDeptID = mainList[0].HDeptID;//é¨é¨ |
| | | long HWHID = mainList[0].HWHID;//è°å
¥ä»åº |
| | | long HSCWHID = mainList[0].HSCWHID;//è°åºä»åº |
| | | long HManagerID = mainList[0].HManagerID;//è´è´£äºº |
| | | long HSecManagerID = mainList[0].HSecManagerID;//éªæ¶å |
| | | long HKeeperID = mainList[0].HKeeperID;//ä¿ç®¡å |
| | | string HMaker = user;//å¶å人 |
| | | string HExplanation = mainList[0].HExplanation;//æè¦ |
| | | string HInnerBillNo = mainList[0].HInnerBillNo;//å
é¨åæ®å· |
| | | |
| | | string HBillType = mainList[0].HBillType; |
| | | string HBillSubType = mainList[0].HBillSubType; |
| | | long HBillStatus = mainList[0].HBillStatus; |
| | | string HMakeDate = mainList[0].HMakeDate; |
| | | string HChecker = mainList[0].HChecker; |
| | | string HCheckDate = mainList[0].HCheckDate; |
| | | string HUpDater = mainList[0].HUpDater; |
| | | string HUpDateDate = mainList[0].HUpDateDate; |
| | | string HDeleteMan = mainList[0].HDeleteMan; |
| | | string HDeleteDate = mainList[0].HDeleteDate; |
| | | string HCloseMan = mainList[0].HCloseMan; |
| | | string HCloseDate = mainList[0].HCloseDate; |
| | | long HCurID = mainList[0].HCurID; |
| | | |
| | | ds = oCn.RunProcReturn("select * from h_v_IF_StepFoldOutBillList where hmainid=" + HInterID + " and åæ®å·='" + HBillNo + "'", "h_v_IF_StepFoldOutBillList"); |
| | | |
| | | if ((OperationType == 1 || OperationType == 2) && ds.Tables[0].Rows.Count == 0)//æ°å¢ |
| | | { |
| | | //主表 |
| | | oCn.RunProc(@"Insert Into Kf_ICStockBillMain |
| | | (HInterID,HBillNo,HDate,HBillType,HBillSubType,HBillStatus,HYear,HPeriod |
| | | ,HSupID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID,HKeeperID,HDeptID |
| | | ,HMaker,HMakeDate,HChecker,HUpDater |
| | | ,HDeleteMan,HCloseMan |
| | | ,HRemark,HExplanation,HInnerBillNo,HCurID) |
| | | values(" + HInterID + ",'" + HBillNo + "','" + HDate + "','" + 1250 + "','" + |
| | | HBillSubType + "'," + HBillStatus + "," + DateTime.Now.Year + "," + DateTime.Now.Month + "," + HSupID + |
| | | "," + HWHID + "," + HSCWHID + "," + HEmpID + "," + HManagerID + "," + HSecManagerID + |
| | | "," + HKeeperID + "," + HDeptID + ",'" + HMaker + "','" + HMakeDate + "','" + HChecker + "','" + HUpDater + "','" + HDeleteMan + "','" + HCloseMan + "','" |
| | | + HRemark + "','" + HExplanation + "','" + HInnerBillNo + "'," + HCurID + "" + ")"); |
| | | } |
| | | else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0) |
| | | { //ä¿®æ¹ |
| | | String sql="update Kf_ICStockBillMain set " + |
| | | "HRemark='" + HRemark + "', HUpDater='" + HMaker + "', HUpDateDate=getdate()" + " where HInterID=" + "HInterID"; |
| | | |
| | | oCn.RunProc(sql); |
| | | //å é¤å表 |
| | | oCn.RunProc("delete from Kf_ICStockBillSub where HInterID='" + HInterID + "'"); |
| | | } |
| | | //ä¿åå表 |
| | | objJsonResult = AddBillSub(msg3, HInterID, OperationType); |
| | | |
| | | if (objJsonResult.code == "0") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = objJsonResult.Message; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = null; |
| | | 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 json AddBillSub(string msg3, long HInterID, int OperationType) |
| | | { |
| | | List<ClsKf_StepFoldOutBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsKf_StepFoldOutBillSub>>(msg3); |
| | | |
| | | int i = 0; |
| | | foreach (ClsKf_StepFoldOutBillSub oSub in DetailColl) |
| | | { |
| | | i++; |
| | | if (oSub.HQty <= 0 || oSub.HQty == null) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "第" + i + "è¡ï¼æ°éä¸è½ä¸º0æè
å°äº0"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (oSub.HMaterID == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "第" + i + "è¡ï¼ç©æä¸è½ä¸ºç©º"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | |
| | | if (oSub.HUnitID == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "第" + i + "è¡ï¼è®¡éåä½ä¸è½ä¸ºç©º"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | DataSet Cs; |
| | | Int64 NewHEntryID = 1; |
| | | Cs = oCn.RunProcReturn("select MAX(HEntryID)HEntryID from Kf_ICStockBillSub", "Kf_ICStockBillSub"); |
| | | if (Cs.Tables[0].Rows.Count != 0 && ClsPub.isLong(Cs.Tables[0].Rows[0]["HEntryID"].ToString()) != 0) |
| | | { |
| | | NewHEntryID = ClsPub.isLong(Cs.Tables[0].Rows[0]["HEntryID"].ToString()); |
| | | NewHEntryID += 1; |
| | | } |
| | | |
| | | oCn.RunProc($@"Insert into Kf_ICStockBillSub |
| | | (HInterID,HEntryID,HRemark |
| | | ,HMaterID,HUnitID,HSecUnitID,HPropertyID,HBatchNo |
| | | ,HWHID,HSCWHID,HSPID,HSCSPID |
| | | ,HQtyMust,HQty,HRelationQty,HRelationMoney,HSecUnitRate,HPrice,HMoney,HOrderPrice |
| | | ,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType |
| | | ,HPOOrderInterID,HPOOrderEntryID,HPOOrderBillNo,HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo) |
| | | values({HInterID},{NewHEntryID},'{oSub.HRemark}' |
| | | ,{oSub.HMaterID},{oSub.HUnitID},{oSub.HSecUnitID},{oSub.HPropertyID},'{oSub.HBatchNo}',{oSub.HWHID},{oSub.HSCWHID} |
| | | ,{oSub.HSPID},{oSub.HSCSPID},{oSub.HQtyMust},{(oSub.HQty == null ? 0 : oSub.HQty)},{oSub.HRelationQty},{oSub.HRelationMoney},{oSub.HSecUnitRate} |
| | | ,{oSub.HPrice},{oSub.HMoney},{oSub.HOrderPrice} |
| | | ,{oSub.HSourceInterID},{oSub.HSourceEntryID},'{oSub.HSourceBillNo}','{oSub.HSourceBillType}',{oSub.HPOOrderInterID},{oSub.HPOOrderEntryID} |
| | | ,'{oSub.HPOOrderBillNo}',{oSub.HSeOrderInterID},{oSub.HSeOrderEntryID},'{oSub.HSeOrderBillNo}')"); |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = null; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 忥å¼è°åºå å é¤åè½ |
| | | [Route("Fb_StepFoldOutBill/DeltetFb_StepFoldOutBill")] |
| | | [HttpGet] |
| | | public object DeltetFb_StepFoldOutBill(string HInterID) |
| | | { |
| | | try |
| | | { |
| | | oCn.BeginTran(); |
| | | oCn.RunProc("Delete From Kf_ICStockBillMain where HInterID = " + HInterID); |
| | | oCn.RunProc("Delete From Kf_ICStockBillSub where HInterID = " + HInterID); |
| | | 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 忥å¼è°åºå å®¡æ ¸/åå®¡æ ¸ |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="HInterID">忮ID</param> |
| | | /// <param name="IsAudit">å®¡æ ¸(0),åå®¡æ ¸(1)</param> |
| | | /// <param name="CurUserName">å®¡æ ¸äºº</param> |
| | | /// <returns></returns> |
| | | [Route("Kf_StepFoldOutBill/AuditKf_StepFoldOutBill")] |
| | | [HttpGet] |
| | | public object AuditKf_StepFoldOutBill(string HInterID, int Type, string user) |
| | | { |
| | | string sql = ""; |
| | | //ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); |
| | | try |
| | | { |
| | | //夿æ¯å¦æå®¡æ ¸æé |
| | | if (!DBUtility.ClsPub.Security_Log("Kf_MoveStockStepOutBill_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; |
| | | BillOld.MvarItemKey = "Kf_ICStockBillMain"; |
| | | |
| | | |
| | | ds = oCn.RunProcReturn("select * from Kf_ICStockBillMain where HInterID = " + int.Parse(HInterID), "Kf_ICStockBillMain"); |
| | | string HBillNo = ""; |
| | | oCn.BeginTran();//å¼å§äºå¡ |
| | | |
| | | if (ds == null || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "åæ®ä¸åå¨ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | //Type 1 å®¡æ ¸ 2 åå®¡æ ¸ |
| | | if (Type == 1) |
| | | { |
| | | //å®¡æ ¸åæ§å¶ |
| | | sql = "exec h_p_Cg_POInStockBill_BeforeCheckCtrl " + int.Parse(HInterID) + ",'" + HBillNo + "','" + user + "'"; |
| | | ds = oCn.RunProcReturn(sql, "h_p_Cg_POInStockBill_BeforeCheckCtrl"); |
| | | 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]["HRemark"].ToString(); ; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (!BillOld.CheckBill(int.Parse(HInterID), HBillNo, "h_p_Cg_POInStockBill_AfterCheckCtrl", user, ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "å®¡æ ¸å¤±è´¥!åå :" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //åå®¡æ ¸åæ§å¶ |
| | | sql = "exec h_p_Cg_POInStockBill_BeforeUnCheckCtrl " + int.Parse(HInterID) + ",'" + HBillNo + "','" + user + "'"; |
| | | ds = oCn.RunProcReturn(sql, "h_p_Cg_POInStockBill_BeforeUnCheckCtrl"); |
| | | 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]["HRemark"].ToString(); ; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (BillOld.AbandonCheck(int.Parse(HInterID), HBillNo, "h_p_Cg_POInStockBill_AfterUnCheckCtrl", user, ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "å®¡æ ¸å¤±è´¥!åå :" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | 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("Kf_StepFoldOutBill/CloseKf_StepFoldOutBill")] |
| | | [HttpGet] |
| | | public object CloseKf_StepFoldOutBill(string HInterID, int Type, string user) |
| | | { |
| | | try |
| | | { |
| | | //夿æ¯å¦æå 餿é |
| | | if (!DBUtility.ClsPub.Security_Log("Kf_MoveStockStepOutBill_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; |
| | | BillOld.MvarItemKey = "Kf_ICStockBillMain"; |
| | | oCn.BeginTran();//å¼å§äºå¡ |
| | | |
| | | //Type 1 å
³é 2 åå
³é |
| | | if (Type == 1) |
| | | { |
| | | //夿忮æ¯å¦å·²ç»å
³é |
| | | DataSet ds; |
| | | string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; |
| | | ds = oCn.RunProcReturn(sql, BillOld.MvarItemKey); |
| | | if (ds == null || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "åæ®ä¸åå¨ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "忮已ä½åº!ä¸è½è¿è¡å
³é!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "") |
| | | //{ |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = "åæ®æªå®¡æ ¸!ä¸è½è¿è¡å
³é!"; |
| | | // objJsonResult.data = null; |
| | | // return objJsonResult; |
| | | //} |
| | | |
| | | if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "忮已å
³é!ä¸è½å次å
³é!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //å
³éåæ® |
| | | if (!BillOld.CloseBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "å
³é失败!åå :" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //夿忮æ¯å¦å·²ç»åå
³é |
| | | DataSet ds; |
| | | string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; |
| | | ds = oCn.RunProcReturn(sql, BillOld.MvarItemKey); |
| | | if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "忮已ä½åº!ä¸è½è¿è¡å
³é!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "") |
| | | //{ |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = "åæ®æªå®¡æ ¸!ä¸è½è¿è¡å
³é!"; |
| | | // objJsonResult.data = null; |
| | | // return objJsonResult; |
| | | //} |
| | | if (ds.Tables[0].Rows[0]["HCloseMan"] == null || ds.Tables[0].Rows[0]["HCloseMan"].ToString() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "åæ®æªå
³é!ä¸éè¦ååå
³é!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //åå
³éåæ® |
| | | if (!BillOld.CancelClose(Int64.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("Kf_StepFoldOutBill/CancellKf_StepFoldOutBill")] |
| | | [HttpGet] |
| | | public object CancellKf_StepFoldOutBill(string HInterID, int Type, string user) |
| | | { |
| | | try |
| | | { |
| | | //夿æ¯å¦æå 餿é |
| | | if (!DBUtility.ClsPub.Security_Log("Kf_MoveStockStepOutBill_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 |
| | | |
| | | } |
| | | } |