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