Esempio n. 1
0
        protected override object GetEditObject()
        {
            if (_facade == null)
            {
                _facade = new ItemFacade(base.DataProvider);
            }
            if (this.ValidateInput())
            {
                Item2SPCTest spc = this._facade.CreateNewItem2SPCTest();

                spc.OID          = this.txtOID.Text.Trim() != String.Empty?this.txtOID.Text:Guid.NewGuid().ToString();
                spc.ItemCode     = this._itemCode;
                spc.TestName     = this.txtTestNameEdit.Text;
                spc.Seq          = int.Parse(this.txtSeqEdit.Text);
                spc.AutoCL       = this.chbAutoCLEdit.Checked?"Y":"N";
                spc.LowOnly      = this.chbLowEdit.Checked?"Y":"N";
                spc.UpOnly       = this.chbUpEdit.Checked?"Y":"N";
                spc.UCL          = this.txtUCLEdit.Text == String.Empty?0:decimal.Parse(this.txtUCLEdit.Text);
                spc.LCL          = this.txtLCLEdit.Text == String.Empty?0:decimal.Parse(this.txtLCLEdit.Text);
                spc.USL          = this.txtUSLEdit.Text == String.Empty?0:decimal.Parse(this.txtUSLEdit.Text);
                spc.LSL          = this.txtLSLEdit.Text == String.Empty?0:decimal.Parse(this.txtLSLEdit.Text);
                spc.Description  = this.txtDescEdit.Text;
                spc.MaintainDate = FormatHelper.TODateInt(DateTime.Now);
                spc.MaintainTime = FormatHelper.TOTimeInt(DateTime.Now);
                spc.MaintainUser = this.GetUserCode();

                return(spc);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 2
0
        protected override object GetEditObject()
        {
            if (_facade == null)
            {
                _facade = new ItemFacade(base.DataProvider);
            }
            if (this.ValidateInput())
            {
                Item2SPCTable spc = this._facade.CreateNewItem2SPCTable();

                spc.OID          = this.txtOID.Text.Trim() != String.Empty?this.txtOID.Text:Guid.NewGuid().ToString();
                spc.ItemCode     = this._itemCode;
                spc.SPCTableName = this.txtTableNameEdit.Text;
                spc.StartDate    = FormatHelper.TODateInt(this.dateStartDateEdit.Text);
                spc.EndDate      = FormatHelper.TODateInt(this.dateEndDateEdit.Text);
                spc.Description  = this.txtDescription.Text;
                spc.MaintainDate = FormatHelper.TODateInt(DateTime.Now);
                spc.MaintainTime = FormatHelper.TOTimeInt(DateTime.Now);
                spc.MaintainUser = this.GetUserCode();

                return(spc);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 3
0
        protected override bool ValidateInput()
        {
            if (_facade == null)
            {
                _facade = new ItemFacade(base.DataProvider);
            }
            PageCheckManager manager = new PageCheckManager();

            manager.Add(new LengthCheck(this.lblTableNameEdit, this.txtTableNameEdit, 40, true));
            manager.Add(new RangeCheck(this.lblStartDateEdit, this.dateStartDateEdit.Text, this.lblEndDateEdit, this.dateEndDateEdit.Text, true));
            //manager.Add(new TableNameUniqueCheck(this._facade,this._itemCode,this.txtTableNameEdit.Text,this.txtOID.Text));
            manager.Add(new DateUniqueCheck(this._facade,
                                            _itemCode,
                                            FormatHelper.TODateInt(this.dateStartDateEdit.Text),
                                            FormatHelper.TODateInt(this.dateEndDateEdit.Text),
                                            this.txtOID.Text));
            manager.Add(new TableNameCheck(this.txtTableNameEdit.Text));

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

            return(true);
        }
Esempio n. 4
0
        //protected override void AddDomainObject(object domainObject)
        //{
        //    if (_facade == null)
        //    {
        //        _facade = new MOModel.ItemFacade(base.DataProvider);
        //    }
        //    this._facade.AddDct((Dct)domainObject);
        //}

        protected override void DeleteDomainObjects(ArrayList domainObjects)
        {
            if (_facade == null)
            {
                _facade = new MOModel.ItemFacade(base.DataProvider);
            }
            this._facade.DeleteMaterial((BenQGuru.eMES.Domain.MOModel.Material[])domainObjects.ToArray(typeof(BenQGuru.eMES.Domain.MOModel.Material)));
        }
Esempio n. 5
0
 protected override void UpdateDomainObject(object domainObject)
 {
     if (_facade == null)
     {
         _facade = new MOModel.ItemFacade(base.DataProvider);
     }
     this._facade.UpdateMaterial((BenQGuru.eMES.Domain.MOModel.Material)domainObject);
 }
Esempio n. 6
0
 protected override void UpdateDomainObject(object domainObject)
 {
     if (_facade == null)
     {
         _facade = new ItemFacade(base.DataProvider);
     }
     this._facade.UpdateItem2SPCTest((Item2SPCTest)domainObject);
 }
Esempio n. 7
0
 protected override void DeleteDomainObjects(ArrayList domainObjects)
 {
     if (_facade == null)
     {
         _facade = new ItemFacade(base.DataProvider);
     }
     this._facade.DeleteItem2SPCTTest((Item2SPCTest[])domainObjects.ToArray(typeof(Item2SPCTest)));
 }
Esempio n. 8
0
 protected override void AddDomainObject(object domainObject)
 {
     if (_facade == null)
     {
         _facade = new ItemFacade(base.DataProvider);
     }
     this._facade.AddItem2SPCTable((Item2SPCTable)domainObject);
 }
Esempio n. 9
0
 protected override int GetRowCount()
 {
     if (_facade == null)
     {
         _facade = new ItemFacade(base.DataProvider);
     }
     return(this._facade.QueryItem2SPCTestCount(
                FormatHelper.PKCapitalFormat(FormatHelper.CleanString(_itemCode))
                ));
 }
Esempio n. 10
0
 protected override object[] LoadDataSource(int inclusive, int exclusive)
 {
     if (_facade == null)
     {
         _facade = new ItemFacade(base.DataProvider);
     }
     return(this._facade.QueryItem2SPCTest(
                FormatHelper.PKCapitalFormat(FormatHelper.CleanString(_itemCode)),
                inclusive, exclusive));
 }
Esempio n. 11
0
        private bool checkItemCode()
        {
            bool result = true;

            this._ItemFacade = new ItemFacade(this.DataProvider);
            Domain.MOModel.Material material = (Domain.MOModel.Material)_ItemFacade.GetMaterial(FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtItemCodeEdit.Text)), int.Parse(this.DropDownListOrg.SelectedValue));

            if (material == null)
            {
                result = false;
            }
            return(result);
        }
Esempio n. 12
0
        protected override object GetEditObject(GridRecord row)
        {
            object objSource = row.Items.FindItemByKey("Msource").Value;
            string strSource = string.Empty;

            if (objSource != null)
            {
                strSource = objSource.ToString();
            }
            if (strSource.ToUpper().Trim() == "SAP")
            {
                //WebInfoPublish.Publish(this, "$Error_SAP_NO_EDITE", this.languageComponent1);
                //return null;

                this.txtMaterialNO.Enabled     = false;
                this.txtMaterialENDesc.Enabled = false;
                this.txtMaterialCHDesc.Enabled = false;
                this.txtDQMaterialNO.Enabled   = false;
            }
            //if (_WarehouseFacade == null)
            //{
            //    _WarehouseFacade = new WarehouseFacade(base.DataProvider);
            //}
            //if (row.Items.FindItemByKey("MControlType").Value.ToString() == "批量管控")
            //{
            //    object[] objs = this._WarehouseFacade.GetStorageDetailsFromDQMCODE(row.Items.FindItemByKey("DQMaterialNo").Value.ToString());
            //    if (objs != null)
            //    {
            //        this.drpMaterialType.Enabled = false;
            //    }
            //}

            if (_facade == null)
            {
                _facade = new MOModel.ItemFacade(base.DataProvider);
            }
            string strCode = string.Empty;
            object objCode = row.Items.FindItemByKey("MaterialNo").Value;

            if (objCode != null)
            {
                strCode = objCode.ToString();
            }
            object obj = _facade.GetMaterial(strCode);

            if (obj != null)
            {
                return((BenQGuru.eMES.Domain.MOModel.Material)obj);
            }
            return(null);
        }
Esempio n. 13
0
 protected override int GetRowCount()
 {
     if (_facade == null)
     {
         _facade = new MOModel.ItemFacade(base.DataProvider);
     }
     return(this._facade.GetMaterialCount(
                FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtMaterialNOQuery.Text)),
                FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtDQMaterialNOQuery.Text)),
                FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtMaterialDescQuery.Text)),
                FormatHelper.CleanString(this.drpMaterialTypeQuery.SelectedValue),
                FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.drpMaterialSourceQuery.SelectedValue))
                ));
 }
