예제 #1
0
        private void WriteSoftwareInfo(SoftwareActionEventArgs actionEventArgs, DataCollectFacade facade, ActionCheckStatus actionCheckStatus)
        {
            SimulationReport report = actionEventArgs.ProductInfo.NowSimulationReport;

            OnWIPSoftVersion onWIPSoftVersion = facade.CreateNewOnWIPSoftVersion();

            onWIPSoftVersion.SoftwareVersion     = actionEventArgs.SoftwareVersion;
            onWIPSoftVersion.SoftwareName        = actionEventArgs.SoftwareName;
            onWIPSoftVersion.RunningCard         = report.RunningCard;
            onWIPSoftVersion.RunningCardSequence = report.RunningCardSequence;
            onWIPSoftVersion.MOCode           = report.MOCode;
            onWIPSoftVersion.ItemCode         = report.ItemCode;
            onWIPSoftVersion.ResourceCode     = report.ResourceCode;
            onWIPSoftVersion.OPCode           = report.OPCode;
            onWIPSoftVersion.RouteCode        = report.RouteCode;
            onWIPSoftVersion.ModelCode        = report.ModelCode;
            onWIPSoftVersion.MaintainDate     = report.MaintainDate;
            onWIPSoftVersion.MaintainTime     = report.MaintainTime;
            onWIPSoftVersion.MaintainUser     = report.MaintainUser;
            onWIPSoftVersion.ShiftTypeCode    = report.ShiftTypeCode;
            onWIPSoftVersion.StepSequenceCode = report.StepSequenceCode;
            onWIPSoftVersion.SegmnetCode      = report.SegmentCode;
            onWIPSoftVersion.ShiftCode        = report.ShiftCode;
            onWIPSoftVersion.TimePeriodCode   = report.TimePeriodCode;
            onWIPSoftVersion.MOSeq            = report.MOSeq; // Added by Icyer 2007/07/02

            if (actionCheckStatus == null || actionCheckStatus.NeedUpdateSimulation == true)
            {
                facade.AddOnWIPSoftVersion(onWIPSoftVersion);
            }
            else
            {
                actionEventArgs.OnWIP.Add(onWIPSoftVersion);
            }
        }
예제 #2
0
        private void WriteECNInfo(EcnTryActionEventArgs actionEventArgs, DataCollectFacade facade, ActionCheckStatus actionCheckStatus)
        {
            SimulationReport report = actionEventArgs.ProductInfo.NowSimulationReport;

            OnWIPECN onWIPECN = facade.CreateNewOnWIPECN();

            onWIPECN.ECNNO               = actionEventArgs.ECNNo;
            onWIPECN.RunningCard         = report.RunningCard;
            onWIPECN.RunningCardSequence = report.RunningCardSequence;
            onWIPECN.MOCode              = report.MOCode;
            onWIPECN.ItemCode            = report.ItemCode;
            onWIPECN.ResourceCode        = report.ResourceCode;
            onWIPECN.OPCode              = report.OPCode;
            onWIPECN.RouteCode           = report.RouteCode;
            onWIPECN.ModelCode           = report.ModelCode;
            onWIPECN.MaintainDate        = report.MaintainDate;
            onWIPECN.MaintainTime        = report.MaintainTime;
            onWIPECN.MaintainUser        = report.MaintainUser;
            onWIPECN.ShiftTypeCode       = report.ShiftTypeCode;
            onWIPECN.StepSequenceCode    = report.StepSequenceCode;
            onWIPECN.SegmnetCode         = report.SegmentCode;
            onWIPECN.ShiftCode           = report.ShiftCode;
            onWIPECN.TimePeriodCode      = report.TimePeriodCode;
            onWIPECN.MOSeq               = report.MOSeq; // Added by Icyer 2007/07/02

            if (actionCheckStatus == null || actionCheckStatus.NeedUpdateSimulation == true)
            {
                facade.AddOnWIPECN(onWIPECN);
            }
            else
            {
                actionEventArgs.OnWIP.Add(onWIPECN);
            }
        }
예제 #3
0
        //检查此Rcard所属栈板下Rcard在同一垛位下
        private bool CheckRcardIsInTheSameStack(string pallet, string stackCode)
        {
            InventoryFacade   inventoryFacade   = new InventoryFacade(this.DataProvider);
            PackageFacade     packageFacade     = new PackageFacade(this.DataProvider);
            DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider);

            object[] pallet2RCardList = packageFacade.GetPallet2RCardListByPallet(pallet);
            if (pallet2RCardList == null)
            {
                return(true);
            }

            for (int i = 0; i < pallet2RCardList.Length; i++)
            {
                string           cartonCode       = string.Empty;
                SimulationReport simulationReport = (SimulationReport)dataCollectFacade.GetLastSimulationReport(((Pallet2RCard)pallet2RCardList[i]).RCard);
                if (simulationReport != null)
                {
                    cartonCode = simulationReport.CartonCode;
                }

                object[] stack2RcardList = inventoryFacade.QueryStacktoRcardByRcardAndCarton(((Pallet2RCard)pallet2RCardList[i]).RCard, cartonCode);
                if (stack2RcardList != null && !((StackToRcard)stack2RcardList[0]).StackCode.Equals(stackCode))
                {
                    ApplicationRun.GetInfoForm().Add(
                        new UserControl.Message(MessageType.Error, "$CS_RCARD_IS_NOT_INSAME_STACK:" + ((StackToRcard)stack2RcardList[0]).StackCode));
                    return(false);
                }
            }

            return(true);
        }
예제 #4
0
        /// <summary>
        /// Undo时更新Simulation数据
        /// </summary>
        private void UndoNGSimulation(Simulation simulation, bool isNG, OnWIP wip)
        {
            // 更新Simulation
            DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider);
            string            lastAction        = wip.Action;

            simulation.LastAction = lastAction;
            string[] actionList = simulation.ActionList.Split(';');
            simulation.ActionList    = string.Join(";", actionList, 0, actionList.Length - 2) + ";";
            simulation.ProductStatus = wip.ActionResult;
            if (isNG == true)
            {
                simulation.NGTimes = simulation.NGTimes - 1;
            }
            simulation.IsComplete = FormatHelper.BooleanToString(false);
            //simulation.RunningCardSequence = wip.RunningCardSequence;		// 保留测试信息
            dataCollectFacade.UpdateSimulation(simulation);
            // 更新SimulationReport
            SimulationReport simulationReport = (SimulationReport)dataCollectFacade.GetLastSimulationReport(simulation.RunningCard);

            simulationReport.LastAction = lastAction;
            simulationReport.Status     = wip.ActionResult;
            if (isNG == true)
            {
                simulationReport.NGTimes = simulationReport.NGTimes - 1;
            }
            simulationReport.IsComplete = FormatHelper.BooleanToString(false);
            //simulationReport.RunningCardSequence = wip.RunningCardSequence;		// 保留测试信息
            dataCollectFacade.UpdateSimulationReport(simulationReport);
        }
예제 #5
0
        private void WriteTryInfo(EcnTryActionEventArgs actionEventArgs, DataCollectFacade facade, ActionCheckStatus actionCheckStatus)
        {
            SimulationReport report = actionEventArgs.ProductInfo.NowSimulationReport;

            List <string> TryList = new List <string>();

            if (actionEventArgs.TryNo.Trim().Length > 0)
            {
                string TryCode = actionEventArgs.TryNo.Trim();
                if (TryCode.IndexOf(",") >= 0)
                {
                    string[] TryCodeList = TryCode.Split(',');
                    for (int i = 0; i < TryCodeList.Length; i++)
                    {
                        TryList.Add(TryCodeList[i]);
                    }
                }
                else
                {
                    TryList.Add(TryCode);
                }
            }

            if (TryList.Count > 0)
            {
                for (int i = 0; i < TryList.Count; i++)
                {
                    OnWIPTRY onWIPTRY = facade.CreateNewOnWIPTRY();

                    onWIPTRY.TRYNO               = TryList[i].ToString().ToUpper();
                    onWIPTRY.RunningCard         = report.RunningCard;
                    onWIPTRY.RunningCardSequence = report.RunningCardSequence;
                    onWIPTRY.MOCode              = report.MOCode;
                    onWIPTRY.ItemCode            = report.ItemCode;
                    onWIPTRY.ResourceCode        = report.ResourceCode;
                    onWIPTRY.OPCode              = report.OPCode;
                    onWIPTRY.RouteCode           = report.RouteCode;
                    onWIPTRY.ModelCode           = report.ModelCode;
                    onWIPTRY.MaintainDate        = report.MaintainDate;
                    onWIPTRY.MaintainTime        = report.MaintainTime;
                    onWIPTRY.MaintainUser        = report.MaintainUser;
                    onWIPTRY.ShiftTypeCode       = report.ShiftTypeCode;
                    onWIPTRY.StepSequenceCode    = report.StepSequenceCode;
                    onWIPTRY.SegmnetCode         = report.SegmentCode;
                    onWIPTRY.ShiftCode           = report.ShiftCode;
                    onWIPTRY.TimePeriodCode      = report.TimePeriodCode;
                    onWIPTRY.MOSeq               = report.MOSeq; // Added by Icyer 2007/07/02

                    if (actionCheckStatus == null || actionCheckStatus.NeedUpdateSimulation == true)
                    {
                        facade.AddOnWIPTRY(onWIPTRY);
                    }
                    else
                    {
                        actionEventArgs.OnWIP.Add(onWIPTRY);
                    }
                }
            }
        }
예제 #6
0
 public ReportingService(IMapper mapper)
 {
     this.mapper = mapper;
     report      = new SimulationReport()
     {
         Iterations = new List <SimulationReportRoundIterationItem>()
         {
             new SimulationReportRoundIterationItem(currentIterationNumber)
         }
     };
 }
예제 #7
0
        protected override DataRow GetGridRow(object obj)
        {
            SimulationReport sr  = obj as SimulationReport;
            DataRow          row = DtSource.NewRow();

            row["RunningCard"] = sr.RunningCard;
            row["OPCode"]      = sr.OPCode;
            row["Status"]      = this.languageComponent1.GetString(sr.Status);
            row["Line"]        = sr.StepSequenceCode;
            row["ResCode"]     = sr.ResourceCode;
            row["TestDate"]    = FormatHelper.ToDateString(sr.MaintainDate);
            row["TestTime"]    = FormatHelper.ToTimeString(sr.MaintainTime);
            return(row);
        }
예제 #8
0
        protected override string[] FormatExportRecord(object obj)
        {
            SimulationReport sr = obj as SimulationReport;

            return(new string[] {
                sr.RunningCard,
                sr.OPCode,
                this.languageComponent1.GetString(sr.Status),
                sr.StepSequenceCode,
                sr.ResourceCode,
                FormatHelper.ToDateString(sr.MaintainDate),
                FormatHelper.ToTimeString(sr.MaintainTime)
            });
        }
