Esempio n. 1
0
        /// <summary>
        /// 审批确定油料申请数据
        /// </summary>
        /// <returns></returns>
        public string UpdateyouliaoInfo(string remack, int oilmId, int jobId)
        {
            string rutes = string.Empty;

            _processStepRecordResposit.StatrAffair(() =>
            {
                ProcessStepRecord processStepRecord           = new ProcessStepRecord();
                ProcessStepRecord processStep                 = _processStepRecordResposit.FindAll().FirstOrDefault(x => x.RefOrderId == oilmId);
                OilMaterialOrder oilMaterialOrder             = _oilMaterialOrderResposit.FindAll().FirstOrDefault(x => x.Id == oilmId);
                oilMaterialOrder.UpdateTime                   = DateTime.Now;
                OilMaterialOrderDetail oilMaterialOrderDetail = _oilMaterialOrderDetailResposit.FindAll().FirstOrDefault(x => x.OrderId == oilmId);
                oilMaterialOrderDetail.UpdateTime             = DateTime.Now;
                if ((int)JobEmun.油站经理 == jobId)
                {
                    if (remack == "同意")
                    {
                        processStep.OilStation       = 0;
                        processStep.OilStationRemark = remack;
                        processStep.Result           = 2;
                    }
                    else
                    {
                        processStep.OilStation       = 2; //不同意该申请
                        processStep.OilStationRemark = remack;
                        processStep.Result           = 3;
                    }
                }
                else if ((int)JobEmun.主管 == jobId)
                {
                    if (remack == "同意")
                    {
                        processStep.GeneralManagerOfPerson       = 0;
                        processStep.GeneralManagerOfPersonRemark = remack;
                        processStep.Result = 2;
                    }
                    else
                    {
                        processStep.GeneralManagerOfPerson       = 2; //不同意该申请
                        processStep.GeneralManagerOfPersonRemark = remack;
                        processStep.Result = 3;
                    }
                }
                else if ((int)JobEmun.总经理 == jobId)
                {
                    if (remack == "同意")
                    {
                        processStep.GeneralManager       = 0;
                        processStep.GeneralManagerRemark = remack;
                        processStep.Result = 2;
                    }
                    else
                    {
                        processStep.GeneralManager       = 2; //不同意该申请
                        processStep.GeneralManagerRemark = remack;
                        processStep.Result = 3;
                    }
                }
                else if ((int)JobEmun.总监 == jobId)
                {
                    if (remack == "同意")
                    {
                        processStep.ChiefInspector       = 0;
                        processStep.ChiefInspectorRemark = remack;
                        processStep.Result = 2;
                    }
                    else
                    {
                        processStep.ChiefInspector       = 2; //不同意该申请
                        processStep.ChiefInspectorRemark = remack;
                        processStep.Result = 3;
                    }
                }
                _processStepRecordResposit.UpdateInfo((x) => new ProcessStepRecord
                {
                    OilStation                   = processStep.OilStation,
                    OilStationRemark             = processStep.OilStationRemark,
                    GeneralManagerOfPersonRemark = processStep.GeneralManagerOfPersonRemark,
                    GeneralManagerOfPerson       = processStep.GeneralManagerOfPerson,
                    GeneralManager               = processStep.GeneralManager,
                    GeneralManagerRemark         = processStep.GeneralManagerRemark,
                    ChiefInspector               = processStep.ChiefInspector,
                    ChiefInspectorRemark         = processStep.ChiefInspectorRemark,
                    Result = processStep.Result
                }, x => x.Id == processStep.Id);

                _oilMaterialOrderDetailResposit.UpdateInfo((x) => new OilMaterialOrderDetail
                {
                    UpdateTime = oilMaterialOrderDetail.UpdateTime
                }, x => x.Id == oilMaterialOrderDetail.Id);

                _oilMaterialOrderResposit.UpdateInfo((x) => new OilMaterialOrder
                {
                    UpdateTime = oilMaterialOrder.UpdateTime
                }, x => x.Id == oilMaterialOrderDetail.Id);

                rutes = "ok";
            });
            return(rutes);
        }
        /// <summary>
        /// 确定审批意见
        /// </summary>
        /// <returns></returns>
        public string UpdateRuzhiInfo(int JobId, string Remack, int ProceId, string staffName)
        {
            //开启事务
            _processStepRecordResposit.StatrAffair(() =>
            {
                //查询得出当前审批的数据
                ProcessStepRecord processStepRecord = _processStepRecordResposit.FindAll().FirstOrDefault(x => x.Id == ProceId);
                processStepRecord.Result            = 1;//表示审核中

                //判断审批人的职位
                if ((int)JobEmun.油站经理 == JobId)
                {
                    processStepRecord.OilStation       = 0;
                    processStepRecord.OilStationRemark = staffName + Remack;
                    //判断当前这个审批的数据是否为最后一个人审批
                    if (processStepRecord.ExecutiveDirector == null && Remack == "同意")
                    {
                        AddStaffInfo(processStepRecord.RefOrderId);
                        processStepRecord.Result = 2;//表示审核完毕  并且通过审核
                    }
                }
                else if ((int)JobEmun.人事经理 == JobId)
                {
                    processStepRecord.ExecutiveDirector       = 0;
                    processStepRecord.ExecutiveDirectorRemark = staffName + Remack;

                    if (processStepRecord.OilStation == null && processStepRecord.GeneralManagerOfPerson == null && Remack == "同意")
                    {
                        //人事员工的最后一个审批人
                        AddStaffInfo(processStepRecord.RefOrderId);
                        processStepRecord.Result = 2;//表示审核完毕  并且通过审核
                    }
                }
                else if ((int)JobEmun.主管 == JobId)
                {
                    processStepRecord.GeneralManagerOfPerson       = 0;
                    processStepRecord.GeneralManagerOfPersonRemark = staffName + Remack;

                    if (processStepRecord.ExecutiveDirector == 0 && processStepRecord.GeneralManager == null && Remack == "同意")
                    {
                        //油站经理  和 财务经理 的最后一个审批人
                        AddStaffInfo(processStepRecord.RefOrderId);
                        processStepRecord.Result = 2;//表示审核完毕  并且通过审核
                    }
                }
                else if ((int)JobEmun.总经理 == JobId)
                {
                    processStepRecord.GeneralManager       = 0;
                    processStepRecord.GeneralManagerRemark = staffName + Remack;
                }
                else if ((int)JobEmun.总监 == JobId)
                {
                    processStepRecord.ChiefInspector       = 0;
                    processStepRecord.ChiefInspectorRemark = staffName + Remack;

                    if (processStepRecord.GeneralManager == 0 && Remack == "同意")
                    {
                        // 人事经理 和 主管的最后一个审批人
                        AddStaffInfo(processStepRecord.RefOrderId);
                        processStepRecord.Result = 2;//表示审核完毕  并且通过审核
                    }
                }

                _processStepRecordResposit.UpdateInfo((x) => new ProcessStepRecord
                {
                    OilStation                   = processStepRecord.OilStation,
                    OilStationRemark             = processStepRecord.OilStationRemark,
                    ExecutiveDirector            = processStepRecord.ExecutiveDirector,
                    ExecutiveDirectorRemark      = processStepRecord.ExecutiveDirectorRemark,
                    GeneralManagerOfPerson       = processStepRecord.GeneralManagerOfPerson,
                    GeneralManagerOfPersonRemark = processStepRecord.GeneralManagerOfPersonRemark,
                    GeneralManager               = processStepRecord.GeneralManager,
                    GeneralManagerRemark         = processStepRecord.GeneralManagerRemark,
                    ChiefInspector               = processStepRecord.ChiefInspector,
                    ChiefInspectorRemark         = processStepRecord.ChiefInspectorRemark,
                    Result = processStepRecord.Result
                }, x => x.Id == processStepRecord.Id);
            });
            return("ok");
        }