Esempio n. 1
0
 public void AddShipment(Shipment shipment)
 {
     if (dictShipmentGroup.ContainsKey(shipment.Item))
     {
         dictShipmentGroup[shipment.Item].Qty = dictShipmentGroup[shipment.Item].Qty + shipment.Qty;
     }
     else
     {
         ShipmentGroup shipmentGroup = new ShipmentGroup();
         shipmentGroup.Item = shipment.Item;
         shipmentGroup.CustomerItemNo = shipment.SalesOrderLine.CustomerItemNo;
         shipmentGroup.Price = shipment.SalesOrderLine.Price;
         shipmentGroup.SalesOrderNo = shipment.SalesOrderLine.SalesOrder.OrderNo;
         shipmentGroup.Qty = shipment.Qty;
         dictShipmentGroup.Add(shipment.Item, shipmentGroup);
     }
 }
Esempio n. 2
0
 public SoGrid(Shipment shipment)
 {
     this._Shipment = shipment;
     this._SalesOrderDate = shipment.SalesOrderLine.PoDate;
     this._SalesOrderNo = shipment.SalesOrderLine.SalesOrder.OrderNo;
     this._Priority = shipment.SalesOrderLine.Priority;
     this._NeedDate = shipment.SalesOrderLine.NeedDate;
     this._IssueQty = shipment.Qty;
 }
Esempio n. 3
0
        public bool IsValidShipmentQty(Shipment so, ref string errMsg)
        {
            bool isValid = true;
            float sQty = 0;

            foreach (Shipment shipment in Shipments)
            {
                if (shipment.Status != Shipment.PackStatus.Cancel)
                {
                    if (shipment != so)
                    {
                        sQty = sQty + shipment.Qty;
                    }
                }
            }

            if (sQty + so.Qty > NeedQty)
            {
                isValid = false;
                errMsg = string.Format("寄貨數({0})不能大於銷售單餘數({1}) !!", so.Qty, NeedQty - sQty);
            }

            return isValid;
        }
Esempio n. 4
0
        private void btnShipment_Click(object sender, EventArgs e)
        {
            if (InitExcel("Shipment") == false)
                return;

            UnitOfWork uow = new UnitOfWork();
            int row = 3;
            uow.BeginTransaction();

            while (ExcelHelper.GetCellStringValue(xlSht, row, 1) != "")
            {
                string soNo = ExcelHelper.GetCellStringValue(xlSht, row, 1);
                int soIndex = ExcelHelper.GetCellIntValue(xlSht, row, 2);
                DateTime needDate = ExcelHelper.GetCellDateTimeValue(xlSht, row, 3);
                float needQty = ExcelHelper.GetCellFloatValue(xlSht, row, 4);
                string remark = ExcelHelper.GetCellStringValue(xlSht, row, 5);

                SalesOrderLine soLine = SalesOrderLine.Find(uow, soNo, soIndex);
                Shipment shipment = new Shipment(uow);
                shipment.SalesOrderLine = soLine;
                shipment.Qty = needQty;
                shipment.Date = needDate;
                shipment.Remark = remark;
                shipment.Save();

                if (chkDeductSO.Checked)
                {
                    shipment.Post(uow);
                    shipment.AddPackedQty(shipment.UnPackedQty);
                    shipment.CompleteShipment();
                }
                row++;
            }
            uow.CommitTransaction();
            ReleaseExcel();
        }
Esempio n. 5
0
 public Shipment CreateShipment(Session session, float shipQty)
 {
     if (OrderStatus == SalesOrderStatus.Active)
     {
         if (shipQty <= LackQty)
         {
             Shipment so = new Shipment(session);
             so.SalesOrderLine = this;
             so.Qty = shipQty;
             so.Save();
             return so;
         }
         else
         {
             return null;
         }
     }
     else
     {
         return null;
     }
 }