예제 #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);
        }
예제 #2
0
        public OperationResult ActionGoodCheck(string usercode, string rescode, string card)
        {
            ActionGoodModel model = new ActionGoodModel {
                userCode = usercode, resCode = rescode, card = card
            };

            Validator.ValidateObject(model, new ValidationContext(model));
            OperationResult operationResult = new OperationResult(OperationResultType.Error);
            Simulation      lastSimulation  = SimulationFormService.Simulations().SingleOrDefault(s => s.RCARD == card);

            if (lastSimulation == null)
            {
                operationResult.Message = card + Properties.Resources.String_FrmGoodNGService_SnHadNotInMo;
                return(operationResult);
            }
            if (lastSimulation.ISCOM == "1")
            {
                operationResult.Message = card + Properties.Resources.String_FrmGoodNGService_SnHadFinish;
                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);
                }
            }

            //throw new Exception("产品维修中");

            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).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);
        }
예제 #3
0
        public OperationResult ActionNg(string card, string usercode, string rescode, string selectedEcg, string selectedEc)
        {
            OperationResult operationResult = ActionNgCheck(card, usercode, rescode, selectedEcg, selectedEc);

            if (operationResult.ResultType == OperationResultType.Error)
            {
                return(operationResult);
            }
            //TBLSIMULATION
            Simulation simulation = SimulationFormService.Simulations().SingleOrDefault(s => s.RCARD == card);
            DateTime   dt         = DateTime.Now;

            simulation.LOTNO         = null;
            simulation.PRODUCTSTATUS = "NG";
            simulation.LACTION       = "NG";
            simulation.ACTIONLIST   += "NG;";
            simulation.NGTIMES      += 1;
            simulation.MUSER         = usercode;
            simulation.MDATE         = Convert.ToInt32("" + dt.Year + dt.Day);
            simulation.MTIME         = Convert.ToInt32("" + dt.Hour + dt.Minute + dt.Second);

            //tblsimulationreport
            SimulationReport simulationReport = new SimulationReport(simulation);

            //TBLTS
            Ts ts = new Ts();

            // ts.TSID = card + DateTime.Now.ToString();
            ts.rcard         = card;
            ts.rcardseq      = 1;                  //固定
            ts.tcard         = card;
            ts.tcardseq      = 1;                  //固定
            ts.scard         = card;
            ts.scardseq      = 1;                  //固定
            ts.cardtype      = "cardtype_product"; //固定
            ts.modelcode     = simulation.MODELCODE;
            ts.itemcode      = simulation.ITEMCODE;
            ts.mocode        = simulation.MOCODE;
            ts.frmroutecode  = simulation.ROUTECODE;
            ts.frmopcode     = ResFormService.Ress().SingleOrDefault(r => r.RESCODE == rescode).Op.OPCODE;
            ts.frmsegcode    = "ZJ";
            ts.frmsscode     = "A1";
            ts.crescode      = rescode;
            ts.shifttypecode = "OS";
            ts.shiftcode     = "OS1";
            ts.tpcode        = "OS1-01";
            ts.shiftday      = 20140624;
            ts.frmuser       = usercode;
            ts.frmdate       = Convert.ToInt32("" + dt.Year + dt.Day);
            ts.frmtime       = Convert.ToInt32("" + dt.Hour + dt.Minute + dt.Second);
            ts.frminputtype  = "tssource_onwip";
            ts.tstimes      += 1;
            //ts.tsstatus = TsStatus.NEW;
            ts.tsstatus        = TsStatus.NEW;
            ts.tsdate          = 0;
            ts.tstimes         = 0;
            ts.confirmtime     = 0;
            ts.confirmdate     = 0;
            ts.transstatus     = "none";
            ts.muser           = usercode;
            ts.mdate           = Convert.ToInt32("" + dt.Year + dt.Day);
            ts.mtime           = Convert.ToInt32("" + dt.Hour + dt.Minute + dt.Second);
            ts.frmmonth        = dt.Month;
            ts.frmweek         = dt.DayOfYear / 7 + 1;
            ts.frmoutroutecode = simulation.ROUTECODE;
            ts.moseq           = simulation.MOSEQ;
            ts.tsrepairmdate   = 0;
            ts.tsrepairmtime   = 0;
            //TBLTSERRORCODE
            TsErrorCode tsErrorCode = new TsErrorCode();

            tsErrorCode.ts        = ts;
            tsErrorCode.errorCode = (ErrorCode)EcFormService.FindEntity("ecode1").AppendData;
            tsErrorCode.muser     = usercode;
            tsErrorCode.mdate     = Convert.ToInt32("" + dt.Year + dt.Day);
            tsErrorCode.mtime     = Convert.ToInt32("" + dt.Hour + dt.Minute + dt.Second);



            //update tbllot
            //delete from tbllot2card

            //insert into tblonwip

            //update      tblrptre allineqty
            //insert into tblrptre secg
            //insert into tblrptre allineecqty
            //insert into tblrpthisopqty


            SimulationReportFormService.AddEntity(simulationReport, false);
            TsFormService.AddEntity(ts, false);
            TsErrorCodeFormService.AddEntity(tsErrorCode);
            operationResult.Message = card + Properties.Resources.String_FrmGoodNGService_CollectSuccess;
            return(operationResult);
        }