管道请购单列表,导出及发送报价单去除不采购物品,添加查看请购单
This commit is contained in:
@@ -258,17 +258,17 @@ public class PurchaseApplyOrderController extends BaseController {
|
||||
|
||||
//批量导出报价单
|
||||
@RequestMapping("/exportSupplierSingleAll")
|
||||
public void exportSupplierSingleAll(HttpServletResponse response, Long[] ids) throws Exception {
|
||||
public void exportSupplierSingleAll(HttpServletResponse response, Long[] ids ,String type) throws Exception {
|
||||
// purchaseApplyOrderService.exportSupplier(response, id);
|
||||
purchaseApplyOrderService.exportSupplierSingleAll(response, ids);
|
||||
purchaseApplyOrderService.exportSupplierSingleAll(response, ids, type);
|
||||
}
|
||||
|
||||
//批量发送报价单
|
||||
@RequestMapping("/sendSupplierAll")
|
||||
@ResponseBody
|
||||
public Message sendSupplierAll( Long[] ids) throws Exception {
|
||||
public Message sendSupplierAll( Long[] ids, String type) throws Exception {
|
||||
try {
|
||||
purchaseApplyOrderService.sendSupplierAll(ids);
|
||||
purchaseApplyOrderService.sendSupplierAll(ids, type);
|
||||
return Message.success("发送成功");
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -536,7 +536,7 @@ public class PurchaseApplyOrderService extends BaseOrderService<PurchaseApplyOrd
|
||||
ExcelUtils.export(response, value, params, fileName);
|
||||
}
|
||||
|
||||
public Map<String, Workbook> exportSupplierSingleAllWorkbook(Long[] ids) {
|
||||
public Map<String, Workbook> exportSupplierSingleAllWorkbook(Long[] ids,String type) {
|
||||
|
||||
Map<String, Workbook> workbookMap = new LinkedHashMap<>();
|
||||
|
||||
@@ -553,6 +553,9 @@ public class PurchaseApplyOrderService extends BaseOrderService<PurchaseApplyOrd
|
||||
List<Map<String, Object>> listMap = new ArrayList<>();
|
||||
List<PurchaseApplyOrderItem> purchaseApplyOrderItemList = purchaseApplyOrderItemService.findByVersionNum(purchaseApplyOrder.getVersionNum(),id);
|
||||
for (PurchaseApplyOrderItem item : purchaseApplyOrderItemList) {
|
||||
if (type.equals("export") && item.getCount().compareTo(BigDecimal.ZERO)<=0){
|
||||
continue;
|
||||
}
|
||||
Map<String, Object> lm = new HashMap<>();
|
||||
lm.put("id", item.getMaterialOrderItemId());
|
||||
lm.put("name", item.getName());
|
||||
@@ -600,7 +603,7 @@ public class PurchaseApplyOrderService extends BaseOrderService<PurchaseApplyOrd
|
||||
|
||||
return workbookMap;
|
||||
}
|
||||
public void exportSupplierSingleAll(HttpServletResponse response,Long[] ids) {
|
||||
public void exportSupplierSingleAll(HttpServletResponse response,Long[] ids,String type) {
|
||||
try {
|
||||
String fileName = "请购报价.zip";
|
||||
response.setContentType("application/octet-stream");
|
||||
@@ -614,7 +617,7 @@ public class PurchaseApplyOrderService extends BaseOrderService<PurchaseApplyOrd
|
||||
|
||||
|
||||
//循环导出
|
||||
for (Map.Entry<String, Workbook> en : exportSupplierSingleAllWorkbook(ids).entrySet()) {
|
||||
for (Map.Entry<String, Workbook> en : exportSupplierSingleAllWorkbook(ids, type).entrySet()) {
|
||||
//导出的文件名称
|
||||
String entryName = en.getKey();
|
||||
ZipEntry entry = new ZipEntry(entryName);
|
||||
@@ -1101,7 +1104,7 @@ public class PurchaseApplyOrderService extends BaseOrderService<PurchaseApplyOrd
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void sendSupplierAll(Long[] ids) {
|
||||
public void sendSupplierAll(Long[] ids, String type) {
|
||||
try {
|
||||
List<Supplier> supplierList = new ArrayList<>();
|
||||
Map<Long,List<String>> map = new HashMap<>();
|
||||
@@ -1115,7 +1118,7 @@ public class PurchaseApplyOrderService extends BaseOrderService<PurchaseApplyOrd
|
||||
Supplier supplier = supplierService.find(purchaseApplyOrder.getOwnerId());
|
||||
supplierList.add(supplier);
|
||||
File file = null;
|
||||
Map<String, Workbook> workbookMap = exportSupplierSingleAllWorkbook(new Long[]{id});
|
||||
Map<String, Workbook> workbookMap = exportSupplierSingleAllWorkbook(new Long[]{id},type);
|
||||
for (Map.Entry<String, Workbook> entry : workbookMap.entrySet()) {
|
||||
file = new File(resFileDir + "/" + entry.getKey());
|
||||
FileOutputStream fos = new FileOutputStream(file);
|
||||
|
||||
@@ -27,6 +27,9 @@
|
||||
<!-- </shiro:hasPermission>-->
|
||||
<a class="btn" href="javascript:exportExcel('/admin/purchaseApplyOrder/export.html')">导出</a>
|
||||
<th:block th:if="${!supplier}">
|
||||
<a class="btn "
|
||||
onclick="checkAll()">批量查看请购单
|
||||
</a>
|
||||
<a class="btn activeBtn "
|
||||
onclick="exportAll()">批量导出报价单
|
||||
</a>
|
||||
@@ -279,6 +282,20 @@
|
||||
});
|
||||
}
|
||||
|
||||
function checkAll() {
|
||||
var selectedIds = $(".tableWrap").selectedIds();
|
||||
if (selectedIds.length < 1) {
|
||||
Dialog.error("至少勾选1项");
|
||||
return
|
||||
}
|
||||
var ids = ""
|
||||
for (var i = 0; i < selectedIds.length; i++) {
|
||||
ids += Number(selectedIds[i]) + ","
|
||||
}
|
||||
ids.substring(0, ids.length - 1)
|
||||
window.open("/admin/purchaseApplyOrder/exportSupplierSingleAll.html?ids=" + ids + "&type=check")
|
||||
}
|
||||
|
||||
function exportAll() {
|
||||
var selectedIds = $(".tableWrap").selectedIds();
|
||||
if (selectedIds.length < 1) {
|
||||
@@ -290,7 +307,7 @@
|
||||
ids += Number(selectedIds[i]) + ","
|
||||
}
|
||||
ids.substring(0, ids.length - 1)
|
||||
window.open("/admin/purchaseApplyOrder/exportSupplierSingleAll.html?ids=" + ids)
|
||||
window.open("/admin/purchaseApplyOrder/exportSupplierSingleAll.html?ids=" + ids + "&type=export")
|
||||
}
|
||||
|
||||
function sendAll() {
|
||||
@@ -307,7 +324,7 @@
|
||||
Dialog.waiting("发送中,请稍等");
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "purchaseApplyOrder/sendSupplierAll.html",
|
||||
url: "purchaseApplyOrder/sendSupplierAll.html?type=export",
|
||||
data: {
|
||||
ids: ids
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user