Example #1
0
    protected void tbOrderNo_TextChanged(Object sender, EventArgs e)
    {
        try
        {
            if (this.CurrentOrderNo == null || this.CurrentOrderNo != this.tbOrderNo.Text.Trim())
            {
                OrderHead currentOrderHead = TheOrderMgr.LoadOrder(this.tbOrderNo.Text.Trim(), this.CurrentUser);

                if (currentOrderHead.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_CANCEL ||
                    currentOrderHead.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_COMPLETE ||
                    currentOrderHead.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_CLOSE)
                {
                    this.ShowErrorMessage("Inventory.Error.PrintHu.OrderStatus", currentOrderHead.OrderNo, currentOrderHead.Status);
                    return;
                }

                if (currentOrderHead.SubType != BusinessConstants.CODE_MASTER_ORDER_SUB_TYPE_VALUE_NML)
                {
                    this.ShowErrorMessage("Inventory.Error.PrintHu.OrderSubType", currentOrderHead.OrderNo, currentOrderHead.SubType);
                    return;
                }

                currentOrderHead.OrderDetails = TheOrderDetailMgr.GetOrderDetail(currentOrderHead);
                this.CurrentOrderNo           = currentOrderHead.OrderNo;

                this.ucList.InitPageParameter(currentOrderHead);
                this.ucList.Visible = true;
            }
        }
        catch (BusinessErrorException ex)
        {
            this.ShowErrorMessage(ex);
        }
    }
Example #2
0
    protected void btnOrderNo_Click(object sender, EventArgs e)
    {
        this.lblMessage.Text = string.Empty;
        this.OrderNo         = this.tbOrderNo.Text.Trim();
        OrderHead orderHead = null;

        try
        {
            orderHead = TheOrderMgr.LoadOrder(this.OrderNo, this.CurrentUser);
        }
        catch (BusinessErrorException ex)
        {
            this.ShowErrorMessage(ex);
            this.tbOrderNo.Text = string.Empty;
            this.tbOrderNo.Focus();
        }
        if (orderHead != null)
        {
            this.gv_List.DataSource = TheOrderDetailMgr.GetOrderDetail(this.OrderNo);
            this.gv_List.DataBind();
            this.tbOrderNo.ReadOnly    = true;
            this.gv_List.Visible       = false;
            this.gv_Hu.Visible         = true;
            this.btn_Hu_Create.Visible = true;
            this.btnReceive.Visible    = false;
            InitPageParameter(orderHead.PartyFrom.Code);
        }
    }
