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 index 05e6adf..4c1faf1 100644 --- 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 @@ -12,8 +12,6 @@ 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.redisson.api.RLock; -import org.redisson.api.RedissonClient; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; @@ -21,8 +19,6 @@ import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.List; -import java.util.concurrent.CopyOnWriteArrayList; -import java.util.concurrent.TimeUnit; /** * @Author: lyd 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 561e67c..d2559d2 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 @@ -5,8 +5,6 @@ import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.ObjectUtil; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; import lombok.extern.slf4j.Slf4j; import org.nl.common.exception.BadRequestException; import org.nl.system.service.notice.ISysNoticeService; @@ -30,8 +28,8 @@ import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; import java.math.BigDecimal; +import java.util.ArrayList; import java.util.List; -import java.util.concurrent.CopyOnWriteArrayList; import java.util.stream.Collectors; /** @@ -495,7 +493,7 @@ public class WmsToMesServiceImpl implements WmsToMesService { * @return lms工单 */ public List toWorkOrderList(List mesWorkOrderInfos) { - List list = new CopyOnWriteArrayList<>(); + List list = new ArrayList<>(); mesWorkOrderInfos.forEach(mesWorkOrderDto -> { // 半成品编码 String fproductMaterialId = mesWorkOrderDto.getFPRODUCT_MATERIAL_ID(); 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 94ab136..f95f5d3 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 @@ -213,7 +213,7 @@ public class PdmBdWorkorderServiceImpl extends ServiceImpl list = pointService.list(lam); - boolean doDetection = true; // 如果只有一条符合的数据就不需要检验不符合5个托 - if (list.size() == 1) { - doDetection = false; - } + boolean doDetection = list.size() != 1; // 如果只有一条符合的数据就不需要检验不符合5个托 lam.ne(doDetection, SchBasePoint::getVehicle_qty, 5) // 载具数量不能等于5 .orderByDesc(SchBasePoint::getVehicle_qty); List schBasePoints = pointService.list(lam); @@ -251,10 +248,15 @@ public class YZSLTask extends AbstractTask { SchBasePoint basePoint = pointService.getById(deviceCode); PdmBdWorkorder workorderObject = workorderService.getDeviceProductionTask(basePoint.getParent_point_code()); // 找到相同组盘信息就修改,避免任务取消组盘信息还存在,重复插入 + SchBaseVehiclematerialgroup groupInfo = vehiclematerialgroupService + .getGroupInfo(vehicleCode, vehicleType, GroupBindMaterialStatusEnum.BOUND.getValue()); + if (ObjectUtil.isNotEmpty(groupInfo)) { + throw new BadRequestException("载具号[" + vehicleCode + "]组盘信息已存在"); + } SchBaseVehiclematerialgroup groupEntity = new SchBaseVehiclematerialgroup(); groupEntity.setGroup_id(IdUtil.getSnowflake(1, 1).nextIdStr()); // 解绑同载具的信息 - vehiclematerialgroupService.unBindingSameVehicleMaterial(vehicleCode, vehicleType); +// vehiclematerialgroupService.unBindingSameVehicleMaterial(vehicleCode, vehicleType); // 要把数据存到组盘表 groupEntity.setMaterial_id(ObjectUtil.isNotEmpty(workorderObject) ? workorderObject.getMaterial_id() @@ -281,7 +283,7 @@ public class YZSLTask extends AbstractTask { ? workorderObject.getBatch_no() : DateUtil.format(DateUtil.date(), "yyyyMMdd")); groupEntity.setInstorage_time(DateUtil.now()); - groupEntity.setGroup_bind_material_status(GroupBindMaterialStatusEnum.WAIT_BIND.getValue()); // 待绑定 + groupEntity.setGroup_bind_material_status(GroupBindMaterialStatusEnum.BOUND.getValue()); // 绑定 groupEntity.setGroup_status(GroupStatusEnum.IN_STORAGE.getType()); // 暂时不维护。 groupEntity.setIs_delete(false); groupEntity.setIs_full(isFull.equals(GeneralDefinition.YES) ? true : false); 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 9096301..b0c2275 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,15 +7,10 @@ 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; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.CopyOnWriteArrayList; +import java.util.*; /** * @Author: lyd @@ -98,10 +93,10 @@ public class CommonUtils { // 请求ACS释放一个木托盘 public static List requestAcsReleaseVehicle(HashMap map, String deviceCode) { - List list = new CopyOnWriteArrayList<>(); + List list = new ArrayList<>(); PutActionRequest putActionRequest = PutActionRequest.createRequest(); putActionRequest.setDevice_code(deviceCode); - List signalList = new CopyOnWriteArrayList<>(); + List signalList = new ArrayList<>(); for (Map.Entry entry : map.entrySet()) { SignalData signalData = SignalData.buildSignalData(entry.getKey(), entry.getValue()); signalList.add(signalData); diff --git a/lms/nladmin-system/nlsso-server/src/main/resources/config/application.yml b/lms/nladmin-system/nlsso-server/src/main/resources/config/application.yml index b9ac791..eff644d 100644 --- a/lms/nladmin-system/nlsso-server/src/main/resources/config/application.yml +++ b/lms/nladmin-system/nlsso-server/src/main/resources/config/application.yml @@ -42,7 +42,7 @@ spring: freemarker: check-template-location: false profiles: - active: prod + active: dev jackson: time-zone: GMT+8 data: 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 6289d16..6f6ddbb 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 @@ -12,11 +12,14 @@ import org.junit.jupiter.api.Test; import org.nl.common.exception.BadRequestException; import org.nl.wms.ext.acs.service.dto.to.wms.ApplyDeviceDto; import org.nl.wms.ext.acs.service.dto.to.wms.ApplyTaskRequest; +import org.nl.wms.pdm.workorder.service.IPdmBdWorkorderService; +import org.nl.wms.pdm.workorder.service.dao.PdmBdWorkorder; import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService; import org.nl.wms.sch.region.service.ISchBaseRegionService; import org.nl.wms.sch.region.service.dao.SchBaseRegion; import org.nl.wms.sch.task.service.dao.SchBaseTask; import org.nl.wms.sch.task_manage.task.core.TaskStatus; +import org.nl.wms.util.TaskUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.transaction.annotation.Transactional; @@ -37,6 +40,8 @@ public class test { private ISchBaseRegionService regionService; @Autowired private ISchBaseVehiclematerialgroupService vehiclematerialgroupService; + @Autowired + private IPdmBdWorkorderService workorderService; @Test @Transactional(rollbackFor = Exception.class) @@ -152,4 +157,20 @@ public class test { System.out.println(split[i]); } } + + @Test + void orderTest() { + PdmBdWorkorder issOrder = workorderService.getByCode("2423111843"); // 下发工单 + PdmBdWorkorder proOrder = workorderService.getByCode("231120005"); // 生产工单 + for (int i = 0; i < 10; i++) { + for (int j = 0; j < 2; j++) { + new Thread(() -> { + TaskUtils.setWorkOrderUpdateByPC(issOrder); + TaskUtils.setWorkOrderUpdateByPC(proOrder); + }).start(); + } + System.out.println(issOrder.getWorkorder_code() + " - " + issOrder.getWorkorder_status()); + System.out.println(proOrder.getWorkorder_code() + " - " + proOrder.getWorkorder_status()); + } + } }