Exemplo n.º 1
0
        public void Post(UnitOfWork uow)
        {
            if (this.Status == ActivityStatus.Waiting)
            {
                WHHistory whHistory = new WHHistory(uow);
                whHistory.Item = this.Item;
                whHistory.OriginalQty = this.Qty;
                whHistory.OriginalUnit = this.Unit;
                whHistory.RefNo = this.ActivityNo;
                whHistory.RefType = WHHistory.ReferenceType.Manual;
                whHistory.Warehouse = this.Warehouse;
                whHistory.Remark = this.Remark;
                whHistory.FromTo = this.FromTo;
                whHistory.WHQty = this.Qty;
                whHistory.WHUnit = whHistory.OriginalUnit;
                whHistory.Save();

                _Status = ActivityStatus.Complete;
                OnChanged("Status");

                _PostedBy = base.CurrentUser;
                OnChanged("PostedBy");
                _PostedDate = ServerHelper.GetCurrentDateTime();
                OnChanged("PostedDate");

                _Date = ServerHelper.GetCurrentDateTime();
                OnChanged("Date");
            }
        }
Exemplo n.º 2
0
        private void CreateWarehouseHistory(UnitOfWork uow)
        {
            if (this.Qty > 0)
            {
                if (Warehouse == null)
                    throw new Exception("请先选取货仓 !!");

                WHHistory whHistory = new WHHistory(uow);
                whHistory.Item = uow.FindObject<Item>(new BinaryOperator("Oid", this.ProdOrder.Item.Oid));
                whHistory.OriginalQty = this.Qty;
                whHistory.OriginalUnit = uow.FindObject<Unit>(new BinaryOperator("Oid", this.ProdOrder.Unit.Oid));
                whHistory.RefNo = this.ProdOrder.OrderNo;
                whHistory.RefType = WHHistory.ReferenceType.Production;
                whHistory.Warehouse = uow.FindObject<WareHouse>(new BinaryOperator("Oid", Warehouse.Oid));
                whHistory.WHQty = this.Qty;
                whHistory.WHUnit = whHistory.OriginalUnit;

                if (this.ProdOrder.GetLastProdRoute() != null)
                    whHistory.FromTo = this.ProdOrder.GetLastProdRoute().WorkCenter.WorkCenterNo;

                whHistory.Save();
            }

            if (this.ScrapQty > 0)
            {
                if (ScrapWarehouse == null)
                    throw new Exception("请先选取货仓 !!");

                WHHistory whHistory = new WHHistory(uow);
                whHistory.Item = uow.FindObject<Item>(new BinaryOperator("Oid", this.ProdOrder.Item.Oid));
                whHistory.OriginalQty = this.ScrapQty;
                whHistory.OriginalUnit = uow.FindObject<Unit>(new BinaryOperator("Oid", this.ProdOrder.Unit.Oid));
                whHistory.RefNo = this.ProdOrder.OrderNo;
                whHistory.RefType = WHHistory.ReferenceType.Production;
                whHistory.Warehouse = uow.FindObject<WareHouse>(new BinaryOperator("Oid", ScrapWarehouse.Oid));
                whHistory.WHQty = this.ScrapQty;
                whHistory.WHUnit = whHistory.OriginalUnit;
                whHistory.Save();
            }
        }
Exemplo n.º 3
0
        public void Post()
        {
            if (Status == OrderReceiveStatus.Waiting && Qty <= PurchOrderLine.BalQty + Qty)
            {
                WHHistory whHistory = new WHHistory(Session);
                whHistory.Item = this.Item;
                whHistory.OriginalQty = this.Qty + this.FreeSpareQty;
                whHistory.OriginalUnit = this.Unit;
                whHistory.RefNo = this.PurchOrderLine.PurchOrderNo;// this.ActivityNo;
                whHistory.RefType = WHHistory.ReferenceType.Purch;
                whHistory.Warehouse = this.Warehouse;
                whHistory.WHQty = this.Qty + this.FreeSpareQty;
                whHistory.WHUnit = whHistory.OriginalUnit;
                whHistory.Remark = this.VendorDN;
                whHistory.FromTo = this.PurchOrderLine.Vendor.No;
                whHistory.Save();

                SetStatusComplete();
            }
            else
            {
                if ((Qty) > (PurchOrderLine.BalQty - PurchOrderLine.PendingReceivedQty))
                {
                    throw new Exception(string.Format("采购单号{0}不能发单, 因为入仓数大于采购单欠数", PurchOrderLine.PurchOrderNo));
                }
            }
        }
