public ActionResult CheckDRApply(int id) { //先验证权限 if (!canCheckAll) { if (!new UASv().CanCheckTheDRBill(id, currentUser.userName, currentUser.userId)) { ViewBag.tip = "单据不存在或无权限查看"; WLog("查看送货单", "无权访问:" + id.ToString(), "", false); return(View("Error")); } } var sv = new DRSv(); var dr = sv.GetDRBill(id); if (dr == null) { ViewBag.tip = "申请单不存在,可能已被删除"; return(View("Error")); } ViewData["drHead"] = dr; ViewData["drDetails"] = sv.GetDRBillDetails(id); WLog("查看申请单", "查看详情", dr == null ? "" : dr.bill_no); return(View()); }
public ActionResult ModifyDRApply(int id) { var sv = new DRSv(); var h = sv.GetDRBill(id); if (h == null) { ViewBag.tip = "单据不存在,可能已被删除"; return(View("Error")); } if (!new string[] { "未提交", "已拒绝" }.Contains(h.p_status)) { ViewBag.tip = "当前申请单状态是:" + h.p_status + ",不能修改"; return(View("Error")); } var details = sv.GetDRBillDetails(id); //重新再计算一次可申请数量 decimal stockQty, transitQty; foreach (var e in details) { stockQty = sv.GetInstockQty(h.account, h.bill_type, (int)e.po_id, (int)e.po_entry_id); // K3已入库数量 transitQty = sv.GetPOTransitQty((int)e.po_id, (int)e.po_entry_id, currentAccount); //在途数量 e.can_send_qty = e.po_qty - stockQty - transitQty + e.send_qty ?? 0m; //可申请数量=订单数量-入库数量-在途数量+本次申请数量 } ViewData["drHead"] = h; ViewData["drDetails"] = details; WLog("修改申请单", "进入修改页面", h.bill_no); return(View("AddDRApply")); }