Exemple #1
0
        public IList<BomItemInfo> ToBOMItemInfoList()
        {
            IList<BomItemInfo> retLst = new List<BomItemInfo>();
            foreach (IFlatBOMItem item in _bomItems)
            {
                BomItemInfo ItemInfo = new BomItemInfo();
                ItemInfo.qty = item.Qty;
                ItemInfo.description = item.Descr ?? string.Empty;
                ItemInfo.PartNoItem = item.PartNoItem ?? string.Empty;
                ItemInfo.type = item.CheckItemType ?? string.Empty;
                ItemInfo.tp = item.Tp ?? string.Empty;
                ItemInfo.GUID = item.GUID;
                if (item.StationPreCheckedPart != null)
                {
                    ItemInfo.scannedQty = item.StationPreCheckedPart.Count;
                    ItemInfo.collectionData = new List<pUnit>();
                    foreach (PartUnit preItem in item.StationPreCheckedPart)
                    {
                        pUnit temp = new pUnit();
                        temp.sn = preItem.Sn;
                        temp.pn = preItem.Pn;
                        temp.valueType = item.CheckItemType;
                        ItemInfo.collectionData.Add(temp);
                    }
                }
                else
                {
                    ItemInfo.scannedQty = 0;
                    ItemInfo.collectionData = new List<pUnit>();
                }

                List<PartNoInfo> allPart = new List<PartNoInfo>();

                ItemInfo.parts = new List<PartNoInfo>();
                if (item.AlterParts != null)
                {
                    foreach (IPart part in item.AlterParts)
                    {
                        PartNoInfo aPart = new PartNoInfo();
                        aPart.description = part.Descr ?? string.Empty;
                        aPart.id = part.PN ?? string.Empty;
                        aPart.friendlyName = aPart.id ?? string.Empty;
                        aPart.partTypeId = part.Type ?? string.Empty;
                        aPart.iecPartNo = part.PN;
                        aPart.valueType = item.CheckItemType ?? string.Empty;
                        IList<NameValueInfo> properties = new List<NameValueInfo>();
                        foreach (PartInfo property in part.Attributes)
                        {
                            var tempProperty = new NameValueInfo();
                            tempProperty.Name = property.InfoType;
                            tempProperty.Value = property.InfoValue;
                            properties.Add(tempProperty);
                        }
                        aPart.properties = properties;
                        allPart.Add(aPart);
                    }
                    allPart.Sort(delegate(PartNoInfo p1, PartNoInfo p2) { return p1.id.CompareTo(p2.id); });

                    ItemInfo.parts = allPart;
                }
                retLst.Add(ItemInfo);
            }
            return retLst;
        }
Exemple #2
0
        private  IList<BomItemInfo> GetCheckItemList(Session Session, string MBSN, string MBModel)
        {
            try
            {
            
                BOM BOMItem = (BOM)Session.GetValue(Session.SessionKeys.SessionBom);
                IList<IMES.FisObject.Common.CheckItem.ICheckItem> checkItems = (IList<IMES.FisObject.Common.CheckItem.ICheckItem>)Session.GetValue(Session.SessionKeys.ExplicityCheckItemList);
                IList<IMES.DataModel.BomItemInfo> retLst = new List<BomItemInfo>();
                if (BOMItem != null)
                {
                    foreach (BOMItem item in BOMItem.Items)
                    {
                        BomItemInfo ItemInfo = new BomItemInfo();
                        ItemInfo.qty = item.Qty;
                        if (item.StationPreCheckedPart != null)
                        {
                            ItemInfo.scannedQty = item.StationPreCheckedPart.Count();
                            ItemInfo.collectionData = new List<pUnit>();
                            foreach (PartUnit preItem in item.StationPreCheckedPart)
                            {
                                pUnit temp = new pUnit();
                                temp.sn = preItem.Sn;
                                temp.pn = preItem.Pn;
                                temp.valueType = item.ValueType;
                                ItemInfo.collectionData.Add(temp);
                            }
                        }

                        else
                        {
                            ItemInfo.scannedQty = 0;
                            ItemInfo.collectionData = new List<pUnit>();
                        }

                        List<PartNoInfo> allPart = new List<PartNoInfo>();


                        foreach (BOMPart part in item.AlterParts)
                        {
                            PartNoInfo aPart = new PartNoInfo();

                            aPart.description = part.Descr2;
                            aPart.id = part.PN;
                            aPart.friendlyName = aPart.id;
                            aPart.partTypeId = part.Type;
                            aPart.iecPartNo = part.PN;
                            aPart.valueType = item.ValueType;
                            allPart.Add(aPart);
                            if (!string.IsNullOrEmpty(MBModel) &&
                                !string.IsNullOrEmpty(MBSN) &&
                                aPart.id == MBModel)
                            {
                                ItemInfo.scannedQty = 1; //item.StationPreCheckedPart.Count();
                                ItemInfo.collectionData = new List<pUnit>();

                                pUnit temp = new pUnit();
                                temp.sn = MBSN;
                                temp.pn = MBModel;
                                temp.valueType = "SN"; //item.ValueType;
                                ItemInfo.collectionData.Add(temp);

                                
                            }


                        }
                        allPart.Sort(delegate(PartNoInfo p1, PartNoInfo p2) { return p1.iecPartNo.CompareTo(p2.iecPartNo); });

                        ItemInfo.parts = allPart;
                        retLst.Add(ItemInfo);
                    }

                }

                if (checkItems != null)
                {
                    foreach (ICheckItem item in checkItems)
                    {
                        BomItemInfo checkItemInfo = new BomItemInfo();
                        checkItemInfo.qty = 1;
                        checkItemInfo.scannedQty = 0;

                        IList<PartNoInfo> allPart = new List<PartNoInfo>();
                        PartNoInfo aPart = new PartNoInfo();
                        aPart.description = string.Empty;
                        aPart.id = item.ItemDisplayName;
                        aPart.friendlyName = aPart.id;
                        aPart.partTypeId = string.Empty;
                        aPart.iecPartNo = aPart.id;
                        allPart.Add(aPart);
                        checkItemInfo.parts = allPart;

                        retLst.Add(checkItemInfo);
                    }

                }
                return retLst;
            }
            catch (Exception)
            {
                throw;
            }
        }