Example #1
0
        public void AddLine(ISession session, CRMSN sn)
        {
            if (sn == null)
            {
                return;
            }
            if (sn.Status != CRMSNStatus.Checked && sn.Status != CRMSNStatus.Packaged)
            {
                throw new Exception("只有已经核货、包装的发货单才能进行交接");
            }
            if (this.LogisticCompID != sn.LogisticsID)
            {
                throw new Exception("发货单包装时选择的物流公司与交接单的物流公司不同");
            }
            IList <ICHead> icHeads = session.CreateObjectQuery(@"
select 1 from ICHead h inner join ICLine l on h.OrderNumber=l.OrderNumber
where l.RefOrderNumber=?snno
")
                                     .Attach(typeof(ICHead)).Attach(typeof(ICLine))
                                     .And(Exp.In("h.Status", InterchangeStatus.New, InterchangeStatus.Release, InterchangeStatus.Open))
                                     .SetValue("?snno", sn.OrderNumber, "l.RefOrderNumber")
                                     .List <ICHead>();

            if (icHeads != null && icHeads.Count > 0)
            {
                throw new Exception("发货单" + sn.OrderNumber + "已经加入到交接单" + icHeads[0].OrderNumber + "中了");
            }
            ICLine line = new ICLine();

            line.OrderNumber    = this.OrderNumber;
            line.LineNumber     = this.NextLineNumber();
            line.OrderTypeCode  = " ";
            line.RefOrderNumber = sn.OrderNumber;
            line.Create(session);
        }
Example #2
0
        public void AutoGenerateDetail(ISession session)
        {
            if (this.Status != InterchangeStatus.New)
            {
                throw new Exception("发货单不是新建状态,无法修改");
            }
            if (this.LogisticCompID <= 0)
            {
                throw new Exception("交接单上的物流公司无效");
            }
            IList <CRMSN> sns = CRMSN.InterchangableList(session, this.LogisticCompID);

            foreach (CRMSN sn in sns)
            {
                ICLine line = new ICLine();
                line.OrderNumber    = this.OrderNumber;
                line.LineNumber     = this.NextLineNumber();
                line.OrderTypeCode  = " ";
                line.RefOrderNumber = sn.OrderNumber;
                line.Create(session);
            }
        }
Example #3
0
 public void AddLine(ISession session, CRMSN sn)
 {
     if (sn == null) return;
     if (sn.Status != CRMSNStatus.Checked && sn.Status != CRMSNStatus.Packaged)
         throw new Exception("ֻ���Ѿ��˻�����װ�ķ��������ܽ��н���");
     if (this.LogisticCompID != sn.LogisticsID)
         throw new Exception("��������װʱѡ���������˾�뽻�ӵ���������˾��ͬ");
     IList<ICHead> icHeads = session.CreateObjectQuery(@"
     select 1 from ICHead h inner join ICLine l on h.OrderNumber=l.OrderNumber
     where l.RefOrderNumber=?snno
     ")
         .Attach(typeof(ICHead)).Attach(typeof(ICLine))
         .And(Exp.In("h.Status", InterchangeStatus.New, InterchangeStatus.Release, InterchangeStatus.Open))
         .SetValue("?snno", sn.OrderNumber, "l.RefOrderNumber")
         .List<ICHead>();
     if (icHeads != null && icHeads.Count > 0)
         throw new Exception("������" + sn.OrderNumber + "�Ѿ����뵽���ӵ�" + icHeads[0].OrderNumber + "����");
     ICLine line = new ICLine();
     line.OrderNumber = this.OrderNumber;
     line.LineNumber = this.NextLineNumber();
     line.OrderTypeCode = " ";
     line.RefOrderNumber = sn.OrderNumber;
     line.Create(session);
 }
Example #4
0
 public void AutoGenerateDetail(ISession session)
 {
     if (this.Status != InterchangeStatus.New)
         throw new Exception("�����������½�״̬���޷��޸�");
     if (this.LogisticCompID <= 0)
         throw new Exception("���ӵ��ϵ�������˾��Ч");
     IList<CRMSN> sns = CRMSN.InterchangableList(session, this.LogisticCompID);
     foreach (CRMSN sn in sns)
     {
         ICLine line = new ICLine();
         line.OrderNumber = this.OrderNumber;
         line.LineNumber = this.NextLineNumber();
         line.OrderTypeCode = " ";
         line.RefOrderNumber = sn.OrderNumber;
         line.Create(session);
     }
 }