コード例 #1
0
ファイル: SBOMFacade.cs プロジェクト: windygu/.net-wms
 public void DeleteSBOM(SBOM sbom)
 {
     try
     {
         this.DataProvider.Delete(sbom);
     }
     catch (Exception ex)
     {
         ExceptionManager.Raise(this.GetType(), "$Error_DeleteSBOM", ex);
     }
 }
コード例 #2
0
ファイル: OPBOMFacadeTest.cs プロジェクト: windygu/.net-wms
        [Test] public void OPBOMFacadeTest_AddOPItem()
        {
            object[] objs  = this.sbomFacade.GetSBOM(itemCode, int.MinValue, int.MaxValue);
            SBOM[]   sboms = new SBOM[objs.Length];

            for (int i = 0; i < objs.Length; i++)
            {
                sboms[i] = (SBOM)objs[i];
            }
            Model2OP model2Operation = (Model2OP)this.modelFacade.GetModel2Operation(opID);

            this.opBOMFacade.AssignBOMItemToOperation(opBOMCode, opBOMVersion, model2Operation, sboms);
        }
コード例 #3
0
ファイル: SBOMFacade.cs プロジェクト: windygu/.net-wms
        public decimal GetSBOMMaxSequence(string itemCode, string sBOMVersion)
        {
            object[] sBOM = this.DataProvider.CustomQuery(typeof(SBOM),
                                                          new SQLCondition("SELECT MAX(seq) AS Seq FROM tblsbom WHERE itemcode='" + itemCode + "' and sbomver='" + sBOMVersion + "'"));

            SBOM bom = sBOM[0] as SBOM;

            if (bom == null || bom.Sequence == 0)
            {
                return(0);
            }
            else
            {
                return(bom.Sequence + 1);
            }
        }
コード例 #4
0
        //获取不在工序bom中的子阶料号
        private Hashtable GetNotInOPBOMHashtalbe()
        {
            Hashtable returnHT = new Hashtable();

            object[] notInOpbomitems = this.GetNotInOPBOMItems();
            if (notInOpbomitems != null && notInOpbomitems.Length > 0)
            {
                foreach (object sbomitem in notInOpbomitems)
                {
                    SBOM tempSbom = (sbomitem as SBOM);
                    if (tempSbom != null && !returnHT.Contains(tempSbom.SBOMItemCode))
                    {
                        returnHT.Add(tempSbom.SBOMItemCode, tempSbom.SBOMItemCode);
                    }
                }
            }
            return(returnHT);
        }
コード例 #5
0
        private SBOM[] GetSelectedBOMs()
        {
            int j = 0;

            SBOM[] boms = new SBOM[gridWebGrid.Rows.Count];
            for (int i = 0; i < gridWebGrid.Rows.Count; i++)
            {
                if (gridWebGrid.Rows[i].Cells[0].Text == "true")
                {
                    boms[i] = (SBOM)sboms[i];
                    j++;
                }
            }
            if (j == 0)
            {
                this.Response.Write("<script language=javascript>alert('" + this.languageComponent1.GetString("warningNoRow") + "')</script>");
            }
            return(boms);
        }
コード例 #6
0
ファイル: SBOMFacade.cs プロジェクト: windygu/.net-wms
        public void AddSBOM(SBOM sbom)
        {
            try
            {
                //Laws Lu,2006/11/13 uniform system collect date
                DBDateTime dbDateTime;

                dbDateTime = FormatHelper.GetNowDBDateTime(DataProvider);

                sbom.MaintainDate = dbDateTime.DBDate;
                sbom.MaintainTime = dbDateTime.DBTime;
                this.DataProvider.Insert(sbom);
            }
            catch (Exception ex)
            {
                //_log.Error(ex.Message,ex);
                ExceptionManager.Raise(this.GetType(), "$Error_AddSBOM", ex);
                //					throw new RemotingException(ErrorCenter.GetErrorServerDescription(typeof(SBOMFacade),"SBOMModel_ERROR_AddSBOM"),ex);
            }
        }
コード例 #7
0
        [Test] public void SBOmFacadeTest_AddSBOM()
        {
            SBOM sbom = this.sbomFacade.CreateSBOM();

            sbom.ItemCode              = itemCode;
            sbom.MaintainUser          = "******";
            sbom.SBOMItemCode          = "test itemcode";
            sbom.SBOMItemControlType   = "lot";
            sbom.SBOMItemDescription   = "this is for test!";
            sbom.SBOMItemECN           = "11";
            sbom.SBOMItemEffectiveDate = FormatHelper.TODateInt(DateTime.Today.ToShortDateString());
            sbom.SBOMItemEffectiveTime = FormatHelper.TOTimeInt(DateTime.Now.ToLongTimeString());
            sbom.SBOMItemInvalidDate   = FormatHelper.TODateInt(DateTime.Today.ToShortDateString());
            sbom.SBOMItemInvalidTime   = FormatHelper.TOTimeInt(DateTime.Now.ToLongTimeString());
            sbom.SBOMItemLocation      = "l1";
            sbom.SBOMItemName          = "this is for test!";
            sbom.SBOMItemQty           = 0;
            sbom.SBOMItemStatus        = "0";
            sbom.Sequence              = 0;
            this.sbomFacade.AddSBOM(sbom);
            Assert.AreEqual(this.sbomFacade.GetSBOMCounts(itemCode), 1);
        }
