Browse Source

fix: 修复pc测试过程中遇到的问题

master
yanps 3 months ago
parent
commit
75310dc523
  1. 21
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/system/controller/secutiry/MobileAuthorizationController.java
  2. 96
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/fab/controller/FabController.java
  3. 27
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/fab/service/impl/FabServiceImpl.java
  4. 20
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/handheld/service/impl/HandheldServiceImpl.java
  5. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/dao/mapper/SchBaseVehiclematerialgroupMapper.xml
  6. 5
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/impl/SchBaseVehiclematerialgroupServiceImpl.java
  7. 1
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/dao/mapper/SchBasePointMapper.xml
  8. 24
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/impl/SchBasePointServiceImpl.java
  9. 18
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/connector/CNTTask.java
  10. 27
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/pcoperation/PcOperationCMTask.java
  11. 4
      lms/nladmin-ui/src/views/wms/produceScreen/index.vue
  12. 8
      lms/nladmin-ui/src/views/wms/produceScreen/setup.vue

21
lms/nladmin-system/nlsso-server/src/main/java/org/nl/system/controller/secutiry/MobileAuthorizationController.java

@ -80,15 +80,6 @@ public class MobileAuthorizationController {
if (!userInfo.getIs_used()) {
throw new BadRequestException("账号未激活");
}
if (StringUtils.isNotEmpty(authUser.getDevice())) {
Object regin_code = redisUtils.get("JT_" + authUser.getUsername());
if (regin_code != null) {
throw new BadRequestException("当前设备工序已经登陆,无法继续选择");
} else {
redisUtils.set("JT_" + authUser.getUsername(), authUser.getDevice());
}
}
// 登录输入,登出删除
CurrentUser user = new CurrentUser();
user.setId(userInfo.getUser_id());
@ -112,25 +103,15 @@ public class MobileAuthorizationController {
roles += role.getRemark() + ',';
}
}
SchBasePoint schBasePoint = new SchBasePoint();
if(StrUtil.isNotEmpty(authUser.getDevice())){
schBasePoint = iSchBasePointService.selectByPointCode(authUser.getDevice());
}
// 返回 token 与 用户信息
JSONObject jsonObject = new JSONObject();
jsonObject.put("user", userInfo);
String finalRoles = roles;
SchBasePoint finalSchBasePoint = schBasePoint;
JSONObject authInfo = new JSONObject(6) {{
put("token", "Bearer " + StpUtil.getTokenValue());
put("user", jsonObject);
put("roles", finalRoles);
if(ObjectUtil.isNotEmpty(finalSchBasePoint)){
put("ext_data", finalSchBasePoint.getRegion_points());
put("point_code", finalSchBasePoint.getPoint_code());
put("point_name", finalSchBasePoint.getPoint_name());
}
}};
return ResponseEntity.ok(authInfo);
@ -142,7 +123,7 @@ public class MobileAuthorizationController {
@Log("PC登出")
public ResponseEntity<Object> loginOut(@Validated @RequestBody AuthUserDto authUser) {
// 密码解密 - 前端的加密规则: encrypt(根据实际更改)
redisUtils.del("JT_" + authUser.getUsername());
redisUtils.del("mobile:" + authUser.getDevice());
return new ResponseEntity(TableDataInfo.build(), HttpStatus.OK);
}

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

@ -9,6 +9,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.nl.common.base.TableDataInfo;
@ -20,6 +21,7 @@ import org.nl.wms.ext.connector.service.WmsToConnectorService;
import org.nl.wms.ext.fab.service.dto.*;
import org.nl.wms.ext.fab.service.impl.FabServiceImpl;
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService;
import org.nl.wms.sch.group.service.dao.SchBaseVehiclematerialgroup;
import org.nl.wms.sch.point.service.ISchBasePointService;
import org.nl.wms.sch.point.service.dao.SchBasePoint;
import org.nl.wms.sch.region.service.ISchBaseRegionService;
@ -93,8 +95,8 @@ public class FabController {
*/
@Log("根据工序查询工单")
@GetMapping("/regionOrder")
public ResponseEntity<TableDataInfo<OrderMater>> regionOrder(String regionCode) {
List<OrderMater> structList = iSchBasePointService.getStructList(regionCode, null);
public ResponseEntity<TableDataInfo<OrderMater>> regionOrder(String deviceCode) {
List<OrderMater> structList = iSchBasePointService.getStructList(deviceCode, null);
return new ResponseEntity(TableDataInfo.build(structList), HttpStatus.OK);
}
@ -148,7 +150,7 @@ public class FabController {
@PostMapping("/sendVehicle")
public ResponseEntity<TableDataInfo> sendVehicle(@RequestBody SendVehiclesVo sendVehiclesVo) {
JSONObject toJSON = (JSONObject) JSON.toJSON(sendVehiclesVo);
List<SendVehicleVo> sendVehicleVoList = sendVehiclesVo.getSendVehicleVoList();
List<SendVehicleVo> sendVehicleVoList = sendVehiclesVo.getMater();
if (CollUtil.isEmpty(sendVehicleVoList)) throw new BadRequestException("物料信息为空,请确认!");
AtomicReference<Boolean> flag = new AtomicReference<>(false);
sendVehicleVoList.stream().forEach(sendVehicleVo1 -> {
@ -156,6 +158,7 @@ public class FabController {
flag.set(true);
}
});
sendVehicleVoList.removeIf(sendVehicleVo1 -> (ObjectUtil.isEmpty(sendVehicleVo1) || sendVehicleVo1.getMaterial_qty() == 0));
if (!flag.get()) {
fabService.createAgvTask(toJSON, "snt");
} else {
@ -163,8 +166,12 @@ public class FabController {
toJSON.put("vehicle_code", schBasePoint.getVehicle_code());
List<String> materiales = new ArrayList<>();
sendVehicleVoList.stream().forEach(send -> {
SchBaseVehiclematerialgroup one = iSchBaseVehiclematerialgroupService.getOne(Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class)
.eq(SchBaseVehiclematerialgroup::getOrder_code, send.getOrder_code()));
send.setDue_date(one.getDue_date());
materiales.add(JSONObject.toJSONString(send));
});
toJSON.put("region_code", schBasePoint.getRegion_code());
toJSON.put("material_info", materiales);
//TODO:修改物料信息
fabService.createAgvTask(toJSON, "smt");
@ -196,41 +203,52 @@ public class FabController {
@Log("工序下料")
@PostMapping("/sendMater")
public ResponseEntity<TableDataInfo> sendMater(@RequestBody SendMaterVo materInfo) {
JSONObject toJSON = (JSONObject) JSON.toJSON(materInfo);
//TODO:待确定
List<String> material_info = materInfo.getMaterial_info();
if (CollUtil.isEmpty(material_info)) throw new BadRequestException("物料信息为空,请确认!");
JSONObject json = new JSONObject();
JSONArray jsonArray = new JSONArray();
HashMap<String, Object> map = new HashMap<>();
material_info.stream().forEach(material -> {
JSONObject jsonObject = JSONObject.parseObject(material);
map.put("order_code", jsonObject.getString("order_code"));
map.put("qty", jsonObject.getString("material_qty"));
jsonArray.add(map);
});
json.put("vehicle_code", materInfo.getVehicle_code());
json.put("region_code", materInfo.getRegion_code());
json.put("materials", jsonArray);
JSONObject jsonObject = wmsToConnectorService.applyRegionAndDueDate(json);
if (ObjectUtil.isNotEmpty(jsonObject) && jsonObject.getInteger("status") == 200) {
JSONArray data = jsonObject.getJSONArray("data");
data.stream().forEach(material -> {
JSONObject jsonObject1 = JSONObject.parseObject(StrUtil.toString(material));
material_info.stream().forEach(material1 -> {
JSONObject jsonObject2 = JSONObject.parseObject(StrUtil.toString(material1));
if (jsonObject2.getString("order_code").equals(jsonObject1.getString("order_code"))) {
jsonObject2.put("due_date", jsonObject1.getString("due_date"));
jsonObject2.put("region_code", jsonObject1.getString("next_region_code"));
}
if (StrUtil.isNotEmpty(materInfo.getRegion_code())) {
JSONObject toJSON = (JSONObject) JSON.toJSON(materInfo);
fabService.createAgvTask(toJSON, "smt");
return new ResponseEntity(TableDataInfo.build(), HttpStatus.OK);
} else {
JSONObject toJSON = (JSONObject) JSON.toJSON(materInfo);
//TODO:待确定
List<SendVehicleVo> mater = materInfo.getMater();
if (CollUtil.isEmpty(mater)) throw new BadRequestException("物料信息为空,请确认!");
JSONObject json = new JSONObject();
JSONArray jsonArray = new JSONArray();
HashMap<String, Object> map = new HashMap<>();
mater.stream().forEach(material -> {
map.put("order_code", material.getOrder_code());
map.put("qty", material.getMaterial_qty());
jsonArray.add(map);
});
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(materInfo.getDevice_code());
json.put("vehicle_code", schBasePoint.getVehicle_code());
json.put("region_code", schBasePoint.getRegion_code());
json.put("materials", jsonArray);
JSONObject jsonObject = wmsToConnectorService.applyRegionAndDueDate(json);
if (ObjectUtil.isNotEmpty(jsonObject) && jsonObject.getInteger("status") == 200) {
JSONArray data = jsonObject.getJSONArray("data");
data.stream().forEach(material -> {
JSONObject jsonObject1 = JSONObject.parseObject(StrUtil.toString(material));
mater.stream().forEach(material1 -> {
if (material1.getOrder_code().equals(jsonObject1.getString("order_code"))) {
material1.setDue_date(jsonObject1.getString("due_date"));
material1.setRegion_code(jsonObject1.getString("next_region_code"));
}
});
});
} else if (ObjectUtil.isNotEmpty(jsonObject) && jsonObject.getInteger("status") == 400) {
throw new BadRequestException(jsonObject.getString("msg"));
}
List<String> materiales = new ArrayList<>();
mater.stream().forEach(material -> {
materiales.add(JSONObject.toJSONString(material));
});
} else if (ObjectUtil.isNotEmpty(jsonObject) && jsonObject.getInteger("status") == 400) {
throw new BadRequestException(jsonObject.getString("msg"));
toJSON.put("material_info", materiales);
toJSON.put("vehicle_code", schBasePoint.getVehicle_code());
toJSON.put("region_code", StrUtil.isNotEmpty(mater.get(0).getRegion_code()) ? mater.get(0).getRegion_code() : schBasePoint.getRegion_code());
fabService.createAgvTask(toJSON, "smt");
return new ResponseEntity(TableDataInfo.build(), HttpStatus.OK);
}
toJSON.put("region_code", JSONObject.parseObject(material_info.get(0)).getString("region_code"));
fabService.createAgvTask(toJSON, "smt");
return new ResponseEntity(TableDataInfo.build(), HttpStatus.OK);
}
//TODO: 根据物料查主盘信息; 当前工序查所有物料 ->
@ -263,7 +281,13 @@ public class FabController {
list.stream().forEach(item -> {
keys.add(item);
});
return new ResponseEntity(keys, HttpStatus.OK);
List<JSONObject> jsonObjectList = new ArrayList<>();
list.stream().forEach(item -> {
JSONObject jsonObject = new JSONObject();
jsonObject.put("order_code", item);
jsonObjectList.add(jsonObject);
});
return new ResponseEntity(jsonObjectList, HttpStatus.OK);
}
/**

27
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/fab/service/impl/FabServiceImpl.java

@ -1,6 +1,7 @@
package org.nl.wms.ext.fab.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@ -51,6 +52,8 @@ public class FabServiceImpl {
private PcOperationSNTTask pcOperationSNTTask;
@Autowired
private CallEmptyTask callEmptyTask;
@Autowired
private ISchBaseVehiclematerialgroupService iSchBaseVehiclematerialgroupService;
public void syncFab(List<String> orders) {
@ -78,9 +81,9 @@ public class FabServiceImpl {
JSONObject param = new JSONObject();
switch (type) {
case "cmt":
Assert.noNullElements(new Object[]{form.getString("device_code"), form.getString("vehicle_code")}, "参数不能为空!");
Assert.noNullElements(new Object[]{form.getString("device_code"),form.getString("vehicle_code")}, "参数不能为空!");
CallMaterVo callMaterVo = form.toJavaObject(CallMaterVo.class);
param.put("device_code", callMaterVo.getPoint_code());
param.put("device_code", callMaterVo.getDevice_code());
param.put("config_code", "PcOperationCMTask");
param.put("region_code", callMaterVo.getRegion_code());
param.put("vehicle_code", callMaterVo.getVehicle_code());
@ -88,15 +91,20 @@ public class FabServiceImpl {
pcOperationCMTask.apply(param);
iSchBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
.eq(SchBasePoint::getPoint_code, callMaterVo.getDevice_code())
.eq(SchBasePoint::getPoint_status, GoodsEnum.IN_STOCK.getValue())
.eq(SchBasePoint::getVehicle_code, callMaterVo.getVehicle_code())
.set(SchBasePoint::getPoint_status, GoodsEnum.EMPTY_PALLETS.getValue())
.eq(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue())
.set(SchBasePoint::getPoint_status, GoodsEnum.IN_STOCK.getValue())
.set(SchBasePoint::getIs_lock, true));
break;
case "cnt":
Assert.noNullElements(new Object[]{form.getString("device_code"), form.getString("vehicle_type"),
form.getString("region_code")}, "参数不能为空!");
Assert.noNullElements(new Object[]{form.getString("device_code"), form.getString("vehicle_type")}, "参数不能为空!");
CallEmpVo callEmpVo = form.toJavaObject(CallEmpVo.class);
SchBasePoint schBasePoint1 = iSchBasePointService.selectByPointCode(form.getString("device_code"));
if(ObjectUtil.isEmpty(schBasePoint1)){
throw new BadRequestException("点位不存在");
}
if(!schBasePoint1.getPoint_status().equals(GoodsEnum.OUT_OF_STOCK.getValue())){
throw new BadRequestException("该点位不是空站点,请确认再呼叫");
}
param.put("device_code", callEmpVo.getDevice_code());
param.put("config_code", "TOSTOREHOUSETask");
param.put("region_code", callEmpVo.getRegion_code());
@ -122,11 +130,12 @@ public class FabServiceImpl {
}
param.put("vehicle_code", sendMaterVo.getVehicle_code());
param.put("vehicle_type", vehicle.getVehicle_type());
pcOperationSMTTask.apply(param);
iSchBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
.eq(SchBasePoint::getPoint_code, sendMaterVo.getDevice_code())
.set(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue())
.set(SchBasePoint::getIs_lock, true));
.set(SchBasePoint::getIs_lock, true)
.set(SchBasePoint::getVehicle_code, null));
pcOperationSMTTask.apply(param);
break;
case "snt":
Assert.noNullElements(new Object[]{form.getString("device_code"), form.getString("region_code")}, "参数不能为空!");

20
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/handheld/service/impl/HandheldServiceImpl.java

@ -12,6 +12,7 @@ import nl.basjes.shaded.org.springframework.util.Assert;
import org.nl.common.enums.VehicleTypeEnum;
import org.nl.common.enums.region.RegionEnum;
import org.nl.common.exception.BadRequestException;
import org.nl.common.utils.RedisUtils;
import org.nl.system.service.user.ISysUserService;
import org.nl.system.service.user.dao.SysUser;
import org.nl.wms.database.vehicle.service.IMdBaseVehicleService;
@ -55,6 +56,8 @@ public class HandheldServiceImpl implements HandheldService {
private WmsToConnectorService wmsToConnectorService;
@Autowired
private ISysUserService iSysUserService;
@Autowired
private RedisUtils redisUtils;
@Override
@ -313,11 +316,11 @@ public class HandheldServiceImpl implements HandheldService {
.eq(SysUser::getUsername, json.getString("username")));
if (ObjectUtil.isEmpty(username)) return null;
List<String> list = JSONUtil.toList(username.getDevices(), String.class);
JSONObject map = new JSONObject();
List<JSONObject> jsonList = new ArrayList<>();
list.stream().forEach(device -> {
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(device);
if (ObjectUtil.isNotEmpty(schBasePoint)) {
JSONObject map = new JSONObject();
map.put("device_code", device);
map.put("device_name", schBasePoint.getPoint_name());
jsonList.add(map);
@ -327,14 +330,25 @@ public class HandheldServiceImpl implements HandheldService {
}
@Override
public JSONObject deviceInLogin(JSONObject json) {
public JSONObject
deviceInLogin(JSONObject json) {
Assert.notNull(json.getString("device_code"), "登录参数不能为空");
if(StrUtil.isNotEmpty(json.getString("device_code"))){
Object regin_code = redisUtils.get("mobile:" + json.getString("device_code"));
if (regin_code != null) {
throw new BadRequestException("当前设备工序已经登陆,无法继续选择");
} else {
redisUtils.set("mobile:" + json.getString("device_code"), json.getString("device_code"));
}
}
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(json.getString("device_code"));
if (ObjectUtil.isNotEmpty(schBasePoint)) {
JSONObject map = new JSONObject();
map.put("device_code", schBasePoint.getPoint_code());
map.put("device_name", schBasePoint.getPoint_name());
map.put("region_points", schBasePoint.getRegion_points());
String region_points = schBasePoint.getRegion_points();
cn.hutool.json.JSONArray jsonArray = JSONUtil.parseArray(region_points);
map.put("region_points", jsonArray);
return map;
}
return null;

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

@ -58,7 +58,7 @@
<select id="selectMaterialByVehicleCode" resultType="java.util.Map" parameterType="java.lang.String">
SELECT
sbv.order_code,
SUM(sbv.material_qty) AS total_material_qty
SUM(sbv.material_qty) AS material_qty
FROM
sch_base_vehiclematerialgroup sbv
WHERE 1 = 1

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

@ -160,10 +160,7 @@ public class SchBaseVehiclematerialgroupServiceImpl extends ServiceImpl<SchBaseV
.eq(SchBaseVehiclematerialgroup::getVehicle_code, vehicle_code));
if(CollUtil.isNotEmpty(order_code)){
orderList.put("region_code",order_code.get(0).getRegion_code());
}
HashMap<String,String> processFlow = processFlowService.selectProcessFlowByOrder(orderList.get("order_code"));
if(CollUtil.isNotEmpty(processFlow)){
orderList.put("due_date",processFlow.get("due_date"));
orderList.put("due_date",order_code.get(0).getDue_date());
}
});
return maps;

1
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/dao/mapper/SchBasePointMapper.xml

@ -43,7 +43,6 @@
<if test="due_date != null and due_date != ''">
and sch_base_vehiclematerialgroup.due_date > #{due_date}
</if>
and has_work = false
AND sch_base_vehiclematerialgroup.region_code = #{region_code}
</select>

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

@ -394,14 +394,14 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
@Override
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
public SchBasePoint selectByEmptyCage(String region_code, String vehicle_type, String pointStatus, boolean isVehicle, SchBaseTask task) {
synchronized (lock){
synchronized (lock) {
List<SchBasePoint> schBasePoints = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class)
.eq(SchBasePoint::getIs_lock, false)
.eq(SchBasePoint::getIs_used, true)
.eq(SchBasePoint::getPoint_status, pointStatus)
.eq(SchBasePoint::getCan_vehicle_type, vehicle_type)
.isNotNull(SchBasePoint::getVehicle_code));
if(CollUtil.isNotEmpty(schBasePoints) && schBasePoints.size() > 0){
if (CollUtil.isNotEmpty(schBasePoints) && schBasePoints.size() > 0) {
return schBasePoints.get(0);
}
schBasePoints = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class)
@ -475,11 +475,23 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
public List<OrderMater> getStructList(String region_code, String vehicle_type) {
//1.查询的结果一个托盘有多个800,PC需要怎么展示?
Param dueDate = iSysParamService.findByCode("due_date");
if (dueDate!=null && StringUtils.isNotEmpty(dueDate.getValue())){
DateUtil.offsetDay(new Date(), Integer.valueOf(dueDate.getValue())).toDateStr();
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(region_code, vehicle_type,dueDate.getValue());
return structList;
SchBasePoint schBasePoint = this.getOne(Wrappers.lambdaQuery(SchBasePoint.class)
.eq(SchBasePoint::getPoint_code, region_code));
List<OrderMater> structList = pointMapper.getStructList(schBasePoint.getRegion_code(), "G01", 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

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

@ -26,7 +26,9 @@ import org.nl.wms.util.TaskUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
@Slf4j
@Component(value = "CNTTask")
@ -52,8 +54,13 @@ public class CNTTask extends AbstractTask {
// 获取任务
List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY);
// 配置信息
/*SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>()
.eq(SchBaseTaskconfig::getConfig_code, TASK_CONFIG_CODE));*/
// 定义按数字后缀排序的比较器
Comparator<SchBaseTask> numericSuffixComparator = (s1, s2) -> {
Integer suffix1 = getNumericSuffix(s1.getPoint_code1());
Integer suffix2 = getNumericSuffix(s2.getPoint_code1());
return suffix1.compareTo(suffix2);
};
tasks.stream().sorted(numericSuffixComparator).collect(Collectors.toList());
for (SchBaseTask task : tasks) {
TaskUtils.setUpdateByAcs(task);
// 找起点
@ -86,6 +93,13 @@ public class CNTTask extends AbstractTask {
}
}
private static Integer getNumericSuffix(String filename) {
// 提取数字后缀
String suffix = filename.replaceAll(".*?(\\d+)$", "$1");
// 将后缀转换为整数,默认值为0
return suffix.isEmpty() ? 0 : Integer.parseInt(suffix);
}
@Override
protected void updateStatus(String task_code, TaskStatus status) {
//TODO:完成任务的时候将int_task_code的清除

27
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/pcoperation/PcOperationCMTask.java

@ -59,10 +59,10 @@ public class PcOperationCMTask extends AbstractTask {
// 找起点
CallMaterVo callMaterVo = JSONObject.parseObject(task.getRequest_param(), CallMaterVo.class);
MdBaseVehicle vehicle = iMdBaseVehicleService.getOne(new QueryWrapper<MdBaseVehicle>().eq("vehicle_code", callMaterVo.getVehicle_code()));
if(ObjectUtil.isEmpty(vehicle)) throw new BadRequestException("载具不存在");
if (ObjectUtil.isEmpty(vehicle)) throw new BadRequestException("载具不存在");
SchBasePoint structPoint = schBasePointService.getOne(new QueryWrapper<SchBasePoint>()
.eq("vehicle_code", vehicle)
.eq("is_lock",false));
.eq("vehicle_code", vehicle.getVehicle_code())
.eq("is_lock", false));
if (ObjectUtil.isEmpty(structPoint)) {
task.setRemark("未找到所需点位!");
taskService.updateById(task);
@ -73,14 +73,15 @@ public class PcOperationCMTask extends AbstractTask {
}
TaskUtils.setUpdateByAcs(task);
taskService.update(new UpdateWrapper<SchBaseTask>()
.set("task_status",TaskStatus.CREATED.getCode())
.set("point_code1",structPoint.getPoint_code())
.eq("task_id",task.getTask_id()));
.set("task_status", TaskStatus.CREATED.getCode())
.set("point_code1", structPoint.getPoint_code())
.set("remark", null)
.eq("task_id", task.getTask_id()));
pointService.update(new UpdateWrapper<SchBasePoint>()
.set("ing_task_code",task.getTask_code())
.set("is_lock",true)
.set("ing_task_code", task.getTask_code())
.set("is_lock", true)
.set("point_status", GoodsEnum.OUT_OF_STOCK.getValue())
.eq("point_code",structPoint.getPoint_code()));
.eq("point_code", structPoint.getPoint_code()));
}
}
@ -122,14 +123,16 @@ public class PcOperationCMTask extends AbstractTask {
if (ObjectUtil.isNotEmpty(schBasePoint)) {
PointUtils.updateByIngTaskCode(schBasePoint);
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, startPoint)
.set(SchBasePoint::getIs_lock, false).set(SchBasePoint::getVehicle_code,null));
.set(SchBasePoint::getIs_lock, false).set(SchBasePoint::getVehicle_code, null));
}
String point_code2 = taskObj.getPoint_code2();
SchBasePoint schBasePoint2 = pointService.selectByPointCode(point_code2);
if (ObjectUtil.isNotEmpty(schBasePoint2)) {
PointUtils.updateByIngTaskCode(schBasePoint2);
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, point_code2)
.set(SchBasePoint::getIs_lock, false));
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
.eq(SchBasePoint::getPoint_code, point_code2)
.set(SchBasePoint::getIs_lock, false)
.set(SchBasePoint::getVehicle_code, taskObj.getVehicle_code()));
}
// 任务完成
taskObj.setTask_status(TaskStatus.FINISHED.getCode());

4
lms/nladmin-ui/src/views/wms/produceScreen/index.vue

@ -236,7 +236,7 @@ export default {
this.show = true
} else if (type === 'BACK') {
crudProduceScreen.fabOrders({ device_code: this.popData.device_code }).then(res => {
this.popList = [...res.content]
this.popList = [...res]
this.show = true
})
}
@ -244,7 +244,7 @@ export default {
handleCurrentChange(val) {
this.currentRow = val
crudProduceScreen.fabMaterial({ vehicle_code: this.currentRow.vehicle_code }).then(res => {
this.popSecList = [...res.content]
this.popSecList = [...res]
})
},
toSure() {

8
lms/nladmin-ui/src/views/wms/produceScreen/setup.vue

@ -23,9 +23,9 @@
<el-select v-model="value" placeholder="请选择">
<el-option
v-for="item in options"
:key="item.point_code"
:label="item.point_name"
:value="item.point_code"
:key="item.device_code"
:label="item.device_name"
:value="item.device_code"
class="option-wraper"
/>
</el-select>
@ -75,7 +75,7 @@ export default {
crudProduceScreen.authLogin({ username: this.username, password: encrypt(this.password) }).then(res => {
this.disabled = false
crudProduceScreen.getUserOrDevice({ username: this.username }).then(res => {
this.options = [...res.content]
this.options = [...res]
this.show = true
})
}).catch(() => {

Loading…
Cancel
Save