コード例 #1
0
        private void edtMoCode_TxtboxKeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == '\r')
            {
                string moCode = FormatHelper.CleanString(this.edtMoCode.Value.Trim().ToUpper());
                if (moCode == string.Empty)
                {
                    this.edtMoCode.TextFocus(true, true);
                    return;
                }

                MOFacade          moFacade = new MOFacade(this.DataProvider);
                Domain.MOModel.MO mo       = (Domain.MOModel.MO)moFacade.GetMO(moCode);

                if (mo == null)
                {
                    ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "$CS_MO_Not_Exist $CS_Param_MOCode:" + moCode));
                    this.edtMoCode.TextFocus(false, true);
                    return;
                }

                this.edtitemDesc.Value  = mo.MaterialDescription.Trim();
                this.edtMoPlanQty.Value = Convert.ToString(Convert.ToInt32(mo.MOPlanQty - mo.MOActualQty));
                this.edtMoPlanQty.TextFocus(false, true);
            }
        }
コード例 #2
0
        protected void cmdAdd_ServerClick(object sender, System.EventArgs e)
        {
            object obj = this.GetEditObject();

            if (obj != null)
            {
                if (_MOFacade.GetFirstCheckByMO(
                        FormatHelper.PKCapitalFormat(FormatHelper.CleanString(((FirstCheckByMO)obj).MOCode)),
                        ((FirstCheckByMO)obj).CheckDate) != null)
                {
                    WebInfoPublish.Publish(this, "$Error_Primary_Key_Overlap", languageComponent1);
                    return;
                }
                ;
                if (_MOFacade.GetMO(FormatHelper.CleanString(((FirstCheckByMO)obj).MOCode)) == null)
                {
                    WebInfoPublish.Publish(this, "$Error_Input_MoCode", languageComponent1);
                    return;
                }
                this._MOFacade.AddFirstCheckByMO((FirstCheckByMO)obj);

                this.RequestData();
                this.buttonHelper.PageActionStatusHandle(PageActionType.Add);
            }
        }
コード例 #3
0
ファイル: DataImportHelper.cs プロジェクト: windygu/.net-wms
        private object CheckRpeat(object obj, string type)
        {
            if (obj == null)
            {
                return(null);
            }

            switch (type)
            {
            case "Model2Item":
                BenQGuru.eMES.Domain.MOModel.Model2Item model2item = obj as BenQGuru.eMES.Domain.MOModel.Model2Item;
                ModelFacade modelfacade = new ModelFacade(this.MESProvider);
                return(modelfacade.GetModel2ItemByItemCode(model2item.ItemCode));

            case "Item":
                BenQGuru.eMES.Domain.MOModel.Item item = obj as BenQGuru.eMES.Domain.MOModel.Item;
                ItemFacade itemfacade = new ItemFacade(this.MESProvider);
                return(itemfacade.GetItem(item.ItemCode, GlobalVariables.CurrentOrganizations.First().OrganizationID));

            case "MO":
                BenQGuru.eMES.Domain.MOModel.MO mo = obj as BenQGuru.eMES.Domain.MOModel.MO;
                MOFacade mofacade = new MOFacade(this.MESProvider);
                return(mofacade.GetMO(mo.MOCode));

            default:
                return(null);
            }
        }
コード例 #4
0
ファイル: ActionGotoMO.cs プロジェクト: windygu/.net-wms
        //add by hiro 08/11/05 检查序列号内容为字母,数字和空格
        public Messages CheckSNContent(string moCode, string rcard, Common.DomainDataProvider.SQLDomainDataProvider domainProvider)
        {
            Messages   msg        = new Messages();
            MOFacade   mofcade    = new MOFacade(domainProvider);
            ItemFacade itemfacade = new ItemFacade(domainProvider);
            object     objMo      = mofcade.GetMO(moCode);

            if (objMo == null)
            {
                return(msg);
            }
            string itemCode       = ((MO)objMo).ItemCode.ToString();
            object objItemSNcheck = itemfacade.GetItem2SNCheck(itemCode, ItemCheckType.ItemCheckType_SERIAL);

            if (objItemSNcheck == null)
            {
                return(msg);
            }
            if (((Item2SNCheck)objItemSNcheck).SNContentCheck == SNContentCheckStatus.SNContentCheckStatus_Need)
            {
                string pattern = @"^([A-Za-z0-9]+[ ]*)*[A-Za-z0-9]+$";
                Regex  rex     = new Regex(pattern, RegexOptions.IgnoreCase);
                Match  match   = rex.Match(rcard);
                if (!match.Success)
                {
                    msg.Add(new UserControl.Message(MessageType.Error, "$CS_SNContent_CheckWrong $CS_Param_RunSeq:" + rcard.Trim()));
                    return(msg);
                }
            }
            return(msg);
        }
コード例 #5
0
ファイル: ActionGotoMO.cs プロジェクト: windygu/.net-wms
        // 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);
        }
コード例 #6
0
        protected void cmdAdd_ServerClick(object sender, EventArgs e)
        {
            ViewState["operate"] = "Add";
            if (this.ValidateInput())
            {
                if (_TransferFacade == null)
                {
                    _TransferFacade = new WarehouseFacade(this.DataProvider);
                }

                object obj = this.GetEditObject();

                if (obj != null)
                {
                    //add前检验唯一性

                    object hasData = _TransferFacade.GetInvTransferDetail(((InvTransferDetail)obj).TransferNO, ((InvTransferDetail)obj).TransferLine);
                    if (hasData != null)
                    {
                        WebInfoPublish.Publish(this, "$Error_TransferHasData", this.languageComponent1);
                        return;
                    }

                    if (!String.IsNullOrEmpty(((InvTransferDetail)obj).MOCode))
                    {
                        MOFacade _MOFacade = new MOFacade();
                        object   MO        = _MOFacade.GetMO(((InvTransferDetail)obj).MOCode);
                        if (MO == null)
                        {
                            WebInfoPublish.Publish(this, "$Error_MOCodeNotInTBLMO", this.languageComponent1);
                            return;
                        }
                    }

                    ((InvTransferDetail)obj).TransferStatus = RecordStatus.RecordStatus_NEW;
                    ((InvTransferDetail)obj).TransferDate   = ((InvTransferDetail)obj).Mdate;
                    ((InvTransferDetail)obj).TransferTime   = ((InvTransferDetail)obj).Mtime;
                    ((InvTransferDetail)obj).TransferUser   = ((InvTransferDetail)obj).Muser;

                    //根据客户代码从表TblCustomer中取得客户名称

                    if (!String.IsNullOrEmpty(((InvTransferDetail)obj).CustomerCode))
                    {
                        Customer customer = (Customer)_TransferFacade.GetCustomer(((InvTransferDetail)obj).CustomerCode);
                        if (customer != null)
                        {
                            ((InvTransferDetail)obj).CustomerName = customer.CustomerName;
                        }
                    }

                    _TransferFacade.AddInvTransferDetail((InvTransferDetail)obj);
                }
            }
            this.RequestData();
            this.buttonHelper.PageActionStatusHandle(PageActionType.Add);
        }
コード例 #7
0
        protected void cmdSave_ServerClick(object sender, EventArgs e)
        {
            ViewState["operate"] = "Edit";
            if (this.ValidateInput())
            {
                if (_TransferFacade == null)
                {
                    _TransferFacade = new WarehouseFacade(this.DataProvider);
                }

                object obj = this.GetEditObject();

                if (obj != null)
                {
                    if (((InvTransferDetail)obj).TransferStatus != RecordStatus.RecordStatus_NEW)
                    {
                        WebInfoPublish.Publish(this, "$Error_OnlyNEWCanEdit", this.languageComponent1);
                        return;
                    }

                    if (!String.IsNullOrEmpty(((InvTransferDetail)obj).MOCode))
                    {
                        MOFacade _MOFacade = new MOFacade();
                        object   MO        = _MOFacade.GetMO(((InvTransferDetail)obj).MOCode);
                        if (MO == null)
                        {
                            WebInfoPublish.Publish(this, "$Error_MOCodeNotInTBLMO", this.languageComponent1);
                            return;
                        }
                    }
                    //根据客户代码从表TblCustomer中取得客户名称

                    if (!String.IsNullOrEmpty(((InvTransferDetail)obj).CustomerCode))
                    {
                        Customer customer = (Customer)_TransferFacade.GetCustomer(((InvTransferDetail)obj).CustomerCode);
                        if (customer != null)
                        {
                            ((InvTransferDetail)obj).CustomerName = customer.CustomerName;
                        }
                    }

                    _TransferFacade.UpdateInvTransferDetail((InvTransferDetail)obj);
                }
            }

            this.RequestData();
            this.buttonHelper.PageActionStatusHandle(PageActionType.Save);
            if (this.ViewState["TransferStatus"].ToString() == this.languageComponent1.GetString(RecordStatus.RecordStatus_CLOSE))
            {
                this.cmdAdd.Disabled = true;
            }
            else
            {
                this.cmdAdd.Disabled = false;
            }
        }
コード例 #8
0
        private void GetImportObjectType(ref object obj, string importType)
        {
            if (obj == null)
            {
                return;
            }

            DBDateTime now = FormatHelper.GetNowDBDateTime(this._DataProvider);

            switch (importType.ToUpper())
            {
            case "WORKPLAN":
                if (_MOFacade == null)
                {
                    _MOFacade = new MOFacade(_DataProvider);
                }

                WorkPlan workPlan = obj as WorkPlan;
                workPlan.MaintainUser   = _UserCode;
                workPlan.MaintainDate   = now.DBDate;
                workPlan.MaintainTime   = now.DBTime;
                workPlan.ActionStatus   = WorkPlanActionStatus.WorkPlanActionStatus_Init;
                workPlan.MaterialStatus = MaterialWarningStatus.MaterialWarningStatus_No;
                object mo = _MOFacade.GetMO(FormatHelper.PKCapitalFormat(FormatHelper.CleanString(workPlan.MoCode)));
                workPlan.ItemCode = ((MO)mo).ItemCode;

                break;

            case "MATERIALNEED":
                MaterialReqStd materialReqStd = obj as MaterialReqStd;
                materialReqStd.MaintainUser = _UserCode;
                materialReqStd.MaintainDate = now.DBDate;
                materialReqStd.MaintainTime = now.DBTime;
                break;

            case "PLANWORKTIME":
                PlanWorkTime planWorkTime = obj as PlanWorkTime;
                planWorkTime.MaintainUser = _UserCode;
                planWorkTime.MaintainDate = now.DBDate;
                planWorkTime.MaintainTime = now.DBTime;
                break;

            default:
                break;
            }
        }
コード例 #9
0
        // Added by Icyer 2006/12/05
        private void TakeDownCarton(ActionEventArgs actionEventArgs)
        {
            bool        bDo     = false;
            ProductInfo product = actionEventArgs.ProductInfo;

            if (System.Configuration.ConfigurationSettings.AppSettings["TakeDownCartonReMORework"] == "1" &&
                product != null &&
                product.NowSimulation != null &&
                product.LastSimulation != null &&
                product.NowSimulation.MOCode != product.LastSimulation.MOCode &&
                product.LastSimulation.CartonCode != string.Empty)
            {
                MOFacade moFacade = new MOFacade(this.DataProvider);
                MO       mo       = (MO)moFacade.GetMO(product.NowSimulation.MOCode);
                if (mo == null)
                {
                    return;
                }
                BenQGuru.eMES.BaseSetting.SystemSettingFacade sysFacade = new SystemSettingFacade(this.DataProvider);
                Parameter param = (Parameter)sysFacade.GetParameter(mo.MOType, BenQGuru.eMES.Web.Helper.MOType.GroupType);
                if (param != null &&
                    param.ParameterValue == BenQGuru.eMES.Web.Helper.MOType.MOTYPE_REWORKMOTYPE)
                {
                    bDo = true;
                }
            }
            if (bDo == false)
            {
                return;
            }

            BenQGuru.eMES.Package.PackageFacade packageFacade = new BenQGuru.eMES.Package.PackageFacade(this.DataProvider);

            string strSql = "UPDATE tblSimulation SET CartonCode='' WHERE RCard='" + product.LastSimulation.LotCode + "' AND MOCode='" + product.LastSimulation.MOCode + "' ";

            this.DataProvider.CustomExecute(new SQLCondition(strSql));

            strSql = "UPDATE tblSimulationReport SET CartonCode='' WHERE RCard='" + product.LastSimulation.LotCode + "' AND MOCode='" + product.LastSimulation.MOCode + "' ";
            this.DataProvider.CustomExecute(new SQLCondition(strSql));

            packageFacade.SaveRemoveCarton2RCARDLog(product.LastSimulation.CartonCode, product.LastSimulation.LotCode, actionEventArgs.UserCode);

            packageFacade.SubtractCollected(product.LastSimulation.CartonCode);
            product.LastSimulation.CartonCode = string.Empty;
        }
