Beispiel #1
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            PostBackTrigger trigger = new PostBackTrigger();

            trigger.ControlID = this.cmdSave.ID;
            (this.impForm.FindControl("up1") as UpdatePanel).Triggers.Add(trigger);
            if (!IsPostBack)
            {
                // 初始化页面语言
                this.InitPageLanguage(this.languageComponent1, false);

                if (_itemFacade == null)
                {
                    _itemFacade = new FacadeFactory(base.DataProvider).CreateItemFacade();
                }
                this.InitPageLanguage(this.languageComponent1, false);
                InitParameters();
                InitdrpMergeTypeEdit();
                InitOptionOP();

                ItemRoute2OP ip = (ItemRoute2OP)this._itemFacade.GetItemRoute2Op(OPID, GlobalVariables.CurrentOrganizations.First().OrganizationID);
                SetEditObject(ip);

                CheckReflow(ip.ItemCode);
            }
        }
Beispiel #2
0
        private void SetEditObject(object obj)
        {
            this.chklstOPControlEdit_Load();
            if (obj == null)
            {
                this.txtItemRouteOperationSeqEdit.Text = string.Empty;
                this.txtItemOperationCodeEdit.Text     = string.Empty;
                this.txtOPDescriptionQuery.Text        = string.Empty;
                //(new OperationListFactory()).CreateOperationListCheckBoxList(this.chklstOPControlEdit,"0000000000000");
                (new OperationListFactory()).CreateNewOperationListCheckBoxList(this.chklstOPControlEdit, this.chklstOPAttributeEdit, this.languageComponent1);
                this.pnlMainEdit.Visible  = false;
                this.PnlChildEdit.Visible = false;

                this.cmdSave.Disabled = true;
            }
            else
            {
                ItemRoute2OP itemRoute2OP = (ItemRoute2OP)obj;
                this.txtItemRouteOperationSeqEdit.Text = itemRoute2OP.OPSequence.ToString();
                this.txtItemOperationCodeEdit.Text     = itemRoute2OP.OPCode;

                BaseModelFacade baseModelFacade = new BaseModelFacade(this.DataProvider);
                Operation       op = (Operation)baseModelFacade.GetOperation(itemRoute2OP.OPCode);
                if (op != null)
                {
                    this.txtOPDescriptionQuery.Text = op.OPDescription;
                }
                else
                {
                    this.txtOPDescriptionQuery.Text = string.Empty;
                }

                this.txtItemOperationCodeEdit.ReadOnly = true;
                this.txtOPDescriptionQuery.ReadOnly    = true;
                (new OperationListFactory()).CreateOperationListCheckBoxList(this.chklstOPControlEdit, this.chklstOPAttributeEdit, itemRoute2OP.OPControl);
                if (FormatHelper.StringToBoolean(itemRoute2OP.OPControl, (int)OperationList.IDTranslation))
                {
                    this.pnlMainEdit.Visible = true;

                    this.drpMergeTypeEdit.SelectedValue = itemRoute2OP.IDMergeType;
                    if (itemRoute2OP.IDMergeType == IDMergeType.IDMERGETYPE_ROUTER)
                    {
                        this.PnlChildEdit.Visible    = true;
                        this.txtDenominatorEdit.Text = itemRoute2OP.IDMergeRule.ToString();
                    }
                    else
                    {
                        this.PnlChildEdit.Visible = false;
                    }
                }
                else
                {
                    this.pnlMainEdit.Visible = false;
                }
                this.cmdSave.Disabled = false;

                drpOptionalOP.SelectedValue = itemRoute2OP.OptionalOP;
            }
        }
Beispiel #3
0
        // Added by Icyer 2006/12/15
        // 检查工单
        private Messages CheckMO(object act)
        {
            Messages msgs = new Messages();

            BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider domainProvider = null;
            if ((act as IDCTClient).DBConnection != null)
            {
                domainProvider = (act as IDCTClient).DBConnection as BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider;
            }
            else
            {
                domainProvider = Common.DomainDataProvider.DomainDataProviderManager.DomainDataProvider()
                                 as BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider;
                (act as IDCTClient).DBConnection = domainProvider;
            }

            MOFacade moFacade = new MOFacade(domainProvider);
            MO       mo       = (MO)moFacade.GetMO(act.ToString().ToUpper());

            if (mo == null)
            {
                msgs.Add(new UserControl.Message(MessageType.Error, "$CS_MO_NOT_EXIST"));
                ProcessBeforeReturn(this.Status, msgs);
                return(msgs);
            }
            if (mo.MOStatus != BenQGuru.eMES.Web.Helper.MOManufactureStatus.MOSTATUS_RELEASE &&
                mo.MOStatus != BenQGuru.eMES.Web.Helper.MOManufactureStatus.MOSTATUS_OPEN)
            {
                msgs.Add(new UserControl.Message(MessageType.Error, "$Error_CS_MO_Should_be_Release_or_Open"));
                ProcessBeforeReturn(this.Status, msgs);
                return(msgs);
            }

            MO2Route route = (MO2Route)moFacade.GetMONormalRouteByMOCode(mo.MOCode);

            if (route == null)
            {
                msgs.Add(new UserControl.Message(MessageType.Error, "$CS_MOnotNormalRoute"));
                ProcessBeforeReturn(this.Status, msgs);
                return(msgs);
            }

            DataCollectFacade dataCollectFacade = new DataCollectFacade(domainProvider);
            ItemRoute2OP      op = dataCollectFacade.GetMORouteFirstOP(mo.MOCode, route.RouteCode);

            BenQGuru.eMES.BaseSetting.BaseModelFacade dataModel = new BenQGuru.eMES.BaseSetting.BaseModelFacade(domainProvider);
            if (dataModel.GetOperation2Resource(op.OPCode, (act as IDCTClient).ResourceCode) == null)
            {
                msgs.Add(new UserControl.Message(MessageType.Error, "$CS_Route_Failed_FirstOP $Domain_MO =" + mo.MOCode));
                ProcessBeforeReturn(this.Status, msgs);
                return(msgs);
            }

            ProcessBeforeReturn(this.Status, msgs);

            return(msgs);
        }