Esempio n. 14
0
 protected override object[] LoadDataSource(int inclusive, int exclusive)
 {
     if (_facade == null)
     {
         _facade = new MOModel.ItemFacade(base.DataProvider);
     }
     return(this._facade.GetMaterial(
                FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtMaterialNOQuery.Text)),
                FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtDQMaterialNOQuery.Text)),
                FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtMaterialDescQuery.Text)),
                FormatHelper.CleanString(this.drpMaterialTypeQuery.SelectedValue),
                FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.drpMaterialSourceQuery.SelectedValue)),
                inclusive, exclusive));
 }
Esempio n. 15
0
        protected override object GetEditObject(Infragistics.WebUI.UltraWebGrid.UltraGridRow row)
        {
            if (_facade == null)
            {
                _facade = new ItemFacade(base.DataProvider);
            }
            object obj = _facade.GetItem2SPCTest(row.Cells[1].Text.ToString());

            if (obj != null)
            {
                return((Item2SPCTest)obj);
            }

            return(null);
        }
Esempio n. 16
0
        protected override object GetEditObject()
        {
            if (_facade == null)
            {
                _facade = new MOModel.ItemFacade(base.DataProvider);
            }
            BenQGuru.eMES.Domain.MOModel.Material merterial = this._facade.CreateNewMaterial();
            merterial = _facade.GetMaterial(FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtMaterialNO.Text, 40))) as BenQGuru.eMES.Domain.MOModel.Material;

            merterial.MCONTROLTYPE = FormatHelper.CleanString(this.drpMaterialType.SelectedValue, 40);
            merterial.Validity     = Int32.Parse(FormatHelper.CleanString(this.txtMaterialValidity.Text, 100));
            merterial.MaintainUser = this.GetUserCode();

            return(merterial);
        }
