/// <summary>
        /// List GetSampleQryResult, get 4 COLUMNs from samplemain and patien to a list to show in listview
        /// </summary>
        /// <returns></returns>
        public List <MaterialInfo> GetProductBOMList(string _productNo)
        {
            List <MaterialInfo> productMaterialsList = new List <MaterialInfo>();

            if (productMaterialsList.Count > 0)
            {
                productMaterialsList.Clear();
            }

            foreach (var val in ProductBOMBLL.GetProductBOMList(_productNo))
            {
                if (val.ProductNo != "" && val.ProductNo != null)
                {
                    if (!val.IsMaterial1NoNull())
                    {
                        MaterialInfo materialTemp = new MaterialInfo();

                        materialTemp.MaterialNo   = val.Material1No;
                        materialTemp.MaterialPcs  = val.Material1Count;
                        materialTemp.MaterialName = MaterialInfoBLL.GetMaterialName(materialTemp.MaterialNo);
                        materialTemp.MaterialSeq  = MaterialInfoBLL.GetMaterialPostion(materialTemp.MaterialNo);
                        productMaterialsList.Add(materialTemp);
                    }

                    if (!val.IsMaterial2NoNull())
                    {
                        MaterialInfo materialTemp = new MaterialInfo();
                        materialTemp.MaterialNo   = val.Material2No;
                        materialTemp.MaterialPcs  = val.Material2Count;
                        materialTemp.MaterialName = MaterialInfoBLL.GetMaterialName(materialTemp.MaterialNo);
                        materialTemp.MaterialSeq  = MaterialInfoBLL.GetMaterialPostion(materialTemp.MaterialNo);
                        productMaterialsList.Add(materialTemp);
                    }


                    if (!val.IsMaterial3NoNull())
                    {
                        MaterialInfo materialTemp = new MaterialInfo();
                        materialTemp.MaterialNo   = val.Material3No;
                        materialTemp.MaterialPcs  = val.Material3Count;
                        materialTemp.MaterialName = MaterialInfoBLL.GetMaterialName(materialTemp.MaterialNo);
                        materialTemp.MaterialSeq  = MaterialInfoBLL.GetMaterialPostion(materialTemp.MaterialNo);
                        productMaterialsList.Add(materialTemp);
                    }


                    if (!val.IsMaterial4NoNull())
                    {
                        MaterialInfo materialTemp = new MaterialInfo();
                        materialTemp.MaterialNo   = val.Material4No;
                        materialTemp.MaterialPcs  = val.Material4Count;
                        materialTemp.MaterialName = MaterialInfoBLL.GetMaterialName(materialTemp.MaterialNo);
                        materialTemp.MaterialSeq  = MaterialInfoBLL.GetMaterialPostion(materialTemp.MaterialNo);
                        productMaterialsList.Add(materialTemp);
                    }


                    if (!val.IsMaterial5NoNull())
                    {
                        MaterialInfo materialTemp = new MaterialInfo();
                        materialTemp.MaterialNo   = val.Material5No;
                        materialTemp.MaterialPcs  = val.Material5Count;
                        materialTemp.MaterialName = MaterialInfoBLL.GetMaterialName(materialTemp.MaterialNo);
                        materialTemp.MaterialSeq  = MaterialInfoBLL.GetMaterialPostion(materialTemp.MaterialNo);
                        productMaterialsList.Add(materialTemp);
                    }


                    if (!val.IsMaterial6NoNull())
                    {
                        MaterialInfo materialTemp = new MaterialInfo();
                        materialTemp.MaterialNo   = val.Material6No;
                        materialTemp.MaterialPcs  = val.Material6Count;
                        materialTemp.MaterialName = MaterialInfoBLL.GetMaterialName(materialTemp.MaterialNo);
                        materialTemp.MaterialSeq  = MaterialInfoBLL.GetMaterialPostion(materialTemp.MaterialNo);
                        productMaterialsList.Add(materialTemp);
                    }


                    if (!val.IsMaterial7NoNull())
                    {
                        MaterialInfo materialTemp = new MaterialInfo();
                        materialTemp.MaterialNo   = val.Material7No;
                        materialTemp.MaterialPcs  = val.Material7Count;
                        materialTemp.MaterialName = MaterialInfoBLL.GetMaterialName(materialTemp.MaterialNo);
                        materialTemp.MaterialSeq  = MaterialInfoBLL.GetMaterialPostion(materialTemp.MaterialNo);
                        productMaterialsList.Add(materialTemp);
                    }


                    if (!val.IsMaterial8NoNull())
                    {
                        MaterialInfo materialTemp = new MaterialInfo();
                        materialTemp.MaterialNo   = val.Material8No;
                        materialTemp.MaterialPcs  = val.Material8Count;
                        materialTemp.MaterialName = MaterialInfoBLL.GetMaterialName(materialTemp.MaterialNo);
                        materialTemp.MaterialSeq  = MaterialInfoBLL.GetMaterialPostion(materialTemp.MaterialNo);
                        productMaterialsList.Add(materialTemp);
                    }


                    if (!val.IsMaterial9NoNull())
                    {
                        MaterialInfo materialTemp = new MaterialInfo();
                        materialTemp.MaterialNo   = val.Material9No;
                        materialTemp.MaterialPcs  = val.Material9Count;
                        materialTemp.MaterialName = MaterialInfoBLL.GetMaterialName(materialTemp.MaterialNo);
                        materialTemp.MaterialSeq  = MaterialInfoBLL.GetMaterialPostion(materialTemp.MaterialNo);
                        productMaterialsList.Add(materialTemp);
                    }


                    if (!val.IsMaterial10NoNull())
                    {
                        MaterialInfo materialTemp = new MaterialInfo();
                        materialTemp.MaterialNo   = val.Material10No;
                        materialTemp.MaterialPcs  = val.Material10Count;
                        materialTemp.MaterialName = MaterialInfoBLL.GetMaterialName(materialTemp.MaterialNo);
                        materialTemp.MaterialSeq  = MaterialInfoBLL.GetMaterialPostion(materialTemp.MaterialNo);
                        productMaterialsList.Add(materialTemp);
                    }


                    if (!val.IsMaterial11NoNull())
                    {
                        MaterialInfo materialTemp = new MaterialInfo();
                        materialTemp.MaterialNo   = val.Material11No;
                        materialTemp.MaterialPcs  = val.Material11Count;
                        materialTemp.MaterialName = MaterialInfoBLL.GetMaterialName(materialTemp.MaterialNo);
                        materialTemp.MaterialSeq  = MaterialInfoBLL.GetMaterialPostion(materialTemp.MaterialNo);
                        productMaterialsList.Add(materialTemp);
                    }


                    if (!val.IsMaterial12NoNull())
                    {
                        MaterialInfo materialTemp = new MaterialInfo();
                        materialTemp.MaterialNo   = val.Material12No;
                        materialTemp.MaterialPcs  = val.Material12Count;
                        materialTemp.MaterialName = MaterialInfoBLL.GetMaterialName(materialTemp.MaterialNo);
                        materialTemp.MaterialSeq  = MaterialInfoBLL.GetMaterialPostion(materialTemp.MaterialNo);
                        productMaterialsList.Add(materialTemp);
                    }


                    if (!val.IsMaterial13NoNull())
                    {
                        MaterialInfo materialTemp = new MaterialInfo();
                        materialTemp.MaterialNo   = val.Material13No;
                        materialTemp.MaterialPcs  = val.Material13Count;
                        materialTemp.MaterialName = MaterialInfoBLL.GetMaterialName(materialTemp.MaterialNo);
                        materialTemp.MaterialSeq  = MaterialInfoBLL.GetMaterialPostion(materialTemp.MaterialNo);
                        productMaterialsList.Add(materialTemp);
                    }


                    if (!val.IsMaterial14NoNull())
                    {
                        MaterialInfo materialTemp = new MaterialInfo();
                        materialTemp.MaterialNo   = val.Material14No;
                        materialTemp.MaterialPcs  = val.Material14Count;
                        materialTemp.MaterialName = MaterialInfoBLL.GetMaterialName(materialTemp.MaterialNo);
                        materialTemp.MaterialSeq  = MaterialInfoBLL.GetMaterialPostion(materialTemp.MaterialNo);
                        productMaterialsList.Add(materialTemp);
                    }


                    if (!val.IsMaterial15NoNull())
                    {
                        MaterialInfo materialTemp = new MaterialInfo();
                        materialTemp.MaterialNo   = val.Material15No;
                        materialTemp.MaterialPcs  = val.Material15Count;
                        materialTemp.MaterialName = MaterialInfoBLL.GetMaterialName(materialTemp.MaterialNo);
                        materialTemp.MaterialSeq  = MaterialInfoBLL.GetMaterialPostion(materialTemp.MaterialNo);
                        productMaterialsList.Add(materialTemp);
                    }


                    if (!val.IsMaterial16NoNull())
                    {
                        MaterialInfo materialTemp = new MaterialInfo();
                        materialTemp.MaterialNo   = val.Material16No;
                        materialTemp.MaterialPcs  = val.Material16Count;
                        materialTemp.MaterialName = MaterialInfoBLL.GetMaterialName(materialTemp.MaterialNo);
                        materialTemp.MaterialSeq  = MaterialInfoBLL.GetMaterialPostion(materialTemp.MaterialNo);
                        productMaterialsList.Add(materialTemp);
                    }


                    if (!val.IsMaterial17NoNull())
                    {
                        MaterialInfo materialTemp = new MaterialInfo();
                        materialTemp.MaterialNo   = val.Material17No;
                        materialTemp.MaterialPcs  = val.Material17Count;
                        materialTemp.MaterialName = MaterialInfoBLL.GetMaterialName(materialTemp.MaterialNo);
                        materialTemp.MaterialSeq  = MaterialInfoBLL.GetMaterialPostion(materialTemp.MaterialNo);
                        productMaterialsList.Add(materialTemp);
                    }


                    if (!val.IsMaterial18NoNull())
                    {
                        MaterialInfo materialTemp = new MaterialInfo();
                        materialTemp.MaterialNo   = val.Material18No;
                        materialTemp.MaterialPcs  = val.Material18Count;
                        materialTemp.MaterialName = MaterialInfoBLL.GetMaterialName(materialTemp.MaterialNo);
                        materialTemp.MaterialSeq  = MaterialInfoBLL.GetMaterialPostion(materialTemp.MaterialNo);
                        productMaterialsList.Add(materialTemp);
                    }


                    if (!val.IsMaterial19NoNull())
                    {
                        MaterialInfo materialTemp = new MaterialInfo();
                        materialTemp.MaterialNo   = val.Material19No;
                        materialTemp.MaterialPcs  = val.Material19Count;
                        materialTemp.MaterialName = MaterialInfoBLL.GetMaterialName(materialTemp.MaterialNo);
                        materialTemp.MaterialSeq  = MaterialInfoBLL.GetMaterialPostion(materialTemp.MaterialNo);
                        productMaterialsList.Add(materialTemp);
                    }


                    if (!val.IsMaterial20NoNull())
                    {
                        MaterialInfo materialTemp = new MaterialInfo();
                        materialTemp.MaterialNo   = val.Material20No;
                        materialTemp.MaterialPcs  = val.Material20Count;
                        materialTemp.MaterialName = MaterialInfoBLL.GetMaterialName(materialTemp.MaterialNo);
                        materialTemp.MaterialSeq  = MaterialInfoBLL.GetMaterialPostion(materialTemp.MaterialNo);
                        productMaterialsList.Add(materialTemp);
                    }
                }
            }

            return(productMaterialsList);
        }