Beispiel #4
0
        public bool IsPackingOperation(string itemCode, string routeCode, string opCode)
        {
            ItemFacade itemFacade = new ItemFacade(this.DataProvider);
            object     obj        = itemFacade.GetItemRoute2Operation(itemCode, routeCode, opCode);

            if (obj == null)
            {
                throw new Exception("Error_ItemRoute2OP_NotExisted");
            }
            ItemRoute2OP itemRoute2Op = obj as ItemRoute2OP;

            return(FormatHelper.StringToBoolean(itemRoute2Op.OPControl, (int)OperationList.Packing));
        }
Beispiel #5
0
        private object GetEditObject()
        {
            if (_itemFacade == null)
            {
                _itemFacade = new FacadeFactory(base.DataProvider).CreateItemFacade();
            }
            ItemRoute2OP itemRoute2OP = (ItemRoute2OP)this._itemFacade.GetItemRoute2Op(OPID, GlobalVariables.CurrentOrganizations.First().OrganizationID);

            try
            {
                itemRoute2OP.OPSequence = System.Int32.Parse(this.txtItemRouteOperationSeqEdit.Text.Trim());
            }
            catch
            {
                itemRoute2OP.OPSequence = 0;
            }

            itemRoute2OP.OPControl = (new OperationListFactory()).CreateOperationList(this.chklstOPControlEdit, this.chklstOPAttributeEdit);

            if (pnlMainEdit.Visible)
            {
                itemRoute2OP.IDMergeType = FormatHelper.CleanString(this.drpMergeTypeEdit.SelectedValue);
                if (this.PnlChildEdit.Visible)
                {
                    itemRoute2OP.IDMergeRule = System.Int32.Parse(FormatHelper.CleanString(this.txtDenominatorEdit.Text));
                }
            }
            else
            {
                itemRoute2OP.IDMergeType = IDMergeType.IDMERGETYPE_IDMERGE;
            }

            itemRoute2OP.OptionalOP = drpOptionalOP.SelectedValue;

            itemRoute2OP.OrganizationID = GlobalVariables.CurrentOrganizations.First().OrganizationID;

            if (itemRoute2OP != null)
            {
                DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider);
                itemRoute2OP.MaintainUser = this.GetUserCode();
                itemRoute2OP.MaintainDate = dbDateTime.DBDate;
                itemRoute2OP.MaintainTime = dbDateTime.DBTime;
            }

            return(itemRoute2OP);
        }
        protected override object GetEditObject(UltraGridRow row)
        {
            if (row != null)
            {
                ItemFacade   itemFacade = new ItemFacade(base.DataProvider);
                ItemRoute2OP ip         = (ItemRoute2OP)itemFacade.GetItemRoute2Op(_opid, GlobalVariables.CurrentOrganizations.First().OrganizationID);

                ItemRouteOp2ErrorCauseGroup relation = _facade.CreateNewItemRouteOp2ErrorCauseGroup();
                relation.OpID = _opid;
                relation.ErrorCauseGroupCode = row.Cells.FromKey("ErrorCauseGroupCode").Value.ToString();
                relation.ItemCode            = ip.ItemCode;
                relation.RouteCode           = ip.RouteCode;
                relation.OpCode       = ip.OPCode;
                relation.MaintainUser = this.GetUserCode();

                return(relation);
            }

            return(null);
        }
Beispiel #7
0
        protected void Return(object sender, System.EventArgs e, string returnMessage)
        {
            if (_itemFacade == null)
            {
                _itemFacade = new FacadeFactory(base.DataProvider).CreateItemFacade();
            }
            ItemRoute2OP itemRoute2OP = (ItemRoute2OP)_itemFacade.GetItemRoute2Op(OPID, GlobalVariables.CurrentOrganizations.First().OrganizationID);

            string target = this.MakeRedirectUrl("FOPBOMOperationComponetLoadingMP.aspx",
                                                 new string[] { "opid", "opcode", "itemcode", "opbomcode", "opbomversion", "routecode", "actiontype", "OrgID" },
                                                 new string[] { OPID, itemRoute2OP.OPCode, Server.UrlEncode(ItemCode), OPBOMCode, OPBOMVersion, Server.UrlEncode(RouteCode), this.Actiontype.ToString(), OrgID.ToString() });


            if (returnMessage.Trim().Length > 0)
            {
                Session["ReturnMessage"] = returnMessage;
            }

            this.Response.Redirect(target);
        }
        protected override object GetEditObject()
        {
            if (this.ValidateInput())
            {
                ItemFacade   itemFacade = new ItemFacade(base.DataProvider);
                ItemRoute2OP ip         = (ItemRoute2OP)itemFacade.GetItemRoute2Op(_opid, GlobalVariables.CurrentOrganizations.First().OrganizationID);

                ItemRouteOp2ErrorCauseGroup relation = _facade.CreateNewItemRouteOp2ErrorCauseGroup();
                relation.OpID = _opid;
                relation.ErrorCauseGroupCode = this.drpErrorCauseGroupEdit.SelectedValue;
                relation.ItemCode            = ip.ItemCode;
                relation.RouteCode           = ip.RouteCode;
                relation.OpCode       = ip.OPCode;
                relation.MaintainUser = this.GetUserCode();

                return(relation);
            }
            else
            {
                return(null);
            }
        }