Esempio n. 17
0
        protected override bool ValidateInput()
        {
            if (_facade == null)
            {
                _facade = new ItemFacade(base.DataProvider);
            }
            PageCheckManager manager = new PageCheckManager();

            manager.Add(new LengthCheck(this.lblItemNameEdit, this.txtTestNameEdit, 40, true));
            manager.Add(new NumberCheck(this.lblSeqEdit, this.txtSeqEdit, 1, int.MaxValue, true));
            manager.Add(new TestNameUniqueCheck(this._facade, this._itemCode, this.txtTestNameEdit.Text, this.txtOID.Text));
            manager.Add(new SeqUniqueCheck(this.lblSeqEdit.Text, this._facade, this._itemCode, this.txtSeqEdit.Text, this.txtOID.Text));
            if (this.txtUSLEdit.Enabled)
            {
                manager.Add(new DecimalCheck(this.lblUSLEdit, this.txtUSLEdit, true));
            }
            if (this.txtLSLEdit.Enabled)
            {
                manager.Add(new DecimalCheck(this.lblLSLEdit, this.txtLSLEdit, true));
            }
            if (this.txtUCLEdit.Enabled)
            {
                manager.Add(new DecimalCheck(this.lblUCLEdit, this.txtUCLEdit, true));
            }
            if (this.txtLCLEdit.Enabled)
            {
                manager.Add(new DecimalCheck(this.lblLCLEdit, this.txtLCLEdit, true));
            }

            //manager.Add(new DateUniqueCheck(this._facade,
            //								_itemCode,
            //								FormatHelper.TODateInt(this.dateStartDateEdit.Text),
            //								FormatHelper.TODateInt(this.dateEndDateEdit.Text),
            //								this.txtOID.Text));
            //manager.Add(new TableNameCheck(this.txtTableNameEdit.Text));

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

            return(true);
        }