예제 #9
0
        /// <summary>
        /// Запуск симуляции
        /// </summary>
        /// <param name="graph">Граф</param>
        /// <param name="start">Начальная вершина</param>
        /// <param name="end">Конечная вершина</param>
        /// <param name="settings">Настройки симуляции</param>
        /// <param name="progress">Програсс симуляции</param>
        public SimulationReport Simulate(Graph.Graph graph, Vertex start, Vertex end, SimulationSettings settings, IProgress <int> progress = null)
        {
            var failureTimes = new List <double>();
            var repairTimes  = new List <double>();
            var cGraph       = new ComputationGraph(graph, _pathFinder, start, end);


            // Симуляция
            for (int i = 0; i < settings.NumRuns; i++)
            {
                cGraph.Reset();
                var rep = RunIteration(cGraph, settings);

                // Все, что больше MaxTime - мусор
                if (rep.FailureTime <= settings.MaxTime)
                {
                    failureTimes.Add(rep.FailureTime);
                }

                repairTimes.AddRange(rep.RepairTimes);

                progress?.Report((int)(i / (float)settings.NumRuns * 100));
            }

            // Формирование отчета
            var report = new SimulationReport();

            report.MinFailureTime     = failureTimes.Min();
            report.MaxFailureTime     = failureTimes.Max();
            report.AverageFailureTime = failureTimes.Average();
            report.AverageRepairTime  = repairTimes.Count > 0 ? repairTimes.Average() : 0;
            report.AvailabilityRate   = report.AverageFailureTime / (report.AverageFailureTime + report.AverageRepairTime);
            report.Pathes             = cGraph.Pathes;
            // TODO: Вероятность безотказной работы системы
            // TODO: Гррафик зависимости безотказной работы системы от времени Pc(t)
            report.FailureBarChart = ToHistogram(failureTimes, settings.BarChartCount, report.MinFailureTime, report.MaxFailureTime);

            if (repairTimes.Count > 0)
            {
                report.RepairBarChart = ToHistogram(repairTimes, settings.BarChartCount);
            }

            // Отдельный запуск для сохранения диаграммы восстановления
            cGraph.Reset();
            report.TimeDiagram = RunIteration(cGraph, settings, true).TimeDiagram;

            progress?.Report(100);

            return(report);
        }
예제 #10
0
        protected override DataRow GetGridRow3(object obj)
        {
            SimulationReport s = obj as SimulationReport;
            //return new Infragistics.WebUI.UltraWebGrid.UltraGridRow(
            //    new object[]{
            //                    s.RunningCard,
            //                    s.ItemCode,
            //                    s.MOCode
            //                }
            //    );
            DataRow row = this.DtSource3.NewRow();

            row["RCard"]    = 1;
            row["ItemCode"] = 1;
            row["MOCode"]   = 1;
            return(row);
        }
예제 #11
0
 private void _helper_DomainObjectToExportRow(object sender, EventArgs e)
 {
     if ((e as DomainObjectToExportRowEventArgs).DomainObject != null)
     {
         SimulationReport obj = (SimulationReport)((DomainObjectToExportRowEventArgs)e).DomainObject;
         (e as DomainObjectToExportRowEventArgs).ExportRow =
             new string[] {
             obj.RunningCard,
             obj.MOCode,
             obj.ItemCode,
             obj.OPCode,
             obj.StepSequenceCode,
             obj.ResourceCode,
             obj.MaintainUser,
             FormatHelper.ToDateString(obj.MaintainDate),
             FormatHelper.ToTimeString(obj.MaintainTime)
         };
     }
 }
예제 #12
0
 private void _helper_DomainObjectToGridRow(object sender, EventArgs e)
 {
     if ((e as DomainObjectToGridRowEventArgs).DomainObject != null)
     {
         SimulationReport obj = (e as DomainObjectToGridRowEventArgs).DomainObject as SimulationReport;
         (e as DomainObjectToGridRowEventArgs).GridRow =
             new UltraGridRow(new object[] {
             obj.RunningCard,
             obj.MOCode,
             obj.ItemCode,
             obj.OPCode,
             obj.StepSequenceCode,
             obj.ResourceCode,
             obj.MaintainUser,
             FormatHelper.ToDateString(obj.MaintainDate),
             FormatHelper.ToTimeString(obj.MaintainTime)
         }
                              );
     }
 }
예제 #13
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);
        }
        public async Task <SimulationReportModel> GetReportAsync(string indexName)
        {
            SimulationReport simulationReport = await _simulationService.GetReportAsync(indexName);

            return(Mapper.Map <SimulationReportModel>(simulationReport));
        }
예제 #15
0
        /// <summary>
        /// 序列号转换采集,只支持分板,不支持合板
        /// </summary>
        /// <param name="domainDataProvider"></param>
        /// <param name="iD"></param>
        /// <param name="actionType"></param>
        /// <param name="resourceCode"></param>
        /// <param name="userCode"></param>
        /// <param name="product"></param>
        /// <param name="datas1">转换后的ID组</param>
        /// <param name="datas2">NULL</param>
        /// <returns></returns>
        public Messages Execute(ActionEventArgs actionEventArgs)
        {
            // Added by Icyer 2006/10/08
            if (((SplitIDActionEventArgs)actionEventArgs).IsUndo == true)
            {
                return(this.UndoExecute((SplitIDActionEventArgs)actionEventArgs));
            }
            // Added end

            Messages         messages         = new Messages();
            DataCollectDebug dataCollectDebug = new DataCollectDebug(this.GetType().ToString() + "Collect");

            dataCollectDebug.WhenFunctionIn(messages);
            try
            {
                if (((SplitIDActionEventArgs)actionEventArgs).SplitedIDs == null || ((SplitIDActionEventArgs)actionEventArgs).SplitedIDs.Length == 0)
                {
                    throw new Exception("$CS_System_Params_Losted");
                }

                ActionOnLineHelper helper            = new ActionOnLineHelper(this.DataProvider);
                DataCollectFacade  dataCollectFacade = new DataCollectFacade(this.DataProvider);

                //laura:  GetLastSimulation into NowSimulation
                string sourcCard = actionEventArgs.ProductInfo.LastSimulation.RunningCard.ToUpper();

                //GetLastSimulation 是获取当前open工单中的一笔,GetSimulation 是获取所有simulation中mdate 最晚的一笔。
                Simulation objSimulation = dataCollectFacade.GetSimulation(sourcCard) as Simulation;
                if (objSimulation == null)
                {
                    throw new Exception("rcard in simulation not existed!");
                }
                actionEventArgs.ProductInfo.NowSimulation = objSimulation;

                //laura:  GetLastSimulationReport into NowSimulationReport
                SimulationReport objSimulationReport = dataCollectFacade.GetLastSimulationReport(sourcCard) as SimulationReport;
                if (objSimulationReport == null)
                {
                    throw new Exception("rcard in simulationreport not existed!");
                }
                actionEventArgs.ProductInfo.NowSimulationReport = objSimulationReport;

                //laura:  如果需要,补充 ProductInfo 信息
                //to-do...

                //
                actionEventArgs.ProductInfo.NowSimulation.IDMergeRule           = 1; //actionEventArgs.ProductInfo.NowSimulation.IDMergeRule/((SplitIDActionEventArgs)actionEventArgs).SplitedIDs.Length;
                actionEventArgs.ProductInfo.NowSimulation.TranslateCard         = actionEventArgs.ProductInfo.LastSimulation.RunningCard;
                actionEventArgs.ProductInfo.NowSimulation.TranslateCardSequence = actionEventArgs.ProductInfo.LastSimulation.RunningCardSequence;
                actionEventArgs.ProductInfo.NowSimulation.NGTimes = actionEventArgs.ProductInfo.LastSimulation.NGTimes;

                for (int i = 0; i < ((SplitIDActionEventArgs)actionEventArgs).SplitedIDs.Length; i++)
                {
                    //修改SIMULATION
                    //Laws Lu,2005/08/15,新增	完工逻辑,在其他Check都通过的情况下,所有的RunningCard应该是GOOD状态
                    //暂时不考虑线外工序
                    if (actionEventArgs.ProductInfo.NowSimulation.RouteCode != "" && dataCollectFacade.OPIsMORouteLastOP(
                            actionEventArgs.ProductInfo.NowSimulation.MOCode
                            , actionEventArgs.ProductInfo.NowSimulation.RouteCode
                            , actionEventArgs.ProductInfo.NowSimulation.OPCode))
                    {
                        actionEventArgs.ProductInfo.NowSimulation.IsComplete  = "1";
                        actionEventArgs.ProductInfo.NowSimulation.EAttribute1 = "GOOD";
                    }
                    //End Laws Lu
                    actionEventArgs.ProductInfo.NowSimulation.RunningCard = ((SplitIDActionEventArgs)actionEventArgs).SplitedIDs[i].ToString();
                    /* added by jessie lee,如果是 序列号转换 */
                    if (string.Compare((actionEventArgs as SplitIDActionEventArgs).IDMergeType, IDMergeType.IDMERGETYPE_IDMERGE, true) == 0)
                    {
                        /* 转换到同一张工单 */
                        if ((actionEventArgs as SplitIDActionEventArgs).UpdateSimulation)
                        {
                            actionEventArgs.ProductInfo.NowSimulation.RunningCardSequence
                                = (actionEventArgs as SplitIDActionEventArgs).ExistIMEISeq + 10;
                        }
                        else
                        {
                            actionEventArgs.ProductInfo.NowSimulation.RunningCardSequence = ActionOnLineHelper.StartSeq;
                        }
                    }
                    else
                    {
                        /* 不是 序列号转换 */
                        actionEventArgs.ProductInfo.NowSimulation.RunningCardSequence = ActionOnLineHelper.StartSeq;
                    }
                    actionEventArgs.ProductInfo.NowSimulation.MOSeq = actionEventArgs.ProductInfo.LastSimulation.MOSeq;     // Added by Icyer 2007/07/03

                    //messages.AddMessages(helper.Execute(actionEventArgs));
                    //messages.AddMessages(helper.Execute(actionEventArgs, true,false));  //线外工序,不用 insert tblonwip。

                    if (messages.IsSuccess())
                    {
                        //#region 将ID添加到MO2RCARDLINK范围表内
                        DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider);
                        //MOFacade _MOFacade = new MOFacade(this.DataProvider);
                        //MO2RCARDLINK mo2cardlink = new MO2RCARDLINK();
                        //mo2cardlink.MOCode = actionEventArgs.ProductInfo.NowSimulation.MOCode;
                        //mo2cardlink.RCard = ((SplitIDActionEventArgs)actionEventArgs).SplitedIDs[i].ToString().Trim().ToUpper();
                        //mo2cardlink.MDate = dbDateTime.DBDate;
                        //mo2cardlink.MUser = actionEventArgs.UserCode;
                        //mo2cardlink.MTime = dbDateTime.DBTime;
                        //mo2cardlink.PrintTimes = 0;
                        //mo2cardlink.LastPrintUSER = "";
                        //mo2cardlink.LastPrintDate = 0;
                        //mo2cardlink.LastPrintTime = 0;
                        //_MOFacade.AddMO2RCardLink(mo2cardlink);
                        //#endregion

                        #region 将ID添加到SplitBoard
                        SplitBoard splitBorad = new SplitBoard();
                        splitBorad.Seq           = actionEventArgs.ProductInfo.NowSimulation.RunningCardSequence;
                        splitBorad.Mocode        = actionEventArgs.ProductInfo.NowSimulation.MOCode;
                        splitBorad.Rcard         = ((SplitIDActionEventArgs)actionEventArgs).SplitedIDs[i].ToString().Trim().ToUpper();
                        splitBorad.Modelcode     = actionEventArgs.ProductInfo.NowSimulation.ModelCode;
                        splitBorad.Itemcode      = actionEventArgs.ProductInfo.NowSimulation.ItemCode;
                        splitBorad.Opcode        = actionEventArgs.ProductInfo.NowSimulation.OPCode;
                        splitBorad.Rescode       = actionEventArgs.ResourceCode;
                        splitBorad.Routecode     = actionEventArgs.ProductInfo.NowSimulation.RouteCode;
                        splitBorad.Scard         = actionEventArgs.ProductInfo.NowSimulation.SourceCard;
                        splitBorad.Segcode       = actionEventArgs.ProductInfo.NowSimulationReport.SegmentCode;
                        splitBorad.Shiftcode     = actionEventArgs.ProductInfo.NowSimulationReport.ShiftCode;
                        splitBorad.Shifttypecode = actionEventArgs.ProductInfo.NowSimulationReport.ShiftTypeCode;
                        splitBorad.Sscode        = actionEventArgs.ProductInfo.NowSimulationReport.StepSequenceCode;
                        splitBorad.Tpcode        = actionEventArgs.ProductInfo.NowSimulationReport.TimePeriodCode;
                        splitBorad.Muser         = actionEventArgs.UserCode;
                        splitBorad.Mdate         = dbDateTime.DBDate;
                        splitBorad.Mtime         = dbDateTime.DBTime;
                        dataCollectFacade.AddSplitBoard(splitBorad);
                        #endregion
                    }
                }
                //}
            }
            catch (Exception e)
            {
                messages.Add(new Message(e));
            }
            dataCollectDebug.WhenFunctionOut(messages);
            return(messages);
        }
