| | |
| | | |
| | | oCN.BeginTran();//开始事务 |
| | | |
| | | //Type 1 作废 2 反作废 |
| | | if (Type == 1) |
| | | //Type 0 作废 1 反作废 |
| | | if (Type == 0) |
| | | { |
| | | if (!BillOld.Cancelltion(int.Parse(HInterID), ref ClsPub.sExeReturnInfo)) |
| | | //判断单据是否已经作废 |
| | | 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]["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]["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]["HBillStatus"].ToString() == "6") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据在审核中!不能进行作废!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | if (!BillOld.Cancelltion(int.Parse(HInterID), ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | |
| | | } |
| | | else |
| | | { |
| | | if (!BillOld.AbandonCancelltion(int.Parse(HInterID), ref ClsPub.sExeReturnInfo)) |
| | | //判断单据是否已经反作废 |
| | | 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]["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]["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]["HBillStatus"].ToString() == "审核中") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据在审核中!不能进行作废!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | if (!BillOld.AbandonCancelltion(int.Parse(HInterID), ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region 销售订单 驳回 |
| | | [Route("Xs_SeOrderBill/RejectCheckFlow_POOrderBill")] |
| | | [HttpGet] |
| | | public object RejectCheckFlow_POOrderBill(string HInterID, string CurUserID) |
| | | { |
| | | try |
| | | { |
| | | Int64 lngBillKey = 0; |
| | | lngBillKey = DBUtility.ClsPub.isLong(HInterID); //对HInterID进行类型的转换 |
| | | DAL.ClsXs_SeOrderBill oBill = new DAL.ClsXs_SeOrderBill(); //实例化单据操作类,用于进行相关操作 |
| | | if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //根据HInterID获取该单据的数据 |
| | | { |
| | | if (oBill.omodel.HBillStatus != 6) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据未在审核中不能驳回"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //发起驳回 |
| | | if (oBill.RejectCheckFlowProgress(lngBillKey, oBill.omodel.HBillNo, CurUserID, ref DBUtility.ClsPub.sExeReturnInfo) == true) |
| | | { |
| | | 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; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | 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("Xs_SeOrderBill/StartCheckFlow_SeOrderBIll")] |
| | | [HttpGet] |
| | | public object StartCheckFlow_SeOrderBIll(int HInterID,int HCheckFlowID_select, string CurUserName) |
| | | public object StartCheckFlow_SeOrderBIll(int HInterID,string CurUserName) |
| | | { |
| | | string ModRightNameCheck = "Xs_SeOrderBill_Check"; |
| | | DBUtility.ClsPub.CurUserName = CurUserName; |
| | | try |
| | | { |
| | |
| | | DAL.ClsXs_SeOrderBill oBill = new DAL.ClsXs_SeOrderBill(); //实例化单据操作类,用于进行相关操作 |
| | | |
| | | //发起审批 |
| | | if (oBill.startCheckFlow(lngBillKey,HCheckFlowID_select, ref DBUtility.ClsPub.sExeReturnInfo) ==true) |
| | | if (oBill.startCheckFlow(lngBillKey,ref DBUtility.ClsPub.sExeReturnInfo) ==true) |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | |
| | | string HCheckFlowID = ds0.Tables[0].Rows[0]["HCheckFlowID"].ToString(); //审批流内码 |
| | | string HCheckItemNowID = "0"; //当前审批项目内码 |
| | | string HCheckItemNextID = "0"; //待审批项目内码 |
| | | if (oBill.omodel.HBillStatus <= 1) |
| | | if (oBill.omodel.HBillStatus == 6) |
| | | { |
| | | for (int i = 0; i < ds0.Tables[0].Rows.Count; i++) |
| | | { |
| | |
| | | oCN.RunProc(sql02); |
| | | |
| | | //判断反审核的单据是否已经审核完成,若审核完成,反审核需要变更单据状态。 |
| | | if (oBill.omodel.HBillStatus <= 1) |
| | | if (oBill.omodel.HBillStatus == 6) |
| | | { |
| | | //更新单据主表的审批流数据 |
| | | string sql04 = "update " + oBill.MvarItemKey + " set HCheckItemNowID=" + HCheckItemNowID + ",HCheckItemNextID=" + HCheckItemNextID + " where HInterID = " + lngBillKey; |
| | |
| | | } |
| | | else |
| | | { |
| | | //更新单据主表的审批流数据 |
| | | string sql04 = "update " + oBill.MvarItemKey + " set HCheckItemNowID=" + HCheckItemNowID + ",HCheckItemNextID=" + HCheckItemNextID + " where HInterID = " + lngBillKey; |
| | | oCN.RunProc(sql04); |
| | | |
| | | |
| | | //反审核提交AbandonCheck |
| | | if (oBill.AbandonCheck(oCN,oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Xs_SeOrderBill_AfterUnCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) |
| | | { |
| | | //更新单据主表的审批流数据 |
| | | string sql04 = "update " + oBill.MvarItemKey + " set HCheckItemNowID=" + HCheckItemNowID + ",HCheckItemNextID=" + HCheckItemNextID + ",HBillStatus=6 " + " where HInterID = " + lngBillKey; |
| | | oCN.RunProc(sql04); |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "反审核成功"; |