Esempio n. 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         this.txtRCVNumber.Value = this.OrderNumber;
         if (log.IsDebugEnabled)
         {
             log.Debug("PageLoad - rcv line: ordNum=" + this.OrderNumber + " return=" + WebUtil.Param("return"));
             log.Debug("url for scan to return: " + "PurchaseRCVLine.aspx?ordNum=" + this.OrderNumber + "&return=" + WebUtil.escape(WebUtil.Param("return")));
         }
         this.txtReturnUrl.Value = "PurchaseRCVLine.aspx?ordNum=" + this.OrderNumber + "&return=" + WebUtil.escape(WebUtil.Param("return"));
         this.cmdReturn1["Return"].NavigateUrl = this.cmdReturn2["Return"].NavigateUrl = WebUtil.Param("return");
         using (ISession session = new Session())
         {
             RCVHead head = RCVHead.Retrieve(session, this.OrderNumber);
             this.txtStatus.Value = head.Status.ToString();
             this.SetView(head);
             if (!string.IsNullOrEmpty(head.RefOrderNumber) && head.RefOrderNumber.Trim().Length > 0)
             {
                 this.txtPONumber.Value = head.RefOrderNumber;
             }
             this.QueryAndBindData(session, head);
         }
     }
 }
Esempio n. 2
0
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName == "Save")
        {
            using (ISession session = new Session())
            {
                RCVHead head = null;
                if (this.IsNew)
                {
                    int lineCount = 0;
                    try
                    {
                        session.BeginTransaction();
                        head = RCVHead.CreatePurchaseRCV(session, SecuritySession.CurrentUser.UserId, this.txtPONumber.Value, this.txtNote.Text);
                        if (this.rdoAutoCreateLines.Checked)
                        {
                            lineCount = head.AddLinesFromRefOrder(session);
                        }
                        session.Commit();

                        this.txtAction.Value = "edit";
                        this.txtId.Value     = head.OrderNumber;
                        this.showInfo(session, head);
                        this.setView(head);
                        WebUtil.ShowMsg(this, string.Format("收货单{0}创建成功{1}", head.OrderNumber, this.rdoAutoCreateLines.Checked ? ",自动创建了" + lineCount.ToString() + "个收货明细" : ""));
                    }
                    catch (Exception er)
                    {
                        session.Rollback();
                        WebUtil.ShowError(this, er);
                    }

                    return;
                }

                head      = RCVHead.Retrieve(session, this.OrderNumber);
                head.Note = this.txtNote.Text.Trim();
                head.Update(session, "Note");
                WebUtil.ShowMsg(this, "保存成功");
            }
        }
    }
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        using (ISession session = new Session())
        {
            bool deleted = false;
            try
            {
                session.BeginTransaction();
                foreach (RepeaterItem item in this.repeatControl.Items)
                {
                    HtmlInputCheckBox chk = item.FindControl("checkbox") as HtmlInputCheckBox;
                    if (chk.Checked && chk.Value.Trim().Length > 0)
                    {
                        RCVHead head = RCVHead.Retrieve(session, chk.Value.Trim());
                        if (head == null || head.Status != ReceiveStatus.New)
                        {
                            continue;
                        }

                        head.Delete(session);
                        session.CreateEntityQuery <RCVLine>()
                        .Where(Exp.Eq("OrderNumber", head.OrderNumber))
                        .Delete();
                        deleted = true;
                    }
                }

                session.Commit();
                if (deleted)
                {
                    WebUtil.ShowMsg(this, "选择的收货单已经删除");
                    this.QueryAndBindData(session, this.magicPagerMain.CurrentPageIndex, this.magicPagerMain.PageSize, true);
                }
            }
            catch (Exception er)
            {
                session.Rollback();
                WebUtil.ShowError(this, er);
            }
        }
    }
Esempio n. 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            this.txtAction.Value = WebUtil.Param("mode");
            this.txtId.Value     = WebUtil.Param("ordNumber");

            RCVHead head = null;
            using (ISession session = new Session())
            {
                if (!this.IsNew)
                {
                    head = RCVHead.Retrieve(session, this.OrderNumber);
                    this.showInfo(session, head);
                }
                else
                {
                    //this.rdoAutoCreateLines.Checked = true;
                }
            }
            this.setView(head);
        }
    }
Esempio n. 5
0
    //弹出选择框,手工选择采购订单明细进行收货的方式
    //这种方式暂时废弃不用
    protected void cmdAddLines_Click(object sender, EventArgs e)
    {
        string[] linesArray = this.txtPOLines.Value.Trim().Trim(';').Split(';');
        if (linesArray == null || linesArray.Length <= 0)
        {
            return;
        }

        using (ISession session = new Session())
        {
            RCVHead head = RCVHead.Retrieve(session, this.OrderNumber);
            try
            {
                session.BeginTransaction();
                foreach (string s in linesArray)
                {
                    POLine poLine = null;
                    if (!string.IsNullOrEmpty(s) && s.Trim().Length > 0)
                    {
                        poLine = POLine.Retrieve(session, head.RefOrderNumber, s);
                    }
                    if (poLine != null)
                    {
                        head.AddLine(session, poLine);
                    }
                }
                head.Update(session, "CurrentLineNumber");
                session.Commit();
            }
            catch (Exception er)
            {
                session.Rollback();
                WebUtil.ShowError(this, er);
            }
            this.QueryAndBindData(session, head);
        }
    }