예제 #16
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);
        }
예제 #17
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);
        }
예제 #18
0
        private void ucLabelEditRcard_TxtboxKeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == '\r')
            {
                dtSource.Clear();
                DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider);
                //转换成起始序列号
                string sourceCard = dataCollectFacade.GetSourceCard(this.ucLabelEditRcard.Value.ToString().ToUpper().Trim(), string.Empty);
                //end
                object objSimulationReport = dataCollectFacade.GetLastSimulationReport(sourceCard);
                if (objSimulationReport != null)
                {
                    SimulationReport simulationReport = objSimulationReport as SimulationReport;
                    if (simulationReport.IsComplete.Equals("1"))
                    {
                        ucMessageInfo.AddEx(null, this.ucLabelEditRcard.Value, new UserControl.Message(MessageType.Error, "$Error_RunningCard_IsCompelete"), true);
                        this.ucLabelEditRcard.TextFocus(false, true);
                        return;
                    }
                    this.ucLabelEditItemCode.Value = simulationReport.ItemCode;
                    this.ucLabelEditOp.Value       = simulationReport.OPCode;
                    this.ucLabelEditRout.Value     = simulationReport.RouteCode;
                    object objMo   = moFacade.GetMO(simulationReport.MOCode);
                    object objItem = itemFacade.GetItem(simulationReport.ItemCode, ((MO)objMo).OrganizationID);
                    this.ucLabelEditName.Value = ((Item)objItem).ItemName;
                    object[] objOperation = null;
                    if (simulationReport.Status.Equals("GOOD"))
                    {
                        objOperation = itemFacade.QueryItemRoute2Operation(simulationReport.ItemCode, simulationReport.RouteCode);
                        CheckNextOp(simulationReport.MOCode, simulationReport.RouteCode, simulationReport.OPCode);
                    }
                    if (simulationReport.Status.Equals("NG"))
                    {
                        TSFacade tsFacade = new TSFacade(this.DataProvider);
                        object   objTs    = tsFacade.QueryLastTSByRunningCard(sourceCard);
                        if (objTs != null)
                        {
                            string refRouteCode = ((Domain.TS.TS)objTs).ReflowRouteCode;
                            string refOpCode    = ((Domain.TS.TS)objTs).ReflowOPCode;
                            if (refRouteCode == string.Empty || refOpCode == string.Empty)
                            {
                                objOperation = itemFacade.QueryItemRoute2Operation(simulationReport.ItemCode, simulationReport.RouteCode);
                                CheckNextOp(simulationReport.MOCode, simulationReport.RouteCode, simulationReport.OPCode);
                            }
                            else
                            {
                                this.ucLabelEditOp.Value = ((Domain.TS.TS)objTs).ConfirmOPCode;
                                objOperation             = itemFacade.QueryItemRoute2Operation(simulationReport.ItemCode, refRouteCode);
                                BaseModelFacade baseModelFacade = new BaseModelFacade(this.DataProvider);
                                object          objOP2Res       = baseModelFacade.GetOperationByResource(ApplicationService.Current().ResourceCode);
                                string          opCode2Res      = string.Empty;
                                if (objOP2Res != null)
                                {
                                    opCode2Res = ((Operation2Resource)objOP2Res).OPCode;
                                }
                                _NextOP = refOpCode;
                                if (opCode2Res != refOpCode)
                                {
                                    string opDesc = ((Operation)baseModelFacade.GetOperation(refOpCode)).OPDescription;
                                    ucMessageInfo.AddEx(null, this.ucLabelEditRcard.Value, new UserControl.Message(MessageType.Error, "$Error_Please_Send_Rcard_To " + opDesc + " $CS_Param_OPCode"), true);
                                }
                            }
                        }
                    }

                    if (objOperation != null)
                    {
                        foreach (Operation operation in objOperation)
                        {
                            DataRow dr = dtSource.NewRow();
                            dr["opCode"]        = operation.OPCode;
                            dr["opDescription"] = operation.OPDescription;
                            dtSource.Rows.Add(dr);
                        }
                        ultraGridHead.DataSource = dtSource;
                    }
                }
                else
                {
                    this.ucLabelEditItemCode.Value = "";
                    this.ucLabelEditOp.Value       = "";
                    this.ucLabelEditRout.Value     = "";
                    this.ucLabelEditName.Value     = "";
                    ucMessageInfo.AddEx(null, this.ucLabelEditRcard.Value, new UserControl.Message(MessageType.Error, "$Error_ProductInfo_IS_Null"), true);
                }
                this.ucLabelEditRcard.TextFocus(false, true);
            }
        }
 public SimulationReportViewModel(SimulationReport report)
 {
     _finishedCaseCount = report?.FinishedCases.Count ?? 0;
 }
 private void ProcessProgressReport(SimulationReport SR, EventArgs e)
 {
     this.CheckCurrentProgress(SR.CurrentProgress);
 }
예제 #21
0
        private void ucBtnOK_Click(object sender, System.EventArgs e)
        {
            if (this.ucLERunningCard.Value.Trim() == string.Empty)
            {
                //Laws Lu,2005/08/11,新增焦点设置
                ucLERunningCard.TextFocus(true, true);
                return;
            }

            this.ucMessage.Add(string.Format("<< {0}", this.ucLERunningCard.Value.Trim().ToUpper()));

            // 输入分板前产品序列号
            if (this._currSequence == 0)
            {
                #region 工单、序列号匹配
                _runningCardList = new ArrayList();

                if (this.txtMoCode.Checked)
                {
                    if (string.IsNullOrEmpty(txtMoCode.Value.ToUpper().Trim()))
                    {
                        this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$CS_Please_Input_MOCode"));
                        this.ucLERunningCard.Value = "";

                        //Laws Lu,2005/08/11,新增焦点设置
                        txtMoCode.Focus();
                        return;
                    }
                }

                //Laws Lu,2005/10/19,新增	缓解性能问题
                //Laws Lu,2006/12/25 修改	减少Open/Close的次数
                ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.CloseConnection();
                ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.AutoCloseConnection = true;
                //added by jessie lee, 2005/11/29
                #region 判断转换前序列号是否符合条件
                //长度检查
                if (bCardTransLenULE.Checked)
                {
                    if (bCardTransLenULE.Value.Trim().Length == 0)
                    {
                        this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$CS_Before_Card_Transfer_Empty"));
                        ucLERunningCard.TextFocus(true, true);
                        return;
                    }

                    int len = 0;
                    try
                    {
                        len = int.Parse(bCardTransLenULE.Value.Trim());
                    }
                    catch
                    {
                        this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$Error_BeforeCardTransLen_Should_be_Integer"));
                        ucLERunningCard.TextFocus(true, true);
                        return;
                    }

                    if (len != this.ucLERunningCard.Value.Trim().Length)
                    {
                        this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$Error_BeforeCardTransLen_Not_Correct"));
                        ucLERunningCard.TextFocus(true, true);
                        return;
                    }
                }

                //首字符串检查
                if (bCardTransLetterULE.Checked)
                {
                    if (bCardTransLetterULE.Value.Trim().Length == 0)
                    {
                        this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$CS_Before_Card_Transfer_FLetter_Empty"));
                        ucLERunningCard.TextFocus(true, true);
                        return;
                    }

                    int index = ucLERunningCard.Value.Trim().IndexOf(bCardTransLetterULE.Value.Trim());
                    if (index != 0)
                    {
                        this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$CS_Before_Card_Transfer_FLetter_NotCompare"));
                        ucLERunningCard.TextFocus(true, true);
                        return;
                    }
                }
                #endregion

                #region 取得分板比例,从工单和SMT是否是打叉板得到分板比例,若不是,带出工单的分版比例

                simReport = _DataCollectFacade.GetLastSimulationReport(this.ucLERunningCard.Value.Trim().ToUpper());
                if (simReport == null)
                {
                    this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$Error_CS_ID_Not_Exist"));
                    this.ucLERunningCard.Value = "";
                    this.ucLERunningCard.TextFocus(true, true);
                    return;
                }
                else
                {
                    if (simReport.IsComplete != "1")
                    {
                        //完工后才可以分板,故注释。
                        //主要应用于以下业务情况:
                        //序列号 s1 通过两张工单 mo1, mo2 完成。s1 经过第一张工单 mo1 完工后,需要进行分板 s1--> s1-1, s1-2,
                        //分板后再用 s1-1, s1-2 进行第二张工单 mo2 的归属生产。
                        this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$CS_ERROR_PRODUCT_NO_COMPLETE"));
                        ucLERunningCard.TextFocus(true, true);
                        return;
                    }

                    if (txtMoCode.Checked)
                    {
                        if (string.Compare(txtMoCode.Value.ToUpper().Trim(), simReport.MOCode, true) != 0)
                        {
                            this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$RCARD_NOT_IN_MO"));
                            ucLERunningCard.TextFocus(true, true);
                            return;
                        }
                    }

                    int rcardCount = _DataCollectFacade.GetSplitBoardCount(this.ucLERunningCard.Value.Trim().ToUpper());

                    if (rcardCount > 0)
                    {
                        //已经分板的序列号就不可以在分了
                        this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$CS_ERROR_PRODUCT_ALREADY_SPLITE"));
                        ucLERunningCard.TextFocus(true, true);
                        return;
                    }
                }


                SMTFacade smtFacade = new SMTFacade(this.DataProvider);
                object    objsmtrel = smtFacade.GetSMTRelationQty(this.ucLERunningCard.Value.Trim().ToUpper(), simReport.MOCode);
                if (objsmtrel != null)
                {
                    Smtrelationqty smtrel = (Smtrelationqty)objsmtrel;
                    this.txtIDMergeValue.Text = Convert.ToString(smtrel.Relationqtry);
                }
                else
                {
                    MOFacade mofacade = new MOFacade(this.DataProvider);
                    object   objMO    = mofacade.GetMO(simReport.MOCode);
                    if (objMO != null)
                    {
                        MO mo = (MO)objMO;
                        this.txtIDMergeValue.Text = Convert.ToString(mo.IDMergeRule);
                    }
                    else
                    {
                        this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$CS_MO_Not_Exit"));
                        txtMoCode.Focus();
                        txtMoCode.SelectAll();
                        return;
                    }
                }
                #endregion

                #region 判断分板前序列号是否存在


                int mergeRule = 1;
                try
                {
                    mergeRule = System.Int32.Parse(this.txtIDMergeValue.Text.ToUpper().Trim());
                }
                catch
                {
                    this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$Error_CS_IDMerge_Should_be_Integer"));//分板比例必须为整数
                    //Laws Lu,2005/08/11,新增焦点设置
                    ucLERunningCard.TextFocus(true, true);
                    return;
                }

                if (mergeRule <= 0)
                {
                    this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$Error_CS_IDMerge_Should_Over_Zero"));//分板比例必须大于零
                    ucLERunningCard.TextFocus(true, true);
                    return;
                }
                this._mergeRule = mergeRule;
                #endregion

                #endregion
            }
            else
            {
                //added by jessie lee, 2005/11/29
                #region 判断转换后序列号是否符合条件
                //长度检查
                if (aCardTransLenULE.Checked)
                {
                    if (aCardTransLenULE.Value.Trim().Length == 0)
                    {
                        this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$CS_After_Card_Transfer_Empty"));
                        ucLERunningCard.TextFocus(true, true);
                        return;
                    }

                    int len = 0;
                    try
                    {
                        len = int.Parse(aCardTransLenULE.Value.Trim());
                    }
                    catch
                    {
                        this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$Error_AfterCardTransLen_Should_be_Integer"));
                        ucLERunningCard.TextFocus(true, true);
                        return;
                    }

                    if (len != this.ucLERunningCard.Value.Trim().Length)
                    {
                        this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$Error_AfterCardTransLen_Not_Correct"));
                        ucLERunningCard.TextFocus(true, true);
                        return;
                    }
                }

                //首字符串检查
                if (aCardTransLetterULE.Checked)
                {
                    if (aCardTransLetterULE.Value.Trim().Length == 0)
                    {
                        this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$CS_After_Card_Transfer_FLetter_Empty"));
                        ucLERunningCard.TextFocus(true, true);
                        return;
                    }

                    int index = ucLERunningCard.Value.Trim().IndexOf(aCardTransLetterULE.Value.Trim());
                    if (index != 0)
                    {
                        this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$CS_After_Card_Transfer_FLetter_NotCompare"));
                        ucLERunningCard.TextFocus(true, true);
                        return;
                    }
                }
                #endregion

                #region 判断分板后序列号是否重复
                if (this._runningCardList.Contains(this.ucLERunningCard.Value.Trim().ToUpper()))
                {
                    this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$Error_CS_Merge_ID_Exist"));//转换后产品序列号重复
                    this.ucLERunningCard.Value = "";

                    //Laws Lu,2005/08/11,新增焦点设置
                    ucLERunningCard.TextFocus(true, true);
                    return;
                }
                #endregion


                int rcardCount = _DataCollectFacade.GetSplitBoardCount(this.ucLERunningCard.Value.Trim().ToUpper());

                if (rcardCount > 0)
                {
                    //已经分板的序列号就不可以在分了
                    this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$CS_ERROR_PRODUCT_ALREADY_SPLITE"));
                    this.ucMessage.AddBoldText(string.Format(">>$CS_Please_Input_Merge_ID {0}/{1}", this._currSequence.ToString(), this._mergeRule.ToString()));//请输入转换后产品序列号
                    ucLERunningCard.TextFocus(true, true);
                    return;
                }


                this._runningCardList.Add(this.ucLERunningCard.Value.Trim().ToUpper());
            }

            if (this._currSequence < this._mergeRule)
            {
                this._currSequence++;

                this.txtIDMergeValue.Enabled = false;
                this.ucMessage.AddBoldText(string.Format(">>$CS_Please_Input_Merge_ID {0}/{1}", this._currSequence.ToString(), this._mergeRule.ToString())); //请输入转换后产品序列号
            }
            else if (this._currSequence == this._mergeRule)                                                                                                  // 达到分板比例,写入数据库
            {
                try
                {
                    this.DataProvider.BeginTransaction();
                    int        tempCount  = 1;
                    DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider);
                    foreach (string strRcard in _runningCardList)
                    {
                        #region 将ID添加到SplitBoard
                        SplitBoard splitBorad = new SplitBoard();
                        splitBorad.Seq           = tempCount;
                        splitBorad.Mocode        = simReport.MOCode;
                        splitBorad.Rcard         = strRcard;
                        splitBorad.Modelcode     = simReport.ModelCode;
                        splitBorad.Itemcode      = simReport.ItemCode;
                        splitBorad.Opcode        = simReport.OPCode;
                        splitBorad.Rescode       = ApplicationService.Current().ResourceCode;
                        splitBorad.Routecode     = simReport.RouteCode;
                        splitBorad.Scard         = simReport.SourceCard;
                        splitBorad.Segcode       = simReport.SegmentCode;
                        splitBorad.Shiftcode     = simReport.ShiftCode;
                        splitBorad.Shifttypecode = simReport.ShiftTypeCode;
                        splitBorad.Sscode        = simReport.StepSequenceCode;
                        splitBorad.Tpcode        = simReport.TimePeriodCode;
                        splitBorad.Muser         = ApplicationService.Current().UserCode;
                        splitBorad.Mdate         = dbDateTime.DBDate;
                        splitBorad.Mtime         = dbDateTime.DBTime;
                        _DataCollectFacade.AddSplitBoard(splitBorad);
                        tempCount++;
                        #endregion
                    }
                    this.DataProvider.CommitTransaction();

                    this.ucMessage.Add(new UserControl.Message(MessageType.Success, ">>$CS_SplitID_CollectSuccess"));//产品序列号转换采集成功
                    //added by jessie lee, 2005/11/29,
                }
                catch (Exception ex)
                {
                    this.DataProvider.RollbackTransaction();
                    this.ucMessage.Add(new UserControl.Message(MessageType.Error, ">>$CS_SplitID_CollectSuccess"));//产品序列号转换采集成功
                }


                this.initInput();
            }

            this.ucLERunningCard.Value = "";

            //Laws Lu,2005/08/11,新增焦点设置
            if (!aCardTransLetterULE.Checked)
            {
                ucLERunningCard.TextFocus(true, true);
            }
            else
            {
                ucLERunningCard.TextFocus(true, true);
            }
        }
