管道请购单列表,导出及发送报价单去除不采购物品,添加查看请购单

This commit is contained in:
suncz
2024-05-31 12:58:24 +08:00
parent 0fff58c990
commit 7faf64dba2
3 changed files with 31 additions and 11 deletions

View File

@@ -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();

View File

@@ -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);