Ejemplo n.º 1
0
        public WIPWHTotal(Session session, PurchOrderReceive poReceive)
            : base(session)
        {
            _Warehouse = poReceive.PurchOrderLine.Warehouse;
            OnChanged("Warehouse");

            _PhysicalQty = 0;
            OnChanged("PhysicalQty");

            _AvailQty = 0;
            OnChanged("AvailQty");

            _Item = poReceive.PurchOrderLine.Item;
            OnChanged("Item");
        }
Ejemplo n.º 2
0
        private void btnDeductFromWarehouse_Click(object sender, EventArgs e)
        {
            UnitOfWork uow = new UnitOfWork();
            uow.BeginTransaction();

            foreach (int row in gridView1.GetSelectedRows())
            {
                PurchOrderLine poLine = (PurchOrderLine)gridView1.GetRow(row);

                if (poLine.OrderStatus != PurchOrderLine.PurchOrderStatus.Complete)
                {
                    XtraMessageBox.Show(string.Format("退货单 {0} 不能扣数 !!", poLine.PurchOrderNo));
                }
                else
                {
                    DialogResult dialResult = XtraMessageBox.Show(string.Format("请问是否扣以下退货数{0}\n注意 : 你需要在采购入仓确认内过帐. ", poLine.PurchOrderNo), "确认扣数", MessageBoxButtons.YesNo);

                    if (dialResult == DialogResult.Yes)
                    {
                        PurchOrderReceive pOrderReceive = new PurchOrderReceive(uow);
                        PurchOrderLine poLine2 = uow.FindObject<PurchOrderLine>(CriteriaOperator.Parse(string.Format("Oid = '{0}'", poLine.Oid)));
                        pOrderReceive.PurchOrderLine = poLine2;
                        pOrderReceive.Qty = poLine2.NeedQty * -1;
                        pOrderReceive.Remark = "";
                        pOrderReceive.Warehouse = poLine2.Warehouse;
                        pOrderReceive.VendorDN = "";
                        pOrderReceive.FreeSpareQty = 0;
                        pOrderReceive.Save();
                        pOrderReceive.Post();
                    }
                }
            }

            uow.CommitTransaction();
            initGrid();
        }
Ejemplo n.º 3
0
 public void Post(Session session )
 {
     //(Qty + FreeSpareQty ) > (PurchOrderLine.BalQty +  PurchOrderLine.FreeSpareBalQty - PurchOrderLine.PendingReceivedQty)
     if ((this.ReceivedNow ) > (PurchOrderLine.BalQty))
     {
         DevExpress.XtraEditors.XtraMessageBox.Show(string.Format("采购单号{0}不能发单, 因为入仓数大于采购单欠数", PurchOrderLine.PurchOrderNo));
         this._ResultStatus = ResultStatus.Error;
     }
     else if (this.ReceivedVendorDN == "")
     {
         DevExpress.XtraEditors.XtraMessageBox.Show(string.Format("采购单号{0}不能发单, 因为没有输入来货单号", PurchOrderLine.PurchOrderNo));
         this._ResultStatus = ResultStatus.Error;
     }
     else
     {
         try
         {
             PurchOrderReceive pOrderReceive = new PurchOrderReceive(session);
             pOrderReceive.PurchOrderLine = this.PurchOrderLine;
             pOrderReceive.Qty = this.ReceivedNow;
             pOrderReceive.Remark = this.ReceivedRemark;
             pOrderReceive.Warehouse = this.ReceivedWarehouse;
             pOrderReceive.VendorDN = this.ReceivedVendorDN;
             pOrderReceive.FreeSpareQty = this.ReceivedFreeNow;
             pOrderReceive.Save();
             this._ResultStatus = ResultStatus.OK;
         }
         catch
         {
             this._ResultStatus = ResultStatus.Error;
         }
     }
 }
Ejemplo n.º 4
0
        public static PurchOrderReceive CreateReturnOrder(PurchOrderReceive pReceive)
        {
            PurchOrderReceive rOrder = new PurchOrderReceive(pReceive.Session);
            rOrder.PurchOrderLine = pReceive.PurchOrderLine;
            rOrder.Qty = pReceive.Qty * -1;
            rOrder.FreeSpareQty = pReceive.FreeSpareQty * -1;
            rOrder.Remark = pReceive.Remark;
            rOrder.Warehouse = pReceive.Warehouse;
            rOrder.VendorDN = pReceive.VendorDN;

            rOrder.SetStatusComplete();
            rOrder.SetStatusReturn();
            rOrder.Save();
            rOrder.PurchOrderLine.UpdatePurchReceive();
            rOrder.PurchOrderLine.Save();

            return rOrder;
        }
Ejemplo n.º 5
0
        private void btnSplit_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            if (View.CurrentObject == null)
                return;

            UnitOfWork uow = (UnitOfWork)((XPObjectSpace)View.ObjectSpace).Session;

            uow.BeginTransaction();

            PurchOrderReceive poReceive = (PurchOrderReceive)View.CurrentObject;

            float SplitQty = 0;

            try
            {
                SplitQty = float.Parse(Microsoft.VisualBasic.Interaction.InputBox(
                    string.Format("你已选取了单号 : {0}, 产品编码 : {1}, 数量 : {2}\n请输入要分单数量 !! ", poReceive.PurchOrderLine.PurchOrderNo,
                    poReceive.Item.ItemNo, poReceive.Qty), "分单", "", 0, 0));

                if (SplitQty >= poReceive.Qty)
                {
                    XtraMessageBox.Show(string.Format("不能分单, 分单数量 {0} 大于原有数量 {1}", SplitQty, poReceive.Qty) , "错误");
                    uow.RollbackTransaction();
                    return;
                }

                poReceive.Qty = poReceive.Qty - SplitQty;
                poReceive.Save();
                poReceive.PurchOrderLine.UpdatePurchReceive();

                PurchOrderReceive newPoReceive = new PurchOrderReceive(uow);

                newPoReceive.OurRefNo = poReceive.OurRefNo;
                newPoReceive.PurchOrderLine = poReceive.PurchOrderLine;
                newPoReceive.Qty = SplitQty;
                newPoReceive.Remark = poReceive.Remark;
                newPoReceive.VendorDN = poReceive.VendorDN;
                newPoReceive.Warehouse = poReceive.Warehouse;
                newPoReceive.Save();

                uow.CommitTransaction();
                View.ObjectSpace.Refresh();
            }
            catch(Exception ex)
            {
                XtraMessageBox.Show(string.Format("不能分单, 错误信息如下: \n{0}", ex.Message) , "错误");
                uow.RollbackTransaction();
            }
        }