예제 #22
0
        /// <summary>
        /// Ukazka pouziti volani simulaci
        /// </summary>
        public static void ExampleUsage()
        {
            string username = "******";             //ID uzivatele, melo by byt ziskano na frontendu (FE) prihlasenim
            UserID user     = new UserID(username); //uzivatel-je predavan serveru

            try
            {
                //zjisteni informaci o algoritmech
                Console.WriteLine("Zjistuji informace o implementovanych algoritmech:");
                var algoritms = proxy_simulation.GetAlgorithmInfo(user);//seznam informaci o algoritmech, volani pomoci proxy_simulation objektu
                foreach (var item in algoritms)
                {
                    Console.WriteLine("ID:{0}\tJmeno:{1}\tPopis:{2}", item.AlgorithmID, item.AlgorithmName, item.AlgorithmDescription);
                }
                //vytvoreni senatu-informace o senatech musi byt nactene z databaze a zde vytvoreny jejich instance
                //Dochazi k volani konstruktoru na strane klienta, viz DataContractHelpers.cs, kde jsou tyto konstruktory implementovany
                Senate s1 = new Senate("INS-tester-1");               //senat, ktery je povoleny,zatizeni 100, pocet aktivnich pripadu 0
                Senate s2 = new Senate("INS-tester-2", false);        //senat je zakazany-nebude pouzit v simulaci
                Senate s3 = new Senate("INS-tester-3", true, 100);    //senat je povoleny, zatizeni je 100, pocet aktivnich pripadu 0
                Senate s4 = new Senate("INS-tester-4", true, 100, 0); //senat je povoleny, zatizeni 100, pocet aktivnich pripadu 0
                Senate s5 = new Senate("INS-tester-5");
                //po odkomentovani vyjimka-volana na strane klienta
                //Senate s6 = new Senate("INS-tester-6",true,120);//zpusobi vyjimku na strane klienta, nepovolena hodnota zatizeni 120
                SimulationParams par = new SimulationParams(); //vytvoreni tridy pro simulacni parametry, pred odeslanim na server musi byt vse nastaveno
                par.User    = user;                            //nastav si uzivatele
                par.Senates = new List <Senate>()
                {
                    s1, s2, s3, s4, s5
                };                                                                                         //musi se vytvorit seznam senatu pro simulaci
                //vyber algoritmu pro simulaci, na FE uzivatel vybere
                par.AlgorithmsToSimulate = (from a in algoritms select int.Parse(a.AlgorithmID)).ToList(); //zjisti-vem ID vsech implementovanych algoritmu pro pouziti v simulaci
                par.IterationsCount      = 10;                                                             //nastaveni poctu iteraci
                par.CasesToDistribution  = 100;                                                            //pocet rozdelovanych pripadu v kazde iteraci
                var results = proxy_simulation.DoSimulation(par);                                          //proved simulaci-bezi na serveru

                //vlozeno 24.1. test exportu do xls
                var report = new SimulationReport(algoritms, par, results);
                report.CreateReportToFile("report.xlsx");//zapise do souboru-pro spousteni v konzoli-pouzije si PLASTIAK
                //Pro DANA MAJEROVA -vytvorenisouboru v pameti pro posilani-ODKOMENTOVAT nasledujici radek a zakomentovat ReportToFile
                //  var memory = report.CreateReportOnTheFly();//vytvor v pameti--je to mozne prevest na pole bytu a poslat response -viz http://howtodomssqlcsharpexcelaccess.blogspot.cz/2014/05/aspnet-how-to-create-excel-file-in.html


                //test Kubera-jestli to funguje-Vezmu vytvoreny memory stream a ulozim ho do souboru- funguje
                using (var memory = report.CreateReportOnTheFly())
                { //nutno pridat nahoru using System.IO; pro praci se soubory
                    using (FileStream fs = new FileStream("reportfly.xlsx", FileMode.OpenOrCreate))
                    {
                        memory.Position = 0; //nastav to na zacatek
                        memory.CopyTo(fs);   //kopiruj pamet do file streamu
                        fs.Flush();          //zapis
                    }
                }



                //konec testu exportu
                foreach (var data in results)//pro kazdy algoritmus pouzity v simulaci, data jsou kompletni data pro jeden algoritmus
                {
                    Console.WriteLine("+".Repeat(70));
                    var name = (from a in algoritms where a.AlgorithmID == data.UsedAlgorithm.ToString() select a.AlgorithmName).First();
                    Console.WriteLine("Pouzity algoritmus {0}:{1}", data.UsedAlgorithm, name);
                    Console.WriteLine("+".Repeat(70));
                    int iterace = 0;
                    foreach (var array in data.Data) //zpracuj data-vypis za jednotlive iterace,array je distribuce pripadu mezi senaty
                    {
                        foreach (var item in array)  //vypis hodnot pres senaty
                        {
                            Console.Write("{0}\t", item);
                        }
                        Console.WriteLine("MAXDIF:{0}", data.MaxDifference[iterace]);
                        iterace++;
                        Console.WriteLine();
                    }
                    Console.WriteLine("-".Repeat(70));
                    Console.WriteLine("\nStatisticke informace");
                    Console.WriteLine("-".Repeat(70));
                    StatisticInfo(data.Data);
                    Console.WriteLine("-".Repeat(70));
                }
            }
            catch (FaultException <GeneratorServiceFault> fault)//odchytavani vyjimek ze serveru
            {
                ConsoleServerMessage(fault);
            }
            catch (Exception e)//odchytnuti vyjimky z klienta
            {
                ConsoleClientMessage(e);
            }
            finally
            {
                Console.WriteLine("Hotovo");
            }
        }
예제 #23
0
 public virtual OperationResult AddEntity(SimulationReport simulationReport, bool isSave = true)
 {
     return(simulationReportRepository.Insert(simulationReport, isSave));
 }
예제 #24
0
 public virtual OperationResult UpdateEntity(SimulationReport simulationReport, bool isSave = true)
 {
     return(simulationReportRepository.Update(simulationReport, isSave));
 }
