| | |
| | | //获取系统参数 |
| | | 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(); |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region [同步插件] |
| | | [Route("Xs_SeOutStockBill/Xs_SeOutStockBillSaveApi")] |
| | | [HttpPost] |
| | | public object Xs_SeOutStockBillSaveApi([FromBody] JObject sMainSub) |
| | | { |
| | | try |
| | | { |
| | | //LogService.Write("发货通知单同步,保存方法执行完成异常:" + sMainSub.ToString()); |
| | | 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); |
| | | string sql = string.Empty; |
| | | oCN.BeginTran(); |
| | | sql = $"delete Xs_SeOutStockBillMain where HinterID = {mainList[0].HInterID}"; |
| | | oCN.RunProc(sql); |
| | | sql = $"delete Xs_SeOutStockBillSub where HinterID = {mainList[0].HInterID}"; |
| | | oCN.RunProc(sql); |
| | | //主表 |
| | | oCN.RunProc(@"Insert Into Xs_SeOutStockBillMain |
| | | (HInterID,HYear,HPeriod,HBillType,HBillSubType,HDate,HBillNo,HBillStatus |
| | | ,HCusID,HManagerID,HDeptID,HRemark,HAddress,HSSID,HCurID,HWHID,HExRate |
| | | ,HEmpID,HExplanation,HInnerBillNo,HSALEORGID,HDELIVERYORGID,HOWNERID |
| | | ,HOWNERTYPEID,HERPInterID,HERPBillType,HMaker,HMakeDate,HChecker,HCheckDate |
| | | ,HCloseMan,HCloseDate,HSTOCKERGROUPID,HSALEGROUPID,HSALEDEPTID,HBUSINESSTYPE |
| | | ,HCARRIERID,HRECEIVERID,HSETTLEID,HPAYERID,HHEADLOCID,HRECCONTACTID |
| | | ,HRECEIPTCONDITIONID,HCORRESPONDORGID,HCARRIAGENO) |
| | | values(" + mainList[0].HInterID + "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + 1402 + "','" + |
| | | mainList[0].HBillSubType + "','" + mainList[0].HDate + "','" + mainList[0].HBillNo + "','" + mainList[0].HBillStatus + "'," + mainList[0].HCusID + |
| | | "," + mainList[0].HManagerID + "," + mainList[0].HDeptID + ",'" + mainList[0].HRemark + "','" + mainList[0].HAddress + "'," + mainList[0].HSSID + |
| | | "," + mainList[0].HCurID + "," + mainList[0].HWHID + "," + mainList[0].HExRate + "," + mainList[0].HEmpID + ",'" + mainList[0].HExplanation + "','" + mainList[0].HInnerBillNo + "'," + mainList[0].HSALEORGID + "," + mainList[0].HDELIVERYORGID + "," + mainList[0].HOWNERID + ",'" + |
| | | mainList[0].HOWNERTYPEID + "'," + mainList[0].HERPInterID + ",'" + mainList[0].HERPBillType + "','" + mainList[0].HMaker + "','" + mainList[0].HMakeDate + "','" |
| | | + mainList[0].HChecker + "','" + mainList[0].HCheckDate + "','" + mainList[0].HCloseMan + "','" + mainList[0].HCloseDate + "'," + mainList[0].HSTOCKERGROUPID + "," |
| | | + mainList[0].HSALEGROUPID + "," + mainList[0].HSALEDEPTID + ",'" + mainList[0].HBUSINESSTYPE + "'," + mainList[0].HCARRIERID + "," + mainList[0].HRECEIVERID + "," + mainList[0].HSETTLEID + "," + mainList[0].HPAYERID + "," + mainList[0].HHEADLOCID + "," + mainList[0].HRECCONTACTID + "," + mainList[0].HRECEIPTCONDITIONID + "," + mainList[0].HCORRESPONDORGID + ",'" + mainList[0].HCARRIAGENO + "'" + ")"); |
| | | //保存主表 |
| | | foreach (var oSub in subList) |
| | | { |
| | | 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, |
| | | HRelationQty,HAuxPropID,HBatchNO,HMTONo,HERPInterID,HERPEntryID,HCUSTMATID, |
| | | HBASEUNITID,HBFLOWID,HOUTCONTROL,HSTOCKUNITID,HROWTYPE,HROWID,HPARENTROWID, |
| | | HPARENTMATID,HTAXCOMBINATION,HPRICECOEFFICIENT,HSYSPRICE,HLIMITDOWNPRICE, |
| | | HPRICEUNITID,HTAXPRICE,HTAXRATE,HTAXNETPRICE,HDISCOUNTRATE,HISFREE,HLOCALCURRID, |
| | | HSETTLECURRID,HEXCHANGETYPEID,HSETTLETYPEID,HRECEIPTCONDITIONID,HEXCHANGERATE, |
| | | HISINCLUDEDTAX,HISPRICEEXCLUDETAX,HTAXRATEID,HTaxRate_TAX,HCOSTPERCENT,HVAT, |
| | | HSELLERWITHHOLDING,HBUYERWITHHOLDING) |
| | | values('{oSub.HInterID}','{oSub.HEntryID}','{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.HCUSTMATID}','{oSub.HBASEUNITID}','{oSub.HBFLOWID}','{oSub.HOUTCONTROL}','{oSub.HSTOCKUNITID}','{oSub.HROWTYPE}', |
| | | '{oSub.HROWID}','{oSub.HPARENTROWID}', |
| | | '{oSub.HPARENTMATID}','{oSub.HTAXCOMBINATION}','{oSub.HPRICECOEFFICIENT}','{oSub.HSYSPRICE}','{oSub.HLIMITDOWNPRICE}','{oSub.HPRICEUNITID}','{oSub.HTAXPRICE}','{oSub.HTAXRATE}','{oSub.HTAXNETPRICE}','{oSub.HDISCOUNTRATE}','{oSub.HISFREE}', |
| | | '{oSub.HLOCALCURRID}','{oSub.HSETTLECURRID}','{oSub.HEXCHANGETYPEID}','{oSub.HSETTLETYPEID}','{oSub.HRECEIPTCONDITIONID}','{oSub.HEXCHANGERATE}','{oSub.HISINCLUDEDTAX}','{oSub.HISPRICEEXCLUDETAX}','{oSub.HTAXRATEID}', |
| | | '{oSub.HTaxRate_TAX}','{oSub.HCOSTPERCENT}','{oSub.HVAT}','{oSub.HSELLERWITHHOLDING}','{oSub.HBUYERWITHHOLDING}')"; |
| | | oCN.RunProc(sql); |
| | | } |
| | | oCN.Commit(); |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "单据保存成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | LogService.Write("发货通知单同步异常,保存方法执行完成异常:" + e.Message.ToString()); |
| | | |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region [同步单据] |
| | | [Route("Xs_SeOutStockBill/Xs_SeOutStockBillViewApi")] |
| | | [HttpGet] |
| | |
| | | } |
| | | #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) |
| | | { |
| | | if (!BillOld.CheckBill(int.Parse(HInterID), ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (BillOld.AbandonCheck(int.Parse(HInterID), 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 |
| | | |
| | | } |
| | | } |