Exemplo n.º 1
0
        private Domain.TS.TS GetNewTS(string runningCard, string partItemCode, string partRunningCard, string userCode)
        {
            SystemSettingFacade systemSettingFacade = new SystemSettingFacade(this.DataProvider);
            ShiftModelFacade    shiftModelFacade    = new ShiftModelFacade(this.DataProvider);
            ModelFacade         modelFacade         = new ModelFacade(this.DataProvider);
            TSFacade            tsFacade            = new TSFacade(this.DataProvider);
            DataCollectFacade   dataCollectFacade   = new DataCollectFacade(this.DataProvider);

            string sourceRCard = dataCollectFacade.GetSourceCard(runningCard.Trim().ToUpper(), string.Empty);

            DBDateTime       dbDateTime     = FormatHelper.GetNowDBDateTime(this.DataProvider);
            SimulationReport lastSimulation = dataCollectFacade.GetLastSimulationReport(sourceRCard);

            if (lastSimulation == null)
            {
                return(null);
            }

            Domain.TS.TS newTS = tsFacade.CreateNewTS();

            newTS.TSId                  = Guid.NewGuid().ToString();
            newTS.RunningCard           = partRunningCard;
            newTS.RunningCardSequence   = dataCollectFacade.GetMaxRCardSequenceFromTS(partRunningCard) + 100;
            newTS.TranslateCard         = partRunningCard;
            newTS.TranslateCardSequence = newTS.RunningCardSequence;
            newTS.SourceCard            = partRunningCard;
            newTS.SourceCardSequence    = newTS.RunningCardSequence;
            newTS.CardType              = CardType.CardType_Part;
            newTS.ReplacedRunningCard   = " ";

            newTS.ItemCode = partItemCode;
            Model model = (Model)modelFacade.GetModelByItemCode(partItemCode);

            if (model == null)
            {
                Parameter parameter = (Parameter)systemSettingFacade.GetParameter("PING", "DEFAULT_MODEL_CODE");
                if (parameter != null)
                {
                    newTS.ModelCode = parameter.ParameterAlias.Trim().ToUpper();
                }
            }
            else
            {
                newTS.ModelCode = model.ModelCode;
            }

            newTS.MOCode               = lastSimulation.MOCode;
            newTS.FromRouteCode        = lastSimulation.RouteCode;
            newTS.FromOPCode           = lastSimulation.OPCode;
            newTS.FromResourceCode     = lastSimulation.ResourceCode;
            newTS.FromSegmentCode      = lastSimulation.SegmentCode;
            newTS.FromStepSequenceCode = lastSimulation.StepSequenceCode;
            newTS.FromShiftTypeCode    = lastSimulation.ShiftTypeCode;
            newTS.MOSeq = lastSimulation.MOSeq;

            TimePeriod tp = (TimePeriod)shiftModelFacade.GetTimePeriod(newTS.FromShiftTypeCode, dbDateTime.DBTime);

            if (tp != null)
            {
                newTS.FromTimePeriodCode = tp.TimePeriodCode;
                newTS.FromShiftCode      = tp.ShiftCode;
                newTS.FromShiftDay       = shiftModelFacade.GetShiftDay(tp, dbDateTime.DateTime);
            }

            newTS.FromUser = userCode;
            newTS.FromDate = dbDateTime.DBDate;
            newTS.FormTime = dbDateTime.DBTime;

            newTS.MaintainUser = userCode;
            newTS.MaintainDate = dbDateTime.DBDate;
            newTS.MaintainTime = dbDateTime.DBTime;

            newTS.TSTimes           = tsFacade.GetMaxTSTimes(partRunningCard) + 1;
            newTS.FromInputType     = TSSource.TSSource_TS;
            newTS.TSStatus          = TSStatus.TSStatus_New;
            newTS.TransactionStatus = TransactionStatus.TransactionStatus_NO;

            return(newTS);
        }
Exemplo n.º 2
0
        private BenQGuru.eMES.Domain.TS.TS GetTS(RMADetial rmadetial)
        {
            BenQGuru.eMES.Domain.TS.TS itemTs = null;

            itemTs = new BenQGuru.eMES.Domain.TS.TS();
            if (_DataCollectFacade == null)
            {
                _DataCollectFacade = new DataCollectFacade(this.DataProvider);
            }

            itemTs.MOCode = "";

            itemTs.RMABillCode         = rmadetial.Rmabillcode;
            itemTs.RunningCard         = rmadetial.Rcard;
            itemTs.RunningCardSequence = 0;
            itemTs.TSId                  = FormatHelper.GetUniqueID("", itemTs.RunningCard, itemTs.RunningCardSequence.ToString());
            itemTs.TranslateCard         = rmadetial.Rcard;
            itemTs.TranslateCardSequence = 0;
            itemTs.CardType              = CardType.CardType_Product;
            itemTs.TSStatus              = TSStatus.TSStatus_New;
            itemTs.SourceCardSequence    = 0;
            itemTs.MaintainUser          = this.GetUserCode();
            itemTs.MaintainDate          = FormatHelper.TODateInt(DateTime.Now);
            itemTs.MaintainTime          = FormatHelper.TOTimeInt(DateTime.Now);
            itemTs.TSDate                = 0;
            itemTs.TSTime                = 0;
            itemTs.FromInputType         = TSFacade.TSSource_RMA;
            itemTs.FromUser              = itemTs.MaintainUser;
            itemTs.FromDate              = itemTs.MaintainDate;
            itemTs.FormTime              = itemTs.MaintainTime;
            itemTs.FromOPCode            = " ";
            itemTs.FromResourceCode      = " ";
            itemTs.FromRouteCode         = " ";
            itemTs.FromSegmentCode       = " ";
            itemTs.FromShiftCode         = " ";
            itemTs.FromShiftDay          = FormatHelper.TODateInt(DateTime.Now);
            itemTs.FromShiftTypeCode     = " ";
            itemTs.FromStepSequenceCode  = " ";
            itemTs.FromTimePeriodCode    = " ";
            itemTs.FromSegmentCode       = " ";
            itemTs.TSTimes               = _TSFacade.GetMaxTSTimes(rmadetial.Rcard) + 1;
            itemTs.ItemCode              = rmadetial.Itemcode;
            itemTs.ModelCode             = rmadetial.Modelcode;
            itemTs.TransactionStatus     = " ";


            if (_ReportFacade == null)
            {
                _ReportFacade = new BenQGuru.eMES.Report.ReportFacade(this.DataProvider);
            }
            object obmTimeDimension = _ReportFacade.GetTimeDimension(itemTs.FromShiftDay);

            if (obmTimeDimension != null)
            {
                itemTs.Week  = (obmTimeDimension as Domain.Report.TimeDimension).Week;
                itemTs.Month = (obmTimeDimension as Domain.Report.TimeDimension).Month;
            }
            else
            {
                itemTs.Week  = 0;
                itemTs.Month = 0;
            }

            if (_MOFacade == null)
            {
                _MOFacade = new MOFacade(this.DataProvider);
            }
            object objmo = _MOFacade.GetMO(rmadetial.Remocode);

            if (objmo == null)
            {
                itemTs.MOSeq = 0;
            }
            else
            {
                itemTs.MOSeq = (objmo as MO).MOSeq;
            }
            return(itemTs);
        }