public override ResultModel Submit(UserModel user, IModel obj) { ResultModel result = new ResultModel(); Model.Contract contract = obj as Model.Contract; if (contract.CreateFrom == (int)NFMT.Common.CreateFromEnum.采购合约库存创建 || contract.CreateFrom == (int)NFMT.Common.CreateFromEnum.销售合约库存创建) { result = base.Submit(user, obj); if (result.ResultStatus != 0) return result; DAL.ContractSubDAL subDAL = new ContractSubDAL(); result = subDAL.GetSubByContractId(user, contract.ContractId); if (result.ResultStatus != 0) return result; Model.ContractSub sub = result.ReturnValue as Model.ContractSub; if (sub == null || sub.SubId <= 0) { result.ResultStatus = -1; result.Message = "子合约获取失败"; return result; } if (sub.SubStatus != StatusEnum.待审核) { result = subDAL.Submit(user, sub); if (result.ResultStatus != 0) return result; } if (result.ResultStatus == 0) result.Message = "合约提交审核成功"; } else result = base.Submit(user, obj); return result; }
public ResultModel ContractOutCompleteCancel(UserModel user, int contractId) { ResultModel result = new ResultModel(); try { DAL.ContractSubDAL subDAL = new ContractSubDAL(); //获取合约 result = this.contractDAL.Get(user, contractId); if (result.ResultStatus != 0) return result; Model.Contract contract = result.ReturnValue as Model.Contract; if (contract == null || contract.ContractId <= 0) { result.Message = "合约不存在"; result.ResultStatus = -1; return result; } if (contract.CreateFrom != (int)NFMT.Common.CreateFromEnum.销售合约库存创建) { result.Message = "合约创建来源不正确"; result.ResultStatus = -1; return result; } //获取子合约 result = subDAL.GetSubByContractId(user, contract.ContractId); if (result.ResultStatus != 0) return result; Model.ContractSub sub = result.ReturnValue as Model.ContractSub; if (sub == null || sub.SubId <= 0) { result.Message = "子合约不存在"; result.ResultStatus = -1; return result; } //主合约完成撤销 result = this.contractDAL.CompleteCancel(user, contract); if (result.ResultStatus != 0) return result; //子合约完成撤销 result = subDAL.CompleteCancel(user, sub); if (result.ResultStatus != 0) return result; } catch (Exception ex) { result.ResultStatus = -1; result.Message = ex.Message; } return result; }
public ResultModel ContractOutAudit(UserModel user, NFMT.WorkFlow.Model.DataSource dataSource, bool isPass) { ResultModel result = new ResultModel(); try { DAL.ContractSubDAL subDAL = new ContractSubDAL(); result = this.contractDAL.Get(NFMT.Common.DefaultValue.SysUser, dataSource.RowId); if (result.ResultStatus != 0) return result; Model.Contract contract = result.ReturnValue as Model.Contract; if (contract == null || contract.ContractId <= 0) { result.ResultStatus = -1; result.Message = "合约不存在"; return result; } //审核,修改数据状态 result = this.contractDAL.Audit(user, contract, isPass); if (result.ResultStatus != 0) return result; //获取子合约 result = subDAL.GetSubByContractId(user, contract.ContractId); if (result.ResultStatus != 0) return result; Model.ContractSub sub = result.ReturnValue as Model.ContractSub; if (sub == null || sub.SubId <= 0) { result.ResultStatus = -1; result.Message = "子合约不存在"; return result; } result = subDAL.Audit(user, sub, isPass); if (result.ResultStatus != 0) return result; result.AffectCount = sub.SubId; } catch (Exception ex) { result.ResultStatus = -1; result.Message = ex.Message; return result; } return result; }
public ResultModel ContractInGoBack(UserModel user, int contractId) { ResultModel result = new ResultModel(); try { DAL.ContractSubDAL subDAL = new ContractSubDAL(); //获取合约 result = this.contractDAL.Get(user, contractId); if (result.ResultStatus != 0) return result; Model.Contract contract = result.ReturnValue as Model.Contract; if (contract == null || contract.ContractId <= 0) { result.Message = "合约不存在"; result.ResultStatus = -1; return result; } if (contract.CreateFrom != (int)NFMT.Common.CreateFromEnum.采购合约库存创建) { result.Message = "合约创建来源不正确"; result.ResultStatus = -1; return result; } //获取子合约 result = subDAL.GetSubByContractId(user, contract.ContractId); if (result.ResultStatus != 0) return result; Model.ContractSub sub = result.ReturnValue as Model.ContractSub; if (sub == null || sub.SubId <= 0) { result.Message = "子合约不存在"; result.ResultStatus = -1; return result; } //撤返合约 result = this.contractDAL.Goback(user, contract); if (result.ResultStatus != 0) return result; //撤返子合约 result = subDAL.Goback(user, sub); if (result.ResultStatus != 0) return result; //删除工作流审核数据 WorkFlow.DAL.DataSourceDAL sourceDAL = new WorkFlow.DAL.DataSourceDAL(); result = sourceDAL.SynchronousStatus(user, contract); if (result.ResultStatus != 0) return result; } catch (Exception ex) { result.ResultStatus = -1; result.Message = ex.Message; } return result; }