예제 #1
0
        public static bool Delete(ISession session, string orderNumber)
        {
            StockInHead head = StockInHead.Retrieve(session, orderNumber);

            if (head == null)
            {
                return(false);
            }
            return(head.Delete(session));
        }
예제 #2
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");
        }