コード例 #1
0
 private void showInfo(ISession session, StockInHead head)
 {
     User user;
     if (head != null)
     {
         this.txtOrderNumber.Text = head.OrderNumber;
         this.txtNote.Text = head.Note;
         this.drpLocation.SelectedValue = head.LocationCode;
         OrderStatusDef statusDef = OrderStatusDef.Retrieve(session, head.OrderTypeCode, (int)head.Status);
         if (statusDef != null) this.lblStatus.Text = statusDef.StatusText;
         if (head.CreateUser > 0)
         {
             user = Magic.Sys.User.Retrieve(session, head.CreateUser);
             if (user != null) this.lblUser.Text = user.FullName;
         }
         this.lblCreateTime.Text = RenderUtil.FormatDatetime(head.CreateTime);
         this.lblApproveResult.Text = ERPUtil.EnumText<ApproveStatus>(head.ApproveResult);
         switch (head.ApproveResult)
         {
             case ApproveStatus.Reject: this.lblApproveResult.ForeColor = System.Drawing.Color.Red; break;
             case ApproveStatus.Approve: this.lblApproveResult.ForeColor = System.Drawing.Color.Blue; break;
         }
         if (head.ApproveResult == ApproveStatus.Approve || head.ApproveResult == ApproveStatus.Reject)
         {
             if (head.ApproveUser > 0)
             {
                 user = Magic.Sys.User.Retrieve(session, head.ApproveUser);
                 if (user != null) this.lblApproveUser.Text = user.FullName;
             }
             this.lblApproveTime.Text = RenderUtil.FormatDatetime(head.ApproveTime);
         }
         this.txtApproveNote.Text = head.ApproveNote;
     }
 }
コード例 #2
0
 private void setView(StockInHead head)
 {
     WebUtil.DisableControl(this.txtNote);
     WebUtil.DisableControl(this.drpLocation);
     this.cmdDetail.Visible = true;
     this.cmdDetail["Detail"].NavigateUrl = "ProductInLine.aspx?ordNum=" + this.OrderNumber + "&return=" + WebUtil.escape(this.ReturnUrl);
     this.cmdReturn["Return"].NavigateUrl = this.ReturnUrl;
 }
コード例 #3
0
ファイル: StockInHead.cs プロジェクト: XtremeKevinChow/rdroad
        public static bool Delete(ISession session, string orderNumber)
        {
            StockInHead head = StockInHead.Retrieve(session, orderNumber);

            if (head == null)
            {
                return(false);
            }
            return(head.Delete(session));
        }
コード例 #4
0
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName == "Save")
        {
            using (ISession session = new Session())
            {
                StockInHead head = null;
                if (this.IsNew)
                {
                    head = new StockInHead();
                    head.OrderTypeCode = StockInHead.ORD_TYPE_PRD_IN;
                    head.Status = StockInStatus.New;
                    head.ApproveResult = ApproveStatus.UnApprove;
                    head.ApproveUser = 0;
                    head.ApproveTime = new DateTime(1900, 1, 1);
                    head.CreateUser = SecuritySession.CurrentUser.UserId;
                    head.CreateTime = DateTime.Now;
                    head.Note = this.txtNote.Text.Trim();
                    head.LocationCode = this.drpLocation.SelectedValue;
                    head.RefOrdNum = this.txtRefOrdNum.Text.Trim().ToUpper();
                    try
                    {
                        session.BeginTransaction();
                        head.OrderNumber = ERPUtil.NextOrderNumber(head.OrderTypeCode);
                        head.Create(session);
                        head.AddPrdOutDetail2ThisOrder(session);
                        session.Commit();
                    }
                    catch (Exception er)
                    {
                        session.Rollback();
                        WebUtil.ShowError(this, er);
                    }

                    this.Response.Redirect("ProductInLine.aspx?ordNum=" + head.OrderNumber + "&return=" + WebUtil.escape(WebUtil.Param("return")));
                    return;
                }

                head = StockInHead.Retrieve(session, this.OrderNumber);
                head.Note = this.txtNote.Text.Trim();
                head.LocationCode = this.drpLocation.SelectedValue;
                head.RefOrdNum = this.txtRefOrdNum.Text.Trim().ToUpper();
                head.Update(session, "Note", "LocationCode", "RefOrdNum");
                //没有明细时,才考虑将库存领用明细添加进来
                if (session.CreateEntityQuery<StockInLine>()
                    .Where(Magic.Framework.ORM.Query.Exp.Eq("OrderNumber", head.OrderNumber))
                    .Count() <= 0)
                    head.AddPrdOutDetail2ThisOrder(session);
                this.Response.Redirect("ProductInLine.aspx?ordNum=" + head.OrderNumber + "&return=" + WebUtil.escape(WebUtil.Param("return")));
            }
        }
    }
