Example #1
0
        public OperationResult Login(LoginModel model)
        {
            var operationResult = new OperationResult(OperationResultType.Error);
            Validator.ValidateObject(model, new ValidationContext(model));
            User user = UserFormService.Users().SingleOrDefault(m => m.usercode == model.Account);
            if (user == null)
            {
                operationResult.Message = Properties.Resources.FrmLogin_Login_UserNotExist;
                return operationResult;
            }
            if (user.userpwd != model.Password)
            {
                operationResult.Message = Properties.Resources.FrmLogin_Login_PasswordError;
                return operationResult;
            }

            var usergroups = user.UserGroups.ToList();
            var reses = new List<Res>();
            var mdls = new List<Mdl>();
            foreach (var a in usergroups)
            {
                reses.AddRange(a.Ress);
                mdls.AddRange(a.Mdls);
            }
            if (reses.SingleOrDefault(r => r.RESCODE == model.ResCode) == null)
            {
                operationResult.Message = Properties.Resources.FrmLogin_Login_UserNotRes;
                return operationResult;
            }
            operationResult.ResultType=OperationResultType.Success;
            operationResult.AppendData = mdls;
            operationResult.Message = Properties.Resources.FrmLogin_Login_LoginSuccess;
            return operationResult;
        }
 public OperationResult TsErrorCauseEdit(string card)
 {
     OperationResult operationResult = new OperationResult(OperationResultType.Error);
     if (card == null)
     {
         operationResult.Message = "条码不能为空";
         return operationResult;
     }
     Simulation simulation = SimulationFormService.Simulations().SingleOrDefault(s => s.RCARD == card);
     if (simulation == null)
     {
         operationResult.Message = "条码不存在";
         return operationResult;
     }
     Model model = ModelFormService.Models().SingleOrDefault(m => m.MODELCODE == simulation.MODELCODE);
     TsErrorCauseSelectCollection tsErrorCauseSelect=new TsErrorCauseSelectCollection();
     tsErrorCauseSelect.errorComs = model.errorComs.ToList();
     tsErrorCauseSelect.solutions = model.solutions.ToList();
     tsErrorCauseSelect.errorCodeGroups = model.ecgs.ToList();
     tsErrorCauseSelect.errorCodeSeasonGroups = model.ecsgs.ToList();
     tsErrorCauseSelect.Duties = DutyFormService.Dutys().ToList();
     operationResult.AppendData = tsErrorCauseSelect;
     operationResult.ResultType = OperationResultType.Success;
     return operationResult;
 }
 public OperationResult ActionNgConfirm(string card)
 {
     OperationResult operationResult = new OperationResult(OperationResultType.Error);
     if (card == null)
     {
         operationResult.Message = "条码不能为空";
         return operationResult;
     }
     Ts ts=TsFormService.Tss().Where(t => t.rcard == card).OrderByDescending(t => t.TSID).FirstOrDefault();
     if (ts == null)
     {
         operationResult.Message = "该产品没有登记不良品";
         return operationResult;
     }
     if (!(ts.tsstatus == TsStatus.NEW || ts.tsstatus == TsStatus.CONFIRM))
     {
         operationResult.Message = "该产品状态不对";
         return operationResult;
     }
    
     foreach (var ter in ts.tsErrorCodes.ToList())
     {
         foreach (var tc in ter.tsErrorCauses.ToList())
         {
             var a= tc.solution;
             var b = tc.duty;
             var c = tc.errorCodeSeason.ecsg;
             var d = tc.errorCom;
         }
         ter.errorCode.ToString();
         ter.errorCode.ecg.ToString();
     }
     ts.tsstatus = TsStatus.CONFIRM;
     TsFormService.UpdateEntity(ts);
     operationResult.ResultType = OperationResultType.Success;
     operationResult.Message = "确认成功";
     operationResult.AppendData = ts;
     return operationResult;
 }
 public OperationResult GetErrorCodeSeasonByGroup(string groupCode)
 {
     OperationResult operationResult = new OperationResult(OperationResultType.Success);
     operationResult.AppendData= EcsgFormService.Ecsgs().SingleOrDefault(e => e.ecsgcode == groupCode).ecses.ToList();
     return operationResult;
 }
 public OperationResult TsCompleteConfirm(TsCompleteModel tsCompleteModel)
 {
     OperationResult operationResult = new OperationResult(OperationResultType.Error);
     tsCompleteModel.ts.refmocode = tsCompleteModel.moString;
     tsCompleteModel.ts.refopcode = tsCompleteModel.opString;
     tsCompleteModel.ts.refroutecode = tsCompleteModel.routeString;
     tsCompleteModel.ts.tsstatus = TsStatus.REFLOW;
     return SaveTs(tsCompleteModel.ts);
 }
        public OperationResult TsCompleteCheck(string card)
        {
            OperationResult operationResult = new OperationResult(OperationResultType.Error);
            if (card == null)
            {
                operationResult.Message = "条码不能为空";
                return operationResult;
            }
            Ts ts = TsFormService.Tss().Where(t => t.rcard == card).OrderByDescending(t => t.TSID).FirstOrDefault();
            if (ts == null)
            {
                operationResult.Message = "该产品没有登记不良品";
                return operationResult;
            }
            if (!(ts.tsstatus == TsStatus.CONFIRM))
            {
                operationResult.Message = "该产品状态不对";
                return operationResult;
            }

            foreach (var ter in ts.tsErrorCodes.ToList())
            {

                if (ter.tsErrorCauses.Count == 0)
                {
                    operationResult.Message = "该产品维修中";
                    return operationResult;
                }
                            
            }
            Item item = (Item)ItemFormService.FindEntity(ts.itemcode).AppendData;
            if (item == null)
            {
                operationResult.Message = "该产品不存在";
                return operationResult;
            }
            List<Route> list = item.Routes.ToList();
            foreach(var route in list)
            {
                route.Ops.ToList();
            }
            TsCompleteModel tsCompleteModel = new TsCompleteModel();
            tsCompleteModel.ts = ts;
            tsCompleteModel.list = list;
            operationResult.ResultType = OperationResultType.Success;
            operationResult.Message = "检测成功";
            operationResult.AppendData = tsCompleteModel;            
            return operationResult;
        }
