Пример #1
0
        private void ShipToWH(ref BindingList<SoCompress> SOCompressList, ref double WHQty)
        {
            ProdOrderFinish ProdOrderFinish = new ProdOrderFinish();
            ProdOrderFinish.ItemNo = txtPartNo.Text;
            ProdOrderFinish.ItemName = txtPartName.Text;
            ProdOrderFinish.ItemType = txtPartType.Text;
            ProdOrderFinish.OKQty = WHQty;
            ProdOrderFinish.RefNo = txtJSNo.Text;
            ProdOrderFinish.IOType = WHIOType.Input;
            ProdOrderFinish.Supplier = "FQC";
            ProdOrderFinish.Remark = txtRevision.Text;
            ProdOrderFinish.CreatedBy = Glob.UserName;
            ProdOrderFinish.Save();

            SoCompress SoComp = new SoCompress();
            SoComp.Item = Item.Load(txtPartNo.Text);
            SoComp.ShipMethod = "Air";
            SoComp.SalesOrderNo = "存仓";
            SoComp.BoxQty = 0;
            SoComp.ShipQty = WHQty;
            SoComp.Calc();
            SOCompressList.Add(SoComp);

            WHQty = 0;
        }
Пример #2
0
        public static BindingList<SoCompress> CompressSO(List<Shipment> Shipments)
        {
            Dictionary<string, SoCompress> DictSoCompress = new Dictionary<string, SoCompress>();
            BindingList<SoCompress> SOCompresses = new BindingList<SoCompress>();
            SoCompress SOCompress;
            string Key;

            foreach (Shipment Shipment in Shipments)
            {
                Key = Shipment.SalesOrderNo + Shipment.ItemNo + Shipment.ShipMethod;
                Shipment.Item = Item.Load(Shipment.ItemNo);

                if (DictSoCompress.ContainsKey(Key))
                {
                    SOCompress = DictSoCompress[Key];
                    SOCompress.ShipQty = SOCompress.ShipQty + Shipment.MoveQty;
                }
                else
                {
                    SOCompress = new SoCompress();
                    SOCompress.Shipment = Shipment;
                    SOCompress.ShipMethod = Shipment.ShipMethod;
                    SOCompress.SalesOrderNo = Shipment.SalesOrderNo;
                    if (Shipment.Item != null)
                        SOCompress.BoxQty = Shipment.Item.BoxQty;

                    if (SOCompress.SalesOrderNo == "存仓")
                        SOCompress.BoxQty = 0;

                    SOCompress.ShipQty = Shipment.MoveQty;
                    DictSoCompress.Add(Key, SOCompress);
                }
            }

            foreach (KeyValuePair<string, SoCompress> KVP in DictSoCompress)
            {
                SOCompress = KVP.Value;
                SOCompress.Calc();

                do
                {
                    SoCompress TmpSOCompress = new SoCompress();
                    TmpSOCompress.Shipment = SOCompress.Shipment;
                    TmpSOCompress.Item = TmpSOCompress.Shipment.Item;
                    TmpSOCompress.ShipMethod = TmpSOCompress.Shipment.ShipMethod;
                    TmpSOCompress.SalesOrderNo = TmpSOCompress.Shipment.SalesOrderNo;
                    TmpSOCompress.MaxQty = SOCompress.MaxQty;
                    TmpSOCompress.BoxQty = SOCompress.BoxQty;

                    if (SOCompress.MaxQty > SOCompress.ShipQty)
                    {
                        TmpSOCompress.ShipQty = SOCompress.ShipQty;
                        SOCompress.ShipQty = 0;
                    }
                    else
                    {
                        TmpSOCompress.ShipQty = SOCompress.MaxQty;
                        SOCompress.ShipQty = SOCompress.ShipQty - SOCompress.MaxQty;
                    }

                    TmpSOCompress.Calc();
                    SOCompresses.Add(TmpSOCompress);

                } while (SOCompress.ShipQty > 0);
            }

            return SOCompresses;
        }