Beispiel #1
0
        public OperationResult ActionGood(string usercode, string rescode, string card)
        {
            OperationResult operationResult = ActionGoodCheck(usercode, rescode, card);

            if (operationResult.ResultType == OperationResultType.Error)
            {
                return(operationResult);
            }
            Simulation lastSimulation = SimulationFormService.Simulations().SingleOrDefault(s => s.RCARD == card);
            Res        res            = (Res)ResFormService.FindEntity(rescode).AppendData;

            lastSimulation.OpCode     = res.Op.OPCODE;
            lastSimulation.LACTION    = "Good";
            lastSimulation.ACTIONLIST = "Good";
            lastSimulation.MUSER      = usercode;
            int      nowOp  = Route2OpFormService.Route2Ops().SingleOrDefault(r => r.routeCode == lastSimulation.ROUTECODE && r.opCode == lastSimulation.OpCode).seq;
            Route2Op nextOp = Route2OpFormService.Route2Ops().Where(r => r.routeCode == lastSimulation.ROUTECODE && r.seq > nowOp).OrderByDescending(r => r.seq).FirstOrDefault();

            //是最后一道工序
            if (nextOp.opCode == res.Op.OPCODE)
            {
                lastSimulation.ISCOM = "1";
                Mo mo = (Mo)MoFormService.FindEntity(lastSimulation.MOCODE).AppendData;
                mo.MOACTQTY += 1;
                SimulationReportFormService.AddEntity(new SimulationReport(lastSimulation));
            }
            else
            {
                SimulationReportFormService.AddEntity(new SimulationReport(lastSimulation));
            }
            operationResult.Message = card + Properties.Resources.String_FrmGoodNGService_CollectSuccess;
            return(operationResult);
        }
Beispiel #2
0
        public OperationResult FindSnCheck(string moString)
        {
            if (moString == null)
            {
                return(new OperationResult(OperationResultType.Error, Properties.Resources.String_FrmGoodNGService_MoCanNotNull));
            }

            OperationResult operationResult = MoFormService.FindEntity(moString);

            if (operationResult.ResultType == OperationResultType.Success)
            {
                Mo           mo           = (Mo)operationResult.AppendData;
                Item2SnCheck item2SnCheck = Item2SnCheckFormService.Item2SnChecks().SingleOrDefault(i => i.ITEMCODE == mo.ITEMCODE);
                operationResult.AppendData = item2SnCheck;
            }
            return(operationResult);
        }
Beispiel #3
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);
        }
Beispiel #4
0
        public OperationResult CardGoMo(string moString, string lengthString, string prefixString, string card, string rescode, string usercode)
        {
            bool tbag = false;

            OperationResult operationResult = CardGoMoCheck(moString, lengthString, prefixString, card, rescode, usercode);

            if (operationResult.ResultType == OperationResultType.Error)
            {
                return(operationResult);
            }

            Mo               mo               = (Mo)MoFormService.FindEntity(moString).AppendData;
            Simulation       nowSimulation    = SimulationFormService.Simulations().SingleOrDefault(s => s.RCARD == card && s.MOCODE == mo.MoCode);
            SimulationReport simulationReport = new SimulationReport();
            Item             item             = ItemFormService.Items().SingleOrDefault(i => i.ITEMCODE == mo.ITEMCODE);

            if (nowSimulation == null)
            {
                nowSimulation = new Simulation();
                tbag          = true;
            }
            MoRcard moRcard = new MoRcard();


            //TBLSimulation
            nowSimulation.ROUTECODE     = mo.Route.ROUTECODE;
            nowSimulation.OpCode        = mo.Route.Ops.First().OPCODE;
            nowSimulation.LACTION       = "GOMO";
            nowSimulation.ACTIONLIST    = ";GOMO;";
            nowSimulation.RCARD         = card;
            nowSimulation.TCARD         = card;
            nowSimulation.TCARDSEQ      = 1;
            nowSimulation.SCARD         = card;
            nowSimulation.SCARDSEQ      = 1;
            nowSimulation.MOCODE        = mo.MoCode;
            nowSimulation.ITEMCODE      = mo.ITEMCODE;
            nowSimulation.MODELCODE     = item.Model.MODELCODE;
            nowSimulation.IDMERGERULE   = mo.IDMERGERULE;
            nowSimulation.ISCOM         = "0";
            nowSimulation.RESCODE       = rescode;
            nowSimulation.PRODUCTSTATUS = "GOOD";
            nowSimulation.FROMOP        = "";
            nowSimulation.FROMROUTE     = "";
            nowSimulation.CARTONCODE    = "";
            nowSimulation.LOTNO         = "";
            nowSimulation.PALLETCODE    = "";
            nowSimulation.NGTIMES       = 0;
            nowSimulation.ISHOLD        = 0;
            nowSimulation.MOSEQ         = mo.MOSEQ;
            nowSimulation.MUSER         = usercode;

            //TBLSimulationReport
            simulationReport.ROUTECODE     = mo.Route.ROUTECODE;
            simulationReport.OPCODE        = mo.Route.Ops.First().OPCODE;
            simulationReport.LACTION       = "GOMO";
            simulationReport.ACTIONLIST    = ";GOMO;";
            simulationReport.RCARD         = card;
            simulationReport.TCARD         = card;
            simulationReport.TCARDSEQ      = 1;
            simulationReport.SCARD         = card;
            simulationReport.SCARDSEQ      = 1;
            simulationReport.MOCODE        = mo.MoCode;
            simulationReport.ITEMCODE      = mo.ITEMCODE;
            simulationReport.MODELCODE     = item.Model.MODELCODE;
            simulationReport.IDMERGERULE   = mo.IDMERGERULE;
            simulationReport.ISCOM         = "0";
            simulationReport.RESCODE       = rescode;
            simulationReport.PRODUCTSTATUS = "GOOD";
            simulationReport.FROMOP        = "";
            simulationReport.FROMROUTE     = "";
            simulationReport.CARTONCODE    = "";
            simulationReport.LOTNO         = "";
            simulationReport.PALLETCODE    = "";
            simulationReport.NGTIMES       = 0;
            simulationReport.ISHOLD        = 0;
            simulationReport.MOSEQ         = mo.MOSEQ;
            simulationReport.MUSER         = usercode;

            //TBLONWIP

            //TBLMo
            mo.MOINPUTQTY = mo.MOINPUTQTY + 1;
            //TBLMoRcard
            moRcard.MoCode      = mo.MoCode;
            moRcard.Seq         = 1;
            moRcard.MoCardStart = card;
            moRcard.MoCardEnd   = card;
            moRcard.Muser       = usercode;
            moRcard.MoSeq       = mo.MOSEQ;

            MoFormService.UpdateEntity(mo, false);
            SimulationReportFormService.AddEntity(simulationReport, false);
            MoRcardFormService.AddEntity(moRcard, false);
            if (tbag)
            {
                SimulationFormService.AddEntity(nowSimulation);
            }
            else
            {
                SimulationFormService.UpdateEntity(nowSimulation);
            }

            operationResult.ResultType = OperationResultType.Success;
            operationResult.Message    = card + Properties.Resources.String_FrmGoodNGService_CollectSuccess;
            return(operationResult);
        }