Browse Source

opt: 代码整理

master
李永德 1 year ago
parent
commit
e053387741
  1. 4
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/autotask/AutoIssueWorkOrder.java
  2. 6
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/impl/WmsToMesServiceImpl.java
  3. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pdm/workorder/service/impl/PdmBdWorkorderServiceImpl.java
  4. 14
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/yz/YZSLTask.java
  5. 11
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/util/CommonUtils.java
  6. 2
      lms/nladmin-system/nlsso-server/src/main/resources/config/application.yml
  7. 21
      lms/nladmin-system/nlsso-server/src/test/java/org/nl/point/test.java

4
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

6
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<PdmBdWorkorder> toWorkOrderList(List<MesWorkOrderDto> mesWorkOrderInfos) {
List<PdmBdWorkorder> list = new CopyOnWriteArrayList<>();
List<PdmBdWorkorder> list = new ArrayList<>();
mesWorkOrderInfos.forEach(mesWorkOrderDto -> {
// 半成品编码
String fproductMaterialId = mesWorkOrderDto.getFPRODUCT_MATERIAL_ID();

2
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<PdmBdWorkorderMapper,
try {
resultForAcs = wmsToAcsService.order(list);
} catch (Exception e) {
log.error("工单下发异常:" + e.getMessage());
log.error("请求ACS之后工单下发异常:" + e.getMessage());
// 通知
noticeService.createNotice("工单下发失败: " + e.getMessage(), "工单下发失败: "
+ pdmBdWorkorder.getWorkorder_code(), NoticeTypeEnum.EXCEPTION.getCode());

14
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/yz/YZSLTask.java

@ -190,10 +190,7 @@ public class YZSLTask extends AbstractTask {
.eq(SchBasePoint::getIs_used, true);
// 如果一个有货一个没货,但是载具数量又是5的时候,就要不需要检测不能为5
List<SchBasePoint> 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<SchBasePoint> 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);

11
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<PutActionRequest> requestAcsReleaseVehicle(HashMap<String, String> map, String deviceCode) {
List<PutActionRequest> list = new CopyOnWriteArrayList<>();
List<PutActionRequest> list = new ArrayList<>();
PutActionRequest putActionRequest = PutActionRequest.createRequest();
putActionRequest.setDevice_code(deviceCode);
List<SignalData> signalList = new CopyOnWriteArrayList<>();
List<SignalData> signalList = new ArrayList<>();
for (Map.Entry<String, String> entry : map.entrySet()) {
SignalData signalData = SignalData.buildSignalData(entry.getKey(), entry.getValue());
signalList.add(signalData);

2
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:

21
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());
}
}
}

Loading…
Cancel
Save