Beispiel #9
0
        // 查询产品序列号应处的工序
        public Messages GetRunningCardOP(ProductInfo product, Common.DomainDataProvider.SQLDomainDataProvider domainProvider)
        {
            Messages          msg         = new Messages();
            DataCollectFacade dataCollect = new DataCollectFacade(domainProvider);

            try
            {
                ItemRoute2OP op = dataCollect.GetMORouteNextOP(product.LastSimulation.MOCode, product.LastSimulation.RouteCode, product.LastSimulation.OPCode);
                if (op != null)
                {
                    msg.Add(new UserControl.Message(MessageType.Success, "$DCT_RunningCard_In_OP " + op.OPCode));
                }
                else
                {
                    msg.Add(new Message(MessageType.Error, "$CS_Route_Failed_GetNotNextOP"));
                }
            }
            catch (Exception ex)
            {
                msg.Add(new Message(ex));
            }
            return(msg);
        }
        //取得这个产品别下的所有不良原因组
        private void BuildErrorCauseGroup()
        {
            ItemFacade   itemFacade = new ItemFacade(base.DataProvider);
            ItemRoute2OP ip         = (ItemRoute2OP)itemFacade.GetItemRoute2Op(_opid, GlobalVariables.CurrentOrganizations.First().OrganizationID);
            Model        model      = new ModelFacade(base.DataProvider).GetModelByItemCode(ip.ItemCode);

            object[] ecgList = new TSModelFacade(base.DataProvider).QueryModel2ErrorCauseGroup(model.ModelCode, string.Empty, 1, int.MaxValue);

            BenQGuru.eMES.TSModel.TSModelFacade fa = new TSModelFacade(base.DataProvider);
            this.drpErrorCauseGroupEdit.Items.Clear();
            if (ecgList != null)
            {
                foreach (BenQGuru.eMES.Domain.TSModel.Model2ErrorCauseGroup ecg in ecgList)
                {
                    BenQGuru.eMES.Domain.TSModel.ErrorCauseGroup obj = fa.GetErrorCauseGroup(ecg.ErrorCauseGroupCode) as BenQGuru.eMES.Domain.TSModel.ErrorCauseGroup;

                    ListItem item = new ListItem(obj.ErrorCauseGroupDescription, ecg.ErrorCauseGroupCode);
                    if (!this.drpErrorCauseGroupEdit.Items.Contains(item))
                    {
                        this.drpErrorCauseGroupEdit.Items.Add(item);
                    }
                }
            }
        }
Beispiel #11
0
        private Messages SetRCardReflowByErrorCode(ActionEventArgs actionEventArgs)
        {
            Messages messages  = new Messages();
            string   routeCode = "";
            string   opCode    = "";

            System.Collections.Generic.List <string> listErrorCode = new System.Collections.Generic.List <string>();

            if (((TSActionEventArgs)actionEventArgs).ErrorCodes != null)
            {
                ErrorCodeGroup2ErrorCode[] error = new ErrorCodeGroup2ErrorCode[((TSActionEventArgs)actionEventArgs).ErrorCodes.Length];
                ((TSActionEventArgs)actionEventArgs).ErrorCodes.CopyTo(error, 0);
                for (int i = 0; i < error.Length; i++)
                {
                    if (error[i].ErrorCode != "" && listErrorCode.Contains(error[i].ErrorCode) == false)
                    {
                        listErrorCode.Add(error[i].ErrorCode);
                    }
                }
            }
            if (listErrorCode.Count == 0)
            {
                return(messages);
            }

            // 查询不良代码和产品对应的返工途程
            TSModel.TSModelFacade tsmodelFacade = new BenQGuru.eMES.TSModel.TSModelFacade(this.DataProvider);
            object objErrorCode2OPRework        = tsmodelFacade.GetErrorCode2OPRework(actionEventArgs.ProductInfo.NowSimulation.OPCode,
                                                                                      listErrorCode[0], GlobalVariables.CurrentOrganizations.First().OrganizationID);

            object             tempOPRework;
            ErrorCode2OPRework tempErrorCode2OPRework;

            if (objErrorCode2OPRework == null)
            {
                for (int i = 1; i < listErrorCode.Count; i++)
                {
                    tempOPRework = tsmodelFacade.GetErrorCode2OPRework(actionEventArgs.ProductInfo.NowSimulation.OPCode,
                                                                       listErrorCode[i], GlobalVariables.CurrentOrganizations.First().OrganizationID);
                    if (tempOPRework != null)
                    {
                        messages.Add(new Message(MessageType.Error, "$Error_ErrorCodeHaveMoreThanOneRoute"));
                        return(messages);
                    }
                }
                return(messages);
            }
            else
            {
                ErrorCode2OPRework firstErrorCode2OPRework = objErrorCode2OPRework as ErrorCode2OPRework;
                for (int i = 1; i < listErrorCode.Count; i++)
                {
                    tempOPRework = tsmodelFacade.GetErrorCode2OPRework(actionEventArgs.ProductInfo.NowSimulation.OPCode,
                                                                       listErrorCode[i], GlobalVariables.CurrentOrganizations.First().OrganizationID);

                    if (tempOPRework == null)
                    {
                        messages.Add(new Message(MessageType.Error, "$Error_ErrorCodeHaveMoreThanOneRoute"));
                        return(messages);
                    }
                    else
                    {
                        tempErrorCode2OPRework = tempOPRework as ErrorCode2OPRework;
                        if (tempErrorCode2OPRework.RouteCode != firstErrorCode2OPRework.RouteCode ||
                            tempErrorCode2OPRework.ToOPCode != firstErrorCode2OPRework.ToOPCode)
                        {
                            messages.Add(new Message(MessageType.Error, "$Error_ErrorCodeHaveMoreThanOneRoute"));
                            return(messages);
                        }
                    }
                }

                opCode    = firstErrorCode2OPRework.ToOPCode;
                routeCode = firstErrorCode2OPRework.RouteCode;
                if (string.Compare(opCode, "TS", true) == 0)
                {
                    return(messages);
                }
            }

            if (routeCode.Trim().Length == 0)  // 如果途程等于空,则将当前序列号的途程作为返工途程
            {
                routeCode = actionEventArgs.ProductInfo.NowSimulation.RouteCode;
            }

            // 检查产品与途程的对应
            ItemFacade   itemFacade = new ItemFacade(this.DataProvider);
            ItemRoute2OP op         = (ItemRoute2OP)itemFacade.GetItemRoute2Operation(actionEventArgs.ProductInfo.NowSimulation.ItemCode, routeCode, opCode);

            if (op == null)
            {
                messages.Add(new Message(MessageType.Error, "$Error_ReworkRouteNotBelongToItem [" + routeCode + "]"));
                return(messages);
            }

            // 将TS的状态改成维修中
            TSFacade tsFacade = new TSFacade(this.DataProvider);
            object   obj      = tsFacade.GetCardLastTSRecord(actionEventArgs.LotCode);

            if (obj != null)
            {
                Domain.TS.TS ts = (Domain.TS.TS)obj;
                ts.ConfirmResourceCode = actionEventArgs.ResourceCode;
                ts.ConfirmUser         = actionEventArgs.UserCode;
                ts.ConfirmDate         = actionEventArgs.ProductInfo.NowSimulation.BeginDate;
                ts.ConfirmTime         = actionEventArgs.ProductInfo.NowSimulation.BeginTime;
                ts.TSStatus            = TSStatus.TSStatus_TS;
                tsFacade.UpdateTS(ts);
            }
            else
            {
                return(messages);
            }

            // 开始设置回流
            ActionFactory     actionFactory     = new ActionFactory(this.DataProvider);
            IAction           actionTSComplete  = actionFactory.CreateAction(ActionType.DataCollectAction_TSComplete);
            TSActionEventArgs tsactionEventArgs = new TSActionEventArgs(
                ActionType.DataCollectAction_TSComplete,
                actionEventArgs.LotCode,
                actionEventArgs.UserCode,
                actionEventArgs.ResourceCode,
                TSStatus.TSStatus_Reflow,
                actionEventArgs.ProductInfo.NowSimulation.MOCode,
                actionEventArgs.ProductInfo.NowSimulation.ItemCode,
                routeCode,
                op.OPCode,
                actionEventArgs.UserCode,
                null);

            tsactionEventArgs.RouteCode            = routeCode;
            tsactionEventArgs.IgnoreResourceInOPTS = true;

            messages.AddMessages(actionTSComplete.Execute(tsactionEventArgs));

            return(messages);
        }
