コード例 #1
0
        private Messages CollectInfo(ActionOnLineHelper onLine, ProductInfo Product)
        {
            Messages msg = new Messages();

            GetKeyParts();

            DropMaterialEventArgs Args = new DropMaterialEventArgs(ActionType.DataCollectAction_DropMaterial, Product.LastSimulation.RunningCard,
                                                                   _usercode, _rescode,
                                                                   Product);

            Args.OnwipItems = Innos.ToArray();

            msg.AddMessages(onLine.ActionWithTransaction(Args));


            return(msg);
        }
コード例 #2
0
        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);
                //填写SIMULATION 检查工单、ID、途程、操作
                // 联美兰达的下料不检查途程
                //messages.AddMessages( dataCollect.CheckID(actionEventArgs));
                if (messages.IsSuccess())
                {
                    // 联美兰达下料不更新Simulation
                    //messages.AddMessages( dataCollect.Execute(actionEventArgs));
                    if (messages.IsSuccess())
                    {
                        /*	由于界面上会自动调用GOOD采集,因此不用写报表
                         * //填写测试报表
                         * ReportHelper reportCollect= new ReportHelper(this.DataProvider);
                         * messages.AddMessages(reportCollect.ReportLineQuanMaster(this.DataProvider,actionEventArgs.ActionType,actionEventArgs.ProductInfo));
                         * messages.AddMessages(reportCollect.ReportResQuanMaster(this.DataProvider,actionEventArgs.ActionType,actionEventArgs.ProductInfo));
                         */

                        //Laws Lu,2005/10/20,新增	使用配置文件来控制物料模块是否使用
                        if (System.Configuration.ConfigurationSettings.AppSettings["NeedMaterialModule"].Trim() == "1")
                        {
                            BenQGuru.eMES.Material.CastDownHelper castHelper = new BenQGuru.eMES.Material.CastDownHelper(DataProvider);
                            ArrayList arRcard = new ArrayList();


                            castHelper.GetAllRCardByMo(ref arRcard, actionEventArgs.ProductInfo.NowSimulation.RunningCard, actionEventArgs.ProductInfo.NowSimulation.MOCode);
                            if (arRcard.Count == 0)
                            {
                                arRcard.Add(actionEventArgs.RunningCard);
                            }
                            string runningCards = "('" + String.Join("','", (string[])arRcard.ToArray(typeof(string))) + "')";

                            object[] objs = (actionEventArgs as DropMaterialEventArgs).OnwipItems;
                            //下料并归还库房
                            BenQGuru.eMES.Material.WarehouseFacade wfacade = new BenQGuru.eMES.Material.WarehouseFacade(this.DataProvider);
                            wfacade.RemoveWarehouse(
                                objs
                                , runningCards
                                , actionEventArgs.ProductInfo.NowSimulation.MOCode
                                , actionEventArgs.UserCode
                                , actionEventArgs.ProductInfo.NowSimulationReport.StepSequenceCode
                                , actionEventArgs.ProductInfo.NowSimulation.OPCode);
                        }
                        else    // Added by Icyer 2006/11/16
                        {
                            DropMaterialEventArgs arg = (DropMaterialEventArgs)actionEventArgs;
                            if (arg.OnwipItems != null)
                            {
                                // 查询需要管控的KeyPart
                                ArrayList listKeyPart    = new ArrayList();
                                ArrayList listAllKeyPart = new ArrayList();

                                //ArrayList partsToUnload = new ArrayList();
                                //ArrayList partsToReplace = new ArrayList();

                                //for (int i = 0; i < arg.OnwipItems.Length; i++)
                                //{
                                //    BenQGuru.eMES.Material.InnoObject io = (BenQGuru.eMES.Material.InnoObject)arg.OnwipItems[i];

                                //    if (io.NewBarcode.Trim().Length > 0)
                                //        partsToReplace.Add(io);
                                //    else
                                //        partsToUnload.Add(io);
                                //}

                                string            sql               = string.Empty;
                                CastDownHelper    castDownHelper    = new CastDownHelper(DataProvider);
                                BaseModelFacade   baseModelFacade   = new BaseModelFacade(this.DataProvider);
                                DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider);
                                ShiftModelFacade  shiftModelFacade  = new ShiftModelFacade(this.DataProvider);

                                DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider);
                                foreach (InnoObject io in arg.OnwipItems)
                                {
                                    //获取arRcard
                                    ArrayList arRcard = new ArrayList();
                                    castDownHelper.GetAllRCard(ref arRcard, actionEventArgs.ProductInfo.NowSimulation.RunningCard);
                                    if (arRcard.Count == 0)
                                    {
                                        arRcard.Add(actionEventArgs.RunningCard);
                                    }

                                    //获取dropop
                                    Operation2Resource objOP  = baseModelFacade.GetOperationByResource(arg.ResourceCode);
                                    string             dropop = string.Empty;
                                    if (objOP != null)
                                    {
                                        dropop = objOP.OPCode;
                                    }

                                    #region 针对旧料所作的动作

                                    string runningCards = "('" + String.Join("','", (string[])arRcard.ToArray(typeof(string))) + "')";
                                    sql = string.Format("update TBLONWIPITEM set TRANSSTATUS='{0}',ActionType=" + (int)MaterialType.DropMaterial +
                                                        ",DropOP = '" + dropop + "'" +
                                                        ",DropUser='******'" +
                                                        ",DropDate=" + dbDateTime.DBDate +
                                                        ",DropTime=" + dbDateTime.DBTime +
                                                        " where RCARD in {1} and ActionType='{2}'" +
                                                        " and MCARD in ('" + io.MCard.Trim().ToUpper() + "')"
                                                        , TransactionStatus.TransactionStatus_YES
                                                        , runningCards
                                                        , (int)Web.Helper.MaterialType.CollectMaterial);
                                    this.DataProvider.CustomExecute(new SQLCondition(sql));

                                    if (io.MCardType == MCardType.MCardType_Keyparts)
                                    {
                                        sql = "update TBLSIMULATIONREPORT set IsLoadedPart='0',LoadedRCard='' " +
                                              " where RCARD in ('" + io.MCard.Trim().ToUpper() + "')";
                                        this.DataProvider.CustomExecute(new SQLCondition(sql));

                                        sql = "update TBLITEMLOTDETAIL set SERIALSTATUS='STORAGE' " +
                                              " where SERIALNO in ('" + io.MCard.Trim().ToUpper() + "')";
                                        this.DataProvider.CustomExecute(new SQLCondition(sql));
                                    }

                                    #endregion

                                    #region 针对新料所做的动作

                                    if (io.NewBarcode.Trim().Length > 0)
                                    {
                                        object[] oldOnWIPItemList = dataCollectFacade.QueryOnWIPItem(io.MCard, runningCards, ((int)Web.Helper.MaterialType.DropMaterial).ToString());

                                        if (oldOnWIPItemList != null && oldOnWIPItemList.Length > 0)
                                        {
                                            OnWIPItem oldOnWIPItem = (OnWIPItem)oldOnWIPItemList[0];
                                            OnWIPItem newOnWIPItem = dataCollectFacade.CreateNewOnWIPItem();

                                            newOnWIPItem.RunningCard      = oldOnWIPItem.RunningCard;
                                            newOnWIPItem.MSequence        = oldOnWIPItem.MSequence;
                                            newOnWIPItem.MOCode           = oldOnWIPItem.MOCode;
                                            newOnWIPItem.ModelCode        = oldOnWIPItem.ModelCode;
                                            newOnWIPItem.ItemCode         = oldOnWIPItem.ItemCode;
                                            newOnWIPItem.MItemCode        = oldOnWIPItem.MItemCode;
                                            newOnWIPItem.MCardType        = oldOnWIPItem.MCardType;
                                            newOnWIPItem.Qty              = oldOnWIPItem.Qty;
                                            newOnWIPItem.RouteCode        = oldOnWIPItem.RouteCode;
                                            newOnWIPItem.OPCode           = oldOnWIPItem.OPCode;
                                            newOnWIPItem.ResourceCode     = oldOnWIPItem.ResourceCode;
                                            newOnWIPItem.SegmentCode      = oldOnWIPItem.SegmentCode;
                                            newOnWIPItem.StepSequenceCode = oldOnWIPItem.StepSequenceCode;
                                            newOnWIPItem.EAttribute1      = oldOnWIPItem.EAttribute1;
                                            newOnWIPItem.MOSeq            = oldOnWIPItem.MOSeq;

                                            newOnWIPItem.MCARD          = io.NewBarcode;
                                            newOnWIPItem.LotNO          = io.NewLotNo;
                                            newOnWIPItem.PCBA           = io.NewPCBA;
                                            newOnWIPItem.BIOS           = io.NewBIOS;
                                            newOnWIPItem.Version        = io.NewVersion;
                                            newOnWIPItem.VendorItemCode = io.NewVendorItemCode;
                                            newOnWIPItem.VendorCode     = io.NewVendorCode;
                                            newOnWIPItem.DateCode       = io.NewDateCode;

                                            newOnWIPItem.TransactionStatus = TransactionStatus.TransactionStatus_NO;
                                            newOnWIPItem.ActionType        = (int)Web.Helper.MaterialType.CollectMaterial;
                                            newOnWIPItem.MaintainUser      = actionEventArgs.UserCode;
                                            newOnWIPItem.MaintainDate      = dbDateTime.DBDate;
                                            newOnWIPItem.MaintainTime      = dbDateTime.DBTime;

                                            //RunningCardSequence取当前RCard的最小再减一
                                            newOnWIPItem.RunningCardSequence = dataCollectFacade.GetMinRCardSequenceFromOnWipItem(runningCards);

                                            //重新抓取ShiftTypeCode、ShiftCode、TimePeriodCode
                                            StepSequence stepSequence = (StepSequence)baseModelFacade.GetStepSequence(newOnWIPItem.StepSequenceCode);
                                            if (stepSequence == null)
                                            {
                                                newOnWIPItem.ShiftTypeCode = stepSequence.ShiftTypeCode;
                                            }
                                            else
                                            {
                                                newOnWIPItem.ShiftTypeCode = oldOnWIPItem.ShiftTypeCode;
                                            }

                                            TimePeriod timePeriod = (TimePeriod)shiftModelFacade.GetTimePeriod(newOnWIPItem.ShiftTypeCode, dbDateTime.DBTime);
                                            if (timePeriod != null)
                                            {
                                                newOnWIPItem.TimePeriodCode = timePeriod.TimePeriodCode;
                                                newOnWIPItem.ShiftCode      = timePeriod.ShiftCode;
                                            }

                                            dataCollectFacade.AddOnWIPItem(newOnWIPItem);
                                        }

                                        if (io.MCardType == MCardType.MCardType_Keyparts)
                                        {
                                            sql = "update TBLSIMULATIONREPORT set IsLoadedPart='1',LoadedRCard='" + String.Join(",", (string[])arRcard.ToArray(typeof(string))) + "' " +
                                                  " where RCARD in ('" + io.NewBarcode.Trim().ToUpper() + "')";
                                            this.DataProvider.CustomExecute(new SQLCondition(sql));

                                            sql = "update TBLITEMLOTDETAIL set SERIALSTATUS='UNSTORAGE' " +
                                                  " where SERIALNO in ('" + io.NewBarcode.Trim().ToUpper() + "')";
                                            this.DataProvider.CustomExecute(new SQLCondition(sql));
                                        }

                                        // Added By Hi1/Venus.feng on 20081114 for Hisense Version : Add Remove Pallet and Carton
                                        // 拆箱和拆Pallet
                                        DataCollectFacade dcf = new DataCollectFacade(this.DataProvider);

                                        if (messages.IsSuccess())
                                        {
                                            messages.AddMessages(dcf.RemoveFromPallet(io.NewBarcode.Trim().ToUpper(), actionEventArgs.UserCode, true));
                                            if (messages.IsSuccess())
                                            {
                                                messages.ClearMessages();
                                            }
                                        }

                                        if (messages.IsSuccess())
                                        {
                                            messages.AddMessages(dcf.RemoveFromCarton(io.NewBarcode.Trim().ToUpper(), actionEventArgs.UserCode));
                                            if (messages.IsSuccess())
                                            {
                                                messages.ClearMessages();
                                            }
                                        }
                                        // End Added
                                    }

                                    #endregion
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                messages.Add(new Message(e));
            }
            dataCollectDebug.WhenFunctionOut(messages);
            return(messages);
        }