예제 #1
0
        protected override object GetEditObject(GridRecord row)
        {
            if (facade == null)
            {
                facade = new BaseModelFacadeFactory(base.DataProvider).Create();
            }
            Operation2Resource relation = facade.CreateNewOperation2Resource();

            relation.OPCode = this.txtOperationCodeQuery.Text.Trim();
            relation.ResourceCode = row.Items.FindItemByKey("UnAssResourceCode").Text;
            relation.MaintainUser = this.GetUserCode();

            return relation;
        }
예제 #2
0
        public bool Init(IDomainDataProvider dataProvider, string resCode, DBDateTime dbDateTime)
        {
            bool returnValue = false;

            BaseModelFacade  baseModelFacade  = new BaseModelFacade(dataProvider);
            ShiftModelFacade shiftModelFacade = new ShiftModelFacade(dataProvider);

            _DataProvider = dataProvider;
            _ResCode      = resCode;
            _DBDateTime   = dbDateTime;

            //获取对应的OPCode
            Operation2Resource op2Res = (Operation2Resource)baseModelFacade.GetOperationByResource(_ResCode);

            if (op2Res != null)
            {
                _Operation = (Operation)baseModelFacade.GetOperation(op2Res.OPCode);
            }
            if (_Operation == null)
            {
                return(returnValue);
            }

            //获取对应的SS
            Resource res = (Resource)baseModelFacade.GetResource(_ResCode);

            if (res != null)
            {
                _StepSequence = (StepSequence)baseModelFacade.GetStepSequence(res.StepSequenceCode);
            }
            if (_StepSequence == null)
            {
                return(returnValue);
            }

            //获取当前的ShiftDate
            _ShiftDate = shiftModelFacade.GetShiftDayBySS(_StepSequence, _DBDateTime.DateTime);

            //获取当前的Shift
            _Shift = (Shift)shiftModelFacade.GetShift(_StepSequence.ShiftTypeCode, _DBDateTime.DBTime);
            if (_Shift == null)
            {
                return(returnValue);
            }

            returnValue = true;

            return(returnValue);
        }
예제 #3
0
        protected override object GetEditObject()
        {
            if (facade == null)
            {
                facade = new BaseModelFacadeFactory(base.DataProvider).Create();
            }
            Operation2Resource relation = this.facade.CreateNewOperation2Resource();

            relation.OPCode           = FormatHelper.CleanString(this.txtOperationCodeQuery.Text.Trim(), 40);
            relation.ResourceCode     = FormatHelper.CleanString(this.txtResourceCodeEdit.Text, 40);
            relation.ResourceSequence = 0;            // System.Int32.Parse( this.txtResourceSequenceEdit.Text );
            relation.MaintainUser     = this.GetUserCode();

            return(relation);
        }
예제 #4
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);
        }
