Пример #1
0
        public static RCVHead CreatePurchaseRCV(ISession session, int userId, string poNumber, string note)
        {
            RCVHead head = new RCVHead();
            head._refOrderType = head._originalOrderType = POHead.ORDER_TYPE;
            head._refOrderNumber = head._orginalOrderNumber = poNumber.Trim().ToUpper();
            #region ���
            //��ʱ������ɹ��ջ����������òɹ������ķ�ʽ
            if (string.IsNullOrEmpty(head._refOrderNumber))
                throw new Exception("�ɹ�����Ϊ��");
            POHead po = POHead.Retrieve(session, head._refOrderNumber);
            if (po == null)
                throw new Exception(string.Format("�ɹ�����{0}������", head._refOrderNumber));
            if (po.Status != POStatus.Release)
                throw new Exception(string.Format("�ɹ�����{0}���Ƿ���״̬�������Խ����ջ���ҵ", head._refOrderNumber));
            if (po.ApproveResult != ApproveStatus.Approve)
                throw new Exception(string.Format("�ɹ�����{0}��û�����ǩ�ˣ������Խ����ջ���ҵ", head._refOrderNumber));
            #endregion
            head._orderTypeCode = RCVHead.ORD_TYPE_PUR;
            head._orderNumber = ERPUtil.NextOrderNumber(head._orderTypeCode);
            head._objectID = po.VendorID;
            head._locationCode = po.LocationCode;
            head._createUser = userId;
            head._note = note.Trim();
            EntityManager.Create(session, head);

            return head;
        }
Пример #2
0
 public static void Close(RCVHead head)
 {
     try
     {
         using (ISession session = new Session())
         {
             try
             {
                 session.BeginTransaction();
                 head.Close(session, false);
                 session.Commit();
             }
             catch (Exception er1)
             {
                 session.Rollback();
                 log.Error(string.Format("收货单{0}签核完成,自动关闭时发生异常", head.OrderNumber), er1);
                 return;
             }
         }
     }
     catch (Exception er)
     {
         log.Error(string.Format("收货单{0}签核完成,自动关闭时发生异常,无法连接数据库", head.OrderNumber), er);
         return;
     }
 }
Пример #3
0
 public static void Close(RCVHead head)
 {
     try
     {
         using (ISession session = new Session())
         {
             try
             {
                 session.BeginTransaction();
                 head.Close(session, false);
                 session.Commit();
             }
             catch (Exception er1)
             {
                 session.Rollback();
                 log.Error(string.Format("�ջ���{0}ǩ����ɣ��Զ��ر�ʱ�����쳣", head.OrderNumber), er1);
                 return;
             }
         }
     }
     catch (Exception er)
     {
         log.Error(string.Format("�ջ���{0}ǩ����ɣ��Զ��ر�ʱ�����쳣���޷��������ݿ�", head.OrderNumber), er);
         return;
     }
 }
Пример #4
0
        public static RCVHead CreatePurchaseRCV(ISession session, int userId, string poNumber, string note)
        {
            RCVHead head = new RCVHead();

            head._refOrderType   = head._originalOrderType = POHead.ORDER_TYPE;
            head._refOrderNumber = head._orginalOrderNumber = poNumber.Trim().ToUpper();
            #region 检查
            //暂时不允许采购收货,但不引用采购订单的方式
            if (string.IsNullOrEmpty(head._refOrderNumber))
            {
                throw new Exception("采购订单为空");
            }
            POHead po = POHead.Retrieve(session, head._refOrderNumber);
            if (po == null)
            {
                throw new Exception(string.Format("采购订单{0}不存在", head._refOrderNumber));
            }
            if (po.Status != POStatus.Release)
            {
                throw new Exception(string.Format("采购订单{0}不是发布状态,不可以进行收货作业", head._refOrderNumber));
            }
            if (po.ApproveResult != ApproveStatus.Approve)
            {
                throw new Exception(string.Format("采购订单{0}还没有完成签核,不可以进行收货作业", head._refOrderNumber));
            }
            #endregion
            head._orderTypeCode = RCVHead.ORD_TYPE_PUR;
            head._orderNumber   = ERPUtil.NextOrderNumber(head._orderTypeCode);
            head._objectID      = po.VendorID;
            head._locationCode  = po.LocationCode;
            head._createUser    = userId;
            head._note          = note.Trim();
            EntityManager.Create(session, head);

            return(head);
        }