Esempio n. 18
0
        private bool SBOMDownloadCheck(object obj)
        {
            SBOM sbom = (SBOM)obj;

            //检查日期格式
            if (sbom.SBOMItemEffectiveDate < 20000101)
            {
                ExceptionManager.Raise(this.GetType().BaseType, "$Error_EffectiveDate_Format");
            }
            if (sbom.SBOMItemInvalidDate < 20000101)
            {
                ExceptionManager.Raise(this.GetType().BaseType, "$Error_InvalidDate_Format");
            }

            // 检查 ItemCode
            if ((sbom.SBOMItemCode == string.Empty) || (sbom.SBOMItemCode == null))
            {
                ExceptionManager.Raise(this.GetType().BaseType, "$Error_OPBOMItem_NotNull");
            }
            // 检查 首选料
            if ((sbom.SBOMSourceItemCode == string.Empty) || (sbom.SBOMSourceItemCode == null))
            {
                ExceptionManager.Raise(this.GetType().BaseType, "$Error_OPBOMSourceItem_NotNull");
            }
            //检查单机用量
            if (!(sbom.SBOMItemQty > 0))
            {
                ExceptionManager.Raise(this.GetType().BaseType, "$Error_SBOMItemQty_Format");
            }

            itemFacade = new ItemFacade(base.DataProvider);
            object item = itemFacade.GetItem(FormatHelper.PKCapitalFormat(FormatHelper.CleanString(sbom.ItemCode)), GlobalVariables.CurrentOrganizations.First().OrganizationID);

            if (item == null)
            {
                ExceptionManager.Raise(this.GetType().BaseType, "$Error_ItemCode_NotExisted", String.Format("[$ItemCode='{0}']", sbom.ItemCode));
            }
            return(true);
        }
