Пример #1
0
        private void InitDropDownList()
        {
            if (_facade == null)
            {
                _facade = new WarehouseFacade(base.DataProvider);
            }
            //来源工厂
            DropDownListBuilder builder = new DropDownListBuilder(this.drpFactoryFromQuery);

            builder.HandleGetObjectList = new GetObjectListDelegate(this._facade.GetAllFactory);
            builder.Build("FactoryCode", "FactoryCode");
            this.drpFactoryFromQuery.Items.Insert(0, new ListItem("", ""));
            //目标工厂
            builder = new DropDownListBuilder(this.drpFactoryToQuery);
            builder.HandleGetObjectList = new GetObjectListDelegate(this._facade.GetAllFactory);
            builder.Build("FactoryCode", "FactoryCode");
            this.drpFactoryToQuery.Items.Insert(0, new ListItem("", ""));

            //来源工段
            BenQGuru.eMES.BaseSetting.BaseModelFacade bmFacade = new BenQGuru.eMES.BaseSetting.BaseModelFacade(base.DataProvider);
//			builder = new DropDownListBuilder(this.drpSegmentFromQuery);
//			builder.HandleGetObjectList = new GetObjectListDelegate(bmFacade.GetAllSegment);
//			builder.Build("SegmentCode","SegmentCode");
//			this.drpSegmentFromQuery.Items.Insert(0, new ListItem("", ""));
//			//目标工段
//			builder = new DropDownListBuilder(this.drpSegmentToQuery);
//			builder.HandleGetObjectList = new GetObjectListDelegate(bmFacade.GetAllSegment);
//			builder.Build("SegmentCode","SegmentCode");
//			this.drpSegmentToQuery.Items.Insert(0, new ListItem("", ""));

            bmFacade = null;
            builder  = null;
        }
Пример #2
0
        public void BuildRouteTree(Route route)
        {
            BenQGuru.eMES.BaseSetting.BaseModelFacade baseFacade = SMTFacadeFactory.CreateBaseModelFacadeFacade();
            Node root = this._tree.Nodes.Add(route.RouteCode);

            object[] ops = baseFacade.GetSelectedOperationByRouteCode(route.RouteCode, string.Empty, 1, int.MaxValue);
            if (ops != null)
            {
                foreach (Operation op in ops)
                {
                    Node     opNode = root.Nodes.Add(op.OPCode);
                    object[] reses  = baseFacade.GetSelectedResourceByOperationCode(op.OPCode, string.Empty, 1, int.MaxValue);
                    if (reses != null)
                    {
                        foreach (Resource res in reses)
                        {
                            opNode.Nodes.Add(res.ResourceCode);
                        }
                        opNode.Expanded = true;
                    }
                }

                root.Expanded = true;
            }
        }
Пример #3
0
        private void FFirstOffline_Load(object sender, System.EventArgs e)
        {
            _firstMsg = UserControl.MutiLanguages.ParserMessage("$Error_FirstOn_Time");           //{0}{1}产线首件上线时间是:{2};
            _offMsg   = UserControl.MutiLanguages.ParserMessage("$Error_FirstOff_Time");          //{0}{1}产线首件下线线时间是:{2},总共时间为{3}小时{4}分种

            this.ucRCard.TextFocus(false, true);
            Messages msg = new Messages();

            _facade = new FirstOnlineFacade(this.DataProvider);
            //取产线
            BenQGuru.eMES.BaseSetting.BaseModelFacade _baseFacade = new BenQGuru.eMES.BaseSetting.BaseModelFacade(this.DataProvider);
            Resource res = (Resource)_baseFacade.GetResource(ApplicationService.Current().ResourceCode);

            if (res != null && res.StepSequenceCode != null)
            {
                this.ucSSName.Value = res.StepSequenceCode;
            }
            else
            {
                msg.Add(new UserControl.Message(MessageType.Error, this.ucSSName.Caption + "$Error_Input_Empty"));
                ApplicationRun.GetInfoForm().Add(msg);
                return;
            }
            this.ucRCard.InnerTextBox.Multiline = false;
        }
Пример #4
0
        protected override bool ValidateInput()
        {
            PageCheckManager manager = new PageCheckManager();

            manager.Add(new LengthCheck(this.lblNGCodeEdit, this.txtErrorCode, 65535, true));
            manager.Add(new LengthCheck(this.lblReworkOPCodeEdit, this.txtReworkOPCode, 40, true));

            if (!manager.Check())
            {
                WebInfoPublish.Publish(this, manager.CheckMessage, this.languageComponent1);
                return(false);
            }

            if (this.txtReworkRoute.Text.Trim().Length != 0)
            {
                BenQGuru.eMES.BaseSetting.BaseModelFacade baseModelFacade = new BenQGuru.eMES.BaseSetting.BaseModelFacade(this.DataProvider);
                object route2op = baseModelFacade.GetRoute2Operation(this.txtReworkRoute.Text.ToUpper(), this.txtReworkOPCode.Text.ToUpper());
                if (route2op == null)
                {
                    WebInfoPublish.Publish(this, "$Error_RouteHasNoOperations", this.languageComponent1);
                    return(false);
                }
            }

            return(true);
        }
Пример #5
0
        private void InitDropDownList()
        {
            if (_facade == null)
            {
                _facade = new WarehouseFacade(base.DataProvider);
            }
            DropDownListBuilder builder = new DropDownListBuilder(this.drpFactoryCodeQuery);

            builder.HandleGetObjectList = new GetObjectListDelegate(this._facade.GetAllFactory);
            builder.Build("FactoryCode", "FactoryCode");
            this.drpFactoryCodeQuery.Items.Insert(0, new ListItem("", ""));

            BenQGuru.eMES.BaseSetting.BaseModelFacade bmFacade = new BenQGuru.eMES.BaseSetting.BaseModelFacade(base.DataProvider);
//			builder = new DropDownListBuilder(this.drpSegmentCodeQuery);
//			builder.HandleGetObjectList = new GetObjectListDelegate(bmFacade.GetAllSegment);
//			builder.Build("SegmentCode","SegmentCode");
//			this.drpSegmentCodeQuery.Items.Insert(0, new ListItem("", ""));

            /*
             * builder = new DropDownListBuilder(this.drpWarehouseCodeQuery);
             * builder.HandleGetObjectList = new GetObjectListDelegate(this._facade.GetAllDistinctWarehouse);
             * builder.Build("WarehouseCode","WarehouseCode");
             * this.drpWarehouseCodeQuery.Items.Insert(0, new ListItem(lword.ControlText, ""));
             */

            bmFacade = null;
            builder  = null;
        }
Пример #6
0
        protected override void UpdateDomainObject(object domainObject)
        {
            if (_facade == null)
            {
                _facade = new TSModelFacadeFactory(base.DataProvider).CreateTSModelFacade();
            }

            if (((ErrorCodeItem2Route)domainObject).RouteCode.ToUpper() != "TS" &&
                ((ErrorCodeItem2Route)domainObject).RouteCode.Trim().Length > 0)
            {
                //检查途程是不是和产品挂起来了
                BenQGuru.eMES.MOModel.ItemFacade itemFacade = new BenQGuru.eMES.MOModel.ItemFacade(this.DataProvider);
                object ir = itemFacade.GetItem2Route(((ErrorCodeItem2Route)domainObject).ItemCode, ((ErrorCodeItem2Route)domainObject).RouteCode, ((ErrorCodeItem2Route)domainObject).OrganizationID.ToString());
                if (ir == null)
                {
                    throw new Exception("$Error_ItemRoute_NotExist");
                }
            }

            if (((ErrorCodeItem2Route)domainObject).RouteCode.Trim().Length > 0)
            {
                BenQGuru.eMES.BaseSetting.BaseModelFacade baseModelFacade = new BenQGuru.eMES.BaseSetting.BaseModelFacade(this.DataProvider);
                object route2op = baseModelFacade.GetRoute2Operation(((ErrorCodeItem2Route)domainObject).RouteCode.ToUpper(), ((ErrorCodeItem2Route)domainObject).OPCode.ToUpper());
                if (route2op == null)
                {
                    throw new Exception("$Error_RouteHasNoOperations");
                }
            }

            this._facade.UpdateErrorCodeItem2Route((ErrorCodeItem2Route)domainObject);
        }