Пример #5
0
        public static bool Delete(ISession session, string orderNumber)
        {
            RCVHead head = RCVHead.Retrieve(session, orderNumber);

            return(head.Delete(session));
        }
 private void showInfo(ISession session, RCVHead head)
 {
     User user;
     if (head != null)
     {
         this.txtOrderNumber.Text = head.OrderNumber;
         this.txtPONumber.Value = head.RefOrderNumber;
         if (head.ObjectID > 0)
         {
             Vendor ven = Vendor.Retrieve(session, head.ObjectID);
             if (ven != null) this.lblVendor.Text = ven.ShortName;
         }
         this.txtNote.Text = head.Note;
         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;
     }
 }
    private void setView(RCVHead head)
    {
        if (this.IsNew)
            this.cmdDetail.Visible = false;
        else
        {
            WebUtil.DisableControl(this.txtPONumber);
            this.cmdSelectPO.Visible = false;
            this.trAutoCreate.Visible = false;

            this.cmdDetail.Visible = true;
            this.cmdDetail["Detail"].NavigateUrl = "PurchaseRCVLine.aspx?ordNum=" + this.OrderNumber + "&return=" + Microsoft.JScript.GlobalObject.escape(this.ReturnUrl);
            if (head != null && head.Status != ReceiveStatus.New)
            {
                this.cmdEdit.Visible = false;
                WebUtil.DisableControl(this.txtNote);
            }
        }
        this.trAutoCreate.Visible = false;
        this.cmdReturn["Return"].NavigateUrl = this.ReturnUrl;
    }
 private void SetView(RCVHead head)
 {
     switch (head.Status)
     {
         case ReceiveStatus.New:
             this.cmdEdit1.Visible = true;
             this.cmdEdit2.Visible = true;
             this.cmdClose1.Visible = false;
             this.cmdClose2.Visible = false;
             this.cmdPrint1.Visible = false;
             this.cmdPrint2.Visible = false;
             break;
         case ReceiveStatus.Release:
             this.cmdEdit1.Visible = false;
             this.cmdEdit2.Visible = false;
             this.cmdClose1.Visible = false;
             this.cmdClose2.Visible = false;
             this.cmdPrint1.Visible = true;
             this.cmdPrint2.Visible = true;
             break;
         case ReceiveStatus.Open:
             this.cmdEdit1.Visible = false;
             this.cmdEdit2.Visible = false;
             this.cmdClose1.Visible = true;
             this.cmdClose2.Visible = true;
             this.cmdPrint1.Visible = true;
             this.cmdPrint2.Visible = true;
             break;
         case ReceiveStatus.Close:
             this.cmdEdit1.Visible = false;
             this.cmdEdit2.Visible = false;
             this.cmdClose1.Visible = false;
             this.cmdClose2.Visible = false;
             this.cmdPrint1.Visible = true;
             this.cmdPrint2.Visible = true;
             break;
     }
 }
 private void QueryAndBindData(ISession session, RCVHead head)
 {
     this.repeatControl.DataSource = session.CreateObjectQuery(@"
     select l.LineNumber as LineNumber,l.RefOrderLine as RefOrderLine
     ,s.BarCode as BarCode,m.ItemCode as ItemCode,m.ItemName as ItemName,s.ColorCode as ColorCode,color.ColorText as ColorText,s.SizeCode as SizeCode
     ,l.AreaCode as AreaCode,l.SectionCode as SectionCode,l.RCVTotalQty as RCVTotalQty,l.QualifiedQty as QualifiedQty
     from RCVLine 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(RCVLine)).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
 /// <summary>
 /// 签核完成后的处理
 /// </summary>
 /// <param name="session"></param>
 void IApprovable.PostApprove(ISession session)
 {
     //TODO: 是否使用配置控制这个行为
     RCVHead.Close(this); //使用新的session完成关闭操作,避免关闭操作发生异常时造成签核处理无法完成
 }