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> list = workorders.stream().map(o -> { + JSONObject workorder = (JSONObject) o; + Map workorder_map = new LinkedHashMap<>(); + workorder_map.put("工单编码", workorder.getString("workorder_code")); + workorder_map.put("工单状态", workorder.getString("order_status")); + workorder_map.put("设备", workorder.getString("device_name")); + workorder_map.put("物料编码", workorder.getString("material_code")); + workorder_map.put("载具类型", workorder.getString("vehicle_type")); + workorder_map.put("计划数量", workorder.getString("plan_qty")); + workorder_map.put("计划生产日期", workorder.getString("plan_date")); + workorder_map.put("实际开始时间", workorder.getString("realproducestart_date")); + workorder_map.put("实际结束时间", workorder.getString("realproduceend_date")); + workorder_map.put("实际生产数量", workorder.getString("real_qty")); + workorder_map.put("合格数量", workorder.getString("qualified_qty")); + workorder_map.put("不合格数量", workorder.getString("unqualified_qty")); + return workorder_map; + }).collect(Collectors.toList()); + + try { + FileUtil.downloadExcel(list, response); + } catch (IOException e) { + throw new RuntimeException(e); + } + } } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/wql/MPS_PRODUCEDURE001.wql b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/wql/MPS_PRODUCEDURE001.wql index b42486a..1deca4c 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/wql/MPS_PRODUCEDURE001.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/wql/MPS_PRODUCEDURE001.wql @@ -191,3 +191,58 @@ ENDQUERY ENDIF + IF 输入.flag = "7" + QUERY + SELECT + ShiftOrder.workorder_code, + d1.label AS order_status, + device.device_name, + material.material_code, + d2.label AS vehicle_type, + ShiftOrder.plan_qty, + ShiftOrder.plan_date, + ShiftOrder.realproducestart_date, + ShiftOrder.realproduceend_date, + ShiftOrder.real_qty, + ShiftOrder.qualified_qty, + ShiftOrder.unqualified_qty + FROM + PDM_BD_WORKORDER ShiftOrder + LEFT JOIN md_me_materialbase material ON material.material_id = ShiftOrder.material_id + LEFT JOIN pdm_bi_device device ON ShiftOrder.device_id = device.device_id + LEFT JOIN sys_dict_detail d1 ON ShiftOrder.order_status = d1.value AND d1.name = 'pdm_workorder_status' + LEFT JOIN sys_dict_detail d2 ON ShiftOrder.vehicle_type = d2.value AND d2.name = 'vehicle_type' + WHERE + ShiftOrder.is_delete = '0' + OPTION 输入.unFinish <> "" + ShiftOrder.order_status <> '5' + ENDOPTION + OPTION 输入.order_status <> "" + find_in_set( ShiftOrder.order_status, 输入.order_status) + ENDOPTION + OPTION 输入.begin_time <> "" + ShiftOrder.realproducestart_date IS NOT NULL + AND ShiftOrder.realproducestart_date <> '' + AND ShiftOrder.realproducestart_date >= 输入.begin_time + ENDOPTION + OPTION 输入.end_time <> "" + ShiftOrder.realproduceend_date IS NOT NULL + AND ShiftOrder.realproducestart_date <> '' + AND ShiftOrder.realproduceend_date <= 输入.end_time + ENDOPTION + OPTION 输入.produceorder_code <> "" + ShiftOrder.workorder_code like 输入.produceorder_code + ENDOPTION + OPTION 输入.material <> "" + ( + material.material_code like 输入.material + ) + ENDOPTION + OPTION 输入.region_code <> "" + device.region_code = 输入.region_code + ENDOPTION + ORDER BY + ShiftOrder.order_status ASC, ShiftOrder.create_time DESC + ENDSELECT + ENDQUERY + ENDIF diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/RegionInType.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/RegionInType.java index 50cc84d..83f55a6 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/RegionInType.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/RegionInType.java @@ -16,8 +16,8 @@ public enum RegionInType { WGRK("完工入库", "F"), BCPRK("半成品入库", "W"), - BCPFPRK("半成品废品入库", "W"), - CCPFPRK("产成品废品入库", "F"); + BCPFPRK("废品入库", "W"), + CCPFPRK("废品入库", "F"); private final String label; private final String value; diff --git a/lms/nladmin-system/src/main/resources/config/application-dev.yml b/lms/nladmin-system/src/main/resources/config/application-dev.yml index 84e511a..2bdb3ab 100644 --- a/lms/nladmin-system/src/main/resources/config/application-dev.yml +++ b/lms/nladmin-system/src/main/resources/config/application-dev.yml @@ -162,3 +162,11 @@ sa-token: loki: url: http://localhost:3100/loki/api/v1 systemName: acs + +#erp +erp: + sqlserver: + enabled: false + jdbcurl: jdbc:sqlserver://192.168.0.251:1433;DatabaseName=UFDATA_001_2023; + username: rl + password: SH123 diff --git a/lms/nladmin-ui/src/views/wms/pdm/workerorder/fj/index.vue b/lms/nladmin-ui/src/views/wms/pdm/workerorder/fj/index.vue index 2aa3f1a..f79bfc6 100644 --- a/lms/nladmin-ui/src/views/wms/pdm/workerorder/fj/index.vue +++ b/lms/nladmin-ui/src/views/wms/pdm/workerorder/fj/index.vue @@ -247,7 +247,7 @@ label="实际结束时间" :min-width="flexWidth('realproduceend_date',crud.data,'实际结束时间')" /> - + - + diff --git a/lms/nladmin-ui/src/views/wms/pdm/workerorder/index.vue b/lms/nladmin-ui/src/views/wms/pdm/workerorder/index.vue index c87601c..4806ebf 100644 --- a/lms/nladmin-ui/src/views/wms/pdm/workerorder/index.vue +++ b/lms/nladmin-ui/src/views/wms/pdm/workerorder/index.vue @@ -88,6 +88,16 @@ > 强制完成 + + 导出Excel + - + { + downloadFile(res, '生产统计', 'xlsx') + crud.downloadLoading = false + }) } } }