Exemplo n.º 1
0
        private void btnIssue_Click(object sender, EventArgs e)
        {
            float Qty = 0;
            float DefectQty = 0;
            float NWDefectQty = 0;
            float LostQty = 0;

            try
            {
                Qty = float.Parse(txtQty.Text);
                DefectQty = float.Parse(txtDefectQty.Text);
                NWDefectQty = float.Parse(txtNWDefectQty.Text);
                LostQty = float.Parse(txtLostQty.Text);
            }
            catch
            {
                XtraMessageBox.Show("请输入正确的良品数, 来料不良数 及 本厂不良数");
                return;
            }

            if (LostQty > 0)
            {
                DialogResult result = XtraMessageBox.Show(string.Format("请确定是否有遗失数{0}只.", LostQty ), "注意", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

                if (result == DialogResult.No)
                {
                    txtLostQty.SelectAll();
                    txtLostQty.Focus();
                    return;
                }
            }

            if (float.Parse(txtBalQty.Text) < Qty + DefectQty + NWDefectQty + LostQty)
            {
                XtraMessageBox.Show("入仓数不能大于余数 !!!");
                return;
            }

            if (Qty == 0 && DefectQty == 0 && NWDefectQty == 0 && LostQty == 0)
            {
                XtraMessageBox.Show("请输入正确的良品数及不良品数");
                return;
            }

            if (float.Parse(txtBalQty.Text) > Qty + DefectQty + NWDefectQty + LostQty )
            {
                DialogResult result = XtraMessageBox.Show(string.Format("良品数 + 不良品数({0})少于余数({1}), 请确认是否入仓????", Qty + DefectQty + NWDefectQty + LostQty, txtBalQty.Text), "注意", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);

                if (result == DialogResult.No)
                {
                    txtQty.Focus();
                    return;
                }
            }

            UnitOfWork uow = new UnitOfWork();

            uow.BeginTransaction();

            SubProdOrder subProdOrder = SubProdOrder.Find(uow, txtProdOrderNo.Text);
            SubProdOrderReceive receive = new SubProdOrderReceive(uow);

            receive.SubProdOrder = subProdOrder;
            receive.Qty = Qty;
            receive.DefectQty = DefectQty;
            receive.NWDefectQty = NWDefectQty;
            receive.LostQty = LostQty;
            receive.Post();
            receive.Save();

            subProdOrder.SubItem.UpdateQty();
            subProdOrder.SubItem.updateTimeStamp = false;
            subProdOrder.SubItem.Save();

            uow.CommitChanges();

            XPCollection<SubProdOrderReceive> subProdOrderReceives = new XPCollection<SubProdOrderReceive>(uow);
            subProdOrderReceives.Criteria = DevExpress.Data.Filtering.CriteriaOperator.Parse(string.Format("Date = '{0}'", DateTime.Today));
            gridProdOrder.DataSource = subProdOrderReceives;

            clear();
            initLUE();
            lueProdOrder.Focus();
        }
        private void btnIssue_Click(object sender, EventArgs e)
        {
            float Qty = 0;
            float DefectQty = 0;

            try
            {
                Qty = float.Parse(txtQty.Text);
                DefectQty = float.Parse(txtDefectQty.Text);
            }
            catch
            {
                XtraMessageBox.Show("请输入正确的良品数及不良品数");
                return;
            }

            if (float.Parse(txtBalQty.Text) < Qty + DefectQty)
            {
                XtraMessageBox.Show("入仓数不能大于余数 !!!");
                return;
            }

            if (Qty == 0 && DefectQty == 0)
            {
                XtraMessageBox.Show("请输入正确的良品数及不良品数");
                return;
            }

            UnitOfWork uow = new UnitOfWork();

            uow.BeginTransaction();

            SubProdOrder subProdOrder = SubProdOrder.Find(uow, txtProdOrderNo.Text);
            SubProdOrderReceive receive = new SubProdOrderReceive(uow);

            receive.SubProdOrder = subProdOrder;
            receive.Qty = Qty;
            receive.DefectQty = DefectQty;
            receive.Post();
            receive.Save();

            subProdOrder.SubItem.UpdateQty();
            subProdOrder.SubItem.updateTimeStamp = false;
            subProdOrder.SubItem.Save();

            uow.CommitChanges();

            XPCollection<SubProdOrderReceive> subProdOrderReceives = new XPCollection<SubProdOrderReceive>(uow);
            subProdOrderReceives.Criteria = DevExpress.Data.Filtering.CriteriaOperator.Parse(string.Format("Date = '{0}'", DateTime.Today));
            gridProdOrder.DataSource = subProdOrderReceives;

            /*
            gridView2.AddNewRow();
            gridView2.SetRowCellValue(0, "Date", receive.Date);
            gridView2.SetRowCellValue(0, "OrderNo", receive.SubProdOrder.OrderNo);
            gridView2.SetRowCellValue(0, "Index", receive.Index);
            gridView2.SetRowCellValue(0, "SubItem.ItemNo", receive.SubProdOrder.SubItem.ItemNo);
            gridView2.SetRowCellValue(0, "Qty", receive.Qty);
            gridView2.SetRowCellValue(0, "DefectQty", receive.DefectQty);
            */

            clear();
            txtProdOrderNo.SelectAll();
            txtProdOrderNo.Focus();
        }
Exemplo n.º 3
0
        private void CreateProdOrderEntry(UnitOfWork uow)
        {
            SubProdOrder prodOrder = new SubProdOrder(uow);
            SubItem subItem = uow.FindObject<SubItem>(new BinaryOperator("Oid", poLine.SubItem.Oid));

            prodOrder.ProdOrderType = poLine.PurchOrderLineType;
            prodOrder.SubItem = subItem;
            prodOrder.Qty = float.Parse(txtDefectQty.Text);
            prodOrder.OrderStatus = SubProdOrder.ProdOrderStatus.Active;
            prodOrder.Save();

            SubProdOrderReceive prodOrderReceive = new SubProdOrderReceive(uow);
            prodOrderReceive.SubProdOrder = prodOrder;
            prodOrderReceive.DefectQty = prodOrder.Qty;
            prodOrderReceive.Save();
            prodOrderReceive.Post();
        }