Exemplo n.º 4
0
        public void Post(UnitOfWork uow)
        {
            if (Status == MoveOrderStatus.Waiting)
            {
                WHHistory FromHistory = new WHHistory(uow);
                FromHistory.Item = this.Item;
                FromHistory.OriginalQty = this.Qty * -1;
                FromHistory.OriginalUnit = this.Item.Unit;
                FromHistory.RefNo = this.MoveOrderNo;
                FromHistory.RefType = WHHistory.ReferenceType.MoveOrder;
                FromHistory.Warehouse = this.FromWarehouse;
                FromHistory.WHQty = this.Qty * -1;
                FromHistory.WHUnit = FromHistory.OriginalUnit;
                FromHistory.Save();

                WHHistory ToHistory = new WHHistory(uow);
                ToHistory.Item = this.Item;
                ToHistory.OriginalQty = this.Qty;
                ToHistory.OriginalUnit = this.Item.Unit;
                ToHistory.RefNo = this.MoveOrderNo;
                ToHistory.RefType = WHHistory.ReferenceType.MoveOrder;
                ToHistory.Warehouse = this.ToWarehouse;
                ToHistory.WHQty = this.Qty;
                ToHistory.WHUnit = ToHistory.OriginalUnit;
                ToHistory.Save();

                _Status = MoveOrderStatus.Complete;
                OnChanged("Status");

                _PostedBy = base.CurrentUser;
                OnChanged("PostedBy");

                _PostedDate = ServerHelper.GetCurrentDateTime();
                OnChanged("PostedDate");
                this.Save();
            }
        }
Exemplo n.º 5
0
 private void CreateWHEntry(UnitOfWork uow, float WHQty)
 {
     WHHistory whHistory = new WHHistory(uow);
     whHistory.Item = this.Item;
     whHistory.OriginalQty = WHQty ;
     whHistory.OriginalUnit = this.SalesOrderLine.Unit;
     whHistory.RefNo = this.SalesOrderLine.OrderLineIndex;
     whHistory.RefType = WHHistory.ReferenceType.Sales;
     whHistory.Warehouse = this.SalesOrderLine.WareHouse;
     whHistory.FromTo = this.SalesOrderLine.SalesOrder.Customer.No;
     whHistory.WHQty = WHQty ;
     whHistory.WHUnit = whHistory.OriginalUnit;
     whHistory.Save();
 }
Exemplo n.º 6
0
        public void PostPickList(UnitOfWork uow)
        {
            if (Status == PickListStatus.Waiting)
            {
                if (this.PickQty > 0)
                {
                    WHHistory WHHistory = new WHHistory(uow);
                    WHHistory.Item = this.Item;
                    WHHistory.OriginalQty = this.PickQty * -1;
                    WHHistory.Warehouse = this.Warehouse;
                    WHHistory.OriginalUnit = this.Item.Unit;
                    WHHistory.RefNo = ProdOrder.OrderNo;
                    WHHistory.RefType = WHHistory.ReferenceType.Production;

                    if (ProdOrder.GetFirstProdRoute() != null)
                        WHHistory.FromTo = ProdOrder.GetFirstProdRoute().WorkCenter.WorkCenterNo;

                    WHHistory.Save();
                }

                _Status = PickListStatus.Complete;
                OnChanged("Status");

                _PostedBy = base.CurrentUser;
                OnChanged("PostedBy");
                _PostedDate = ServerHelper.GetCurrentDateTime();
                OnChanged("PostedDate");

                this.Save();

                ProdBom.UpdatePickQty();
                ProdBom.Save();

                ProdOrderStart.UpdateStatus();
                ProdOrderStart.Save();

                ProdOrder.UpdateKitQty();
                ProdOrder.Save();
            }
        }
Exemplo n.º 7
0
        public void PostReturnList(UnitOfWork uow)
        {
            if (this.Status == ProdOrderReturnListStatus.Waiting)
            {
                if (Qty > ProdBom.RemainReturnQty)
                    throw new Exception(string.Format("入仓数 {0} 必需小于余数 {1}", Qty, ProdBom.RemainReturnQty));

                WHHistory WHHistory = new WHHistory(uow);
                WHHistory.Item = this.Item;
                WHHistory.OriginalQty = this.Qty;
                WHHistory.Warehouse = this.Warehouse;
                WHHistory.OriginalUnit = this.Item.Unit;
                WHHistory.RefNo = ProdOrder.OrderNo;
                WHHistory.RefType = WHHistory.ReferenceType.Production;

                if (ProdOrder.GetFirstProdRoute() != null)
                    WHHistory.FromTo = ProdOrder.GetFirstProdRoute().WorkCenter.WorkCenterNo;

                WHHistory.Save();

                _Status = ProdOrderReturnListStatus.Complete;
                OnChanged("Status");

                _PostedBy = base.CurrentUser;
                OnChanged("PostedBy");
                _PostedDate = ServerHelper.GetCurrentDateTime();
                OnChanged("PostedDate");

                this.Save();

                ProdBom.UpdateReturnQty();
                ProdBom.Save();

                ProdOrder.UpdateKitQty();
                ProdOrder.Save();
            }
        }