Пример #7
0
        private void FFirstOnline_Load(object sender, System.EventArgs e)
        {
            _firstMsg = UserControl.MutiLanguages.ParserMessage("$Error_FirstOn_Time");            //{0}{1}产线首件上线时间是:{2};
            this.ucRCard.TextFocus(false, true);
            Messages msg = new Messages();

            _facade = new FirstOnlineFacade(this.DataProvider);

            //取产线
            BenQGuru.eMES.BaseSetting.BaseModelFacade _baseFacade = new BenQGuru.eMES.BaseSetting.BaseModelFacade(this.DataProvider);
            Resource res = (Resource)_baseFacade.GetResource(ApplicationService.Current().ResourceCode);

            if (res != null && res.StepSequenceCode != null)
            {
                this.ucSSName.Value = res.StepSequenceCode;
            }
            else
            {
                msg.Add(new UserControl.Message(MessageType.Error, this.ucSSName.Caption + "$Error_Input_Empty"));
                ApplicationRun.GetInfoForm().Add(msg);
                return;
            }

            int i = this._facade.BindShiftTime(this.cbxShiftTime.ComboBoxData.Items, res);

            if (i >= 0)
            {
                this.cbxShiftTime.ComboBoxData.SelectedIndex = i;
                this.dtpBegin.Text = this.cbxShiftTime.ComboBoxData.SelectedItem.ToString();
            }

            this.ucRCard.InnerTextBox.Multiline = false;

            DoSSCodeChange();
        }
Пример #8
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);
        }
Пример #9
0
        protected int GetRowCount()
        {
            if (facade == null)
            {
                facade = (new FacadeFactory(base.DataProvider)).CreateBaseModelFacade();
            }

            return(this.facade.GetItem2RouteCount(
                       FormatHelper.PKCapitalFormat(FormatHelper.CleanString(ItemCode))));
        }
Пример #10
0
        protected object[] LoadDataSource(int inclusive, int exclusive)
        {
            if (facade == null)
            {
                facade = new FacadeFactory(base.DataProvider).CreateBaseModelFacade();
            }

            return(this.facade.QueryItem2Route(
                       FormatHelper.PKCapitalFormat(FormatHelper.CleanString(ItemCode)),
                       inclusive, exclusive));
        }
Пример #11
0
        private string GetOPControl(Hashtable htRoute, Hashtable htOP, RPTCenterYield real)
        {
            string routeCode = "";

            if (htRoute.Contains(real.MOCode) == true)
            {
                routeCode = ((MO2Route)htRoute[real.MOCode]).RouteCode;
            }

            object objOp = null;

            if (htOP.Contains(real.ItemCode + ":" + routeCode + ":" + real.OperationCode) == true)
            {
                objOp = htOP[real.ItemCode + ":" + routeCode + ":" + real.OperationCode];
            }
            else
            {
                QueryFacade1 queryFacade1 = new QueryFacade1(this.DataProvider);
                try
                {
                    objOp = queryFacade1.GetItemRoute2Operation(real.ItemCode, routeCode, real.OperationCode);
                    if (objOp != null)
                    {
                        htOP.Add(real.ItemCode + ":" + routeCode + ":" + real.OperationCode, objOp);
                    }
                }
                catch {}
            }
            string opControl = String.Empty;

            if (objOp != null)
            {
                if (objOp is ItemRoute2OP)
                {
                    opControl = ((ItemRoute2OP)objOp).OPControl;
                }
                else if (objOp is BenQGuru.eMES.Domain.BaseSetting.Operation)
                {
                    opControl = ((BenQGuru.eMES.Domain.BaseSetting.Operation)objOp).OPControl;
                }
            }
            else
            {
                BenQGuru.eMES.BaseSetting.BaseModelFacade modelFacade = new BenQGuru.eMES.BaseSetting.BaseModelFacade(this.DataProvider);
                object objTmp = modelFacade.GetOperation(real.OperationCode);
                if (objTmp != null)
                {
                    opControl = ((BenQGuru.eMES.Domain.BaseSetting.Operation)objTmp).OPControl;
                    htOP.Add(real.ItemCode + ":" + routeCode + ":" + real.OperationCode, objTmp);
                }
            }
            return(opControl);
        }
Пример #12
0
        public object[] GetResources(string SSCode)
        {
            BaseSetting.BaseModelFacade baseModeFacade = new BenQGuru.eMES.BaseSetting.BaseModelFacade(this.DataProvider);

            object[] objs = baseModeFacade.GetResourceByStepSequenceCode(SSCode);

            if (objs == null)
            {
                objs = new object[] { }
            }
            ;

            return(objs);
        }
Пример #13
0
        /// <summary>
        /// RCard Burn Out
        /// </summary>
        /// <returns></returns>
        private Messages RunBurnOut(string rcard, string shelfpk)
        {
            if (Resource == null)
            {
                BenQGuru.eMES.BaseSetting.BaseModelFacade dataModel = new BenQGuru.eMES.BaseSetting.BaseModelFacade(this.DataProvider);
                Resource = (Domain.BaseSetting.Resource)dataModel.GetResource(ApplicationService.Current().ResourceCode);
            }

            Messages messages = new Messages();

            try
            {
                messages = GetProduct(rcard);
                if (messages.IsSuccess())
                {
                    product                       = (ProductInfo)messages.GetData().Values[0];
                    actionCheckStatus             = new ActionCheckStatus();
                    actionCheckStatus.ProductInfo = product;
                    if (actionCheckStatus.ProductInfo != null)
                    {
                        actionCheckStatus.ProductInfo.Resource = Resource;
                    }

                    IAction         dataCollectModule = new ActionFactory(this.DataProvider).CreateAction(ActionType.DataCollectAction_BurnOutGood);
                    ActionEventArgs actionEventArgs   = new ActionEventArgs(
                        ActionType.DataCollectAction_BurnOutGood,
                        rcard,
                        ApplicationService.Current().UserCode,
                        ApplicationService.Current().ResourceCode,
                        shelfpk,
                        product);
                    messages.AddMessages(((IActionWithStatus)dataCollectModule).Execute(
                                             actionEventArgs,
                                             actionCheckStatus));
                }

                if (messages.IsSuccess())
                {
                    messages.Add(new UserControl.Message(MessageType.Success, string.Format("$CS_BurnOutSUCCESS,$CS_Param_ID:{0}", rcard)));
                }
                return(messages);
            }
            catch (Exception e)
            {
                messages.Add(new UserControl.Message(e));
                return(messages);
            }
        }