コード例 #5
0
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName == "Save")
        {
            using (ISession session = new Session())
            {
                StockInHead head = null;
                if (this.IsNew)
                {
                    head = new StockInHead();
                    head.OrderTypeCode = StockInHead.ORD_TYPE_ASSIST_IN;
                    head.Status = StockInStatus.New;
                    head.ApproveResult = ApproveStatus.UnApprove;
                    head.ApproveUser = 0;
                    head.ApproveTime = new DateTime(1900, 1, 1);
                    head.CreateUser = SecuritySession.CurrentUser.UserId;
                    head.CreateTime = DateTime.Now;
                    head.Note = this.txtNote.Text.Trim();
                    head.LocationCode = this.drpLocation.SelectedValue;
                    try
                    {
                        session.BeginTransaction();
                        head.OrderNumber = ERPUtil.NextOrderNumber(head.OrderTypeCode);
                        head.Create(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}创建成功", head.OrderNumber));
                    }
                    catch (Exception er)
                    {
                        session.Rollback();
                        WebUtil.ShowError(this, er);
                    }

                    return;
                }

                head = StockInHead.Retrieve(session, this.OrderNumber);
                head.Note = this.txtNote.Text.Trim();
                head.LocationCode = this.drpLocation.SelectedValue;
                head.Update(session, "Note", "LocationCode");
                WebUtil.ShowMsg(this, "保存成功");
            }
        }
    }
コード例 #6
0
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName == "Save")
        {
            using (ISession session = new Session())
            {
                StockInHead head = null;
                if (this.IsNew)
                {
                    head = new StockInHead();
                    head.OrderTypeCode = StockInHead.ORD_TYPE_PRD_OUT;
                    head.Status = StockInStatus.New;
                    head.ApproveResult = ApproveStatus.UnApprove;
                    head.ApproveUser = 0;
                    head.ApproveTime = new DateTime(1900, 1, 1);
                    head.CreateUser = SecuritySession.CurrentUser.UserId;
                    head.CreateTime = DateTime.Now;
                    head.Note = this.txtNote.Text.Trim();
                    head.Responsible = this.txtResponsible.Text.Trim();
                    head.LocationCode = this.drpLocation.SelectedValue;
                    try
                    {
                        session.BeginTransaction();
                        head.OrderNumber = ERPUtil.NextOrderNumber(head.OrderTypeCode);
                        head.Create(session);
                        session.Commit();
                    }
                    catch (Exception er)
                    {
                        session.Rollback();
                        WebUtil.ShowError(this, er);
                    }

                    this.Response.Redirect("ProductOutNewLine.aspx?ordNum=" + head.OrderNumber + "&return=" + WebUtil.escape("ProductOutLine.aspx?ordNum=" + head.OrderNumber + "&return=" + WebUtil.escape(WebUtil.Param("return"))));
                    return;
                }

                head = StockInHead.Retrieve(session, this.OrderNumber);
                head.Responsible = this.txtResponsible.Text.Trim();
                head.Note = this.txtNote.Text.Trim();
                head.LocationCode = this.drpLocation.SelectedValue;
                head.Update(session, "Note", "LocationCode");
                this.Response.Redirect("ProductOutLine.aspx?ordNum=" + head.OrderNumber + "&return=" + WebUtil.escape(WebUtil.Param("return")));
            }
        }
    }
コード例 #7
0
        //将产品领用单明细添加到产品入库单中
        public void AddPrdOutDetail2ThisOrder(ISession session)
        {
            if (this.OrderTypeCode != ORD_TYPE_PRD_IN)
            {
                throw new Exception("只有产品入库单可以执行该方法");
            }
            if (string.IsNullOrEmpty(this.RefOrdNum) || this.RefOrdNum.Trim().Length <= 0)
            {
                return;
            }
            StockInHead refHead = StockInHead.Retrieve(session, this.RefOrdNum);

            if (refHead == null)
            {
                throw new Exception("");
            }
            IList <StockInLine> refLines = session.CreateEntityQuery <StockInLine>()
                                           .Where(Exp.Eq("OrderNumber", this.RefOrdNum))
                                           .List <StockInLine>();

            if (refLines.Count <= 0)
            {
                return;
            }
            foreach (StockInLine refLine in refLines)
            {
                StockInLine line = new StockInLine();
                line.OrderNumber   = this.OrderNumber;
                line.LineNumber    = this.NextLineNumber();
                line.LocationCode  = refLine.LocationCode;
                line.AreaCode      = refLine.AreaCode;
                line.SectionCode   = refLine.SectionCode;
                line.StockDetailID = refLine.StockDetailID;
                line.SKUID         = refLine.SKUID;
                line.Quantity      = refLine.Quantity;
                line.Price         = refLine.Price;
                line.RefQuantity   = 0M;
                line.UnitID        = 0;
                line.Create(session);
            }
            this.Update(session, "CurrentLineNumber");
        }