コード例 #8
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);
        }
コード例 #9
0
ファイル: SBOMFacade.cs プロジェクト: windygu/.net-wms
 public void UpdateSBOM(SBOM sbom)
 {
     this._helper.UpdateDomainObject(sbom);
 }
コード例 #10
0
        /// <summary>
        /// 映射SAP BOM到MES BOM
        /// </summary>
        /// <returns></returns>
        private ArrayList MapSAPBom(object[] SAPBOMObjs)
        {
            #region 参数判断 类型判断

            if (SAPBOMObjs == null)
            {
                return(new ArrayList());
            }
            if (!(SAPBOMObjs.Length > 0))
            {
                return(new ArrayList());
            }

            if (!(SAPBOMObjs[0] is IImport))
            {
                return(new ArrayList());
            }
            ;

            if (SAPBOMObjs[0].GetType() != typeof(SAPBOM))
            {
                ExceptionManager.Raise(this.GetType(), "$Error_Mapper_Parameter", string.Empty);              //参数类型错误
            }

            #endregion

            ArrayList mesObjs = new ArrayList(SAPBOMObjs.Length);               //映射返回的MES 工单

            #region  射BOM的字段
            //SAPBOM 主键 ITEMCODE,Sequence
            int    seq       = 1;
            string lastALPGR = string.Empty;

            foreach (SAPBOM _sapEntity in SAPBOMObjs)
            {
                SBOM _mesEntity = new SBOM();

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

                _mesEntity.ItemCode              = _sapEntity.FItemCode;                                                                        //产品代码
                _mesEntity.SBOMItemECN           = _sapEntity.SBOMItemECN;
                _mesEntity.SBOMItemCode          = _sapEntity.SBOMItemCode;                                                                     //子阶料
                _mesEntity.SBOMSourceItemCode    = _sapEntity.SBOMItemCode;                                                                     //首选料
                _mesEntity.SBOMItemName          = _sapEntity.SOBOMItemName;
                _mesEntity.SBOMItemEffectiveDate = FormatHelper.TODateInt(_sapEntity.SBOMItemEffectiveDate.Date);
                _mesEntity.SBOMItemInvalidDate   = FormatHelper.TODateInt(_sapEntity.SBOMItemInvalidDate.Date);
                _mesEntity.ALPGR = _sapEntity.ALPGR;                                                                                                                                            //替代项目组

                _mesEntity.SBOMItemEffectiveTime = _sapEntity.SBOMItemEffectiveDate.Hour * 10000 + _sapEntity.SBOMItemEffectiveDate.Minute * 100 + _sapEntity.SBOMItemEffectiveDate.Second;
                _mesEntity.SBOMItemInvalidTime   = _sapEntity.SBOMItemInvalidDate.Hour * 10000 + _sapEntity.SBOMItemInvalidDate.Minute * 100 + _sapEntity.SBOMItemInvalidDate.Second;

                _mesEntity.SBOMItemControlType = BOMItemControlType.ITEM_CONTROL_NOCONTROL;                             //导入的数据默认是不受管控的,由用户自行决定是受lot管控还是keyparts管控
                _mesEntity.SBOMItemStatus      = "0";
                _mesEntity.SBOMItemQty         = _sapEntity.SBOMItemQty;
                if (_sapEntity.ALPGR != null && _sapEntity.ALPGR != lastALPGR)
                {
                    lastALPGR = _sapEntity.ALPGR;
                    seq       = 1;
                }
                _mesEntity.Sequence    = seq++;                                                                                                                                 //Sequence 不再作为主键
                _mesEntity.SBOMItemUOM = (_sapEntity.ItemUOM == string.Empty) ? "EA":_sapEntity.ItemUOM;

                _mesEntity.MaintainDate = FormatHelper.TODateInt(DateTime.Today);
                _mesEntity.MaintainTime = FormatHelper.TOTimeInt(DateTime.Now);
                _mesEntity.MaintainUser = "******";
                _mesEntity.MaintainDate = FormatHelper.TODateInt(DateTime.Today);
                _mesEntity.MaintainTime = FormatHelper.TOTimeInt(DateTime.Now);

                //以下是没有映射的字段

                mesObjs.Add(_mesEntity);
            }

            #endregion

            return(mesObjs);
        }