Пример #14
0
        private void InitDropDownList()
        {
            if (_facade == null)
            {
                _facade = new WarehouseFacade(base.DataProvider);
            }
            BenQGuru.eMES.Common.MutiLanguage.LanguageWord lword = languageComponent1.GetLanguage("listItemAll");
            DropDownListBuilder builder = new DropDownListBuilder(this.drpFactoryCodeQuery);

            builder.HandleGetObjectList = new GetObjectListDelegate(this._facade.GetAllFactory);
            builder.Build("FactoryCode", "FactoryCode");
            this.drpFactoryCodeQuery.Items.Insert(0, new ListItem(lword.ControlText, ""));

            BenQGuru.eMES.BaseSetting.BaseModelFacade bmFacade = new BenQGuru.eMES.BaseSetting.BaseModelFacade(base.DataProvider);
//			builder = new DropDownListBuilder(this.drpSegmentCodeQuery);
//			builder.HandleGetObjectList = new GetObjectListDelegate(bmFacade.GetAllSegment);
//			builder.Build("SegmentCode","SegmentCode");
//			this.drpSegmentCodeQuery.Items.Insert(0, new ListItem(lword.ControlText, ""));

            builder = new DropDownListBuilder(this.drpFactoryCodeEdit);
            builder.HandleGetObjectList = new GetObjectListDelegate(this._facade.GetAllFactory);
            builder.Build("FactoryCode", "FactoryCode");
            this.drpFactoryCodeEdit.Items.Insert(0, new ListItem(lword.ControlText, ""));

//			builder = new DropDownListBuilder(this.drpSegmentCodeEdit);
//			builder.HandleGetObjectList = new GetObjectListDelegate(bmFacade.GetAllSegment);
//			builder.Build("SegmentCode","SegmentCode");
//			this.drpSegmentCodeEdit.Items.Insert(0, new ListItem(lword.ControlText, ""));

            builder = new DropDownListBuilder(this.drpWarehouseTypeEdit);
            builder.HandleGetObjectList = new GetObjectListDelegate(this._facade.GetWarehouseTypes);
            builder.Build("ParameterAlias", "ParameterCode");

            this.drpWarehouseStatusEdit.Items.Clear();
            this.drpWarehouseStatusEdit.Items.Add(new ListItem(this.languageComponent1.GetString(Warehouse.WarehouseStatus_Normal), Warehouse.WarehouseStatus_Normal));
            this.drpWarehouseStatusEdit.Items.Add(new ListItem(this.languageComponent1.GetString(Warehouse.WarehouseStatus_Cycle), Warehouse.WarehouseStatus_Cycle));


            InitWarehouseCodeQueryList();

            bmFacade = null;
            lword    = null;
            builder  = null;

            this.chbIsControl.Checked = true;
        }
Пример #15
0
        protected void drpSegmentCode_SelectedIndexChanged(object sender, EventArgs e)
        {
            BenQGuru.eMES.BaseSetting.BaseModelFacade modelFacade = new BenQGuru.eMES.BaseSetting.BaseModelFacade(this.DataProvider);
            object[] objs = modelFacade.GetStepSequenceBySegmentCode(this.drpSegmentCode.SelectedValue);
            this.drpSSCode.Items.Clear();
            if (objs != null)
            {
                for (int i = 0; i < objs.Length; i++)
                {
                    this.drpSSCode.Items.Add(new ListItem(((StepSequence)objs[i]).StepSequenceCode, ((StepSequence)objs[i]).StepSequenceCode));
                }
            }

            if (this.drpSSCode.Items.Count > 0)
            {
                this.drpSSCode.SelectedIndex = 0;
            }
        }
Пример #16
0
        private System.Data.DataTable LoadData()
        {
            System.Data.DataTable dt = new System.Data.DataTable("SS");
            dt.Columns.Add("生产线代码");
            dt.Columns.Add("生产线描述");
            dt.Columns.Add("所属工段");
            //load 产线数据
            BenQGuru.eMES.BaseSetting.BaseModelFacade _baseFacade = new BenQGuru.eMES.BaseSetting.BaseModelFacade(this.DataProvider);
            object[] objs = _baseFacade.GetAllStepSequence();

            foreach (object obj in objs)
            {
                BenQGuru.eMES.Domain.BaseSetting.StepSequence ss = obj as BenQGuru.eMES.Domain.BaseSetting.StepSequence;
                if (ss != null)
                {
                    dt.Rows.Add(new object[] { ss.StepSequenceCode, ss.StepSequenceDescription, ss.SegmentCode });
                }
            }
            return(dt);
        }
Пример #17
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (!this.IsPostBack)
            {
                // 初始化页面语言
                this.InitPageLanguage(this.languageComponent1, false);

                BenQGuru.eMES.BaseSetting.BaseModelFacade modelFacade = new BenQGuru.eMES.BaseSetting.BaseModelFacade(this.DataProvider);
                object[] objs = modelFacade.GetAllSegment();
                this.drpSegmentCode.Items.Clear();
                for (int i = 0; i < objs.Length; i++)
                {
                    this.drpSegmentCode.Items.Add(new ListItem(((Segment)objs[i]).SegmentCode, ((Segment)objs[i]).SegmentCode));
                }
                if (this.drpSegmentCode.Items.Count > 0)
                {
                    this.drpSegmentCode.SelectedIndex = 0;
                    drpSegmentCode_SelectedIndexChanged(null, null);
                }
            }
            this.cmdSave.Disabled = false;
        }
Пример #18
0
        private void InitDropDownList()
        {
            if (_facade == null)
            {
                _facade = new WarehouseFacade(base.DataProvider);
            }
            BenQGuru.eMES.Common.MutiLanguage.LanguageWord lword = languageComponent1.GetLanguage("listItemAll");
            DropDownListBuilder builder = new DropDownListBuilder(this.drpFactoryCodeQuery);

            builder.HandleGetObjectList = new GetObjectListDelegate(this._facade.GetAllFactory);
            builder.Build("FactoryCode", "FactoryCode");
            this.drpFactoryCodeQuery.Items.Insert(0, new ListItem("", ""));

            BenQGuru.eMES.BaseSetting.BaseModelFacade bmFacade = new BenQGuru.eMES.BaseSetting.BaseModelFacade(base.DataProvider);
//			builder = new DropDownListBuilder(this.drpSegmentCodeQuery);
//			builder.HandleGetObjectList = new GetObjectListDelegate(bmFacade.GetAllSegment);
//			builder.Build("SegmentCode","SegmentCode");
//			this.drpSegmentCodeQuery.Items.Insert(0, new ListItem("", ""));

            bmFacade = null;
            lword    = null;
            builder  = null;
        }
Пример #19
0
        private void ucLabelRcard_TxtboxKeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == '\r')
            {
                if (this.ucLabelSoftVersion.Value.Trim().Length == 0)
                {
                    this.ucLabelSoftVersion.TextFocus(false, true);
                    ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Normal, "$CS_PleaseChooseSoftVersion"));
                    return;
                }

                if (this.ucLabelRcard.Value == string.Empty)
                {
                    this.ucLabelRcard.TextFocus(false, true);
                    return;
                }
                string   newVersion = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.ucLabelSoftVersion.Value));
                string   rcard      = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.ucLabelRcard.Value));
                Messages msg        = new Messages();
                ((SQLDomainDataProvider)DataProvider).PersistBroker.AutoCloseConnection = false;
                ((SQLDomainDataProvider)DataProvider).PersistBroker.OpenConnection();

                try
                {
                    DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider);
                    string            sourceRCard       = dataCollectFacade.GetSourceCard(rcard.Trim().ToUpper(), string.Empty);

                    // 获取要升级的产品序列号信息
                    OnWipSoftVer4Upgrade oldVersion = dataCollectFacade.GetOldSoftVersion(sourceRCard);

                    if (oldVersion == null)
                    {
                        ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "$Error_Rcard_Or_NOSoftInfo"));
                        this.ucLabelRcard.TextFocus(false, true);
                        return;
                    }
                    // 判断软件版本是否相同,相同就不需要升级了
                    if (string.Compare(oldVersion.SoftwareVersion, newVersion, true) == 0)
                    {
                        ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Normal, "$CS_AlreadyUpgraded"));
                        this.ucLabelRcard.TextFocus(false, true);
                        return;
                    }

                    BenQGuru.eMES.BaseSetting.BaseModelFacade dataModel = new BenQGuru.eMES.BaseSetting.BaseModelFacade(this.DataProvider);
                    Resource resource = (Domain.BaseSetting.Resource)dataModel.GetResource(ApplicationService.Current().ResourceCode);

                    string userCode = ApplicationService.Current().UserCode;

                    // 升级
                    msg.AddMessages(dataCollectFacade.UpgradeNewSoftVer(oldVersion, resource, userCode, newVersion));

                    if (!msg.IsSuccess())
                    {
                        ApplicationRun.GetInfoForm().Add(msg);
                        this.ucLabelRcard.TextFocus(false, true);
                        return;
                    }

                    dtSoftWareVersion.Rows.Add(new object[] { oldVersion.RunningCard, oldVersion.ItemDescription,
                                                              oldVersion.SoftwareVersion, newVersion });
                    dtSoftWareVersion.AcceptChanges();
                    this.ucLabelEditCount.Value = this.dtSoftWareVersion.Rows.Count.ToString();

                    this.ucLabelRcard.TextFocus(false, true);
                }
                catch (Exception ex)
                {
                    ApplicationRun.GetInfoForm().Add(ex.Message);
                    this.ucLabelRcard.TextFocus(false, true);
                }
                finally
                {
                    ((SQLDomainDataProvider)DataProvider).PersistBroker.CloseConnection();
                    ((SQLDomainDataProvider)DataProvider).PersistBroker.AutoCloseConnection = true;
                }
            }
        }
