Browse Source

opt: 添加手持叫料功能

master
yanps 2 months ago
parent
commit
67143c4e5f
  1. 36
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/plc_to_agv/PlcToAgvDeviceDriver.java
  2. 10
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/DeviceOpcProtocolRunable.java
  3. 4
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java
  4. 39
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/fab/controller/FabController.java
  5. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/fab/service/dto/SendVehicleVo.java
  6. 5
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/sorting/service/impl/SortingServiceImpl.java
  7. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/ISchBaseVehiclematerialgroupService.java
  8. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/dao/mapper/SchBaseVehiclematerialgroupMapper.java
  9. 7
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/dao/mapper/SchBaseVehiclematerialgroupMapper.xml
  10. 24
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/impl/SchBaseVehiclematerialgroupServiceImpl.java
  11. 7
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/ISchBasePointService.java
  12. 41
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/impl/SchBasePointServiceImpl.java
  13. 6
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/connector/FTGTask.java
  14. 3
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/sorting/SortingSMTTask.java

36
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/plc_to_agv/PlcToAgvDeviceDriver.java

@ -121,7 +121,6 @@ public class PlcToAgvDeviceDriver extends AbstractOpcDeviceDriver implements Dev
} }
/** /**
* 多个信号一起下发电气 * 多个信号一起下发电气
* *
@ -148,25 +147,26 @@ public class PlcToAgvDeviceDriver extends AbstractOpcDeviceDriver implements Dev
} }
public void writing(String param, String value) { public void writing(String param, String value) {
if (!"heartbeat".equals(param)) {
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + param;
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() Map<String, Object> itemMap = new HashMap<String, Object>();
+ "." + param;
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_param, Integer.parseInt(value)); itemMap.put(to_param, Integer.parseInt(value));
try { try {
Thread.sleep(1000); Thread.sleep(1000);
this.checkcontrol(itemMap); this.checkcontrol(itemMap);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
}
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("下发多个电气信号" + itemMap)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
} }
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("下发多个电气信号" + itemMap)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
} }
public void writing(List list) { public void writing(List list) {
@ -231,7 +231,7 @@ public class PlcToAgvDeviceDriver extends AbstractOpcDeviceDriver implements Dev
jo.put("signals_are_allowed", AGVSetInLowerAllowed == 1 ? "下层允许上料请求" : AGVSetOutLowerAllowed == 1 ? "下层允许下料请求" jo.put("signals_are_allowed", AGVSetInLowerAllowed == 1 ? "下层允许上料请求" : AGVSetOutLowerAllowed == 1 ? "下层允许下料请求"
: AGVSetInUpperAllowed == 1 ? "上层允许上料请求" : AGVSetOutUpperAllowed == 1 ? "上层允许下料请求" : "未允许"); : AGVSetInUpperAllowed == 1 ? "上层允许上料请求" : AGVSetOutUpperAllowed == 1 ? "上层允许下料请求" : "未允许");
jo.put("agv_enable", AGVEnable == 1 ? "启用" : "禁用"); jo.put("agv_enable", AGVEnable == 1 ? "启用" : "禁用");
jo.put("request_a_signal",AGVSetInReqUpper == 1 ? "上层上料请求" : AGVSetInReqLower == 1 ? "下层上料请求" jo.put("request_a_signal", AGVSetInReqUpper == 1 ? "上层上料请求" : AGVSetInReqLower == 1 ? "下层上料请求"
: AGVSetOutReqUpper == 1 ? "上层下料请求" : AGVSetOutReqLower == 1 ? "下层下料请求" : "未请求"); : AGVSetOutReqUpper == 1 ? "上层下料请求" : AGVSetOutReqLower == 1 ? "下层下料请求" : "未请求");
jo.put("agv_inop", AGVInOP == 1 ? "AGV动作中" : "AGV空闲"); jo.put("agv_inop", AGVInOP == 1 ? "AGV动作中" : "AGV空闲");
return jo; return jo;

10
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/DeviceOpcProtocolRunable.java

@ -207,10 +207,12 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC
} }
if(!ObjectUtil.isEmpty(value) || "".equals(value)){ if(!ObjectUtil.isEmpty(value) || "".equals(value)){
accessor_value.setValue(itemId, value); accessor_value.setValue(itemId, value);
LuceneLogDto luceneLogDto = new LuceneLogDto(itemDto.getOpc_server_code(), itemDto.getOpc_plc_code(),4, itemDto.getDevice_code(), itemDto.getItem_code().substring(itemDto.getItem_code().lastIndexOf(".") + 1), if(!"heartbeat".equals(itemDto.getItem_code().substring(itemDto.getItem_code().lastIndexOf(".") + 1))){
String.valueOf(his), String.valueOf(value)); LuceneLogDto luceneLogDto = new LuceneLogDto(itemDto.getOpc_server_code(), itemDto.getOpc_plc_code(),4, itemDto.getDevice_code(), itemDto.getItem_code().substring(itemDto.getItem_code().lastIndexOf(".") + 1),
luceneLogDto.setLogType(LogTypeEnum.DEVICE_LOG.getDesc()); String.valueOf(his), String.valueOf(value));
log.info("{}", JSON.toJSONString(luceneLogDto)); luceneLogDto.setLogType(LogTypeEnum.DEVICE_LOG.getDesc());
log.info("{}", JSON.toJSONString(luceneLogDto));
}
} }
if(ObjectUtil.isEmpty(value) && !"".equals(value)){ if(ObjectUtil.isEmpty(value) && !"".equals(value)){
accessor_value.removeValue(itemId); accessor_value.removeValue(itemId);

4
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java

@ -400,9 +400,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
json.put("task_code", schBaseTask.getTask_code()); json.put("task_code", schBaseTask.getTask_code());
AcsResponse acsResponse = connectorService.feedAgvTaskStatus(json); AcsResponse acsResponse = connectorService.feedAgvTaskStatus(json);
} }
List<String> list = iSchBaseVehiclematerialgroupService.selectOrdersByVehicleCode(schBaseTask.getVehicle_code()); /*List<String> list = iSchBaseVehiclematerialgroupService.selectOrdersByVehicleCode(schBaseTask.getVehicle_code());
//同步fab工序流程 //同步fab工序流程
FabServiceImpl.syncFab(list); FabServiceImpl.syncFab(list);*/
} else if ("2".equals(is_connector)) { } else if ("2".equals(is_connector)) {
JSONObject json = new JSONObject(); JSONObject json = new JSONObject();
json.put("vehicle_code", schBaseTask.getVehicle_code()); json.put("vehicle_code", schBaseTask.getVehicle_code());

39
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/fab/controller/FabController.java

@ -91,16 +91,29 @@ public class FabController {
/** /**
* 根据工序查询订单 * 根据工序查询订单
* *
* @param regionCode * @param deviceCode
* @return * @return
*/ */
@Log("根据工序查询工单") @Log("根据设备工序查询工单")
@GetMapping("/regionOrder") @GetMapping("/regionOrder")
public ResponseEntity<TableDataInfo<OrderMater>> regionOrder(String deviceCode) { public ResponseEntity<TableDataInfo<OrderMater>> selectOrderByPointCode(String deviceCode) {
List<OrderMater> structList = iSchBasePointService.getStructList(deviceCode, null); List<OrderMater> structList = iSchBasePointService.getStructList(deviceCode, null);
return new ResponseEntity(TableDataInfo.build(structList), HttpStatus.OK); return new ResponseEntity(TableDataInfo.build(structList), HttpStatus.OK);
} }
/**
* 根据工序查询订单
*
* @param
* @return
*/
@Log("根据工序查询工单")
@GetMapping("/selectOrderByRegion")
public ResponseEntity<TableDataInfo<OrderMater>> regionOrder(String regionCode) {
List<OrderMater> structList = iSchBasePointService.selectOrder(regionCode);
return new ResponseEntity(TableDataInfo.build(structList), HttpStatus.OK);
}
/** /**
* 根据工单查询匹配库存 * 根据工单查询匹配库存
* *
@ -279,16 +292,24 @@ public class FabController {
@Log("查询订单号") @Log("查询订单号")
@PostMapping("/orders") @PostMapping("/orders")
public ResponseEntity<TableDataInfo> selectOrders(@RequestBody SendVehicleVo sendVehicleVo) { public ResponseEntity<TableDataInfo> selectOrders(@RequestBody SendVehicleVo sendVehicleVo) {
if (StrUtil.isEmpty(sendVehicleVo.getDevice_code()) && StrUtil.isEmpty(sendVehicleVo.getVehicle_code())) { List<String> deviceCodes = sendVehicleVo.getDeviceCodes();
if (CollUtil.isEmpty(deviceCodes) && StrUtil.isEmpty(sendVehicleVo.getVehicle_code())) {
throw new BadRequestException("请输入设备号或载具号!"); throw new BadRequestException("请输入设备号或载具号!");
} }
List<String> list = null; List<String> list = null;
if (StrUtil.isNotEmpty(sendVehicleVo.getVehicle_code())) { if (StrUtil.isNotEmpty(sendVehicleVo.getVehicle_code())) {
list = iSchBaseVehiclematerialgroupService.selectOrdersByVehicleCode(sendVehicleVo.getVehicle_code()); deviceCodes = new ArrayList<>();
} else if (StrUtil.isNotEmpty(sendVehicleVo.getDevice_code())) { deviceCodes.add(sendVehicleVo.getVehicle_code());
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(sendVehicleVo.getDevice_code()); list = iSchBaseVehiclematerialgroupService.selectOrdersByVehicleCode(deviceCodes);
if (ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("设备不存在!"); } else if (CollUtil.isNotEmpty(deviceCodes)) {
list = iSchBaseVehiclematerialgroupService.selectOrdersByVehicleCode(schBasePoint.getVehicle_code()); List<String> vehicleCodes = new ArrayList<>();
deviceCodes.stream().forEach(deviceCode -> {
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(deviceCode);
if (ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("设备不存在!");
vehicleCodes.add(schBasePoint.getVehicle_code());
}
);
list = iSchBaseVehiclematerialgroupService.selectOrdersByVehicleCode(vehicleCodes);
} }
HashSet<String> keys = new HashSet<>(); HashSet<String> keys = new HashSet<>();
list.stream().forEach(item -> { list.stream().forEach(item -> {

2
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/fab/service/dto/SendVehicleVo.java

@ -36,4 +36,6 @@ public class SendVehicleVo {
*/ */
List<SendVehicleVo> sendVehicleVoList; List<SendVehicleVo> sendVehicleVoList;
List<String> deviceCodes;
} }