예제 #25
0
        private bool InputPallet(string palletCode)
        {
            ////Check 栈板是否存在
            //
            PackageFacade objFacade = new PackageFacade(this.DataProvider);
            object        pallet    = objFacade.GetPallet(palletCode);

            if (pallet == null)
            {
                //Message:该栈板不存在
                ApplicationRun.GetInfoForm().Add(
                    new UserControl.Message(MessageType.Error, "$CS_PALLETNO_IS_NOT_EXIT"));
                return(false);
            }


            InventoryFacade inventoryFacade = new InventoryFacade(this.DataProvider);

            ////使用原栈板
            //
            if (this.rdoUseOPallet.Checked)
            {
                ////Check 栈板在目标垛位中已经存在
                //
                object[] rcardToStackPallet = inventoryFacade.GetRcardToStackPallet(this.ucLabelEditStock.Value, palletCode, "");

                if (rcardToStackPallet != null)
                {
                    //Message:栈板在目标垛位中已经存在
                    ApplicationRun.GetInfoForm().Add(
                        new UserControl.Message(MessageType.Error, "$CS_PALLET_IS_EXIST_IN_TAR_STACK"));
                    return(false);
                }

                ////获取源栈板的垛位资料
                //
                object[] rcardToStackPalletList = inventoryFacade.GetRcardToStackPallet("", palletCode, "");

                if (rcardToStackPalletList == null)
                {
                    //Message:源栈板对应的垛位信息不存在
                    ApplicationRun.GetInfoForm().Add(
                        new UserControl.Message(MessageType.Error, "$CS_PALLET_IS_NOT_EXIST_IN_ORI_STACK"));
                    return(false);
                }

                if (inventoryFacade.CheckStackIsOnlyAllowOneItem(ucLabelEditStock.Value.ToString()) &&
                    CheckStackItemError(this.ucLabelEditStock.Value.Trim(), this.ucLabelComboxINVType.SelectedItemValue.ToString(),
                                        ((RcardToStackPallet)rcardToStackPalletList[0]).ItemCode))
                {
                    //Message:目标垛位的物料和当前物料不一致
                    ApplicationRun.GetInfoForm().Add(
                        new UserControl.Message(MessageType.Error, "$CS_STACK_ITEM_DIFF"));
                    return(false);
                }

                ////根据源栈板的Rcard更新StackToRcard
                //
                inventoryFacade.UpdatePalletStackByWholePallet(rcardToStackPalletList,
                                                               this.ucLabelComboxINVType.SelectedItemValue.ToString(),
                                                               this.ucLabelEditStock.Value.Trim(),
                                                               ApplicationService.Current().LoginInfo.UserCode);

                //Load Grid
                this.LoadGrid(rcardToStackPalletList, this.ucLabelEditStock.Value.Trim(), palletCode);
            }

            ////使用目标垛位栈板
            //
            if (this.rdoUseTPallet.Checked)
            {
                if (palletCode.Equals(this.txtUseTPallet.Value.Trim()))
                {
                    //Message:源栈板和目标栈板相同
                    ApplicationRun.GetInfoForm().Add(
                        new UserControl.Message(MessageType.Error, "$CS_PALLETNO_SAME_AS_TARPALLET"));
                    return(false);
                }

                ////check目标垛位栈板的,产品,公司别,产品档次,是否和序列号的栈板一致
                //
                //获取源栈板信息
                object[] objOriStackToRcardList = inventoryFacade.GetStackToRcardInfoByPallet(palletCode);
                object[] objTarStackToRcardList = inventoryFacade.GetStackToRcardInfoByPallet(this.txtUseTPallet.Value.Trim());

                if (objOriStackToRcardList == null)
                {
                    //Message:源栈板对应的垛位信息不存在
                    ApplicationRun.GetInfoForm().Add(
                        new UserControl.Message(MessageType.Error, "$CS_PALLET_IS_NOT_EXIST_IN_ORI_STACK"));
                    return(false);
                }

                if (inventoryFacade.CheckStackIsOnlyAllowOneItem(ucLabelEditStock.Value.ToString()) &&
                    CheckStackItemError(this.ucLabelEditStock.Value.Trim(), this.ucLabelComboxINVType.SelectedItemValue.ToString(),
                                        ((StackToRcard)objOriStackToRcardList[0]).ItemCode))
                {
                    //Message:目标垛位的物料和当前物料不一致
                    ApplicationRun.GetInfoForm().Add(
                        new UserControl.Message(MessageType.Error, "$CS_STACK_ITEM_DIFF"));
                    return(false);
                }

                string       strErrorMessage = string.Empty;
                StackToRcard objOri          = (StackToRcard)objOriStackToRcardList[0];
                StackToRcard objTar          = (StackToRcard)objTarStackToRcardList[0];
                if (objOri.ItemCode != objTar.ItemCode)
                {
                    strErrorMessage = strErrorMessage + "itemcode";
                    ApplicationRun.GetInfoForm().Add(
                        new UserControl.Message(MessageType.Error, "$CS_ITEM_NOT_SAME_IN_PALLET_TWO $CS_TARGET=" + objTar.ItemCode + " $CS_ORIGINAL=" + objOri.ItemCode));
                }

                if (objOri.Company != objTar.Company)
                {
                    strErrorMessage = strErrorMessage + "companycode";
                    ApplicationRun.GetInfoForm().Add(
                        new UserControl.Message(MessageType.Error, "$CS_COMPANY_NOT_SAME_IN_PALLET_TWO $CS_TARGET=" + objTar.Company + " $CS_ORIGINAL=" + objOri.Company));
                }

                if (strErrorMessage != string.Empty)
                {
                    return(false);
                }

                ////获取源栈板的垛位资料
                //
                object[] rcardToStackPallet = inventoryFacade.GetRcardToStackPallet("", palletCode, "");

                ////把原栈板更新为目标栈板
                //
                inventoryFacade.UpdateOriPalletStackToTargetPallet(rcardToStackPallet,
                                                                   this.txtUseTPallet.Value.Trim(),
                                                                   this.ucLabelComboxINVType.SelectedItemValue.ToString(),
                                                                   this.ucLabelEditStock.Value.Trim(),
                                                                   ApplicationService.Current().LoginInfo.UserCode);

                //Load Grid
                this.LoadGrid(rcardToStackPallet, this.ucLabelEditStock.Value.Trim(), this.txtUseTPallet.Value.Trim());
            }

            ////使用新栈板
            //
            if (this.rdoUseNPallet.Checked)
            {
                if (palletCode.Equals(this.txtUseNPallet.Value.Trim()))
                {
                    //Message:源栈板和目标栈板相同
                    ApplicationRun.GetInfoForm().Add(
                        new UserControl.Message(MessageType.Error, "$CS_PALLETNO_SAME_AS_TARPALLET"));
                    return(false);
                }


                ////获取源栈板的垛位资料
                //
                object[] rcardToStackPallet = inventoryFacade.GetRcardToStackPallet("", palletCode, "");

                if (rcardToStackPallet == null)
                {
                    //Message:源栈板对应的垛位信息不存在
                    ApplicationRun.GetInfoForm().Add(
                        new UserControl.Message(MessageType.Error, "$CS_PALLET_IS_NOT_EXIST_IN_ORI_STACK"));
                    return(false);
                }

                if (inventoryFacade.CheckStackIsOnlyAllowOneItem(ucLabelEditStock.Value.ToString()) && CheckStackItemError(this.ucLabelEditStock.Value.Trim(), this.ucLabelComboxINVType.SelectedItemValue.ToString(),
                                                                                                                           ((RcardToStackPallet)rcardToStackPallet[0]).ItemCode))
                {
                    //Message:目标垛位的物料和当前物料不一致
                    ApplicationRun.GetInfoForm().Add(
                        new UserControl.Message(MessageType.Error, "$CS_STACK_ITEM_DIFF"));
                    return(false);
                }

                //检查栈板容量是否满
                if (!inventoryFacade.CheckStackCapacity(this.ucLabelComboxINVType.SelectedItemValue.ToString().Trim().ToUpper(),
                                                        this.ucLabelEditStock.Value.Trim().ToUpper()))
                {
                    ApplicationRun.GetInfoForm().Add(
                        new UserControl.Message(MessageType.Error, "$CS_STACK_CAPACITY_FULL"));
                    return(false);
                }


                string            lotNo             = " ";
                DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider);
                SimulationReport  simulationReport  = (SimulationReport)dataCollectFacade.GetRcardFromSimulationReport(((RcardToStackPallet)rcardToStackPallet[0]).SerialNo);
                if (simulationReport != null)
                {
                    OQCFacade   oqcFacade   = new OQCFacade(this.DataProvider);
                    OQCLot2Card oqcLot2Card = (OQCLot2Card)oqcFacade.GetLastOQCLot2CardByRCard(simulationReport.RunningCard);

                    if (oqcLot2Card != null)
                    {
                        lotNo = oqcLot2Card.LOTNO;
                    }
                }

                //把原栈板更新为新栈板
                inventoryFacade.UpdateOriPalletStackToNewPallet(rcardToStackPallet,
                                                                this.txtUseNPallet.Value.Trim(),
                                                                this.ucLabelComboxINVType.SelectedItemValue.ToString(),
                                                                this.ucLabelEditStock.Value.Trim(),
                                                                ApplicationService.Current().LoginInfo.UserCode,
                                                                ApplicationService.Current().ResourceCode,
                                                                lotNo);

                //Load Grid
                this.LoadGrid(rcardToStackPallet, this.ucLabelEditStock.Value.Trim(), this.txtUseNPallet.Value.Trim());
            }

            return(true);
        }