Пример #20
0
        private void CheckImportResult(ArrayList items)
        {
            BenQGuru.eMES.MOModel.ItemFacade          itemFacade  = new BenQGuru.eMES.MOModel.ItemFacade(base.DataProvider);
            BenQGuru.eMES.BaseSetting.BaseModelFacade modelFacade = new BenQGuru.eMES.BaseSetting.BaseModelFacade(this.DataProvider);
            if (_facade == null)
            {
                _facade = new SMTFacade(base.DataProvider);
            }
            ArrayList checkedSpec    = new ArrayList();
            ArrayList checkedProduct = new ArrayList();
            ArrayList checkedSSCode  = new ArrayList();

            for (int i = 0; i < items.Count; i++)
            {
                SMTFeederMaterial item = (SMTFeederMaterial)items[i];
                item.EAttribute1 = true.ToString();
                if (item.ProductCode == string.Empty ||
                    item.StepSequenceCode == string.Empty ||
                    item.MachineCode == string.Empty ||
                    item.MachineStationCode == string.Empty ||
                    item.MaterialCode == string.Empty)
                {
                    item.EAttribute1 = false.ToString() + ":" + languageComponent1.GetString("$Error_Input_Empty");
                    continue;
                }
                if (checkedProduct.Contains(item.ProductCode) == false)
                {
                    object obj = itemFacade.GetItem(item.ProductCode, GlobalVariables.CurrentOrganizations.First().OrganizationID);
                    if (obj == null)
                    {
                        item.EAttribute1 = false.ToString() + ":" + languageComponent1.GetString("$Error_ItemCode_NotExist");
                        continue;
                    }
                    else
                    {
                        checkedProduct.Add(item.ProductCode);
                    }
                }
                if (checkedSSCode.Contains(item.StepSequenceCode) == false)
                {
                    object obj = modelFacade.GetStepSequence(item.StepSequenceCode);
                    if (obj == null)
                    {
                        item.EAttribute1 = false.ToString() + ":" + languageComponent1.GetString("$Error_SSCode_NotExist");
                        continue;
                    }
                    else
                    {
                        checkedSSCode.Add(item.StepSequenceCode);
                    }
                }
                if (item.FeederSpecCode == string.Empty || item.Qty == 0)
                {
                    if (item.SourceMaterialCode == string.Empty || i == 0)
                    {
                        item.EAttribute1 = false.ToString() + ":" + languageComponent1.GetString("$MaterialCode_Not_Exist");
                        continue;
                    }
                    for (int n = 0; n < items.Count; n++)
                    {
                        SMTFeederMaterial item1 = (SMTFeederMaterial)items[n];
                        if (item1.MaterialCode == item.SourceMaterialCode)
                        {
                            if (item.FeederSpecCode == string.Empty)
                            {
                                item.FeederSpecCode = item1.FeederSpecCode;
                            }
                            if (item.Qty == 0)
                            {
                                item.Qty = item1.Qty;
                            }
                            break;
                        }
                    }
                    if (item.FeederSpecCode == string.Empty)
                    {
                        item.EAttribute1 = false.ToString() + ":" + languageComponent1.GetString("$FeederSpec_Not_Exist");
                        continue;
                    }
                }
                if (checkedSpec.Contains(item.FeederSpecCode) == false)
                {
                    object obj = _facade.GetFeederSpec(item.FeederSpecCode);
                    if (obj == null)
                    {
                        item.EAttribute1 = false.ToString() + ":" + languageComponent1.GetString("$FeederSpec_Not_Exist");
                        continue;
                    }
                    else
                    {
                        checkedSpec.Add(item.FeederSpecCode);
                    }
                }
            }
        }
