/// <summary> /// 构建设计完结单信息 /// </summary> /// <param name="employeeID"></param> /// <returns></returns> private IQueryable <DesignResultViewModel> BuildResultInfo(int employeeID) { var role = storeEmployeesBLL.GetModel(p => p.ID == employeeID); List <DesignResultViewModel> designResultViews = new List <DesignResultViewModel>(); List <设计_设计案完结单> models = new List <设计_设计案完结单>(); if (role.是否店长 == true) { models = designResultBLL.GetModels(p => p.店铺ID == storeID).ToList(); } else { return(null); } foreach (var item in models) { DesignResultViewModel designResultViewModel = new DesignResultViewModel(); designResultViewModel.Id = item.id; designResultViewModel.制单日期 = item.制单日期; designResultViewModel.合计成交金额 = item.合计成交金额; var files = design_ProjectDrawingsBLL.GetModels(p => p.设计案提交表ID == item.设计案提交表ID && p.文件类型 == 8); List <String> listPath = new List <string>(); if (files.Count() > 0) { foreach (var ite in files) { listPath.Add(ite.存储路径); } designResultViewModel.完成效果图路径 = listPath; } designResultViewModel.实际完成时间 = item.实际完成时间; designResultViewModel.实际完成空间 = item.实际完成空间; designResultViewModel.审批状态 = item.审批状态; designResultViewModel.客户编号 = item.客户单号;//合同编号 designResultViewModel.店长审核 = item.店长审核; designResultViewModel.设计师确认 = item.设计师确认; designResultViewModel.销售审核 = item.销售审核; designResultViewModel.设计案提交表ID = item.设计案提交表ID; designResultViewModel.销售人员 = storeEmployeesBLL.GetModel(p => p.ID == item.销售人员).姓名; designResultViewModel.销售人员确认日期 = item.销售人员确认日期; designResultViewModel.销售单号 = item.销售单号; //订单编号 designResultViewModel.单据编号 = item.单据编号; //单据编号 designResultViewModel.店长 = storeEmployeesBLL.GetModel(p => p.ID == item.店长).姓名; designResultViewModel.店长审核日期 = item.店长确认日期; designResultViewModel.延期或无法完成原因 = item.延期或无法完成原因; designResultViewModel.建议 = item.建议; designResultViewModel.更新人 = item.更新人; designResultViewModel.计划完成时间 = item.计划完成时间; designResultViewModel.计划完成空间 = item.计划完成空间; designResultViewModel.设计师 = storeEmployeesBLL.GetModel(p => p.ID == item.设计师).姓名; designResultViewModel.设计师确认 = item.设计师确认; designResultViewModel.设计师确认日期 = item.设计师确认日期; designResultViewModel.更新日期 = item.更新日期; int sellID;//销售订单ID if (item.设计案提交表ID != null && item.设计案提交表ID != 0) { var phoneNumber = designSubmitBLL.GetModel(w => w.id == item.设计案提交表ID).联系方式; try { sellID = salesOrderBLL.GetModel(p => p.客户联系方式 == phoneNumber && p.店铺ID == storeID).ID; //根据联系方式查找相应的客户的订单ID designResultViewModel.客户编号 = salesOrderBLL.GetModel(p => p.ID == sellID).合同编号; //合同编号 designResultViewModel.设计案提交表ID = item.设计案提交表ID; designResultViewModel.销售单号 = salesOrderBLL.GetModel(p => p.ID == sellID).订单编号; //订单编号 designResultViewModel.单据编号 = salesOrderBLL.GetModel(p => p.ID == sellID).单据编号; //单据编号 } catch (Exception e) { return(null); } var lis = salesOrder_DetailsBLL.GetModels(p => p.单据ID == sellID).ToList();//根据订单ID查询订单详细 List <DesignResult_OrderDetailViewModel> list = new List <DesignResult_OrderDetailViewModel>(); foreach (var ite in lis) { DesignResult_OrderDetailViewModel model = new DesignResult_OrderDetailViewModel(); var spuid = product_SKUBLL.GetModel(p => p.ID == ite.SKU_ID).SPU_ID; var productid = product_SPUBLL.GetModel(p => p.ID == spuid).商品ID; var product = productBLL.GetModel(p => p.ID == productid); model.产品型号 = product.编号; model.单位 = product.计量单位; model.成交价 = ite.零售小计; model.数量 = ite.数量; model.空间 = ""; list.Add(model); } designResultViewModel.DesignResult_OrderDetailViewModel = list; } designResultViews.Add(designResultViewModel); } return(designResultViews.AsQueryable()); }
/// <summary> /// 添加设计案完结清单-未确认完结 /// </summary> /// <param name="subid">设计案提交ID</param> /// <returns></returns> public ActionResult AddDesignResultView(int?subid) { Session["method"] = "N"; SetEmployee(); ViewBag.Store = store; ViewBag.Employee = employeeName; ViewBag.IsManager = storeEmployeesBLL.GetModel(p => p.ID == employeeID).是否店长; ViewBag.IsDesigner = storeEmployeesBLL.GetModel(p => p.ID == employeeID).是否设计师; ViewBag.IsEmployee = storeEmployeesBLL.GetModel(p => p.ID == employeeID).是否销售; if (storeEmployeesBLL.GetModel(p => p.ID == employeeID).职务ID != 4 && storeEmployeesBLL.GetModel(p => p.ID == employeeID).职务ID != 3) { return(Content("<script>alert('您不具有操作权限!不能进行完结操作!');window.history.go(-1);</script>")); } DesignResultViewModel designResultViewModel = new DesignResultViewModel(); designResultViewModel.计划完成时间 = designSubmitBLL.GetModel(p => p.id == subid).项目预计完成时间; designResultViewModel.计划完成空间 = designSubmitBLL.GetModel(p => p.id == subid).家具空间; int sellID;//销售订单ID if (subid != null && subid != 0) { var phoneNumber = designSubmitBLL.GetModel(w => w.id == subid).联系方式; try { sellID = salesOrderBLL.GetModel(p => p.客户联系方式 == phoneNumber && p.店铺ID == storeID).ID; //根据联系方式查找相应的客户的订单ID designResultViewModel.客户编号 = salesOrderBLL.GetModel(p => p.ID == sellID).合同编号; //合同编号 designResultViewModel.设计案提交表ID = subid; designResultViewModel.销售单号 = salesOrderBLL.GetModel(p => p.ID == sellID).订单编号; //订单编号 designResultViewModel.单据编号 = salesOrderBLL.GetModel(p => p.ID == sellID).单据编号; //单据编号 } catch (Exception e) { return(Content("<script>alert('没有与客户相关订单信息!不能进行完结操作!请仔细查阅!');window.history.go(-1);</script>")); } /*designResultViewModel.设计_设计案完结单_家具成交单 =*/ var lis = salesOrder_DetailsBLL.GetModels(p => p.单据ID == sellID).ToList();//根据订单ID查询订单详细 List <DesignResult_OrderDetailViewModel> list = new List <DesignResult_OrderDetailViewModel>(); foreach (var item in lis) { DesignResult_OrderDetailViewModel model = new DesignResult_OrderDetailViewModel(); var spuid = product_SKUBLL.GetModel(p => p.ID == item.SKU_ID).SPU_ID; var productid = product_SPUBLL.GetModel(p => p.ID == spuid).商品ID; var product = productBLL.GetModel(p => p.ID == productid); model.产品型号 = product.编号; model.单位 = product.计量单位; model.成交价 = item.零售小计; model.数量 = item.数量; model.空间 = ""; list.Add(model); } designResultViewModel.DesignResult_OrderDetailViewModel = list; var files = design_ProjectDrawingsBLL.GetModels(p => p.设计案提交表ID == subid && p.文件类型 == 8); if (files.Count() > 0) { designResultViewModel.完成效果图 = true; List <String> listPath = new List <string>(); foreach (var item in files) { listPath.Add(item.存储路径); } designResultViewModel.完成效果图路径 = listPath; } else { designResultViewModel.完成效果图 = false; } var mid = designSubmitBLL.GetModel(p => p.id == subid).店长; designResultViewModel.店长 = storeEmployeesBLL.GetModel(p => p.ID == mid).姓名; var emid = designSubmitBLL.GetModel(p => p.id == subid).销售人员; designResultViewModel.销售人员 = storeEmployeesBLL.GetModel(p => p.ID == emid).姓名; } return(View(designResultViewModel)); }