Esempio n. 19
0
        private void GetAllItem()
        {
            try
            {
                string fileName = string.Empty;

                #region  new

                #region File
                if (_facade == null)
                {
                    _facade = new MOModel.ItemFacade(base.DataProvider);
                }
                if (inventoryFacade == null)
                {
                    inventoryFacade = new BenQGuru.eMES.Material.InventoryFacade(base.DataProvider);
                }
                string upfileName = "";
                BenQGuru.eMES.Domain.Warehouse.InvDoc doc = new BenQGuru.eMES.Domain.Warehouse.InvDoc();
                if (this.DownLoadPathBom.PostedFile != null)
                {
                    string         stno       = "MaterialImport";// FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtASNSTNOQuery.Text));
                    HttpPostedFile postedFile = this.DownLoadPathBom.PostedFile;
                    string         path       = Server.MapPath(this.VirtualHostRoot + "InvDoc/" + "物料维护/");
                    DBDateTime     dbDateTime = FormatHelper.GetNowDBDateTime(base.DataProvider);
                    //string CARINVNO = row.Items.FindItemByKey("CARINVNO").Text;
                    doc.InvDocNo   = stno;
                    doc.InvDocType = "MaterialImport";//FMaterialMP
                    string[] part = postedFile.FileName.Split(new char[] { '/', '\\' });

                    doc.DocType        = Path.GetExtension(postedFile.FileName);
                    doc.DocName        = Path.GetFileNameWithoutExtension(postedFile.FileName);
                    doc.DocSize        = postedFile.ContentLength / 1024;
                    doc.UpUser         = GetUserCode();
                    doc.UpfileDate     = FormatHelper.TODateInt(DateTime.Now);
                    doc.Dirname        = "物料维护";
                    doc.MaintainUser   = this.GetUserCode();
                    doc.MaintainDate   = dbDateTime.DBDate;
                    doc.MaintainTime   = dbDateTime.DBTime;
                    doc.ServerFileName = doc.DocName + "_" + stno + DateTime.Now.ToString("yyyyMMddhhmmss") + doc.DocType;
                    if (!Directory.Exists(path))
                    {
                        Directory.CreateDirectory(path);
                    }
                    fileName = doc.ServerFileName;

                    upfileName = path + fileName;
                    this.DownLoadPathBom.PostedFile.SaveAs(upfileName);
                }
                else
                {
                    this.DataProvider.RollbackTransaction();
                    WebInfoPublish.PublishInfo(this, "导入文件不能为空", this.languageComponent1);
                    return;
                }

                #endregion

                this.UploadedFileName = upfileName;
                #endregion

                DBDateTime dbTime = FormatHelper.GetNowDBDateTime(this.DataProvider);
                if (this.ViewState["UploadedFileName"] == null)
                {
                    WebInfoPublish.Publish(this, "$Error_UploadFileIsEmpty", this.languageComponent1);
                    //BenQGuru.eMES.Common.ExceptionManager.Raise(this.GetType().BaseType, "$Error_UploadFileIsEmpty");
                }
                fileName = this.ViewState["UploadedFileName"].ToString();
                //读取EXCEL格式文件
                System.Data.DataTable dt = GetExcelData(fileName);

                if ((dt != null) && (dt.Rows.Count > 0))
                {
                    for (int t = 0; t < dt.Rows.Count; t++)
                    {
                        string dqmcode  = dt.Rows[t][0].ToString().Trim(); //物料号
                        string validity = dt.Rows[t][1].ToString().Trim(); //有效期
                        if (validity.Length > 10)
                        {
                            this.DataProvider.RollbackTransaction();
                            WebInfoPublish.Publish(this, "$Error_VALID_DAY_NOT_MORE_THREE", this.languageComponent1);
                            return;
                        }
                        if (!IsInt(validity))
                        {
                            this.DataProvider.RollbackTransaction();
                            WebInfoPublish.Publish(this, "鼎桥物料号" + dqmcode + "有效期必须是数值型", this.languageComponent1);
                            return;
                        }
                        BenQGuru.eMES.Domain.MOModel.Material material =
                            _facade.GetMaterialByDQMCode(dqmcode) as BenQGuru.eMES.Domain.MOModel.Material;
                        if (material != null)
                        {
                            material.Validity     = Convert.ToInt32(FormatHelper.CleanString(validity, 100));
                            material.MaintainDate = dbTime.DBDate;
                            material.MaintainTime = dbTime.DBTime;
                            material.MaintainUser = this.GetUserCode();
                            this._facade.UpdateMaterial(material);
                        }
                        else
                        {
                            this.DataProvider.RollbackTransaction();
                            WebInfoPublish.Publish(this, dqmcode + "EXCEL表中鼎桥物料号不存在", this.languageComponent1);
                            return;
                        }
                    }

                    this.DataProvider.CommitTransaction();
                    WebInfoPublish.Publish(this, "导入成功!", this.languageComponent1);
                }
                else
                {
                    this.DataProvider.RollbackTransaction();
                    WebInfoPublish.Publish(this, "导入内容不能为空", this.languageComponent1);//add by sam
                }
            }
            catch (Exception ex)
            {
                this.DataProvider.RollbackTransaction();
                WebInfoPublish.PublishInfo(this, ex.Message, this.languageComponent1);
            }
        }