예제 #26
0
        /// <summary>
        /// 成品入库检查
        /// </summary>
        /// <returns>true/false</returns>
        private bool CheckStackAndRcardInfo(string rcard, string stackCode, string itemCode, string palletCode, string companyCode, string storageCode)
        {
            DataCollectFacade dcFacade = new DataCollectFacade(this.DataProvider);
            SimulationReport  report   = dcFacade.GetLastSimulationReport(rcard);

            if (report != null)
            {
                if (!report.ItemCode.Equals(itemCode))
                {
                    //Message:产品序列号所对应的物料与输入物料不对应
                    ApplicationRun.GetInfoForm().Add(
                        new UserControl.Message(MessageType.Error, "$CS_PRODUCT_ITEM_NOT_SAME $ITEM_CODE=" + report.ItemCode));
                    return(false);
                }
            }


            ////Check从垛位使用状况的页面带过来的垛位和库位
            //if (!this.CheckSelecetedStackAndStorage(this.SelectedStorage, this.SelectedStack, Convert.ToString(this.ucLabelComboxINVType.SelectedItemValue)))
            //{
            //    return false;
            //}
            //else
            //{
            //Check序列号对应的料号是否和垛位的不一样
            InventoryFacade inventoryFacade = new InventoryFacade(this.DataProvider);

            object[] objStackToRcards = inventoryFacade.GetAnyStack2RCardByStack(stackCode);

            if (objStackToRcards != null)
            {
                if (inventoryFacade.CheckStackIsOnlyAllowOneItem(stackCode) && !((StackToRcard)objStackToRcards[0]).ItemCode.Equals(itemCode))
                {
                    //垛位的料号和当前产品的料号不一至
                    //ucMessage1.AddEx(this._FunctionName, this.opsetPackObject.CheckedItem.DisplayText + ": " + this.txtRCard.Value + ";料号:" + this.txtItemCode.Value, new UserControl.Message(MessageType.Error, "$CS_STACK_AND_PRODUCT_ITEM_NOT_SAME"), true);
                    ApplicationRun.GetInfoForm().Add(
                        new UserControl.Message(MessageType.Error, "$CS_STACK_AND_PRODUCT_ITEM_NOT_SAME $ITEM_CODE=" + itemCode));
                    return(false);
                }
            }

            //Check 序列号是否已经入过库
            object objStarckToRcard = inventoryFacade.GetStackToRcard(rcard);

            if (objStarckToRcard != null)
            {
                //序列号重复入库
                //ucMessage1.AddEx(this._FunctionName, "序列号" + ": " + this.txtRCard.Value, new UserControl.Message(MessageType.Error, "$CS_SERIAL_EXIST"), true);
                ApplicationRun.GetInfoForm().Add(
                    new UserControl.Message(MessageType.Error, "$CS_SERIAL_EXIST $SERIAL_NO=" + rcard));
                return(false);
            }
            //}

            //Check 序列号是否已经在其他栈板上
            PackageFacade objPFFacade     = new PackageFacade(this.DataProvider);
            object        objPallet2RCard = objPFFacade.GetPallet2RCardByRCard(rcard);

            if (objPallet2RCard != null)
            {
                ApplicationRun.GetInfoForm().Add(
                    new UserControl.Message(MessageType.Error, "$CS_RCARD_EXIST_IN_PALLET " + ((Pallet2RCard)objPallet2RCard).PalletCode));
                return(false);
            }

            //Check栈板(如果入栈板,而且栈板在系统中已经存在)的公司别,产品别和产品等级是否和当前的一致
            if (palletCode.Length > 0)
            {
                object[] objStackToRcardList = inventoryFacade.GetStackToRcardInfoByPallet(palletCode);
                if (objStackToRcardList != null)
                {
                    string       strErrorMessage = string.Empty;
                    StackToRcard obj             = (StackToRcard)objStackToRcardList[0];
                    if (obj.ItemCode != itemCode)
                    {
                        strErrorMessage = strErrorMessage + "itemcode";
                        ApplicationRun.GetInfoForm().Add(
                            new UserControl.Message(MessageType.Error, "$CS_ITEM_NOT_SAME_IN_PALLET=" + obj.ItemCode));
                    }

                    if (obj.Company != companyCode)
                    {
                        strErrorMessage = strErrorMessage + "companycode";
                        ApplicationRun.GetInfoForm().Add(
                            new UserControl.Message(MessageType.Error, "$CS_COMPANY_NOT_SAME_IN_PALLET=" + obj.Company));
                    }

                    //if (obj.ItemGrade != itemGrade)
                    //{
                    //    //ApplicationRun.GetInfoForm().Add(
                    //    //new UserControl.Message(MessageType.Error, "$CS_RCARD_EXIST_IN_PALLET" + ((Pallet2RCard)objPallet2RCard).PalletCode));
                    //    //return false;
                    //    strErrorMessage = strErrorMessage + "itemgrade";
                    //    ApplicationRun.GetInfoForm().Add(
                    //    new UserControl.Message(MessageType.Error, "$CS_ITEMGRADE_NOT_SAME_IN_PALLET=" + obj.ItemGrade));
                    //}

                    if (strErrorMessage != string.Empty)
                    {
                        return(false);
                    }
                }
                else
                {
                    if (!inventoryFacade.CheckStackCapacity(storageCode, stackCode))
                    {
                        ApplicationRun.GetInfoForm().Add(
                            new UserControl.Message(MessageType.Error, "$CS_STACK_CAPACITY_FULL"));
                        return(false);
                    }
                }
            }

            //Check 出库的产品和当前选择的产品不一致
            object[] outTransList = inventoryFacade.GetInvOutTransaction(rcard, "");

            if (outTransList != null)
            {
                if (!((InvOutTransaction)outTransList[0]).ItemCode.Equals(itemCode))
                {
                    //Message:出库的产品:XXXXXXXXXXX和当前选择的产品不一致,是否继续使用当前选择的产品
                    if (MessageBox.Show(UserControl.MutiLanguages.ParserMessage("$CS_OUT_INV_ITEM_NOT_SAME") + "=" + ((InvOutTransaction)outTransList[0]).ItemCode + "," + UserControl.MutiLanguages.ParserMessage("$CS_OUT_INV_ITEM_NOT_SAME_ASK") + "?", UserControl.MutiLanguages.ParserMessage("$CS_CONFIRM"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                    {
                        return(false);
                    }
                }
            }

            if (!this.CheckRule(rcard))
            {
                return(false);
            }


            return(true);
        }
예제 #27
0
        //Laws Lu,2005/08/19,新增	完工逻辑
        //Laws Lu,2005/08/26,新增	更新工单报废数量
        private void doAction(ActionEventArgs e)
        {
            #region 填写Simulation
            //Laws Lu,2005/08/26,新增	更新工单中报废的数量

            DataCollectFacade fac        = new DataCollectFacade(this.DataProvider);
            DBDateTime        dbDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider);
            Simulation        sim        = (Simulation)fac.GetSimulation(e.RunningCard.Trim());

            if (sim != null)
            {
                sim.IsComplete    = "1";
                sim.EAttribute1   = "SCRAP";//TSStatus.TSStatus_Scrap 以Mail内容为准
                sim.ProductStatus = "SCRAP";
                sim.MaintainUser  = e.UserCode.Trim();
                sim.MaintainDate  = dbDateTime.DBDate;
                sim.MaintainTime  = dbDateTime.DBTime;
            }

            fac.UpdateSimulation(sim);

            #endregion

            #region 填写SimulationReport

            SimulationReport simulationReport = new SimulationReport();
            simulationReport.RouteCode             = sim.RouteCode;
            simulationReport.OPCode                = sim.OPCode;
            simulationReport.CartonCode            = sim.CartonCode;
            simulationReport.EAttribute1           = sim.EAttribute1;
            simulationReport.EAttribute2           = sim.EAttribute2;
            simulationReport.IDMergeRule           = sim.IDMergeRule;
            simulationReport.IsComplete            = sim.IsComplete;
            simulationReport.ItemCode              = sim.ItemCode;
            simulationReport.LastAction            = sim.LastAction;
            simulationReport.LOTNO                 = sim.LOTNO;
            simulationReport.MaintainDate          = sim.MaintainDate;
            simulationReport.MaintainTime          = sim.MaintainTime;
            simulationReport.MaintainUser          = sim.MaintainUser;
            simulationReport.MOCode                = sim.MOCode;
            simulationReport.ModelCode             = sim.ModelCode;
            simulationReport.NGTimes               = sim.NGTimes;
            simulationReport.PalletCode            = sim.PalletCode;
            simulationReport.ResourceCode          = sim.ResourceCode;
            simulationReport.RunningCard           = sim.RunningCard;
            simulationReport.RunningCardSequence   = sim.RunningCardSequence;
            simulationReport.Status                = sim.ProductStatus;
            simulationReport.TranslateCard         = sim.TranslateCard;
            simulationReport.TranslateCardSequence = sim.TranslateCardSequence;
            simulationReport.SourceCard            = sim.SourceCard;
            simulationReport.SourceCardSequence    = sim.SourceCardSequence;

            BaseModelFacade dataModel = new BaseModelFacade(this.DataProvider);
            Resource        resource  = (Resource)dataModel.GetResource(sim.ResourceCode);
            simulationReport.SegmentCode = resource.SegmentCode;

            ShiftModelFacade shiftModel = new ShiftModelFacade(this.DataProvider);
            TimePeriod       period     = (TimePeriod)shiftModel.GetTimePeriod(resource.ShiftTypeCode, simulationReport.MaintainTime);
            if (period == null)
            {
                throw new Exception("$OutOfPerid");
            }

            // Modified by Jane Shu		Date:2005-07-26
            //			if ( period.IsOverDate == FormatHelper.TRUE_STRING )
            //			{
            //				if ( period.TimePeriodBeginTime < period.TimePeriodEndTime )
            //				{
            //					simulationReport.ShiftDay =	FormatHelper.TODateInt(DateTime.Now.AddDays(-1)) ;
            //				}
            //				else if ( sim.MaintainTime < period.TimePeriodBeginTime)
            //				{
            //					simulationReport.ShiftDay =	FormatHelper.TODateInt(DateTime.Now.AddDays(-1)) ;
            //				}
            //				else
            //				{
            //					simulationReport.ShiftDay = FormatHelper.TODateInt(DateTime.Now) ;
            //				}
            //			}
            //			else
            //			{
            //				simulationReport.ShiftDay = FormatHelper.TODateInt(DateTime.Now) ;
            //			}
            simulationReport.ShiftTypeCode    = resource.ShiftTypeCode;
            simulationReport.ShiftCode        = period.ShiftCode;
            simulationReport.TimePeriodCode   = period.TimePeriodCode;
            simulationReport.StepSequenceCode = resource.StepSequenceCode;
            simulationReport.MOSeq            = sim.MOSeq; // Added by Icyer 2007/07/03

            fac.UpdateSimulationReport(simulationReport);

            #endregion

            #region 填写OnWIP
            //			OnWIP onwip	=	new OnWIP();
            //			onwip.Action	=	sim.LastAction;
            //			onwip.ActionResult	=	sim.ProductStatus;
            //			onwip.ItemCode		=	sim.ItemCode ;
            //			onwip.MaintainDate	=	FormatHelper.TODateInt(DateTime.Now) ;
            //			onwip.MaintainTime	=	FormatHelper.TOTimeInt(DateTime.Now) ;
            //			onwip.MaintainUser	=	sim.MaintainUser ;
            //			onwip.MOCode			=	sim.MOCode;
            //			onwip.ModelCode		=  sim.ModelCode;
            //			onwip.NGTimes			=  sim.NGTimes;
            //			onwip.OPCode			=  sim.OPCode;
            //			onwip.ResourceCode =  sim.ResourceCode;
            //			onwip.RouteCode		=  sim.RouteCode;
            //			onwip.RunningCard	=  sim.RunningCard;
            //			onwip.RunningCardSequence	= sim.RunningCardSequence ;
            //
            ////			BaseModelFacade dataModel1 = new BaseModelFacade(this.DataProvider);
            ////			Resource resource1				= (Resource)dataModel1.GetResource(sim.ResourceCode);
            ////			onwip.SegmentCode				= resource1.SegmentCode ;
            ////
            ////			ShiftModelFacade shiftModel1	= new ShiftModelFacade(this.DataProvider);
            ////			TimePeriod  period1				= (TimePeriod)shiftModel1.GetTimePeriod(resource1.ShiftTypeCode,onwip.MaintainTime);
            ////			if (period1==null)
            ////			{
            ////				throw new Exception("$OutOfPerid");
            ////			}
            //
            ////			if ( period1.IsOverDate == FormatHelper.TRUE_STRING )
            ////			{
            ////				if ( period1.TimePeriodBeginTime < period1.TimePeriodEndTime )
            ////				{
            ////					onwip.ShiftDay =	FormatHelper.TODateInt(DateTime.Now.AddDays(-1)) ;
            ////				}
            ////				else if ( sim.MaintainTime < period1.TimePeriodBeginTime)
            ////				{
            ////					onwip.ShiftDay =	FormatHelper.TODateInt(DateTime.Now.AddDays(-1)) ;
            ////				}
            ////				else
            ////				{
            ////					onwip.ShiftDay = FormatHelper.TODateInt(DateTime.Now) ;
            ////				}
            ////			}
            ////			else
            ////			{
            ////				onwip.ShiftDay = FormatHelper.TODateInt(DateTime.Now) ;
            ////			}
            ////			onwip.ShiftTypeCode	= resource1.ShiftTypeCode;
            ////			onwip.ShiftCode			= period1.ShiftCode;
            ////			onwip.TimePeriodCode	= period1.TimePeriodCode;
            //
            //			onwip.SourceCard				  = sim.SourceCard;
            //			onwip.SourceCardSequence = sim.SourceCardSequence;
            ////			onwip.StepSequenceCode	  = resource1.StepSequenceCode;
            //
            //			onwip.TranslateCard			= sim.TranslateCard;
            //			onwip.TranslateCardSequence = sim.TranslateCardSequence;
            //
            //			fac.UpdateOnWIP(onwip);
            #endregion

            MOFacade moFAC = new MOFacade(_domainDataProvider);
            object   objMO = null;
            if (e.CurrentMO != null)
            {
                objMO = e.CurrentMO;
            }
            else
            {
                objMO       = moFAC.GetMO(sim.MOCode);
                e.CurrentMO = objMO as Domain.MOModel.MO;
            }



            if (objMO != null)
            {
                MO mo = (MO)objMO;

                //Laws Lu,2006/02/28,修改	报废数量
                mo.MOScrapQty = /*mo.MOScrapQty + */ 1 * sim.IDMergeRule;

                moFAC.UpdateMOScrapQty(mo);
            }
            //End Laws Lu
        }
예제 #28
0
        private bool initFlowPicBox()
        {
            clear();
            string routeCode = "",
                   moCode    = "",
                   itemCode;

            object[] objs;

            if (string.IsNullOrEmpty(Convert.ToString(this.drownListMoCode.SelectedItemValue)))
            {
                return(false);
            }
            moCode = Convert.ToString(this.drownListMoCode.SelectedItemValue);
            if (string.IsNullOrEmpty(Convert.ToString(this.drownListRouteCode.SelectedItemValue)))
            {
                return(false);
            }
            routeCode = Convert.ToString(this.drownListRouteCode.SelectedItemValue);

            Messages msg = new Messages();

            if (m_DataCollectFacade == null)
            {
                m_DataCollectFacade = new DataCollectFacade(this.DataProvider);
            }
            try
            {
                //add
                string sourceRcard = m_DataCollectFacade.GetSourceCard(FormatHelper.CleanString(txtRcard.Text.ToUpper()), this.drownListMoCode.SelectedItemValue.ToString());
                //end
                //object objLastSimRe = m_DataCollectFacade.GetLastSimulationReport(FormatHelper.CleanString(sourceRcard));
                object objLastSimRe = m_DataCollectFacade.GetSimulationReport(this.drownListMoCode.SelectedItemValue.ToString(), FormatHelper.CleanString(sourceRcard));


                if (objLastSimRe == null)
                {
                    msg.Add(new UserControl.Message(MessageType.Error, "$Error_CS_ID_Not_Exist"));
                    txtRcard.SelectAll();
                    txtRcard.Focus();
                    ApplicationRun.GetInfoForm().Add(msg);
                    return(false);
                }
                else
                {
                    SimulationReport currentSimRe = (SimulationReport)objLastSimRe;
                    itemCode = currentSimRe.ItemCode;

                    //查询当前途程工序捞TBLITEMROUTE2OP表
                    //QueryItemOpFlow(当前itemCode,当前途程Code);
                    objs = m_DataCollectFacade.QueryItemOpFlow(itemCode, routeCode);
                    if (objs == null)
                    {
                        ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Normal, "$CS_No_Data_To_Display"));
                        //add by klaus 置焦点
                        txtRcard.SelectAll();
                        txtRcard.Focus();
                        return(false);
                    }

                    #region 画流程图
                    this.panelDrawFlow.Controls.Clear();
                    this.panelDrawFlow.Refresh();

                    StartButton btnStart = new StartButton();
                    this.panelDrawFlow.Controls.Add(btnStart);
                    btnStart.setProcessName(MutiLanguages.ParserString("$CS_Start"));
                    btnStart.Location = new Point(10, 30);
                    btnStart.DrawButton();

                    FunctionButton lastOne = btnStart;
                    FlowButton     btnFlow = new StraightArrowButton();
                    double         vdegree = 0;

                    ItemRoute2OP currentOP = null;

                    for (int i = 0; i < objs.Length; i++)
                    {
                        ItemRoute2OP itemRoute2Op = objs[i] as ItemRoute2OP;

                        btnFlow = lastOne.AddOutArrow(vdegree);
                        Operation op = (Operation) new BaseModelFacade(this.DataProvider).GetOperation(itemRoute2Op.OPCode);
                        lastOne = btnFlow.AddOutProcess(itemRoute2Op.OPCode);

                        lastOne.Tag       = itemRoute2Op.OPCode;
                        lastOne.ProcessID = op.OPDescription;
                        lastOne.DrawButton();
                        lastOne.BackColor = Color.Green;
                        lastOne.Click    += new EventHandler(btn_Click);

                        //string actionResult = m_DataCollectFacade.CheckOpIsExist(FormatHelper.CleanString(txtRcard.Text.Trim().ToUpper()), moCode, routeCode, itemRoute2Op.OPCode);
                        string actionResult = m_DataCollectFacade.CheckOpIsExist(sourceRcard, moCode, routeCode, itemRoute2Op.OPCode);
                        if (string.IsNullOrEmpty(actionResult))
                        {
                            lastOne.BackColor = Color.White;
                        }
                        else
                        {
                            if (actionResult == ProductStatus.GOOD)
                            {
                                lastOne.BackColor = Color.Green;
                            }
                            else
                            {
                                lastOne.BackColor = Color.Red;
                            }
                        }

                        if (itemRoute2Op.OPCode == currentSimRe.OPCode &&
                            itemRoute2Op.RouteCode == currentSimRe.RouteCode)
                        {
                            currentOP = (ItemRoute2OP)objs[i];
                            if (currentSimRe.Status == ProductStatus.GOOD)
                            {
                                lastOne.BackColor = Color.Green;
                            }
                            else
                            {
                                lastOne.BackColor = Color.Red;
                            }
                        }

                        #region 注释 Terry 2012-11-13
                        //如果途程里工序是从0开始,显示背景有问题。
                        //if ((currentOP != null) && (i > currentOP.OPSequence - 1))
                        //{
                        //    lastOne.BackColor = Color.WhiteSmoke;
                        //}
                        #endregion

                        if ((btnFlow as StraightArrowButton).Degree == 90)
                        {
                            vdegree = (vdegree + 180) % 360;
                        }
                    }
                    btnFlow = lastOne.AddOutArrow(vdegree);
                    EndButton btnEnd = btnFlow.AddEnd();
                    btnEnd.Text      = MutiLanguages.ParserString("$CS_End");
                    btnEnd.BackColor = lastOne.BackColor;
                    #endregion

                    return(true);
                }
            }
            catch (Exception ex)
            {
                msg.Add(new UserControl.Message(ex));
                ApplicationRun.GetInfoForm().Add(msg);
                txtRcard.Focus();
                return(false);
            }
        }
        /// <summary>
        /// <c>Run</c> (přesměrováno; GET) - "webová" metoda pro zobrazení výsledků simulace (URL: /Simulation/Run, ale když nemá TempData, tak přesměruje na /Simulation/Index).
        /// </summary>
        /// <remarks><para>ViewModel: SimulationResViewModels.cs, třída SimulationResViewModel.</para><para>Views: Simulation/Run.cshtml.</para><para>Pouze pro přihlášené uživatele.</para><para>Tuto metodu lze spustit jedině po vyplnění formuláře s parametry simulace (nemá-li TempData, tak uživatele přesměruje na daný formulář.</para><para>Generuje také data pro XLS-soubor s výsledky simulace.</para><para>Lze volat jen jednou. Pro opakované volání je nutno znovu vyplnit formulář s parametry simulace! (Zajištěno přesměrováním.)</para></remarks>
        //
        // Redirect: Simulation/Run
        // https://stackoverflow.com/questions/129335/how-do-you-redirect-to-a-page-using-the-post-verb
        // https://stackoverflow.com/questions/26751087/detect-if-page-was-redirected-from-redirecttoaction-method
        public ActionResult Run()
        {
            if (TempData.Count == 0)               // nemáme data z Index()
            {
                return(RedirectToAction("Index")); // přesměrování
            }
            // jsou data => připravíme HTML pro výpis senátů, a pak spustíme simulaci a zpracujeme výsledky:

            SimulationParams par = new SimulationParams(); // objekt pro back-end (simulační parametry, musí být serveru správně předány)

            List <AlgorithmInfo> algInfo = TempData["AlgInfo"] as List <AlgorithmInfo>;
            List <Senate>        senates = TempData["Senates"] as List <Senate>;
            int    nCases = (int)TempData["NumCases"];
            int    nIters = (int)TempData["NumIters"];
            string resInitBE;

            GetSenates(); // nastaví "mySenates" a "htmlSenates", prioritně ze session
            ViewBag.senates = HtmlSenates(false, senates);

            Initialize();
            resInitBE = InitializeBackEnd(); // připojení k serveru s back-endem, získání seznamu algoritmů
            if (resInitBE != null)
            {
                TempData.Add("error", resInitBE); // chybové hlášení pro přesměrování
                return(RedirectToAction("Error", "Simulation"));
            }

            par.User    = tester;                                                                    // nastav si uzivatele
            par.Senates = senates;                                                                   // seznam senatu pro simulaci
            par.AlgorithmsToSimulate = (from a in algInfo select int.Parse(a.AlgorithmID)).ToList(); // IDecka algoritmu
            par.IterationsCount      = nIters;                                                       // nastaveni poctu iteraci
            par.CasesToDistribution  = nCases;                                                       // pocet rozdelovanych pripadu v kazde iteraci
            SimulationResViewModel SRVM = new SimulationResViewModel();                              //

            try
            {
                var results = proxy_simulation.DoSimulation(par);         // proveď simulaci (běží na serveru)
                var report  = new SimulationReport(algo, par, results);
                SRVM.Senates.AddRange(from p in par.Senates select p.ID); // jména senátů

                foreach (var a_result in results)                         // prochazej vysledky po algoritmech
                {
                    SRVM.AlgId.Add(a_result.UsedAlgorithm);               // pridej identifikator pouziteho algoritmu, coz je int
                    SRVM.AlgName.Add(ConvertAlgorithmName(algo[a_result.UsedAlgorithm].AlgorithmName));
                    SRVM.Data.Add(a_result.Data);                         // pridej data ze simulace konkretniho algoritmu, tedy predavam List<List<int>> - vyznam indexu prvni pres iterace, druhy  pres senaty
                    SRVM.MinMaxDiff.Add(a_result.MaxDifference);          // vypocet "max. okamžité odchylky" v rámci každé iterace; tohle dělá back-end (od 28. 3. 2018)

                    // vypocet a pridani statistickych informaci:

                    /* Do MAX je pridavan seznam maximalnich hodnot pres iterace, tj. pro kazdy senat je zde jedna polozka v seznamu.
                     * Ostatni statisticke veliciny analogicky...
                     */
                    SRVM.Max.Add(GetMax(a_result.Data));              // spocti maximum a pridej to do seznamu
                    SRVM.Min.Add(GetMin(a_result.Data));              // spocti minimum a pridej to do seznamu
                    List <double> avglist;
                    SRVM.Avg.Add(avglist = GetAvg(a_result.Data));    // spocti prumery a pridej do seznamu
                    SRVM.Stdev.Add(GetStdev(a_result.Data, avglist)); // spocti odchylky a pridej do seznamu. Pro odchylky potrebuji prumery, proto ten pomocny seznam
                }
                //            SRVM.TestovaciVypis();

                // report.CreateReportToFile("report.xlsx"); // zapise do souboru na serveru (pro Plastiaka)
                var memory = report.CreateReportOnTheFly(); // vytvor v pameti. Poslání response: http://howtodomssqlcsharpexcelaccess.blogspot.cz/2014/05/aspnet-how-to-create-excel-file-in.html

                if (!TempData.ContainsKey("BytesData"))
                {
                    TempData.Add("BytesData", memory.ToArray()); // prevod na pole Bytu
                }
                ViewBag.isEquiv = Session["equiv"];
                return(View(SRVM));
            }
            catch (Exception e)
            {
                TempData.Add("error", e.Message);
                return(RedirectToAction("Error", "Simulation"));
            }
            finally
            {
                proxy_simulation.Close(); // odpojení od back-endu
            }
        }
