Beispiel #1
0
        private void CreateRListTransfer()
        {
            ProdRouteListTransfer sorListTransfer = new ProdRouteListTransfer(Session);

            sorListTransfer.ProdOrder = this.ProdOrder;
            sorListTransfer.FromProdRoute = this.ProdRoute;
            sorListTransfer.Qty = this.Qty;
            sorListTransfer.ScrapQty = 0;
            sorListTransfer.IsToSO = true;
            sorListTransfer.Remark = "出货单号 - " + this.PackingListNo;
            sorListTransfer.Save();
            sorListTransfer.Post();
        }
Beispiel #2
0
        public void Post()
        {
            ProdRoute ToProdRoute = this.ProdOrder.GetFirstProdRoute();

            if (ToProdRoute == null)
            {
                DevExpress.XtraEditors.XtraMessageBox.Show(string.Format("不能開始生產單{0}, 因為没有流程", this.ProdOrder.OrderNo), "提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Warning);
                return;
            }

            if (this.Status != OrderStartStatus.Active)
            {
                DevExpress.XtraEditors.XtraMessageBox.Show(string.Format("不能開始生產單{0}, 因為狀態不是{1}", this.ProdOrder.OrderNo, ProdOrderStart.OrderStartStatus.Active.ToString()), "提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Warning);
                return;
            }

            ProdRouteListTransfer rListTransfer = new ProdRouteListTransfer(Session);
            rListTransfer.ProdOrder = this.ProdOrder;
            //rListTransfer.FromProdRoute = null ; // No FromProdRoute for the first Start.
            rListTransfer.ToProdRoute = ToProdRoute;
            rListTransfer.ToCellLine = this.ProdOrder.CellLine;
            rListTransfer.Qty = this.Qty;
            rListTransfer.ScrapQty = 0;
            rListTransfer.Save();
            rListTransfer.Post();

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

            _StartedDate = ServerHelper.GetCurrentDateTime();
            OnChanged("StartedDate");

            _StartedBy = base.CurrentUser;
            OnChanged("StartedBy");
        }
        private void ConfirmProdRouteListTransfer_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            try
            {
                rListTransfer = (ProdRouteListTransfer)View.CurrentObject;

                if (rListTransfer.ToProdRoute == null)
                    CreateProdOrderFinish(e);
                else
                {
                    uow = (UnitOfWork)((XPObjectSpace)View.ObjectSpace).Session;
                    uow.BeginTransaction();
                    rListTransfer.Post();
                    uow.CommitChanges();
                    View.ObjectSpace.Refresh();
                }
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message, "錯誤", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                uow.RollbackTransaction();
            }

            UpdateViewState();

            //View.ObjectSpace.Refresh();
        }