Пример #21
0
        private void ucButtonOK_Click(object sender, EventArgs e)
        {
            //获取产品原始的序列号
            DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider);
            string            sourceOldRCard    = dataCollectFacade.GetSourceCard(this.ucLabelEditOldRCard.Value.Trim().ToUpper(), string.Empty);
            string            sourceNewRCard    = dataCollectFacade.GetSourceCard(this.ucLabelEditNewRCard.Value.Trim().ToUpper(), string.Empty);

            //check OldRcard Is Empty
            if (string.IsNullOrEmpty(this.ucLabelEditOldRCard.Value.Trim()))
            {
                ApplicationRun.GetInfoForm().AddEx(this._FunctionName, this.ucLabelEditOldRCard.Value + ":" + this.ucLabelEditOldRCard.Value,
                                                   new UserControl.Message(MessageType.Error, "$CS_OLDRCARD_ISNULL"), true);
                this.ucLabelEditOldRCard.TextFocus(true, true);
                return;
            }

            //Check OldRcard Is Exist in ProductInfo
            Object ObjectSimulationOld = dataCollectFacade.GetLastSimulationReport(FormatHelper.CleanString(sourceOldRCard.Trim().ToUpper()));

            if (ObjectSimulationOld == null)
            {
                ApplicationRun.GetInfoForm().AddEx(this._FunctionName, this.ucLabelEditOldRCard.Value + ":" + this.ucLabelEditOldRCard.Value,
                                                   new UserControl.Message(MessageType.Error, "$CS_OLDRCARD_IS_NOT_EXIT"), true);
                this.ucLabelEditOldRCard.TextFocus(false, true);
                return;
            }

            //Check NewRcard Is Empty
            if (string.IsNullOrEmpty(this.ucLabelEditNewRCard.Value.Trim()))
            {
                ApplicationRun.GetInfoForm().AddEx(this._FunctionName, this.ucLabelEditNewRCard.Value + ":" + this.ucLabelEditNewRCard.Value,
                                                   new UserControl.Message(MessageType.Error, "$CS_newIDisNull"), true);
                this.ucLabelEditNewRCard.TextFocus(false, true);
                return;
            }

            //Compare NewRcard and OldRcard Is  Same
            if (this.ucLabelEditNewRCard.Value.Trim() == this.ucLabelEditOldRCard.Value.Trim())
            {
                ApplicationRun.GetInfoForm().AddEx(this._FunctionName, this.ucLabelEditNewRCard.Value + ":" + this.ucLabelEditNewRCard.Value,
                                                   new UserControl.Message(MessageType.Error, "$CS_SAMERCARD"), true);
                this.ucLabelEditNewRCard.TextFocus(false, true);
                return;
            }

            //Check OldRcard Is Not Exist in ProductInfo
            Object ObjectSimulationNew = dataCollectFacade.GetLastSimulationReport(FormatHelper.CleanString(sourceNewRCard.Trim().ToUpper()));

            if (ObjectSimulationNew != null)
            {
                ApplicationRun.GetInfoForm().AddEx(this._FunctionName, this.ucLabelEditNewRCard.Value + ":" + this.ucLabelEditNewRCard.Value,
                                                   new UserControl.Message(MessageType.Error, "$CS_NEWRCARD_IS_PRODUCTINFO"), true);
                this.ucLabelEditNewRCard.TextFocus(false, true);
                return;
            }

            //Check ChangeReason is Empty
            if (string.IsNullOrEmpty(this.ucLabelEditReason.Value.Trim()))
            {
                ApplicationRun.GetInfoForm().AddEx(this._FunctionName, this.ucLabelEditReason.Value + ":" + this.ucLabelEditReason.Value,
                                                   new UserControl.Message(MessageType.Error, "$CS_INPUT_CHANGEREASON"), true);
                this.ucLabelEditReason.TextFocus(false, true);
                return;
            }

            BaseSetting.BaseModelFacade baseModelFacade = new BenQGuru.eMES.BaseSetting.BaseModelFacade(this.DataProvider);

            string OldRcard      = FormatHelper.CleanString(this.ucLabelEditOldRCard.Value.Trim().ToUpper());
            string NewRcard      = FormatHelper.CleanString(this.ucLabelEditNewRCard.Value.Trim().ToUpper());
            string OutPutResoult = string.Empty;

            ProcedureCondition procedureCondition = new ProcedureCondition("CHANGERCARD",
                                                                           new ProcedureParameter[] {
                new ProcedureParameter("i_FromRCard", typeof(string), 40, DirectionType.Input, OldRcard),
                new ProcedureParameter("i_ToRCard", typeof(string), 40, DirectionType.Input, NewRcard),
                new ProcedureParameter("o_Result", typeof(string), 40, DirectionType.Output, OutPutResoult)
            });

            this.DataProvider.BeginTransaction();
            try
            {
                baseModelFacade.DoRCardChange(ref procedureCondition);

                if (procedureCondition.Parameters[2].Value.ToString().Length == 2)
                {
                    DBDateTime  DBDateTime     = FormatHelper.GetNowDBDateTime(this.DataProvider);
                    RCardChange NewRCardChange = baseModelFacade.CreateNewRCardChange();

                    NewRCardChange.RCardFrom    = OldRcard;
                    NewRCardChange.RCardTo      = NewRcard;
                    NewRCardChange.Reason       = FormatHelper.CleanString(this.ucLabelEditReason.Value.Trim());
                    NewRCardChange.MaintainUser = ApplicationService.Current().UserCode;
                    NewRCardChange.MaintainDate = DBDateTime.DBDate;
                    NewRCardChange.MaintainTime = DBDateTime.DBTime;
                    NewRCardChange.EAttribute1  = string.Empty;

                    baseModelFacade.AddRCardChange(NewRCardChange);

                    ApplicationRun.GetInfoForm().AddEx(this._FunctionName, procedureCondition.Parameters[2].Value.ToString(),
                                                       new UserControl.Message(MessageType.Success, "$CS_RCARDCHANGE_SUCCESS"), true);
                    this.ucLabelEditNewRCard.Value = string.Empty;
                    this.ucLabelEditReason.Value   = string.Empty;
                }
            }
            catch (Exception ex)
            {
                this.DataProvider.RollbackTransaction();
                ApplicationRun.GetInfoForm().AddEx(this._FunctionName, "", new UserControl.Message(ex), true);
            }
            finally
            {
                this.DataProvider.CommitTransaction();
            }

            if (procedureCondition.Parameters[2].Value.ToString().Length > 2)
            {
                ApplicationRun.GetInfoForm().AddEx(this._FunctionName, procedureCondition.Parameters[2].Value.ToString(),
                                                   new UserControl.Message(MessageType.Error, "$CS_RCARDCHANGE_WRONG"), true);
            }
            this.ucLabelEditOldRCard.TextFocus(false, true);
        }
