更改并发锁
This commit is contained in:
@@ -35,7 +35,7 @@ import java.util.Map;
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
private final TaskService taskService;
|
||||
private final Object lockObj = new Object();
|
||||
|
||||
/**
|
||||
* task_id:任务标识
|
||||
@@ -169,134 +169,136 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public JSONObject apply(JSONObject whereJson) {
|
||||
String type = whereJson.getString("type");
|
||||
String point_code = whereJson.getString("point_code");
|
||||
String vehicle_type = whereJson.getString("vehicle_type");
|
||||
String vehicle_code = whereJson.getString("vehicle_code");
|
||||
//载具数量
|
||||
String vehicle_num = whereJson.getString("vehicle_num");
|
||||
//物料数量
|
||||
String material_num = whereJson.getString("qty");
|
||||
synchronized (lockObj) {
|
||||
String type = whereJson.getString("type");
|
||||
String point_code = whereJson.getString("point_code");
|
||||
String vehicle_type = whereJson.getString("vehicle_type");
|
||||
String vehicle_code = whereJson.getString("vehicle_code");
|
||||
//载具数量
|
||||
String vehicle_num = whereJson.getString("vehicle_num");
|
||||
//物料数量
|
||||
String material_num = whereJson.getString("qty");
|
||||
|
||||
if (ObjectUtil.isEmpty(type)) throw new BadRequestException("类型不能为空");
|
||||
if (ObjectUtil.isEmpty(point_code)) throw new BadRequestException("点位不能为空");
|
||||
|
||||
/*
|
||||
* 根据type判断是什么业务类型:
|
||||
* 1.共挤线申请空盘
|
||||
* 2.共挤线满托入库
|
||||
* 3.油漆线申请空盘
|
||||
* 4.油漆线申请物料
|
||||
* 5.油漆线空盘入库
|
||||
* 6.一楼空盘入库 (有载具号)
|
||||
* 7.油漆线->输送线(油漆线满料)
|
||||
* 8.豪凯自动线下料入库
|
||||
*/
|
||||
if (StrUtil.equals(type, "1")) {
|
||||
// 1.共挤线申请空盘: 调用空托盘出库处理类创建任务
|
||||
if (ObjectUtil.isEmpty(vehicle_num)) throw new BadRequestException("数量不能为空");
|
||||
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("point_code2", point_code);
|
||||
param.put("vehicle_type", vehicle_type);
|
||||
param.put("vehicle_code", vehicle_code);
|
||||
param.put("qty", material_num);
|
||||
// 创建任务
|
||||
GjxCallEmpVehicleTask taskBean = SpringContextHolder.getBean(GjxCallEmpVehicleTask.class);
|
||||
taskBean.createTask(param);
|
||||
|
||||
} else if (StrUtil.equals(type, "2")) {
|
||||
// 2.共挤线满托入库: 调用物料入库处理类创建任务
|
||||
if (ObjectUtil.isEmpty(material_num) || (StrUtil.equals(material_num, "0")))
|
||||
throw new BadRequestException("物料数量不能为空或者为0");
|
||||
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("point_code1", point_code); // 满料位
|
||||
param.put("qty", material_num); // 满料位
|
||||
param.put("vehicle_type", vehicle_type);
|
||||
param.put("vehicle_code", vehicle_code);
|
||||
|
||||
GjxSendMaterialTask taskBean = SpringContextHolder.getBean(GjxSendMaterialTask.class);
|
||||
String task_id = taskBean.createTask(param); // 创建任务
|
||||
} else if (StrUtil.equals(type, "3")) {
|
||||
// 3.油漆线申请空盘: 调用空托盘出库处理类创建任务
|
||||
if (ObjectUtil.isEmpty(vehicle_num)) throw new BadRequestException("数量不能为空");
|
||||
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("point_code2", point_code);
|
||||
param.put("vehicle_code", vehicle_code);
|
||||
param.put("qty", vehicle_num);
|
||||
// 创建任务
|
||||
YqxCallEmpVehicleTask taskBean = SpringContextHolder.getBean(YqxCallEmpVehicleTask.class);
|
||||
String task_id = taskBean.createTask(param);
|
||||
} else if (StrUtil.equals(type, "4")) {
|
||||
// 4.油漆线申请物料: 调用物料出库库处理类创建任务
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("point_code2", point_code); // 叫料点
|
||||
param.put("io_type", "2");
|
||||
param.put("vehicle_type", vehicle_type);
|
||||
param.put("vehicle_code", vehicle_code);
|
||||
param.put("material_num", material_num);
|
||||
// 创建任务
|
||||
YqxCallMaterialTask taskBean = SpringContextHolder.getBean(YqxCallMaterialTask.class);
|
||||
String task_id = taskBean.createTask(param);
|
||||
|
||||
} else if (StrUtil.equals(type, "5")) {
|
||||
// 5.油漆线空盘入库: 调用空托盘入库处理类创建任务
|
||||
if (ObjectUtil.isEmpty(type)) throw new BadRequestException("类型不能为空");
|
||||
if (ObjectUtil.isEmpty(point_code)) throw new BadRequestException("点位不能为空");
|
||||
if (ObjectUtil.isEmpty(vehicle_num)) throw new BadRequestException("数量不能为空");
|
||||
if (ObjectUtil.isEmpty(vehicle_type)) throw new BadRequestException("载具类型不能为空");
|
||||
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("point_code1", point_code);
|
||||
param.put("qty", vehicle_num);
|
||||
param.put("vehicle_type", vehicle_type);
|
||||
param.put("vehicle_code", vehicle_code);
|
||||
// 创建任务
|
||||
YqxSendEmpVehicleTask taskBean = SpringContextHolder.getBean(YqxSendEmpVehicleTask.class);
|
||||
taskBean.createTask(param);
|
||||
/*
|
||||
* 根据type判断是什么业务类型:
|
||||
* 1.共挤线申请空盘
|
||||
* 2.共挤线满托入库
|
||||
* 3.油漆线申请空盘
|
||||
* 4.油漆线申请物料
|
||||
* 5.油漆线空盘入库
|
||||
* 6.一楼空盘入库 (有载具号)
|
||||
* 7.油漆线->输送线(油漆线满料)
|
||||
* 8.豪凯自动线下料入库
|
||||
*/
|
||||
if (StrUtil.equals(type, "1")) {
|
||||
// 1.共挤线申请空盘: 调用空托盘出库处理类创建任务
|
||||
if (ObjectUtil.isEmpty(vehicle_num)) throw new BadRequestException("数量不能为空");
|
||||
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("point_code2", point_code);
|
||||
param.put("vehicle_type", vehicle_type);
|
||||
param.put("vehicle_code", vehicle_code);
|
||||
param.put("qty", material_num);
|
||||
// 创建任务
|
||||
GjxCallEmpVehicleTask taskBean = SpringContextHolder.getBean(GjxCallEmpVehicleTask.class);
|
||||
taskBean.createTask(param);
|
||||
|
||||
} else if (StrUtil.equals(type, "2")) {
|
||||
// 2.共挤线满托入库: 调用物料入库处理类创建任务
|
||||
if (ObjectUtil.isEmpty(material_num) || (StrUtil.equals(material_num, "0")))
|
||||
throw new BadRequestException("物料数量不能为空或者为0");
|
||||
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("point_code1", point_code); // 满料位
|
||||
param.put("qty", material_num); // 满料位
|
||||
param.put("vehicle_type", vehicle_type);
|
||||
param.put("vehicle_code", vehicle_code);
|
||||
|
||||
GjxSendMaterialTask taskBean = SpringContextHolder.getBean(GjxSendMaterialTask.class);
|
||||
String task_id = taskBean.createTask(param); // 创建任务
|
||||
} else if (StrUtil.equals(type, "3")) {
|
||||
// 3.油漆线申请空盘: 调用空托盘出库处理类创建任务
|
||||
if (ObjectUtil.isEmpty(vehicle_num)) throw new BadRequestException("数量不能为空");
|
||||
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("point_code2", point_code);
|
||||
param.put("vehicle_code", vehicle_code);
|
||||
param.put("qty", vehicle_num);
|
||||
// 创建任务
|
||||
YqxCallEmpVehicleTask taskBean = SpringContextHolder.getBean(YqxCallEmpVehicleTask.class);
|
||||
String task_id = taskBean.createTask(param);
|
||||
} else if (StrUtil.equals(type, "4")) {
|
||||
// 4.油漆线申请物料: 调用物料出库库处理类创建任务
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("point_code2", point_code); // 叫料点
|
||||
param.put("io_type", "2");
|
||||
param.put("vehicle_type", vehicle_type);
|
||||
param.put("vehicle_code", vehicle_code);
|
||||
param.put("material_num", material_num);
|
||||
// 创建任务
|
||||
YqxCallMaterialTask taskBean = SpringContextHolder.getBean(YqxCallMaterialTask.class);
|
||||
String task_id = taskBean.createTask(param);
|
||||
|
||||
} else if (StrUtil.equals(type, "5")) {
|
||||
// 5.油漆线空盘入库: 调用空托盘入库处理类创建任务
|
||||
if (ObjectUtil.isEmpty(point_code)) throw new BadRequestException("点位不能为空");
|
||||
if (ObjectUtil.isEmpty(vehicle_num)) throw new BadRequestException("数量不能为空");
|
||||
if (ObjectUtil.isEmpty(vehicle_type)) throw new BadRequestException("载具类型不能为空");
|
||||
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("point_code1", point_code);
|
||||
param.put("qty", vehicle_num);
|
||||
param.put("vehicle_type", vehicle_type);
|
||||
param.put("vehicle_code", vehicle_code);
|
||||
// 创建任务
|
||||
YqxSendEmpVehicleTask taskBean = SpringContextHolder.getBean(YqxSendEmpVehicleTask.class);
|
||||
taskBean.createTask(param);
|
||||
|
||||
|
||||
} else if (StrUtil.equals(type, "6")) {
|
||||
// 6.一楼空盘入库 (有载具号): 调用空托盘入库处理类创建任务
|
||||
if (ObjectUtil.isEmpty(vehicle_code)) throw new BadRequestException("载具号不能为空");
|
||||
JSONObject param = new JSONObject();
|
||||
} else if (StrUtil.equals(type, "6")) {
|
||||
// 6.一楼空盘入库 (有载具号): 调用空托盘入库处理类创建任务
|
||||
if (ObjectUtil.isEmpty(vehicle_code)) throw new BadRequestException("载具号不能为空");
|
||||
JSONObject param = new JSONObject();
|
||||
|
||||
// 查询载具号对应的数量
|
||||
JSONObject jsonVeQty = new JSONObject();
|
||||
if (ObjectUtil.isEmpty(vehicle_num)) {
|
||||
if (ObjectUtil.isEmpty(jsonVeQty)) throw new BadRequestException("请先手持扫码");
|
||||
} else {
|
||||
jsonVeQty.put("qty", vehicle_num);
|
||||
}
|
||||
|
||||
param.put("qty", jsonVeQty.getString("qty"));
|
||||
param.put("point_code1", point_code);
|
||||
param.put("vehicle_code", vehicle_code);
|
||||
param.put("vehicle_type", vehicle_type);
|
||||
// 创建任务
|
||||
HtSendEmpVehicleTask taskBean = SpringContextHolder.getBean(HtSendEmpVehicleTask.class);
|
||||
String task_id = taskBean.createTask(param);
|
||||
|
||||
} else if (StrUtil.equals(type, "7")) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("point_code1", point_code);
|
||||
param.put("vehicle_code", vehicle_code);
|
||||
param.put("vehicle_type", vehicle_type);
|
||||
param.put("qty", material_num);
|
||||
// 1.生成起点确定的任务
|
||||
SpringContextHolder.getBean(YqxSendMaterialTask.class).createTask(param);
|
||||
} else if (StrUtil.equals(type, "8")) {
|
||||
// 8.豪凯自动线下料入库
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("point_code1", point_code);
|
||||
param.put("vehicle_code", vehicle_code);
|
||||
param.put("vehicle_type", vehicle_type);
|
||||
param.put("qty", material_num);
|
||||
HkxSendMaterialTask taskBean = SpringContextHolder.getBean(HkxSendMaterialTask.class);
|
||||
String task_id = taskBean.createTask(param);
|
||||
|
||||
// 查询载具号对应的数量
|
||||
JSONObject jsonVeQty = new JSONObject();
|
||||
if (ObjectUtil.isEmpty(vehicle_num)) {
|
||||
if (ObjectUtil.isEmpty(jsonVeQty)) throw new BadRequestException("请先手持扫码");
|
||||
} else {
|
||||
jsonVeQty.put("qty", vehicle_num);
|
||||
}
|
||||
|
||||
param.put("qty", jsonVeQty.getString("qty"));
|
||||
param.put("point_code1", point_code);
|
||||
param.put("vehicle_code", vehicle_code);
|
||||
param.put("vehicle_type", vehicle_type);
|
||||
// 创建任务
|
||||
HtSendEmpVehicleTask taskBean = SpringContextHolder.getBean(HtSendEmpVehicleTask.class);
|
||||
String task_id = taskBean.createTask(param);
|
||||
|
||||
} else if (StrUtil.equals(type, "7")) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("point_code1", point_code);
|
||||
param.put("vehicle_code", vehicle_code);
|
||||
param.put("vehicle_type", vehicle_type);
|
||||
param.put("qty", material_num);
|
||||
// 1.生成起点确定的任务
|
||||
SpringContextHolder.getBean(YqxSendMaterialTask.class).createTask(param);
|
||||
} else if (StrUtil.equals(type, "8")) {
|
||||
// 8.豪凯自动线下料入库
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("point_code1", point_code);
|
||||
param.put("vehicle_code", vehicle_code);
|
||||
param.put("vehicle_type", vehicle_type);
|
||||
param.put("qty", material_num);
|
||||
HkxSendMaterialTask taskBean = SpringContextHolder.getBean(HkxSendMaterialTask.class);
|
||||
String task_id = taskBean.createTask(param);
|
||||
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user