Beispiel #12
0
        public Messages CheckIn(ActionEventArgs actionEventArgs)
        {
            ((GoToMOActionEventArgs)actionEventArgs).PassCheck = true;

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

            dataCollectDebug.WhenFunctionIn(messages);

            try
            {
                DataCollectFacade   dataCollectFacade = new DataCollectFacade(this.DataProvider);
                MOFacade            moFacade          = new MOFacade(this.DataProvider);
                MOLotFacade         moLotFacade       = new MOLotFacade(this.DataProvider);
                BaseModelFacade     dataModel         = new BaseModelFacade(this.DataProvider);
                ModelFacade         mf           = new ModelFacade(this.DataProvider);
                SystemSettingFacade systemFacade = new SystemSettingFacade(this.DataProvider);

                //AMOI  MARK  START  20050803 序号默认为初始,FOR 重工序列号重复
                actionEventArgs.ProductInfo.NowSimulation.LotSeq = ActionOnLineHelper.StartSeq;
                //AMOI  MARK  END

                if (((GoToMOActionEventArgs)actionEventArgs).MOCode == null || ((GoToMOActionEventArgs)actionEventArgs).MOCode.Trim() == string.Empty)
                {
                    throw new Exception("$CS_Sys_GoToMO_Lost_MOParam");
                }


                #region 检查途程
                MO mo = null;
                if (actionEventArgs.CurrentMO != null)
                {
                    mo = actionEventArgs.CurrentMO;
                }
                else
                {
                    mo = (MO)moFacade.GetMO(((GoToMOActionEventArgs)actionEventArgs).MOCode);
                    actionEventArgs.CurrentMO = mo;
                }
                if (mo == null)
                {
                    throw new Exception("$CS_MO_Not_Exit");
                }

                MO2Route route = (MO2Route)moFacade.GetMONormalRouteByMOCode(mo.MOCode);
                if (route == null)
                {
                    throw new Exception("$CS_MOnotNormalRoute");
                }

                ItemRoute2OP op = dataCollectFacade.GetMORouteFirstOP(mo.MOCode, route.RouteCode);

                if (dataModel.GetOperation2Resource(op.OPCode, actionEventArgs.ResourceCode) == null)
                {
                    throw new Exception("$CS_Route_Failed_FirstOP $Domain_MO =" + mo.MOCode);
                }
                #endregion

                #region 检查工单

                //工单状态检查
                if (!dataCollectFacade.CheckMO(mo))
                {
                    throw new Exception("$CS_MO_Status_Error $CS_Param_MOStatus=$" + mo.MOStatus);
                }

                /*1.Simulation 没有记录
                 *	    a. MO Running Card 没有重复		OK
                 *     b. MO Running Card 有重复		Exception
                 *
                 * 2. Simulation 有记录
                 *		a.  Simulation 工单 和 当前工单 一样			OK
                 *		b.  Simulation 工单 和 当前工单 不一样
                 *			 b1.  当前工单 是重工工单
                 *					b11.  MO Running Card 没有重复		OK
                 *					b12.  MO Running Card 有重复			Exception
                 *			 b2.  当前工单不是重工工单						Exception
                 *
                 */

                Parameter parameter = (Parameter)systemFacade.GetParameter(mo.MOType, BenQGuru.eMES.Web.Helper.MOType.GroupType);

                if (parameter == null)
                {
                    throw new Exception("$CS_MOType_Lost");
                }
                mo.MOType = parameter.ParameterValue;

                if (actionEventArgs.ProductInfo.LastSimulation != null)
                {
                    //归属工单和归属工序相同也不允许
                    if ((mo.MOCode == actionEventArgs.ProductInfo.LastSimulation.MOCode))
                    {
                        ((GoToMOActionEventArgs)actionEventArgs).PassCheck = false;
                        return(messages);
                    }
                    //Laws Lu,2005/10/20,修改	Lucky的需求	CS112
                    //建议返工工单归属采集时增加判断条件,也就是说只有没有在制记录的或者已经拆解的产品序列号才能归属返工工单
                    if (actionEventArgs.ProductInfo.LastSimulation.IsComplete == "0")
                    {
                        throw new Exception("$CS_PRODUCT_STILL_INLINE_NOT_BELONG_MO ,$CS_Param_ID=" + actionEventArgs.LotCode);
                    }
                }

                // 投入量检查
                if (mo.IsControlInput == "1")   // 客户在工单中勾选了“限制投入量”则检查工单可投入量,否则不检查
                {
                    if (mo.MOPlanQty - mo.MOInputQty + mo.MOScrapQty + mo.MOOffQty - mo.IDMergeRule < 0)
                    {
                        throw new Exception("$CS_MOInputOut $Domain_MO =" + mo.MOCode);
                    }
                }
                #endregion

                #region 检查库房状态
                if (System.Configuration.ConfigurationSettings.AppSettings["NeedMaterialModule"] != null &&
                    System.Configuration.ConfigurationSettings.AppSettings["NeedMaterialModule"].Trim() == "1")
                {
                    Material.WarehouseFacade wFAC = new BenQGuru.eMES.Material.WarehouseFacade(DataProvider);
                    //读资源对应的产线
                    BenQGuru.eMES.BaseSetting.BaseModelFacade facade = new BenQGuru.eMES.BaseSetting.BaseModelFacade(this.DataProvider);
                    object objResource = facade.GetResource(actionEventArgs.ResourceCode);

                    string strSSCode = ((BenQGuru.eMES.Domain.BaseSetting.Resource)objResource).StepSequenceCode;
                    object obj       = wFAC.GetWarehouseByMoSS(mo.MOCode, strSSCode);
                    if (obj != null)
                    {
                        Domain.Warehouse.Warehouse wh = obj as Domain.Warehouse.Warehouse;
                        //Laws Lu,2006/02/20,修改/无需工段代码
                        string strStatus = wFAC.GetWarehouseStatus(wh.WarehouseCode, wh.FactoryCode);
                        if (strStatus == Domain.Warehouse.Warehouse.WarehouseStatus_Cycle)
                        {
                            throw new Exception("$CS_LINE_IS_HOLD");
                        }
                    }
                }
                #endregion

                #region 填写新SIMULATION 归属工单 批次数量从tblmo2lotlink 中获取

                Domain.MOModel.MO2LotLink mo2lotlink = moLotFacade.GetMO2LotLink(actionEventArgs.LotCode, mo.MOCode) as Domain.MOModel.MO2LotLink;
                if (mo2lotlink != null)
                {
                    if (mo2lotlink.LotStatus != LotStatusForMO2LotLink.LOTSTATUS_STOP)
                    {
                        mo2lotlink.LotStatus = LotStatusForMO2LotLink.LOTSTATUS_USE;
                        moLotFacade.UpdateMO2LotLink(mo2lotlink);

                        actionEventArgs.ProductInfo.NowSimulation.LotQty  = mo2lotlink.LotQty;
                        actionEventArgs.ProductInfo.NowSimulation.GoodQty = mo2lotlink.LotQty;
                        actionEventArgs.ProductInfo.NowSimulation.NGQty   = 0;
                    }
                    else
                    {
                        throw new Exception("$CS_Mo2LotLink_Error_Status");
                    }
                }
                else
                {
                    throw new Exception("$CS_Mo2LotLink_Not_Exist");
                }


                //messages.AddMessages( dataCollectFacade.WriteSimulation(id,actionType,resourceCode,userCode,product));
                actionEventArgs.ProductInfo.NowSimulation.RouteCode  = route.RouteCode;
                actionEventArgs.ProductInfo.NowSimulation.OPCode     = op.OPCode;
                actionEventArgs.ProductInfo.NowSimulation.LotStatus  = LotStatusForMO2LotLink.LOTSTATUS_USE;
                actionEventArgs.ProductInfo.NowSimulation.LastAction = ActionType.DataCollectAction_GoMO;
                actionEventArgs.ProductInfo.NowSimulation.ActionList = ";" + ActionType.DataCollectAction_GoMO + ";";
                actionEventArgs.ProductInfo.NowSimulation.LotCode    = actionEventArgs.LotCode;
                actionEventArgs.ProductInfo.NowSimulation.MOCode     = mo.MOCode;
                actionEventArgs.ProductInfo.NowSimulation.ItemCode   = mo.ItemCode;
                Model model = mf.GetModelByItemCode(mo.ItemCode);
                if (model == null)
                {
                    throw new Exception("$CS_Model_Lost $CS_Param_ItemCode=" + mo.ItemCode);
                }
                actionEventArgs.ProductInfo.NowSimulation.ModelCode     = model.ModelCode;
                actionEventArgs.ProductInfo.NowSimulation.IsComplete    = ProductComplete.NoComplete;
                actionEventArgs.ProductInfo.NowSimulation.CollectStatus = CollectStatus.CollectStatus_BEGIN;
                actionEventArgs.ProductInfo.NowSimulation.ResCode       = actionEventArgs.ResourceCode;
                actionEventArgs.ProductInfo.NowSimulation.ProductStatus = ProductStatus.GOOD;
                actionEventArgs.ProductInfo.NowSimulation.FromOP        = ActionOnLineHelper.StringNull;
                actionEventArgs.ProductInfo.NowSimulation.FromRoute     = ActionOnLineHelper.StringNull;
                actionEventArgs.ProductInfo.NowSimulation.CartonCode    = ActionOnLineHelper.StringNull;
                actionEventArgs.ProductInfo.NowSimulation.LotNo         = ActionOnLineHelper.StringNull;
                actionEventArgs.ProductInfo.NowSimulation.PalletCode    = ActionOnLineHelper.StringNull;
                actionEventArgs.ProductInfo.NowSimulation.NGTimes       = ActionOnLineHelper.StartNGTimes;
                actionEventArgs.ProductInfo.NowSimulation.ProductStatus = ProductStatus.GOOD;
                actionEventArgs.ProductInfo.NowSimulation.LotStatus     = LotStatusForMO2LotLink.LOTSTATUS_USE;
                actionEventArgs.ProductInfo.NowSimulation.IsHold        = 0;
                actionEventArgs.ProductInfo.NowSimulation.MOSeq         = (int)mo.MOSeq; // Added by Icyer 2007/07/03
                //update by andy.xin rmaBillCode
                //actionEventArgs.ProductInfo.NowSimulation.RMABillCode = rmaBillCode; //mo.RMABillCode;

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

            dataCollectDebug.WhenFunctionOut(messages);
            return(messages);
        }
        private object GetEditObject()
        {
            if (this.ValidateInput())
            {
                if (_itemFacade == null)
                {
                    _itemFacade = new FacadeFactory(base.DataProvider).CreateItemFacade();
                }
                if (_opBOMFacade == null)
                {
                    _opBOMFacade = new FacadeFactory(base.DataProvider).CreateOPBOMFacade();
                }

                OPBOMDetail opBOMDetail = this._opBOMFacade.CreateNewOPBOMDetail();

                opBOMDetail.OPBOMItemSeq         = int.Parse(this.TextboxOPBOMItemSeqEdit.Text);
                opBOMDetail.IsItemCheck          = OPBOMFacade.OPBOMISItemCheckValue_DEFAULT;
                opBOMDetail.ItemCheckValue       = OPBOMFacade.OPBOMItemCheckValue_DEFAULT;
                opBOMDetail.ItemCode             = ItemCode;
                opBOMDetail.MaintainUser         = this.GetUserCode();
                opBOMDetail.OPBOMCode            = OPBOMCode;
                opBOMDetail.OPBOMItemCode        = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtItemCodeEdit.Text));
                opBOMDetail.OPBOMItemControlType = FormatHelper.CleanString(this.drpItemControlTypeEdit.SelectedValue);
                opBOMDetail.OPBOMItemName        = FormatHelper.CleanString(this.txtBOMItemNameEdit.Text);
                opBOMDetail.OPBOMItemQty         = System.Decimal.Parse(this.txtItemQtyEdit.Text);
                opBOMDetail.OPBOMItemType        = OPBOMFacade.OPBOMITEMTYPE_DEFAULT;
                opBOMDetail.OPBOMItemUOM         = FormatHelper.CleanString(this.txtBOMItemUOMEdit.Text);
                opBOMDetail.OPBOMSourceItemCode  = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtSourceItemCodeEdit.Text));

                ItemRoute2OP itemRoute2OP = (ItemRoute2OP)_itemFacade.GetItemRoute2Op(OPID, GlobalVariables.CurrentOrganizations.First().OrganizationID);

                opBOMDetail.OPID                   = OPID;
                opBOMDetail.OPBOMVersion           = this.DropdownlistSBOMVersionQuery.SelectedValue;
                opBOMDetail.OPCode                 = itemRoute2OP.OPCode;
                opBOMDetail.OPBOMItemEffectiveDate = 20051231;
                opBOMDetail.OPBOMItemEffectiveTime = 0;
                opBOMDetail.OPBOMItemInvalidDate   = 21001231;
                opBOMDetail.OPBOMItemInvalidTime   = 0;
                opBOMDetail.OPBOMItemVersion       = this.DropdownlistSBOMVersionQuery.SelectedValue;
                opBOMDetail.ActionType             = this.Actiontype;
                opBOMDetail.OrganizationID         = GlobalVariables.CurrentOrganizations.First().OrganizationID;

                if (chkValid.Checked)
                {
                    opBOMDetail.OPBOMValid = int.Parse(BenQGuru.eMES.Web.Helper.FormatHelper.TRUE_STRING);
                }
                else
                {
                    opBOMDetail.OPBOMValid = int.Parse(BenQGuru.eMES.Web.Helper.FormatHelper.FALSE_STRING);
                }

                //Parse Type
                opBOMDetail.OPBOMParseType = string.Empty;
                if (chkParseBarcode.Checked)
                {
                    opBOMDetail.OPBOMParseType += "," + OPBOMDetailParseType.PARSE_BARCODE;
                }
                if (chkParsePrepare.Checked)
                {
                    opBOMDetail.OPBOMParseType += "," + OPBOMDetailParseType.PARSE_PREPARE;
                }
                if (chkParseProduct.Checked)
                {
                    opBOMDetail.OPBOMParseType += "," + OPBOMDetailParseType.PARSE_PRODUCT;
                }
                if (opBOMDetail.OPBOMParseType.Length > 0)
                {
                    opBOMDetail.OPBOMParseType = opBOMDetail.OPBOMParseType.Substring(1);
                }
                else
                {
                    opBOMDetail.OPBOMParseType = " ";
                }
                if (chkParseProduct.Checked && this.chkCheckStatus.Checked)
                {
                    opBOMDetail.CheckStatus = BenQGuru.eMES.Web.Helper.FormatHelper.TRUE_STRING;
                }
                else
                {
                    opBOMDetail.CheckStatus = BenQGuru.eMES.Web.Helper.FormatHelper.FALSE_STRING;
                }

                //Check Type
                opBOMDetail.OPBOMCheckType = string.Empty;
                if (chkLinkBarcode.Checked)
                {
                    opBOMDetail.OPBOMCheckType += "," + OPBOMDetailCheckType.CHECK_LINKBARCODE;
                }
                if (chkCompareItem.Checked)
                {
                    opBOMDetail.OPBOMCheckType += "," + OPBOMDetailCheckType.CHECK_COMPAREITEM;
                }
                if (opBOMDetail.OPBOMCheckType.Length > 0)
                {
                    opBOMDetail.OPBOMCheckType = opBOMDetail.OPBOMCheckType.Substring(1);
                }
                else
                {
                    opBOMDetail.OPBOMCheckType = " ";
                }

                if (chkSNLength.Checked)
                {
                    int snLength = int.Parse(this.txtSNLength.Text);
                    opBOMDetail.SerialNoLength = snLength;
                }
                else
                {
                    opBOMDetail.SerialNoLength = 0;
                }

                if (this.chkNeedVendor.Checked)
                {
                    opBOMDetail.NeedVendor = NeedVendor.NeedVendor_Y;
                }
                else
                {
                    opBOMDetail.NeedVendor = NeedVendor.NeedVendor_N;
                }

                return(opBOMDetail);
            }
            else
            {
                return(null);
            }
        }