Пример #22
0
        // Added end

        public override Messages Action(object act)
        {
            Messages           msg     = new Messages();
            ActionOnLineHelper _helper = null;

            BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider domainProvider = null;

            if (act == null)
            {
                return(msg);
            }

            DataCollect.Action.ActionEventArgs args;
            if (ObjectState == null)
            {
                args             = new BenQGuru.eMES.DataCollect.Action.ActionEventArgs();
                args.RunningCard = act.ToString().ToUpper().Trim();
            }
            else
            {
                args = ObjectState as DataCollect.Action.ActionEventArgs;
            }

            string data = act.ToString().ToUpper().Trim();            //Keyparts

            //Laws Lu,2006/06/03	添加	获取已有连接
            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;
            }


            msg = CheckData(data, domainProvider);

            if (keypartsHT == null)
            {
                // 按照逻辑,走到这个分支应该是错误的
                string strFile = @"C:\DCT_EmptyMessage.txt";
                string strLine = DateTime.Now.ToString("yyyy-MM-dd HH:mi:ss") + "\t" + "ActionCollectKeyParts" + "\t" + "Missing Product In Action, RunningCard:" + args.RunningCard + ",Input:" + data;
                System.IO.StreamWriter writer = new System.IO.StreamWriter(strFile, true);
                writer.WriteLine(strLine);
                writer.Close();
                //
                if (msg.IsSuccess() &&
                    (keypartsHT == null || keypartsHT.ContainsKey("ProdcutInfo") == false))
                {
                    //检查序列号
                    _helper = new ActionOnLineHelper(domainProvider);
                    msg     = _helper.GetIDInfo(args.RunningCard);
                    // Added by Icyer 2006/12/14
                    // 检查序列号
                    ProductInfo product = (ProductInfo)msg.GetData().Values[0];
                    if (product == null || product.LastSimulation == null)
                    {
                        msg.ClearMessages();
                        msg.Add(new Message(MessageType.Error, "$NoSimulation"));
                    }
//					base.Action (act);
//					ActionCollectKeyparts actionCollectKeyparts = this;
//					this.NextAction = actionCollectKeyparts;
//					this.Status = ActionStatus.PrepareData;
//					return msg;
                    // Added end
                }

                if (msg.IsSuccess() &&
                    (keypartsHT == null || keypartsHT.ContainsKey("KeypartsInfo") == false))
                {
                    try
                    {
                        keypartsHT = new Hashtable();
                        keypartsHT.Add("ProdcutInfo", msg);

                        ProductInfo product = (ProductInfo)msg.GetData().Values[0];

                        /*	Removed by Icyer 2006/12/14
                         * 如果序列号已在本上料工序,则GetMORouteNextOperation会取下一个工序,导致找不到OPBOM
                         * 改变推导OPBOM的逻辑
                         * ItemFacade itemFacade = new ItemFacade(domainProvider);
                         * object op = itemFacade.GetMORouteNextOperation(
                         *      product.LastSimulation.MOCode,
                         *      product.LastSimulation.RouteCode,
                         *      product.LastSimulation.OPCode);
                         *
                         * OPBOMFacade opBOMFacade=new OPBOMFacade( domainProvider);
                         * object[] objBomDetail = opBOMFacade.GetOPBOMDetails(
                         *      product.LastSimulation.MOCode,
                         *      product.LastSimulation.RouteCode,
                         *      (op as ItemRoute2OP).OPCode);
                         */
                        // Added by Icyer 2006/12/14
                        IDCTClient  client       = act as IDCTClient;
                        OPBOMFacade opBOMFacade  = new OPBOMFacade(domainProvider);
                        object[]    objBomDetail = null;
                        DataCollect.ActionOnLineHelper onLine = new ActionOnLineHelper(domainProvider);
                        Messages messages1 = onLine.CheckID(
                            new CKeypartsActionEventArgs(
                                ActionType.DataCollectAction_CollectKeyParts,
                                product.LastSimulation.RunningCard,
                                client.LoginedUser,
                                client.ResourceCode,
                                product,
                                null,
                                null));
                        if (messages1.IsSuccess() == true)
                        {
                            objBomDetail = opBOMFacade.GetOPBOMDetails(
                                product.NowSimulation.MOCode,
                                product.NowSimulation.RouteCode,
                                product.NowSimulation.OPCode);
                        }
                        else
                        {
                            throw new Exception(messages1.OutPut());
                        }
                        // Added end

                        MOFacade moFacade = new MOFacade(domainProvider);
                        object   mo       = moFacade.GetMO(product.LastSimulation.MOCode);

                        OPBomKeyparts opBomKeyparts = new OPBomKeyparts(objBomDetail, Convert.ToInt32(((MO)mo).IDMergeRule), domainProvider);

                        if (opBomKeyparts.Count == 0)
                        {
                            /*	Removed by Icyer 2006/12/27 @ YHI
                             * msg.Add(new Message(MessageType.Error, "$CS_NOOPBomInfo $CS_Param_MOCode="+product.LastSimulation.MOCode
                             +" $CS_Param_RouteCode="+product.LastSimulation.RouteCode
                             +" $CS_Param_OPCode ="+product.LastSimulation.OPCode));
                             * throw new Exception(msg.OutPut());
                             */
                            throw new Exception("$CS_NOOPBomInfo");
                        }
                        else
                        {
                            //opBomKeyparts.AddKeyparts(data, product.LastSimulation.MOCode);	// Removed by Icyer 2006/12/14

                            keypartsHT.Add("KeypartsInfo", opBomKeyparts);
                        }
                    }
                    catch (Exception ex)
                    {
                        /*	Removed by Icyer 2006/12/27 @ YHI
                         * keypartsHT = null;
                         * this.NeedCancel = true;
                         * throw ex;
                         */
                        // Added by Icyer 2006/12/27 @ YHI
                        base.Action(act);
                        ActionCollectKeyparts actionCollectKeyparts = this;
                        this.NextAction = actionCollectKeyparts;
                        this.Status     = ActionStatus.PrepareData;
                        msg.ClearMessages();
                        msg.Add(new UserControl.Message(MessageType.Error, ex.Message));
                        msg.Add(new UserControl.Message(MessageType.Normal, "$DCT_PLEASE_INPUT_Keyparts"));
                        return(msg);
                        // Added end
                    }
                }
            }

            if (msg.IsSuccess())
            {
                OPBomKeyparts opBomKeyparts = (OPBomKeyparts)keypartsHT["KeypartsInfo"];
                msg = keypartsHT["ProdcutInfo"] as Messages;
                MO moWillGo = (MO)keypartsHT["MOWillGo"];

                ProductInfo product = (ProductInfo)msg.GetData().Values[0];

                Messages msgResult = new Messages();
                if (opBomKeyparts.Count > opBomKeyparts.GetbomKeypartCount())
                {
                    try
                    {
                        //opBomKeyparts.AddKeyparts(data, product.LastSimulation.MOCode);
                        if (moWillGo == null)
                        {
                            msgResult.AddMessages(opBomKeyparts.AddKeyparts(data, product.LastSimulation.MOCode));
                        }
                        else
                        {
                            msgResult.AddMessages(opBomKeyparts.AddKeyparts(data, moWillGo.MOCode));
                        }
                    }
                    catch (Exception ex)
                    {
                        msgResult.Add(new UserControl.Message(MessageType.Error, ex.Message));
                    }

                    keypartsHT["KeypartsInfo"] = opBomKeyparts;
                }

                if (msgResult.IsSuccess() == false || opBomKeyparts.Count > opBomKeyparts.GetbomKeypartCount())
                {
                    base.Action(act);
                    ActionCollectKeyparts actionCollectKeyparts = this;
                    this.NextAction = actionCollectKeyparts;

                    this.Status = ActionStatus.PrepareData;

                    this.OutMesssage = new UserControl.Message(MessageType.Normal, "$DCT_PLEASE_INPUT_Keyparts " + (opBomKeyparts.GetbomKeypartCount() + 1).ToString() + "/" + opBomKeyparts.Count.ToString());
                    if (msgResult.IsSuccess() == false)
                    {
                        //msgResult.Add(new UserControl.Message(MessageType.Normal, "$DCT_PLEASE_INPUT_Keyparts"));
                        return(msgResult);
                    }
                    else
                    {
                        return(msg);
                    }
                }

                //((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)domainProvider).PersistBroker.OpenConnection();
                domainProvider.BeginTransaction();
                try
                {
                    BenQGuru.eMES.BaseSetting.BaseModelFacade dataModel = new BenQGuru.eMES.BaseSetting.BaseModelFacade(domainProvider);
                    Resource resource = (Resource)dataModel.GetResource(args.ResourceCode);

                    _helper = new ActionOnLineHelper(domainProvider);
                    DataCollectFacade dataCollect       = new DataCollect.DataCollectFacade(domainProvider);
                    ActionCheckStatus actionCheckStatus = new ActionCheckStatus();
                    actionCheckStatus.ProductInfo          = product;
                    actionCheckStatus.ProductInfo.Resource = resource;
                    ExtendSimulation lastSimulation = actionCheckStatus.ProductInfo.LastSimulation;

                    BenQGuru.eMES.Material.WarehouseFacade wfacade = null;
                    if (System.Configuration.ConfigurationSettings.AppSettings["NeedMaterialModule"].Trim() == "1")
                    {
                        wfacade = new WarehouseFacade(domainProvider);
                    }

                    IDCTClient client = act as IDCTClient;

                    msg.AddMessages(_helper.ActionWithTransaction(
                                        new CKeypartsActionEventArgs(
                                            ActionType.DataCollectAction_CollectKeyParts,
                                            product.NowSimulation.RunningCard,
                                            client.LoginedUser,
                                            client.ResourceCode,
                                            product,
                                            opBomKeyparts,
                                            wfacade), actionCheckStatus));

                    // Added by Icyer 2006/12/28 @ YHI	采集集成上料
                    bool bLoadedINNO = false;
                    if (this.NeedCollectINNO == true && msg.IsSuccess() == true)
                    {
                        string strRCard = product.NowSimulation.RunningCard;
                        UserControl.Messages msgProduct = _helper.GetIDInfo(strRCard);
                        product = (ProductInfo)msgProduct.GetData().Values[0];
                        CINNOActionEventArgs argsInno = new CINNOActionEventArgs(
                            ActionType.DataCollectAction_CollectINNO,
                            strRCard,
                            client.LoginedUser,
                            client.ResourceCode,
                            product,
                            INNOCode,
                            wfacade
                            );
                        IAction action = new BenQGuru.eMES.DataCollect.Action.ActionFactory(domainProvider).CreateAction(ActionType.DataCollectAction_CollectINNO);
                        msg.AddMessages(action.Execute(argsInno));
                        if (msg.IsSuccess() == true)
                        {
                            bLoadedINNO = true;
                            msg.Add(new UserControl.Message(MessageType.Success, string.Format("$CS_INNO_CollectSuccess[" + this.INNOCode + "] $CS_Keyparts_CollectSuccess")));
                        }
                    }
                    // Added end
                    if (msg.IsSuccess())
                    {
                        if (System.Configuration.ConfigurationSettings.AppSettings["NeedMaterialModule"].Trim() == "1")
                        {
                            if (wfacade != null)
                            {
                                wfacade.ExecCacheSQL();
                            }
                        }

                        domainProvider.CommitTransaction();
                        if (bLoadedINNO == false)
                        {
                            msg.Add(new UserControl.Message(MessageType.Success, string.Format("$CS_Keyparts_CollectSuccess")));
                        }
                    }
                    else
                    {
                        domainProvider.RollbackTransaction();
                    }
                }
                catch (Exception ex)
                {
                    domainProvider.RollbackTransaction();

                    msg.Add(new UserControl.Message(ex));
                }
                finally
                {
                    ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)domainProvider).PersistBroker.CloseConnection();
                }
                base.Action(act);
                ActionRCard actRcard1 = new ActionRCard();
                actRcard1.OutMesssage = new UserControl.Message(MessageType.Normal, "$CS_Please_Input_RunningCard");
                this.NextAction       = actRcard1;
                this.ObjectState      = null;
                this.keypartsHT       = null;
                this.Status           = ActionStatus.PrepareData;
                return(msg);
            }

            base.Action(act);

            //Web.Helper.ActionType acttype = new Web.Helper.ActionType();