コード例 #10
0
        /// <summary>
        /// 根据工单把产品,产品别信息取出来
        /// </summary>
        private void txtMoCode_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
        {
            if (e.KeyChar == '\r')
            {
                string mocode = this.txtMoCode.Text.Trim().ToUpper();
                if (mocode.Length == 0)
                {
                    return;
                }

                BenQGuru.eMES.MOModel.MOFacade  facade = new MOFacade(this.DataProvider);
                BenQGuru.eMES.Domain.MOModel.MO mo     = facade.GetMO(mocode) as BenQGuru.eMES.Domain.MOModel.MO;
                if (mo == null || mo.MOCode == null)
                {
                    ErrorMsg("$CS_MO_Not_Exist");
                    this.txtMoCode.Focus();
                    return;
                }

                BenQGuru.eMES.MOModel.ModelFacade  modelfacade = new ModelFacade(this.DataProvider);
                BenQGuru.eMES.Domain.MOModel.Model model       = modelfacade.GetModelByItemCode(mo.ItemCode) as BenQGuru.eMES.Domain.MOModel.Model;

                if (model == null)
                {
                    ErrorMsg("$CS_Model_Lost");
                    return;
                }
                BenQGuru.eMES.MOModel.ItemFacade  itemfacade = new ItemFacade(this.DataProvider);
                BenQGuru.eMES.Domain.MOModel.Item item       = itemfacade.GetItem(mo.ItemCode, GlobalVariables.CurrentOrganizations.First().OrganizationID) as BenQGuru.eMES.Domain.MOModel.Item;
                if (item == null)
                {
                    ErrorMsg("$Error_ItemCode_NotExist");
                    return;
                }

                this.cbxModel.SetSelectItem(model.ModelCode);
                this.cbxItemCode.SetSelectItem(mo.ItemCode);
                this.txtItemDesc.Value = item.ItemDescription;

                this.txtNum.Focus();
            }
        }
コード例 #11
0
ファイル: DataImportHelper.cs プロジェクト: windygu/.net-wms
        private void ImportMOBOM(object[] objs, string type, Log log)
        {
            MOFacade  mofacade = new MOFacade(this.MESProvider);
            Hashtable ht       = new Hashtable();

            object[] impobjs = new object[objs.Length];
            for (int j = 0; j < objs.Length; j++)
            {
                object impObj = importSchema.FillImportObject(objs[j], type);
                object moobj  = mofacade.GetMO((impObj as MOBOM).MOCode);
                impobjs.SetValue(impObj, j);
                if (!ht.ContainsKey((impObj as MOBOM).MOCode))
                {
                    (impObj as MOBOM).ItemCode = (moobj as MO).ItemCode;
                    ht.Add((impObj as MOBOM).MOCode, (moobj as MO).ItemCode);
                }
                else
                {
                    (impObj as MOBOM).ItemCode = ht[(impObj as MOBOM).MOCode].ToString();
                }
            }

            foreach (DictionaryEntry dic in ht)
            {
                object[] delobjs = mofacade.GetMOBOM(dic.Key.ToString());
                if (delobjs != null)
                {
                    for (int k = 0; k < delobjs.Length; k++)
                    {
                        this.MESProvider.Delete(delobjs[k]);
                    }
                }
            }

            for (int j = 0; j < objs.Length; j++)
            {
                this.MESProvider.Insert(impobjs[j]);

                this.ERPProvider.Delete(objs[j]);
            }
        }
コード例 #12
0
        public void Init(string rcard)
        {
            Messages msg = new Messages();

            try
            {
                if (!string.IsNullOrEmpty(rcard))
                {
                    this.txtRcard.Text = rcard;

                    if (m_DataCollectFacade == null)
                    {
                        m_DataCollectFacade = new DataCollectFacade(this.DataProvider);
                    }
                    object objSim = m_DataCollectFacade.GetSimulation(rcard);

                    if (objSim != null)
                    {
                        Simulation sim = (Simulation)objSim;
                        this.txtItemCode.Text = sim.ItemCode;
                        object objMo = m_MOFacade.GetMO(sim.MOCode.ToUpper());
                        int    orgID = Convert.ToInt16(((MO)objMo).OrganizationID);
                        Item   item  = (Item)m_ItemFacade.GetItem(((MO)objMo).ItemCode, orgID);
                        this.txtItemDesc.Text = item.ItemDescription;
                        DoQuery(sim.ItemCode, sim.OPCode);
                        QueryPicsNG();
                    }
                    else
                    {
                        msg.Add(new UserControl.Message(MessageType.Error, "$Error_CS_ID_Not_Exist"));
                        ApplicationRun.GetInfoForm().Add(msg);
                    }
                }
            }
            catch (Exception ex)
            {
                msg.Add(new UserControl.Message(ex));
                ApplicationRun.GetInfoForm().Add(msg);
                return;
            }
        }
コード例 #13
0
        /// <summary>
        /// 根据OnWIPItem的上料记录,反推上料的BOM,然后建立对应的下料BOM
        /// </summary>
        private Messages BuildOPBomKeyPartsByOnWIPItem(string rcard, ProductInfo product, OnWIPItem[] wipItems)
        {
            Messages msg = new Messages();

            MO       mo;
            MOFacade moFacade = new MOFacade(DataProvider);

            if (product != null && product.CurrentMO != null)
            {
                mo = product.CurrentMO;
            }
            else
            {
                mo = (MO)moFacade.GetMO(product.LastSimulation.MOCode);
            }

            OPBOMFacade opBOMFacade = new OPBOMFacade(DataProvider);

            object[] objOpBoms = opBOMFacade.GetOPBOMDetails(
                product.LastSimulation.MOCode
                , wipItems[0].RouteCode
                , wipItems[0].OPCode);
            for (int i = 0; objOpBoms != null && i < objOpBoms.Length; i++)
            {
                ((OPBOMDetail)objOpBoms[i]).ActionType = (int)MaterialType.DropMaterial;
            }
            opBomKeyparts = new OPBomKeyparts(objOpBoms, Convert.ToInt32(mo.IDMergeRule), this.DataProvider);

            if (opBomKeyparts.Count == 0)
            {
                msg.Add(new UserControl.Message("$CS_NOOPBomInfo $CS_Param_MOCode =" + product.LastSimulation.MOCode
                                                + " $CS_Param_RouteCode =" + wipItems[0].RouteCode
                                                + " $CS_Param_OPCode =" + wipItems[0].OPCode));
            }

            return(msg);
        }
コード例 #14
0
        // 从需要归属工单的序列号中,查询应该归属工单的工单信息
        // 用在第一站采NG时,查询不良代码列表
        public Messages GetItemCodeFromGoMoRCard(string resourceCode, string runningCard)
        {
            Messages   msg = new Messages();
            DBDateTime dbDateTime;

            dbDateTime = FormatHelper.GetNowDBDateTime(DataProvider);

            string strResCode = resourceCode;
            string strRCard   = runningCard;
            // 根据资源检查是否需要归属工单
            Resource2MO res2mo = GetResource2MOByResource(strResCode, dbDateTime);

            if (res2mo == null)         // 如果没有设置,表示不用归属工单,直接返回
            {
                return(msg);
            }
            // 检查序列号格式
            msg.AddMessages(CheckRCardFormatByResource2MO(res2mo, runningCard, null));
            if (msg.IsSuccess() == false)
            {
                return(msg);
            }
            // 解析工单
            string strMOCode = BuildMOCodeByResource2MO(res2mo, runningCard, null, dbDateTime);
            // 查询工单信息
            MOFacade moFacade = new MOFacade(this.DataProvider);
            MO       mo       = (MO)moFacade.GetMO(strMOCode);

            if (mo == null)
            {
                msg.Add(new Message(MessageType.Error, "$CS_MO_Not_Exit [" + strMOCode + "]"));
                return(msg);
            }
            msg.Add(new Message(MessageType.Data, "", new object[] { mo }));
            return(msg);
        }
コード例 #15
0
ファイル: FSMTScrapQty.cs プロジェクト: windygu/.net-wms
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (this.txtRelationQtyEdit.Value.Trim() == string.Empty)
            {
                //数量不能为空 $Error_Qty_Cannot_Empty
                ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "$Error_Qty_Cannot_Empty"));
                this.txtRelationQtyEdit.TextFocus(false, true);
                return;
            }
            try
            {
                if (mofacade == null)
                {
                    mofacade = new MOFacade(this.DataProvider);
                }
                object  objMO = mofacade.GetMO(this.txtMoCodeEdit.Value.Trim().ToUpper());
                decimal moQty = 0;

                int intQty = Convert.ToInt32(this.txtRelationQtyEdit.Value);
                if (intQty <= 0)
                {
                    //数量应为整数类型 $Error_Qty_Not_Int
                    ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "$Error_CS_SmtRelQty_Should_Over_Zero"));
                    this.txtRelationQtyEdit.TextFocus(false, true);
                    return;
                }
                else
                {
                    if (objMO != null && ((MO)objMO).IDMergeRule >= 0)
                    {
                        moQty = ((MO)objMO).IDMergeRule;
                    }
                    if (moQty < Convert.ToDecimal(intQty))
                    {
                        //数量应小于工单的连板数 $Error_Qty_Not_Int
                        ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "$Error_CS_SmtRelQty_Should_less_MO" + ": " + moQty));
                        this.txtRelationQtyEdit.TextFocus(false, true);
                        return;
                    }
                }
            }
            catch
            {
                //数量应为整数类型 $Error_Qty_Not_Int
                ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "$Error_Qty_Not_Int"));
                this.txtRelationQtyEdit.TextFocus(false, true);
                return;
            }
            if (smtfacade == null)
            {
                smtfacade = new SMTFacade(this.DataProvider);
            }
            object     relation   = smtfacade.GetSMTRelationQty(this.txtRCardEdit.Value, this.txtMoCodeEdit.Value.Trim());
            DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider);

            if (relation != null)
            {
                ((Smtrelationqty)relation).Relationqtry = int.Parse(this.txtRelationQtyEdit.Value);
                ((Smtrelationqty)relation).Muser        = ApplicationService.Current().UserCode;

                ((Smtrelationqty)relation).Mdate = dbDateTime.DBDate;
                ((Smtrelationqty)relation).Mtime = dbDateTime.DBTime;
                smtfacade.UpdateSmtrelationqty((Smtrelationqty)relation);
            }
            this.ucBtnSave.Enabled = false;
            btnQuery_Click(sender, e);
        }