예제 #30
0
        /// <summary>
        /// 维修完成
        /// </summary>
        /// <param name="actionEventArgs"></param>
        /// <returns></returns>
        public Messages Execute(ActionEventArgs actionEventArgs)
        {
            Messages         messages         = new Messages();
            DataCollectDebug dataCollectDebug = new DataCollectDebug(this.GetType().ToString() + "Collect");

            dataCollectDebug.WhenFunctionIn(messages);
            try
            {
                ActionOnLineHelper dataCollect = new ActionOnLineHelper(this.DataProvider);
                //检查res在不在OPTS中
                // Modified By Hi1/Venus.Feng on 20080711 for Hisense Version : 对于自动作Reflow的动作来讲,不再Check Resource是否在回流的工序中
                if (((TSActionEventArgs)actionEventArgs).IgnoreResourceInOPTS != true)
                {
                    messages.AddMessages(dataCollect.CheckResourceInOperationTS(actionEventArgs));
                }
                // End Modified

                if (messages.IsSuccess())
                {
                    TSFacade tsFacade = new TSFacade(this.DataProvider);
                    //					if( !tsFacade.IsCardInTS(actionEventArgs.RunningCard))
                    //					{
                    //						messages.Add(new Message(MessageType.Error,"$CSError_Card_Not_In_TS"));
                    //					}
                    //					if(messages.IsSuccess())
                    //					{

                    //Laws Lu,2005/09/16,修改	逻辑调整P4.8
                    object obj = tsFacade.GetCardLastTSRecord(actionEventArgs.RunningCard);



                    if (obj == null)
                    {
                        messages.Add(new Message(MessageType.Error, "$CSError_Card_Not_In_TS"));
                        //messages.Add(new Message(MessageType.Error,"$CSError_Card_TSStatus_IsNot_TS"));
                    }
                    else
                    {
                        Domain.TS.TS ts = (Domain.TS.TS)obj;



                        if (ts.TSStatus == TSStatus.TSStatus_Scrap ||
                            ts.TSStatus == TSStatus.TSStatus_Split ||
                            ts.TSStatus == TSStatus.TSStatus_Reflow ||
                            ts.TSStatus == TSStatus.TSStatus_Confirm)
                        {
                            messages.Add(new Message(MessageType.Error, "$CSError_Card_TSStatus_IsNot_TS $Current_Status $" + ts.TSStatus));
                        }


                        if (messages.IsSuccess())
                        {
                            //2006/11/17,Laws Lu add get DateTime from db Server
                            DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(DataProvider);

                            DateTime dtNow = FormatHelper.ToDateTime(dbDateTime.DBDate, dbDateTime.DBTime);

                            //修改 Karron Qiu,2005-9-26
                            if (ts.FromInputType == TS.TSFacade.TSSource_OnWIP)//线上.必须是回流或者报废
                            {
                                if (((TSActionEventArgs)actionEventArgs).TSStatus == TSStatus.TSStatus_Complete)
                                {
                                    messages.Add(new Message(MessageType.Error, "$CSError_Please_Select_Reflow_OR_Scrap"));//请选择回流或者报废
                                }
                            }
                            else if (ts.FromInputType == TS.TSFacade.TSSource_TS)//离线. 不能回流
                            {
                                if (((TSActionEventArgs)actionEventArgs).TSStatus == TSStatus.TSStatus_Reflow)
                                {
                                    messages.Add(new Message(MessageType.Error, "$CSError_Offline_Cannot_Reflow"));//离线不能回流
                                }
                            }
                            else if (ts.FromInputType == TS.TSFacade.TSSource_RMA)//RMA. 不能回流
                            {
                                if (((TSActionEventArgs)actionEventArgs).TSStatus == TSStatus.TSStatus_Reflow)
                                {
                                    messages.Add(new Message(MessageType.Error, "$CSError_RMATS_Cannot_Reflow"));//RMA不能回流
                                }
                            }



                            //Laws Lu,2005/11/09,新增	记录ShiftDay
                            BaseSetting.BaseModelFacade dataModel = new BaseSetting.BaseModelFacade(this.DataProvider);
                            Domain.BaseSetting.Resource res       = (Domain.BaseSetting.Resource)dataModel.GetResource(actionEventArgs.ResourceCode);
                            //onwip.SegmentCode				= productInfo.NowSimulationReport.SegmentCode;

                            BaseSetting.ShiftModelFacade  shiftModel = new BaseSetting.ShiftModelFacade(this.DataProvider);
                            Domain.BaseSetting.TimePeriod period     = (Domain.BaseSetting.TimePeriod)shiftModel.GetTimePeriod(res.ShiftTypeCode, Web.Helper.FormatHelper.TOTimeInt(dtNow));

                            int shiftDay = 0;
                            if (period == null)
                            {
                                throw new Exception("$OutOfPerid");
                            }

                            if (period.IsOverDate == Web.Helper.FormatHelper.TRUE_STRING)
                            {
                                if (period.TimePeriodBeginTime < period.TimePeriodEndTime)
                                {
                                    shiftDay = FormatHelper.TODateInt(dtNow.AddDays(-1));
                                }
                                else if (Web.Helper.FormatHelper.TOTimeInt(dtNow) < period.TimePeriodBeginTime)
                                {
                                    shiftDay = FormatHelper.TODateInt(dtNow.AddDays(-1));
                                }
                                else
                                {
                                    shiftDay = FormatHelper.TODateInt(dtNow);
                                }
                            }
                            else
                            {
                                shiftDay = FormatHelper.TODateInt(dtNow);
                            }

                            #region 报废
                            if (((TSActionEventArgs)actionEventArgs).TSStatus == TSStatus.TSStatus_Scrap)
                            {
                                if (ts.TSStatus == TSStatus.TSStatus_TS || ts.TSStatus == TSStatus.TSStatus_Confirm)
                                {
                                    ts.TSStatus       = TSStatus.TSStatus_Scrap;
                                    ts.TSResourceCode = actionEventArgs.ResourceCode;
                                    ts.TSUser         = actionEventArgs.UserCode;

                                    ts.TSDate = shiftDay;
                                    ts.TSTime = FormatHelper.TOTimeInt(dtNow);

                                    //added by jessie lee, 2005/11/24,
                                    //新增报废原因
                                    ts.ScrapCause   = (actionEventArgs as TSActionEventArgs).ScrapCause;
                                    ts.MaintainUser = (actionEventArgs as TSActionEventArgs).MaintainUser;
                                    ts.MaintainDate = ts.TSDate;
                                    ts.MaintainTime = ts.TSTime;

                                    //TODO:Laws Lu,2005/11/09,需要优化
                                    tsFacade.UpdateTS(ts);

                                    //added by alex,2010/11/09
                                    BenQGuru.eMES.OQC.OQCFacade oqcFacade = new BenQGuru.eMES.OQC.OQCFacade(this.DataProvider);
                                    OQCLot2Card oqcLot2Card = oqcFacade.GetLastOQCLot2CardByRCard(actionEventArgs.RunningCard) as OQCLot2Card;
                                    if (oqcLot2Card != null)
                                    {
                                        oqcLot2Card.Status = "SCRAP";
                                        oqcFacade.UpdateOQCLot2Card(oqcLot2Card);
                                    }

                                    MOFacade moFAC = new MOFacade(this._domainDataProvider);

                                    if (ts.FromInputType == TSFacade.TSSource_OnWIP)
                                    {
                                        //Laws Lu,2005/08/19,新增
                                        //Laws Lu,2005/08/25,修改	处理报废时,更新工单的报废数量
                                        doAction(actionEventArgs);
                                    }
                                }
                                else
                                {
                                    messages.Add(new Message(MessageType.Error, "$CSError_Card_TSStatus_IsNot_TS_OR_Confirm"));
                                }
                            }
                            #endregion

                            #region 完成
                            if (((TSActionEventArgs)actionEventArgs).TSStatus == TSStatus.TSStatus_Complete)
                            {
                                if (ts.TSStatus == TSStatus.TSStatus_TS)
                                {
                                    ts.TSStatus = TSStatus.TSStatus_Complete;

                                    ts.TSTimes = 1;

                                    //added by jessie lee, 2005/11/24,
                                    ts.MaintainUser = (actionEventArgs as TSActionEventArgs).MaintainUser;
                                    ts.TSUser       = actionEventArgs.UserCode;
                                    ts.MaintainDate = FormatHelper.TODateInt(dtNow);
                                    ts.MaintainTime = FormatHelper.TOTimeInt(dtNow);
                                    //Laws Lu,2006/04/28 add 添加维修shiftday和维修resourcecode
                                    ts.TSDate         = shiftDay;
                                    ts.TSTime         = FormatHelper.TOTimeInt(dtNow);
                                    ts.TSResourceCode = actionEventArgs.ResourceCode;


                                    tsFacade.UpdateTS(ts);

                                    // Added by Icyer 2006/11/07, KeyPart维修完成
                                    if (ts.CardType == CardType.CardType_Part && ts.FromInputType == TSFacade.TSSource_TS)
                                    {
                                        DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider);
                                        SimulationReport  simRpt            = dataCollectFacade.GetLastSimulationReport(ts.RunningCard);
                                        if (simRpt != null && simRpt.Status == ProductStatus.NG)
                                        {
                                            simRpt.Status = ProductStatus.GOOD;
                                            dataCollectFacade.UpdateSimulationReport(simRpt);
                                        }
                                    }
                                    // Added end
                                }
                                else
                                {
                                    messages.Add(new Message(MessageType.Error, "$CSError_Card_TSStatus_IsNot_TS $Current_Status $" + ts.TSStatus));
                                }
                            }
                            #endregion

                            #region 回流
                            if (((TSActionEventArgs)actionEventArgs).TSStatus == TSStatus.TSStatus_Reflow)
                            {
                                if (ts.TSStatus == TSStatus.TSStatus_TS)
                                {
                                    ts.TSStatus     = TSStatus.TSStatus_Reflow;
                                    ts.ReflowMOCode = ((TSActionEventArgs)actionEventArgs).MOCode;
                                    //ts.ReflowResourceCode = ((TSActionEventArgs)actionEventArgs).ItemCode ;
                                    ts.ReflowRouteCode = ((TSActionEventArgs)actionEventArgs).RouteCode;
                                    ts.ReflowOPCode    = ((TSActionEventArgs)actionEventArgs).OPCode;

                                    //added by jessie lee, 2005/11/24,
                                    //added by jessie lee, 2005/11/24,
                                    ts.MaintainUser = (actionEventArgs as TSActionEventArgs).MaintainUser;
                                    ts.TSUser       = actionEventArgs.UserCode;
                                    ts.MaintainDate = FormatHelper.TODateInt(dtNow);
                                    ts.MaintainTime = FormatHelper.TOTimeInt(dtNow);

                                    //Laws Lu,2006/04/28 add 添加维修shiftday和维修resourcecode
                                    ts.TSDate         = shiftDay;
                                    ts.TSTime         = FormatHelper.TOTimeInt(dtNow);
                                    ts.TSResourceCode = actionEventArgs.ResourceCode;

                                    tsFacade.UpdateTSReflowStatus(ts);
                                }
                                else
                                {
                                    messages.Add(new Message(MessageType.Error, "$CSError_Card_TSStatus_IsNot_TS $Current_Status $" + ts.TSStatus));
                                }
                            }
                            #endregion
                        }
                    }
                }
            }
            catch (Exception e)
            {
                messages.Add(new Message(e));
            }
            dataCollectDebug.WhenFunctionOut(messages);
            return(messages);
        }