diff --git a/lms/nladmin-system/pom.xml b/lms/nladmin-system/pom.xml
index 35ae326..7e7c87d 100644
--- a/lms/nladmin-system/pom.xml
+++ b/lms/nladmin-system/pom.xml
@@ -215,17 +215,17 @@
org.apache.poi
poi-ooxml-schemas
- 3.17
+ 4.0.0
org.apache.poi
poi
- 3.17
+ 4.0.0
org.apache.poi
poi-ooxml
- 3.17
+ 4.0.0
xerces
diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java
index 6e5dfb8..a9c148a 100644
--- a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java
+++ b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java
@@ -721,6 +721,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
workorder.put("order_status", WorkOrderEnum.ORDER_STATUS_FINISH.value());
if (!"0".equals(qty)) {
workorder.put("real_qty", qty);
+ } else {
+ workorder.put("real_qty", workorder.getIntValue("unqualified_qty") + workorder.getIntValue("qualified_qty"));
}
String unqualified_qty = jsonObject.getString("unqualified_qty");
if (StrUtil.isNotBlank(unqualified_qty) && !"0".equals(unqualified_qty)) {
diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/rest/PdaController.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/rest/PdaController.java
index 72110b3..e3d56b1 100644
--- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/rest/PdaController.java
+++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/rest/PdaController.java
@@ -92,10 +92,6 @@ public class PdaController {
@ApiOperation("不合格品上报")
@PdaAnnotation
public JSONObject report(@RequestBody JSONObject param) {
- String func = param.getString("func");
- if (StrUtil.isBlank(func)) {
- throw new BadRequestException("未知功能!");
- }
String device_code = param.getString("device_code");
if (StrUtil.isBlank(device_code)) {
throw new BadRequestException("区域不能为空!");
diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/rest/WorkorderController.java b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/rest/WorkorderController.java
index 5bc23d5..2873ed2 100644
--- a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/rest/WorkorderController.java
+++ b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/rest/WorkorderController.java
@@ -15,6 +15,7 @@ import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
+import javax.servlet.http.HttpServletResponse;
import java.util.Map;
/**
@@ -150,4 +151,11 @@ public class WorkorderController {
return new ResponseEntity<>(workordeService.getMaterial(),HttpStatus.OK);
}
+ @GetMapping("/downloadExcel")
+ @Log("导出Excel")
+ @ApiOperation("导出Excel")
+ public void downloadExcel(@RequestParam Map params, HttpServletResponse response) {
+ workordeService.downloadExcel(params, response);
+ }
+
}
diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/WorkordeService.java b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/WorkordeService.java
index 8317fc1..1bd390d 100644
--- a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/WorkordeService.java
+++ b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/WorkordeService.java
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import org.nl.wms.pdm.service.dto.WorkorderDto;
import org.springframework.data.domain.Pageable;
+import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
@@ -123,4 +124,6 @@ public interface WorkordeService {
JSONArray getDtl(JSONObject param);
JSONArray getMaterial();
+
+ void downloadExcel(Map params, HttpServletResponse response);
}
diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/impl/WorkorderServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/impl/WorkorderServiceImpl.java
index 1e32cdf..85a2bdb 100644
--- a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/impl/WorkorderServiceImpl.java
+++ b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/impl/WorkorderServiceImpl.java
@@ -12,6 +12,7 @@ import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.modules.common.exception.BadRequestException;
+import org.nl.modules.common.utils.FileUtil;
import org.nl.modules.common.utils.SecurityUtils;
import org.nl.modules.system.util.CodeUtil;
import org.nl.modules.wql.WQL;
@@ -31,8 +32,13 @@ import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.stream.Collectors;
import static cn.hutool.db.sql.SqlExecutor.query;
@@ -57,8 +63,12 @@ public class WorkorderServiceImpl implements WorkordeService {
String order_status = MapUtil.getStr(whereJson, "order_status");
JSONObject map = new JSONObject();
map.put("flag", "1");
- map.put("begin_time", begin_time);
- map.put("end_time", end_time);
+ if (StrUtil.isNotBlank(begin_time)) {
+ map.put("begin_time", begin_time + " 00:00:00");
+ }
+ if (StrUtil.isNotBlank(end_time)) {
+ map.put("end_time", end_time + " 23:59:59");
+ }
map.put("region_code", MapUtil.getStr(whereJson, "region_code"));
if (StrUtil.isNotEmpty(order_status)) {
order_status = order_status.replace("[\"", "").replace("\"]", "").replace("\"", "");
@@ -448,8 +458,6 @@ public class WorkorderServiceImpl implements WorkordeService {
String qualified_qty = row.getString("qualified_qty");
if (StrUtil.isNotBlank(qualified_qty) && !"0".equals(qualified_qty)) {
workorder.put("qualified_qty", qualified_qty);
- } else {
- workorder.put("qualified_qty", workorder.getIntValue("real_qty") - workorder.getIntValue("unqualified_qty"));
}
workorder.put("realproduceend_date", DateUtil.now());
@@ -493,4 +501,61 @@ public class WorkorderServiceImpl implements WorkordeService {
public JSONArray getMaterial() {
return WQLObject.getWQLObject("md_me_materialbase").query().getResultJSONArray(0);
}
+
+ @Override
+ public void downloadExcel(Map params, HttpServletResponse response) {
+ String produceorder_code = MapUtil.getStr(params, "produceorder_code");
+ String material = MapUtil.getStr(params, "material");
+ String begin_time = MapUtil.getStr(params, "begin_time");
+ String end_time = MapUtil.getStr(params, "end_time");
+ String order_status = MapUtil.getStr(params, "order_status");
+ JSONObject map = new JSONObject();
+ map.put("flag", "7");
+ if (StrUtil.isNotBlank(begin_time)) {
+ map.put("begin_time", begin_time + " 00:00:00");
+ }
+ if (StrUtil.isNotBlank(end_time)) {
+ map.put("end_time", end_time + " 23:59:59");
+ }
+ map.put("region_code", MapUtil.getStr(params, "region_code"));
+ if (StrUtil.isNotEmpty(order_status)) {
+ order_status = order_status.replace("[\"", "").replace("\"]", "").replace("\"", "");
+ }
+ map.put("order_status", order_status);
+ //处理状态为未完成
+ if (StrUtil.isNotEmpty(order_status) && order_status.contains("-1")) {
+ map.put("unFinish", "-1");
+ map.put("order_status", order_status.replace("-1", ""));
+ }
+ if (StrUtil.isNotEmpty(produceorder_code)) {
+ map.put("produceorder_code", "%" + produceorder_code + "%");
+ }
+ if (StrUtil.isNotEmpty(material)) {
+ map.put("material", "%" + material + "%");
+ }
+ JSONArray workorders = WQL.getWO("MPS_PRODUCEDURE001").addParamMap(map).process().getResultJSONArray(0);
+ List