コード例 #16
0
        // Added by Icyer 2005/10/28
        //扩展一个带ActionCheckStatus参数的方法
        public Messages Execute(ActionEventArgs actionEventArgs, ActionCheckStatus actionCheckStatus)
        {
            ((GoToMOActionEventArgs)actionEventArgs).MOCode       = ((GoToMOActionEventArgs)actionEventArgs).MOCode.Trim().ToUpper();
            actionEventArgs.ProductInfo.NowSimulation.EAttribute1 = (actionEventArgs as GoToMOActionEventArgs).Memo;
            //actionEventArgs.ProductInfo.NowSimulation.RMABillCode = (actionEventArgs as GoToMOActionEventArgs).ProductInfo.CurrentMO.mor;

            actionEventArgs.LotCode = actionEventArgs.LotCode.Trim().ToUpper();

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

            dataCollectDebug.WhenFunctionIn(messages);

            if (((GoToMOActionEventArgs)actionEventArgs).MOCode.Trim() == String.Empty)
            {
                messages.Add(new UserControl.Message(MessageType.Error, "$CS_Please_Input_MOCode"));
            }

            if (((GoToMOActionEventArgs)actionEventArgs).LotCode.Trim() == String.Empty)
            {
                messages.Add(new UserControl.Message(MessageType.Error, "$CS_Please_Input_RunningCard"));
            }

            DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider);
            MOFacade          moFacade          = new MOFacade(this.DataProvider);

            try
            {
                if (messages.IsSuccess())
                {
                    //调用含有ActionCheckStatus参数的CheckIn方法
                    messages.AddMessages(this.CheckIn(actionEventArgs, actionCheckStatus));
                    // Added by Icyer 2006/12/05
                    TakeDownCarton(actionEventArgs);
                    // Added end

                    if (!((GoToMOActionEventArgs)actionEventArgs).PassCheck)
                    {
                        throw new Exception("$CS_ID_Has_Already_Belong_To_This_MO $CS_Param_ID="
                                            + actionEventArgs.LotCode + " $Domain_MO=" + ((GoToMOActionEventArgs)actionEventArgs).MOCode);
                    }

                    if (messages.IsSuccess())
                    {
                        // 拆箱和拆Pallet

                        actionEventArgs.ProductInfo.NowSimulation.EAttribute1 = (actionEventArgs as GoToMOActionEventArgs).Memo;

                        if (actionCheckStatus.NeedUpdateSimulation)
                        {
                            ActionOnLineHelper dataCollect = new ActionOnLineHelper(this.DataProvider);
                            messages.AddMessages(dataCollect.Execute(actionEventArgs));
                        }
                        else
                        {
                            ActionOnLineHelper dataCollect = new ActionOnLineHelper(this.DataProvider);
                            messages.AddMessages(dataCollect.Execute(actionEventArgs, actionCheckStatus));
                        }

                        if (messages.IsSuccess())
                        {
                            moFacade.UpdateMOInPutQty(actionEventArgs.ProductInfo.NowSimulation.MOCode, actionEventArgs.CurrentMO, (int)actionEventArgs.ProductInfo.NowSimulation.LotQty);
                            //是否执行过updateItem2Route操作
                            if (actionCheckStatus.IsUpdateRefItem2Route == false)
                            {
                                this.updateItem2Route(actionEventArgs.ProductInfo.NowSimulation.ItemCode, actionEventArgs.ProductInfo.NowSimulation.RouteCode, actionEventArgs.UserCode);
                                actionCheckStatus.IsUpdateRefItem2Route = true;
                            }

                            MORunningCardFacade cardFacade = new MORunningCardFacade(this.DataProvider);
                            MORunningCard       card       = cardFacade.CreateNewMORunningCard();

                            card.MOCode             = ((GoToMOActionEventArgs)actionEventArgs).MOCode.ToString();
                            card.MORunningCardStart = actionEventArgs.LotCode;
                            card.MORunningCardEnd   = actionEventArgs.LotCode;
                            card.MaintainUser       = actionEventArgs.UserCode;

                            DBDateTime dbDateTime;
                            //Laws Lu,2006/11/13 uniform system collect date
                            //Laws Lu,2006/11/13 uniform system collect date
                            if (actionEventArgs.ProductInfo.WorkDateTime != null)
                            {
                                dbDateTime = actionEventArgs.ProductInfo.WorkDateTime;
                            }
                            else
                            {
                                dbDateTime = FormatHelper.GetNowDBDateTime(DataProvider);
                                actionEventArgs.ProductInfo.WorkDateTime = dbDateTime;
                            }

                            card.MaintainDate = dbDateTime.DBDate;
                            card.MaintainTime = dbDateTime.DBTime;
                            // Added by Icyer 2007/07/02
                            MO mo = (MO)moFacade.GetMO(card.MOCode);
                            card.MOSeq = mo.MOSeq;
                            // Added end

                            //将Action加入列表
                            actionCheckStatus.ActionList.Add(actionEventArgs);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                messages.Add(new Message(e));
            }

            dataCollectDebug.WhenFunctionOut(messages);
            return(messages);
        }
コード例 #17
0
        public Messages Execute(ActionEventArgs actionEventArgs)
        {
            ((GoToMOActionEventArgs)actionEventArgs).MOCode = ((GoToMOActionEventArgs)actionEventArgs).MOCode.Trim().ToUpper();
            actionEventArgs.LotCode = actionEventArgs.LotCode.Trim().ToUpper();

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

            dataCollectDebug.WhenFunctionIn(messages);

            if (((GoToMOActionEventArgs)actionEventArgs).MOCode.Trim() == String.Empty)
            {
                messages.Add(new UserControl.Message(MessageType.Error, "$CS_Please_Input_MOCode"));
            }

            if (((GoToMOActionEventArgs)actionEventArgs).LotCode.Trim() == String.Empty)
            {
                messages.Add(new UserControl.Message(MessageType.Error, "$CS_Please_Input_RunningCard"));
            }
            //add by hiro.chen 08/11/18 checkISDown
            DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider);

            //messages.AddMessages(dataCollectFacade.CheckISDown(((GoToMOActionEventArgs)actionEventArgs).LotCode.Trim()));
            //end

            try
            {
                if (messages.IsSuccess())
                {
                    actionEventArgs.ProductInfo.NowSimulation.EAttribute1 = (actionEventArgs as GoToMOActionEventArgs).Memo;
                    //actionEventArgs.ProductInfo.NowSimulation.RMABillCode = (actionEventArgs as GoToMOActionEventArgs).ProductInfo.CurrentMO.MOCode;

                    messages.AddMessages(this.CheckIn(actionEventArgs));
                    // Added by Icyer 2006/12/05
                    TakeDownCarton(actionEventArgs);
                    // Added end

                    //Laws Lu,2006/07/05 add support RMA
                    if (actionEventArgs.CurrentMO != null)
                    {
                        actionEventArgs.ProductInfo.NowSimulation.RMABillCode = actionEventArgs.CurrentMO.RMABillCode;
                    }

                    if (!((GoToMOActionEventArgs)actionEventArgs).PassCheck)
                    {
                        throw new Exception("$CS_ID_Has_Already_Belong_To_This_MO $CS_Param_ID="
                                            + actionEventArgs.LotCode + " $Domain_MO=" + ((GoToMOActionEventArgs)actionEventArgs).MOCode);
                    }

                    if (messages.IsSuccess())
                    {
                        ActionOnLineHelper dataCollect = new ActionOnLineHelper(this.DataProvider);
                        //actionEventArgs.ProductInfo.NowSimulation.Eattribute1 = (actionEventArgs as GoToMOActionEventArgs).Memo;

                        // Added By Hi1/Venus Feng on 20081114 for Hisense Version : remove pallet and carton
                        // 拆箱和拆Pallet
                        DataCollectFacade dcf = new DataCollectFacade(this.DataProvider);


                        // End Added

                        messages.AddMessages(dataCollect.Execute(actionEventArgs));

                        if (messages.IsSuccess())
                        {
                            //Laws Lu,2005/10/24,注释
                            // Added by Jane Shu	Date:2005/06/02
                            //							if ( actionEventArgs.ProductInfo.NowSimulation != null )
                            //							{
                            //this.updateMOQty(actionEventArgs.ProductInfo.NowSimulation.MOCode, actionEventArgs.UserCode);
                            this.updateItem2Route(actionEventArgs.ProductInfo.NowSimulation.ItemCode, actionEventArgs.ProductInfo.NowSimulation.RouteCode, actionEventArgs.UserCode);
                            //							}

                            // 将ID添加到MO范围表内		Added by Jane Shu	Date:2005/06/03
                            MORunningCardFacade cardFacade = new MORunningCardFacade(this.DataProvider);
                            MORunningCard       card       = cardFacade.CreateNewMORunningCard();

                            DBDateTime dbDateTime;
                            //Laws Lu,2006/11/13 uniform system collect date
                            //Laws Lu,2006/11/13 uniform system collect date
                            if (actionEventArgs.ProductInfo.WorkDateTime != null)
                            {
                                dbDateTime = actionEventArgs.ProductInfo.WorkDateTime;
                            }
                            else
                            {
                                dbDateTime = FormatHelper.GetNowDBDateTime(DataProvider);
                                actionEventArgs.ProductInfo.WorkDateTime = dbDateTime;
                            }

                            card.MOCode             = ((GoToMOActionEventArgs)actionEventArgs).MOCode.ToString();
                            card.MORunningCardStart = actionEventArgs.LotCode;
                            card.MORunningCardEnd   = actionEventArgs.LotCode;
                            card.MaintainUser       = actionEventArgs.UserCode;

                            card.MaintainDate = dbDateTime.DBDate;
                            card.MaintainTime = dbDateTime.DBTime;

                            card.EAttribute1 = (actionEventArgs as GoToMOActionEventArgs).Memo;
                            // Added by Icyer 2007/07/02
                            MOFacade moFacade = new MOFacade(this.DataProvider);
                            MO       mo       = (MO)moFacade.GetMO(card.MOCode);
                            card.MOSeq = mo.MOSeq;
                            // Added end

                            cardFacade.AddMORunningCard(card);


                            //ReportHelper reportCollect = new ReportHelper(this.DataProvider);
                            //messages.AddMessages(reportCollect.ReportLineQuanMaster(this.DataProvider, actionEventArgs.ActionType, actionEventArgs.ProductInfo));
                        }
                    }
                }
            }
            catch (Exception e)
            {
                messages.Add(new Message(e));
            }

            dataCollectDebug.WhenFunctionOut(messages);
            return(messages);
        }
コード例 #18
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);
        }