5
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/sorting/service/impl/SortingServiceImpl.java

@ -172,11 +172,14 @@ public class SortingServiceImpl implements SortingService {
.set("is_lock", true) .set("is_lock", true)
.set("remark", task_code) .set("remark", task_code)
.eq("point_code", pointCode + "_01")); .eq("point_code", pointCode + "_01"));
jsonObject.put("pallet_detail",jsonArray1);
taskParam = new JSONObject(MapOf.of("task_code", task_code, "job_name", jobname, "device_code", pointCode, "requestNo"
, "sorting_" + IdUtil.getStringId(), "ext_data", jsonObject, "vehicle_code", vehicle_code, "ext_data", jsonObject));
taskParam.put("config_code", "SortingSMTTask");
taskParam.put("task_seq", "1"); taskParam.put("task_seq", "1");
taskParam.put("vehicle_code", jsonObject.getString("vehicle_code2")); taskParam.put("vehicle_code", jsonObject.getString("vehicle_code2"));
taskParam.put("device_code", pointCode + "_02"); taskParam.put("device_code", pointCode + "_02");
taskParam.put("task_code", task_code + "B"); taskParam.put("task_code", task_code + "B");
taskParam.put("ext_data", jsonObject.put("pallet_detail",jsonArray1));
connectorTask.apply(taskParam); connectorTask.apply(taskParam);
iSchBasePointService.update(new UpdateWrapper<SchBasePoint>() iSchBasePointService.update(new UpdateWrapper<SchBasePoint>()
.set("is_lock", true) .set("is_lock", true)

2
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/ISchBaseVehiclematerialgroupService.java

@ -72,7 +72,7 @@ public interface ISchBaseVehiclematerialgroupService extends IService<SchBaseVeh
* 根据载具号查找订单号 * 根据载具号查找订单号
* @param vehicle_code * @param vehicle_code
*/ */
List<String> selectOrdersByVehicleCode(String vehicle_code); List<String> selectOrdersByVehicleCode(List<String> vehicle_code);
/** /**
* 根据载具号查找物料信息 * 根据载具号查找物料信息

2
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/dao/mapper/SchBaseVehiclematerialgroupMapper.java

@ -21,7 +21,7 @@ public interface SchBaseVehiclematerialgroupMapper extends BaseMapper<SchBaseVeh
SchBaseVehiclematerialgroup getGroup(JSONObject entity); SchBaseVehiclematerialgroup getGroup(JSONObject entity);
List<String> selectOrders(String vehicle_code); List<String> selectOrders(@Param("list") List<String> vehicleCodes);
List<Map> selectMaterialByVehicleCode(String vehicle_code); List<Map> selectMaterialByVehicleCode(String vehicle_code);
} }

7
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/dao/mapper/SchBaseVehiclematerialgroupMapper.xml

@ -50,10 +50,13 @@
</if> </if>
AND vg.group_bind_material_status = '2' AND vg.group_bind_material_status = '2'
</select> </select>
<select id="selectOrders" resultType="java.lang.String" parameterType="java.lang.String"> <select id="selectOrders" resultType="java.lang.String" parameterType="java.util.List">
SELECT sbv.order_code SELECT sbv.order_code
FROM sch_base_vehiclematerialgroup sbv FROM sch_base_vehiclematerialgroup sbv
WHERE sbv.vehicle_code = #{vehicle_code} WHERE sbv.vehicle_code IN
<foreach item="code" collection="list" open="(" separator="," close=")">
#{code}
</foreach>
</select> </select>
<select id="selectMaterialByVehicleCode" resultType="java.util.Map" parameterType="java.lang.String"> <select id="selectMaterialByVehicleCode" resultType="java.util.Map" parameterType="java.lang.String">
SELECT SELECT

24
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/impl/SchBaseVehiclematerialgroupServiceImpl.java

@ -30,10 +30,8 @@ import org.nl.wms.sch.process_flow.service.ProcessFlowService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.HashMap; import java.util.*;
import java.util.List; import java.util.stream.Collectors;
import java.util.Map;
import java.util.Set;
/** /**
* @author lyd * @author lyd
@ -75,7 +73,8 @@ public class SchBaseVehiclematerialgroupServiceImpl extends ServiceImpl<SchBaseV
} }
} }
if (StrUtil.isNotBlank(item.getRegion_code())) { if (StrUtil.isNotBlank(item.getRegion_code())) {
item.setRegion_name(pointService.list(Wrappers.lambdaQuery(SchBasePoint.class).eq(SchBasePoint::getRegion_code, item.getRegion_code())).get(0).getRegion_name()); // item.setRegion_name(pointService.list(Wrappers.lambdaQuery(SchBasePoint.class).eq(SchBasePoint::getRegion_code, item.getRegion_code())).get(0).getRegion_name());
item.setRegion_name(item.getRegion_code());
} }
}); });
// pages = vehiclematerialgroupMapper.selectPageLeftJoin(pages, whereJson); // pages = vehiclematerialgroupMapper.selectPageLeftJoin(pages, whereJson);
@ -142,7 +141,7 @@ public class SchBaseVehiclematerialgroupServiceImpl extends ServiceImpl<SchBaseV
} }
@Override @Override
public List<String> selectOrdersByVehicleCode(String vehicle_code) { public List<String> selectOrdersByVehicleCode(List<String> vehicle_code) {
return vehiclematerialgroupMapper.selectOrders(vehicle_code); return vehiclematerialgroupMapper.selectOrders(vehicle_code);
} }
@ -158,7 +157,20 @@ public class SchBaseVehiclematerialgroupServiceImpl extends ServiceImpl<SchBaseV
orderList.put("due_date", order_code.get(0).getDue_date()); orderList.put("due_date", order_code.get(0).getDue_date());
} }
}); });
maps = maps.stream().sorted(Comparator.comparingLong(order -> {
if(ObjectUtil.isNotEmpty(order.get("due_date"))){
return getTime(StrUtil.toString(order.get("due_date")));
}
return 0;
})).collect(Collectors.toList());
return maps; return maps;
} }
private Long getTime(String dateString){
String pattern = "yyyy-MM-dd HH:mm:ss";
java.util.Date date = DateUtil.parse(dateString, pattern);
long timestamp = date.getTime();
return timestamp;
}
} }

7
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/ISchBasePointService.java

@ -198,4 +198,11 @@ public interface ISchBasePointService extends IService<SchBasePoint> {
* 选择登录设备 * 选择登录设备
*/ */
List<Map> selectJobDevice(); List<Map> selectJobDevice();
/**
* 根据工序查询订单
* @param regionCode
* @return
*/
List<OrderMater> selectOrder(String regionCode);
} }