Esempio n. 20
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                try
                {
                    _provider   = BenQGuru.eMES.Common.DomainDataProvider.DomainDataProviderManager.DomainDataProvider();
                    _query      = new BenQGuru.eMES.WebQuery.QuerySPC(this._provider);
                    _itemfacade = new ItemFacade(this._provider);

                    GetParam();

                    #region 返回基本资料部分
                    if (_fromTime == null || _fromTime == string.Empty)//第一次查询,不是刷新
                    {
                        /*产品别
                         * 品名
                         * 日期								(YYYY-MM-DD)
                         * 资源列表                             (以逗号分割,资源代码里的逗号用空格代替)
                         * 测试项
                         * USL,LSL,UCL,LCL,是否自动产生
                         */
                        ModelFacade modelfacade = new FacadeFactory(_provider).CreateModelFacade();
                        Model       model       = (Model)modelfacade.GetModelByItemCode(_itemCode);
                        this.Writeln(model != null ? model.ModelCode : "");

                        Item item = (Item)_itemfacade.GetItem(_itemCode, GlobalVariables.CurrentOrganizations.First().OrganizationID);
                        this.Writeln(item != null ? item.ItemName : "");

                        //this.Writeln(_dateFrom);
                        WriteDateList();

                        WriteResList();

                        this.Writeln(this._testName);

                        string strtest = string.Empty;

                        strtest = itemSpec.USL.ToString() + ","
                                  + itemSpec.LSL.ToString() + ","
                                  + itemSpec.UCL.ToString() + ","
                                  + itemSpec.LCL.ToString() + ","
                                  + itemSpec.AutoCL + ","
                                  + itemSpec.LimitUpOnly + ","
                                  + itemSpec.LimitLowOnly;

                        this.Writeln(strtest);
                    }
                    else //刷新
                    {
                        WriteDateList();
                        //资源列表
                        WriteResList();
                    }
                    #endregion

                    #region 测试数据部分
                    //总数								(以下记录数的总和)
                    //HHMMSS数值,工作站					(时间和数值间没有空格)

                    //从SQL Server中查询数据
                    if (_query == null)
                    {
                        _query = new BenQGuru.eMES.WebQuery.QuerySPC(this._provider);
                    }



                    BenQGuru.eMES.SPCDataCenter.DataHandler dataHandler = new BenQGuru.eMES.SPCDataCenter.DataHandler(this._provider);
                    int iFromTime = 0;
                    if (this._fromTime != null && this._fromTime != string.Empty)
                    {
                        iFromTime = int.Parse(this._fromTime);
                    }
                    string[][] spcData = dataHandler.QuerySPCData(this._itemCode, this._testName, int.Parse(this._groupSeq), this._resourceCode, FormatHelper.TODateInt(this._dateFrom), FormatHelper.TODateInt(this._dateTo), _testResult, iFromTime);
                    if ((_fromTime == null || _fromTime == string.Empty) && spcData.Length < 10)
                    {
                        ExceptionManager.Raise(this.GetType(), "$SPC_SamplePoint_Too_Little");
                    }
                    // 记录数
                    this.Writeln(spcData.Length);
                    for (int i = 0; i < spcData.Length; i++)
                    {
                        string strLine = string.Empty;
                        strLine = this._dateList.IndexOf(spcData[i][1]) + "," + FormatHelper.ToTimeString(int.Parse(spcData[i][2])).Replace(":", "") + spcData[i][3];
                        if (this._resList.Count > 1)
                        {
                            strLine += "," + this._resList.IndexOf(spcData[i][0]);
                        }
                        this.Writeln(strLine);
                    }

                    #endregion

                    Response.End();

                    if (!IsPostBack)
                    {
                        // 初始化页面语言
                        //this.InitPageLanguage(this.languageComponent1, false);
                    }
                }
                catch (System.Threading.ThreadAbortException)
                {
                }
                catch (System.Exception ex)
                {
                    Response.Clear();
                    string msg = MessageCenter.ParserMessage(ex.Message, this.languageComponent1);
                    if (ex.InnerException != null)
                    {
                        msg = msg + " " + ex.InnerException.Message;
                    }
                    msg = msg.Replace("\r", "");
                    msg = msg.Replace("\n", "");
                    Response.Write(msg);
                    try
                    {
                        Response.End();
                    }
                    catch (System.Threading.ThreadAbortException)
                    {
                    }
                }
            }
            finally             //关闭数据库连接
            {
                if (_query != null && this._query.SPCBroker != null)
                {
                    this._query.SPCBroker.CloseConnection();
                }

                if (_provider != null)
                {
                    ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)_provider).PersistBroker.CloseConnection();
                }
            }
        }
Esempio n. 21
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;
                object item   = items[i];

                this._ItemFacade = new ItemFacade(this.DataProvider);

                string itemCode = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(GetFieldValue(items[i], "ITEMCODE")));
                Int32  orgID    = GlobalVariables.CurrentOrganizations.First().OrganizationID;
                object obj      = _ItemFacade.GetMaterial(itemCode, orgID);
                if (obj == null)
                {
                    result = "物料代码不存在";
                }
                else
                {
                    this._Facade = new MaterialFacade(this.DataProvider);

                    object objExit = _Facade.GetMaterialReqStd(itemCode, orgID);

                    if (objExit == null)
                    {
                        result = "Insert";
                    }
                }

                string requestQty = GetFieldValue(items[i], "RequestQTY");
                if (requestQty != string.Empty)
                {
                    try
                    {
                        int numRequestQty = int.Parse(requestQty);
                    }
                    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, "EAttribute1", result);
            }
        }