コード例 #19
0
        public Messages DeductQty(ActionEventArgs actionEventArgs, DataCollectFacade dataCollectFacade, MINNO minno)
        {
            SystemSettingFacade systemSettingFacade = new SystemSettingFacade(this.DataProvider);
            MaterialFacade      materialFacade      = new MaterialFacade(this.DataProvider);
            MOFacade            moFacade            = new MOFacade(this.DataProvider);
            OPBOMFacade         opbomFacade         = new OPBOMFacade(this.DataProvider);
            ItemFacade          itemFacade          = new ItemFacade(this.DataProvider);
            InventoryFacade     inventoryFacade     = new InventoryFacade(this.DataProvider);
            LotSimulation       simulation          = ((CINNOActionEventArgs)actionEventArgs).ProductInfo.NowSimulation;
            LotSimulationReport simulationReport    = ((CINNOActionEventArgs)actionEventArgs).ProductInfo.NowSimulationReport;
            Messages            returnValue         = new Messages();
            string lotNoList = string.Empty;// add by Jarvis For onWipItem

            ProductInfo   productionInfo = actionEventArgs.ProductInfo;
            LotSimulation sim            = actionEventArgs.ProductInfo.NowSimulation;
            int           orgid          = actionEventArgs.ProductInfo.Resource.OrganizationID;
            MO            mo             = actionEventArgs.ProductInfo.CurrentMO;

            if (mo == null)
            {
                mo = moFacade.GetMO(sim.MOCode) as MO;
            }

            //获取当前工单号
            string moCode = productionInfo.NowSimulation.MOCode;
            //获取当前工序号
            string opCode = productionInfo.NowSimulation.OPCode;
            //获取当前产品号
            string itemCode = productionInfo.NowSimulation.ItemCode;
            //获取途程代码
            string routeCode = productionInfo.NowSimulation.RouteCode;
            string resCode   = productionInfo.Resource.ResourceCode;
            //获取ORGID
            int    orgID    = productionInfo.Resource.OrganizationID;
            string moBomVer = string.Empty;

            object objMo = moFacade.GetMO(moCode);

            if (objMo != null)
            {
                moBomVer = (objMo as MO).BOMVersion;
            }

            //获取物料名称
            string MItemName = string.Empty;

            Domain.MOModel.Material material = ((Domain.MOModel.Material)itemFacade.GetMaterial(minno.MItemCode, orgID));
            if (material != null)
            {
                MItemName = material.MaterialName;
            }

            //添加产品已上料扣料判断  tblonwip
            string  lotNo = productionInfo.NowSimulation.LotCode;
            decimal seq   = productionInfo.NowSimulation.LotSeq;

            //object[] objOnWip = dataCollectFacade.QueryLotOnWIP(lotNo, moCode, opCode, "CINNO");

            //if (objOnWip != null && objOnWip.Length > 0)
            //{
            //    return returnValue;
            //}

            //remove by Jarvis 不检查工单BOM 20120321
            //object[] objMoBoms = moFacade.QueryMoBom(sim.ItemCode, minno.MItemCode, sim.MOCode);//检查工单BOM是否有该首选料, Jarvis 20120319
            //if (objMoBoms == null)
            //{
            //    throw new Exception("$CS_ItemCode[" + minno.MItemCode + "]" + "$Error_NotExistInMoBOM" + String.Format("[$MOCode='{0}']", sim.MOCode));
            //}

            object[] opbomObjs = opbomFacade.QueryOPBOMDetail(sim.ItemCode, minno.MItemCode, string.Empty, string.Empty, string.Empty, sim.RouteCode, opCode, (int)MaterialType.CollectMaterial, int.MinValue, int.MaxValue, orgid, true);
            if (opbomObjs == null)
            {
                throw new Exception("$CS_ItemCode[" + minno.MItemCode + "]" + "$Error_NotExistInOPBOM" + String.Format("[$ItemCode='{0}']", sim.ItemCode));
            }

            object[] moRouteObjs = moFacade.QueryMORoutes(sim.MOCode, sim.RouteCode);
            if (moRouteObjs == null)
            {
                throw new Exception("$Error_MORouteNOExist");
            }

            bool iflag = false;

            decimal iOPBOMItemQty = 0;

            //需要比对的子阶料料号 比对成功的 只在工单生产BOM 中
            if (opbomObjs == null)//去掉检查工单BOM是否为空
            {
                return(returnValue);
            }

            //以工单标准BOM为基准,扣减当前工单的倒冲库存地(tblmo. EATTRIBUTE2)中相对应的库存信息
            //for (int n = 0; n < objMoBoms.Length; n++)//去掉工单BOM 20120321 Jarvis
            //{
            //求得opbom中对应的料品
            string TempMOBOMItemCode = minno.MItemCode;

            iflag         = false;
            iOPBOMItemQty = 0;
            for (int j = 0; j < opbomObjs.Length; j++)
            {
                if (TempMOBOMItemCode.ToUpper() == ((OPBOMDetail)opbomObjs[j]).OPBOMItemCode.ToUpper() ||
                    TempMOBOMItemCode.ToUpper() == ((OPBOMDetail)opbomObjs[j]).OPBOMSourceItemCode.ToUpper())
                {   //子阶料存在或有替代料可用
                    iflag = true;
                    //TempMOBOMItemCode = ((OPBOMDetail)opbomObjs[j]).OPBOMItemCode;//remove by Jarvis 20120316
                    //For 替代料,记录首选料号,Jarvis 20120316
                    //TempMOBOMItemCode = ((MOBOM)objMoBoms[n]).MOBOMItemCode;

                    iOPBOMItemQty  = (decimal)((OPBOMDetail)opbomObjs[j]).OPBOMItemQty;
                    iOPBOMItemQty *= sim.LotQty;

                    break;
                }
            }

            //比对成功:子阶料料号一致
            if (iflag)//子阶料不存在, 即只在工单标准bom中
            {
                //object[] objInfos = inventoryFacade.QueryStorageInfoByIDAndMCode(mo.EAttribute2, TempMOBOMItemCode.ToUpper());
                object[] objInfos = inventoryFacade.QueryStorageInfoByIDAndMCode(TempMOBOMItemCode.ToUpper());
                if (objInfos == null)
                {
                    throw new Exception("$CS_ItemCode[" + minno.MItemCode + "]" + "$CS_StorageQty_ERROR");
                }

                //获取物料的总库存数,Jarvis 20120316
                //decimal total = inventoryFacade.GetStorageQty(mo.EAttribute2, TempMOBOMItemCode.ToUpper());
                decimal total = inventoryFacade.GetStorageQty(TempMOBOMItemCode.ToUpper());

                if (total < iOPBOMItemQty)
                {
                    throw new Exception("$CS_ItemCode[" + minno.MItemCode + "]" + "$CS_StorageQty_ERROR");
                }

                #region //先判断备料批号中的数据量,不够扣减就退出
                decimal   temlotQty          = 0;
                object[]  objStorageLotInfo  = null;
                ArrayList StorageLotInfoList = new ArrayList();

                //获取子阶料的备料信息,Jarvis 20120316,按Seq排序
                object[] minnoss = materialFacade.QueryMINNO_New(moCode, routeCode, opCode, resCode, moBomVer, minno.MSourceItemCode);    //获取同一首选料的备料信息,Jarvis 20120321

                //获取备料信息中可扣减数,Jarvis 20120316
                foreach (MINNO temp in minnoss)
                {
                    //objStorageLotInfo = inventoryFacade.QueryStorageLot(temp.LotNO, mo.EAttribute2, temp.MItemCode);
                    objStorageLotInfo = inventoryFacade.QueryStorageLot(temp.LotNO, temp.MItemCode);
                    if (objStorageLotInfo != null)
                    {
                        foreach (StorageLotInfo lotInfo in objStorageLotInfo)
                        {
                            temlotQty += lotInfo.Lotqty;
                            if (lotInfo.Lotqty <= 0)    //如果批数量为0不记录该批
                            {
                                continue;
                            }
                            StorageLotInfoList.Add(lotInfo);
                        }
                    }
                }


                if (temlotQty < iOPBOMItemQty)
                {
                    throw new Exception("$CS_ItemCode[" + minno.MItemCode + "-" + MItemName + "]" + "$CS_DeductQty_ERROR");
                }
                #endregion

                #region 数量可以扣减

                foreach (StorageLotInfo lotInfo in StorageLotInfoList)
                {
                    if (iOPBOMItemQty > lotInfo.Lotqty)
                    {
                        iOPBOMItemQty = iOPBOMItemQty - lotInfo.Lotqty;
                        inventoryFacade.DeleteStorageLotInfo(lotInfo);
                        this.UpdateStorageQty(lotInfo, inventoryFacade, lotInfo.Lotqty);
                        lotNoList += ("," + lotInfo.Lotno + ",");

                        #region 记录过账信息
                        LotOnWipItem wipItem    = new LotOnWipItem();
                        MINNO        minnoTemp  = null;
                        object[]     minnoTemps = materialFacade.QueryMINNO(moCode, routeCode, opCode, resCode, moBomVer, lotInfo.Mcode, minno.MSourceItemCode, lotInfo.Lotno);
                        if (minnoTemps != null)
                        {
                            minnoTemp = (MINNO)minnoTemps[0];
                        }
                        wipItem.DateCode       = minnoTemp.DateCode;
                        wipItem.LOTNO          = minnoTemp.LotNO;
                        wipItem.MItemCode      = minnoTemp.MItemCode;
                        wipItem.VendorCode     = minnoTemp.VendorCode;
                        wipItem.VendorItemCode = minnoTemp.VendorItemCode;
                        wipItem.Version        = minnoTemp.Version;
                        wipItem.MSeq           = seqForDeductQty;
                        wipItem.MCardType      = minno.EAttribute1;

                        wipItem.Eattribute1         = simulation.EAttribute1;
                        wipItem.ItemCode            = simulation.ItemCode;
                        wipItem.ResCode             = simulation.ResCode;
                        wipItem.RouteCode           = simulation.RouteCode;
                        wipItem.LotCode             = simulation.LotCode;
                        wipItem.LotSeq              = simulation.LotSeq;
                        wipItem.SegmentCode         = simulationReport.SegmentCode;
                        wipItem.BeginShiftCode      = simulationReport.BeginShiftCode;
                        wipItem.ShiftTypeCode       = simulationReport.ShiftTypeCode;
                        wipItem.StepSequenceCode    = simulationReport.StepSequenceCode;
                        wipItem.BeginTimePeriodCode = simulationReport.BeginTimePeriodCode;
                        wipItem.MOCode              = simulation.MOCode;
                        wipItem.ModelCode           = simulation.ModelCode;
                        wipItem.OPCode              = simulation.OPCode;
                        wipItem.CollectStatus       = simulation.CollectStatus;
                        wipItem.BeginDate           = simulation.BeginDate;
                        wipItem.BeginTime           = simulation.BeginTime;
                        wipItem.MaintainUser        = simulation.MaintainUser;
                        wipItem.TransStatus         = TransactionStatus.TransactionStatus_YES;
                        wipItem.Qty = lotInfo.Lotqty;

                        wipItem.ActionType = (int)MaterialType.CollectMaterial;
                        wipItem.MOSeq      = simulation.MOSeq;

                        dataCollectFacade.AddLotOnWIPItem(wipItem);

                        LotSimulationReport simulationRpt = dataCollectFacade.GetLastLotSimulationReport(wipItem.LotCode);
                        if (simulationRpt != null)
                        {
                            dataCollectFacade.UpdateLotSimulationReport(simulationRpt);
                        }
                        seqForDeductQty++;
                        #endregion
                    }
                    else
                    {
                        lotInfo.Lotqty = lotInfo.Lotqty - iOPBOMItemQty;
                        inventoryFacade.UpdateStorageLotInfo(lotInfo);
                        this.UpdateStorageQty(lotInfo, inventoryFacade, iOPBOMItemQty);

                        #region 记录过账信息
                        LotOnWipItem wipItem    = new LotOnWipItem();
                        MINNO        minnoTemp  = null;
                        object[]     minnoTemps = materialFacade.QueryMINNO(moCode, routeCode, opCode, resCode, moBomVer, lotInfo.Mcode, minno.MSourceItemCode, lotInfo.Lotno);
                        if (minnoTemps != null)
                        {
                            minnoTemp = (MINNO)minnoTemps[0];
                        }
                        wipItem.DateCode       = minnoTemp.DateCode;
                        wipItem.LOTNO          = minnoTemp.LotNO;
                        wipItem.MItemCode      = minnoTemp.MItemCode;
                        wipItem.VendorCode     = minnoTemp.VendorCode;
                        wipItem.VendorItemCode = minnoTemp.VendorItemCode;
                        wipItem.Version        = minnoTemp.Version;
                        wipItem.MSeq           = seqForDeductQty;
                        wipItem.MCardType      = minno.EAttribute1;

                        wipItem.Eattribute1         = simulation.EAttribute1;
                        wipItem.ItemCode            = simulation.ItemCode;
                        wipItem.ResCode             = simulation.ResCode;
                        wipItem.RouteCode           = simulation.RouteCode;
                        wipItem.LotCode             = simulation.LotCode;
                        wipItem.LotSeq              = simulation.LotSeq;
                        wipItem.SegmentCode         = simulationReport.SegmentCode;
                        wipItem.BeginShiftCode      = simulationReport.BeginShiftCode;
                        wipItem.ShiftTypeCode       = simulationReport.ShiftTypeCode;
                        wipItem.StepSequenceCode    = simulationReport.StepSequenceCode;
                        wipItem.BeginTimePeriodCode = simulationReport.BeginTimePeriodCode;
                        wipItem.MOCode              = simulation.MOCode;
                        wipItem.ModelCode           = simulation.ModelCode;
                        wipItem.OPCode              = simulation.OPCode;
                        wipItem.CollectStatus       = simulation.CollectStatus;
                        wipItem.BeginDate           = simulation.BeginDate;
                        wipItem.BeginTime           = simulation.BeginTime;
                        wipItem.MaintainUser        = simulation.MaintainUser;
                        wipItem.TransStatus         = TransactionStatus.TransactionStatus_YES;
                        wipItem.Qty = iOPBOMItemQty;

                        wipItem.ActionType = (int)MaterialType.CollectMaterial;
                        wipItem.MOSeq      = simulation.MOSeq;

                        dataCollectFacade.AddLotOnWIPItem(wipItem);

                        LotSimulationReport simulationRpt = dataCollectFacade.GetLastLotSimulationReport(wipItem.LotCode);
                        if (simulationRpt != null)
                        {
                            dataCollectFacade.UpdateLotSimulationReport(simulationRpt);
                        }
                        seqForDeductQty++;
                        #endregion
                        iOPBOMItemQty = 0;
                        lotNoList    += ("," + lotInfo.Lotno + ",");
                        break;
                    }
                }

                #endregion
            }
            //}
            return(returnValue);
        }