41
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/impl/SchBasePointServiceImpl.java

@ -177,9 +177,9 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
if (ObjectUtil.isNotEmpty(pointStatus) && pointStatus.equals(GoodsEnum.OUT_OF_STOCK.getValue())) { if (ObjectUtil.isNotEmpty(pointStatus) && pointStatus.equals(GoodsEnum.OUT_OF_STOCK.getValue())) {
vehicle_code = null; vehicle_code = null;
} else if (ObjectUtil.isNotEmpty(pointStatus) && (pointStatus.equals(GoodsEnum.EMPTY_PALLETS.getValue()) || pointStatus.equals(GoodsEnum.IN_STOCK.getValue()))) { } else if (ObjectUtil.isNotEmpty(pointStatus) && (pointStatus.equals(GoodsEnum.EMPTY_PALLETS.getValue()) || pointStatus.equals(GoodsEnum.IN_STOCK.getValue()))) {
if(StrUtil.isEmpty(entity.getVehicle_code())) throw new BadRequestException("载具编码不能为空"); if (StrUtil.isEmpty(entity.getVehicle_code())) throw new BadRequestException("载具编码不能为空");
} }
pointMapper.update(entity,Wrappers.lambdaUpdate(SchBasePoint.class) pointMapper.update(entity, Wrappers.lambdaUpdate(SchBasePoint.class)
.eq(SchBasePoint::getPoint_code, entity.getPoint_code()) .eq(SchBasePoint::getPoint_code, entity.getPoint_code())
.set(SchBasePoint::getVehicle_code, vehicle_code)); .set(SchBasePoint::getVehicle_code, vehicle_code));
} }
@ -263,6 +263,9 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
SchBasePoint schBasePoint = schBasePoints.get(0); SchBasePoint schBasePoint = schBasePoints.get(0);
schBasePoint.setVehicle_code(vehicleCode); schBasePoint.setVehicle_code(vehicleCode);
schBasePoint.setIs_lock(true); schBasePoint.setIs_lock(true);
update(Wrappers.lambdaUpdate(SchBasePoint.class)
.eq(SchBasePoint::getPoint_code, schBasePoint.getPoint_code())
.set(SchBasePoint::getIs_lock, true));
return schBasePoint; return schBasePoint;
} }
SchBasePoint schBasePoint1 = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class).eq(SchBasePoint::getRegion_code, region_code)).get(0); SchBasePoint schBasePoint1 = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class).eq(SchBasePoint::getRegion_code, region_code)).get(0);
@ -280,6 +283,9 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
SchBasePoint schBasePoint = schBasePoints1.get(0); SchBasePoint schBasePoint = schBasePoints1.get(0);
schBasePoint.setVehicle_code(vehicleCode); schBasePoint.setVehicle_code(vehicleCode);
schBasePoint.setIs_lock(true); schBasePoint.setIs_lock(true);
update(Wrappers.lambdaUpdate(SchBasePoint.class)
.eq(SchBasePoint::getPoint_code, schBasePoint.getPoint_code())
.set(SchBasePoint::getIs_lock, true));
return schBasePoint; return schBasePoint;
} }
return null; return null;
@ -492,6 +498,27 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
return pointMapper.selectJobDevice(); return pointMapper.selectJobDevice();
} }
@Override
public List<OrderMater> selectOrder(String regionCode) {
Assert.notBlank(regionCode, "工序不能为空");
Param dueDate = iSysParamService.findByCode("due_date");
String s = null;
if (dueDate != null && StringUtils.isNotEmpty(dueDate.getValue())) {
s = DateUtil.offsetDay(new Date(), Integer.parseInt(dueDate.getValue())).toDateStr();
}
List<OrderMater> structList = pointMapper.getStructList(regionCode, null, s);
List<OrderMater> collect = structList.stream().collect(Collectors.groupingBy(
OrderMater::getVehicle_code,
Collectors.collectingAndThen(
Collectors.maxBy(Comparator.comparing(OrderMater::getDue_date)),
Optional::get
)
)).values()
.stream()
.collect(Collectors.toList());
return collect;
}
@Override @Override
public List<OrderMater> getStructList(String region_code, String vehicle_type) { public List<OrderMater> getStructList(String region_code, String vehicle_type) {
//1.查询的结果一个托盘有多个800,PC需要怎么展示? //1.查询的结果一个托盘有多个800,PC需要怎么展示?
@ -506,15 +533,23 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
List<OrderMater> collect = structList.stream().collect(Collectors.groupingBy( List<OrderMater> collect = structList.stream().collect(Collectors.groupingBy(
OrderMater::getVehicle_code, OrderMater::getVehicle_code,
Collectors.collectingAndThen( Collectors.collectingAndThen(
Collectors.maxBy(Comparator.comparing(OrderMater::getDue_date)), Collectors.minBy(Comparator.comparing(OrderMater::getDue_date)),
Optional::get Optional::get
) )
)).values() )).values()
.stream() .stream()
.collect(Collectors.toList()); .collect(Collectors.toList());
collect = collect.stream().sorted(Comparator.comparingLong(order -> getTime(order.getDue_date()))).collect(Collectors.toList());
return collect; return collect;
} }
private Long getTime(String dateString){
String pattern = "yyyy-MM-dd HH:mm:ss";
java.util.Date date = DateUtil.parse(dateString, pattern);
long timestamp = date.getTime();
return timestamp;
}
@Override @Override
@Transactional(propagation = Propagation.REQUIRES_NEW) @Transactional(propagation = Propagation.REQUIRES_NEW)
public SchBasePoint selectEmpVehicleByRegionCode(String region_code, String... vehicleType) { public SchBasePoint selectEmpVehicleByRegionCode(String region_code, String... vehicleType) {

6
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/connector/FTGTask.java

@ -54,13 +54,13 @@ public class FTGTask extends AbstractTask {
protected void create() throws BadRequestException { protected void create() throws BadRequestException {
// 获取任务 // 获取任务
List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY); List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY);
Comparator<SchBaseTask> numericSuffixComparator = (s1, s2) -> { /*Comparator<SchBaseTask> numericSuffixComparator = (s1, s2) -> {
Integer suffix1 = getNumericSuffix(s1.getPoint_code1()); Integer suffix1 = getNumericSuffix(s1.getPoint_code1());
Integer suffix2 = getNumericSuffix(s2.getPoint_code1()); Integer suffix2 = getNumericSuffix(s2.getPoint_code1());
return suffix1.compareTo(suffix2); return suffix1.compareTo(suffix2);
}; };
List<SchBaseTask> collect = tasks.stream().sorted(numericSuffixComparator).collect(Collectors.toList()); List<SchBaseTask> collect = tasks.stream().sorted(numericSuffixComparator).collect(Collectors.toList());*/
for (SchBaseTask task : collect) { for (SchBaseTask task : tasks) {
// 查找空载具点位 // 查找空载具点位
SchBasePoint schBasePoint = schBasePointService.selectEmpVehicleByRegionCode(RegionEnum.LAG_ROBOT_BEANDING_CELL.getRegion_code(),task.getVehicle_type()); SchBasePoint schBasePoint = schBasePointService.selectEmpVehicleByRegionCode(RegionEnum.LAG_ROBOT_BEANDING_CELL.getRegion_code(),task.getVehicle_type());
if (ObjectUtil.isEmpty(schBasePoint)) { if (ObjectUtil.isEmpty(schBasePoint)) {

3
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/sorting/SortingSMTTask.java

@ -42,6 +42,7 @@ import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException; import java.time.format.DateTimeParseException;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* sorting将满料放到线边库 * sorting将满料放到线边库
@ -73,7 +74,7 @@ public class SortingSMTTask extends AbstractTask {
// 配置信息 // 配置信息
SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>() SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>()
.eq(SchBaseTaskconfig::getConfig_code, TASK_CONFIG_CODE)); .eq(SchBaseTaskconfig::getConfig_code, TASK_CONFIG_CODE));
tasks.stream().sorted(Comparator.comparing(SchBaseTask::getAcs_trace_id)); tasks = tasks.stream().sorted(Comparator.comparing(SchBaseTask::getAcs_trace_id)).collect(Collectors.toList());
for (SchBaseTask task : tasks) { for (SchBaseTask task : tasks) {
TaskUtils.setUpdateByAcs(task); TaskUtils.setUpdateByAcs(task);
// 找起点 // 找起点

Loading…
Cancel
Save