rev:码垛下料校验
This commit is contained in:
@@ -1,15 +1,10 @@
|
||||
package org.nl.common.utils;
|
||||
|
||||
import lombok.SneakyThrows;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.nl.config.language.LangProcess;
|
||||
import org.nl.system.service.coderule.ISysCodeRuleService;
|
||||
import org.redisson.api.RLock;
|
||||
import org.redisson.api.RedissonClient;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -21,27 +16,14 @@ import java.util.concurrent.TimeUnit;
|
||||
*/
|
||||
public class CodeUtil {
|
||||
|
||||
@SneakyThrows
|
||||
public static String getNewCode(String ruleCode){
|
||||
RedissonClient redissonClient = SpringContextHolder.getBean(RedissonClient.class);
|
||||
RLock lock = redissonClient.getLock(ruleCode);
|
||||
boolean tryLock = lock.tryLock(5, TimeUnit.SECONDS);
|
||||
try {
|
||||
if (tryLock) {
|
||||
String flag = "1";
|
||||
HashMap<String,String> map = new HashMap<>();
|
||||
map.put("flag",flag);
|
||||
map.put("code",ruleCode);
|
||||
return SpringContextHolder.getBean(ISysCodeRuleService.class).codeDemo(map);
|
||||
} else {
|
||||
throw new BadRequestException(LangProcess.msg("error_SystemError"));
|
||||
}
|
||||
} finally {
|
||||
if (tryLock) {
|
||||
lock.unlock();
|
||||
}
|
||||
private static final Object LOCK = new Object();
|
||||
|
||||
public static String getNewCode(String ruleCode) {
|
||||
synchronized (LOCK) {
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("flag", "1");
|
||||
map.put("code", ruleCode);
|
||||
return SpringContextHolder.getBean(ISysCodeRuleService.class).codeDemo(map);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -73,32 +73,11 @@ public class SecondaryPackagingServiceImpl implements SecondaryPackagingService
|
||||
boolean tryLock = lock.tryLock(0, TimeUnit.SECONDS);
|
||||
try {
|
||||
if (tryLock) {
|
||||
// device_code、material_code、qty、vehicle_seq、pcsn、cases
|
||||
/* MdMeMaterialbase materialCode = materialbaseService.getByCode(param.getString("material_code"));
|
||||
// 组盘
|
||||
GroupPlate groupPlate = new GroupPlate();
|
||||
groupPlate.setGroup_id(IdUtil.getStringId());
|
||||
groupPlate.setVehicle_code(IdUtil.getStringId());
|
||||
groupPlate.setRemark(param.toJSONString());
|
||||
groupPlate.setStatus("1");
|
||||
groupPlate.setQty(param.getBigDecimal("qty"));
|
||||
groupPlate.setPcsn(param.getString("pcsn"));
|
||||
groupPlate.setMaterial_id(materialCode.getMaterial_id());
|
||||
groupPlate.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||
groupPlate.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||
groupPlate.setCreate_time(DateUtil.now());
|
||||
// ....待定
|
||||
groupplateService.save(groupPlate);*/
|
||||
|
||||
// 校验任务
|
||||
Integer num = taskService.haveTaskAll(param.getString("device_code"));
|
||||
if (num > 0) {
|
||||
throw new BadRequestException("该点位已存在任务!");
|
||||
}
|
||||
/* param.put("group_id", groupPlate.getGroup_id());
|
||||
param.put("material_id", materialCode.getMaterial_id());
|
||||
param.put("material_qty", groupPlate.getQty());
|
||||
param.put("vehicle_code", groupPlate.getVehicle_code());*/
|
||||
param.put("task_type", ACSTaskTypeEnum.F002.getCode());
|
||||
AbstractTask palletizingDownTask = taskFactory.getTask("PalletizingDownTask");
|
||||
palletizingDownTask.create(param);
|
||||
|
||||
@@ -114,7 +114,6 @@ public class PalletizingAddTask extends AbstractTask {
|
||||
|
||||
@Transactional
|
||||
public void cancelTask(SchBaseTask taskObj) {
|
||||
|
||||
// 更新任务状态
|
||||
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||
taskObj.setRemark("已取消");
|
||||
@@ -128,7 +127,7 @@ public class PalletizingAddTask extends AbstractTask {
|
||||
taskObj.setRemark("已完成");
|
||||
taskService.updateById(taskObj);
|
||||
|
||||
// 更新
|
||||
// 更新起点
|
||||
pointService.update(
|
||||
new UpdateWrapper<SchBasePoint>().lambda()
|
||||
.set(SchBasePoint::getVehicle_code, "")
|
||||
@@ -136,6 +135,13 @@ public class PalletizingAddTask extends AbstractTask {
|
||||
.eq(SchBasePoint::getPoint_code, taskObj.getPoint_code1())
|
||||
.set(SchBasePoint::getIng_task_code, "")
|
||||
);
|
||||
|
||||
// 更新终点
|
||||
pointService.update(
|
||||
new UpdateWrapper<SchBasePoint>().lambda()
|
||||
.set(SchBasePoint::getPoint_status, IOSEnum.POINT_STATUS.code("有箱有料"))
|
||||
.eq(SchBasePoint::getPoint_code, taskObj.getPoint_code2())
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -43,6 +43,12 @@ public class PalletizingDownTask extends AbstractTask {
|
||||
|
||||
@Override
|
||||
public String create(JSONObject json) {
|
||||
// 判断缠绕机是否有货
|
||||
SchBasePoint pointCR = pointService.getById("CRJ01");
|
||||
if (!pointCR.getPoint_status().equals(IOSConstant.ONE)) {
|
||||
throw new BadRequestException("缠绕机点位有货!");
|
||||
}
|
||||
|
||||
// 查找空闲的内外中转点
|
||||
List<SchBasePoint> list = pointService.getNoTaskPointByRegionAndType("AGVZJZ01", "1", "1");
|
||||
if (list.size() == 0) {
|
||||
|
||||
@@ -153,7 +153,13 @@ public class WrappingDownTask extends AbstractTask {
|
||||
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||
taskObj.setRemark("已完成");
|
||||
taskService.updateById(taskObj);
|
||||
// 更新
|
||||
// 更新起点
|
||||
pointService.update(
|
||||
new UpdateWrapper<SchBasePoint>().lambda()
|
||||
.set(SchBasePoint::getPoint_status, IOSEnum.POINT_STATUS.code("空位"))
|
||||
.eq(SchBasePoint::getPoint_code, taskObj.getPoint_code1())
|
||||
);
|
||||
// 更新终点
|
||||
pointService.update(
|
||||
new UpdateWrapper<SchBasePoint>().lambda()
|
||||
.set(SchBasePoint::getVehicle_code, taskObj.getVehicle_code())
|
||||
@@ -164,16 +170,6 @@ public class WrappingDownTask extends AbstractTask {
|
||||
.set(SchBasePoint::getIng_task_code, "")
|
||||
.eq(SchBasePoint::getPoint_code, taskObj.getPoint_code2())
|
||||
);
|
||||
/*pointService.update(
|
||||
new UpdateWrapper<SchBasePoint>().lambda()
|
||||
.set(SchBasePoint::getVehicle_code, "")
|
||||
.set(SchBasePoint::getPoint_status, IOSEnum.POINT_STATUS.code("空位"))
|
||||
.set(SchBasePoint::getUpdate_time, DateUtil.now())
|
||||
.set(SchBasePoint::getUpdate_id, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBasePoint::getUpdate_name, SecurityUtils.getCurrentNickName())
|
||||
.set(SchBasePoint::getIng_task_code, "")
|
||||
.eq(SchBasePoint::getPoint_code, taskObj.getPoint_code3())
|
||||
);*/
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user