コード例 #20
0
ファイル: ActionCollectMix.cs プロジェクト: windygu/.net-wms
        // Added by Icyer 2006/12/15
        // 检查产品
        private Messages CheckProduct(object act, string runningCard)
        {
            // 查询产品信息
            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;
            }

            try
            {
                //为改善性能
                ((SQLDomainDataProvider)domainProvider).PersistBroker.AutoCloseConnection = false;
                ((SQLDomainDataProvider)domainProvider).PersistBroker.OpenConnection();

                ActionOnLineHelper _helper = new ActionOnLineHelper(domainProvider);

                // Added by Icyer 2007/03/16	如果归属工单,则做归属工单检查,否则做序列号途程检查
                UserControl.Messages msgProduct = _helper.GetIDInfo(runningCard);
                ProductInfo          product    = (ProductInfo)msgProduct.GetData().Values[0];
                MO           moWillGo           = null;
                ActionGoToMO actionGoMO         = new ActionGoToMO(domainProvider);
                Messages     msgMo = actionGoMO.GetItemCodeFromGoMoRCard(((IDCTClient)act).ResourceCode, runningCard);
                if (msgMo.IsSuccess() == false)         // 如果有错误,表示需要归属工单,但是解析工单或查询工单发生错误
                {
                    return(msgMo);
                }
                if (msgMo.GetData() != null)    // 需要归属工单,做归属工单检查
                {
                    product.NowSimulation = new BenQGuru.eMES.Domain.DataCollect.Simulation();
                    UserControl.Message msgMoData = msgMo.GetData();
                    moWillGo = (MO)msgMoData.Values[0];
                    moCode   = moWillGo.MOCode;
                    ActionGoToMO          goToMO            = new ActionGoToMO(domainProvider);
                    GoToMOActionEventArgs MOActionEventArgs = new GoToMOActionEventArgs(
                        ActionType.DataCollectAction_GoMO,
                        runningCard,
                        ((IDCTClient)act).LoginedUser,
                        ((IDCTClient)act).ResourceCode,
                        product,
                        moWillGo.MOCode);
                    msgMo = goToMO.CheckIn(MOActionEventArgs);
                    if (!MOActionEventArgs.PassCheck)
                    {
                        msgMo = _helper.CheckID(new CKeypartsActionEventArgs(
                                                    ActionType.DataCollectAction_CollectINNO,
                                                    runningCard,
                                                    ((IDCTClient)act).LoginedUser,
                                                    ((IDCTClient)act).ResourceCode,
                                                    product, null, null));
                    }
                }
                else    // 不需要归属工单,检查序列号途程
                {
                    if (product == null || product.LastSimulation == null)
                    {
                        msgProduct.ClearMessages();
                        msgProduct.Add(new UserControl.Message(MessageType.Error, "$NoSimulation"));
                        return(msgProduct);
                    }
                    msgMo = _helper.CheckID(new CKeypartsActionEventArgs(
                                                ActionType.DataCollectAction_CollectINNO,
                                                runningCard,
                                                ((IDCTClient)act).LoginedUser,
                                                ((IDCTClient)act).ResourceCode,
                                                product, null, null));
                }
                if (msgMo.IsSuccess() == false)
                {
                    return(msgMo);
                }
                // Added end

                keypartsHT = new Hashtable();
                keypartsHT.Add("ProdcutInfo", product);
                keypartsHT.Add("MOWillGo", moWillGo);

                IDCTClient  client       = act as IDCTClient;
                OPBOMFacade opBOMFacade  = new OPBOMFacade(domainProvider);
                MOFacade    moFacade     = new MOFacade(domainProvider);
                object[]    objBomDetail = null;
                Messages    messages1    = new Messages();
                if (moWillGo == null)
                {
                    // 检查途程
                    messages1 = _helper.CheckID(
                        new CKeypartsActionEventArgs(
                            ActionType.DataCollectAction_CollectINNO,
                            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);

                    //Miodified by Scott
                    MO moNew = (MO)moFacade.GetMO(product.NowSimulation.MOCode);

                    objBomDetail = opBOMFacade.QueryOPBOMDetail(product.NowSimulation.ItemCode, string.Empty, string.Empty, moNew.BOMVersion,
                                                                product.NowSimulation.RouteCode, product.NowSimulation.OPCode, (int)MaterialType.CollectMaterial,
                                                                int.MinValue, int.MaxValue, moNew.OrganizationID, true);

                    if (objBomDetail == null)
                    {
                        messages1.Add(new UserControl.Message(MessageType.Error, "$CS_OPBOM_NotFound"));
                    }
                }
                else
                {
                    return(messages1);
                }

                //object mo = moFacade.GetMO( product.LastSimulation.MOCode );
                object mo = moWillGo;
                if (moWillGo == null)
                {
                    mo = moFacade.GetMO(product.LastSimulation.MOCode);
                }

                //OPBomKeyparts opBomKeyparts = new OPBomKeyparts(objBomDetail, Convert.ToInt32(((MO)mo).IDMergeRule), domainProvider);
                // 查询OPBOM
                if (objBomDetail == null)
                {
                    msgProduct.Add(new Message(MessageType.Error, "$CS_NOOPBomInfo $CS_Param_MOCode=" + product.NowSimulation.MOCode
                                               + " $CS_Param_RouteCode=" + product.NowSimulation.RouteCode
                                               + " $CS_Param_OPCode =" + product.NowSimulation.OPCode));
                    return(msgProduct);
                }
                else
                {
                    this.filterOpBomDetail(ref objBomDetail);

                    if (objBomDetail == null || objBomDetail.Length <= 0)
                    {
                        msgProduct.Add(new Message(MessageType.Error, "$CS_OPBOM_NotFound"));
                        return(msgProduct);
                    }

                    for (int i = 0; i < objBomDetail.Length; i++)
                    {
                        if (((OPBOMDetail)objBomDetail[i]).OPBOMItemControlType == "item_control_lot")
                        {
                            opBomDetailCount += 1;
                        }
                        else
                        {
                            opBomDetailCount += Convert.ToInt32(((OPBOMDetail)objBomDetail[i]).OPBOMItemQty);
                        }
                    }
                    for (int i = 0; i < objBomDetail.Length; i++)
                    {
                        if (((OPBOMDetail)objBomDetail[i]).OPBOMItemControlType == "item_control_lot")
                        {
                            opBomDetailList.Add(objBomDetail[i]);
                        }
                        else
                        {
                            int number = Convert.ToInt32(((OPBOMDetail)objBomDetail[i]).OPBOMItemQty);
                            for (int j = 0; j < number; j++)
                            {
                                opBomDetailList.Add(objBomDetail[i]);
                            }
                        }
                    }

                    if (((OPBOMDetail)objBomDetail[0]).OPBOMItemControlType == BOMItemControlType.ITEM_CONTROL_LOT)
                    {
                        msgProduct.Add(new UserControl.Message(MessageType.Normal, ">>$DCT_PLEASE_INPUT_Lot " + ((OPBOMDetail)objBomDetail[0]).OPBOMSourceItemCode));
                    }
                    else
                    {
                        msgProduct.Add(new UserControl.Message(MessageType.Normal, ">>$DCT_PLEASE_INPUT_Keyparts " + ((OPBOMDetail)objBomDetail[0]).OPBOMSourceItemCode));
                    }
                    // keypartsHT.Add("KeypartsInfo", opBomKeyparts);
                    keypartsHT.Add("Opbomdetail", objBomDetail);
                }
                return(msgProduct);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                ((SQLDomainDataProvider)domainProvider).PersistBroker.CloseConnection();
                ((SQLDomainDataProvider)domainProvider).PersistBroker.AutoCloseConnection = true;
            }
        }