예제 #5
0
        private void LoadInitData()
        {
            if (product == null)
            {
                TSModel.TSModelFacade tsmodelFacade = new TSModelFacade(this.DataProvider);
                object[] objsECodeAll = tsmodelFacade.GetAllErrorCode();
                if (objsECodeAll == null || objsECodeAll.Length == 0)
                {
                    return;
                }

                ErrorCodeA[] errorsAll = new ErrorCodeA[objsECodeAll.Length];
                objsECodeAll.CopyTo(errorsAll, 0);
                this.ucErrorCodeSelect21.AddErrorCodes(errorsAll);
                this.ucErrorCodeSelect21.Focus();
                this.ucErrorCodeSelect21.FocusInput();
                return;
            }

            if (product == null || product.LastSimulation == null)
            {
                return;
            }
            ItemFacade itFacade = new ItemFacade(this.DataProvider);

            BaseSetting.BaseModelFacade baseFacade = new BaseSetting.BaseModelFacade(this.DataProvider);

            object op = null;

            if (product.LastSimulation.RouteCode != null && product.LastSimulation.RouteCode != string.Empty)
            {
                try
                {
                    op = itFacade.GetItemRoute2Operation(product.LastSimulation.ItemCode,
                                                         product.LastSimulation.RouteCode,
                                                         product.LastSimulation.OPCode);
                }
                catch { }
            }

            string strOPCode = "";

            if (op != null)
            {
                ItemRoute2OP CurrentOP = op as ItemRoute2OP;
                object       objOP2RES = baseFacade.GetOperation2Resource(CurrentOP.OPCode, this.txtResource.Value.Trim().ToUpper());
                if (objOP2RES != null)
                {
                    strOPCode = CurrentOP.OPCode;
                }
                else
                {
                    /* joe song 不知道这段代码为什么这样写,为了增加对线外工序的支持, 修改之
                     * //object objSOP = baseFacade.GetOperationByRouteAndResource(product.LastSimulation.RouteCode, this.txtResource.Value.Trim().ToUpper());
                     * //if (objSOP != null)
                     * //{
                     * //    object actOP = itFacade.GetItemRoute2Operation(product.LastSimulation.ItemCode, product.LastSimulation.RouteCode, (objSOP as Operation).OPCode);
                     * //     if (actOP != null)
                     * //    {
                     * //         CurrentOP = actOP as ItemRoute2OP;
                     * //         strOPCode = CurrentOP.OPCode;
                     * //     }
                     * // }
                     * */
                    Operation2Resource or = baseFacade.GetOperationByResource(this.txtResource.Value.Trim().ToUpper()) as Operation2Resource;
                    if (or != null)
                    {
                        strOPCode = or.OPCode;
                    }
                }
            }
            if (strOPCode == "")
            {
                Operation2Resource or = baseFacade.GetOperationByResource(this.txtResource.Value.Trim().ToUpper()) as Operation2Resource;
                if (or != null)
                {
                    strOPCode = or.OPCode;
                }
            }
            if (strOPCode == "")
            {
                return;
            }

            object[] objsECode = baseFacade.GetAllErrorCodeByOperationCode(strOPCode);
            if (objsECode == null || objsECode.Length == 0)
            {
                return;
            }

            ErrorCodeA[] errors = new ErrorCodeA[objsECode.Length];
            objsECode.CopyTo(errors, 0);
            this.ucErrorCodeSelect21.AddErrorCodes(errors);
            this.ucErrorCodeSelect21.Focus();
            this.ucErrorCodeSelect21.FocusInput();
        }
예제 #6
0
        private void txtMoCode_KeyDown(object sender, KeyEventArgs e)
        {
            Messages msg = new Messages();

            clearAll();
            if (e.KeyCode == Keys.Enter)
            {
                try
                {
                    if (!string.IsNullOrEmpty(this.txtMoCode.Text))
                    {
                        object objMo = m_MOFacade.GetMO(txtMoCode.Text.ToUpper());

                        if (objMo != null)
                        {
                            MO mo = (MO)objMo;
                            this.txtItemCode.Text = mo.ItemCode;
                            int  orgID = Convert.ToInt16(mo.OrganizationID);
                            Item item  = (Item)m_ItemFacade.GetItem(mo.ItemCode, orgID);
                            this.txtItemDesc.Text = item.ItemDescription;
                            Operation2Resource opRes = (Operation2Resource)
                                                       m_BaseModelFacade.GetOperationByResource(
                                ApplicationService.Current().LoginInfo.Resource.ResourceCode);
                            DoQuery(mo.ItemCode, opRes.OPCode);
                        }
                        else
                        {
                            msg.Add(new UserControl.Message(MessageType.Error, "$Error_MOCode_NotCompare"));
                            ApplicationRun.GetInfoForm().Add(msg);
                            clearAll();
                        }
                    }
                }
                catch (Exception ex)
                {
                    msg.Add(new UserControl.Message(ex));
                    ApplicationRun.GetInfoForm().Add(msg);
                    txtMoCode.Focus();
                    clearAll();
                    return;
                }

                try
                {
                    if (!string.IsNullOrEmpty(this.txtRcard.Text))
                    {
                        object objSim = m_DataCollectFacade.GetSimulation(txtRcard.Text);

                        if (objSim != null)
                        {
                            Simulation sim = (Simulation)objSim;
                            this.txtItemCode.Text = sim.ItemCode;
                            object objMo = m_MOFacade.GetMO(sim.MOCode.ToUpper());
                            int    orgID = Convert.ToInt16(((MO)objMo).OrganizationID);
                            Item   item  = (Item)m_ItemFacade.GetItem(((MO)objMo).ItemCode, orgID);
                            this.txtItemDesc.Text = item.ItemDescription;
                            DoQuery(sim.ItemCode, sim.OPCode);
                        }
                        else
                        {
                            msg.Add(new UserControl.Message(MessageType.Error, "$Error_CS_ID_Not_Exist"));
                            ApplicationRun.GetInfoForm().Add(msg);
                            clearAll();
                        }
                    }
                }
                catch (Exception ex)
                {
                    msg.Add(new UserControl.Message(ex));
                    ApplicationRun.GetInfoForm().Add(msg);
                    txtRcard.Focus();
                    clearAll();
                    return;
                }
            }
        }