//			if(acttype.Items.Contains(args.RunningCard))
//			{
//				(act as IDCTClient).CachedAction = null;
//			}

            ActionRCard actRcard = new ActionRCard();

            actRcard.OutMesssage = new UserControl.Message(MessageType.Normal, "$CS_Please_Input_RunningCard");
            this.NextAction      = actRcard;
            // Added by Icyer 2006/12/14
            this.ObjectState = null;
            this.keypartsHT  = null;
            this.Status      = ActionStatus.PrepareData;
            // Added end

            return(msg);
        }
Пример #23
0
        public Messages CheckProduct(string rcard, object act)
        {
            currentProductInfo = null;
            moWillGo           = null;
            Messages msg = 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;
            }
            ActionOnLineHelper _helper = new ActionOnLineHelper(domainProvider);

            msg = _helper.GetIDInfo(rcard);
            if (msg.IsSuccess())
            {
                IDCTClient  client       = (IDCTClient)act;
                ProductInfo product      = (ProductInfo)msg.GetData().Values[0];
                bool        bNeedCheckMO = false;
                if (product == null || product.LastSimulation == null)
                {
                    /*	需要再检查是否归属工单
                     * msg.Add(new UserControl.Message(UserControl.MessageType.Error,"$NoSimulation"));
                     * return msg;
                     */
                    bNeedCheckMO = true;
                }
                else
                {
                    // 如果完工,并且当前资源不属于Simulation的当前工序,则需要检查归属工单
                    if (product.LastSimulation.IsComplete == "1")
                    {
                        BenQGuru.eMES.BaseSetting.BaseModelFacade dataModel = new BenQGuru.eMES.BaseSetting.BaseModelFacade(domainProvider);
                        if (dataModel.GetOperation2Resource(product.LastSimulation.OPCode, client.ResourceCode) == null)
                        {
                            bNeedCheckMO = true;
                        }
                    }
                }
                Messages msgChkErr = new Messages();
                if (bNeedCheckMO == true)
                {
                    ActionGoToMO actionGoMO = new ActionGoToMO(domainProvider);
                    Messages     msgMo      = actionGoMO.GetItemCodeFromGoMoRCard(client.ResourceCode, rcard);
                    if (msgMo.IsSuccess() == false)                             // 如果有错误,表示需要归属工单,但是解析工单或查询工单发生错误
                    {
                        msgChkErr.AddMessages(msgMo);
                    }
                    else                        // 返回成功,有两种情况:需要归属工单并且返回正确的工单信息;不需要归属工单
                    {
                        UserControl.Message msgMoData = msgMo.GetData();
                        if (msgMoData != null && msgMoData.Values.Length > 0)                                   // 有DATA数据,表示需要归属工单
                        {
                            this.moWillGo = (MO)msgMoData.Values[0];
                        }
                        else                                    // 如果没有DATA数据,表示不需要归属工单,则调用以前的代码:如果LastSimulation为空,则报没有序列号
                        {
                            if (product.LastSimulation == null)
                            {
                                msgChkErr.Add(new UserControl.Message(UserControl.MessageType.Error, "$NoSimulation"));
                            }
                        }
                    }
                }
                if (msgChkErr.IsSuccess() == false)
                {
                    return(msgChkErr);
                }

                if (product.LastSimulation != null)                             // 只有在序列号存在的情况下才检查途程
                {
                    msg = _helper.CheckID(new TSActionEventArgs(ActionType.DataCollectAction_NG,
                                                                rcard,
                                                                client.LoginedUser,
                                                                client.ResourceCode,
                                                                product,
                                                                new object[] {},
                                                                null,
                                                                ""));
                }
                if (product.LastSimulation == null || msg.IsSuccess() == true)
                {
                    currentProductInfo = product;
                }
                else if (product.LastSimulation.LastAction == ActionType.DataCollectAction_GOOD ||
                         product.LastSimulation.LastAction == ActionType.DataCollectAction_NG ||
                         product.LastSimulation.LastAction == ActionType.DataCollectAction_OutLineGood ||
                         product.LastSimulation.LastAction == ActionType.DataCollectAction_OutLineNG)                           // 允许测试站重复采集
                {
                    BenQGuru.eMES.BaseSetting.BaseModelFacade dataModel = new BenQGuru.eMES.BaseSetting.BaseModelFacade(domainProvider);
                    if (dataModel.GetOperation2Resource(product.LastSimulation.OPCode, (act as IDCTClient).ResourceCode) != null)
                    {
                        msg.ClearMessages();
                        currentProductInfo = product;
                    }
                }
            }
            return(msg);
        }
Пример #24
0
        private DataTable GetImportDT(ArrayList array)
        {
            /* 生成表结构 */
            DataTable dt = new DataTable();

            dt.Rows.Clear();
            dt.Columns.Clear();
            dt.Columns.Add(this.gridHelper.CheckColumnKey, typeof(bool));
            dt.Columns.Add("GUID");
            dt.Columns.Add("ImportResult");
            dt.AcceptChanges();
            ArrayList htable = this.XmlHelper.GridBuilder;
            string    orgid  = string.Empty;

            if (htable.Count > 0)
            {
                foreach (DictionaryEntry de in htable)
                {
                    string key = de.Key.ToString();
                    dt.Columns.Add(key);
                }

                //添加组织ID Add By Jarvis 20121213
                switch (this.InputType.ToUpper())
                {
                case "ITEM":
                case "MODEL":
                case "ITEMLOCATION":
                case "OPBOM":
                    htable.Insert(0, new DictionaryEntry("ORGID", "ORGID"));
                    dt.Columns.Add("ORGID");
                    Domain.BaseSetting.Organization org = new BenQGuru.eMES.BaseSetting.BaseModelFacade(this.DataProvider).
                                                          GetUserDefaultOrgByUser(this.GetUserCode()) as Domain.BaseSetting.Organization;
                    if (org != null)
                    {
                        orgid = org.OrganizationID.ToString().ToUpper();
                    }
                    break;

                default:
                    break;
                }
            }

            /* 填数据 */
            for (int i = 0; i < array.Count; i++)
            {
                GridRecord gridRow = array[i] as GridRecord;
                DataRow    row     = dt.NewRow();
                row["GUID"]                    = Guid.NewGuid().ToString();
                row["ImportResult"]            = "";
                row[gridHelper.CheckColumnKey] = false;
                if (htable.Count > 0)
                {
                    foreach (DictionaryEntry de in htable)
                    {
                        string key = de.Key.ToString();

                        //添加组织ID Add By Jarvis 20121213
                        if (key.ToUpper() == "ORGID")
                        {
                            row[key] = orgid;
                            continue;
                        }

                        if (XmlHelper.NeedMatchCtoE(key))
                        {
                            string value1 = GetECode(key, gridRow.Items.FindItemByKey(key).Value.ToString());
                            if (gridRow.Items.FindItemByKey(key).Value.ToString().Trim().Length != 0 &&
                                value1.Length == 0)
                            {
                                ExceptionManager.Raise(this.GetType().BaseType, "$Error_UploadFile_ContentError");
                            }
                            else
                            {
                                row[key] = value1;
                            }
                        }
                        else
                        {
                            row[key] = gridRow.Items.FindItemByKey(key).Value.ToString();
                        }
                    }
                }
                dt.Rows.Add(row);
            }

            return(dt);
        }
