diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/material/service/dao/mapper/MdBaseMaterialMapper.xml b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/material/service/dao/mapper/MdBaseMaterialMapper.xml index 844091d..c2feaf7 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/material/service/dao/mapper/MdBaseMaterialMapper.xml +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/material/service/dao/mapper/MdBaseMaterialMapper.xml @@ -17,8 +17,17 @@ LEFT JOIN sch_base_point p ON p.vehicle_code = vg.vehicle_code AND p.vehicle_type = vg.vehicle_type WHERE vg.group_bind_material_status = '2' - AND p.region_code = 'GTPHC' - AND p.point_status = '3' + AND p.region_code = 'GTPHC' + AND p.point_status = '3' + + AND mm.material_code LIKE '%${query.blurry}%' OR mm.material_name LIKE '%${query.blurry}%' + + + AND mm.material_spec LIKE '%${query.material_spec}%' + + + AND mm.material_model LIKE '%${query.material_model}%' + ) SELECT CTE.material_id, CTE.material_code, diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/material/service/dto/MdBaseMaterialQuery.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/material/service/dto/MdBaseMaterialQuery.java index c8442dc..9088a41 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/material/service/dto/MdBaseMaterialQuery.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/material/service/dto/MdBaseMaterialQuery.java @@ -11,4 +11,6 @@ import java.io.Serializable; @Data public class MdBaseMaterialQuery implements Serializable { private String blurry; + private String material_spec; + private String material_model; } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/material/service/impl/MdBaseMaterialServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/material/service/impl/MdBaseMaterialServiceImpl.java index 018455f..9624d55 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/material/service/impl/MdBaseMaterialServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/material/service/impl/MdBaseMaterialServiceImpl.java @@ -51,11 +51,14 @@ public class MdBaseMaterialServiceImpl extends ServiceImpl lam = new LambdaQueryWrapper<>(); lam.like(ObjectUtil.isNotEmpty(blurry), MdBaseMaterial::getMaterial_code, blurry) .or(ObjectUtil.isNotEmpty(blurry), l -> l.like(ObjectUtil.isNotEmpty(blurry), MdBaseMaterial::getMaterial_name, blurry)) .like(ObjectUtil.isNotEmpty(material_spec), MdBaseMaterial::getMaterial_spec, material_spec) + .like(ObjectUtil.isNotEmpty(material_model), MdBaseMaterial::getMaterial_model, material_model) .eq(ObjectUtil.isNotEmpty(is_used), MdBaseMaterial::getIs_used, is_used) .eq(ObjectUtil.isNotEmpty(workshop_code), MdBaseMaterial::getWorkshop_code, workshop_code); IPage pages = new Page<>(page.getPage() + 1, page.getSize()); diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/autotask/AutoIssueWorkOrder.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/autotask/AutoIssueWorkOrder.java new file mode 100644 index 0000000..2acc19b --- /dev/null +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/autotask/AutoIssueWorkOrder.java @@ -0,0 +1,72 @@ +package org.nl.wms.ext.acs.autotask; + +import cn.hutool.http.HttpStatus; +import lombok.SneakyThrows; +import lombok.extern.slf4j.Slf4j; +import org.nl.system.service.notice.ISysNoticeService; +import org.nl.wms.ext.acs.service.WmsToAcsService; +import org.nl.wms.ext.acs.service.dto.to.wms.AcsResponse; +import org.nl.wms.pdm.workorder.service.IPdmBdWorkorderService; +import org.nl.wms.pdm.workorder.service.dao.PdmBdWorkorder; +import org.nl.wms.pdm.workorder.service.dao.vo.AcsWorkOrderVo; +import org.nl.wms.sch.task_manage.enums.NoticeTypeEnum; +import org.nl.wms.sch.task_manage.enums.WorkOrderStatusEnum; +import org.nl.wms.util.TaskUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; + +import java.util.List; +import java.util.concurrent.CopyOnWriteArrayList; + +/** + * @Author: lyd + * @Description: 自动下发工单给acs + * @Date: 2023/10/30 + */ +@Slf4j +@Component +@Order(value = 1) +public class AutoIssueWorkOrder { + @Autowired + private IPdmBdWorkorderService workorderService; + @Autowired + private WmsToAcsService wmsToAcsService; + @Autowired + private ISysNoticeService noticeService; + @SneakyThrows + public void run() { + // 获取未有生产中的设备号 + List deviceCodes = workorderService.getTheDayUnProducedDevice(); + // 查找该设备未生产的工单去下发 + deviceCodes.forEach(s -> { + List acsWorkOrderVoList = workorderService.getAcsWorkOrderVos(s); + if (acsWorkOrderVoList.size() == 0) return; + AcsWorkOrderVo acsWorkOrderVo = acsWorkOrderVoList.get(0); + // 获取一个下发 + List list = new CopyOnWriteArrayList<>(); + list.add(acsWorkOrderVo); + AcsResponse resultForAcs; + try { + resultForAcs = wmsToAcsService.order(list); + } catch (Exception e) { + log.error("工单下发异常:" + e.getMessage()); + // 通知 + noticeService.createNotice("工单下发失败: " + e.getMessage(), "工单下发失败: " + + acsWorkOrderVo.getWorkorder_code(), NoticeTypeEnum.EXCEPTION.getCode()); + return; + } + if (resultForAcs.getCode() != HttpStatus.HTTP_OK) { + // 不成功 + noticeService.createNotice(resultForAcs.getMessage(), "工单下发失败: " + acsWorkOrderVo.getWorkorder_code(), + NoticeTypeEnum.EXCEPTION.getCode()); + return; + } + // 修改工单数据 + PdmBdWorkorder pdmBdWorkorder = workorderService.getByCode(acsWorkOrderVo.getWorkorder_code()); + pdmBdWorkorder.setWorkorder_status(WorkOrderStatusEnum.ISSUED.getCode()); + TaskUtils.setWorkOrderUpdateByAcs(pdmBdWorkorder); + workorderService.updateById(pdmBdWorkorder); + }); + } +} diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/autotask/AutoSynWorkOrderInfo.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/autotask/AutoSynWorkOrderInfo.java new file mode 100644 index 0000000..b1afb07 --- /dev/null +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/autotask/AutoSynWorkOrderInfo.java @@ -0,0 +1,25 @@ +package org.nl.wms.ext.mes.autotask; + +import lombok.SneakyThrows; +import lombok.extern.slf4j.Slf4j; +import org.nl.wms.ext.mes.service.WmsToMesService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; + +/** + * @Author: lyd + * @Description: 自动同步工单 + * @Date: 2023/10/30 + */ +@Slf4j +@Component +@Order(value = 1) +public class AutoSynWorkOrderInfo { + @Autowired + private WmsToMesService wmsToMesService; + @SneakyThrows + public void run() { + wmsToMesService.synchronizeWorkOrderInfo(); + } +} diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/impl/WmsToMesServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/impl/WmsToMesServiceImpl.java index b1020cf..1d28e66 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/impl/WmsToMesServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/impl/WmsToMesServiceImpl.java @@ -72,12 +72,13 @@ public class WmsToMesServiceImpl implements WmsToMesService { public void synchronizeMaterialInfo() { log.info("同步物料开始"); // 获取lms数据库中的最后获取时间 - LambdaQueryWrapper lmsMaterialTabQuery = new QueryWrapper().lambda(); - lmsMaterialTabQuery.isNotNull(MdBaseMaterial::getExt_id).ne(MdBaseMaterial::getExt_id, "") - .orderByDesc(MdBaseMaterial::getExt_time); - List mdBaseMaterials = mdBaseMaterialService.list(lmsMaterialTabQuery); - String time = mdBaseMaterials.size() > 0 ? mdBaseMaterials.get(0).getExt_time() : "1970-01-01 00:00:00"; - log.info("上次更新同步时间:{}", time); +// LambdaQueryWrapper lmsMaterialTabQuery = new QueryWrapper().lambda(); +// lmsMaterialTabQuery.isNotNull(MdBaseMaterial::getExt_id).ne(MdBaseMaterial::getExt_id, "") +// .orderByDesc(MdBaseMaterial::getExt_time); +// List mdBaseMaterials = mdBaseMaterialService.list(lmsMaterialTabQuery); +// String time = mdBaseMaterials.size() > 0 ? mdBaseMaterials.get(0).getExt_time() : "1970-01-01 00:00:00"; + String time = "1970-01-01 00:00:00"; +// log.info("上次更新同步时间:{}", time); // 获取mes的物料数据 List materials = mesRequestMapper.getMesMaterialInfos(time); if (materials.size() == 0) { diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/dao/mapper/PdaMapper.xml b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/dao/mapper/PdaMapper.xml index 1e3c45d..6769e14 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/dao/mapper/PdaMapper.xml +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/dao/mapper/PdaMapper.xml @@ -137,7 +137,7 @@ mm.material_model FROM `md_base_material` mm - WHERE mm.material_code LIKE '%${material_code}%' OR mm.material_name LIKE '%ss%' + WHERE mm.material_code LIKE '%${material_code}%' OR mm.material_name LIKE '%${material_code}%' + + + + diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pdm/workorder/service/impl/PdmBdWorkorderServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pdm/workorder/service/impl/PdmBdWorkorderServiceImpl.java index 687b348..c4baed8 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pdm/workorder/service/impl/PdmBdWorkorderServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pdm/workorder/service/impl/PdmBdWorkorderServiceImpl.java @@ -249,4 +249,24 @@ public class PdmBdWorkorderServiceImpl extends ServiceImpl getTheDayUnProducedWorkOrder() { + return pdmBdWorkorderMapper.getTheDayUnProducedWorkOrder(); + } + + @Override + public List getTheDayIssueWorkOrderList() { + return pdmBdWorkorderMapper.getTheDayIssueWorkOrderList(); + } + + @Override + public List getTheDayUnProducedDevice() { + return pdmBdWorkorderMapper.getTheDayUnProducedDevice(); + } + + @Override + public List getAcsWorkOrderVos(String s) { + return pdmBdWorkorderMapper.getAcsWorkOrderVos(s); + } } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/util/CommonUtils.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/util/CommonUtils.java index 1377a0a..82125a3 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/util/CommonUtils.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/util/CommonUtils.java @@ -7,6 +7,7 @@ import org.nl.wms.ext.acs.service.dto.to.acs.PutActionRequest; import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.Duration; +import java.time.LocalDate; import java.time.LocalDateTime; import java.time.LocalTime; import java.time.format.DateTimeFormatter; @@ -109,4 +110,14 @@ public class CommonUtils { list.add(putActionRequest); return list; } + + public static String CurrentData() { + // 获取当前日期 + LocalDate currentDate = LocalDate.now(); + // 定义日期格式 + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd"); + // 格式化日期为"20231030" + String formattedDate = currentDate.format(formatter); + return formattedDate; + } } diff --git a/lms/nladmin-system/nlsso-server/src/test/java/org/nl/point/test.java b/lms/nladmin-system/nlsso-server/src/test/java/org/nl/point/test.java index e3d7e0f..4cce342 100644 --- a/lms/nladmin-system/nlsso-server/src/test/java/org/nl/point/test.java +++ b/lms/nladmin-system/nlsso-server/src/test/java/org/nl/point/test.java @@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import org.checkerframework.checker.units.qual.A; +import org.junit.Assert; import org.junit.jupiter.api.Test; import org.nl.common.exception.BadRequestException; import org.nl.wms.ext.acs.service.dto.to.wms.ApplyDeviceDto; @@ -19,6 +20,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.transaction.annotation.Transactional; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.List; @@ -117,5 +120,16 @@ public class test { // System.out.println(5%3); System.out.println(Double.parseDouble("0.0")); } - + @Test + // 测试场景:获取当前日期,格式化为"yyyyMMdd" + public void testGetFormattedDate() { + // 获取当前日期 + LocalDate currentDate = LocalDate.now(); + // 定义日期格式 + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd"); + // 格式化日期为"20231030" + String formattedDate = currentDate.format(formatter); + // 断言格式化后的日期是否符合预期 + Assert.assertEquals("20231030", formattedDate); + } } diff --git a/lms/nladmin-ui/src/views/wms/sch/group/MaterialDialog.vue b/lms/nladmin-ui/src/views/wms/sch/group/MaterialDialog.vue index cb6acb5..912dad2 100644 --- a/lms/nladmin-ui/src/views/wms/sch/group/MaterialDialog.vue +++ b/lms/nladmin-ui/src/views/wms/sch/group/MaterialDialog.vue @@ -23,6 +23,24 @@ @keyup.enter.native="crud.toQuery" /> + + + + + + @@ -54,6 +72,7 @@ +