fix: 修复pc测试过程中遇到的问题
This commit is contained in:
@@ -80,15 +80,6 @@ public class MobileAuthorizationController {
|
|||||||
if (!userInfo.getIs_used()) {
|
if (!userInfo.getIs_used()) {
|
||||||
throw new BadRequestException("账号未激活");
|
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();
|
CurrentUser user = new CurrentUser();
|
||||||
user.setId(userInfo.getUser_id());
|
user.setId(userInfo.getUser_id());
|
||||||
@@ -112,25 +103,15 @@ public class MobileAuthorizationController {
|
|||||||
roles += role.getRemark() + ',';
|
roles += role.getRemark() + ',';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SchBasePoint schBasePoint = new SchBasePoint();
|
|
||||||
if(StrUtil.isNotEmpty(authUser.getDevice())){
|
|
||||||
schBasePoint = iSchBasePointService.selectByPointCode(authUser.getDevice());
|
|
||||||
}
|
|
||||||
|
|
||||||
// 返回 token 与 用户信息
|
// 返回 token 与 用户信息
|
||||||
JSONObject jsonObject = new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
jsonObject.put("user", userInfo);
|
jsonObject.put("user", userInfo);
|
||||||
String finalRoles = roles;
|
String finalRoles = roles;
|
||||||
SchBasePoint finalSchBasePoint = schBasePoint;
|
|
||||||
JSONObject authInfo = new JSONObject(6) {{
|
JSONObject authInfo = new JSONObject(6) {{
|
||||||
put("token", "Bearer " + StpUtil.getTokenValue());
|
put("token", "Bearer " + StpUtil.getTokenValue());
|
||||||
put("user", jsonObject);
|
put("user", jsonObject);
|
||||||
put("roles", finalRoles);
|
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);
|
return ResponseEntity.ok(authInfo);
|
||||||
@@ -142,7 +123,7 @@ public class MobileAuthorizationController {
|
|||||||
@Log("PC登出")
|
@Log("PC登出")
|
||||||
public ResponseEntity<Object> loginOut(@Validated @RequestBody AuthUserDto authUser) {
|
public ResponseEntity<Object> loginOut(@Validated @RequestBody AuthUserDto authUser) {
|
||||||
// 密码解密 - 前端的加密规则: encrypt(根据实际更改)
|
// 密码解密 - 前端的加密规则: encrypt(根据实际更改)
|
||||||
redisUtils.del("JT_" + authUser.getUsername());
|
redisUtils.del("mobile:" + authUser.getDevice());
|
||||||
return new ResponseEntity(TableDataInfo.build(), HttpStatus.OK);
|
return new ResponseEntity(TableDataInfo.build(), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import com.alibaba.fastjson.JSON;
|
|||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.nl.common.base.TableDataInfo;
|
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.dto.*;
|
||||||
import org.nl.wms.ext.fab.service.impl.FabServiceImpl;
|
import org.nl.wms.ext.fab.service.impl.FabServiceImpl;
|
||||||
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService;
|
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.ISchBasePointService;
|
||||||
import org.nl.wms.sch.point.service.dao.SchBasePoint;
|
import org.nl.wms.sch.point.service.dao.SchBasePoint;
|
||||||
import org.nl.wms.sch.region.service.ISchBaseRegionService;
|
import org.nl.wms.sch.region.service.ISchBaseRegionService;
|
||||||
@@ -93,8 +95,8 @@ public class FabController {
|
|||||||
*/
|
*/
|
||||||
@Log("根据工序查询工单")
|
@Log("根据工序查询工单")
|
||||||
@GetMapping("/regionOrder")
|
@GetMapping("/regionOrder")
|
||||||
public ResponseEntity<TableDataInfo<OrderMater>> regionOrder(String regionCode) {
|
public ResponseEntity<TableDataInfo<OrderMater>> regionOrder(String deviceCode) {
|
||||||
List<OrderMater> structList = iSchBasePointService.getStructList(regionCode, null);
|
List<OrderMater> structList = iSchBasePointService.getStructList(deviceCode, null);
|
||||||
return new ResponseEntity(TableDataInfo.build(structList), HttpStatus.OK);
|
return new ResponseEntity(TableDataInfo.build(structList), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,7 +150,7 @@ public class FabController {
|
|||||||
@PostMapping("/sendVehicle")
|
@PostMapping("/sendVehicle")
|
||||||
public ResponseEntity<TableDataInfo> sendVehicle(@RequestBody SendVehiclesVo sendVehiclesVo) {
|
public ResponseEntity<TableDataInfo> sendVehicle(@RequestBody SendVehiclesVo sendVehiclesVo) {
|
||||||
JSONObject toJSON = (JSONObject) JSON.toJSON(sendVehiclesVo);
|
JSONObject toJSON = (JSONObject) JSON.toJSON(sendVehiclesVo);
|
||||||
List<SendVehicleVo> sendVehicleVoList = sendVehiclesVo.getSendVehicleVoList();
|
List<SendVehicleVo> sendVehicleVoList = sendVehiclesVo.getMater();
|
||||||
if (CollUtil.isEmpty(sendVehicleVoList)) throw new BadRequestException("物料信息为空,请确认!");
|
if (CollUtil.isEmpty(sendVehicleVoList)) throw new BadRequestException("物料信息为空,请确认!");
|
||||||
AtomicReference<Boolean> flag = new AtomicReference<>(false);
|
AtomicReference<Boolean> flag = new AtomicReference<>(false);
|
||||||
sendVehicleVoList.stream().forEach(sendVehicleVo1 -> {
|
sendVehicleVoList.stream().forEach(sendVehicleVo1 -> {
|
||||||
@@ -156,6 +158,7 @@ public class FabController {
|
|||||||
flag.set(true);
|
flag.set(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
sendVehicleVoList.removeIf(sendVehicleVo1 -> (ObjectUtil.isEmpty(sendVehicleVo1) || sendVehicleVo1.getMaterial_qty() == 0));
|
||||||
if (!flag.get()) {
|
if (!flag.get()) {
|
||||||
fabService.createAgvTask(toJSON, "snt");
|
fabService.createAgvTask(toJSON, "snt");
|
||||||
} else {
|
} else {
|
||||||
@@ -163,8 +166,12 @@ public class FabController {
|
|||||||
toJSON.put("vehicle_code", schBasePoint.getVehicle_code());
|
toJSON.put("vehicle_code", schBasePoint.getVehicle_code());
|
||||||
List<String> materiales = new ArrayList<>();
|
List<String> materiales = new ArrayList<>();
|
||||||
sendVehicleVoList.stream().forEach(send -> {
|
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));
|
materiales.add(JSONObject.toJSONString(send));
|
||||||
});
|
});
|
||||||
|
toJSON.put("region_code", schBasePoint.getRegion_code());
|
||||||
toJSON.put("material_info", materiales);
|
toJSON.put("material_info", materiales);
|
||||||
//TODO:修改物料信息
|
//TODO:修改物料信息
|
||||||
fabService.createAgvTask(toJSON, "smt");
|
fabService.createAgvTask(toJSON, "smt");
|
||||||
@@ -196,41 +203,52 @@ public class FabController {
|
|||||||
@Log("工序下料")
|
@Log("工序下料")
|
||||||
@PostMapping("/sendMater")
|
@PostMapping("/sendMater")
|
||||||
public ResponseEntity<TableDataInfo> sendMater(@RequestBody SendMaterVo materInfo) {
|
public ResponseEntity<TableDataInfo> sendMater(@RequestBody SendMaterVo materInfo) {
|
||||||
JSONObject toJSON = (JSONObject) JSON.toJSON(materInfo);
|
if (StrUtil.isNotEmpty(materInfo.getRegion_code())) {
|
||||||
//TODO:待确定
|
JSONObject toJSON = (JSONObject) JSON.toJSON(materInfo);
|
||||||
List<String> material_info = materInfo.getMaterial_info();
|
fabService.createAgvTask(toJSON, "smt");
|
||||||
if (CollUtil.isEmpty(material_info)) throw new BadRequestException("物料信息为空,请确认!");
|
return new ResponseEntity(TableDataInfo.build(), HttpStatus.OK);
|
||||||
JSONObject json = new JSONObject();
|
} else {
|
||||||
JSONArray jsonArray = new JSONArray();
|
JSONObject toJSON = (JSONObject) JSON.toJSON(materInfo);
|
||||||
HashMap<String, Object> map = new HashMap<>();
|
//TODO:待确定
|
||||||
material_info.stream().forEach(material -> {
|
List<SendVehicleVo> mater = materInfo.getMater();
|
||||||
JSONObject jsonObject = JSONObject.parseObject(material);
|
if (CollUtil.isEmpty(mater)) throw new BadRequestException("物料信息为空,请确认!");
|
||||||
map.put("order_code", jsonObject.getString("order_code"));
|
JSONObject json = new JSONObject();
|
||||||
map.put("qty", jsonObject.getString("material_qty"));
|
JSONArray jsonArray = new JSONArray();
|
||||||
jsonArray.add(map);
|
HashMap<String, Object> map = new HashMap<>();
|
||||||
});
|
mater.stream().forEach(material -> {
|
||||||
json.put("vehicle_code", materInfo.getVehicle_code());
|
map.put("order_code", material.getOrder_code());
|
||||||
json.put("region_code", materInfo.getRegion_code());
|
map.put("qty", material.getMaterial_qty());
|
||||||
json.put("materials", jsonArray);
|
jsonArray.add(map);
|
||||||
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"));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
} else if (ObjectUtil.isNotEmpty(jsonObject) && jsonObject.getInteger("status") == 400) {
|
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(materInfo.getDevice_code());
|
||||||
throw new BadRequestException(jsonObject.getString("msg"));
|
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));
|
||||||
|
});
|
||||||
|
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: 根据物料查主盘信息; 当前工序查所有物料 ->
|
//TODO: 根据物料查主盘信息; 当前工序查所有物料 ->
|
||||||
@@ -263,7 +281,13 @@ public class FabController {
|
|||||||
list.stream().forEach(item -> {
|
list.stream().forEach(item -> {
|
||||||
keys.add(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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package org.nl.wms.ext.fab.service.impl;
|
package org.nl.wms.ext.fab.service.impl;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
@@ -51,6 +52,8 @@ public class FabServiceImpl {
|
|||||||
private PcOperationSNTTask pcOperationSNTTask;
|
private PcOperationSNTTask pcOperationSNTTask;
|
||||||
@Autowired
|
@Autowired
|
||||||
private CallEmptyTask callEmptyTask;
|
private CallEmptyTask callEmptyTask;
|
||||||
|
@Autowired
|
||||||
|
private ISchBaseVehiclematerialgroupService iSchBaseVehiclematerialgroupService;
|
||||||
|
|
||||||
|
|
||||||
public void syncFab(List<String> orders) {
|
public void syncFab(List<String> orders) {
|
||||||
@@ -78,9 +81,9 @@ public class FabServiceImpl {
|
|||||||
JSONObject param = new JSONObject();
|
JSONObject param = new JSONObject();
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "cmt":
|
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);
|
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("config_code", "PcOperationCMTask");
|
||||||
param.put("region_code", callMaterVo.getRegion_code());
|
param.put("region_code", callMaterVo.getRegion_code());
|
||||||
param.put("vehicle_code", callMaterVo.getVehicle_code());
|
param.put("vehicle_code", callMaterVo.getVehicle_code());
|
||||||
@@ -88,15 +91,20 @@ public class FabServiceImpl {
|
|||||||
pcOperationCMTask.apply(param);
|
pcOperationCMTask.apply(param);
|
||||||
iSchBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
|
iSchBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
|
||||||
.eq(SchBasePoint::getPoint_code, callMaterVo.getDevice_code())
|
.eq(SchBasePoint::getPoint_code, callMaterVo.getDevice_code())
|
||||||
.eq(SchBasePoint::getPoint_status, GoodsEnum.IN_STOCK.getValue())
|
.eq(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue())
|
||||||
.eq(SchBasePoint::getVehicle_code, callMaterVo.getVehicle_code())
|
.set(SchBasePoint::getPoint_status, GoodsEnum.IN_STOCK.getValue())
|
||||||
.set(SchBasePoint::getPoint_status, GoodsEnum.EMPTY_PALLETS.getValue())
|
|
||||||
.set(SchBasePoint::getIs_lock, true));
|
.set(SchBasePoint::getIs_lock, true));
|
||||||
break;
|
break;
|
||||||
case "cnt":
|
case "cnt":
|
||||||
Assert.noNullElements(new Object[]{form.getString("device_code"), form.getString("vehicle_type"),
|
Assert.noNullElements(new Object[]{form.getString("device_code"), form.getString("vehicle_type")}, "参数不能为空!");
|
||||||
form.getString("region_code")}, "参数不能为空!");
|
|
||||||
CallEmpVo callEmpVo = form.toJavaObject(CallEmpVo.class);
|
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("device_code", callEmpVo.getDevice_code());
|
||||||
param.put("config_code", "TOSTOREHOUSETask");
|
param.put("config_code", "TOSTOREHOUSETask");
|
||||||
param.put("region_code", callEmpVo.getRegion_code());
|
param.put("region_code", callEmpVo.getRegion_code());
|
||||||
@@ -122,11 +130,12 @@ public class FabServiceImpl {
|
|||||||
}
|
}
|
||||||
param.put("vehicle_code", sendMaterVo.getVehicle_code());
|
param.put("vehicle_code", sendMaterVo.getVehicle_code());
|
||||||
param.put("vehicle_type", vehicle.getVehicle_type());
|
param.put("vehicle_type", vehicle.getVehicle_type());
|
||||||
pcOperationSMTTask.apply(param);
|
|
||||||
iSchBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
|
iSchBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
|
||||||
.eq(SchBasePoint::getPoint_code, sendMaterVo.getDevice_code())
|
.eq(SchBasePoint::getPoint_code, sendMaterVo.getDevice_code())
|
||||||
.set(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue())
|
.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;
|
break;
|
||||||
case "snt":
|
case "snt":
|
||||||
Assert.noNullElements(new Object[]{form.getString("device_code"), form.getString("region_code")}, "参数不能为空!");
|
Assert.noNullElements(new Object[]{form.getString("device_code"), form.getString("region_code")}, "参数不能为空!");
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import nl.basjes.shaded.org.springframework.util.Assert;
|
|||||||
import org.nl.common.enums.VehicleTypeEnum;
|
import org.nl.common.enums.VehicleTypeEnum;
|
||||||
import org.nl.common.enums.region.RegionEnum;
|
import org.nl.common.enums.region.RegionEnum;
|
||||||
import org.nl.common.exception.BadRequestException;
|
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.ISysUserService;
|
||||||
import org.nl.system.service.user.dao.SysUser;
|
import org.nl.system.service.user.dao.SysUser;
|
||||||
import org.nl.wms.database.vehicle.service.IMdBaseVehicleService;
|
import org.nl.wms.database.vehicle.service.IMdBaseVehicleService;
|
||||||
@@ -55,6 +56,8 @@ public class HandheldServiceImpl implements HandheldService {
|
|||||||
private WmsToConnectorService wmsToConnectorService;
|
private WmsToConnectorService wmsToConnectorService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysUserService iSysUserService;
|
private ISysUserService iSysUserService;
|
||||||
|
@Autowired
|
||||||
|
private RedisUtils redisUtils;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -313,11 +316,11 @@ public class HandheldServiceImpl implements HandheldService {
|
|||||||
.eq(SysUser::getUsername, json.getString("username")));
|
.eq(SysUser::getUsername, json.getString("username")));
|
||||||
if (ObjectUtil.isEmpty(username)) return null;
|
if (ObjectUtil.isEmpty(username)) return null;
|
||||||
List<String> list = JSONUtil.toList(username.getDevices(), String.class);
|
List<String> list = JSONUtil.toList(username.getDevices(), String.class);
|
||||||
JSONObject map = new JSONObject();
|
|
||||||
List<JSONObject> jsonList = new ArrayList<>();
|
List<JSONObject> jsonList = new ArrayList<>();
|
||||||
list.stream().forEach(device -> {
|
list.stream().forEach(device -> {
|
||||||
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(device);
|
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(device);
|
||||||
if (ObjectUtil.isNotEmpty(schBasePoint)) {
|
if (ObjectUtil.isNotEmpty(schBasePoint)) {
|
||||||
|
JSONObject map = new JSONObject();
|
||||||
map.put("device_code", device);
|
map.put("device_code", device);
|
||||||
map.put("device_name", schBasePoint.getPoint_name());
|
map.put("device_name", schBasePoint.getPoint_name());
|
||||||
jsonList.add(map);
|
jsonList.add(map);
|
||||||
@@ -327,14 +330,25 @@ public class HandheldServiceImpl implements HandheldService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JSONObject deviceInLogin(JSONObject json) {
|
public JSONObject
|
||||||
|
deviceInLogin(JSONObject json) {
|
||||||
Assert.notNull(json.getString("device_code"), "登录参数不能为空");
|
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"));
|
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(json.getString("device_code"));
|
||||||
if (ObjectUtil.isNotEmpty(schBasePoint)) {
|
if (ObjectUtil.isNotEmpty(schBasePoint)) {
|
||||||
JSONObject map = new JSONObject();
|
JSONObject map = new JSONObject();
|
||||||
map.put("device_code", schBasePoint.getPoint_code());
|
map.put("device_code", schBasePoint.getPoint_code());
|
||||||
map.put("device_name", schBasePoint.getPoint_name());
|
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 map;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -58,7 +58,7 @@
|
|||||||
<select id="selectMaterialByVehicleCode" resultType="java.util.Map" parameterType="java.lang.String">
|
<select id="selectMaterialByVehicleCode" resultType="java.util.Map" parameterType="java.lang.String">
|
||||||
SELECT
|
SELECT
|
||||||
sbv.order_code,
|
sbv.order_code,
|
||||||
SUM(sbv.material_qty) AS total_material_qty
|
SUM(sbv.material_qty) AS material_qty
|
||||||
FROM
|
FROM
|
||||||
sch_base_vehiclematerialgroup sbv
|
sch_base_vehiclematerialgroup sbv
|
||||||
WHERE 1 = 1
|
WHERE 1 = 1
|
||||||
|
|||||||
@@ -160,10 +160,7 @@ public class SchBaseVehiclematerialgroupServiceImpl extends ServiceImpl<SchBaseV
|
|||||||
.eq(SchBaseVehiclematerialgroup::getVehicle_code, vehicle_code));
|
.eq(SchBaseVehiclematerialgroup::getVehicle_code, vehicle_code));
|
||||||
if(CollUtil.isNotEmpty(order_code)){
|
if(CollUtil.isNotEmpty(order_code)){
|
||||||
orderList.put("region_code",order_code.get(0).getRegion_code());
|
orderList.put("region_code",order_code.get(0).getRegion_code());
|
||||||
}
|
orderList.put("due_date",order_code.get(0).getDue_date());
|
||||||
HashMap<String,String> processFlow = processFlowService.selectProcessFlowByOrder(orderList.get("order_code"));
|
|
||||||
if(CollUtil.isNotEmpty(processFlow)){
|
|
||||||
orderList.put("due_date",processFlow.get("due_date"));
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return maps;
|
return maps;
|
||||||
|
|||||||
@@ -43,7 +43,6 @@
|
|||||||
<if test="due_date != null and due_date != ''">
|
<if test="due_date != null and due_date != ''">
|
||||||
and sch_base_vehiclematerialgroup.due_date > #{due_date}
|
and sch_base_vehiclematerialgroup.due_date > #{due_date}
|
||||||
</if>
|
</if>
|
||||||
and has_work = false
|
|
||||||
AND sch_base_vehiclematerialgroup.region_code = #{region_code}
|
AND sch_base_vehiclematerialgroup.region_code = #{region_code}
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
@@ -394,14 +394,14 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
|
|||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
|
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
|
||||||
public SchBasePoint selectByEmptyCage(String region_code, String vehicle_type, String pointStatus, boolean isVehicle, SchBaseTask task) {
|
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)
|
List<SchBasePoint> schBasePoints = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class)
|
||||||
.eq(SchBasePoint::getIs_lock, false)
|
.eq(SchBasePoint::getIs_lock, false)
|
||||||
.eq(SchBasePoint::getIs_used, true)
|
.eq(SchBasePoint::getIs_used, true)
|
||||||
.eq(SchBasePoint::getPoint_status, pointStatus)
|
.eq(SchBasePoint::getPoint_status, pointStatus)
|
||||||
.eq(SchBasePoint::getCan_vehicle_type, vehicle_type)
|
.eq(SchBasePoint::getCan_vehicle_type, vehicle_type)
|
||||||
.isNotNull(SchBasePoint::getVehicle_code));
|
.isNotNull(SchBasePoint::getVehicle_code));
|
||||||
if(CollUtil.isNotEmpty(schBasePoints) && schBasePoints.size() > 0){
|
if (CollUtil.isNotEmpty(schBasePoints) && schBasePoints.size() > 0) {
|
||||||
return schBasePoints.get(0);
|
return schBasePoints.get(0);
|
||||||
}
|
}
|
||||||
schBasePoints = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class)
|
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) {
|
public List<OrderMater> getStructList(String region_code, String vehicle_type) {
|
||||||
//1.查询的结果一个托盘有多个800,PC需要怎么展示?
|
//1.查询的结果一个托盘有多个800,PC需要怎么展示?
|
||||||
Param dueDate = iSysParamService.findByCode("due_date");
|
Param dueDate = iSysParamService.findByCode("due_date");
|
||||||
if (dueDate!=null && StringUtils.isNotEmpty(dueDate.getValue())){
|
String s = null;
|
||||||
DateUtil.offsetDay(new Date(), Integer.valueOf(dueDate.getValue())).toDateStr();
|
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());
|
SchBasePoint schBasePoint = this.getOne(Wrappers.lambdaQuery(SchBasePoint.class)
|
||||||
return structList;
|
.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
|
@Override
|
||||||
|
|||||||
@@ -26,7 +26,9 @@ import org.nl.wms.util.TaskUtils;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Component(value = "CNTTask")
|
@Component(value = "CNTTask")
|
||||||
@@ -52,8 +54,13 @@ public class CNTTask extends AbstractTask {
|
|||||||
// 获取任务
|
// 获取任务
|
||||||
List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY);
|
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) {
|
for (SchBaseTask task : tasks) {
|
||||||
TaskUtils.setUpdateByAcs(task);
|
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
|
@Override
|
||||||
protected void updateStatus(String task_code, TaskStatus status) {
|
protected void updateStatus(String task_code, TaskStatus status) {
|
||||||
//TODO:完成任务的时候将int_task_code的清除
|
//TODO:完成任务的时候将int_task_code的清除
|
||||||
|
|||||||
@@ -59,10 +59,10 @@ public class PcOperationCMTask extends AbstractTask {
|
|||||||
// 找起点
|
// 找起点
|
||||||
CallMaterVo callMaterVo = JSONObject.parseObject(task.getRequest_param(), CallMaterVo.class);
|
CallMaterVo callMaterVo = JSONObject.parseObject(task.getRequest_param(), CallMaterVo.class);
|
||||||
MdBaseVehicle vehicle = iMdBaseVehicleService.getOne(new QueryWrapper<MdBaseVehicle>().eq("vehicle_code", callMaterVo.getVehicle_code()));
|
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>()
|
SchBasePoint structPoint = schBasePointService.getOne(new QueryWrapper<SchBasePoint>()
|
||||||
.eq("vehicle_code", vehicle)
|
.eq("vehicle_code", vehicle.getVehicle_code())
|
||||||
.eq("is_lock",false));
|
.eq("is_lock", false));
|
||||||
if (ObjectUtil.isEmpty(structPoint)) {
|
if (ObjectUtil.isEmpty(structPoint)) {
|
||||||
task.setRemark("未找到所需点位!");
|
task.setRemark("未找到所需点位!");
|
||||||
taskService.updateById(task);
|
taskService.updateById(task);
|
||||||
@@ -73,14 +73,15 @@ public class PcOperationCMTask extends AbstractTask {
|
|||||||
}
|
}
|
||||||
TaskUtils.setUpdateByAcs(task);
|
TaskUtils.setUpdateByAcs(task);
|
||||||
taskService.update(new UpdateWrapper<SchBaseTask>()
|
taskService.update(new UpdateWrapper<SchBaseTask>()
|
||||||
.set("task_status",TaskStatus.CREATED.getCode())
|
.set("task_status", TaskStatus.CREATED.getCode())
|
||||||
.set("point_code1",structPoint.getPoint_code())
|
.set("point_code1", structPoint.getPoint_code())
|
||||||
.eq("task_id",task.getTask_id()));
|
.set("remark", null)
|
||||||
|
.eq("task_id", task.getTask_id()));
|
||||||
pointService.update(new UpdateWrapper<SchBasePoint>()
|
pointService.update(new UpdateWrapper<SchBasePoint>()
|
||||||
.set("ing_task_code",task.getTask_code())
|
.set("ing_task_code", task.getTask_code())
|
||||||
.set("is_lock",true)
|
.set("is_lock", true)
|
||||||
.set("point_status", GoodsEnum.OUT_OF_STOCK.getValue())
|
.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)) {
|
if (ObjectUtil.isNotEmpty(schBasePoint)) {
|
||||||
PointUtils.updateByIngTaskCode(schBasePoint);
|
PointUtils.updateByIngTaskCode(schBasePoint);
|
||||||
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, startPoint)
|
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();
|
String point_code2 = taskObj.getPoint_code2();
|
||||||
SchBasePoint schBasePoint2 = pointService.selectByPointCode(point_code2);
|
SchBasePoint schBasePoint2 = pointService.selectByPointCode(point_code2);
|
||||||
if (ObjectUtil.isNotEmpty(schBasePoint2)) {
|
if (ObjectUtil.isNotEmpty(schBasePoint2)) {
|
||||||
PointUtils.updateByIngTaskCode(schBasePoint2);
|
PointUtils.updateByIngTaskCode(schBasePoint2);
|
||||||
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, point_code2)
|
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
|
||||||
.set(SchBasePoint::getIs_lock, false));
|
.eq(SchBasePoint::getPoint_code, point_code2)
|
||||||
|
.set(SchBasePoint::getIs_lock, false)
|
||||||
|
.set(SchBasePoint::getVehicle_code, taskObj.getVehicle_code()));
|
||||||
}
|
}
|
||||||
// 任务完成
|
// 任务完成
|
||||||
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||||
|
|||||||
@@ -236,7 +236,7 @@ export default {
|
|||||||
this.show = true
|
this.show = true
|
||||||
} else if (type === 'BACK') {
|
} else if (type === 'BACK') {
|
||||||
crudProduceScreen.fabOrders({ device_code: this.popData.device_code }).then(res => {
|
crudProduceScreen.fabOrders({ device_code: this.popData.device_code }).then(res => {
|
||||||
this.popList = [...res.content]
|
this.popList = [...res]
|
||||||
this.show = true
|
this.show = true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -244,7 +244,7 @@ export default {
|
|||||||
handleCurrentChange(val) {
|
handleCurrentChange(val) {
|
||||||
this.currentRow = val
|
this.currentRow = val
|
||||||
crudProduceScreen.fabMaterial({ vehicle_code: this.currentRow.vehicle_code }).then(res => {
|
crudProduceScreen.fabMaterial({ vehicle_code: this.currentRow.vehicle_code }).then(res => {
|
||||||
this.popSecList = [...res.content]
|
this.popSecList = [...res]
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
toSure() {
|
toSure() {
|
||||||
|
|||||||
@@ -23,9 +23,9 @@
|
|||||||
<el-select v-model="value" placeholder="请选择">
|
<el-select v-model="value" placeholder="请选择">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in options"
|
v-for="item in options"
|
||||||
:key="item.point_code"
|
:key="item.device_code"
|
||||||
:label="item.point_name"
|
:label="item.device_name"
|
||||||
:value="item.point_code"
|
:value="item.device_code"
|
||||||
class="option-wraper"
|
class="option-wraper"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
@@ -75,7 +75,7 @@ export default {
|
|||||||
crudProduceScreen.authLogin({ username: this.username, password: encrypt(this.password) }).then(res => {
|
crudProduceScreen.authLogin({ username: this.username, password: encrypt(this.password) }).then(res => {
|
||||||
this.disabled = false
|
this.disabled = false
|
||||||
crudProduceScreen.getUserOrDevice({ username: this.username }).then(res => {
|
crudProduceScreen.getUserOrDevice({ username: this.username }).then(res => {
|
||||||
this.options = [...res.content]
|
this.options = [...res]
|
||||||
this.show = true
|
this.show = true
|
||||||
})
|
})
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user