Пример #1
0
        public JsonResult GetPO4Box(string billType, string searchValue, int page, int rows)
        {
            var boxSv = new BoxSv();
            var drSv  = new DRSv();

            List <K3POs4BoxModel> pos;
            string GetPO4Box_param = (string)Session["GetPO4Box_param"];

            if (GetPO4Box_param == null || !GetPO4Box_param.Equals(billType + ":" + searchValue))
            {
                pos = boxSv.GetPos4Box(billType, searchValue, currentUser.userId, currentUser.userName, currentAccount);
                pos = pos.OrderByDescending(p => p.po_date).Take(1000).ToList(); //最多显示1000条记录
                Session["GetPO4Box_param"] = billType + ":" + searchValue;
                Session["GetPO4Box_list"]  = pos;                                //为加快翻页速度,将数据放在session中
            }
            else
            {
                pos = (List <K3POs4BoxModel>)Session["GetPO4Box_list"];
            }
            var result = pos.OrderByDescending(p => p.po_date).Skip((page - 1) * rows).Take(rows).ToList();

            //var noFinishBox = boxSv.GetNotFinishedBoxQty(result.Select(r => new IDModel() { interId = r.po_id, entryId = r.po_entry_id }).ToList());
            foreach (var p in result)
            {
                p.id_field = p.po_id + "-" + p.po_entry_id;
                //2019-10-24 因为TDD送货平台只用来打印标签,不做送货单,所以此规则改为:可做外箱数量=po数量-平台未关联外箱数量(不记k3关联数量)
                //p.can_make_box_qty = p.po_qty - (noFinishBox.Where(f => f.poId == p.po_id && f.poEntryId == p.po_entry_id).Sum(r => r.qty) ?? 0m);
                //p.can_make_box_qty = p.po_qty - p.realte_qty - (noFinishBox.Where(f => f.poId == p.po_id && f.poEntryId == p.po_entry_id).Sum(r => r.qty) ?? 0m);
                //2019-11-19 因为有退补货的存在,所以此规则再次修改为:可做外箱数量=po数量-k3关联数量
                p.can_make_box_qty = p.po_qty - p.realte_qty;
            }

            return(Json(new { suc = true, total = pos.Count(), rows = result }));
        }
Пример #2
0
        public JsonResult GetPO4Box(string billType, string searchType, string searchValue, int page, int rows)
        {
            var boxSv = new BoxSv();
            var drSv  = new DRSv();

            List <K3POs4BoxModel> pos;
            string GetPO4Box_param = (string)Session["GetPO4Box_param"];
            string searchInfo      = string.Format("{0};{1}:{2}", billType, searchType, searchValue);

            if (GetPO4Box_param == null || !GetPO4Box_param.Equals(searchInfo))
            {
                pos = boxSv.GetPos4Box(billType, searchType, searchValue, currentUser.userId, currentUser.userName, currentAccount);
                pos = pos.OrderByDescending(p => p.po_date).Take(1000).ToList(); //最多显示1000条记录
                Session["GetPO4Box_param"] = searchInfo;
                Session["GetPO4Box_list"]  = pos;                                //为加快翻页速度,将数据放在session中
            }
            else
            {
                pos = (List <K3POs4BoxModel>)Session["GetPO4Box_list"];
            }
            var result = pos.OrderByDescending(p => p.po_number).ThenBy(p => p.po_entry_id).Skip((page - 1) * rows).Take(rows).ToList();

            var noFinishBox = boxSv.GetNotFinishedBoxQty(result.Select(r => new IDModel()
            {
                interId = r.po_id, entryId = r.po_entry_id
            }).ToList(), currentAccount);

            foreach (var p in result)
            {
                p.id_field         = p.po_id + "-" + p.po_entry_id;
                p.can_make_box_qty = p.po_qty - p.realte_qty - (noFinishBox.Where(f => f.poId == p.po_id && f.poEntryId == p.po_entry_id).Sum(r => r.qty) ?? 0m);
            }

            return(Json(new { suc = true, total = pos.Count(), rows = result }));
        }