Пример #1
0
 /// <summary>
 /// 获取DN表相关信息
 /// </summary>
 /// <param name="aDN">aDN</param>
 public S_RowData_COAandDN GetADN(string aDN)
 {
     logger.Debug("(_CombineCOAandDN)GetADN start.");
     try
     {
         S_RowData_COAandDN ele = new S_RowData_COAandDN();
         Delivery reDelivery = currentRepository.Find(aDN);
         if (null != reDelivery)
         {
             ele.DeliveryNO = reDelivery.DeliveryNo;
             ele.Model = reDelivery.ModelName;
             ele.CustomerPN = currentRepository.GetDeliveryInfoValue(reDelivery.DeliveryNo, "PartNo");
             ele.PoNo = reDelivery.PoNo;
             ele.Date = reDelivery.ShipDate.ToString("yyyy/MM/dd");
             ele.Qty = reDelivery.Qty.ToString();
             int qty = 0;
             int packedQty = 0;
             qty = reDelivery.Qty;
             IList<IProduct> productList = new List<IProduct>();
             productList = productRepository.GetProductListByDeliveryNo(reDelivery.DeliveryNo);
             if (null != productList)
             {
                 ele.PackedQty = productList.Count.ToString();
                 packedQty = productList.Count;
             }
         }
         return ele;
     }
     catch (FisException e)
     {
         logger.Error(e.mErrmsg, e);
         throw new Exception(e.mErrmsg);
     }
     catch (Exception e)
     {
         logger.Error(e.Message, e);
         throw new SystemException(e.Message);
     }
     finally
     {
         logger.Debug("(_CombineCOAandDN)GetADN end.");
     }
 }
Пример #2
0
        /// <summary>
        /// 获取DN表相关信息
        /// </summary>
        public IList<S_RowData_COAandDN> GetDNListQuick(string model, string pono)
        {
            logger.Debug("(_CombineCOAandDN)GetDNListQuick start.");
            try
            {
                IList<S_RowData_COAandDN> ret = new List<S_RowData_COAandDN>();
                if (model == "")
                {
                    return ret;
                }
                if (pono == "")
                {
                    Delivery assignDelivery = null;
                    int assignQty = 0;

                    IList<Delivery> deliveryList = currentRepository.GetDeliveryListByModel(model, "PC", 12, "00");
                   
                    //a)	ShipDate 越早,越优先
                    //b)	散装优先于非散装
                    //c)	剩余未包装Product数量越少的越优先

                    bool assignNA = false;
                    foreach (Delivery dvNode in deliveryList)
                    {
                        int curqty = productRepository.GetCombinedQtyByDN(dvNode.DeliveryNo);
                        int tmpqty = dvNode.Qty - curqty;
                        int curQty = productRepository.GetCombinedQtyByDN(dvNode.DeliveryNo);
                        if (tmpqty > 0)
                        {
                            bool naflag = false;
                            foreach (DeliveryPallet dpNode in dvNode.DnPalletList)
                            {
                                if (dpNode.PalletID.Substring(0, 2) == "NA")
                                {
                                    naflag = true;
                                    break;
                                }
                            }
                            if (assignDelivery == null)
                            {
                                assignDelivery = dvNode;
                                assignQty = tmpqty;
                                assignNA = naflag;
                                continue;
                            }
                            if (DateTime.Compare(assignDelivery.ShipDate, dvNode.ShipDate) < 0)
                            {
                                continue;
                            }
                            if (!assignNA && naflag)
                            {
                                assignDelivery = dvNode;
                                assignQty = tmpqty;
                                assignNA = naflag;
                            }
                            else if (assignNA == naflag)
                            {
                                if (tmpqty < assignQty)
                                {
                                    assignDelivery = dvNode;
                                    assignQty = tmpqty;
                                    assignNA = naflag;
                                }
                            }
                        }
                    }
                    if (assignDelivery == null)
                    {
                        FisException fe = new FisException("PAK103", new string[] { });   //没找到可分配的delivery
                        throw fe;
                    }

                    S_RowData_COAandDN ele = new S_RowData_COAandDN();
                    ele.DeliveryNO = assignDelivery.DeliveryNo;

                    ele.Model = assignDelivery.ModelName;
                    ele.CustomerPN = currentRepository.GetDeliveryInfoValue(assignDelivery.DeliveryNo, "PartNo");
                    ele.PoNo = assignDelivery.PoNo;

                    ele.Date = assignDelivery.ShipDate.ToString("yyyy/MM/dd");
                    ele.Qty = assignDelivery.Qty.ToString();
                    int qty = 0;
                    int packedQty = 0;
                    qty = assignDelivery.Qty;
                    IList<IProduct> productList = new List<IProduct>();
                    productList = productRepository.GetProductListByDeliveryNo(assignDelivery.DeliveryNo);
                    if (null != productList)
                    {
                        ele.PackedQty = productList.Count.ToString();
                        packedQty = productList.Count;
                    }
                    ret.Add(ele);
                }
                else
                {
                    DNQueryCondition condition = new DNQueryCondition();
                    DateTime temp = DateTime.Now;
                    temp = temp.AddDays(-3);
                    condition.ShipDateFrom = new DateTime(temp.Year, temp.Month, temp.Day, 0, 0, 0, 0);
                    condition.Model = model;
                    IList<DNForUI> dnList = currentRepository.GetDNListByConditionWithSorting(condition);
                    foreach (DNForUI tmp in dnList)
                    {
                        S_RowData_COAandDN ele = new S_RowData_COAandDN();
                        ele.DeliveryNO = tmp.DeliveryNo;
                        if (tmp.Status != "00")
                        {
                            continue;
                        }
                        if (!(tmp.ModelName.Length == 12 && tmp.ModelName.Substring(0, 2) == "PC"))
                        {
                            continue;
                        }
                        ele.Model = tmp.ModelName;
                        ele.CustomerPN = currentRepository.GetDeliveryInfoValue(tmp.DeliveryNo, "PartNo");
                        ele.PoNo = tmp.PoNo;
                        if (pono != "")
                        {
                            if (pono != tmp.PoNo)
                            {
                                continue;
                            }
                        }
                        ele.Date = tmp.ShipDate.ToString("yyyy/MM/dd");
                        ele.Qty = tmp.Qty.ToString();
                        int qty = 0;
                        int packedQty = 0;
                        qty = tmp.Qty;
                        IList<IProduct> productList = new List<IProduct>();
                        productList = productRepository.GetProductListByDeliveryNo(tmp.DeliveryNo);
                        if (null != productList)
                        {
                            ele.PackedQty = productList.Count.ToString();
                            packedQty = productList.Count;
                        }
                        if (packedQty > qty)
                        {
                            continue;
                        }
                        ret.Add(ele);
                        break;
                    }
                }
                return ret;
            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg, e);
                throw new Exception(e.mErrmsg);
            }
            catch (Exception e)
            {
                logger.Error(e.Message, e);
                throw new SystemException(e.Message);
            }
            finally
            {
                logger.Debug("(_CombineCOAandDN)GetDNListQuick end.");
            }
        }
