Пример #1
0
 public IList<AssemblyVCInfo> GetAssemblyVCbyCondition(AssemblyVCInfo condition)
 {
     IList<AssemblyVCInfo> retList = new List<AssemblyVCInfo>();
     try
     {
         retList = iPartRepository.GetAssemblyVC(condition);
         
     }
     catch (Exception)
     {
         throw;
     }
     return retList;
 }
Пример #2
0
 public void UpdateAssemblyVC(AssemblyVCInfo item)
 {
     try
     {
         iPartRepository.UpdateAssemblyVC(item);
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #3
0
 private void initcmbVC()
 {
     ListItem item = null;
     IList<AssemblyVCInfo> list = new List<AssemblyVCInfo>();
     IList<string> stringList = new List<string>();
     AssemblyVCInfo Condition = new AssemblyVCInfo();
     list = iAssemblyVC.GetAssemblyVCbyCondition(Condition);
     stringList = (from q in list
                   orderby q.vc
                   select q.vc).Distinct().ToList<string>();
     this.cmbVC.Items.Clear();
     this.cmbVC.Items.Add(new ListItem("ALL", "ALL"));
     foreach (string temp in stringList)
     {
         item = new ListItem(temp, temp);
         this.cmbVC.Items.Add(item);
     }
     this.cmbVC.SelectedIndex = 0;
     ScriptManager.RegisterStartupScript(this.UpdatePanel1, typeof(System.Object), "VCUpdate", "DealHideWait();", true);
 }
Пример #4
0
 public void InsertAssemblyVC(AssemblyVCInfo item)
 {
     try
     {
         iPartRepository.InsertAssemblyVC(item);
     }
     catch (Exception)
     {
         throw;
     }
     
 }
Пример #5
0
    protected void btnSave_ServerClick(Object sender, EventArgs e)
    {
        AssemblyVCInfo item = new AssemblyVCInfo();
        item.vc = this.txtVC.Value.Trim();
        item.partNo = this.hidAddInsertPartNO.Value.Trim();
        item.combineVC = this.txtCombineVC.Value.Trim();
        item.combinePartNo = this.hidAddInsertCombinePartNO.Value.Trim();
        item.family = this.cmbFamily.SelectedValue.Trim();
        item.remark = this.txtRemark.Value.Trim();
        item.editor = this.HiddenUserName.Value;
        item.udt = DateTime.Now;

        string oldItemId = this.dOldId.Value.Trim();
        try
        {
            if (oldItemId != "")
            {
                item.id = Convert.ToInt64(oldItemId);
                iAssemblyVC.UpdateAssemblyVC(item);
            }
            else
            {
                item.cdt = DateTime.Now;
                iAssemblyVC.InsertAssemblyVC(item);
            }
        }
        catch (FisException ex)
        {
            showErrorMessage(ex.mErrmsg);
            return;
        }
        catch (Exception ex)
        {
            showErrorMessage(ex.Message);
            return;
        }
        ShowListByCustomAndStage();

        
        ScriptManager.RegisterStartupScript(this.updatePanelAll, typeof(System.Object), "saveUpdate", "DealHideWait();", true);
    }
Пример #6
0
    private Boolean ShowListByCustomAndStage()
    {
        String vc = this.cmbVC.SelectedValue;
        String combineVC = this.cmbCombineVC.SelectedValue;
        AssemblyVCInfo Condition = new AssemblyVCInfo();
        IList<AssemblyVCInfo> list = new List<AssemblyVCInfo>();
        try
        {
            if (vc != "ALL")
            {
                Condition.vc = vc;
            }
            if (combineVC != "ALL")
            {
                Condition.combineVC = combineVC;
            }
            list = iAssemblyVC.GetAssemblyVCbyCondition(Condition);

            DataTable dataList = ConvertToDataTable(list);

            if (dataList == null || dataList.Rows.Count == 0)
            {
                bindTable(null, DEFAULT_ROWS);
            }
            else
            {
                bindTable(dataList, DEFAULT_ROWS);
            }
        }
        catch (FisException ex)
        {
            bindTable(null, DEFAULT_ROWS);
            showErrorMessage(ex.mErrmsg);
            return false;
        }
        catch (Exception ex)
        {
            //show error
            bindTable(null, DEFAULT_ROWS);
            showErrorMessage(ex.Message);
            return false;
        }
        finally
        {
            ScriptManager.RegisterStartupScript(this.UpdatePanel2, typeof(System.Object), "VCUpdate", "DealHideWait();", true);
        }
        return true;
    }
Пример #7
0
    private void initcmbCombineVC()
    {
        ListItem item = null;
        IList<AssemblyVCInfo> list = new List<AssemblyVCInfo>();
        IList<string> stringList = new List<string>();
        AssemblyVCInfo Condition = new AssemblyVCInfo();
        if (this.cmbVC.SelectedValue != "ALL")
        {
            Condition.vc = this.cmbVC.SelectedValue.Trim();
        }
        list = iAssemblyVC.GetAssemblyVCbyCondition(Condition);

        stringList = (from q in list
                      orderby q.combineVC descending
                      select q.combineVC).Distinct().ToList<String>();



        this.cmbCombineVC.Items.Clear();
        this.cmbCombineVC.Items.Add(new ListItem("ALL", "ALL"));
        foreach (string temp in stringList)
        {
            item = new ListItem(temp, temp);
            this.cmbCombineVC.Items.Add(item);
        }
        this.cmbCombineVC.SelectedIndex = 0;
        ScriptManager.RegisterStartupScript(this.UpdatePanel2, typeof(System.Object), "VCUpdate", "DealHideWait();", true);
        //ShowListByCustomAndStage();
    }
Пример #8
0
     //   private Session _currentSession;
   //     private IList<CheckItemTypeRuleDef> _lstChkItemRule;
    //    private string _station;
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hierarchical_bom"></param>
        /// <param name="station"></param>
        /// <param name="main_object"></param>
        /// <returns></returns>
        public object FilterBOM(object hierarchical_bom, string station, object main_object)
        {
           // _lstChkItemRule = null;
           // _station = station;
            IPartRepository partRep = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>();
            Session session = GetSession(main_object);
            IList<CheckItemTypeRuleDef> lstChkItemRule = GetCheckItemTypeRule(session);
          //  SetCheckItemTypeRule();
            IList<IFlatBOMItem> flat_bom_items = new List<IFlatBOMItem>();
            Hashtable share_parts_set = new Hashtable();
            Hashtable share_part_no_set = new Hashtable();
            Hashtable qty_share_parts_set = new Hashtable();
            Hashtable descr_parts_set = new Hashtable();
            Hashtable check_typ_set = new Hashtable();
            //问题:station参数用不上。因为在hierarchicalBOM中,没有与station相关的字段。
            IFlatBOM ret = null;
            //int qty = 0;
            //var parts = new List<IPart>();
            if (hierarchical_bom == null)
            {
                throw new ArgumentNullException();
            }
            var bom = (HierarchicalBOM)hierarchical_bom;
            try
            {
                 
                Product product_model = session.GetValue(Session.SessionKeys.Product) as Product;
                //product.FamilyName
                
                IList<ConstValueInfo> valueList =
                   partRep.GetConstValueListByType("CheckAssemblyVC").Where(x => x.value.Trim() != "" && x.name == "Family" && x.description == lstChkItemRule.Select(y=>y.PartDescr).ElementAt(0).ToString()).ToList();
                bool IsCheckAssemblyVC = false;
                IList<string> lstVC = new List<string>();
                if (valueList != null && valueList.Count > 0)
                {
                    //ret.remark = valueList[0].value;
                    IsCheckAssemblyVC = valueList.Any(x => x.value == product_model.Family);
                    if (IsCheckAssemblyVC)
                    {
                        var product = session.GetValue(Session.SessionKeys.Product) as IProduct;
                        IList<IProductPart> lstPrdPart = product.ProductParts;
                        var partsn = from n in lstPrdPart
                                      where n.CheckItemType == "LCM"
                                      where n.PartSn != ""
                                     select n.PartSn;
                        //var partsn = lstPrdPart.Select(y => y.PartSn).Where(x => x.CheckItemType == "LCM" && x.PartSn != "").ToString();
                        //ProductPart Product_Part = session.GetValue(Session.SessionKeys.ProductPartList) as ProductPart;
                        string sn5 = "";
                        if (null != partsn  &&partsn.ElementAt(0)!="")
                        {
                            sn5 = partsn.ElementAt(0).Substring(0, 5);
                        }
                AssemblyVCInfo ai = new AssemblyVCInfo();
                ai.vc = sn5;
                IList<AssemblyVCInfo> lstAI = partRep.GetAssemblyVC(ai);

                //IList<string> lstVC = new List<string>();
                if (lstAI != null && lstAI.Count > 0)
                {
                    foreach (AssemblyVCInfo a in lstAI)
                    {
                        lstVC.Add(a.combinePartNo);
                    }
                }
                else
                {
                    throw new FisException("CQCHK0004", new string[] { sn5 });
                }
                    }
                }
                if (bom.FirstLevelNodes != null)
                {
                    for (int i = 0; i < bom.FirstLevelNodes.Count; i++)
                    {
                        IPart part = ((BOMNode)bom.FirstLevelNodes.ElementAt(i)).Part;
                       // if (part != null && (part.BOMNodeType.Trim().Equals("PL") || part.BOMNodeType.Trim().Equals("C2") || part.BOMNodeType.Trim().Equals("VK")))
                        if (part != null && CheckBomNodeType(bom.FirstLevelNodes.ElementAt(i).Part,lstChkItemRule))
                      
                        {

                            if (NewCheckCondition(bom.FirstLevelNodes.ElementAt(i),session,lstChkItemRule))
                            {
                                Boolean exist_share_part = false;
                                IList<PartInfo> part_infos = part.Attributes;
                                if (part_infos != null && part_infos.Count > 0)
                                {
                                    foreach (PartInfo part_info in part_infos)
                                    {
                                        if (part_info.InfoType.Equals("SUB"))
                                        {
                                            exist_share_part = true;

                                            String[] share_parts = part_info.InfoValue.Trim().Split(';');
                                            if (share_parts.Length > 0)
                                            {
                                                string share_part_no = part_info.InfoValue.Trim();
                                                //                                                share_part_no = share_part_no.Replace("DIB", "");
                                                //                                                share_part_no_set.Add(part.PN, share_part_no.Replace(';', ','));
                                                if (share_part_no_set.ContainsKey(part.PN))
                                                {
                                                    share_part_no_set[part.PN] += "," + share_part_no.Replace(';', ',');
                                                }
                                                else
                                                {
                                                    share_part_no_set.Add(part.PN, share_part_no.Replace(';', ','));
                                                }
                                                IPartRepository repository = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>();
                                                IList<IPart> parts = new List<IPart>();
                                                parts.Add(part);
                                                for (int j = 0; j < share_parts.Length; j++)
                                                {
                                                    //                                                    IPart share_part = repository.GetPartByPartNo(share_parts[j]);
                                                    IPart share_part = null;
                                                    bool isC2WithoutVC = false;
                                                    //part
                                                  //  if (share_parts[j].Substring(0, 3).Equals("DIB") && part.BOMNodeType.Trim().Equals("C2"))
                                                    if (share_parts[j].Substring(0, 3).Equals("DIB") && CheckBomNodeType(part,lstChkItemRule))
                                                    {
                                                        share_part = repository.GetPartByPartNo(share_parts[j].Substring(3, share_parts[j].Length - 3));
                                                        if (share_part == null)
                                                        {
                                                            share_part = repository.GetPartByPartNo(share_parts[j]);
                                                        }
                                                        if (share_part != null)
                                                        {
                                                            IList<PartInfo> c2_dib_share_part_infos = share_part.Attributes;
                                                            if (c2_dib_share_part_infos != null)
                                                            {
                                                                bool have_vendor_code = false;
                                                                foreach (PartInfo c2_dib_share_part_info in c2_dib_share_part_infos)
                                                                {
                                                                    if (c2_dib_share_part_info.InfoType.Equals("VendorCode"))
                                                                    {
                                                                        have_vendor_code = true;
                                                                    }
                                                                }
                                                                if (!have_vendor_code)
                                                                {
                                                                    isC2WithoutVC = true;
                                                                    parts.Add(share_part);
                                                                }
                                                            }
                                                        }
                                                    }
                                                    else
                                                    {
                                                        share_part = repository.GetPartByPartNo(share_parts[j]);
                                                    }
                                                    if (share_part != null && !isC2WithoutVC)
                                                    {
                                                        parts.Add(share_part);
                                                    }
                                                }
                                                String share_parts_code = part.PN;
                                                if (!share_parts_set.ContainsKey(share_parts_code))
                                                {
                                                    share_parts_set.Add(share_parts_code, parts);
                                                    qty_share_parts_set.Add(share_parts_code, ((BOMNode)bom.FirstLevelNodes.ElementAt(i)).Qty);
                                                    descr_parts_set.Add(share_parts_code, part.Descr);
                                                    check_typ_set.Add(share_parts_code, part.BOMNodeType.Trim());
                                                }
                                                else
                                                {
                                                    ((IList<IPart>)share_parts_set[share_parts_code]).Add(part);
                                                    if (!((String)descr_parts_set[share_parts_code]).Contains(part.Descr))
                                                    {
                                                        descr_parts_set[share_parts_code] += "," + part.Descr;
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }

                                if (!exist_share_part)
                                {
                                    if (!share_parts_set.ContainsKey(part.PN))
                                    {
                                        IList<IPart> parts = new List<IPart>();
                                        parts.Add(part);
                                        //                                        }
                                        share_parts_set.Add(part.PN, parts);
                                        qty_share_parts_set.Add(part.PN, ((BOMNode)bom.FirstLevelNodes.ElementAt(i)).Qty);
                                        descr_parts_set.Add(part.PN, part.Descr);
                                        check_typ_set.Add(part.PN, part.BOMNodeType.Trim());
                                    }
                                    else
                                    {
                                      
                                        ((IList<IPart>)share_parts_set[part.PN]).Add(part);
                                        //                                        }
                                        if (!((String)descr_parts_set[part.PN]).Contains(part.Descr))
                                        {
                                            descr_parts_set[part.PN] += "," + part.Descr;
                                        }
                                    }
                                }
                             }
                        }
                    }

                    if (share_parts_set.Count > 0)
                    {
                        foreach (DictionaryEntry de in share_parts_set)
                        {
                            var flat_bom_item = new FlatBOMItem((int)qty_share_parts_set[de.Key], part_check_type, (IList<IPart>)de.Value);
                            if (share_part_no_set.ContainsKey(de.Key))
                            {
                                if (((string)de.Key).Substring(0, 3).Equals("DIB"))
                                {
                                    flat_bom_item.PartNoItem = ((string)de.Key).Substring(3, ((string)de.Key).Length - 3) + "," + (string)share_part_no_set[de.Key];
                                    flat_bom_item.PartNoItem = flat_bom_item.PartNoItem.Replace("DIB", "");
                                }
                                else
                                {
                                    flat_bom_item.PartNoItem = de.Key + "," + (string)share_part_no_set[de.Key];
                                    flat_bom_item.PartNoItem = flat_bom_item.PartNoItem.Replace("DIB", "");
                                }
                            }
                            else
                            {
                                //                                flat_bom_item.PartNoItem = (string)de.Key;
                                if (((string)de.Key).Substring(0, 3).Equals("DIB"))
                                {
                                    flat_bom_item.PartNoItem = ((string)de.Key).Substring(3, ((string)de.Key).Length - 3);
                                    flat_bom_item.PartNoItem = flat_bom_item.PartNoItem.Replace("DIB", "");
                                }
                                else
                                {
                                    flat_bom_item.PartNoItem = (string)de.Key;
                                    flat_bom_item.PartNoItem = flat_bom_item.PartNoItem.Replace("DIB", "");
                                }
                            }
                            flat_bom_item.Tp = (string)check_typ_set[de.Key];
                            flat_bom_item.Descr = (string)descr_parts_set[de.Key];
                            flat_bom_items.Add(flat_bom_item);
                            if (IsCheckAssemblyVC)
                            {
                                if (!lstVC.Contains(flat_bom_item.PartNoItem) && flat_bom_item.Descr == lstChkItemRule.Select(y => y.PartDescr).ElementAt(0).ToString())
                                {
                                      //flat_bom_items.Add(flat_bom_item);
                                    flat_bom_items.Remove(flat_bom_item);
                                }                            
                            }
                           
                        }
                    }
                    if (flat_bom_items.Count > 0)
                    {

                        ret = new FlatBOM(flat_bom_items);
                    }
                }
            }
            catch (Exception e)
            {
                throw;
            }
            return ret;
        }
Пример #9
0
        public object FilterBOM(object hierarchical_bom, string station, object main_object)
        {
            IList<IFlatBOMItem> flat_bom_items = new List<IFlatBOMItem>();
            Hashtable share_parts_set = new Hashtable();
            Hashtable share_part_no_set = new Hashtable();
            Hashtable qty_share_parts_set = new Hashtable();
            Hashtable descr_parts_set = new Hashtable();
            Hashtable check_typ_set = new Hashtable();
            IFlatBOM ret = null;

            if (hierarchical_bom == null)
            {
                throw new ArgumentNullException();
            }
            var bom = (HierarchicalBOM)hierarchical_bom;
            try
            {
                Session session = GetSession(main_object);
                Product product = session.GetValue(Session.SessionKeys.Product) as Product;
                if (product == null)
                {
                    throw new FisException("Can not get product in " + part_check_type + " session");
                }
                if (string.IsNullOrEmpty(product.CUSTSN) || product.CUSTSN.Length < 5)
                {
                    throw new FisException("Can not get CUSTSN in " + part_check_type + " product");
                }

                IPartRepository partRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>();
                string sn5 = product.CUSTSN.Substring(0, 5);
                AssemblyVCInfo ai = new AssemblyVCInfo();
                ai.vc = sn5;
                IList<AssemblyVCInfo> lstAI = partRepository.GetAssemblyVC(ai);

                IList<string> lstVC = new List<string>();
                if (lstAI != null && lstAI.Count > 0)
                {
                    foreach (AssemblyVCInfo a in lstAI)
                    {
                        lstVC.Add(a.combineVC);
                    }
                }
                else
                {
                    throw new FisException("CQCHK0004", new string[] { sn5 });
                }

                if (bom.FirstLevelNodes != null)
                {
                    for (int i = 0; i < bom.FirstLevelNodes.Count; i++)
                    {
                        IPart part = ((BOMNode)bom.FirstLevelNodes.ElementAt(i)).Part;
                        if (part != null && part.BOMNodeType.Trim().Equals("PL") && "TPM".Equals(part.Descr) )
                        {

                            if (CheckCondition(bom.FirstLevelNodes.ElementAt(i)))
                            {
                                string vendorcodeValue = "";
								Boolean exist_share_part = false;
                                IList<PartInfo> part_infos = part.Attributes;
                                if (part_infos != null && part_infos.Count > 0)
                                {
                                    foreach (PartInfo part_info in part_infos)
                                    {
                                        if (part_info.InfoType.Equals("VendorCode") && !string.IsNullOrEmpty(part_info.InfoValue)) {
                                            if (lstVC.Contains(part_info.InfoValue))
                                            {
                                                vendorcodeValue = part_info.InfoValue;
                                            }
										}
                                    }
                                }

                                if (string.IsNullOrEmpty(vendorcodeValue))
                                    continue;

                                if (!exist_share_part)
                                {
                                    if (!share_parts_set.ContainsKey(vendorcodeValue))
                                    {
                                        IList<IPart> parts = new List<IPart>();
                                       
                                        parts.Add(part);
                                      
                                        share_parts_set.Add(vendorcodeValue, parts);
                                        qty_share_parts_set.Add(vendorcodeValue, ((BOMNode)bom.FirstLevelNodes.ElementAt(i)).Qty);
                                        descr_parts_set.Add(vendorcodeValue, part.Descr);
                                        check_typ_set.Add(vendorcodeValue, part.BOMNodeType.Trim());
                                    }
                                    else
                                    {
                                     
                                        ((IList<IPart>)share_parts_set[vendorcodeValue]).Add(part);
                            
                                        if (!((String)descr_parts_set[vendorcodeValue]).Contains(part.Descr))
                                        {
                                            descr_parts_set[vendorcodeValue] += "," + part.Descr;
                                        }
                                    }
                                }
                          
                            }
                        }
                    }

                    if (share_parts_set.Count > 0)
                    {
                        FlatBOMItem flat_bom_item = null;
                        string partNoItem = "";

                        foreach (DictionaryEntry de in share_parts_set)
                        {
                            if (flat_bom_item == null)
                            {
                                flat_bom_item = new FlatBOMItem((int)qty_share_parts_set[de.Key], part_check_type, (IList<IPart>)de.Value);
                                flat_bom_item.Tp = (string)check_typ_set[de.Key];
                                flat_bom_item.Descr = (string)descr_parts_set[de.Key];
                            }
                            else
                            {
                                IList<IPart> parts = share_parts_set[de.Key] as IList<IPart>;
                                if (null != parts)
                                {
                                    foreach (IPart part in parts)
                                        flat_bom_item.AddAlterPart(part);
                                }
                            }

                            if (partNoItem == "")
                                partNoItem = (string)de.Key;
                            else
                                partNoItem += "," + de.Key;
                        }

                        flat_bom_item.PartNoItem = partNoItem;
                        flat_bom_items.Add(flat_bom_item);
                    }

                    if (flat_bom_items.Count > 0)
                    {
                        ret = new FlatBOM(flat_bom_items);
                    }
                    else
                    {
                        throw new FisException("CQCHK0005", new string[] { product.Model });
                    }
                }
                
            }
            catch (Exception e)
            {
                throw;
            }

           return ret;
        }