コード例 #1
0
 private IList <WHArea> GetAreas()
 {
     if (this._session == null && this._areas == null)
     {
         return(new List <WHArea>());
     }
     if (this._areas == null)
     {
         this._areas = ERPUtil.GetWHArea(this._session, POReturnHead.ORD_TYPE_CODE, null);
     }
     return(this._areas);
 }
コード例 #2
0
 private IList <WHArea> GetAreas()
 {
     if (this._session == null && this._areas == null)
     {
         return(new List <WHArea>());
     }
     if (this._areas == null)
     {
         this._areas = ERPUtil.GetWHArea(this._session, StockInHead.ORD_TYPE_ASSIST_IN, null);
     }
     return(this._areas);
 }
コード例 #3
0
 private IList <WHArea> GetArea(ISession session)
 {
     if (session == null)
     {
         return(new List <WHArea>(0));
     }
     if (this._area == null)
     {
         this._area = ERPUtil.GetWHArea(session, WHTransferHead.ORDER_TYPE_NORMAL, "403", this._head.ToLocation);
     }
     return(this._area);
 }
コード例 #4
0
 private IList <WHArea> GetAreas()
 {
     if (this._session == null && this._areas == null)
     {
         return(new List <WHArea>());
     }
     if (this._areas == null)
     {
         this._areas = ERPUtil.GetWHArea(this._session, this._head == null ? "X" : this._head.OrderTypeCode, null);
     }
     return(this._areas);
 }
コード例 #5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         log.DebugFormat("PageLoad - to add assist item req line: ordNum={0}, return={1}", this.OrderNumber, WebUtil.Param("return"));
         this.toolbarTop["Return"].NavigateUrl = this.toolbarBottom["Return"].NavigateUrl = WebUtil.Param("return");
         using (ISession session = new Session())
         {
             StockInHead head = StockInHead.Retrieve(session, this.OrderNumber);
             this.drpArea.Items.Clear();
             this.drpArea.Items.Add(new ListItem("", ""));
             IList <WHArea> areas = ERPUtil.GetWHArea(session, StockInHead.ORD_TYPE_ASSIST_OUT, null, head.LocationCode);
             foreach (WHArea area in areas)
             {
                 this.drpArea.Items.Add(new ListItem(area.AreaCode, area.AreaCode));
             }
             this.QueryAndBindData(session, 1, this.magicPagerMain.PageSize, true);
         }
     }
 }
コード例 #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         log.DebugFormat("PageLoad - Ìí¼ÓÒÆ¿âÃ÷ϸ: ordNum={0}, return={1}", this.OrderNumber, WebUtil.Param("return"));
         this.toolbarTop["Return"].NavigateUrl = this.toolbarBottom["Return"].NavigateUrl = WebUtil.Param("return");
         using (ISession session = new Session())
         {
             WHTransferHead head = WHTransferHead.Retrieve(session, this.OrderNumber);
             this.drpArea.Items.Clear();
             this.drpArea.Items.Add(new ListItem("", ""));
             IList <WHArea> areas = ERPUtil.GetWHArea(session, WHTransferHead.ORDER_TYPE_NORMAL, "401", head.FromLocation);
             foreach (WHArea area in areas)
             {
                 this.drpArea.Items.Add(new ListItem(area.AreaCode, area.AreaCode));
             }
             this.QueryAndBindData(session, 1, this.magicPagerMain.PageSize, true);
         }
     }
 }
コード例 #7
0
        public void UpdateOrCreateLines(ISession session, IList <ReturnLine> toSave)
        {
            //确保换货退货不会执行该方法
            if (this.OrderTypeCode == ORDER_TYPE_EXCHANGE_RTN)
            {
                return;
            }

            log.DebugFormat("to create or save rtn lines, count:{0}", toSave == null ? 0 : toSave.Count);
            if (toSave == null || toSave.Count <= 0)
            {
                return;
            }
            if (this.Status != ReturnStatus.New)
            {
                throw new Exception("退货单不是新建状态,无法更新");
            }
            //物流退货、内部退货必须全退,不支持部分退货
            if (this.OrderTypeCode == ORDER_TYPE_LOGISTICS_RTN || this.OrderTypeCode == ORDER_TYPE_INNER_RTN)
            {
                int snLineCount = session.CreateEntityQuery <CRMSNLine>().Where(Exp.Eq("SNID", this.RefOrderID)).Count();
                if (snLineCount != toSave.Count)
                {
                    throw new Exception("发货单" + this.RefOrderNumber + "明细(" + snLineCount.ToString() + "项)与退货明细(" + toSave.Count.ToString() + "项)不一致");
                }
            }
            bool updateHeadLineNum = false;

            foreach (ReturnLine line in toSave)
            {
                if (line.RefOrderLineID <= 0 || line.Quantity <= 0M)
                {
                    if (this.OrderTypeCode == ORDER_TYPE_LOGISTICS_RTN || this.OrderTypeCode == ORDER_TYPE_INNER_RTN)
                    {
                        throw new Exception("退货明细或者数量无效");
                    }
                    continue;
                }
                bool checkCreate = true;
                if (this.OrderTypeCode == ORDER_TYPE_MBR_RTN)
                {
                    //会员退货才可以分多次扫描退货明细
                    ReturnLine existsLine = ReturnLine.Retrieve(session, this.OrderNumber, line.RefOrderLineID);
                    if (existsLine != null)
                    {
                        log.DebugFormat("rtn line({0}) exists, rtn qty:{1}", line.RefOrderLineID, line.Quantity);
                        existsLine.Quantity += line.Quantity;
                        existsLine.Update(session, "Quantity");
                        checkCreate = false;
                    }
                }
                if (checkCreate)
                {
                    CRMSNLine snline = CRMSNLine.Retrieve(session, line.RefOrderLineID);
                    if (snline == null)
                    {
                        throw new Exception("发货单明细" + line.RefOrderLineID.ToString() + "不存在");
                    }
                    //物流退货、内部退货必须全退
                    if ((this.OrderTypeCode == ORDER_TYPE_LOGISTICS_RTN || this.OrderTypeCode == ORDER_TYPE_INNER_RTN) &&
                        line.Quantity != snline.Quantity)
                    {
                        throw new Exception("退货数量不等于发货数量");
                    }
                    ReturnLine existsLine = new ReturnLine();
                    existsLine.OrderNumber     = this.OrderNumber;
                    existsLine.LineNumber      = this.NextLineNumber();
                    updateHeadLineNum          = true;
                    existsLine.RefOrderLineID  = snline.ID;
                    existsLine.SKUID           = snline.SKUID;
                    existsLine.TransTypeCode   = " ";
                    existsLine.Quantity        = line.Quantity;
                    existsLine.DeliverQuantity = snline.Quantity;
                    existsLine.Price           = snline.Price;
                    IList <WHArea> areas = ERPUtil.GetWHArea(session, this.OrderTypeCode, null, this.LocationCode);
                    if (areas.Count == 1)
                    {
                        existsLine.AreaCode = areas[0].AreaCode;
                    }
                    log.DebugFormat("to create rtn line, qty:{0}", line.Quantity);
                    existsLine.Create(session);
                }
            }
            if (updateHeadLineNum)
            {
                this.Update(session, "CurrentLineNumber");
            }
        }