Пример #2
0
 public static void UpdateProdLineMaterialRcvCount(string _materialNo, byte _productLineNo, string _orderNo, int _receivedCount)
 {//string _materialNo, byte _productionLineNo, string _orderNo, int _usedCount
     if (_productLineNo > 0 && _productLineNo < 10 && _orderNo.Length > 0 && _materialNo.Length > 0 && _receivedCount > 0)
     {
         int _recordNo = ProductionLineMaterialBLL.GetProdLineMaterialRecord(_materialNo, _productLineNo, _orderNo);
         if (_recordNo > 0)
         {
             int _previousReceivedCount = ProductionLineMaterialBLL.GetProdLineMaterialReceivedCount(_materialNo, _productLineNo, _orderNo);
             if (ProductionLineMaterialBLL.UpdateProdLineMaterialReceivedCount(_materialNo, _productLineNo, _orderNo, _receivedCount + _previousReceivedCount))
             {
                 LogerHelper.ToLog("新物料箱更新database " + _orderNo + ":" + _materialNo + "," + _receivedCount + "+" + _previousReceivedCount, false);
             }
             else
             {
                 LogerHelper.ToLog("更新databse出错 " + _orderNo + ":" + _materialNo + "," + _receivedCount + "+" + _previousReceivedCount, false);
             }
         }
         else
         {
             if (ProductionLineMaterialBLL.InsertProdLineMaterial(_materialNo, MaterialInfoBLL.GetMaterialName(_materialNo), 0, _productLineNo, _receivedCount, _orderNo))
             {
                 LogerHelper.ToLog("新物料写入database " + _orderNo + ":" + _materialNo + "," + _receivedCount, false);
             }
             else
             {
                 LogerHelper.ToLog("写databse出错 " + _orderNo + ":" + _materialNo + "," + _receivedCount, false);
             }
         }
     }
 }