add:现场测试优化
This commit is contained in:
@@ -241,17 +241,17 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml-schemas</artifactId>
|
||||
<version>3.17</version>
|
||||
<version>4.1.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi</artifactId>
|
||||
<version>3.17</version>
|
||||
<version>4.1.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<version>3.17</version>
|
||||
<version>4.1.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>xerces</groupId>
|
||||
|
||||
@@ -79,6 +79,7 @@ public class MobileAuthorizationController {
|
||||
result.put("token", "Bearer " + StpUtil.getTokenValue());
|
||||
result.put("roles", permissionList);
|
||||
result.put("user", user);
|
||||
result.put("is_send", userInfo.getGender());
|
||||
return new ResponseEntity<>(TableDataInfo.buildJson(result), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@@ -146,10 +146,8 @@ public class MdMeMaterialbaseServiceImpl extends ServiceImpl<MdMeMaterialbaseMap
|
||||
List<MdMeMaterialbase> materialList = new ArrayList<>();
|
||||
for (int i = 1; i < read.size(); i++) {
|
||||
List<Object> list = read.get(i);
|
||||
String m1 = String.valueOf(list.get(0));
|
||||
String m2 = String.valueOf(list.get(1));
|
||||
String m3 = ObjectUtil.isEmpty(list.get(2)) ? null : String.valueOf(list.get(2));
|
||||
String m4 = ObjectUtil.isEmpty(list.get(3)) ? null : String.valueOf(list.get(3));
|
||||
String m2 = String.valueOf(list.get(0));
|
||||
String m3 = ObjectUtil.isEmpty(list.get(1)) ? null : String.valueOf(list.get(1));
|
||||
// 根据物料编码查询是否有相同物料编码的物料
|
||||
MdMeMaterialbase mdMeMaterialbase = this.baseMapper.selectOne(
|
||||
new QueryWrapper<MdMeMaterialbase>().lambda()
|
||||
@@ -160,10 +158,8 @@ public class MdMeMaterialbaseServiceImpl extends ServiceImpl<MdMeMaterialbaseMap
|
||||
}
|
||||
MdMeMaterialbase dao = new MdMeMaterialbase();
|
||||
dao.setMaterial_id(IdUtil.getStringId());
|
||||
dao.setMaterial_type(m1);
|
||||
dao.setMaterial_code(m2);
|
||||
dao.setMaterial_name(m3);
|
||||
dao.setUnit_name(m4);
|
||||
dao.setIs_used("1");
|
||||
dao.setIs_delete("0");
|
||||
dao.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||
|
||||
@@ -73,4 +73,10 @@ public class AcsToWmsController {
|
||||
return new ResponseEntity<>(acsToWmsService.applyIn(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/applyOut")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> applyOut(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(acsToWmsService.applyOut(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -49,4 +49,6 @@ public interface AcsToWmsService {
|
||||
JSONObject actionFinishRequest2(JSONObject param);
|
||||
|
||||
JSONObject applyIn(JSONObject jo);
|
||||
|
||||
JSONObject applyOut(JSONObject jo);
|
||||
}
|
||||
|
||||
@@ -165,9 +165,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
}
|
||||
//已分配过二次分配点位
|
||||
if (StringUtils.isNotBlank(baseTask.getResponse_param())) {
|
||||
if ("1".equals(type) && baseTask.getResponse_param().equals(PackageInfoIvtEnum.IS_SEND.code("取货是"))) {
|
||||
if ("1".equals(type) && baseTask.getResponse_param().equals(PackageInfoIvtEnum.IS_ALLOCATE.code("取货是"))) {
|
||||
return baseTask.getPoint_code1();
|
||||
} else if ("2".equals(type) && baseTask.getResponse_param().equals(PackageInfoIvtEnum.IS_SEND.code("放货是"))) {
|
||||
} else if ("2".equals(type) && baseTask.getResponse_param().equals(PackageInfoIvtEnum.IS_ALLOCATE.code("放货是"))) {
|
||||
return baseTask.getPoint_code2();
|
||||
}
|
||||
}
|
||||
@@ -200,6 +200,10 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
} else if (baseTask.getVehicle_code2().equals("4") || baseTask.getVehicle_code2().equals("5")) {
|
||||
if ("1".equals(type)) {
|
||||
updateWrapper.set(SchBaseTask::getPoint_code1, newPoint.getPoint_code());
|
||||
if (StringUtils.isNotBlank(newPoint.getStoragevehicle_code())) {
|
||||
//更新托盘号
|
||||
updateWrapper.set(SchBaseTask::getVehicle_code, newPoint.getStoragevehicle_code());
|
||||
}
|
||||
} else if ("2".equals(type)) {
|
||||
updateWrapper.set(SchBaseTask::getPoint_code2, newPoint.getPoint_code());
|
||||
}
|
||||
@@ -376,10 +380,35 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
String region_code = schBasePoint.getRegion_code();
|
||||
List<RegionCharge> regionCharges = regionChargeMapper.selectList(new LambdaQueryWrapper<RegionCharge>()
|
||||
.eq(RegionCharge::getRegion_code, region_code)
|
||||
.eq(RegionCharge::getIs_delete, Integer.parseInt(GeneralDefinition.NO)));
|
||||
.eq(RegionCharge::getStatus, Integer.parseInt(GeneralDefinition.ONE)));
|
||||
if (regionCharges.size() > 0) {
|
||||
log.info("agv申请进入" + point_code + ",失败,当前区域被管制!");
|
||||
throw new BadRequestException("agv申请进入" + point_code + ",失败,当前区域被管制!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject applyOut(JSONObject param) {
|
||||
log.info("ACS请求agv离开参数:{}", param);
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("status", HttpStatus.HTTP_OK);
|
||||
result.put("message", "agv申请进入成功!");
|
||||
String point_code = param.getString("point_code");
|
||||
if (ObjectUtil.isEmpty(point_code)) {
|
||||
throw new BadRequestException("请求进入失败,管制点不能为空!");
|
||||
}
|
||||
SchBasePoint schBasePoint = pointMapper.selectOne(new LambdaQueryWrapper<SchBasePoint>().eq(SchBasePoint::getPoint_code, point_code));
|
||||
if (ObjectUtil.isEmpty(schBasePoint)) {
|
||||
throw new BadRequestException("请求进入失败,找不到点位是" + point_code + "的管制点位!");
|
||||
}
|
||||
String region_code = schBasePoint.getRegion_code();
|
||||
List<RegionCharge> regionCharges = regionChargeMapper.selectList(new LambdaQueryWrapper<RegionCharge>()
|
||||
.eq(RegionCharge::getRegion_code, region_code)
|
||||
.eq(RegionCharge::getStatus, Integer.parseInt(GeneralDefinition.ONE)));
|
||||
if (regionCharges.size() > 0) {
|
||||
log.info("agv申请进入" + point_code + ",失败,当前区域有人员存在!");
|
||||
throw new BadRequestException("agv申请进入" + point_code + ",失败,当前区域有人员存在!");
|
||||
throw new BadRequestException("agv申请进入" + point_code + ",失败,当前区域被管制!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -348,9 +348,15 @@ public class PdaTaskController {
|
||||
}
|
||||
|
||||
@PostMapping("/finishTask")
|
||||
@Log("终点确认")
|
||||
@Log("强制完成")
|
||||
public PdaResponseVo finishTask(@RequestBody JSONObject whereJson) {
|
||||
return pdaTaskService.finishTask(whereJson);
|
||||
}
|
||||
|
||||
@PostMapping("/messageConfirm")
|
||||
@Log("推送确认")
|
||||
public PdaResponseVo messageConfirm(@RequestBody JSONObject whereJson) {
|
||||
return pdaTaskService.messageConfirm(whereJson);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -109,4 +109,6 @@ public interface PdaTaskService {
|
||||
PdaResponseVo endPointConfirm(JSONObject whereJson);
|
||||
|
||||
PdaResponseVo finishTask(JSONObject whereJson);
|
||||
|
||||
PdaResponseVo messageConfirm(JSONObject whereJson);
|
||||
}
|
||||
|
||||
@@ -75,9 +75,14 @@ public class PdaRequestDto {
|
||||
@Data
|
||||
public static class DataItem {
|
||||
/**
|
||||
* 容器编码(卷号)
|
||||
* 机台
|
||||
*/
|
||||
private String container_code;
|
||||
private String device_code;
|
||||
|
||||
/**
|
||||
* DOFF号
|
||||
*/
|
||||
private String doff_code;
|
||||
|
||||
/**
|
||||
* 物料编码
|
||||
@@ -88,19 +93,5 @@ public class PdaRequestDto {
|
||||
* 物料名称
|
||||
*/
|
||||
private String material_name;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private String qty;
|
||||
|
||||
/**
|
||||
* 计量单位
|
||||
*/
|
||||
private String measure_unit_id;
|
||||
/**
|
||||
* 批次号
|
||||
*/
|
||||
private String pscn;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.wms.pda.task.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
@@ -70,12 +71,16 @@ import org.nl.wms.sch.task_manage.task.core.TaskType;
|
||||
import org.nl.wms.sch.tasks.PdaPointTask;
|
||||
import org.nl.wms.sch.tasks.netsl.NETSLTask;
|
||||
import org.nl.wms.util.TaskUtils;
|
||||
import org.redisson.api.RLock;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import oshi.driver.mac.net.NetStat;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@@ -117,6 +122,8 @@ public class PdaTaskServiceImpl implements PdaTaskService {
|
||||
private MdPbGroupplatedtlMapper mdPbGroupplatedtlMapper;
|
||||
@Autowired
|
||||
private SysParamMapper sysParamMapper;
|
||||
@Autowired
|
||||
private RedissonClient redissonClient;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -261,14 +268,14 @@ public class PdaTaskServiceImpl implements PdaTaskService {
|
||||
throw new BadRequestException("物料信息不能为空");
|
||||
}
|
||||
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
JSONObject jo = data.getJSONObject(i);
|
||||
String container_code = jo.getString("container_code");
|
||||
List<GroupPlatedtl> groupPlatedtlList = groupplatedtlService.selectDtlByContainerCode(container_code);
|
||||
if (ObjectUtil.isNotEmpty(groupPlatedtlList)) {
|
||||
throw new BadRequestException("该卷号【" + container_code + "】已绑定过,请勿重复操作!");
|
||||
}
|
||||
}
|
||||
// for (int i = 0; i < data.size(); i++) {
|
||||
// JSONObject jo = data.getJSONObject(i);
|
||||
// String container_code = jo.getString("container_code");
|
||||
// List<GroupPlatedtl> groupPlatedtlList = groupplatedtlService.selectDtlByContainerCode(container_code);
|
||||
// if (ObjectUtil.isNotEmpty(groupPlatedtlList)) {
|
||||
// throw new BadRequestException("该卷号【" + container_code + "】已绑定过,请勿重复操作!");
|
||||
// }
|
||||
// }
|
||||
SchBasePoint point = pointMapper.selectOne(new LambdaQueryWrapper<SchBasePoint>().eq(SchBasePoint::getPoint_code, point_code));
|
||||
if (ObjectUtil.isEmpty(point)) {
|
||||
throw new BadRequestException("点位" + point_code + "不存在!");
|
||||
@@ -316,57 +323,48 @@ public class PdaTaskServiceImpl implements PdaTaskService {
|
||||
|
||||
private void packageData(List<PdaRequestDto.DataItem> data, String point_code, String vehicleCode) {
|
||||
PdaRequestDto.DataItem jo = data.get(0);
|
||||
String material_name = jo.getMaterial_name();
|
||||
MdMeMaterialbase mdMeMaterialbase = mdMeMaterialbaseMapper.selectOne(new LambdaQueryWrapper<MdMeMaterialbase>().eq(MdMeMaterialbase::getMaterial_name, material_name));
|
||||
String material_code = jo.getMaterial_code();
|
||||
MdMeMaterialbase mdMeMaterialbase = mdMeMaterialbaseMapper.selectOne(new LambdaQueryWrapper<MdMeMaterialbase>().eq(MdMeMaterialbase::getMaterial_code, material_code));
|
||||
if (mdMeMaterialbase == null) {
|
||||
throw new BadRequestException("当前物料不存在【" + material_name + "】");
|
||||
throw new BadRequestException("当前物料【" + material_code + "】不存在");
|
||||
}
|
||||
String measure_unit_id = jo.getMeasure_unit_id();
|
||||
if (StrUtil.isEmpty(vehicleCode)) {
|
||||
vehicleCode = "TP" + TaskUtils.getDateTime("yyMMddHHmmss") + CodeUtil.getNewCode("VEHICLE_CODE");
|
||||
}
|
||||
String device = jo.getDevice_code();
|
||||
String dofCode = jo.getDoff_code();
|
||||
String group_id = org.nl.common.utils.IdUtil.getStringId();
|
||||
List<String> list = new ArrayList<>();
|
||||
List<GroupPlatedtl> groupPlatedtls = new ArrayList<>();
|
||||
int qty = 0;
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
PdaRequestDto.DataItem jsonObject = data.get(i);
|
||||
String container_code = jsonObject.getContainer_code();
|
||||
qty += Integer.parseInt(jsonObject.getQty());
|
||||
String doff_code = jsonObject.getDoff_code();
|
||||
String device_code = jsonObject.getDevice_code();
|
||||
GroupPlatedtl groupPlatedtlBuilder = GroupPlatedtl.builder()
|
||||
.groupdtl_id(org.nl.common.utils.IdUtil.getStringId())
|
||||
.group_id(group_id)
|
||||
.pcsn(jsonObject.getPscn())
|
||||
.container_code(container_code)
|
||||
.doff_code(doff_code)
|
||||
.device_code(device_code)
|
||||
.storagevehicle_code(vehicleCode)
|
||||
.qty(Integer.parseInt(jsonObject.getQty()))
|
||||
.material_code(mdMeMaterialbase.getMaterial_code())
|
||||
.material_name(mdMeMaterialbase.getMaterial_name())
|
||||
.measure_unit_id(measure_unit_id)
|
||||
.unit_name(measure_unit_id)
|
||||
.create_id(SecurityUtils.getCurrentUserId())
|
||||
.create_name(SecurityUtils.getCurrentNickName())
|
||||
.create_time(DateUtil.now())
|
||||
.build();
|
||||
groupPlatedtls.add(groupPlatedtlBuilder);
|
||||
list.add(container_code);
|
||||
}
|
||||
groupplatedtlService.saveBatch(groupPlatedtls);
|
||||
//找到最小卷号
|
||||
String pscn = list.stream().min(String::compareTo).orElse("");
|
||||
GroupPlate groupPlateBuilder = GroupPlate.builder()
|
||||
.group_id(group_id)
|
||||
.material_code(mdMeMaterialbase.getMaterial_code())
|
||||
.material_name(mdMeMaterialbase.getMaterial_name())
|
||||
.pcsn(pscn)
|
||||
.qty(qty)
|
||||
.measure_unit_id(measure_unit_id)
|
||||
.unit_name(measure_unit_id)
|
||||
.device_code(device)
|
||||
.doff_code(dofCode)
|
||||
.storagevehicle_code(vehicleCode)
|
||||
.create_id(SecurityUtils.getCurrentUserId())
|
||||
.create_name(SecurityUtils.getCurrentNickName())
|
||||
.create_time(DateUtil.now())
|
||||
.ext_code(list.toString())
|
||||
.build();
|
||||
groupplateMapper.insert(groupPlateBuilder);
|
||||
SchBasePoint point = pointMapper.selectOne(new LambdaQueryWrapper<SchBasePoint>().eq(SchBasePoint::getPoint_code, point_code));
|
||||
@@ -431,7 +429,8 @@ public class PdaTaskServiceImpl implements PdaTaskService {
|
||||
|
||||
@Override
|
||||
public JSONObject getStartRegions() {
|
||||
List<SchBaseRegion> list = regionMapper.selectList(new LambdaQueryWrapper<SchBaseRegion>().eq(SchBaseRegion::getRegion_code, "KCW"));
|
||||
List<String> regions = Arrays.asList("R1", "R2", "R3", "R4", "R5", "R6", "R7");
|
||||
List<SchBaseRegion> list = regionMapper.selectList(new LambdaQueryWrapper<SchBaseRegion>().in(SchBaseRegion::getRegion_code, regions));
|
||||
List<JSONObject> ja = new ArrayList<>();
|
||||
list.forEach(region -> {
|
||||
JSONObject jo = new JSONObject();
|
||||
@@ -451,7 +450,7 @@ public class PdaTaskServiceImpl implements PdaTaskService {
|
||||
|
||||
@Override
|
||||
public JSONObject getEndRegions() {
|
||||
List<String> regions = Arrays.asList("L1", "L2");
|
||||
List<String> regions = Arrays.asList("R1", "R2", "R3", "R4", "R5", "R6", "R7");
|
||||
List<SchBaseRegion> list = regionMapper.selectList(new LambdaQueryWrapper<SchBaseRegion>().in(SchBaseRegion::getRegion_code, regions));
|
||||
List<JSONObject> ja = new ArrayList<>();
|
||||
list.forEach(region -> {
|
||||
@@ -609,11 +608,10 @@ public class PdaTaskServiceImpl implements PdaTaskService {
|
||||
if (ObjectUtil.isNotEmpty(list)) {
|
||||
list.forEach(groupPlatedtl -> {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("container_code", groupPlatedtl.getContainer_code());
|
||||
jo.put("device_code", groupPlatedtl.getDevice_code());
|
||||
jo.put("doff_code", groupPlatedtl.getDoff_code());
|
||||
jo.put("material_code", groupPlatedtl.getMaterial_code());
|
||||
jo.put("material_name", groupPlatedtl.getMaterial_name());
|
||||
jo.put("qty", groupPlatedtl.getQty());
|
||||
jo.put("measure_unit_id", groupPlatedtl.getUnit_name());
|
||||
arr.add(jo);
|
||||
});
|
||||
}
|
||||
@@ -637,34 +635,32 @@ public class PdaTaskServiceImpl implements PdaTaskService {
|
||||
throw new BadRequestException("点位不存在!");
|
||||
}
|
||||
List<ResponseVo.DataItem> arr = new ArrayList<>();
|
||||
// if (point.getRegion_code().equals(RegionTypeEnum.REGION_TYPE.code("区域1")) || point.getRegion_code().equals(RegionTypeEnum.REGION_TYPE.code("区域2"))) {
|
||||
// ResponseVo.DataItem dataItem = new ResponseVo.DataItem();
|
||||
// dataItem.setValue(RegionTypeEnum.REGION_TYPE.code("区域3"));
|
||||
// dataItem.setText(RegionTypeEnum.REGION_TYPE.code("区域3"));
|
||||
// arr.add(dataItem);
|
||||
// } else if (point.getRegion_code().equals(RegionTypeEnum.REGION_TYPE.code("区域3"))) {
|
||||
// List<String> list = Arrays.asList("R4", "R5");
|
||||
// list.forEach(region_code -> {
|
||||
// ResponseVo.DataItem dataItem = new ResponseVo.DataItem();
|
||||
// dataItem.setValue(region_code);
|
||||
// dataItem.setText(region_code);
|
||||
// arr.add(dataItem);
|
||||
// });
|
||||
// } else
|
||||
if (point.getRegion_code().equals(RegionTypeEnum.REGION_TYPE.code("区域4")) || point.getRegion_code().equals(RegionTypeEnum.REGION_TYPE.code("区域5"))) {
|
||||
List<String> list = Arrays.asList("R6", "R7");
|
||||
list.forEach(region_code -> {
|
||||
ResponseVo.DataItem dataItem = new ResponseVo.DataItem();
|
||||
dataItem.setValue(region_code);
|
||||
if (region_code.equals("R6")) {
|
||||
dataItem.setText("合格区");
|
||||
} else {
|
||||
dataItem.setText("不合格区");
|
||||
}
|
||||
arr.add(dataItem);
|
||||
});
|
||||
} else {
|
||||
|
||||
if (point.getRegion_code().equals(RegionTypeEnum.REGION_TYPE.code("区域4")) || point.getRegion_code().equals(RegionTypeEnum.REGION_TYPE.code("区域5")) || point.getRegion_code().equals(RegionTypeEnum.REGION_TYPE.code("区域3"))) {
|
||||
if (point.getRegion_code().equals(RegionTypeEnum.REGION_TYPE.code("区域3"))) {
|
||||
List<String> list = Arrays.asList("R4", "R5");
|
||||
list.forEach(region_code -> {
|
||||
ResponseVo.DataItem dataItem = new ResponseVo.DataItem();
|
||||
dataItem.setValue(region_code);
|
||||
if (region_code.equals("R4")) {
|
||||
dataItem.setText("区域4");
|
||||
} else {
|
||||
dataItem.setText("区域5");
|
||||
}
|
||||
arr.add(dataItem);
|
||||
});
|
||||
} else {
|
||||
List<String> list = Arrays.asList("R6", "R7");
|
||||
list.forEach(region_code -> {
|
||||
ResponseVo.DataItem dataItem = new ResponseVo.DataItem();
|
||||
dataItem.setValue(region_code);
|
||||
if (region_code.equals("R6")) {
|
||||
dataItem.setText("区域6");
|
||||
} else {
|
||||
dataItem.setText("区域7");
|
||||
}
|
||||
arr.add(dataItem);
|
||||
});
|
||||
}
|
||||
}
|
||||
ResponseVo ret = new ResponseVo();
|
||||
ret.setMessage("查询成功");
|
||||
@@ -674,7 +670,9 @@ public class PdaTaskServiceImpl implements PdaTaskService {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public PdaResponseVo productBlanking(MaterialDto whereJson) {
|
||||
//
|
||||
String point_code = whereJson.getPoint_code();
|
||||
String type = whereJson.getType();
|
||||
if (ObjectUtil.isEmpty(point_code)) {
|
||||
@@ -707,8 +705,8 @@ public class PdaTaskServiceImpl implements PdaTaskService {
|
||||
}
|
||||
// 1.产线下料 2.质检配送 3.质检下料
|
||||
if (CommonParamEnum.ONE.getCode().equals(type)) {
|
||||
if (!point.getRegion_code().equals(RegionTypeEnum.REGION_TYPE.code("区域1"))) {
|
||||
throw new BadRequestException("该点位【" + point.getPoint_code() + "】不是区域1的下料位,请检查输入点位是否有误!");
|
||||
if (!point.getRegion_code().equals(RegionTypeEnum.REGION_TYPE.code("区域1")) && !point.getRegion_code().equals(RegionTypeEnum.REGION_TYPE.code("区域2"))) {
|
||||
throw new BadRequestException("该点位【" + point.getPoint_code() + "】不是区域1或者区域2的下料位,请检查输入点位是否有误!");
|
||||
}
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("point3", point.getPoint_code());
|
||||
@@ -723,17 +721,22 @@ public class PdaTaskServiceImpl implements PdaTaskService {
|
||||
if (!point.getRegion_code().equals(RegionTypeEnum.REGION_TYPE.code("区域3"))) {
|
||||
throw new BadRequestException("该点位【" + point.getPoint_code() + "】不是区域3的下料位,请检查输入点位是否有误!");
|
||||
}
|
||||
String region_code = whereJson.getRegion_code();
|
||||
if (ObjectUtil.isEmpty(region_code)) {
|
||||
throw new BadRequestException("区域不能为空!");
|
||||
}
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("device_code", pointMapper.selectOne(new LambdaQueryWrapper<SchBasePoint>().eq(SchBasePoint::getPoint_code, point.getParent_point_code())).getPoint_code());//等待点
|
||||
param.put("point3", point.getPoint_code());
|
||||
param.put("material_code", point.getMaterial_code());
|
||||
param.put("requestNo", IdUtil.simpleUUID());
|
||||
param.put("config_code", "ZJPSTask");
|
||||
param.put("region_code", region_code);
|
||||
param.put("user_id", "1");
|
||||
taskService.apply(param);
|
||||
}
|
||||
if (CommonParamEnum.THREE.getCode().equals(type)) {
|
||||
if (!point.getRegion_code().equals(RegionTypeEnum.REGION_TYPE.code("区域4")) || !point.getRegion_code().equals(RegionTypeEnum.REGION_TYPE.code("区域5"))) {
|
||||
if (!point.getRegion_code().equals(RegionTypeEnum.REGION_TYPE.code("区域4")) && !point.getRegion_code().equals(RegionTypeEnum.REGION_TYPE.code("区域5"))) {
|
||||
throw new BadRequestException("该点位【" + point.getPoint_code() + "】不是区域4或区域5的下料位,请检查输入点位是否有误!");
|
||||
}
|
||||
String region_code = whereJson.getRegion_code();
|
||||
@@ -812,31 +815,17 @@ public class PdaTaskServiceImpl implements PdaTaskService {
|
||||
if (ObjectUtil.isEmpty(point)) {
|
||||
throw new BadRequestException("点位【+point.getPoint_code()+】不存在!");
|
||||
}
|
||||
List<SchBasePoint> list = pointMapper.selectList(new LambdaQueryWrapper<SchBasePoint>().eq(SchBasePoint::getRegion_code, point.getRegion_code())
|
||||
.eq(SchBasePoint::getPoint_type, "1")
|
||||
.eq(SchBasePoint::getIs_used, "1"));
|
||||
List<JSONObject> ja = new ArrayList<>();
|
||||
if (ObjectUtil.isNotEmpty(list)) {
|
||||
SchBasePoint schBasePoint = list.stream().max(Comparator.comparingInt(SchBasePoint::getRow_num)).orElse(null);
|
||||
Integer row_num = schBasePoint.getRow_num();
|
||||
if (schBasePoint.getRegion_code().equals("R7")){//区域7排数从4开始
|
||||
row_num = row_num - 3;
|
||||
}
|
||||
for (Integer i = 0; i < row_num; i++) {
|
||||
JSONObject jo1 = new JSONObject();
|
||||
int row = i + 1;
|
||||
jo1.put("text", String.valueOf(row));
|
||||
jo1.put("value", String.valueOf(row));
|
||||
ja.add(jo1);
|
||||
}
|
||||
}
|
||||
Integer row_num = point.getRow_num();
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("col",String.valueOf(row_num));
|
||||
ret.put("code", String.valueOf(HttpStatus.HTTP_OK));
|
||||
ret.put("message", "查询成功");
|
||||
ret.put("data", ja);
|
||||
ret.put("data", jo);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public JSONObject cleanPoint(JSONObject whereJson) {
|
||||
log.info("人工开始清空点位");
|
||||
String point_code = whereJson.getString("point_code");
|
||||
@@ -866,6 +855,7 @@ public class PdaTaskServiceImpl implements PdaTaskService {
|
||||
point.setPoint_status(PointStatusEnum.EMPTY_POINT.getCode());
|
||||
point.setStoragevehicle_code("");
|
||||
point.setMaterial_code("");
|
||||
point.setSource_id("");
|
||||
point.setIng_task_code("");
|
||||
point.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||
point.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||
@@ -878,6 +868,7 @@ public class PdaTaskServiceImpl implements PdaTaskService {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public JSONObject cleanCol(JSONObject whereJson) {
|
||||
log.info("人工开始清空列");
|
||||
String point_code = whereJson.getString("point_code");
|
||||
@@ -890,7 +881,7 @@ public class PdaTaskServiceImpl implements PdaTaskService {
|
||||
}
|
||||
Integer col = whereJson.getInteger("col");
|
||||
if (ObjectUtil.isEmpty(col)) {
|
||||
throw new BadRequestException("列不能为空!");
|
||||
throw new BadRequestException("排不能为空!");
|
||||
}
|
||||
List<SchBasePoint> pointListlist = pointMapper.selectList(new LambdaQueryWrapper<SchBasePoint>().eq(SchBasePoint::getRegion_code, schBasePoint.getRegion_code())
|
||||
.eq(SchBasePoint::getPoint_type, "1")
|
||||
@@ -916,6 +907,7 @@ public class PdaTaskServiceImpl implements PdaTaskService {
|
||||
point.setPoint_status(PointStatusEnum.EMPTY_POINT.getCode());
|
||||
point.setStoragevehicle_code("");
|
||||
point.setMaterial_code("");
|
||||
point.setSource_id("");
|
||||
point.setIng_task_code("");
|
||||
point.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||
point.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||
@@ -1053,15 +1045,37 @@ public class PdaTaskServiceImpl implements PdaTaskService {
|
||||
if (ObjectUtil.isEmpty(option)) {
|
||||
throw new BadRequestException("操作不能为空!");
|
||||
}
|
||||
RegionCharge regionCharge = regionChargeMapper.selectOne(new LambdaQueryWrapper<RegionCharge>().eq(RegionCharge::getRegion_code, region_code));
|
||||
if (ObjectUtil.isEmpty(regionCharge)) {
|
||||
throw new BadRequestException("当前区域为:" + region_code + "的管制记录不存在!");
|
||||
}
|
||||
if (option.equals(regionCharge.getStatus())) {
|
||||
throw new BadRequestException("当前区域为:" + region_code + "已经被管制,请勿重复操作!");
|
||||
RLock lock = redissonClient.getLock(region_code);
|
||||
boolean getLock;
|
||||
try {
|
||||
getLock = lock.tryLock(0, TimeUnit.SECONDS);
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
try {
|
||||
if (getLock) {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
SchBaseRegion schBaseRegion = regionMapper.selectOne(new LambdaQueryWrapper<SchBaseRegion>().eq(SchBaseRegion::getRegion_code, region_code));
|
||||
RegionCharge regionCharge = regionChargeMapper.selectOne(new LambdaQueryWrapper<RegionCharge>().eq(RegionCharge::getRegion_code, region_code));
|
||||
if (ObjectUtil.isEmpty(regionCharge)) {
|
||||
RegionCharge charge = RegionCharge.builder()
|
||||
.regioncharge_id(IdUtil.simpleUUID())
|
||||
.region_code(region_code)
|
||||
.region_name(schBaseRegion.getRegion_name())
|
||||
.is_delete(Integer.parseInt(GeneralDefinition.NO))
|
||||
.status(option)
|
||||
.create_id(currentUserId)
|
||||
.create_name(SecurityUtils.getCurrentNickName())
|
||||
.create_time(DateUtil.now())
|
||||
.build();
|
||||
regionChargeMapper.insert(charge);
|
||||
return PdaResponseVo.pdaResultOk("管制成功!");
|
||||
}
|
||||
if (option.equals(regionCharge.getStatus())) {
|
||||
throw new BadRequestException("当前区域为:" + region_code + "已经被管制,请勿重复操作!");
|
||||
}
|
||||
|
||||
//下发ACS,执行管制区域动作
|
||||
//下发ACS,执行管制区域动作
|
||||
// JSONArray paramArr = new JSONArray();
|
||||
// JSONObject param = new JSONObject();
|
||||
// param.put("device_code", region_code);
|
||||
@@ -1074,15 +1088,18 @@ public class PdaTaskServiceImpl implements PdaTaskService {
|
||||
// if (!StrUtil.equals(result.getString("status"), "200")) {
|
||||
// throw new BadRequestException("操作失败:" + result.getString("message "));
|
||||
// }
|
||||
|
||||
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
regionCharge.setStatus(option);
|
||||
regionCharge.setUpdate_optid(currentUserId);
|
||||
regionCharge.setUpdate_optname(nickName);
|
||||
regionCharge.setUpdate_time(DateUtil.now());
|
||||
regionChargeMapper.updateById(regionCharge);
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
regionCharge.setStatus(option);
|
||||
regionCharge.setUpdate_optid(currentUserId);
|
||||
regionCharge.setUpdate_optname(nickName);
|
||||
regionCharge.setUpdate_time(DateUtil.now());
|
||||
regionChargeMapper.updateById(regionCharge);
|
||||
}
|
||||
} finally {
|
||||
if (getLock) {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
return PdaResponseVo.pdaResultOk("管制成功!");
|
||||
}
|
||||
|
||||
@@ -1097,15 +1114,37 @@ public class PdaTaskServiceImpl implements PdaTaskService {
|
||||
if (ObjectUtil.isEmpty(option)) {
|
||||
throw new BadRequestException("操作不能为空!");
|
||||
}
|
||||
RegionCharge regionCharge = regionChargeMapper.selectOne(new LambdaQueryWrapper<RegionCharge>().eq(RegionCharge::getRegion_code, region_code));
|
||||
if (ObjectUtil.isEmpty(regionCharge)) {
|
||||
throw new BadRequestException("当前区域为:" + region_code + "的管制记录不存在!");
|
||||
}
|
||||
if (option.equals(regionCharge.getStatus())) {
|
||||
throw new BadRequestException("当前车区域为:" + region_code + "已经被恢复,请勿重复操作!");
|
||||
RLock lock = redissonClient.getLock(region_code);
|
||||
boolean getLock;
|
||||
try {
|
||||
getLock = lock.tryLock(0, TimeUnit.SECONDS);
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
try {
|
||||
if (getLock) {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
SchBaseRegion schBaseRegion = regionMapper.selectOne(new LambdaQueryWrapper<SchBaseRegion>().eq(SchBaseRegion::getRegion_code, region_code));
|
||||
RegionCharge regionCharge = regionChargeMapper.selectOne(new LambdaQueryWrapper<RegionCharge>().eq(RegionCharge::getRegion_code, region_code));
|
||||
if (ObjectUtil.isEmpty(regionCharge)) {
|
||||
RegionCharge charge = RegionCharge.builder()
|
||||
.regioncharge_id(IdUtil.simpleUUID())
|
||||
.region_code(region_code)
|
||||
.region_name(schBaseRegion.getRegion_name())
|
||||
.is_delete(Integer.parseInt(GeneralDefinition.NO))
|
||||
.status(option)
|
||||
.create_id(currentUserId)
|
||||
.create_name(SecurityUtils.getCurrentNickName())
|
||||
.create_time(DateUtil.now())
|
||||
.build();
|
||||
regionChargeMapper.insert(charge);
|
||||
return PdaResponseVo.pdaResultOk("解除管制成功!");
|
||||
}
|
||||
if (option.equals(regionCharge.getStatus())) {
|
||||
throw new BadRequestException("当前车区域为:" + region_code + "已经被恢复,请勿重复操作!");
|
||||
}
|
||||
|
||||
//下发ACS,执行释放区域动作
|
||||
//下发ACS,执行释放区域动作
|
||||
// JSONArray paramArr = new JSONArray();
|
||||
// JSONObject param = new JSONObject();
|
||||
// param.put("device_code", region_code);
|
||||
@@ -1119,72 +1158,92 @@ public class PdaTaskServiceImpl implements PdaTaskService {
|
||||
// throw new BadRequestException("操作失败:" + result.getString("message "));
|
||||
// }
|
||||
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
regionCharge.setStatus(option);
|
||||
regionCharge.setUpdate_optid(currentUserId);
|
||||
regionCharge.setUpdate_optname(nickName);
|
||||
regionCharge.setUpdate_time(DateUtil.now());
|
||||
regionChargeMapper.updateById(regionCharge);
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
regionCharge.setStatus(option);
|
||||
regionCharge.setUpdate_optid(currentUserId);
|
||||
regionCharge.setUpdate_optname(nickName);
|
||||
regionCharge.setUpdate_time(DateUtil.now());
|
||||
regionChargeMapper.updateById(regionCharge);
|
||||
}
|
||||
} finally {
|
||||
if (getLock) {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
return PdaResponseVo.pdaResultOk("解除管制成功!");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public PdaResponseVo materialTransfer(JSONObject whereJson) {
|
||||
String point_code1 = whereJson.getString("point_code1");
|
||||
String point_code2 = whereJson.getString("point_code2");
|
||||
if (ObjectUtil.isEmpty(point_code1) || ObjectUtil.isEmpty(point_code2)) {
|
||||
throw new BadRequestException("点位不能为空");
|
||||
RLock lock = redissonClient.getLock("materialTransfer");
|
||||
boolean getLock;
|
||||
try {
|
||||
getLock = lock.tryLock(0, TimeUnit.SECONDS);
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
SchBasePoint point1 = pointMapper.selectOne(new LambdaQueryWrapper<SchBasePoint>().eq(SchBasePoint::getPoint_code, point_code1));
|
||||
SchBasePoint point2 = pointMapper.selectOne(new LambdaQueryWrapper<SchBasePoint>().eq(SchBasePoint::getPoint_code, point_code2));
|
||||
if (ObjectUtil.isEmpty(point1)) {
|
||||
throw new BadRequestException("点位1不存在");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(point2)) {
|
||||
throw new BadRequestException("点位2不存在");
|
||||
}
|
||||
if (point1.getPoint_status().equals("1")) {
|
||||
throw new BadRequestException("点位1为:" + point_code1 + "的点位无货!");
|
||||
}
|
||||
if (point2.getPoint_status().equals("2")) {
|
||||
throw new BadRequestException("点位2为:" + point_code2 + "的点位有货!");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(point1.getStoragevehicle_code())) {
|
||||
throw new BadRequestException("点位1为:" + point_code1 + "的点位无托盘号!");
|
||||
}
|
||||
List<GroupPlate> groupPlates = groupplateMapper.selectList(new LambdaQueryWrapper<GroupPlate>().eq(GroupPlate::getStoragevehicle_code, point1.getStoragevehicle_code()));
|
||||
if (groupPlates.size() == 0) {
|
||||
throw new BadRequestException("点位1为:" + point_code1 + "的点位无物料组盘信息!");
|
||||
}
|
||||
boolean flag1 = isSingleTask(point_code1);
|
||||
if (flag1) {
|
||||
throw new BadRequestException("点位1为:" + point_code1 + "的点位有未完成的任务!");
|
||||
}
|
||||
boolean flag2 = isSingleTask(point_code2);
|
||||
if (flag2) {
|
||||
throw new BadRequestException("点位2为:" + point_code2 + "的点位有未完成的任务!");
|
||||
}
|
||||
//清空点位1的点位信息
|
||||
String storagevehicle_code = point1.getStoragevehicle_code();
|
||||
String material_code = point1.getMaterial_code();
|
||||
point1.setPoint_status(PointStatusEnum.EMPTY_POINT.getCode());
|
||||
point1.setStoragevehicle_code("");
|
||||
point1.setMaterial_code("");
|
||||
point1.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||
point1.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||
point1.setUpdate_time(DateUtil.now());
|
||||
try {
|
||||
if (getLock) {
|
||||
String point_code1 = whereJson.getString("point_code1");
|
||||
String point_code2 = whereJson.getString("point_code2");
|
||||
if (ObjectUtil.isEmpty(point_code1) || ObjectUtil.isEmpty(point_code2)) {
|
||||
throw new BadRequestException("点位不能为空");
|
||||
}
|
||||
SchBasePoint point1 = pointMapper.selectOne(new LambdaQueryWrapper<SchBasePoint>().eq(SchBasePoint::getPoint_code, point_code1));
|
||||
SchBasePoint point2 = pointMapper.selectOne(new LambdaQueryWrapper<SchBasePoint>().eq(SchBasePoint::getPoint_code, point_code2));
|
||||
if (ObjectUtil.isEmpty(point1)) {
|
||||
throw new BadRequestException("点位1不存在");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(point2)) {
|
||||
throw new BadRequestException("点位2不存在");
|
||||
}
|
||||
if (point1.getPoint_status().equals("1")) {
|
||||
throw new BadRequestException("点位1为:" + point_code1 + "的点位无货!");
|
||||
}
|
||||
if (point2.getPoint_status().equals("2")) {
|
||||
throw new BadRequestException("点位2为:" + point_code2 + "的点位有货!");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(point1.getStoragevehicle_code())) {
|
||||
throw new BadRequestException("点位1为:" + point_code1 + "的点位无托盘号!");
|
||||
}
|
||||
List<GroupPlate> groupPlates = groupplateMapper.selectList(new LambdaQueryWrapper<GroupPlate>().eq(GroupPlate::getStoragevehicle_code, point1.getStoragevehicle_code()));
|
||||
if (groupPlates.size() == 0) {
|
||||
throw new BadRequestException("点位1为:" + point_code1 + "的点位无物料组盘信息!");
|
||||
}
|
||||
boolean flag1 = isSingleTask(point_code1);
|
||||
if (flag1) {
|
||||
throw new BadRequestException("点位1为:" + point_code1 + "的点位有未完成的任务!");
|
||||
}
|
||||
boolean flag2 = isSingleTask(point_code2);
|
||||
if (flag2) {
|
||||
throw new BadRequestException("点位2为:" + point_code2 + "的点位有未完成的任务!");
|
||||
}
|
||||
//清空点位1的点位信息
|
||||
String storagevehicle_code = point1.getStoragevehicle_code();
|
||||
String material_code = point1.getMaterial_code();
|
||||
point1.setPoint_status(PointStatusEnum.EMPTY_POINT.getCode());
|
||||
point1.setStoragevehicle_code("");
|
||||
point1.setMaterial_code("");
|
||||
point1.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||
point1.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||
point1.setUpdate_time(DateUtil.now());
|
||||
|
||||
//绑定点位2的信息
|
||||
point2.setPoint_status(PointStatusEnum.EMPTY_VEHICLE.getCode());
|
||||
point2.setStoragevehicle_code(storagevehicle_code);
|
||||
point2.setMaterial_code(material_code);
|
||||
point2.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||
point2.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||
point2.setUpdate_time(DateUtil.now());
|
||||
pointMapper.updateById(point1);
|
||||
pointMapper.updateById(point2);
|
||||
//绑定点位2的信息
|
||||
point2.setPoint_status(PointStatusEnum.EMPTY_VEHICLE.getCode());
|
||||
point2.setStoragevehicle_code(storagevehicle_code);
|
||||
point2.setMaterial_code(material_code);
|
||||
point2.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||
point2.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||
point2.setUpdate_time(DateUtil.now());
|
||||
pointMapper.updateById(point1);
|
||||
pointMapper.updateById(point2);
|
||||
}
|
||||
} finally {
|
||||
if (getLock) {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
return PdaResponseVo.pdaResultOk("移库成功!");
|
||||
}
|
||||
|
||||
@@ -1311,6 +1370,88 @@ public class PdaTaskServiceImpl implements PdaTaskService {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PdaResponseVo messageConfirm(JSONObject whereJson) {
|
||||
String type = whereJson.getString("type");
|
||||
log.info("消息推送确认,请求参数{}", type);
|
||||
if (ObjectUtil.isEmpty(type)) {
|
||||
throw new BadRequestException("操作类型不能为空!");
|
||||
}
|
||||
List<SchBasePoint> list = pointMapper.selectList(new LambdaQueryWrapper<SchBasePoint>().eq(SchBasePoint::getRegion_code, "R6")
|
||||
.eq(SchBasePoint::getPoint_type, "1")
|
||||
.eq(SchBasePoint::getIs_last, 1));
|
||||
List<SchBasePoint> list1 = pointMapper.selectList(new LambdaQueryWrapper<SchBasePoint>().eq(SchBasePoint::getRegion_code, "R7")
|
||||
.eq(SchBasePoint::getPoint_type, "1")
|
||||
.eq(SchBasePoint::getIs_last, 1));
|
||||
if (list.isEmpty() || list1.isEmpty()) {
|
||||
throw new BadRequestException("请先确认区域6或者区域7每排是否配置最后一个点位属性!");
|
||||
}
|
||||
if ("1".equals(type)) {
|
||||
for (SchBasePoint schBasePoint : list) {
|
||||
if (!schBasePoint.getPoint_status().equals(PointStatusEnum.EMPTY_VEHICLE.getCode())) {
|
||||
continue;
|
||||
} else {
|
||||
if (ObjectUtil.isEmpty(schBasePoint.getSource_id())) {
|
||||
continue;
|
||||
}
|
||||
Date date = new Date();
|
||||
date.setTime(date.getTime() + 1 * 60 * 1000);
|
||||
String format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date);
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("type", type);
|
||||
jo.put("date", format);
|
||||
schBasePoint.setSource_id(jo.toJSONString());
|
||||
pointMapper.updateById(schBasePoint);
|
||||
}
|
||||
}
|
||||
for (SchBasePoint schBasePoint : list1) {
|
||||
if (!schBasePoint.getPoint_status().equals(PointStatusEnum.EMPTY_VEHICLE.getCode())) {
|
||||
continue;
|
||||
} else {
|
||||
if (ObjectUtil.isEmpty(schBasePoint.getSource_id())) {
|
||||
continue;
|
||||
}
|
||||
Date date = new Date();
|
||||
date.setTime(date.getTime() + 1 * 60 * 1000);
|
||||
String format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date);
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("type", type);
|
||||
jo.put("date", format);
|
||||
schBasePoint.setSource_id(jo.toJSONString());
|
||||
pointMapper.updateById(schBasePoint);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (SchBasePoint schBasePoint : list) {
|
||||
if (!schBasePoint.getPoint_status().equals(PointStatusEnum.EMPTY_VEHICLE.getCode())) {
|
||||
continue;
|
||||
} else {
|
||||
if (ObjectUtil.isEmpty(schBasePoint.getSource_id())) {
|
||||
continue;
|
||||
}
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("type", type);
|
||||
schBasePoint.setSource_id(jo.toJSONString());
|
||||
pointMapper.updateById(schBasePoint);
|
||||
}
|
||||
}
|
||||
for (SchBasePoint schBasePoint : list1) {
|
||||
if (!schBasePoint.getPoint_status().equals(PointStatusEnum.EMPTY_VEHICLE.getCode())) {
|
||||
continue;
|
||||
} else {
|
||||
if (ObjectUtil.isEmpty(schBasePoint.getSource_id())) {
|
||||
continue;
|
||||
}
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("type", type);
|
||||
schBasePoint.setSource_id(jo.toJSONString());
|
||||
pointMapper.updateById(schBasePoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
return PdaResponseVo.pdaResultOk("操作成功!");
|
||||
}
|
||||
|
||||
|
||||
//判断该点位是否存在未完成的任务
|
||||
public boolean isSingleTask(String point_code) {
|
||||
@@ -1350,11 +1491,10 @@ public class PdaTaskServiceImpl implements PdaTaskService {
|
||||
if (ObjectUtil.isNotEmpty(list)) {
|
||||
list.forEach(groupPlatedtl -> {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("container_code", groupPlatedtl.getContainer_code());
|
||||
jo.put("device_code", groupPlatedtl.getDevice_code());
|
||||
jo.put("doff_code", groupPlatedtl.getDoff_code());
|
||||
jo.put("material_code", groupPlatedtl.getMaterial_code());
|
||||
jo.put("material_name", groupPlatedtl.getMaterial_name());
|
||||
jo.put("qty", groupPlatedtl.getQty());
|
||||
jo.put("measure_unit_id", groupPlatedtl.getUnit_name());
|
||||
arr.add(jo);
|
||||
});
|
||||
}
|
||||
@@ -1535,10 +1675,10 @@ public class PdaTaskServiceImpl implements PdaTaskService {
|
||||
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
PdaRequestDto.DataItem jo = data.get(i);
|
||||
String container_code = jo.getContainer_code();
|
||||
List<GroupPlatedtl> groupPlatedtlList = groupplatedtlService.selectDtlByContainerCode(container_code);
|
||||
String doff_code = jo.getDoff_code();
|
||||
List<GroupPlatedtl> groupPlatedtlList = groupplatedtlService.selectDtlByContainerCode(doff_code);
|
||||
if (ObjectUtil.isNotEmpty(groupPlatedtlList)) {
|
||||
throw new BadRequestException("该卷号【" + container_code + "】已绑定过,请勿重复操作!");
|
||||
throw new BadRequestException("该DOFF号【" + doff_code + "】已绑定过,请勿重复操作!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1557,7 +1697,7 @@ public class PdaTaskServiceImpl implements PdaTaskService {
|
||||
SchBasePoint schBasePoint = list.get(i);
|
||||
boolean singleTask = isSingleTask(schBasePoint.getPoint_code());
|
||||
if (singleTask) {
|
||||
throw new BadRequestException("请检查当前点位前面的位置是否有任务,请按顺序放货!");
|
||||
throw new BadRequestException("请检查当前点位后面的位置是否有任务,请按顺序放货!");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1568,13 +1708,13 @@ public class PdaTaskServiceImpl implements PdaTaskService {
|
||||
.eq(SchBasePoint::getRegion_code, point.getRegion_code())
|
||||
.eq(SchBasePoint::getPoint_type, point.getPoint_type())
|
||||
.eq(SchBasePoint::getRow_num, point.getRow_num())
|
||||
.lt(SchBasePoint::getIn_order_seq, point.getIn_order_seq()));
|
||||
.gt(SchBasePoint::getIn_order_seq, point.getIn_order_seq()));
|
||||
if (ObjectUtil.isNotEmpty(list)) {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
SchBasePoint schBasePoint = list.get(i);
|
||||
boolean singleTask = isSingleTask(schBasePoint.getPoint_code());
|
||||
if (singleTask) {
|
||||
throw new BadRequestException("请检查当前点位前面的位置是否有任务,请按顺序放货!");
|
||||
throw new BadRequestException("请检查当前点位后面的位置是否有任务,请按顺序放货!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,15 @@ public class RegionStructIvtVo {
|
||||
* 物料编码
|
||||
*/
|
||||
private String material_code;
|
||||
|
||||
/**
|
||||
* 机台
|
||||
*/
|
||||
private String device_code;
|
||||
/**
|
||||
* DOFF号
|
||||
*/
|
||||
private String doff_code;
|
||||
/**
|
||||
* 物料名称
|
||||
*/
|
||||
|
||||
@@ -15,4 +15,5 @@ public class RegionStructQuery extends BaseQuery<SchBaseRegion> {
|
||||
private String material_code;
|
||||
private String storagevehicle_code;
|
||||
private String pcsn;
|
||||
private String doff_code;
|
||||
}
|
||||
|
||||
@@ -89,20 +89,22 @@ public class GroupController {
|
||||
}
|
||||
String measure_unit_id = jo.getString("measure_unit_id");
|
||||
String unit_name = jo.getString("unit_name");
|
||||
String device_code = jo.getString("device_code");
|
||||
String dofCode = jo.getString("doff_code");
|
||||
String vehicleCode = "TP" + TaskUtils.getDateTime("yyMMddHHmmss") + CodeUtil.getNewCode("VEHICLE_CODE");
|
||||
String group_id = org.nl.common.utils.IdUtil.getStringId();
|
||||
List<String> list = new ArrayList<>();
|
||||
List<GroupPlatedtl> groupPlatedtls = new ArrayList<>();
|
||||
int qty = 0;
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
JSONObject jsonObject = rows.get(i);
|
||||
String container_code = jsonObject.getString("container_code");
|
||||
String doff_code = jsonObject.getString("doff_code");
|
||||
qty += jsonObject.getIntValue("qty");
|
||||
GroupPlatedtl groupPlatedtlBuilder = GroupPlatedtl.builder()
|
||||
.groupdtl_id(org.nl.common.utils.IdUtil.getStringId())
|
||||
.group_id(group_id)
|
||||
.pcsn(jsonObject.getString("pcsn"))
|
||||
.container_code(container_code)
|
||||
.doff_code(doff_code)
|
||||
.device_code(jsonObject.getString("device_code"))
|
||||
.storagevehicle_code(vehicleCode)
|
||||
.qty(jsonObject.getIntValue("qty"))
|
||||
.material_code(mdMeMaterialbase.getMaterial_code())
|
||||
@@ -111,24 +113,18 @@ public class GroupController {
|
||||
.unit_name(unit_name)
|
||||
.build();
|
||||
groupPlatedtls.add(groupPlatedtlBuilder);
|
||||
list.add(container_code);
|
||||
}
|
||||
groupplatedtlService.saveBatch(groupPlatedtls);
|
||||
//找到最小卷号
|
||||
String pscn = list.stream().min(String::compareTo).orElse("");
|
||||
GroupPlate groupPlateBuilder = GroupPlate.builder()
|
||||
.group_id(group_id)
|
||||
.material_code(mdMeMaterialbase.getMaterial_code())
|
||||
.material_name(mdMeMaterialbase.getMaterial_name())
|
||||
.pcsn(pscn)
|
||||
.qty(qty)
|
||||
.measure_unit_id(measure_unit_id)
|
||||
.unit_name(unit_name)
|
||||
.storagevehicle_code(vehicleCode)
|
||||
.doff_code(dofCode)
|
||||
.device_code(device_code)
|
||||
.create_id(SecurityUtils.getCurrentUserId())
|
||||
.create_name(SecurityUtils.getCurrentNickName())
|
||||
.create_time(DateUtil.now())
|
||||
.ext_code(list.toString())
|
||||
.build();
|
||||
groupplateMapper.insert(groupPlateBuilder);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
|
||||
@@ -41,6 +41,16 @@ public class GroupPlate implements Serializable {
|
||||
*/
|
||||
private String material_name;
|
||||
|
||||
/**
|
||||
* DOFF号
|
||||
*/
|
||||
private String doff_code;
|
||||
|
||||
/**
|
||||
* 机台
|
||||
*/
|
||||
private String device_code;
|
||||
|
||||
|
||||
/**
|
||||
* 批次
|
||||
|
||||
@@ -44,9 +44,14 @@ public class GroupPlatedtl implements Serializable {
|
||||
private String material_name;
|
||||
|
||||
/**
|
||||
* 卷号
|
||||
* DOFF号
|
||||
*/
|
||||
private String container_code;
|
||||
private String doff_code;
|
||||
|
||||
/**
|
||||
* 机台
|
||||
*/
|
||||
private String device_code;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -34,9 +34,8 @@
|
||||
mater.material_name LIKE #{param.material_code} )
|
||||
</if>
|
||||
|
||||
<if test="param.pcsn != null and param.pcsn != ''">
|
||||
AND
|
||||
late.pcsn LIKE #{param.pcsn}
|
||||
<if test="param.doff_code != null and param.doff_code != ''">
|
||||
AND late.doff_code = #{param.doff_code}
|
||||
</if>
|
||||
|
||||
<if test="param.storagevehicle_code != null and param.storagevehicle_code != ''">
|
||||
|
||||
@@ -23,7 +23,7 @@ public class MdPbGroupplatedtlServiceImpl extends ServiceImpl<MdPbGroupplatedtlM
|
||||
|
||||
@Override
|
||||
public List<GroupPlatedtl> selectDtlByContainerCode(String container_code) {
|
||||
List<GroupPlatedtl> list = mdpbGroupplatedtlMapper.selectList(new LambdaQueryWrapper<GroupPlatedtl>().eq(GroupPlatedtl::getContainer_code, container_code));
|
||||
List<GroupPlatedtl> list = mdpbGroupplatedtlMapper.selectList(new LambdaQueryWrapper<GroupPlatedtl>().eq(GroupPlatedtl::getDoff_code, container_code));
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,6 +108,9 @@ public class SchBasePoint implements Serializable {
|
||||
/** 是否使用 */
|
||||
private Boolean is_used;
|
||||
|
||||
/** 是否为最后一个位置 */
|
||||
private Boolean is_last;
|
||||
|
||||
/** 创建人 */
|
||||
private String create_id;
|
||||
|
||||
|
||||
@@ -62,6 +62,8 @@
|
||||
md_me_materialbase.material_spec,
|
||||
md_pb_groupplate.pcsn,
|
||||
md_pb_groupplate.qty,
|
||||
md_pb_groupplate.device_code,
|
||||
md_pb_groupplate.doff_code,
|
||||
md_pb_groupplate.frozen_qty,
|
||||
md_pb_groupplate.unit_name,
|
||||
md_pb_groupplate.status,
|
||||
@@ -80,10 +82,14 @@
|
||||
<if test="query.point_code != null">
|
||||
AND sch_base_point.point_code = #{query.point_code}
|
||||
</if>
|
||||
<if test="query.doff_code != null">
|
||||
AND md_pb_groupplate.doff_code = #{query.doff_code}
|
||||
</if>
|
||||
<if test="query.material_code != null">
|
||||
AND md_pb_groupplate.material_code = #{query.material_code}
|
||||
</if>
|
||||
|
||||
|
||||
</select>
|
||||
<select id="selectListByRegion" resultType="org.nl.wms.sch.point.service.dao.SchBasePoint"
|
||||
parameterType="java.lang.String">
|
||||
@@ -222,19 +228,32 @@
|
||||
SELECT *
|
||||
FROM `sch_base_point` p
|
||||
WHERE p.region_code = #{region_code}
|
||||
AND p.parent_point_code = #{point_code2}
|
||||
AND p.ext_point_code = #{point_code2}
|
||||
AND point_type = '1'
|
||||
AND is_used = 1
|
||||
AND point_status = "1"
|
||||
<if test='region_code != "R3"'>
|
||||
AND 0 = (
|
||||
SELECT COUNT(1) FROM sch_base_point p2
|
||||
WHERE
|
||||
p2.point_status = '2'
|
||||
AND p2.row_num = p.row_num
|
||||
AND p2.col_num <![CDATA[<]]> p.col_num
|
||||
AND p2.in_order_seq > p.in_order_seq
|
||||
AND p2.point_type = '1'
|
||||
AND p2.region_code = #{region_code}
|
||||
)
|
||||
</if>
|
||||
<if test='region_code == "R3"'>
|
||||
AND 0 = (
|
||||
SELECT COUNT(1) FROM sch_base_point p2
|
||||
WHERE
|
||||
p2.point_status = '2'
|
||||
AND p2.point_location = p.point_location
|
||||
AND p2.in_order_seq > p.in_order_seq
|
||||
AND p2.point_type = '1'
|
||||
AND p2.region_code = 'R3'
|
||||
)
|
||||
</if>
|
||||
ORDER BY in_order_seq asc
|
||||
</select>
|
||||
<select id="getSamePoints" resultType="org.nl.wms.sch.point.service.dao.SchBasePoint">
|
||||
@@ -263,10 +282,10 @@
|
||||
SELECT *
|
||||
FROM `sch_base_point` p
|
||||
WHERE p.region_code = #{region_code}
|
||||
AND p.parent_point_code = #{point_code2}
|
||||
AND p.parent_point_code = #{point_code1}
|
||||
AND point_type = '2'
|
||||
AND is_used = 1
|
||||
AND point_status = "1"
|
||||
AND point_status = "2"
|
||||
AND 0 = (
|
||||
SELECT COUNT(1) FROM sch_base_point p2
|
||||
WHERE
|
||||
@@ -287,6 +306,6 @@
|
||||
AND p.row_num = #{point.row_num}
|
||||
AND p.point_location = #{point.point_location}
|
||||
AND point_type = '1'
|
||||
AND p.in_order_seq <![CDATA[<]]> #{point.in_order_seq}
|
||||
AND p.in_order_seq <![CDATA[>]]> #{point.in_order_seq}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -95,6 +95,9 @@ public class SchBasePointDto implements Serializable {
|
||||
/** 是否启用 */
|
||||
private Boolean is_used;
|
||||
|
||||
/** 是否为最后一个位置 */
|
||||
private Boolean is_last;
|
||||
|
||||
/** 创建人 */
|
||||
private String create_id;
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package org.nl.wms.sch.task_manage;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.SneakyThrows;
|
||||
@@ -34,50 +37,97 @@ public class AutoInventoryReport {
|
||||
@SneakyThrows
|
||||
public void run() {
|
||||
log.debug("定时任务AutoInventoryReport开始执行:");
|
||||
boolean flag = checkFullInventory();
|
||||
if (flag) {
|
||||
log.debug("定时任务AutoInventoryReport执行结束:");
|
||||
}
|
||||
checkFullInventory();
|
||||
}
|
||||
|
||||
public boolean checkFullInventory() {
|
||||
public void checkFullInventory() {
|
||||
List<SchBasePoint> list = schBasePointMapper.selectList(new LambdaQueryWrapper<SchBasePoint>().eq(SchBasePoint::getRegion_code, "R6")
|
||||
.eq(SchBasePoint::getPoint_type, "1"));
|
||||
.eq(SchBasePoint::getPoint_type, "1")
|
||||
.eq(SchBasePoint::getIs_last, 1));
|
||||
List<SchBasePoint> list1 = schBasePointMapper.selectList(new LambdaQueryWrapper<SchBasePoint>().eq(SchBasePoint::getRegion_code, "R7")
|
||||
.eq(SchBasePoint::getPoint_type, "1"));
|
||||
|
||||
Map<Integer, List<SchBasePoint>> groupedByRow = list.stream()
|
||||
.collect(Collectors.groupingBy(SchBasePoint::getRow_num));
|
||||
Map<Integer, List<SchBasePoint>> groupedByRow1 = list1.stream()
|
||||
.collect(Collectors.groupingBy(SchBasePoint::getRow_num));
|
||||
Map<Integer, List<SchBasePoint>> mergedMap = Stream.of(groupedByRow, groupedByRow1)
|
||||
.flatMap(map -> map.entrySet().stream())
|
||||
.collect(Collectors.toMap(
|
||||
Map.Entry::getKey,
|
||||
Map.Entry::getValue,
|
||||
(list3, list4) -> {
|
||||
list3.addAll(list4);
|
||||
return list3;
|
||||
}
|
||||
));
|
||||
|
||||
for (Map.Entry<Integer, List<SchBasePoint>> entry : mergedMap.entrySet()) {
|
||||
List<SchBasePoint> points = entry.getValue();
|
||||
if (points.stream().allMatch(point -> point.getPoint_status().equals(PointStatusEnum.EMPTY_VEHICLE.getCode()))) {
|
||||
SchBasePoint schBasePoint = points.get(0);
|
||||
JSONObject res = new JSONObject();
|
||||
res.put("data", schBasePoint.getRegion_code() + "区域第" + schBasePoint.getRow_num() + "排库存已满!");
|
||||
SocketMsg messageInfo = new SocketMsg(res, MsgType.INFO);
|
||||
try {
|
||||
webSocketServer.sendInfo(messageInfo, "sid");
|
||||
} catch (IOException e) {
|
||||
throw new BadRequestException(LangProcess.msg("error_Send"));
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
.eq(SchBasePoint::getPoint_type, "1")
|
||||
.eq(SchBasePoint::getIs_last, 1));
|
||||
if (list.isEmpty() || list1.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for (SchBasePoint schBasePoint : list) {
|
||||
if (!schBasePoint.getPoint_status().equals(PointStatusEnum.EMPTY_VEHICLE.getCode())) {
|
||||
continue;
|
||||
} else {
|
||||
if (ObjectUtil.isEmpty(schBasePoint.getSource_id())) {
|
||||
Integer row_num = schBasePoint.getRow_num();
|
||||
stringBuilder.append(schBasePoint.getRegion_code())
|
||||
.append("区域第")
|
||||
.append(row_num)
|
||||
.append("排库存已满!请及时取货!");
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("type", "2");
|
||||
schBasePoint.setSource_id(jo.toJSONString());
|
||||
schBasePointMapper.updateById(schBasePoint);
|
||||
}else {
|
||||
JSONObject jsonObject = JSONObject.parseObject(schBasePoint.getSource_id());
|
||||
String type = jsonObject.getString("type");//1-稍后提醒 2-确定(不再提醒)
|
||||
if (type.equals("1")) {
|
||||
String nowTime = DateUtil.now();
|
||||
String date = jsonObject.getString("date");
|
||||
long compareResult = DateUtil.compare(DateUtil.parse(date), DateUtil.parse(nowTime));
|
||||
if (compareResult <= 0) {
|
||||
Integer row_num = schBasePoint.getRow_num();
|
||||
stringBuilder.append(schBasePoint.getRegion_code())
|
||||
.append("区域第")
|
||||
.append(row_num)
|
||||
.append("排库存已满!请及时取货!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (SchBasePoint schBasePoint : list1) {
|
||||
if (!schBasePoint.getPoint_status().equals(PointStatusEnum.EMPTY_VEHICLE.getCode())) {
|
||||
continue;
|
||||
} else {
|
||||
if (ObjectUtil.isEmpty(schBasePoint.getSource_id())) {
|
||||
Integer row_num = schBasePoint.getRow_num();
|
||||
stringBuilder.append(schBasePoint.getRegion_code())
|
||||
.append("区域第")
|
||||
.append(row_num)
|
||||
.append("排库存已满!请及时取货!");
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("type", "2");
|
||||
schBasePoint.setSource_id(jo.toJSONString());
|
||||
schBasePointMapper.updateById(schBasePoint);
|
||||
}else {
|
||||
JSONObject jsonObject = JSONObject.parseObject(schBasePoint.getSource_id());
|
||||
String type = jsonObject.getString("type");//1-稍后提醒 2-确定(不再提醒)
|
||||
if (StrUtil.isNotEmpty(type)) {
|
||||
if (type.equals("1")) {
|
||||
String nowTime = DateUtil.now();
|
||||
String date = jsonObject.getString("date");
|
||||
long compareResult = DateUtil.compare(DateUtil.parse(date), DateUtil.parse(nowTime));
|
||||
if (compareResult <= 0) {
|
||||
Integer row_num = schBasePoint.getRow_num();
|
||||
stringBuilder.append(schBasePoint.getRegion_code())
|
||||
.append("区域第")
|
||||
.append(row_num)
|
||||
.append("排库存已满!请及时取货!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (stringBuilder.length() > 0) {
|
||||
JSONObject res = new JSONObject();
|
||||
res.put("data", stringBuilder);
|
||||
SocketMsg messageInfo = new SocketMsg(res, MsgType.INFO);
|
||||
try {
|
||||
webSocketServer.sendInfo(messageInfo, "sid");
|
||||
} catch (IOException e) {
|
||||
throw new BadRequestException(LangProcess.msg("error_Send"));
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ public class SCXLTask extends AbstractTask {
|
||||
findNextPoint(nextRegionStr, task);
|
||||
}
|
||||
|
||||
private void findNextPoint(List<String> nextRegionStr, SchBaseTask task) {
|
||||
public void findNextPoint(List<String> nextRegionStr, SchBaseTask task) {
|
||||
RedissonUtils.lock(c -> {
|
||||
//按组找同一半区没有阻挡的空闲点位
|
||||
List<SchBasePoint> points = scxlMapper.findNextPoint(nextRegionStr);
|
||||
@@ -116,6 +116,9 @@ public class SCXLTask extends AbstractTask {
|
||||
schBasePoint = point;
|
||||
break;
|
||||
}
|
||||
if (schBasePoint == null){
|
||||
throw new BadRequestException("区域3接收区域没有空闲的点位!");
|
||||
}
|
||||
// 设置终点并修改创建成功状态
|
||||
task.setPoint_code2(schBasePoint.getExt_point_code());
|
||||
task.setPoint_code4(schBasePoint.getPoint_code());
|
||||
@@ -134,39 +137,6 @@ public class SCXLTask extends AbstractTask {
|
||||
PointUtils.setUpdateByAcs(schBasePoint);
|
||||
pointService.updateById(schBasePoint);
|
||||
return true;
|
||||
// List<SchBasePoint> points = pointService.list(new LambdaQueryWrapper<SchBasePoint>()
|
||||
// .in(SchBasePoint::getRegion_code, nextRegionStr)
|
||||
// .eq(SchBasePoint::getPoint_status, PointStatusEnum.EMPTY_POINT.getCode())
|
||||
// .eq(SchBasePoint::getIng_task_code, "")
|
||||
// .eq(SchBasePoint::getIs_used, true)
|
||||
// .orderByAsc(SchBasePoint::getIn_order_seq));
|
||||
//
|
||||
// if (CollectionUtils.isEmpty(points)) {
|
||||
// throw new BadRequestException("区域3没有空闲的上料点位!");
|
||||
// }
|
||||
// SchBasePoint point = getNextPoint(points);
|
||||
// if (ObjectUtil.isNull(point)) {
|
||||
// // 找不到一排都为空的点位 取第一列第一个为空的位置
|
||||
// point = points.get(0);
|
||||
// }
|
||||
// // 设置终点并修改创建成功状态
|
||||
// task.setPoint_code2(point.getPoint_code());
|
||||
// String requestParam = task.getRequest_param();
|
||||
// JSONObject jsonObject = JSONObject.parseObject(requestParam);
|
||||
// String point3 = jsonObject.getString("point3");
|
||||
// if (StrUtil.isNotEmpty(point3)){
|
||||
// task.setPoint_code3(point3);
|
||||
// }
|
||||
// // 设置终点并修改创建成功状态
|
||||
// task.setVehicle_code2(PackageInfoIvtEnum.AGV_ACTION_TYPE.code("取货二次分配"));
|
||||
// task.setRemark("");
|
||||
// task.setTask_status(TaskStatus.CREATED.getCode());
|
||||
// taskService.save(task);
|
||||
// // 点位更新
|
||||
// point.setIng_task_code(task.getTask_code());
|
||||
// PointUtils.setUpdateByAcs(point);
|
||||
// pointService.updateById(point);
|
||||
// return true;
|
||||
}, "SCXLTask", null);
|
||||
}
|
||||
|
||||
@@ -182,7 +152,7 @@ public class SCXLTask extends AbstractTask {
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean checkMaxTaskNum(SchBasePoint point) {
|
||||
public boolean checkMaxTaskNum(SchBasePoint point) {
|
||||
String ext_point_code = point.getExt_point_code();
|
||||
if (StrUtil.isEmpty(ext_point_code)){
|
||||
throw new BadRequestException("该点位【"+point.getPoint_code()+"】没有设置等待点位!");
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
WHERE
|
||||
p1.point_status = '1'
|
||||
AND p1.point_type = '1'
|
||||
AND p1.is_used= '1'
|
||||
AND p1.region_code = 'R3'
|
||||
AND 0 = (
|
||||
SELECT COUNT(*)
|
||||
|
||||
@@ -85,7 +85,7 @@ public class ZJPSTask extends AbstractTask {
|
||||
String requestParam = task.getRequest_param();
|
||||
JSONObject jsonObject = JSONObject.parseObject(requestParam);
|
||||
String regionCode = jsonObject.getString("region_code");
|
||||
findNextPoint(nextRegionStr, task);
|
||||
findNextPoint(nextRegionStr,regionCode, task);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,56 +100,113 @@ public class ZJPSTask extends AbstractTask {
|
||||
List<String> nextRegionStr = Arrays.stream(taskConfig.getNext_region_str().split(","))
|
||||
.collect(Collectors.toList());
|
||||
// 找终点
|
||||
findNextPoint(nextRegionStr, task);
|
||||
String requestParam = task.getRequest_param();
|
||||
JSONObject jsonObject = JSONObject.parseObject(requestParam);
|
||||
String regionCode = jsonObject.getString("region_code");
|
||||
findNextPoint(nextRegionStr,regionCode, task);
|
||||
}
|
||||
|
||||
private void findNextPoint(List<String> nextRegionStr,SchBaseTask task) {
|
||||
RedissonUtils.lock(c -> {
|
||||
List<SchBasePoint> points = zjpsMapper.findNextPoint(nextRegionStr);
|
||||
if (CollectionUtils.isEmpty(points)) {
|
||||
throw new BadRequestException("区域4和区域5没有空闲的上料点位!");
|
||||
}
|
||||
SchBasePoint schBasePoint = null;
|
||||
for (int i = 0; i < points.size(); i++) {
|
||||
SchBasePoint point = points.get(i);
|
||||
|
||||
//判断该点位的所在的排是否达到任务最大数
|
||||
if (!checkMaxTaskNum(point)) {
|
||||
continue;
|
||||
public void findNextPoint(List<String> nextRegionStr,String regionCode,SchBaseTask task) {
|
||||
if ("R4".equals(regionCode)) {
|
||||
RedissonUtils.lock(c -> {
|
||||
List<SchBasePoint> points = zjpsMapper.findNextPoint(nextRegionStr,regionCode);
|
||||
if (CollectionUtils.isEmpty(points)) {
|
||||
throw new BadRequestException("区域4没有空闲的上料点位!");
|
||||
}
|
||||
schBasePoint = point;
|
||||
break;
|
||||
}
|
||||
// 设置终点并修改创建成功状态
|
||||
task.setPoint_code2(schBasePoint.getExt_point_code());
|
||||
task.setPoint_code4(schBasePoint.getPoint_code());
|
||||
String requestParam = task.getRequest_param();
|
||||
JSONObject jsonObject = JSONObject.parseObject(requestParam);
|
||||
String point3 = jsonObject.getString("point3");
|
||||
if (StrUtil.isNotEmpty(point3)){
|
||||
task.setPoint_code3(point3);
|
||||
}
|
||||
task.setVehicle_code2(PackageInfoIvtEnum.AGV_ACTION_TYPE.code("取放货二次分配"));
|
||||
task.setRemark("");
|
||||
task.setTask_status(TaskStatus.CREATED.getCode());
|
||||
taskService.save(task);
|
||||
// 点位更新
|
||||
schBasePoint.setIng_task_code(task.getTask_code());
|
||||
PointUtils.setUpdateByAcs(schBasePoint);
|
||||
pointService.updateById(schBasePoint);
|
||||
return true;
|
||||
}, "ZJPSTask", null);
|
||||
SchBasePoint schBasePoint = null;
|
||||
for (int i = 0; i < points.size(); i++) {
|
||||
SchBasePoint point = points.get(i);
|
||||
|
||||
//判断该点位的所在的排是否达到任务最大数
|
||||
if (!checkMaxTaskNum(point)) {
|
||||
continue;
|
||||
}
|
||||
schBasePoint = point;
|
||||
break;
|
||||
}
|
||||
if (schBasePoint == null) {
|
||||
throw new BadRequestException("区域4没有空闲的上料点位!");
|
||||
}
|
||||
// 设置终点并修改创建成功状态
|
||||
task.setPoint_code2(schBasePoint.getExt_point_code());
|
||||
task.setPoint_code4(schBasePoint.getPoint_code());
|
||||
String requestParam = task.getRequest_param();
|
||||
JSONObject jsonObject = JSONObject.parseObject(requestParam);
|
||||
String point3 = jsonObject.getString("point3");
|
||||
if (StrUtil.isNotEmpty(point3)){
|
||||
task.setPoint_code3(point3);
|
||||
}
|
||||
task.setVehicle_code2(PackageInfoIvtEnum.AGV_ACTION_TYPE.code("取放货二次分配"));
|
||||
task.setRemark("");
|
||||
task.setTask_status(TaskStatus.CREATED.getCode());
|
||||
taskService.save(task);
|
||||
// 点位更新
|
||||
schBasePoint.setIng_task_code(task.getTask_code());
|
||||
PointUtils.setUpdateByAcs(schBasePoint);
|
||||
pointService.updateById(schBasePoint);
|
||||
return true;
|
||||
}, "ZJPSToR4Task", null);
|
||||
}else {
|
||||
RedissonUtils.lock(c -> {
|
||||
List<SchBasePoint> points = zjpsMapper.findNextPoint(nextRegionStr,regionCode);
|
||||
if (CollectionUtils.isEmpty(points)) {
|
||||
throw new BadRequestException("区域5没有空闲的上料点位!");
|
||||
}
|
||||
SchBasePoint schBasePoint = null;
|
||||
for (int i = 0; i < points.size(); i++) {
|
||||
SchBasePoint point = points.get(i);
|
||||
|
||||
//判断该点位的所在的排是否达到任务最大数
|
||||
if (!checkMaxTaskNum(point)) {
|
||||
continue;
|
||||
}
|
||||
schBasePoint = point;
|
||||
break;
|
||||
}
|
||||
if (schBasePoint == null) {
|
||||
throw new BadRequestException("区域5没有空闲的上料点位!");
|
||||
}
|
||||
// 设置终点并修改创建成功状态
|
||||
task.setPoint_code2(schBasePoint.getExt_point_code());
|
||||
task.setPoint_code4(schBasePoint.getPoint_code());
|
||||
String requestParam = task.getRequest_param();
|
||||
JSONObject jsonObject = JSONObject.parseObject(requestParam);
|
||||
String point3 = jsonObject.getString("point3");
|
||||
if (StrUtil.isNotEmpty(point3)){
|
||||
task.setPoint_code3(point3);
|
||||
}
|
||||
task.setVehicle_code2(PackageInfoIvtEnum.AGV_ACTION_TYPE.code("取放货二次分配"));
|
||||
task.setRemark("");
|
||||
task.setTask_status(TaskStatus.CREATED.getCode());
|
||||
taskService.save(task);
|
||||
// 点位更新
|
||||
schBasePoint.setIng_task_code(task.getTask_code());
|
||||
PointUtils.setUpdateByAcs(schBasePoint);
|
||||
pointService.updateById(schBasePoint);
|
||||
return true;
|
||||
}, "ZJPSToR5Task", null);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean checkMaxTaskNum(SchBasePoint point) {
|
||||
public boolean checkMaxTaskNum(SchBasePoint point) {
|
||||
String ext_point_code = point.getExt_point_code();
|
||||
if (StrUtil.isEmpty(ext_point_code)){
|
||||
throw new BadRequestException("该点位【"+point.getPoint_code()+"】没有设置等待点位!");
|
||||
}
|
||||
String region_code = point.getRegion_code();
|
||||
Param zjpsTaskNum = new Param();
|
||||
if (region_code.equals("R4")) {
|
||||
zjpsTaskNum = paramService.findByCode("ZJXLToR4Task_num");
|
||||
}else if (region_code.equals("R5")) {
|
||||
zjpsTaskNum = paramService.findByCode("ZJXLToR5Task_num");
|
||||
}
|
||||
List<SchBaseTask> zjpsTask = taskService.findUnFinishTasksByTaskConfigAndPointCode("ZJPSTask", ext_point_code);
|
||||
Param zjpsTaskNum = paramService.findByCode("ZJPSTask_num");
|
||||
if (zjpsTaskNum == null) {
|
||||
throw new BadRequestException("请先设置参数【ZJPSTask_num】!");
|
||||
if (region_code.equals("R4")) {
|
||||
throw new BadRequestException("请先设置参数【ZJXLToR4Task_num】!");
|
||||
}else if (region_code.equals("R5")) {
|
||||
throw new BadRequestException("请先设置参数【ZJXLToR5Task_num】!");
|
||||
}
|
||||
}
|
||||
if (zjpsTask.size() >= Integer.parseInt(zjpsTaskNum.getValue())) {
|
||||
return false;
|
||||
|
||||
@@ -7,5 +7,5 @@ import org.nl.wms.sch.point.service.dao.SchBasePoint;
|
||||
import java.util.List;
|
||||
|
||||
public interface ZJPSMapper {
|
||||
List<SchBasePoint> findNextPoint(@Param("nextRegionStr") List<String> nextRegionStr);
|
||||
List<SchBasePoint> findNextPoint(@Param("nextRegionStr") List<String> nextRegionStr, @Param("regionCode") String regionCode);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
p1.point_status = '1'
|
||||
AND p1.point_type = '1'
|
||||
AND p1.is_used= '1'
|
||||
AND p1.region_code = #{regionCode}
|
||||
AND 0 = (
|
||||
SELECT COUNT(*)
|
||||
FROM sch_base_task
|
||||
@@ -18,15 +19,15 @@
|
||||
AND task_status <![CDATA[<]]> '5'
|
||||
AND is_delete = '0'
|
||||
)
|
||||
AND (p1.region_code = 'R4' OR p1.region_code = 'R5')
|
||||
AND 0 = (
|
||||
SELECT COUNT(1) FROM sch_base_point p2
|
||||
WHERE
|
||||
p2.point_status = '2'
|
||||
AND p2.row_num = p1.row_num
|
||||
AND p2.col_num <![CDATA[<]]> p1.col_num
|
||||
AND p2.in_order_seq > p1.in_order_seq
|
||||
AND p2.point_type = '1'
|
||||
AND (p2.region_code = 'R4' OR p2.region_code = 'R5')
|
||||
AND p2.region_code = #{regionCode}
|
||||
)
|
||||
ORDER BY p1.in_order_seq
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -82,7 +82,6 @@ public class ZJXLTask extends AbstractTask {
|
||||
List<String> nextRegionStr = Arrays.stream(taskConfig.getNext_region_str().split(","))
|
||||
.collect(Collectors.toList());
|
||||
// 找终点
|
||||
// 找终点
|
||||
String requestParam = task.getRequest_param();
|
||||
JSONObject jsonObject = JSONObject.parseObject(requestParam);
|
||||
String regionCode = jsonObject.getString("region_code");
|
||||
@@ -100,7 +99,6 @@ public class ZJXLTask extends AbstractTask {
|
||||
TaskUtils.setUpdateByAcs(task);
|
||||
List<String> nextRegionStr = Arrays.stream(taskConfig.getNext_region_str().split(","))
|
||||
.collect(Collectors.toList());
|
||||
// 找起点
|
||||
String requestParam = task.getRequest_param();
|
||||
JSONObject jsonObject = JSONObject.parseObject(requestParam);
|
||||
String regionCode = jsonObject.getString("region_code");
|
||||
@@ -108,7 +106,7 @@ public class ZJXLTask extends AbstractTask {
|
||||
findNextPoint(nextRegionStr,regionCode,task);
|
||||
}
|
||||
|
||||
private void findNextPoint(List<String> nextRegionStr,String regionCode,SchBaseTask task) {
|
||||
public void findNextPoint(List<String> nextRegionStr,String regionCode,SchBaseTask task) {
|
||||
// 查找R6 R7区域的空闲点位
|
||||
if ("R6".equals(regionCode)) {
|
||||
RedissonUtils.lock(c -> {
|
||||
@@ -128,6 +126,9 @@ public class ZJXLTask extends AbstractTask {
|
||||
schBasePoint = point;
|
||||
break;
|
||||
}
|
||||
if (schBasePoint == null) {
|
||||
throw new BadRequestException("区域6没有空闲的点位!");
|
||||
}
|
||||
// 设置终点并修改创建成功状态
|
||||
task.setPoint_code2(schBasePoint.getExt_point_code());
|
||||
task.setPoint_code4(schBasePoint.getPoint_code());
|
||||
@@ -165,6 +166,9 @@ public class ZJXLTask extends AbstractTask {
|
||||
schBasePoint = point;
|
||||
break;
|
||||
}
|
||||
if (schBasePoint == null) {
|
||||
throw new BadRequestException("区域7没有空闲的点位!");
|
||||
}
|
||||
// 设置终点并修改创建成功状态
|
||||
task.setPoint_code2(schBasePoint.getExt_point_code());
|
||||
task.setPoint_code4(schBasePoint.getPoint_code());
|
||||
@@ -187,7 +191,7 @@ public class ZJXLTask extends AbstractTask {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean checkMaxTaskNum(SchBasePoint point) {
|
||||
public boolean checkMaxTaskNum(SchBasePoint point) {
|
||||
String ext_point_code = point.getExt_point_code();
|
||||
if (StrUtil.isEmpty(ext_point_code)){
|
||||
throw new BadRequestException("该点位【"+point.getPoint_code()+"】没有设置等待点位!");
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
WHERE
|
||||
p1.point_status = '1'
|
||||
AND p1.point_type = '1'
|
||||
AND p1.is_used= '1'
|
||||
AND p1.region_code = #{regionCode}
|
||||
AND 0 = (
|
||||
SELECT COUNT(*)
|
||||
@@ -24,7 +25,7 @@
|
||||
WHERE
|
||||
p2.point_status = '2'
|
||||
AND p2.row_num = p1.row_num
|
||||
AND p2.col_num <![CDATA[<]]> p1.col_num
|
||||
AND p2.in_order_seq > p1.in_order_seq
|
||||
AND p2.point_type = '1'
|
||||
AND p2.region_code = #{regionCode}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user