Пример #25
0
        private void ucBtnOK_Click(object sender, System.EventArgs e)
        {
            if (this.ucLEMOCode.Value.Trim() == string.Empty)
            {
                this.ucMessage.Add(">>$CS_Please_Input_MOCode");

                ucLEMOCode.TextFocus(false, true);
                return;
            }

            if (this.ucLERunningCard.Value.Trim() == string.Empty)
            {
                this.ucMessage.Add(">>$CS_Please_Input_RunningCard");


                return;
            }

            if (this._moCode == string.Empty)
            {
                if (!this.displayMOInfo())
                {
                    return;
                }
            }

            string runningCard = this.ucLERunningCard.Value.Trim().ToUpper();

            this.ucMessage.Add("<< " + runningCard);

            Messages messages = this._helper.GetIDInfo(runningCard);

            if (messages.IsSuccess())
            {
                ProductInfo product = (ProductInfo)messages.GetData().Values[0];

                // Added by Icyer 2005/10/28
                if (Resource == null)
                {
                    BenQGuru.eMES.BaseSetting.BaseModelFacade dataModel = new BenQGuru.eMES.BaseSetting.BaseModelFacade(this.DataProvider);
                    Resource = (Domain.BaseSetting.Resource)dataModel.GetResource(ApplicationService.Current().ResourceCode);
                }
                // Added end

                ActionCheckStatus actionCheckStatus = new ActionCheckStatus();

                if (listActionCheckStatus.ContainsKey(_moCode))
                {
                    actionCheckStatus             = (ActionCheckStatus)listActionCheckStatus[_moCode];
                    actionCheckStatus.ProductInfo = null;
                    actionCheckStatus.ActionList  = new ArrayList();
                }
                else
                {
                    listActionCheckStatus.Add(_moCode, actionCheckStatus);
                }

                GoToMOActionEventArgs args = new GoToMOActionEventArgs(
                    ActionType.DataCollectAction_GoMO,
                    runningCard,
                    ApplicationService.Current().UserCode,
                    ApplicationService.Current().ResourceCode,
                    product,
                    this._moCode);

                IAction action = new ActionFactory(this.DataProvider).CreateAction(ActionType.DataCollectAction_GoMO);

                //Laws Lu,2005/10/19,新增	缓解性能问题
                ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.OpenConnection();
                DataProvider.BeginTransaction();
                try
                {
                    messages.AddMessages(((IActionWithStatus)action).Execute(args, actionCheckStatus));

                    if (messages.IsSuccess())
                    {
                        this.DataProvider.CommitTransaction();
                        messages.Add(new UserControl.Message(MessageType.Success, string.Format("$CS_GOMO_CollectSuccess $MOCode={0}", this._moCode)));

                        actionCheckStatus.MO.MOInputQty += actionCheckStatus.MO.IDMergeRule;


                        this.displayMOInfo();
                    }
                    else
                    {
                        this.DataProvider.RollbackTransaction();
                    }
                }
                catch (Exception ex)
                {
                    this.DataProvider.RollbackTransaction();

                    messages.Add(new UserControl.Message(ex));
                }
                finally
                {
                    //Laws Lu,2005/10/19,新增	缓解性能问题
                    ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.CloseConnection();
                }
            }

            this.ucMessage.Add(messages);
            this.ucMessage.Add(">>$CS_Please_Input_RunningCard");

            this.ucLERunningCard.Value = "";
            this.ucLERunningCard.TextFocus(false, true);
        }
Пример #26
0
        private void btnConfirm_Click(object sender, System.EventArgs e)
        {
            try
            {
                this.Cursor = System.Windows.Forms.Cursors.WaitCursor;

                Messages msg = new Messages();
                if (this.txtAlertMsg.InnerTextBox.Text.Trim() == string.Empty)
                {
                    msg.Add(new UserControl.Message(MessageType.Error, this.txtAlertMsg.Caption + " $Error_Input_Empty"));
                    ApplicationRun.GetInfoForm().Add(msg);
                    return;
                }

                if (this.txtMOCode.InnerTextBox.Text.Trim() == string.Empty)
                {
                    msg.Add(new UserControl.Message(MessageType.Error, this.txtMOCode.Caption + " $Error_Input_Empty"));
                    ApplicationRun.GetInfoForm().Add(msg);
                    this.txtMOCode.TextFocus(false, true);
                    return;
                }

                //根据工单得到产品代码
                BenQGuru.eMES.MOModel.MOFacade  moFacade = new MOFacade(this.DataProvider);
                BenQGuru.eMES.Domain.MOModel.MO mo       = moFacade.GetMO(this.txtMOCode.InnerTextBox.Text.Trim()) as BenQGuru.eMES.Domain.MOModel.MO;
                string productcode;
                if (mo != null)
                {
                    productcode = mo.ItemCode;
                }
                else
                {
                    msg.Add(new UserControl.Message(MessageType.Error, "$ManualAlert_MOCode_Error"));                    //工单号码输入错误
                    ApplicationRun.GetInfoForm().Add(msg);
                    this.txtMOCode.TextFocus(false, true);
                    return;
                }
                try
                {
                    DataProvider.BeginTransaction();

                    BenQGuru.eMES.AlertModel.AlertFacade facade = new BenQGuru.eMES.AlertModel.AlertFacade(DataProvider);
                    BenQGuru.eMES.Domain.Alert.Alert     alert  = facade.CreateNewAlert();

                    alert.ItemCode    = string.Empty;
                    alert.AlertItem   = string.Empty;
                    alert.AlertStatus = BenQGuru.eMES.AlertModel.AlertStatus_Old.Unhandled;
                    alert.AlertType   = BenQGuru.eMES.AlertModel.AlertType_Old.Manual;

                    //Laws Lu,2006/11/13 uniform system collect date
                    DBDateTime dbDateTime;

                    dbDateTime = FormatHelper.GetNowDBDateTime(DataProvider);


                    alert.MaintainDate = dbDateTime.DBDate;
                    alert.MaintainUser = ApplicationService.Current().UserCode;
                    alert.MaintainTime = dbDateTime.DBTime;

                    alert.AlertLevel  = this._levelDict[this.cbAlertLevel.ComboBoxData.SelectedItem.ToString()];
                    alert.AlertMsg    = ApplicationService.Current().ResourceCode + ":" + this.txtAlertMsg.InnerTextBox.Text;
                    alert.Description = string.Empty;
                    alert.MailNotify  = "N";
                    alert.AlertValue  = 0;

                    alert.ProductCode = productcode;
                    //单得到产线代码
                    BenQGuru.eMES.BaseSetting.BaseModelFacade baseFacade = new BenQGuru.eMES.BaseSetting.BaseModelFacade(this.DataProvider);
                    Resource res = baseFacade.GetResource(ApplicationService.Current().ResourceCode) as Resource;
                    if (res != null)
                    {
                        alert.SSCode = res.StepSequenceCode;
                    }

                    alert.AlertMsg = this.txtAlertMsg.InnerTextBox.Text + "," +
                                     "产品: " +
                                     alert.ProductCode +
                                     ", 资源: " + ApplicationService.Current().ResourceCode;
                    facade.AddAlert(alert);

                    DataProvider.CommitTransaction();

                    msg.Add(new UserControl.Message(MessageType.Success, "$ManualAlert_Add_Success"));
                    ApplicationRun.GetInfoForm().Add(msg);
                    this.txtAlertMsg.InnerTextBox.Text = string.Empty;

                    //刷新Sample
                    //RefreshSample();
                }
                catch (System.Exception ex)
                {
                    DataProvider.RollbackTransaction();
                    msg.Add(new UserControl.Message(MessageType.Error, ex.Message));
                    ApplicationRun.GetInfoForm().Add(msg);
                }
            }
            finally
            {
                this.Cursor = System.Windows.Forms.Cursors.Default;
                this.CloseConnection();
            }
        }