Example #7
0
        public OperationResult CardGoMoCheck(string moString, string lengthString, string prefixString, string card, string rescode, string usercode)
        {
            GoMoModel model = new GoMoModel { MoString = moString, LengthString = lengthString, PrefixString = prefixString, Card = card, Rescode = rescode, Usercode = usercode };
            Validator.ValidateObject(model, new ValidationContext(model));
            OperationResult operationResult = new OperationResult(OperationResultType.Error);

            Mo mo =(Mo) MoFormService.FindEntity(moString).AppendData;
            if (mo == null)
            {
                operationResult.Message = moString +Properties.Resources.String_FrmGoodNGService_MoNotExit;
                return operationResult;
            }
            if (!(mo.MOSTATUS == MoStatus.RELEASE || mo.MOSTATUS == MoStatus.OPEN))
            {
                operationResult.Message = moString + Properties.Resources.String_FrmGoodNGService_MoStatusError;
                return operationResult;
            }
            if (mo.Route == null)
            {
                operationResult.Message = moString + Properties.Resources.String_FrmGoodNGService_MoDontHaveRoute;
                return operationResult;
            }
            MoRcard moRcard = MoRcardFormService.MoRcards().SingleOrDefault(r => r.MoCode == mo.MoCode && r.MoCardStart == card);
            if (moRcard != null)
            {
                operationResult.Message = card + Properties.Resources.String_FrmGoodNGService_SnHadInMo;
                return operationResult;
            }

            if (mo.Route.Ops.First().Reses.SingleOrDefault(r => r.RESCODE == rescode) == null)
            {
                operationResult.Message = rescode + Properties.Resources.String_FrmGoodNGService_ResNotFirst;
                return operationResult;
            }
            Simulation lastSimulation = SimulationFormService.Simulations().SingleOrDefault(r => r.MOCODE == mo.MoCode && r.RCARD == card);
            if (lastSimulation != null)
            {
                if (lastSimulation.ISCOM == "0")
                {
                    operationResult.Message = card + Properties.Resources.String_FrmGoodNGService_SnIsRunning;
                    return operationResult;
                }
            }

            Item item = ItemFormService.Items().SingleOrDefault(i => i.ITEMCODE == mo.ITEMCODE);
            if (item.CHKITEMOP == null || item.CHKITEMOP.Trim().Length == 0)
            {
                operationResult.Message = Properties.Resources.String_FrmGoodNGService_LotNotOp;
                return operationResult;
            }
            if (mo.ISCONINPUT == 1)
            {
                if (mo.MOPLANQTY - mo.MOINPUTQTY + mo.OFFMOQTY - mo.IDMERGERULE <= 0)
                {
                    operationResult.Message = mo.MoCode + Properties.Resources.String_FrmGoodNGService_MoEnough;
                    return operationResult;
                }
            }
            operationResult.ResultType = OperationResultType.Success;
            operationResult.Message = card + Properties.Resources.String_FrmGoodNGService_CheckSuccess;
            return operationResult;
        }
Example #8
0
        public OperationResult ActionNgCheck(string card, string usercode, string rescode, string selectedEcg, string selectedEc)
        {
            ActionNGModel model = new ActionNGModel { userCode = usercode, resCode = rescode, card = card ,selectedEc=selectedEc,selectedEcg=selectedEc};
            Validator.ValidateObject(model, new ValidationContext(model));
            OperationResult operationResult = new OperationResult(OperationResultType.Error);
            Simulation simulation = SimulationFormService.Simulations().SingleOrDefault(s=>s.RCARD==card);
            if (simulation == null)
            {
                operationResult.Message = card + Properties.Resources.String_FrmGoodNGService_SnHadNotInMo;
                return operationResult;
            }
            Res res = ResFormService.Ress().SingleOrDefault(r => r.RESCODE == rescode);
            if (res != null)
            {
                if (res.Op == null)
                {
                    operationResult.Message = rescode + Properties.Resources.String_FrmGoodNGService_ResNotOp;
                    return operationResult;
                }
            }

            int nowOp = Route2OpFormService.Route2Ops().SingleOrDefault(r => r.routeCode == simulation.ROUTECODE && r.opCode == simulation.OpCode).seq;
            Route2Op nextOp = Route2OpFormService.Route2Ops().Where(r => r.routeCode == simulation.ROUTECODE && r.seq > nowOp).OrderBy(r => r.seq).FirstOrDefault();
            if (nextOp.opCode != res.Op.OPCODE)
            {
                operationResult.Message = Properties.Resources.String_FrmGoodNGService_NowOp + res.Op.OPCODE + Properties.Resources.String_FrmGoodNGService_NextOp + nextOp.opCode;
                return operationResult;
            }
            operationResult.Message = card + Properties.Resources.String_FrmGoodNGService_CheckSuccess;
            operationResult.ResultType = OperationResultType.Success;
            return operationResult;           
          
        }