|  |  |  | 
|---|
|  |  |  | 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"; | 
|---|
|  |  |  | 
|---|
|  |  |  | /// <returns></returns> | 
|---|
|  |  |  | [Route("Xs_SeOutStockBill/DeltetSeOutStockBill")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public object DeltetSeOutStockBill(string HInterID,string user) | 
|---|
|  |  |  | public object DeltetSeOutStockBill(string HInterID, string HsupId, string HQty, string HSourceInterID, string HSourceEntryID, string user) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //进行 会计期间 结账 的判断和控制 | 
|---|
|  |  |  | string s = ""; | 
|---|
|  |  |  | int sYear = 0; | 
|---|
|  |  |  | int sPeriod = 0; | 
|---|
|  |  |  | DateTime HDate = DateTime.Now; | 
|---|
|  |  |  | if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.Message = s; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | oCN.BeginTran(); | 
|---|
|  |  |  | var ds = oCN.RunProcReturn("select * from Xs_SeOutStockBillMain where HInterID=" + HInterID, "Xs_SeOutStockBillMain"); | 
|---|
|  |  |  | //删除撤销  发货通知单 反写 销售订单 | 
|---|
|  |  |  | oCN.RunProcReturn("exec h_p_Xs_SeOutStockBillMain_Delete " + HInterID, "h_p_Xs_SeOutStockBillMain_Delete"); | 
|---|
|  |  |  | //删除前控制 | 
|---|
|  |  |  | DataSet BeforeDs = oCN.RunProcReturn("Exec h_p_Xs_SeOutStockBill_BeforeDelCtrl  " + HInterID.ToString() + ",'" + user + "'", "h_p_Xs_SeOutStockBill_BeforeDelCtrl"); | 
|---|
|  |  |  | 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; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | oCN.RunProc("Delete From Xs_SeOutStockBillMain where HInterID = " + HInterID); | 
|---|
|  |  |  | oCN.RunProc("Delete From Xs_SeOutStockBillSub where HInterID = " + HInterID); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //删除后控制 | 
|---|
|  |  |  | DataSet EndDs = oCN.RunProcReturn("Exec  h_p_Xs_SeOutStockBill_AfterDelCtrl  " + HInterID.ToString() + ",'" + ds.Tables[0].Rows[0]["HBillNo"].ToString() + "','" + user + "'", " h_p_Xs_SeOutStockBill_AfterDelCtrl"); | 
|---|
|  |  |  | if (EndDs == null || EndDs.Tables.Count == 0 || EndDs.Tables[0].Rows.Count == 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "删除后判断失败!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | oCN.RollBack(); | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (DBUtility.ClsPub.isLong(EndDs.Tables[0].Rows[0]["HBack"]) == 1) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "删除失败!" + DBUtility.ClsPub.isStrNull(EndDs.Tables[0].Rows[0]["HRemark"]); | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | oCN.Commit(); | 
|---|
|  |  |  | objJsonResult.code = "1"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | 
|---|
|  |  |  | 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); //是否垫付 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | long HProjectID = mainList[0].HProjectID;//工程项目 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | string HBillType = mainList[0].HBillType; | 
|---|
|  |  |  | string HBillSubType = mainList[0].HBillSubType; | 
|---|
|  |  |  | 
|---|
|  |  |  | 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"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //进行 会计期间 结账 的判断和控制 | 
|---|
|  |  |  | string s = ""; | 
|---|
|  |  |  | int sYear = 0; | 
|---|
|  |  |  | int sPeriod = 0; | 
|---|
|  |  |  | if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.Message = s; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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 | 
|---|
|  |  |  | ,HChecker,HCheckDate,HCloseMan,HCloseDate,HERPInterID,HERPBillType,HDFflag) | 
|---|
|  |  |  | ,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,HProjectID) | 
|---|
|  |  |  | 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 + ",'"+ HProjectID + "')"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | DataSet dss; | 
|---|
|  |  |  | dss = oCN.RunProcReturn("select * from h_v_IF_SeOutStockBillList where hmainid=" + HInterID + " and 单据号='" + HBillNo + "'", "h_v_IF_SeOutStockBillList"); | 
|---|
|  |  |  | //判断是否可编辑 | 
|---|
|  |  |  | if (dss.Tables[0].Rows[0]["审核人"].ToString() != "" && dss.Tables[0].Rows[0]["审核人"] != null) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "此单据已经被审核,不允许修改!"; | 
|---|
|  |  |  | objJsonResult.data = 1; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (dss.Tables[0].Rows[0]["状态"].ToString() != "创建") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "此单据处于不可编辑状态,不允许修改!"; | 
|---|
|  |  |  | objJsonResult.data = 1; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | string sql = $@"update Xs_SeOutStockBillMain  set " + | 
|---|
|  |  |  | "HRemark='" + HRemark + "', HUpDater='" + HMaker + "', HUpDateDate=getdate()" + | 
|---|
|  |  |  | ",HCusID='" + HCusID + "', HCurID='" + HCurID + "', HWHID = '" + HWHID | 
|---|
|  |  |  | + "',HExRate='" + HExRate + "',HEmpID='" + HEmpID + "',HSeOrderBillNo_M='" + HSeOrderBillNo_M + "',HManagerID='" + HManagerID + "',HDeptID='" + HDeptID + "',HOWNERID='" + HOWNERID | 
|---|
|  |  |  | + "',HAddress='" + HAddress + "',HProjectID='"+ HProjectID + "' where HInterID=" + HInterID; | 
|---|
|  |  |  | oCN.RunProc(sql); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //删除 撤销发货通知单 反写 销售订单 | 
|---|
|  |  |  | oCN.RunProcReturn("exec h_p_Xs_SeOutStockBillMain_Delete " + HInterID, "h_p_Xs_SeOutStockBillMain_Delete"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //删除子表 | 
|---|
|  |  |  | oCN.RunProc("delete from Xs_SeOutStockBillSub where HInterID='" + HInterID + "'"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //保存子表 | 
|---|
|  |  |  | objJsonResult = AddBillSub(msg3, HInterID, OperationType); | 
|---|
|  |  |  | objJsonResult = AddBillSub(msg3, HInterID, OperationType,user); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //发货通知的 反写 数量到 销售订单 关联数量 | 
|---|
|  |  |  | oCN.RunProcReturn("exec h_p_Xs_SeOutStockBillMain " + HInterID, "h_p_Xs_SeOutStockBillMain"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //保存后控制========================================= | 
|---|
|  |  |  | 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") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public json AddBillSub(string msg3, long HInterID, int OperationType) | 
|---|
|  |  |  | public json AddBillSub(string msg3, long HInterID, int OperationType,string user) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 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++; | 
|---|
|  |  |  | 
|---|
|  |  |  | 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"; | 
|---|
|  |  |  | 
|---|
|  |  |  | //Type 1 审核  2  反审核 | 
|---|
|  |  |  | if (Type == 1) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (!BillOld.CheckBill(int.Parse(HInterID), ref ClsPub.sExeReturnInfo)) | 
|---|
|  |  |  | //审核前控制 | 
|---|
|  |  |  | 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; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //进行 会计期间 结账 的判断和控制 | 
|---|
|  |  |  | string s = ""; | 
|---|
|  |  |  | int sYear = 0; | 
|---|
|  |  |  | int sPeriod = 0; | 
|---|
|  |  |  | DateTime HDate = DateTime.Now; | 
|---|
|  |  |  | if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.Message = s; | 
|---|
|  |  |  | 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; | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (BillOld.AbandonCheck(int.Parse(HInterID), ref ClsPub.sExeReturnInfo)) | 
|---|
|  |  |  | //反审核前控制 | 
|---|
|  |  |  | 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; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //进行 会计期间 结账 的判断和控制 | 
|---|
|  |  |  | string s = ""; | 
|---|
|  |  |  | int sYear = 0; | 
|---|
|  |  |  | int sPeriod = 0; | 
|---|
|  |  |  | DateTime HDate = DateTime.Now; | 
|---|
|  |  |  | if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.Message = s; | 
|---|
|  |  |  | 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"); | 
|---|