Esempio n. 6
0
        internal static IApprovable GetApproveItem(ISession session, string orderType, string orderNumber)
        {
            switch (orderType)
            {
            case POHead.ORDER_TYPE:     //采购订单
                return(POHead.Retrieve(session, orderNumber));

            case RCVHead.ORD_TYPE_PUR:           //采购收货
                return(RCVHead.Retrieve(session, orderNumber));

            case POReturnHead.ORD_TYPE_CODE:     //采购退货
                return(POReturnHead.Retrieve(session, orderNumber));

            case ICHead.ORDER_TYPE:     //交接单
                return(ICHead.Retrieve(session, orderNumber));

            case INVCheckHead.ORDER_TYPE_ADJ:     //库存调整单
            case INVCheckHead.ORDER_TYPE_CHK:     //库房盘点
                return(INVCheckHead.Retrieve(session, orderNumber));

            case StockInHead.ORD_TYPE_ASSIST_IN:         //辅料入库
            case StockInHead.ORD_TYPE_ASSIST_OUT:        //辅料领用
            case StockInHead.ORD_TYPE_PRD_IN:            //产品入库
            case StockInHead.ORD_TYPE_PRD_OUT:           //产品领用
                return(StockInHead.Retrieve(session, orderNumber));

            case ReturnHead.ORDER_TYPE_MBR_RTN:       //会员退货
            case ReturnHead.ORDER_TYPE_LOGISTICS_RTN: //物流退货
            case ReturnHead.ORDER_TYPE_INNER_RTN:     //内部退货
            case ReturnHead.ORDER_TYPE_EXCHANGE_RTN:  //会员换货
                return(ReturnHead.Retrieve(session, orderNumber));

            case WHTransferHead.ORDER_TYPE_NORMAL:     //移库单
                return(WHTransferHead.Retrieve(session, orderNumber));
            }
            throw new Exception(string.Format("Order type {0} is not a registered approvable item", orderType));
        }
Esempio n. 7
0
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName == "Save")
        {
            #region 保存
            //这个功能也暂时废弃不用,因为采用扫描入库方式,并且需要控制货架、库位容量
            IList <RCVLine> linesToSave = new List <RCVLine>();
            foreach (RepeaterItem item in this.repeatControl.Items)
            {
                HtmlInputCheckBox chk = item.FindControl("checkbox") as HtmlInputCheckBox;
                TextBox           text;
                RCVLine           line = new RCVLine();
                line.OrderNumber  = this.OrderNumber;
                line.LineNumber   = chk.Value.Trim();
                text              = item.FindControl("txtQualifiedQty") as TextBox;
                line.QualifiedQty = Cast.Decimal(text.Text.Trim());
                line.RCVTotalQty  = line.QualifiedQty;

                linesToSave.Add(line);
            }

            using (ISession session = new Session())
            {
                try
                {
                    //检查
                    RCVHead head = RCVHead.Retrieve(session, this.OrderNumber);
                    if (head == null)
                    {
                        return;
                    }
                    head.UpdateLines(session, linesToSave);
                    WebUtil.ShowMsg(this, "保存成功");
                }
                catch (Exception er)
                {
                    WebUtil.ShowError(this, er);
                }
            }
            #endregion
        }
        else if (e.CommandName == "Delete")
        {
            #region  除
            using (ISession session = new Session())
            {
                IList <RCVLine> linesToDelete = new List <RCVLine>();
                foreach (RepeaterItem item in this.repeatControl.Items)
                {
                    HtmlInputCheckBox chk = item.FindControl("checkbox") as HtmlInputCheckBox;
                    if (chk.Checked)
                    {
                        RCVLine line = RCVLine.Retrieve(session, this.OrderNumber, chk.Value.Trim());
                        if (line != null)
                        {
                            linesToDelete.Add(line);
                        }
                    }
                }

                try
                {
                    //检查
                    RCVHead head = RCVHead.Retrieve(session, this.OrderNumber);
                    if (head == null)
                    {
                        return;
                    }
                    session.BeginTransaction();
                    head.DeleteLines(session, linesToDelete);
                    session.Commit();
                    this.QueryAndBindData(session, head);
                    WebUtil.ShowMsg(this, "选择的明细已经删除");
                }
                catch (Exception er)
                {
                    session.Rollback();
                    WebUtil.ShowError(this, er);
                }
            }
            #endregion
        }
        else if (e.CommandName == "Release")
        {
            #region 发布
            using (ISession session = new Session())
            {
                try
                {
                    session.BeginTransaction();
                    RCVHead head = RCVHead.Retrieve(session, this.OrderNumber);
                    head.Release(session);
                    session.Commit();
                    WebUtil.ShowMsg(this, "发布成功");
                    this.QueryAndBindData(session, head);
                    this.SetView(head);
                }
                catch (Exception er)
                {
                    session.Rollback();
                    WebUtil.ShowError(this, er);
                }
            }
            #endregion
        }
        else if (e.CommandName == "Close")
        {
            #region 关闭
            using (ISession session = new Session())
            {
                try
                {
                    RCVHead head = RCVHead.Retrieve(session, this.OrderNumber);
                    session.BeginTransaction();
                    head.Close(session, true);
                    session.Commit();
                    WebUtil.ShowMsg(this, "发布成功");
                    this.QueryAndBindData(session, head);
                    this.SetView(head);
                }
                catch (Exception er)
                {
                    session.Rollback();
                    WebUtil.ShowError(this, er);
                }
            }
            #endregion
        }
    }