Пример #3
0
 /*
  /// <summary>
  /// 获取DN表相关信息
  /// </summary>
  public IList<S_RowData_COAandDN> GetDNList()
  {
      logger.Debug("(_CombineCOAandDN)GetDNList start.");
      try
      {
          IList<S_RowData_COAandDN> ret = new List<S_RowData_COAandDN>();
          DNQueryCondition condition = new DNQueryCondition();
          DateTime temp = DateTime.Now;
          temp = temp.AddDays(-3);
          condition.ShipDateFrom = new DateTime(temp.Year, temp.Month, temp.Day, 0,0,0,0);
          IList<Srd4CoaAndDn> dnList = currentRepository.GetDNListByConditionForPerformance(condition);
          foreach (Srd4CoaAndDn tmp in dnList)
          {
              S_RowData_COAandDN ele = new S_RowData_COAandDN();
              ele.DeliveryNO = tmp.DeliveryNO;
              ele.Model = tmp.Model;
              ele.CustomerPN = tmp.CustomerPN;
              ele.PoNo = tmp.PoNo;
              ele.Date = tmp.ShipDate.ToString("yyyy/MM/dd");
              ele.Qty = tmp.Qty.ToString();
              ele.PackedQty = tmp.PackedQty.ToString();
              ret.Add(ele);
          }
          return ret;
      }
      catch (FisException e)
      {
          logger.Error(e.mErrmsg, e);
          throw new Exception(e.mErrmsg);
      }
      catch (Exception e)
      {
          logger.Error(e.Message, e);
          throw new SystemException(e.Message);
      }
      finally
      {
          logger.Debug("(_CombineCOAandDN)GetDNList end.");
      }
  }*/
  /// <summary>
  /// 获取DN表相关信息
  /// </summary>
  public IList<S_RowData_COAandDN> GetDNList()
  {
      logger.Debug("(_CombineCOAandDN)GetDNList start.");
      try
      {
          IList<S_RowData_COAandDN> ret = new List<S_RowData_COAandDN>();
          DNQueryCondition condition = new DNQueryCondition();
          DateTime temp = DateTime.Now;
          temp = temp.AddDays(-3);
          condition.ShipDateFrom = new DateTime(temp.Year, temp.Month, temp.Day, 0, 0, 0, 0);
          IList<DNForUI> dnList = currentRepository.GetDNListByCondition(condition);
          foreach (DNForUI tmp in dnList)
          {
              S_RowData_COAandDN ele = new S_RowData_COAandDN();
              ele.DeliveryNO = tmp.DeliveryNo;
              if (tmp.Status != "00")
              {
                  continue;
              }
              if (!(tmp.ModelName.Length == 12 && tmp.ModelName.Substring(0, 2) == "PC"))
              {
                  continue;
              }
              ele.Model = tmp.ModelName;
              ele.CustomerPN = currentRepository.GetDeliveryInfoValue(tmp.DeliveryNo, "PartNo");
              ele.PoNo = tmp.PoNo;
              ele.Date = tmp.ShipDate.ToString("yyyy/MM/dd");
              ele.Qty = tmp.Qty.ToString();
              int qty = 0;
              int packedQty = 0;
              qty = tmp.Qty;
              IList<IProduct> productList = new List<IProduct>();
              productList = productRepository.GetProductListByDeliveryNo(tmp.DeliveryNo);
              if (null != productList)
              {
                  ele.PackedQty = productList.Count.ToString();
                  packedQty = productList.Count;
              }
              if (packedQty > qty)
              {
                  continue;
              }
              ret.Add(ele);
          }
          return ret;
      }
      catch (FisException e)
      {
          logger.Error(e.mErrmsg, e);
          throw new Exception(e.mErrmsg);
      }
      catch (Exception e)
      {
          logger.Error(e.Message, e);
          throw new SystemException(e.Message);
      }
      finally
      {
          logger.Debug("(_CombineCOAandDN)GetDNList end.");
      }
  }