Browse Source

opt: 添加手持叫料功能

master
yanps 2 months ago
parent
commit
67143c4e5f
  1. 4
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/plc_to_agv/PlcToAgvDeviceDriver.java
  2. 2
      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. 37
      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. 37
      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

4
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,7 +147,7 @@ public class PlcToAgvDeviceDriver extends AbstractOpcDeviceDriver implements Dev
}
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;
@ -168,6 +167,7 @@ public class PlcToAgvDeviceDriver extends AbstractOpcDeviceDriver implements Dev
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
}
public void writing(List list) {
Map<String, Object> itemMap = new HashMap<String, Object>();

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

@ -207,11 +207,13 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC
}
if(!ObjectUtil.isEmpty(value) || "".equals(value)){
accessor_value.setValue(itemId, value);
if(!"heartbeat".equals(itemDto.getItem_code().substring(itemDto.getItem_code().lastIndexOf(".") + 1))){
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),
String.valueOf(his), String.valueOf(value));
luceneLogDto.setLogType(LogTypeEnum.DEVICE_LOG.getDesc());
log.info("{}", JSON.toJSONString(luceneLogDto));
}
}
if(ObjectUtil.isEmpty(value) && !"".equals(value)){
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());
AcsResponse acsResponse = connectorService.feedAgvTaskStatus(json);
}
List<String> list = iSchBaseVehiclematerialgroupService.selectOrdersByVehicleCode(schBaseTask.getVehicle_code());
/*List<String> list = iSchBaseVehiclematerialgroupService.selectOrdersByVehicleCode(schBaseTask.getVehicle_code());
//同步fab工序流程
FabServiceImpl.syncFab(list);
FabServiceImpl.syncFab(list);*/
} else if ("2".equals(is_connector)) {
JSONObject json = new JSONObject();
json.put("vehicle_code", schBaseTask.getVehicle_code());

37
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
*/
@Log("根据工序查询工单")
@Log("根据设备工序查询工单")
@GetMapping("/regionOrder")
public ResponseEntity<TableDataInfo<OrderMater>> regionOrder(String deviceCode) {
public ResponseEntity<TableDataInfo<OrderMater>> selectOrderByPointCode(String deviceCode) {
List<OrderMater> structList = iSchBasePointService.getStructList(deviceCode, null);
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("查询订单号")
@PostMapping("/orders")
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("请输入设备号或载具号!");
}
List<String> list = null;
if (StrUtil.isNotEmpty(sendVehicleVo.getVehicle_code())) {
list = iSchBaseVehiclematerialgroupService.selectOrdersByVehicleCode(sendVehicleVo.getVehicle_code());
} else if (StrUtil.isNotEmpty(sendVehicleVo.getDevice_code())) {
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(sendVehicleVo.getDevice_code());
deviceCodes = new ArrayList<>();
deviceCodes.add(sendVehicleVo.getVehicle_code());
list = iSchBaseVehiclematerialgroupService.selectOrdersByVehicleCode(deviceCodes);
} else if (CollUtil.isNotEmpty(deviceCodes)) {
List<String> vehicleCodes = new ArrayList<>();
deviceCodes.stream().forEach(deviceCode -> {
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(deviceCode);
if (ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("设备不存在!");
list = iSchBaseVehiclematerialgroupService.selectOrdersByVehicleCode(schBasePoint.getVehicle_code());
vehicleCodes.add(schBasePoint.getVehicle_code());
}
);
list = iSchBaseVehiclematerialgroupService.selectOrdersByVehicleCode(vehicleCodes);
}
HashSet<String> keys = new HashSet<>();
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<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("remark", task_code)
.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("vehicle_code", jsonObject.getString("vehicle_code2"));
taskParam.put("device_code", pointCode + "_02");
taskParam.put("task_code", task_code + "B");
taskParam.put("ext_data", jsonObject.put("pallet_detail",jsonArray1));
connectorTask.apply(taskParam);
iSchBasePointService.update(new UpdateWrapper<SchBasePoint>()
.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
*/
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);
List<String> selectOrders(String vehicle_code);
List<String> selectOrders(@Param("list") List<String> vehicleCodes);
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>
AND vg.group_bind_material_status = '2'
</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
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 id="selectMaterialByVehicleCode" resultType="java.util.Map" parameterType="java.lang.String">
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.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author lyd
@ -75,7 +73,8 @@ public class SchBaseVehiclematerialgroupServiceImpl extends ServiceImpl<SchBaseV
}
}
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);
@ -142,7 +141,7 @@ public class SchBaseVehiclematerialgroupServiceImpl extends ServiceImpl<SchBaseV
}
@Override
public List<String> selectOrdersByVehicleCode(String vehicle_code) {
public List<String> selectOrdersByVehicleCode(List<String> 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());
}
});
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;
}
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();
/**
* 根据工序查询订单
* @param regionCode
* @return
*/
List<OrderMater> selectOrder(String regionCode);
}

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

@ -263,6 +263,9 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
SchBasePoint schBasePoint = schBasePoints.get(0);
schBasePoint.setVehicle_code(vehicleCode);
schBasePoint.setIs_lock(true);
update(Wrappers.lambdaUpdate(SchBasePoint.class)
.eq(SchBasePoint::getPoint_code, schBasePoint.getPoint_code())
.set(SchBasePoint::getIs_lock, true));
return schBasePoint;
}
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.setVehicle_code(vehicleCode);
schBasePoint.setIs_lock(true);
update(Wrappers.lambdaUpdate(SchBasePoint.class)
.eq(SchBasePoint::getPoint_code, schBasePoint.getPoint_code())
.set(SchBasePoint::getIs_lock, true));
return schBasePoint;
}
return null;
@ -492,6 +498,27 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
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
public List<OrderMater> getStructList(String region_code, String vehicle_type) {
//1.查询的结果一个托盘有多个800,PC需要怎么展示?
@ -506,15 +533,23 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
List<OrderMater> collect = structList.stream().collect(Collectors.groupingBy(
OrderMater::getVehicle_code,
Collectors.collectingAndThen(
Collectors.maxBy(Comparator.comparing(OrderMater::getDue_date)),
Collectors.minBy(Comparator.comparing(OrderMater::getDue_date)),
Optional::get
)
)).values()
.stream()
.collect(Collectors.toList());
collect = collect.stream().sorted(Comparator.comparingLong(order -> getTime(order.getDue_date()))).collect(Collectors.toList());
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
@Transactional(propagation = Propagation.REQUIRES_NEW)
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 {
// 获取任务
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 suffix2 = getNumericSuffix(s2.getPoint_code1());
return suffix1.compareTo(suffix2);
};
List<SchBaseTask> collect = tasks.stream().sorted(numericSuffixComparator).collect(Collectors.toList());
for (SchBaseTask task : collect) {
List<SchBaseTask> collect = tasks.stream().sorted(numericSuffixComparator).collect(Collectors.toList());*/
for (SchBaseTask task : tasks) {
// 查找空载具点位
SchBasePoint schBasePoint = schBasePointService.selectEmpVehicleByRegionCode(RegionEnum.LAG_ROBOT_BEANDING_CELL.getRegion_code(),task.getVehicle_type());
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.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
/**
* sorting将满料放到线边库
@ -73,7 +74,7 @@ public class SortingSMTTask extends AbstractTask {
// 配置信息
SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>()
.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) {
TaskUtils.setUpdateByAcs(task);
// 找起点

Loading…
Cancel
Save