Beispiel #14
0
        protected void cmdAdd_ServerClick(object sender, System.EventArgs e)
        {
            if (_opBOMFacade == null)
            {
                _opBOMFacade = new FacadeFactory(base.DataProvider).CreateOPBOMFacade();
            }
            if (_itemFacade == null)
            {
                _itemFacade = new FacadeFactory(base.DataProvider).CreateItemFacade();
            }

            ArrayList array = this.GetNoRepeatSelectObjs(this.gridHelper.GetCheckedRows());

            if (array.Count > 0)
            {
                ArrayList sboms        = new ArrayList();
                Hashtable notInOPBOMHT = this.GetNotInOPBOMHashtalbe();
                string    returnMsg    = string.Empty;

                foreach (GridRecord row in array)
                {
                    object obj = this.GetEditObject(row);
                    if (obj != null)
                    {
                        if (notInOPBOMHT.Contains(((SBOM)obj).SBOMItemCode))//只有不在opbom中的子阶料才可以添加到列表中
                        {
                            sboms.Add((SBOM)obj);
                        }
                    }
                }
                if (sboms.Count > 0)
                {
                    ItemRoute2OP itemRoute2Operation = (ItemRoute2OP)_itemFacade.GetItemRoute2Op(OPID, GlobalVariables.CurrentOrganizations.First().OrganizationID);
                    _opBOMFacade.AssignBOMItemToOperation(OPBOMCode, OPBOMVersion, itemRoute2Operation, (SBOM[])sboms.ToArray(typeof(SBOM)), this.Actiontype);

                    //Laws Lu,2006/09/01

                    /*1,目前工序BOM建立逻辑不变,增加生效检查功能和失效功能,
                     * 初始建立的工序BOM资料处于失效状态,通过生效检查后处于生效状态,
                     * 此时不允许修改,只有失效状态的工序BOM才可以修改。
                     * 生效检查逻辑包括:完整的工序BOM包含的子阶物料(替代料)必须包含某工单所有的已发料物料代码,
                     * 比如,工单发料资料中包含5种物料,则工序BOM中的子阶物料必须也有这五种物料,
                     * 且首选料不能有这五种物料之外的其他物料。具体的工单由用户在界面指定。
                     * 举例如下:工单发料资料中有A,B,C,D四种物料*/
                    DataProvider.BeginTransaction();
                    try
                    {
                        MOFacade moFac = (new FacadeFactory(DataProvider)).CreateMOFacade();

                        object objOPBOM = moFac.GetOPBOM(itemRoute2Operation.ItemCode, OPBOMCode, OPBOMVersion, GlobalVariables.CurrentOrganizations.First().OrganizationID);

                        if (objOPBOM != null)
                        {
                            OPBOM opBOM = objOPBOM as OPBOM;

                            opBOM.Avialable = 0;

                            moFac.UpdateOPBOM(opBOM);
                        }
                        // Added by Icyer 2005/08/16
                        // 同时将物料加入到物料主档中
                        BenQGuru.eMES.Material.WarehouseFacade wf = new BenQGuru.eMES.Material.WarehouseFacade(base.DataProvider);
                        wf.AddWarehouseItem((SBOM[])sboms.ToArray(typeof(SBOM)));

                        DataProvider.CommitTransaction();
                        //this.cmdReturn_ServerClick(sender,e);
                        // Added end
                    }
                    catch (Exception ex)
                    {
                        Log.Error(ex.Message);

                        DataProvider.RollbackTransaction();
                        throw ex;
                    }
                    finally
                    {
                        ((SQLDomainDataProvider)DataProvider).PersistBroker.CloseConnection();
                    }

                    foreach (SBOM somobject in (SBOM[])sboms.ToArray(typeof(SBOM)))
                    {
                        ItemFacade itemFacade = new ItemFacade(this.DataProvider);
                        Domain.MOModel.Material MaterialObject = (Domain.MOModel.Material)itemFacade.GetMaterial(somobject.SBOMItemCode.Trim().ToUpper(), GlobalVariables.CurrentOrganizations.First().OrganizationID);
                        if (MaterialObject != null)
                        {
                            if (MaterialObject.MaterialCheckType.IndexOf(OPBOMDetailCheckType.CHECK_LINKBARCODE) < 0)
                            {
                                returnMsg += "$ITEM_NOT_LINKBARCODE:" + somobject.SBOMItemCode.Trim().ToUpper() + "\n ";
                            }
                        }
                    }
                }

                //if (addItemMessage.Trim()!=string.Empty && addItemMessage.Trim().Length>0)
                //{
                //    WebInfoPublish.Publish(this, addItemMessage, this.languageComponent1);
                //}

                this.RequestData();
                this.Return(sender, e, returnMsg);
            }
        }
        private Messages CollectAtLineOutputOP(OnWIP onWIP, OnOffPostEnvirenment nowEnv, OnOffPostEnvirenment lastSecondEnv)
        {
            Messages returnValue = new Messages();

            ItemFacade        itemFacade        = new ItemFacade(this.DataProvider);
            PerformanceFacade performanceFacade = new PerformanceFacade(this.DataProvider);

            //获取是否LineOutputCount需要加一:仅判断是否为产量工序
            ItemRoute2OP itemRoute2OP         = (ItemRoute2OP)itemFacade.GetItemRoute2OP(onWIP.ItemCode, onWIP.RouteCode, onWIP.OPCode);
            bool         lineOutpitCountAdded = false;

            if (itemRoute2OP != null && itemRoute2OP.OPControl.Substring(10, 1) == "1")
            {
                lineOutpitCountAdded = true;
            }

            if (lineOutpitCountAdded)
            {
                ProduceDetail produceDetail = (ProduceDetail)performanceFacade.GetLatestProduceDetail(onWIP.StepSequenceCode, 0, string.Empty, true);

                if (produceDetail == null)
                {
                    NewProduceDetail(onWIP, nowEnv, performanceFacade);
                }
                else
                {
                    if (produceDetail.ShiftDate == nowEnv.ShiftDate && produceDetail.ShiftCode == nowEnv.Shift.ShiftCode)
                    {
                        if (string.Compare(produceDetail.MOCode, onWIP.MOCode, true) != 0)
                        {
                            if (produceDetail.Status == ProduceDetailStatus.ProduceDetailStatus_Open)
                            {
                                produceDetail.EndDate      = lastSecondEnv.DBDateTime.DBDate;
                                produceDetail.EndTime      = lastSecondEnv.DBDateTime.DBTime;
                                produceDetail.Duration     = FormatHelper.GetSpanSeconds(produceDetail.BeginDate, produceDetail.BeginTime, produceDetail.EndDate, produceDetail.EndTime);
                                produceDetail.Status       = ProduceDetailStatus.ProduceDetailStatus_Close;
                                produceDetail.MaintainUser = onWIP.MaintainUser;
                                performanceFacade.UpdateProduceDetail(produceDetail);
                            }

                            int manCount = performanceFacade.QueryLine2ManDetailCount(string.Empty, nowEnv.StepSequence.StepSequenceCode, string.Empty, string.Empty, 0, string.Empty, performanceFacade.GetLine2ManDetailStatusList(true));

                            ProduceDetail newProduceDetail = performanceFacade.CreateNewProduceDetail();
                            newProduceDetail.SSCode       = onWIP.StepSequenceCode;
                            newProduceDetail.ShiftDate    = nowEnv.ShiftDate;
                            newProduceDetail.ShiftCode    = nowEnv.Shift.ShiftCode;
                            newProduceDetail.BeginDate    = nowEnv.DBDateTime.DBDate;
                            newProduceDetail.BeginTime    = nowEnv.DBDateTime.DBTime;
                            newProduceDetail.EndDate      = nowEnv.GetShiftEndDate();
                            newProduceDetail.EndTime      = nowEnv.Shift.ShiftEndTime;
                            newProduceDetail.Duration     = FormatHelper.GetSpanSeconds(newProduceDetail.BeginDate, newProduceDetail.BeginTime, newProduceDetail.EndDate, newProduceDetail.EndTime);
                            newProduceDetail.Status       = ProduceDetailStatus.ProduceDetailStatus_Open;
                            newProduceDetail.ManCount     = manCount;
                            newProduceDetail.MOCode       = onWIP.MOCode;
                            newProduceDetail.MaintainUser = onWIP.MaintainUser;
                            performanceFacade.AddProduceDetail(newProduceDetail);
                        }
                    }
                    else
                    {
                        if (produceDetail.Status == ProduceDetailStatus.ProduceDetailStatus_Open)
                        {
                            produceDetail.Status       = ProduceDetailStatus.ProduceDetailStatus_Close;
                            produceDetail.MaintainUser = onWIP.MaintainUser;
                            performanceFacade.UpdateProduceDetail(produceDetail);
                        }

                        NewProduceDetail(onWIP, nowEnv, performanceFacade);
                    }
                }
            }

            return(returnValue);
        }
Beispiel #16
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);
            }
        }
Beispiel #17
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();
        }