Ejemplo n.º 1
0
        public ResultModel ContractOutInvalidStockOperate(UserModel user, int subId)
        {
            ResultModel result = new ResultModel();

            try
            {
                NFMT.WareHouse.DAL.StockOutApplyDAL stockOutApplyDAL = new NFMT.WareHouse.DAL.StockOutApplyDAL();
                NFMT.WareHouse.DAL.StockOutApplyDetailDAL stockOutApplyDetailDAL = new NFMT.WareHouse.DAL.StockOutApplyDetailDAL();
                NFMT.Operate.DAL.ApplyDAL applyDAL = new NFMT.Operate.DAL.ApplyDAL();
                NFMT.WareHouse.DAL.StockExclusiveDAL stockExclusiveDAL = new NFMT.WareHouse.DAL.StockExclusiveDAL();

                //获取子合约出库申请
                result = stockOutApplyDAL.LoadBySubId(user, subId);
                if (result.ResultStatus != 0)
                    return result;

                List<NFMT.WareHouse.Model.StockOutApply> outApplies = result.ReturnValue as List<NFMT.WareHouse.Model.StockOutApply>;
                if (outApplies == null || outApplies.Count == 0)
                {
                    result.ResultStatus = -1;
                    result.Message = "获取出库申请失败";
                    return result;
                }

                foreach (NFMT.WareHouse.Model.StockOutApply outApply in outApplies)
                {
                    result = applyDAL.Get(user, outApply.ApplyId);
                    if (result.ResultStatus != 0)
                        return result;

                    NFMT.Operate.Model.Apply apply = result.ReturnValue as NFMT.Operate.Model.Apply;
                    if (apply == null || apply.ApplyId <= 0)
                    {
                        result.ResultStatus = -1;
                        result.Message = "获取主申请失败";
                        return result;
                    }

                    //申请作废
                    result = applyDAL.Invalid(user, apply);
                    if (result.ResultStatus != 0)
                        return result;

                    //获取出库申请明细
                    result = stockOutApplyDetailDAL.Load(user, outApply.StockOutApplyId);
                    if (result.ResultStatus != 0)
                        return result;

                    List<NFMT.WareHouse.Model.StockOutApplyDetail> details = result.ReturnValue as List<NFMT.WareHouse.Model.StockOutApplyDetail>;
                    if (details == null)
                    {
                        result.ResultStatus = -1;
                        result.Message = "获取出库申请明细失败";
                        return result;
                    }

                    foreach (NFMT.WareHouse.Model.StockOutApplyDetail detail in details)
                    {
                        detail.DetailStatus = StatusEnum.已录入;
                        result = stockOutApplyDetailDAL.Invalid(user, detail);
                        if (result.ResultStatus != 0)
                            return result;

                        //获取排他明细
                        result = stockExclusiveDAL.Get(user, apply.ApplyId, outApply.StockOutApplyId, detail.DetailId);
                        if (result.ResultStatus != 0)
                            return result;

                        NFMT.WareHouse.Model.StockExclusive stockExclusive = result.ReturnValue as NFMT.WareHouse.Model.StockExclusive;
                        if (stockExclusive == null || stockExclusive.ExclusiveId <= 0)
                        {
                            result.ResultStatus = -1;
                            result.Message = "获取排他明细失败";
                            return result;
                        }

                        //作废排他明细
                        stockExclusive.ExclusiveStatus = StatusEnum.已录入;
                        result = stockExclusiveDAL.Invalid(user, stockExclusive);
                        if (result.ResultStatus != 0)
                            return result;
                    }
                }
            }
            catch (Exception ex)
            {
                result.ResultStatus = -1;
                result.Message = ex.Message;
            }

            return result;
        }
Ejemplo n.º 2
0
        public ResultModel ContractOutAuditStockOperate(UserModel user, int subId, bool isPass)
        {
            ResultModel result = new ResultModel();

            try
            {
                NFMT.WareHouse.DAL.StockOutApplyDAL stockOutApplyDAL = new NFMT.WareHouse.DAL.StockOutApplyDAL();
                NFMT.Operate.DAL.ApplyDAL applyDAL = new NFMT.Operate.DAL.ApplyDAL();

                //获取子合约出库申请
                result = stockOutApplyDAL.LoadBySubId(user, subId);
                if (result.ResultStatus != 0)
                    return result;

                List<NFMT.WareHouse.Model.StockOutApply> outApplies = result.ReturnValue as List<NFMT.WareHouse.Model.StockOutApply>;
                if (outApplies == null || outApplies.Count == 0)
                {
                    result.ResultStatus = -1;
                    result.Message = "获取出库申请失败";
                    return result;
                }

                foreach (NFMT.WareHouse.Model.StockOutApply outApply in outApplies)
                {
                    result = applyDAL.Get(user, outApply.ApplyId);
                    if (result.ResultStatus != 0)
                        return result;

                    NFMT.Operate.Model.Apply apply = result.ReturnValue as NFMT.Operate.Model.Apply;
                    if (apply == null || apply.ApplyId <= 0)
                    {
                        result.ResultStatus = -1;
                        result.Message = "获取主申请失败";
                        return result;
                    }

                    //审核出库申请
                    result = applyDAL.Audit(user, apply, isPass);
                    if (result.ResultStatus != 0)
                        return result;
                }
            }
            catch (Exception ex)
            {
                result.ResultStatus = -1;
                result.Message = ex.Message;
            }

            return result;
        }