コード例 #8
0
 private void SetView(StockInHead head)
 {
     switch (head.Status)
     {
         case StockInStatus.New:
             this.cmdEdit1.Visible = true;
             this.cmdEdit2.Visible = true;
             this.cmdClose1.Visible = false;
             this.cmdClose2.Visible = false;
             break;
         case StockInStatus.Release:
             this.cmdEdit1.Visible = false;
             this.cmdEdit2.Visible = false;
             this.cmdClose1.Visible = false;
             this.cmdClose2.Visible = false;
             break;
         case StockInStatus.Open:
             this.cmdEdit1.Visible = false;
             this.cmdEdit2.Visible = false;
             this.cmdClose1.Visible = true;
             this.cmdClose2.Visible = true;
             break;
         case StockInStatus.Close:
             this.cmdEdit1.Visible = false;
             this.cmdEdit2.Visible = false;
             this.cmdClose1.Visible = false;
             this.cmdClose2.Visible = false;
             break;
     }
 }
コード例 #9
0
 private void QueryAndBindData(ISession session, StockInHead head)
 {
     this.repeatControl.DataSource = session.CreateObjectQuery(@"
     select l.LineNumber as LineNumber,s.BarCode as BarCode,m.ItemCode as ItemCode,m.ItemName as ItemName
     ,s.ColorCode as ColorCode,s.SizeCode as SizeCode,color.ColorText as ColorText
     ,l.AreaCode as AreaCode,l.SectionCode as SectionCode,l.Quantity as Quantity,l.Price as Price
     from StockInLine l
     inner join ItemSpec s on l.SKUID=s.SKUID
     inner join ItemMaster m on m.ItemID=s.ItemID
     left join ItemColor color on color.ColorCode=s.ColorCode
     where l.OrderNumber=?ordNum
     order by l.LineNumber")
         .Attach(typeof(StockInLine)).Attach(typeof(ItemSpec)).Attach(typeof(ItemMaster)).Attach(typeof(ItemColor))
         .SetValue("?ordNum", this.OrderNumber, "l.OrderNumber")
         .DataSet();
     this._session = session;
     this._head = head;
     this.repeatControl.DataBind();
     this._head = null;
     this._session = null;
 }
コード例 #10
0
 private void setView(StockInHead head)
 {
     if (this.IsNew)
         this.cmdDetail.Visible = false;
     else
     {
         if (head != null && head.Status != StockInStatus.New)
         {
             WebUtil.DisableControl(this.txtNote);
             WebUtil.DisableControl(this.drpLocation);
             WebUtil.DisableControl(this.txtResponsible);
             this.cmdEdit.Visible = false;
         }
         this.cmdDetail.Visible = true;
         this.cmdDetail["Detail"].NavigateUrl = "ProductOutLine.aspx?ordNum=" + this.OrderNumber + "&return=" + WebUtil.escape(this.ReturnUrl);
     }
     this.cmdReturn["Return"].NavigateUrl = this.ReturnUrl;
 }
コード例 #11
0
 private void SetView(StockInHead head)
 {
     switch (head.Status)
     {
         case StockInStatus.Confirm:
             this.cmdEdit1.Visible = true;
             this.cmdEdit2.Visible = true;
             break;
         default:
             this.cmdEdit1.Visible = false;
             this.cmdEdit2.Visible = false;
             break;
     }
 }
コード例 #12
0
    private void Save(ISession session, StockInHead head)
    {
        if (head == null) return;

        IList<StockInLine> linesToSave = new List<StockInLine>();
        foreach (RepeaterItem item in this.repeatControl.Items)
        {
            HtmlInputHidden txt = item.FindControl("hidLine") as HtmlInputHidden;
            TextBox text;
            StockInLine line = StockInLine.Retrieve(session, this.OrderNumber, txt.Value);
            text = item.FindControl("txtPrice") as TextBox;
            line.Price = Cast.Decimal(text.Text, line.Price);
            linesToSave.Add(line);
        }

        head.UpdatePrice(session, linesToSave);
    }
コード例 #13
0
 private void Confirm(ISession session, StockInHead head)
 {
     if (head == null) return;
     head.Confirm(session);
 }
コード例 #14
0
 private void setView(StockInHead head)
 {
     if (this.IsNew)
         this.cmdDetail.Visible = false;
     else
     {
         if (head != null && head.Status != StockInStatus.New)
         {
             WebUtil.DisableControl(this.txtNote);
             WebUtil.DisableControl(this.drpLocation);
             this.cmdEdit.Visible = false;
         }
         this.cmdDetail.Visible = true;
         this.cmdDetail["Detail"].NavigateUrl = "AssistItemOutLine.aspx?ordNum=" + this.OrderNumber + "&return=" + Microsoft.JScript.GlobalObject.escape(this.ReturnUrl);
     }
     this.cmdReturn["Return"].NavigateUrl = this.ReturnUrl;
 }