コード例 #11
0
        public static SBOM  ProcessFileLine(string lineContent, string logUser)
        {
            char[] splitChar = new char[1];
            splitChar[0] = CHAR_SEPARATOR_COMMA;

            string[] lineColumn = null;
            lineColumn = lineContent.Split(splitChar);

            if (lineColumn.Length < FILE_COLUMN_SIZE)
            {
                throw new RemotingException(ErrorCenter.GetErrorServerDescription(typeof(BOMFileParser), ErrorCenter.FILE_COLUMN_ERROR));
            }

            if (lineColumn[1].ToString().Trim() == string.Empty)
            {
                throw new RemotingException("1" + ErrorCenter.GetErrorServerDescription(typeof(BOMFileParser), ErrorCenter.NOT_EMPTY_ERROR));
            }

            if (lineColumn[2].ToString().Trim() == string.Empty)
            {
                throw new RemotingException("2" + ErrorCenter.GetErrorServerDescription(typeof(BOMFileParser), ErrorCenter.NOT_EMPTY_ERROR));
            }

            if (lineColumn[3].ToString().Trim() == string.Empty)
            {
                throw new RemotingException("3" + ErrorCenter.GetErrorServerDescription(typeof(BOMFileParser), ErrorCenter.NOT_EMPTY_ERROR));
            }

            if (lineColumn[4].ToString().Trim() == string.Empty)
            {
                throw new RemotingException("4" + ErrorCenter.GetErrorServerDescription(typeof(BOMFileParser), ErrorCenter.NOT_EMPTY_ERROR));
            }

            SBOM sbom = new SBOM();

            try
            {
                sbom.Sequence = Int32.Parse(lineColumn[0].ToString());
            }
            catch
            {
                sbom.Sequence = 0;
            }
            sbom.SBOMItemECN           = lineColumn[1].ToString().Trim();
            sbom.ItemCode              = lineColumn[2].ToString().Trim();
            sbom.SBOMItemCode          = lineColumn[3].ToString().Trim().ToUpper();
            sbom.SBOMItemName          = lineColumn[4].ToString().Trim();
            sbom.SBOMItemLocation      = lineColumn[7].ToString().Trim();
            sbom.SBOMItemStatus        = ITEM_STATUS_NORMAL;
            sbom.SBOMItemEffectiveDate = FormatHelper.TODateInt(lineColumn[5].ToString().Trim());
            sbom.SBOMItemEffectiveTime = 0;
            sbom.SBOMItemInvalidDate   = FormatHelper.TODateInt(lineColumn[6].ToString().Trim());;
            sbom.SBOMItemInvalidTime   = 235959;
            sbom.SBOMItemQty           = 0;
            sbom.SBOMItemControlType   = ITEM_CONTROL_LOT;
            sbom.MaintainUser          = logUser;
            sbom.MaintainDate          = FormatHelper.TODateInt(DateTime.Today);
            sbom.MaintainTime          = FormatHelper.TOTimeInt(DateTime.Now);
            sbom.OrganizationID        = GlobalVariables.CurrentOrganizations.First().OrganizationID;

            if (sbom.SBOMItemInvalidDate < sbom.SBOMItemEffectiveDate)
            {
                throw new RemotingException(ErrorCenter.GetErrorServerDescription(typeof(BOMFileParser), ErrorCenter.EFFECTDATE_ERROR));
            }
            if (FormatHelper.TODateInt(DateTime.Today) >= sbom.SBOMItemInvalidDate)
            {
                throw new RemotingException(ErrorCenter.GetErrorServerDescription(typeof(BOMFileParser), ErrorCenter.INEFFECTDATE_ERROR));
            }
            return(sbom);
        }
コード例 #12
0
        private SBOM GetDomainObject(UltraGridRow row)
        {
            SBOM sbom = new SBOM();

            sbom.ItemCode     = FormatHelper.PKCapitalFormat(row.Cells[1].Text);
            sbom.SBOMItemECN  = row.Cells[2].Text;
            sbom.SBOMItemCode = row.Cells[3].Text.ToUpper();
            sbom.SBOMItemName = row.Cells[4].Text;
            try
            {
                sbom.SBOMItemEffectiveDate = Int32.Parse(row.Cells[6].Text);
            }
            catch
            {
                sbom.SBOMItemEffectiveDate = 0;
            }

            try
            {
                sbom.SBOMItemInvalidDate = Int32.Parse(row.Cells[7].Text);
            }
            catch
            {
                sbom.SBOMItemInvalidDate = 0;
            }
            try
            {
                sbom.MaintainDate = Int32.Parse(row.Cells[8].Text);
            }
            catch
            {
                sbom.MaintainDate = 0;
            }

            try
            {
                sbom.MaintainTime = Int32.Parse(row.Cells[9].Text);
            }
            catch
            {
                sbom.MaintainTime = 0;
            }
            sbom.MaintainUser        = this.GetUserCode();
            sbom.SBOMItemControlType = row.Cells[11].Text;
            sbom.SBOMItemStatus      = row.Cells[16].Text;
            try
            {
                sbom.SBOMItemQty = System.Decimal.Parse(row.Cells[5].Text);
            }
            catch
            {
                sbom.SBOMItemQty = 0;
            }
            try
            {
                sbom.Sequence = Int32.Parse(row.Cells[19].Text);
            }
            catch
            {
                ExceptionManager.Raise(this.GetType().BaseType, "$Error_SystemError");
            }
            sbom.SBOMItemUOM    = FormatHelper.CleanString(row.Cells[20].Text);
            sbom.OrganizationID = GlobalVariables.CurrentOrganizations.First().OrganizationID;

            return(sbom);
        }