Example #3
0
    public bool sendDeliveryOrder(DeliveryOrder order, string userCode)
    {
        IList <OrderDetail> orderDetailList = new List <OrderDetail>();

        if (order != null && order.deliveryOrderItems != null && order.deliveryOrderItems.Length > 0)
        {
            foreach (DeliveryOrderItem item in order.deliveryOrderItems)
            {
                OrderDetail orderDetail = TheOrderDetailMgr.LoadOrderDetail(int.Parse(item.id));
                orderDetail.CurrentShipQty = Convert.ToDecimal(item.deliveryQuantity);
                orderDetailList.Add(orderDetail);
            }
            TheOrderMgr.ShipOrder(orderDetailList, userCode);
        }


        return(true);
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        int currentLocTransId = -1;

        foreach (GridViewRow row in this.GV_List.Rows)
        {
            RadioButton rbSelect   = (RadioButton)row.FindControl("rbSelect");
            HiddenField hfRowIndex = (HiddenField)row.FindControl("hfRowIndex");
            if (rbSelect.Checked)
            {
                currentLocTransId = int.Parse(hfRowIndex.Value);
                break;
            }
        }
        if (currentLocTransId == -1)
        {
            ShowErrorMessage("Common.Message.Record.Not.Select");
        }
        else
        {
            OrderLocationTransaction currentLocationTrans = OrderLocTransList[currentLocTransId];
            OrderLocationTransaction oldLocationTrans     = TheOrderLocationTransactionMgr.LoadOrderLocationTransaction(this.LocTransId);
            OrderDetail orderDetail = TheOrderDetailMgr.LoadOrderDetail(oldLocationTrans.OrderDetail.Id, true);
            orderDetail.OrderHead        = TheOrderHeadMgr.LoadOrderHead(orderDetail.OrderHead.OrderNo, true, true, true);
            oldLocationTrans.OrderDetail = orderDetail;
            try
            {
                TheOrderLocationTransactionMgr.ReplaceAbstractItem(oldLocationTrans, currentLocationTrans.BomDetail);

                if (SaveEvent != null)
                {
                    SaveEvent(currentLocationTrans.OrderDetail.OrderHead.OrderNo, e);
                    this.Visible = false;
                }
            }
            catch (BusinessErrorException ex)
            {
                ShowErrorMessage(ex);
            }
        }
    }
    protected void lbtnAdd_Click(object sender, EventArgs e)
    {
        int                    rowIndex    = ((GridViewRow)(((DataControlFieldCell)(((LinkButton)(sender)).Parent)).Parent)).RowIndex;
        GridViewRow            row         = this.GV_List.Rows[rowIndex];
        RequiredFieldValidator rfvItem     = (RequiredFieldValidator)(row.FindControl("rfvItem"));
        RequiredFieldValidator rfvLocation = (RequiredFieldValidator)(row.FindControl("rfvLocation"));

        if (!rfvItem.IsValid || !rfvLocation.IsValid)
        {
            return;
        }
        if (checkItemExists())
        {
            ShowErrorMessage("MasterData.Order.OrderDetail.Item.Exists");
            return;
        }
        OrderLocationTransaction orderLocTrans = new OrderLocationTransaction();



        orderLocTrans.Operation   = int.Parse(((TextBox)row.FindControl("tbOperation")).Text.Trim());
        orderLocTrans.OrderDetail = TheOrderDetailMgr.LoadOrderDetail(int.Parse(((DropDownList)row.FindControl("tbKitItem")).SelectedValue));

        orderLocTrans.UnitQty = decimal.Parse(((TextBox)row.FindControl("tbUnitQty")).Text.Trim());
        Item item = TheItemMgr.LoadItem(((Controls_TextBox)row.FindControl("tbItem")).Text.Trim());

        if (item != null)
        {
            orderLocTrans.Item = item;
            orderLocTrans.Uom  = item.Uom;
        }
        orderLocTrans.OrderedQty = decimal.Parse(((TextBox)row.FindControl("tbOrderdQty")).Text.Trim());

        if (orderLocTrans.OrderedQty == 0)
        {
            orderLocTrans.OrderedQty = orderLocTrans.UnitQty * orderLocTrans.OrderDetail.OrderedQty;
        }
        if (!this.IsReuse && this.IsScrap)
        {
            orderLocTrans.Location = orderLocTrans.OrderDetail.DefaultLocationFrom;
        }
        else
        {
            Controls_TextBox tbLocation = (Controls_TextBox)row.FindControl("tbLocation");
            if (tbLocation.Text.Trim() != string.Empty)
            {
                orderLocTrans.Location = TheLocationMgr.LoadLocation(tbLocation.Text.Trim());
            }
        }

        orderLocTrans.NeedPrint = ((CheckBox)row.FindControl("cbNeedPrint")).Checked;

        orderLocTrans.IsAssemble      = true;
        orderLocTrans.IOType          = this.IOType;
        orderLocTrans.IsBlank         = false;
        orderLocTrans.TransactionType = BusinessConstants.CODE_MASTER_LOCATION_TRANSACTION_TYPE_VALUE_ISS_WO;

        try
        {
            TheOrderMgr.AddOrderLocationTransaction(orderLocTrans, this.CurrentUser);
            ShowSuccessMessage("MasterData.Order.LocTrans.Add.Successfully");
            UpdateRoutingEvent(this.OrderNo, e);
            UpdateView();
        }
        catch (BusinessErrorException ex)
        {
            ShowErrorMessage(ex);
        }
    }