コード例 #21
0
ファイル: FBurn.cs プロジェクト: windygu/.net-wms
        private void txtGOMO_TxtboxKeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
        {
            if (e.KeyChar == '\r')
            {
                // Added By Hi1/Venus.Feng on 20080822 for Hisense Version : Add loading item and item description
                if (this.txtGOMO.Value.Trim().Length == 0)
                {
                    ApplicationRun.GetInfoForm().AddEx("$CS_CMPleaseInputMO");
                    this.txtMO.Value               = "";
                    this.txtItem.Value             = "";
                    this.labelItemDescription.Text = "";
                    this.bRCardLetterULE.Value     = "";
                    this.bRCardLetterULE.Checked   = false;
                    this.txtGOMO.Checked           = true;
                    this.txtGOMO.TextFocus(false, true);
                    return;
                }

                string   moCode   = this.txtGOMO.Value.Trim().ToUpper();
                MOFacade mofacade = new MOFacade(this.DataProvider);

                object moObj = mofacade.GetMO(moCode);
                if (moObj == null)
                {
                    // mo not exist
                    ApplicationRun.GetInfoForm().AddEx("$CS_MO_NOT_EXIST");
                    this.txtMO.Value               = "";
                    this.txtItem.Value             = "";
                    this.labelItemDescription.Text = "";
                    this.bRCardLetterULE.Value     = "";
                    this.bRCardLetterULE.Checked   = false;
                    this.txtGOMO.Checked           = true;
                    this.txtGOMO.TextFocus(false, true);
                    return;
                }

                MO mo = moObj as MO;
                this.txtMO.Value = mo.MOCode;

                ItemFacade itemFacade = new ItemFacade(this.DataProvider);
                object     itemObject = itemFacade.GetItem(mo.ItemCode, mo.OrganizationID);
                if (itemObject == null)
                {
                    // Item not exist
                    ApplicationRun.GetInfoForm().AddEx("$Error_ItemCode_NotExist $Domain_ItemCode:" + mo.ItemCode);
                    this.txtMO.Value               = "";
                    this.txtItem.Value             = "";
                    this.labelItemDescription.Text = "";
                    this.bRCardLetterULE.Value     = "";
                    this.bRCardLetterULE.Checked   = false;
                    this.txtGOMO.Checked           = true;
                    this.txtGOMO.TextFocus(false, true);
                    return;
                }

                Item   item         = itemObject as Item;
                object item2sncheck = itemFacade.GetItem2SNCheck(item.ItemCode, ItemCheckType.ItemCheckType_SERIAL);
                if (item2sncheck == null)
                {
                    // Item2SNCheck not exist
                    ApplicationRun.GetInfoForm().AddEx("$Error_NoItemSNCheckInfo $Domain_ItemCode:" + mo.ItemCode);
                    this.txtMO.Value               = "";
                    this.txtItem.Value             = "";
                    this.labelItemDescription.Text = "";
                    this.bRCardLetterULE.Value     = "";
                    this.bRCardLetterULE.Checked   = false;
                    this.txtGOMO.Checked           = true;
                    this.txtGOMO.TextFocus(false, true);
                    return;
                }

                Item2SNCheck item2SNCheck = item2sncheck as Item2SNCheck;
                this.txtItem.Value             = item.ItemCode;
                this.labelItemDescription.Text = item.ItemDescription;

                SystemSettingFacade ssf = new SystemSettingFacade(this.DataProvider);

                object para = ssf.GetParameter("PRODUCTCODECONTROLSTATUS", "PRODUCTCODECONTROLSTATUS");

                if (item2SNCheck.SNPrefix.Length != 0)
                {
                    this.bRCardLetterULE.Checked = true;
                    this.bRCardLetterULE.Value   = item2SNCheck.SNPrefix;
                    if (para != null)
                    {
                        if (string.Compare(((Parameter)para).ParameterAlias, "1", true) == 0)
                        {
                            this.bRCardLetterULE.Enabled = false;
                        }
                        else
                        {
                            this.bRCardLetterULE.Enabled = true;
                        }
                    }
                    else
                    {
                        this.bRCardLetterULE.Enabled = true;
                    }
                }
                else
                {
                    this.bRCardLetterULE.Enabled = true;
                }

                if (item2SNCheck.SNLength != 0)
                {
                    this.bRCardLenULE.Checked = true;
                    this.bRCardLenULE.Value   = item2SNCheck.SNLength.ToString();
                    if (para != null)
                    {
                        if (string.Compare(((Parameter)para).ParameterAlias, "1", true) == 0)
                        {
                            this.bRCardLenULE.Enabled = false;
                        }
                        else
                        {
                            this.bRCardLenULE.Enabled = true;
                        }
                    }
                    else
                    {
                        this.bRCardLenULE.Enabled = true;
                    }
                }
                else
                {
                    this.bRCardLenULE.Enabled = true;
                }

                // end added
                this.txtGOMO.InnerTextBox.Enabled = false;
                txtRunningCard.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
ファイル: FDropMaterial.cs プロジェクト: windygu/.net-wms
        private Messages LoadData(string rcard)
        {
            Messages msg = new Messages();

            _DataTableLoadedPart.Clear();

            MOFacade       moFacade       = new MOFacade(this.DataProvider);
            OPBOMFacade    opBOMFacade    = new OPBOMFacade(this.DataProvider);
            MaterialFacade materialFacade = new MaterialFacade(this.DataProvider);
            ItemFacade     itemFacade     = new ItemFacade(this.DataProvider);

            //根据当前的序列号获取产品原始的序列号
            DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider);
            string            sourceRCard       = dataCollectFacade.GetSourceCard(rcard, string.Empty);

            //Get Product Info
            ProductInfo product = GetProduct(sourceRCard);

            if (product == null || product.LastSimulation == null)
            {
                msg.Add(new UserControl.Message(MessageType.Error, "$NoSimulation"));
                return(msg);
            }

            // Marked By HI1/Venus.Feng on 20081013 for Hisense Version : GOOD can do drop

            /*
             * if (product.LastSimulation.ProductStatus != ProductStatus.NG)
             * {
             *  msg.Add(new UserControl.Message(MessageType.Error, "$DropMaterial_Need_NG"));
             *  return msg;
             * }
             */
            // End Marked

            //Get loaded parts
            OnWIPItem[] onWIPItems = materialFacade.QueryLoadedPartByRCard(product.LastSimulation.RunningCard, string.Empty);

            if (onWIPItems == null)
            {
                msg.Add(new UserControl.Message(MessageType.Error, "$DropMaterial_Need_CINNO"));
                return(msg);
            }

            try
            {
                if (onWIPItems != null)
                {
                    for (int i = 0; i < onWIPItems.Length; i++)
                    {
                        MO  mo    = (MO)moFacade.GetMO(onWIPItems[i].MOCode);
                        int orgID = GlobalVariables.CurrentOrganizations.First().OrganizationID;
                        if (mo != null)
                        {
                            orgID = mo.OrganizationID;
                        }

                        Domain.MOModel.Material material = (Domain.MOModel.Material)itemFacade.GetMaterial(onWIPItems[i].MItemCode, orgID);
                        //changed by hiro 08/11/04
                        if (material != null)
                        {
                            _DataTableLoadedPart.Rows.Add(new object[] {
                                false,
                                false,
                                string.Empty,
                                i + 1,
                                onWIPItems[i].MItemCode,
                                onWIPItems[i].MOCode,
                                onWIPItems[i].MCARD,
                                material.MaterialDescription == null ? "" : material.MaterialDescription,
                                string.Empty,
                                onWIPItems[i].MCardType
                            });
                        }
                        //end by hiro
                    }
                }
            }
            catch (Exception E)
            {
                msg.Add(new UserControl.Message(E));
            }

            return(msg);
        }
コード例 #24
0
        protected void cmdImport_ServerClick(object sender, System.EventArgs e)
        {
            if (items == null)
            {
                items = GetAllItem();
                if (items == null)
                {
                    return;
                }
            }
            if (items == null || items.Length == 0)
            {
                return;
            }

            int    successNum = 0;
            int    failNum    = 0;
            string objValue   = string.Empty;

            DBDateTime now          = FormatHelper.GetNowDBDateTime(this.DataProvider);
            string     maintainUser = this.GetUserCode();

            for (int i = 0; i < items.Length; i++)
            {
                if (string.Compare(GetFieldValue(items[i], "ValidateResult"), "OK", true) == 0)
                {
                    string   moCode   = GetFieldValue(items[i], "MOCode");
                    MOFacade moFacade = new MOFacade(this.DataProvider);
                    object   obj      = moFacade.GetMO(moCode);
                    MO       objMo    = obj as MO;

                    /*---------------------------  CSV中数据(如果是空,则不更新对应的栏位) ---------------------------*/
                    objValue = GetFieldValue(items[i], "MOPlanQty1");
                    if (objValue != string.Empty)
                    {
                        objMo.MOPlanQty = decimal.Parse(objValue);  //MOPlanQty
                    }

                    objValue = GetFieldValue(items[i], "MOMemo1");
                    if (objValue != string.Empty)
                    {
                        objMo.MOMemo = objValue;  //MOMemo
                    }

                    objValue = GetFieldValue(items[i], "BOMVersion1");
                    if (objValue != string.Empty)
                    {
                        objMo.BOMVersion = objValue;  //BOMVersion
                    }

                    objValue = GetFieldValue(items[i], "MOPlanStartDate1");
                    if (objValue != string.Empty)
                    {
                        objMo.MOPlanStartDate = int.Parse(objValue); //MOPlanStartDate
                    }

                    objValue = GetFieldValue(items[i], "MOPlanStartTime");
                    if (objValue != string.Empty)
                    {
                        objMo.MOPlanStartTime = int.Parse(objValue);  //MOPlanStartTime
                    }

                    objValue = GetFieldValue(items[i], "MOPlanEndDate1");
                    if (objValue != string.Empty)
                    {
                        objMo.MOPlanEndDate = int.Parse(objValue);  //MOPlanEndDate
                    }

                    objValue = GetFieldValue(items[i], "MOPlanEndTime");
                    if (objValue != string.Empty)
                    {
                        objMo.MOPlanEndTime = int.Parse(objValue);  //MOPlanEndTime
                    }

                    objValue = GetFieldValue(items[i], "MOPlanLine");
                    if (objValue != string.Empty)
                    {
                        objMo.MOPlanLine = objValue;  //MOPlanLine
                    }

                    objValue = GetFieldValue(items[i], "CustomerCode");
                    if (objValue != string.Empty)
                    {
                        objMo.CustomerCode = objValue;   //CustomerCode
                    }

                    objValue = GetFieldValue(items[i], "CustomerName");
                    if (objValue != string.Empty)
                    {
                        objMo.CustomerName = objValue;  //CustomerName
                    }

                    objValue = GetFieldValue(items[i], "CustomerOrderNO1");
                    if (objValue != string.Empty)
                    {
                        objMo.CustomerOrderNO = objValue;  //CustomerOrderNO
                    }

                    objValue = GetFieldValue(items[i], "CustomerItemCode");
                    if (objValue != string.Empty)
                    {
                        objMo.CustomerItemCode = objValue;  //CustomerItemCode
                    }

                    objValue = GetFieldValue(items[i], "OrderNO");
                    if (objValue != string.Empty)
                    {
                        objMo.OrderNO = objValue;  //OrderNO
                    }

                    objValue = GetFieldValue(items[i], "OrderSequence1");
                    if (objValue != string.Empty)
                    {
                        objMo.OrderSequence = decimal.Parse(objValue);  //OrderSequence
                    }

                    objValue = GetFieldValue(items[i], "EAttribute1");
                    if (objValue != string.Empty)
                    {
                        objMo.EAttribute1 = objValue;  //EAttribute1
                    }

                    objValue = GetFieldValue(items[i], "EAttribute4");
                    if (objValue != string.Empty)
                    {
                        objMo.EAttribute4 = objValue;  //EAttribute4
                    }

                    objValue = GetFieldValue(items[i], "EAttribute5");
                    if (objValue != string.Empty)
                    {
                        objMo.EAttribute5 = objValue;  //EAttribute5
                    }

                    objValue = GetFieldValue(items[i], "EAttribute6");
                    if (objValue != string.Empty)
                    {
                        objMo.EAttribute6 = objValue;  //EAttribute6
                    }

                    objMo.MaintainDate = now.DBDate;
                    objMo.MaintainTime = now.DBTime;
                    objMo.MaintainUser = maintainUser;

                    moFacade.UpdateMO(objMo, false);

                    successNum++;
                }
                else
                {
                    failNum++;
                }
            }

            //string strMessage = languageComponent1.GetString("导入完成: 成功" + successNum + "笔, 失败" + failNum + "笔");
            string strMessage = "导入完成: 成功" + successNum + "笔, 失败" + failNum + "笔";
            string alertInfo  =
                string.Format("<script language=javascript>alert('{0}');</script>", strMessage);

            if (!this.IsClientScriptBlockRegistered("ImportAlert"))
            {
                this.RegisterClientScriptBlock("ImportAlert", alertInfo);
            }
            items = null;
            this.cmdEnter.Disabled = true;
        }
コード例 #25
0
        private void ValidateItems()
        {
            if (items == null || items.Length == 0)
            {
                return;
            }

            CultureInfo culture = new System.Globalization.CultureInfo("en-US");

            for (int i = 0; i < items.Length; i++)
            {
                string   result   = string.Empty;
                MOFacade moFacade = new MOFacade(this.DataProvider);
                object   item     = items[i];

                /*-----MOCode  Check -----*/
                string moCode = GetFieldValue(items[i], "MOCode");
                object obj    = moFacade.GetMO(moCode);
                if (obj == null)
                {
                    result = "工单不存在";
                }

                if (obj != null)
                {
                    MO objMo = obj as MO;
                    if (string.Compare(objMo.MOStatus, MOManufactureStatus.MOSTATUS_CLOSE, true) == 0)
                    {
                        result = string.Format("{0};工单状态已经关闭", result);
                    }

                    /*-----------MOPLANQTY Check -----------*/
                    string moPlanQty = GetFieldValue(items[i], "MOPlanQty1");
                    if (moPlanQty != string.Empty)
                    {
                        try
                        {
                            decimal numQty = decimal.Parse(moPlanQty);
                            if (numQty < objMo.MOInputQty)
                            {
                                result = string.Format("{0};计划数量不能小于投入数量", result);
                            }
                        }
                        catch
                        {
                            result = string.Format("{0};计划数量必须为数字", result);
                        }
                    }
                }

                /*-----------MOBOM Check  -------*/
                string moBOM = GetFieldValue(items[i], "BOMVersion1");
                if (moBOM != string.Empty)
                {
                    try
                    {
                        int numBOM = int.Parse(moBOM);
                    }
                    catch
                    {
                        result = string.Format("{0};工单BOM必须是数字", result);
                    }
                }

                /*----------- MOPLANSTARTDATE Check ------------*/
                string moPlanStartDate = GetFieldValue(items[i], "MOPlanStartDate1");
                if (moPlanStartDate != string.Empty)
                {
                    try
                    {
                        DateTime startDate = DateTime.ParseExact(moPlanStartDate, "yyyyMMdd", culture);
                    }
                    catch
                    {
                        result = string.Format("{0};计划开工日期格式不正确(YYYYMMDD)", result);
                    }
                }


                /*----------- MOPLANSTARTTIME Check ------------*/
                string moPlanStartTime = GetFieldValue(items[i], "MOPlanStartTime");
                if (moPlanStartTime != string.Empty)
                {
                    try
                    {
                        DateTime startTime = DateTime.ParseExact(moPlanStartTime.PadLeft(6, '0'), "HHmmss", culture);
                    }
                    catch
                    {
                        result = string.Format("{0};计划开工时间格式不正确(HHMMSS)", result);
                    }
                }

                /*----------- MOPLANENDDATE Check ------------*/
                string moPlanEndDate = GetFieldValue(items[i], "MOPlanEndDate1");
                if (moPlanEndDate != string.Empty)
                {
                    try
                    {
                        DateTime endDate = DateTime.ParseExact(moPlanEndDate, "yyyyMMdd", culture);
                    }
                    catch
                    {
                        result = string.Format("{0};计划完工日期格式不正确(YYYYMMDD)", result);
                    }
                }


                /*----------- MOPLANENDTIME Check ------------*/
                string moPlanEndTime = GetFieldValue(items[i], "MOPlanEndTime");
                if (moPlanEndTime != string.Empty)
                {
                    try
                    {
                        DateTime endTime = DateTime.ParseExact(moPlanEndTime.PadLeft(6, '0'), "HHmmss", culture);
                    }
                    catch
                    {
                        result = string.Format("{0};计划完工时间格式不正确(HHMMSS)", result);
                    }
                }

                /*-----------ORDERSEQ Check  -------*/
                string orderSeq = GetFieldValue(items[i], "OrderSequence1");
                if (orderSeq != string.Empty)
                {
                    try
                    {
                        decimal numOrderSeq = decimal.Parse(orderSeq);
                    }
                    catch
                    {
                        result = string.Format("{0};订单序号必须是数字", result);
                    }
                }


                if (result != string.Empty && result != null)
                {
                    int j = result.IndexOf(";");
                    if (j == 0)
                    {
                        result = result.Substring(1, result.Length - 1);
                    }
                }

                if (result == string.Empty)
                {
                    result = "OK";
                }

                SetFieldValue(item, "ValidateResult", result);
            }
        }
コード例 #26
0
ファイル: FRMABillMP.aspx.cs プロジェクト: windygu/.net-wms
        private BenQGuru.eMES.Domain.TS.TS GetTS(RMADetial rmadetial)
        {
            BenQGuru.eMES.Domain.TS.TS itemTs = null;

            itemTs = new BenQGuru.eMES.Domain.TS.TS();
            if (_DataCollectFacade == null)
            {
                _DataCollectFacade = new DataCollectFacade(this.DataProvider);
            }

            itemTs.MOCode = "";

            itemTs.RMABillCode         = rmadetial.Rmabillcode;
            itemTs.RunningCard         = rmadetial.Rcard;
            itemTs.RunningCardSequence = 0;
            itemTs.TSId                  = FormatHelper.GetUniqueID("", itemTs.RunningCard, itemTs.RunningCardSequence.ToString());
            itemTs.TranslateCard         = rmadetial.Rcard;
            itemTs.TranslateCardSequence = 0;
            itemTs.CardType              = CardType.CardType_Product;
            itemTs.TSStatus              = TSStatus.TSStatus_New;
            itemTs.SourceCardSequence    = 0;
            itemTs.MaintainUser          = this.GetUserCode();
            itemTs.MaintainDate          = FormatHelper.TODateInt(DateTime.Now);
            itemTs.MaintainTime          = FormatHelper.TOTimeInt(DateTime.Now);
            itemTs.TSDate                = 0;
            itemTs.TSTime                = 0;
            itemTs.FromInputType         = TSFacade.TSSource_RMA;
            itemTs.FromUser              = itemTs.MaintainUser;
            itemTs.FromDate              = itemTs.MaintainDate;
            itemTs.FormTime              = itemTs.MaintainTime;
            itemTs.FromOPCode            = " ";
            itemTs.FromResourceCode      = " ";
            itemTs.FromRouteCode         = " ";
            itemTs.FromSegmentCode       = " ";
            itemTs.FromShiftCode         = " ";
            itemTs.FromShiftDay          = FormatHelper.TODateInt(DateTime.Now);
            itemTs.FromShiftTypeCode     = " ";
            itemTs.FromStepSequenceCode  = " ";
            itemTs.FromTimePeriodCode    = " ";
            itemTs.FromSegmentCode       = " ";
            itemTs.TSTimes               = _TSFacade.GetMaxTSTimes(rmadetial.Rcard) + 1;
            itemTs.ItemCode              = rmadetial.Itemcode;
            itemTs.ModelCode             = rmadetial.Modelcode;
            itemTs.TransactionStatus     = " ";


            if (_ReportFacade == null)
            {
                _ReportFacade = new BenQGuru.eMES.Report.ReportFacade(this.DataProvider);
            }
            object obmTimeDimension = _ReportFacade.GetTimeDimension(itemTs.FromShiftDay);

            if (obmTimeDimension != null)
            {
                itemTs.Week  = (obmTimeDimension as Domain.Report.TimeDimension).Week;
                itemTs.Month = (obmTimeDimension as Domain.Report.TimeDimension).Month;
            }
            else
            {
                itemTs.Week  = 0;
                itemTs.Month = 0;
            }

            if (_MOFacade == null)
            {
                _MOFacade = new MOFacade(this.DataProvider);
            }
            object objmo = _MOFacade.GetMO(rmadetial.Remocode);

            if (objmo == null)
            {
                itemTs.MOSeq = 0;
            }
            else
            {
                itemTs.MOSeq = (objmo as MO).MOSeq;
            }
            return(itemTs);
        }
コード例 #27
0
ファイル: ActionTSConfirm.cs プロジェクト: windygu/.net-wms
        /// <summary>
        /// ** 功能描述:	确认流程卡序列号的维修
        /// ** 作 者:		crystal chu
        /// ** 日 期:		2005/07/26/
        /// ** 修 改:
        /// ** 日 期:
        /// ** nunit
        /// </summary>
        /// <param name="actionEventArgs"> </param>
        /// <returns></returns>
        public Messages Execute(ActionEventArgs actionEventArgs)
        {
            Messages         messages         = new Messages();
            DataCollectDebug dataCollectDebug = new DataCollectDebug(this.GetType().ToString() + "Collect");

            dataCollectDebug.WhenFunctionIn(messages);
            try
            {
                ActionOnLineHelper dataCollect = new ActionOnLineHelper(this.DataProvider);
                //检查res在不在OPTS中
                messages.AddMessages(dataCollect.CheckResourceInOperationTS(actionEventArgs));

                //Laws Lu,2006/11/13 uniform system collect date
                DBDateTime dbDateTime;
                //Laws Lu,2006/11/13 uniform system collect date
                if (actionEventArgs.ProductInfo != null && actionEventArgs.ProductInfo.WorkDateTime != null)
                {
                    dbDateTime = actionEventArgs.ProductInfo.WorkDateTime;
                }
                else
                {
                    dbDateTime = FormatHelper.GetNowDBDateTime(DataProvider);
                    if (actionEventArgs.ProductInfo != null)
                    {
                        actionEventArgs.ProductInfo.WorkDateTime = dbDateTime;
                    }
                }

                DateTime dtNow = FormatHelper.ToDateTime(dbDateTime.DBDate, dbDateTime.DBTime);
                if (messages.IsSuccess())
                {
                    //Laws Lu,2005/09/16,修改	整理逻辑
                    TSFacade tsFacade = new TSFacade(this.DataProvider);
                    //					if( !tsFacade.IsCardInTS(actionEventArgs.RunningCard))
                    //					{
                    //						messages.Add(new Message(MessageType.Error,"$CSError_Card_Not_In_TS"));
                    //					}
                    //Laws Lu,2005/10/16,在订单1中的已经拆解的产品序列号,
                    //现在系统中可以实现将该产品序列号重新归属到另外一个订单2,
                    //但是该产品序列号在工单2采集完不良后,
                    //作送修作业时,系统提出报错信息:
                    //该产品状态为“拆解”状态。导致该产品序列号无法进行维修。
                    object obj = tsFacade.GetCardLastTSRecordInNewStatus(actionEventArgs.RunningCard);

                    if (obj == null)
                    {
                        //Laws Lu,2006,07/05 Support RMA Repair
                        //						if(actionEventArgs.IsRMA)
                        //						{
                        MOFacade moFAC  = new MOFacade(DataProvider);
                        object   objRMA = moFAC.GetRepairRMARCARDByRcard(actionEventArgs.RunningCard);
                        if (objRMA != null)
                        {
                            #region 新增维修信息

                            RMARCARD     rma = objRMA as RMARCARD;
                            Domain.TS.TS tS  = tsFacade.CreateNewTS();
                            tS.TSId = FormatHelper.GetUniqueID((rma.REWORKMOCODE == String.Empty?rma.RMABILLNO:rma.REWORKMOCODE)
                                                               , actionEventArgs.RunningCard, ActionOnLineHelper.StartSeq.ToString());

                            tS.CardType      = CardType.CardType_Product;;
                            tS.FormTime      = rma.MTIME;
                            tS.FromDate      = rma.MDATE;
                            tS.FromInputType = TSFacade.TSSource_RMA;
                            tS.FromUser      = rma.MUSER;
                            tS.FromMemo      = rma.EATTRIBUTE1;
                            //Laws Lu,2006/07/05 add support RMA
                            tS.RMABillCode = rma.RMABILLNO;
                            //工作时间和工业布局信息

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

                            BaseSetting.ShiftModelFacade  shiftModel = new BaseSetting.ShiftModelFacade(this.DataProvider);
                            Domain.BaseSetting.TimePeriod period     = (Domain.BaseSetting.TimePeriod)shiftModel.GetTimePeriod(res.ShiftTypeCode, Web.Helper.FormatHelper.TOTimeInt(dtNow));
                            if (period == null)
                            {
                                throw new Exception("$OutOfPerid");
                            }

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

                            tS.FromOPCode           = "TS";
                            tS.FromResourceCode     = actionEventArgs.ResourceCode;
                            tS.FromRouteCode        = String.Empty;
                            tS.FromSegmentCode      = res.SegmentCode;
                            tS.FromShiftCode        = period.ShiftCode;                     /*Laws Lu,2006/03/11 修正班次填写有误*/
                            tS.FromShiftTypeCode    = period.ShiftTypeCode;
                            tS.FromStepSequenceCode = res.StepSequenceCode;
                            tS.FromTimePeriodCode   = period.TimePeriodCode;

                            tS.ItemCode     = rma.ITEMCODE;
                            tS.MaintainDate = FormatHelper.TODateInt(dtNow);
                            tS.MaintainTime = FormatHelper.TOTimeInt(dtNow);
                            tS.MaintainUser = actionEventArgs.MaintainUser;

                            tS.MOCode              = (rma.REWORKMOCODE == String.Empty?rma.RMABILLNO:rma.REWORKMOCODE);
                            tS.ModelCode           = rma.MODELCODE;
                            tS.RunningCard         = actionEventArgs.RunningCard;
                            tS.RunningCardSequence = ActionOnLineHelper.StartSeq;
                            tS.SourceCard          = actionEventArgs.RunningCard;
                            tS.SourceCardSequence  = ActionOnLineHelper.StartSeq;
                            tS.TransactionStatus   = TSFacade.TransactionStatus_None;

                            tS.TranslateCard         = actionEventArgs.RunningCard;
                            tS.TranslateCardSequence = ActionOnLineHelper.StartSeq;
                            //tS.TSStatus = TSStatus.TSStatus_New;

                            tS.Week    = (new ReportHelper(DataProvider)).WeekOfYear(tS.FromShiftDay.ToString());
                            tS.Month   = int.Parse(tS.FromShiftDay.ToString().Substring(4, 2));
                            tS.TSTimes = ActionOnLineHelper.StartNGTimes;

                            tS.ConfirmUser         = actionEventArgs.UserCode;
                            tS.ConfirmDate         = FormatHelper.TODateInt(dtNow);
                            tS.ConfirmTime         = FormatHelper.TOTimeInt(dtNow);
                            tS.ConfirmOPCode       = "TS";
                            tS.ConfirmResourceCode = actionEventArgs.ResourceCode;
                            tS.TSStatus            = TSStatus.TSStatus_Confirm;
                            // Added by Icyer 2007/07/03
                            MO mo = (MO)moFAC.GetMO(tS.MOCode);
                            if (mo != null)
                            {
                                tS.MOSeq = mo.MOSeq;
                            }
                            // Added end

                            tsFacade.AddTS(tS);
                            //Laws Lu,2006/07/07 add ,Success release than delete rma
                            moFAC.DeleteRMARCARD(rma);
                            #endregion
                        }
                        else
                        {
                            messages.Add(new Message(MessageType.Error, "$CSError_Card_Not_In_TS_OR_Status_Error"));
                        }
                        //						}
                        //						else
                        //						{
                        //							messages.Add(new Message(MessageType.Error,"$CSError_Card_Not_In_TS_OR_Status_Error"));
                        //						}
                    }
                    else
                    {
                        BenQGuru.eMES.Domain.TS.TS ts = (BenQGuru.eMES.Domain.TS.TS)obj;

                        if (ts.TSStatus == TSStatus.TSStatus_New)
                        {
                            ts.ConfirmUser         = actionEventArgs.UserCode;
                            ts.ConfirmDate         = FormatHelper.TODateInt(dtNow);
                            ts.ConfirmTime         = FormatHelper.TOTimeInt(dtNow);
                            ts.ConfirmOPCode       = "TS";
                            ts.ConfirmResourceCode = actionEventArgs.ResourceCode;
                            ts.TSStatus            = TSStatus.TSStatus_Confirm;

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

                            tsFacade.UpdateTSConfirmStatus(ts);
                        }
                        else
                        {
                            messages.Add(new Message(MessageType.Error, "$CSError_Card_TSStatus_Error $Current_Status $" + ts.TSStatus));
                        }
                    }
                }
            }
            catch (Exception e)
            {
                messages.Add(new Message(e));
            }
            dataCollectDebug.WhenFunctionOut(messages);
            return(messages);
        }
コード例 #28
0
        // Added by Icyer 2006/12/15
        // 检查产品
        private Messages CheckProduct(object act, string runningCard)
        {
            // 查询产品信息
            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);

            /*	Removed by Icyer 2007/03/16
             * UserControl.Messages msgProduct =  _helper.GetIDInfo( runningCard ) ;
             * ProductInfo product= (ProductInfo)msgProduct.GetData().Values[0];
             * if (product == null || product.LastSimulation == null)
             * {
             *      msgProduct.ClearMessages();
             *      msgProduct.Add(new UserControl.Message(MessageType.Error, "$NoSimulation"));
             *      return msgProduct;
             * }
             */

            // Added by Icyer 2007/03/16	如果归属工单,则做归属工单检查,否则做序列号途程检查
            UserControl.Messages msgProduct = _helper.GetIDInfo(runningCard);
            ProductInfo          product    = (ProductInfo)msgProduct.GetData().Values[0];
            MO           moWillGo           = null;
            ActionGoToMO actionGoMO         = new ActionGoToMO(domainProvider);
            Messages     msgMo = actionGoMO.GetItemCodeFromGoMoRCard(((IDCTClient)act).ResourceCode, runningCard);

            if (msgMo.IsSuccess() == false)                     // 如果有错误,表示需要归属工单,但是解析工单或查询工单发生错误
            {
                return(msgMo);
            }
            if (msgMo.GetData() != null)                // 需要归属工单,做归属工单检查
            {
                product.NowSimulation = new BenQGuru.eMES.Domain.DataCollect.Simulation();
                UserControl.Message msgMoData = msgMo.GetData();
                moWillGo = (MO)msgMoData.Values[0];
                ActionGoToMO          goToMO            = new ActionGoToMO(domainProvider);
                GoToMOActionEventArgs MOActionEventArgs = new GoToMOActionEventArgs(
                    ActionType.DataCollectAction_GoMO,
                    runningCard,
                    ((IDCTClient)act).LoginedUser,
                    ((IDCTClient)act).ResourceCode,
                    product,
                    moWillGo.MOCode);
                msgMo = goToMO.CheckIn(MOActionEventArgs);
                if (!MOActionEventArgs.PassCheck)
                {
                    msgMo = _helper.CheckID(new CKeypartsActionEventArgs(
                                                ActionType.DataCollectAction_CollectKeyParts,
                                                runningCard,
                                                ((IDCTClient)act).LoginedUser,
                                                ((IDCTClient)act).ResourceCode,
                                                product, null, null));
                }
            }
            else                // 不需要归属工单,检查序列号途程
            {
                if (product == null || product.LastSimulation == null)
                {
                    msgProduct.ClearMessages();
                    msgProduct.Add(new UserControl.Message(MessageType.Error, "$NoSimulation"));
                    return(msgProduct);
                }
                msgMo = _helper.CheckID(new CKeypartsActionEventArgs(
                                            ActionType.DataCollectAction_CollectKeyParts,
                                            runningCard,
                                            ((IDCTClient)act).LoginedUser,
                                            ((IDCTClient)act).ResourceCode,
                                            product, null, null));
            }
            if (msgMo.IsSuccess() == false)
            {
                return(msgMo);
            }
            // Added end

            keypartsHT = new Hashtable();
            keypartsHT.Add("ProdcutInfo", msgProduct);
            keypartsHT.Add("MOWillGo", moWillGo);

            IDCTClient  client      = act as IDCTClient;
            OPBOMFacade opBOMFacade = new OPBOMFacade(domainProvider);

            object[] objBomDetail = null;
            Messages messages1    = new Messages();

            if (moWillGo == null)
            {
                // 检查途程
                messages1 = _helper.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
            {
                return(messages1);
            }

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

            if (moWillGo == null)
            {
                mo = moFacade.GetMO(product.LastSimulation.MOCode);
            }

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

            if (opBomKeyparts.Count == 0)
            {
                msgProduct.Add(new Message(MessageType.Error, "$CS_NOOPBomInfo $CS_Param_MOCode=" + product.NowSimulation.MOCode
                                           + " $CS_Param_RouteCode=" + product.NowSimulation.RouteCode
                                           + " $CS_Param_OPCode =" + product.NowSimulation.OPCode));
                return(msgProduct);
            }
            else
            {
                this.OutMesssage = new UserControl.Message(MessageType.Normal, "$DCT_PLEASE_INPUT_Keyparts " + (opBomKeyparts.GetbomKeypartCount() + 1).ToString() + "/" + opBomKeyparts.Count.ToString());
                keypartsHT.Add("KeypartsInfo", opBomKeyparts);
            }
            return(msgProduct);
        }
コード例 #29
0
        public ServiceResult Run(RunMethod runMethod)
        {
            /*--------- Get WebService URL and UserName and Password ---------*/
            SAPWebServiceEntity webServiceEntity = System.Configuration.ConfigurationManager.GetSection("MOHeaderTransferConfig") as SAPWebServiceEntity;

            if (webServiceEntity == null)
            {
                return(new ServiceResult(false, "没有维护MOHeaderTransferConfig对应的Service地址", this.m_Argument.TransactionCode));
            }

            #region Begin for Prepare input Paremente
            // Prepare input parameter
            DT_MES_PO_REQ moParameter = new DT_MES_PO_REQ();
            moParameter.Trsaction_Code = this.m_Argument.TransactionCode;
            if (this.m_Argument.MOCode.Trim().Length == 0)
            {
                moParameter.MaintainDate_B = this.m_Argument.MaintainDate_B.Date.ToString("yyyyMMdd", new System.Globalization.CultureInfo("en-US"));
                moParameter.MaintainDate_E = this.m_Argument.MaintainDate_E.Date.ToString("yyyyMMdd", new System.Globalization.CultureInfo("en-US"));
                moParameter.OrgID          = this.m_Argument.OrgID.ToString();
                moParameter.Mocode         = "";
            }
            else
            {
                moParameter.MaintainDate_B = "";
                moParameter.MaintainDate_E = "";
                moParameter.OrgID          = "";
                moParameter.Mocode         = this.m_Argument.MOCode.ToUpper().Trim();
            }
            #endregion

            // Serialize the Input Parameter
            string xmlFilePath = SerializeUtil.SerializeFile(this.m_Argument.TransactionCode + "_Request.xml",
                                                             typeof(DT_MES_PO_REQ), moParameter);

            #region For Request Log
            DBDateTime         requestDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider);
            SAPDataTransferLog log             = new SAPDataTransferLog();
            TransferFacade     transferFacade  = new TransferFacade(this.DataProvider);
            log.JobID               = TransferFacade.MOHeaderTransferJobID;
            log.TransactionCode     = this.m_Argument.TransactionCode;
            log.TransactionSequence = 1;
            log.RequestDate         = requestDateTime.DBDate;
            log.RequestTime         = requestDateTime.DBTime;
            log.RequestContent      = xmlFilePath;
            log.OrganizationID      = this.m_Argument.OrgID;
            log.SendRecordCount     = 1;
            transferFacade.AddSAPDataTransferLog(log);
            #endregion

            #region Begin for Calling WebService
            // Call Web Service through MOServiceClientProxy
            DT_MES_PO_RESP returnValue;
            try
            {
                MOServiceClientProxy clientProxy = new MOServiceClientProxy();
                clientProxy.RequestEncoding = Encoding.UTF8;
                clientProxy.Timeout         = InternalVariables.MS_TimeOut * 1000;
                clientProxy.Url             = webServiceEntity.Url;
                clientProxy.PreAuthenticate = true;
                System.Uri uri = new Uri(clientProxy.Url);
                clientProxy.Credentials = new NetworkCredential(webServiceEntity.UserName, webServiceEntity.Password).GetCredential(uri, "");
                returnValue             = clientProxy.MI_MES_PO_REQ(moParameter);
                clientProxy.Dispose();
                clientProxy = null;

                //Serialize the output Parameter
                xmlFilePath = SerializeUtil.SerializeFile(this.m_Argument.TransactionCode + "_Response.xml",
                                                          typeof(DT_MES_PO_RESP), returnValue);

                // Update Log
                DBDateTime responseDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider);
                log.ResponseDate    = responseDateTime.DBDate;
                log.ResponseTime    = responseDateTime.DBTime;
                log.ResponseContent = xmlFilePath;
                transferFacade.UpdateSAPDataTransferLog(log);
            }
            catch (Exception e)
            {
                log.Result       = "Fail";
                log.ErrorMessage = e.Message;
                transferFacade.UpdateSAPDataTransferLog(log);
                return(new ServiceResult(false, e.Message, log.TransactionCode));
            }
            #endregion

            // Generate MO Object and Save it
            if (string.Compare(returnValue.FLAG, "Y", true) == 0)
            {
                int    moCount = returnValue.POLIST.Length;
                string moList  = "";

                ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.AutoCloseConnection = false;
                ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.OpenConnection();
                this.DataProvider.BeginTransaction();

                try
                {
                    MOFacade             moFacade   = new MOFacade(this.DataProvider);
                    ItemFacade           itemFacade = new ItemFacade(this.DataProvider);
                    MO                   mo;
                    DT_MES_PO_RESPPOLIST moObject;
                    DBDateTime           currentDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider);

                    for (int i = 0; i < moCount; i++)
                    {
                        moObject = returnValue.POLIST[i];
                        moList  += moObject.MOCODE + "|";

                        if (moFacade.GetMO(moObject.MOCODE) != null)
                        {
                            continue;
                        }

                        mo = moFacade.CreateNewMO();

                        /*---------------------  Web Service 节点数据 ---------------------*/
                        mo.MOCode          = moObject.MOCODE;
                        mo.MOType          = moObject.MoType;
                        mo.MOPlanQty       = decimal.Parse(moObject.MOPlanQty);
                        mo.MOPlanStartDate = int.Parse(moObject.MOPlanstart);
                        mo.MOPlanEndDate   = int.Parse(moObject.MOPlanEndDate);
                        mo.ItemCode        = InternalVariables.MatchItemCode(moObject.ItemCode);
                        mo.OrganizationID  = int.Parse(moObject.ORGID);
                        mo.BOMVersion      = moObject.MOBOM;
                        mo.MOOP            = moObject.MOOP;
                        mo.EAttribute2     = moObject.StorNo;

                        /*-------------- 固定数据 ----------*/
                        object material = itemFacade.GetMaterial(mo.ItemCode, int.Parse(moObject.ORGID));
                        if (material == null)
                        {
                            mo.MaterialDescription = "";
                        }
                        else
                        {
                            mo.MaterialDescription = (material as BenQGuru.eMES.Domain.MOModel.Material).MaterialDescription;
                        }
                        mo.MOMemo            = "";
                        mo.MODescription     = "";
                        mo.MOInputQty        = 0;
                        mo.MOScrapQty        = 0;
                        mo.MOActualQty       = 0;
                        mo.MOActualStartDate = 0;
                        mo.MOActualEndDate   = 0;
                        mo.Factory           = mo.OrganizationID.ToString();
                        mo.OrderSequence     = 0;
                        mo.MOUser            = "******";
                        mo.MODownloadDate    = currentDateTime.DBDate;
                        mo.MOStatus          = MOManufactureStatus.MOSTATUS_INITIAL;
                        mo.MOVersion         = "1.0";
                        mo.IsControlInput    = "1";
                        mo.IsBOMPass         = "******";
                        mo.IDMergeRule       = 1;
                        mo.MaintainUser      = "******";
                        mo.MOReleaseDate     = 0;
                        mo.MOReleaseTime     = 0;
                        mo.MOPendingCause    = " ";
                        mo.MOImportDate      = currentDateTime.DBDate;
                        mo.MOImportTime      = currentDateTime.DBTime;
                        mo.CustomerCode      = "";
                        mo.CustomerName      = "";
                        mo.CustomerOrderNO   = "";
                        mo.CustomerItemCode  = "";
                        mo.OrderNO           = "";
                        mo.EAttribute1       = "";
                        mo.MOOffQty          = 0;
                        mo.IsCompareSoft     = 0;
                        mo.RMABillCode       = "";
                        mo.MOSeq             = 0;
                        mo.MOPCBAVersion     = "";
                        mo.MOBIOSVersion     = "";

                        moFacade.AddMO(mo);
                    }

                    // Call MOBOM Logic in one transaction
                    if (moList.Trim().Length > 0)
                    {
                        moList = moList.Substring(0, moList.Length - 1);
                        int                   requestCount  = this.GetRequestCount(moList);
                        MOBOMTransfer         moBOMTransfer = new MOBOMTransfer(this.DataProvider);
                        MOBOMTransferArgument moBOMArgument = new MOBOMTransferArgument(this.DataProvider);
                        ServiceResult         sr;
                        for (int j = 0; j < requestCount; j++)
                        {
                            moBOMArgument.GenerateNewTransactionCode(this.DataProvider);
                            moBOMArgument.MOCodeList = this.GetMOListPerRequest(moList, j);
                            moBOMTransfer.SetArguments(moBOMArgument);
                            sr = moBOMTransfer.Run(RunMethod.Auto);
                            if (sr.Result == false)
                            {
                                throw new Exception(sr.Message);
                            }
                        }
                    }

                    this.DataProvider.CommitTransaction();
                    log.Result       = "OK";
                    log.ErrorMessage = "";
                }
                catch (Exception ex)
                {
                    this.DataProvider.RollbackTransaction();
                    // Log
                    log.Result       = "Fail";
                    log.ErrorMessage = ex.Message;
                }
                finally
                {
                    ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.CloseConnection();
                    ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.AutoCloseConnection = true;
                }

                log.ReceivedRecordCount = moCount;
                DBDateTime finishedDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider);
                log.FinishedDate = finishedDateTime.DBDate;
                log.FinishedTime = finishedDateTime.DBTime;
                transferFacade.UpdateSAPDataTransferLog(log);

                if (log.Result == "OK")
                {
                    return(new ServiceResult(true, "", log.TransactionCode));
                }
                else
                {
                    return(new ServiceResult(false, log.ErrorMessage, log.TransactionCode));
                }
            }
            else //  status!="OK"
            {
                log.Result              = "Fail";
                log.ErrorMessage        = returnValue.Message;
                log.ReceivedRecordCount = 0;
                transferFacade.UpdateSAPDataTransferLog(log);
                return(new ServiceResult(false, log.ErrorMessage, log.TransactionCode));
            }
        }
コード例 #30
0
        private void txtMoCode_KeyDown(object sender, KeyEventArgs e)
        {
            Messages msg = new Messages();

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

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

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

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