|
@ -36,6 +36,7 @@ import org.nl.wms.sch.task_manage.GeneralDefinition; |
|
|
import org.nl.wms.sch.task_manage.task.TaskFactory; |
|
|
import org.nl.wms.sch.task_manage.task.TaskFactory; |
|
|
import org.nl.wms.sch.task_manage.task.core.TaskType; |
|
|
import org.nl.wms.sch.task_manage.task.core.TaskType; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
|
import org.springframework.http.HttpStatus; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.transaction.annotation.Propagation; |
|
|
import org.springframework.transaction.annotation.Propagation; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
@ -75,8 +76,8 @@ public class HandheldServiceImpl implements HandheldService { |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void emptyCageStorageTask(JSONObject param) { |
|
|
public void emptyCageStorageTask(JSONObject param) { |
|
|
Assert.noNullElements(new Object[]{param.getString("device_code"), param.getString("vehicle_list") |
|
|
Assert.noNullElements(new Object[]{param.getString("device_code"), param.getString("vehicle_list")}, |
|
|
}, "参数不能为空!"); |
|
|
"参数不能为空!"); |
|
|
String vehicle = param.getString("vehicle_list"); |
|
|
String vehicle = param.getString("vehicle_list"); |
|
|
String device_code = param.getString("device_code"); |
|
|
String device_code = param.getString("device_code"); |
|
|
String type = param.getString("type"); |
|
|
String type = param.getString("type"); |
|
@ -101,10 +102,6 @@ public class HandheldServiceImpl implements HandheldService { |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 空载具送回货架 |
|
|
* 空载具送回货架 |
|
|
* |
|
|
|
|
|
* @param vehicle |
|
|
|
|
|
* @param device_code |
|
|
|
|
|
* @param param |
|
|
|
|
|
*/ |
|
|
*/ |
|
|
private void applyDeliveryRacks(String vehicle, String device_code, JSONObject param) { |
|
|
private void applyDeliveryRacks(String vehicle, String device_code, JSONObject param) { |
|
|
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(device_code); |
|
|
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(device_code); |
|
@ -121,14 +118,7 @@ public class HandheldServiceImpl implements HandheldService { |
|
|
throw new BadRequestException("载具号已存在别的点位,请确认再下发"); |
|
|
throw new BadRequestException("载具号已存在别的点位,请确认再下发"); |
|
|
} |
|
|
} |
|
|
// 准备参数:设备编码
|
|
|
// 准备参数:设备编码
|
|
|
JSONObject jo = new JSONObject(); |
|
|
applyTask(param, vehicle, device_code, mdBaseVehicle, connectorTask); |
|
|
jo.put("device_code", device_code); |
|
|
|
|
|
jo.put("config_code", "RACKTask"); |
|
|
|
|
|
jo.put("create_mode", GeneralDefinition.AUTO_CREATION); |
|
|
|
|
|
jo.put("vehicle_code", vehicle); |
|
|
|
|
|
jo.put("vehicle_type", mdBaseVehicle.getVehicle_type()); |
|
|
|
|
|
jo.put("ext_data", param); |
|
|
|
|
|
connectorTask.apply(jo); |
|
|
|
|
|
iSchBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class) |
|
|
iSchBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class) |
|
|
.eq(SchBasePoint::getPoint_code, schBasePoint.getPoint_code()) |
|
|
.eq(SchBasePoint::getPoint_code, schBasePoint.getPoint_code()) |
|
|
.set(SchBasePoint::getIs_lock, true)); |
|
|
.set(SchBasePoint::getIs_lock, true)); |
|
@ -136,10 +126,6 @@ public class HandheldServiceImpl implements HandheldService { |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 内部过道送托盘 |
|
|
* 内部过道送托盘 |
|
|
* |
|
|
|
|
|
* @param vehicle |
|
|
|
|
|
* @param device_code |
|
|
|
|
|
* @param param |
|
|
|
|
|
*/ |
|
|
*/ |
|
|
private void interiorAisle(String vehicle, String device_code, JSONObject param) { |
|
|
private void interiorAisle(String vehicle, String device_code, JSONObject param) { |
|
|
MdBaseVehicle mdBaseVehicle = iMdBaseVehicleService.selectByVehicleCode(vehicle); |
|
|
MdBaseVehicle mdBaseVehicle = iMdBaseVehicleService.selectByVehicleCode(vehicle); |
|
@ -162,10 +148,6 @@ public class HandheldServiceImpl implements HandheldService { |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 空料架送回 |
|
|
* 空料架送回 |
|
|
* |
|
|
|
|
|
* @param vehicle |
|
|
|
|
|
* @param device_code |
|
|
|
|
|
* @param param |
|
|
|
|
|
*/ |
|
|
*/ |
|
|
private void semiAutomaticBending(String vehicle, String device_code, JSONObject param) { |
|
|
private void semiAutomaticBending(String vehicle, String device_code, JSONObject param) { |
|
|
MdBaseVehicle mdBaseVehicle = iMdBaseVehicleService.selectByVehicleCode(vehicle); |
|
|
MdBaseVehicle mdBaseVehicle = iMdBaseVehicleService.selectByVehicleCode(vehicle); |
|
@ -174,26 +156,11 @@ public class HandheldServiceImpl implements HandheldService { |
|
|
&& !mdBaseVehicle.getVehicle_type().equals(VehicleTypeEnum.RACKS_S06.getVehicleCode())) { |
|
|
&& !mdBaseVehicle.getVehicle_type().equals(VehicleTypeEnum.RACKS_S06.getVehicleCode())) { |
|
|
throw new BadRequestException("不是料架,生成搬运任务失败!"); |
|
|
throw new BadRequestException("不是料架,生成搬运任务失败!"); |
|
|
} |
|
|
} |
|
|
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(device_code); |
|
|
rackTask(param, vehicle, device_code, mdBaseVehicle); |
|
|
if (ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("设备点位不存在!"); |
|
|
|
|
|
AbstractTask connectorTask = taskFactory.getTask("RACKTask"); |
|
|
|
|
|
// 准备参数:设备编码
|
|
|
|
|
|
JSONObject jo = new JSONObject(); |
|
|
|
|
|
jo.put("device_code", device_code); |
|
|
|
|
|
jo.put("config_code", "RACKTask"); |
|
|
|
|
|
jo.put("create_mode", GeneralDefinition.AUTO_CREATION); |
|
|
|
|
|
jo.put("vehicle_code", vehicle); |
|
|
|
|
|
jo.put("vehicle_type", mdBaseVehicle.getVehicle_type()); |
|
|
|
|
|
jo.put("ext_data", param); |
|
|
|
|
|
connectorTask.apply(jo); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 空料框送回 |
|
|
* 空料框送回 |
|
|
* |
|
|
|
|
|
* @param vehicle |
|
|
|
|
|
* @param device_code |
|
|
|
|
|
* @param param |
|
|
|
|
|
*/ |
|
|
*/ |
|
|
private void artificialBending(String vehicle, String device_code, JSONObject param) { |
|
|
private void artificialBending(String vehicle, String device_code, JSONObject param) { |
|
|
String[] vehicle_list = null; |
|
|
String[] vehicle_list = null; |
|
@ -230,7 +197,6 @@ public class HandheldServiceImpl implements HandheldService { |
|
|
throw new BadRequestException("托盘类型不匹配,,生成搬运任务失败!"); |
|
|
throw new BadRequestException("托盘类型不匹配,,生成搬运任务失败!"); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(device_code); |
|
|
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(device_code); |
|
|
if (ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("设备点位不存在!"); |
|
|
if (ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("设备点位不存在!"); |
|
@ -254,15 +220,14 @@ public class HandheldServiceImpl implements HandheldService { |
|
|
@Override |
|
|
@Override |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public void cageBlankingTask(JSONObject param) { |
|
|
public void cageBlankingTask(JSONObject param) { |
|
|
Assert.noNullElements(new Object[]{param.getString("device_code"), param.getString("vehicle_code")}, |
|
|
boolean allNotEmpty = ObjectUtil.isAllNotEmpty(param.getString("device_code"), param.getString("vehicle_code"), param.getString("type")); |
|
|
"当前点位或载具号不能为空!"); |
|
|
Assert.isTrue(allNotEmpty, "当前点位,载具号或类型不能为空!"); |
|
|
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(param.getString("device_code")); |
|
|
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(param.getString("device_code")); |
|
|
|
|
|
Assert.notNull(schBasePoint, "当前点位不存在!"); |
|
|
SchBasePoint one = iSchBasePointService.getOne(Wrappers.lambdaQuery(SchBasePoint.class) |
|
|
SchBasePoint one = iSchBasePointService.getOne(Wrappers.lambdaQuery(SchBasePoint.class) |
|
|
.eq(SchBasePoint::getVehicle_code, param.getString("vehicle_code")) |
|
|
.eq(SchBasePoint::getVehicle_code, param.getString("vehicle_code")) |
|
|
.ne(SchBasePoint::getPoint_code, param.getString("device_code"))); |
|
|
.ne(SchBasePoint::getPoint_code, param.getString("device_code"))); |
|
|
if (ObjectUtil.isNotEmpty(one)) { |
|
|
Assert.isNull(one, "载具号已存在别的点位,请确认再下发"); |
|
|
throw new BadRequestException("载具号已存在别的点位,请确认再下发"); |
|
|
|
|
|
} |
|
|
|
|
|
String region_code = param.getString("region_code"); |
|
|
String region_code = param.getString("region_code"); |
|
|
String device_code = param.getString("device_code"); |
|
|
String device_code = param.getString("device_code"); |
|
|
String vehicle_code = param.getString("vehicle_code"); |
|
|
String vehicle_code = param.getString("vehicle_code"); |
|
@ -288,13 +253,6 @@ public class HandheldServiceImpl implements HandheldService { |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* connector下料入库 |
|
|
* connector下料入库 |
|
|
* |
|
|
|
|
|
* @param |
|
|
|
|
|
* @param param |
|
|
|
|
|
* @param region_code |
|
|
|
|
|
* @param device_code |
|
|
|
|
|
* @param vehicle_code |
|
|
|
|
|
* @param connectorTask |
|
|
|
|
|
*/ |
|
|
*/ |
|
|
private void connectorBlanking(JSONObject param, String region_code, String device_code, String vehicle_code, AbstractTask connectorTask) { |
|
|
private void connectorBlanking(JSONObject param, String region_code, String device_code, String vehicle_code, AbstractTask connectorTask) { |
|
|
JSONObject jo = new JSONObject(); |
|
|
JSONObject jo = new JSONObject(); |
|
@ -314,15 +272,8 @@ public class HandheldServiceImpl implements HandheldService { |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 物料下料去货架 |
|
|
* 物料下料去货架 |
|
|
* |
|
|
|
|
|
* @param param |
|
|
|
|
|
* @param region_code |
|
|
|
|
|
* @param device_code |
|
|
|
|
|
* @param vehicle_code |
|
|
|
|
|
* @param connectorTask |
|
|
|
|
|
*/ |
|
|
*/ |
|
|
private void goShelves(SchBasePoint schBasePoint, JSONObject param, String region_code, String device_code, String vehicle_code, AbstractTask connectorTask) { |
|
|
private void goShelves(SchBasePoint schBasePoint, JSONObject param, String region_code, String device_code, String vehicle_code, AbstractTask connectorTask) { |
|
|
//TODO:是否需要加上是否有无货校验
|
|
|
|
|
|
Assert.noNullElements(param.getJSONArray("material"), "参数不能为空!"); |
|
|
Assert.noNullElements(param.getJSONArray("material"), "参数不能为空!"); |
|
|
JSONArray materials = param.getJSONArray("material"); |
|
|
JSONArray materials = param.getJSONArray("material"); |
|
|
JSONObject jo = new JSONObject(); |
|
|
JSONObject jo = new JSONObject(); |
|
@ -338,7 +289,7 @@ public class HandheldServiceImpl implements HandheldService { |
|
|
if (StrUtil.isBlank(region_code)) { |
|
|
if (StrUtil.isBlank(region_code)) { |
|
|
JSONObject json = new JSONObject(); |
|
|
JSONObject json = new JSONObject(); |
|
|
JSONArray jsonArray = new JSONArray(); |
|
|
JSONArray jsonArray = new JSONArray(); |
|
|
materials.stream().forEach(material2 -> { |
|
|
materials.forEach(material2 -> { |
|
|
boolean material_code = ObjectUtil.isEmpty(((LinkedHashMap) material2).get("material_code")); |
|
|
boolean material_code = ObjectUtil.isEmpty(((LinkedHashMap) material2).get("material_code")); |
|
|
if (material_code) { |
|
|
if (material_code) { |
|
|
((LinkedHashMap) material2).remove("material_code"); |
|
|
((LinkedHashMap) material2).remove("material_code"); |
|
@ -353,7 +304,7 @@ public class HandheldServiceImpl implements HandheldService { |
|
|
json.put("region_code", schBasePoint.getRegion_code()); |
|
|
json.put("region_code", schBasePoint.getRegion_code()); |
|
|
json.put("materials", jsonArray); |
|
|
json.put("materials", jsonArray); |
|
|
JSONObject json1 = wmsToConnectorService.applyRegionAndDueDate(json); |
|
|
JSONObject json1 = wmsToConnectorService.applyRegionAndDueDate(json); |
|
|
if (ObjectUtil.isNotEmpty(json1) && json1.getInteger("status") == 200) { |
|
|
if (ObjectUtil.isNotEmpty(json1) && json1.getInteger("status") == HttpStatus.OK.value()) { |
|
|
JSONArray date = json1.getJSONArray("data"); |
|
|
JSONArray date = json1.getJSONArray("data"); |
|
|
date.stream().map(date1 -> JSONObject.parseObject(StrUtil.toString(date1))).forEach(json2 -> { |
|
|
date.stream().map(date1 -> JSONObject.parseObject(StrUtil.toString(date1))).forEach(json2 -> { |
|
|
List<cn.hutool.json.JSONObject> updatedMaterials = materials.stream() |
|
|
List<cn.hutool.json.JSONObject> updatedMaterials = materials.stream() |
|
@ -363,10 +314,8 @@ public class HandheldServiceImpl implements HandheldService { |
|
|
jsonObject.putOpt("due_date", json2.getString("due_date")); |
|
|
jsonObject.putOpt("due_date", json2.getString("due_date")); |
|
|
jsonObject.putOpt("region_code", json2.getString("next_region_code")); |
|
|
jsonObject.putOpt("region_code", json2.getString("next_region_code")); |
|
|
jsonObject.putOpt("priority", json2.getString("priority")); |
|
|
jsonObject.putOpt("priority", json2.getString("priority")); |
|
|
return jsonObject; // 更新的对象
|
|
|
|
|
|
} else { |
|
|
|
|
|
return jsonObject; // 其他对象保持不变
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
return jsonObject; |
|
|
}) |
|
|
}) |
|
|
.collect(Collectors.toList()); |
|
|
.collect(Collectors.toList()); |
|
|
materials.clear(); |
|
|
materials.clear(); |
|
@ -384,38 +333,18 @@ public class HandheldServiceImpl implements HandheldService { |
|
|
jo.put("config_code", "BLANKINGTask"); |
|
|
jo.put("config_code", "BLANKINGTask"); |
|
|
jo.put("create_mode", GeneralDefinition.AUTO_CREATION); |
|
|
jo.put("create_mode", GeneralDefinition.AUTO_CREATION); |
|
|
jo.put("vehicle_code", vehicle_code); |
|
|
jo.put("vehicle_code", vehicle_code); |
|
|
|
|
|
param.put("region_code", region_code); |
|
|
|
|
|
param.put("materials",materials); |
|
|
jo.put("ext_data", param); |
|
|
jo.put("ext_data", param); |
|
|
iSchBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class) |
|
|
iSchBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class) |
|
|
.eq(SchBasePoint::getPoint_code, device_code) |
|
|
.eq(SchBasePoint::getPoint_code, device_code) |
|
|
.set(SchBasePoint::getIs_lock, true)); |
|
|
.set(SchBasePoint::getIs_lock, true)); |
|
|
connectorTask.apply(jo); |
|
|
connectorTask.apply(jo); |
|
|
iSchBaseVehiclematerialgroupService.remove(Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class) |
|
|
|
|
|
.eq(SchBaseVehiclematerialgroup::getVehicle_code, vehicle_code)); |
|
|
|
|
|
String finalRegion_code = region_code; |
|
|
|
|
|
materials.stream().forEach(material -> { |
|
|
|
|
|
cn.hutool.json.JSONObject jsonObject = JSONUtil.parseObj(material); |
|
|
|
|
|
SchBaseVehiclematerialgroup schBaseVehiclematerialgroup = new SchBaseVehiclematerialgroup(); |
|
|
|
|
|
schBaseVehiclematerialgroup.setVehicle_code(vehicle_code); |
|
|
|
|
|
schBaseVehiclematerialgroup.setMaterial_qty(jsonObject.getInt("material_qty")); |
|
|
|
|
|
schBaseVehiclematerialgroup.setMaterial_code(jsonObject.getStr("material_code")); |
|
|
|
|
|
schBaseVehiclematerialgroup.setOrder_code(jsonObject.getStr("order_code")); |
|
|
|
|
|
schBaseVehiclematerialgroup.setDue_date(jsonObject.getStr("due_date")); |
|
|
|
|
|
schBaseVehiclematerialgroup.setCreate_name(SecurityUtils.getCurrentNickName()); |
|
|
|
|
|
schBaseVehiclematerialgroup.setPriority(jsonObject.getStr("priority")); |
|
|
|
|
|
schBaseVehiclematerialgroup.setRegion_code(StrUtil.isBlank(finalRegion_code) ? jsonObject.getStr("region_code") : finalRegion_code); |
|
|
|
|
|
iSchBaseVehiclematerialgroupService.create(schBaseVehiclematerialgroup); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 物料下料去外协或内部加工区 |
|
|
* 物料下料去外协或内部加工区 |
|
|
* |
|
|
|
|
|
* @param param |
|
|
|
|
|
* @param region_code |
|
|
|
|
|
* @param device_code |
|
|
|
|
|
* @param vehicle_code |
|
|
|
|
|
* @param connectorTask |
|
|
|
|
|
*/ |
|
|
*/ |
|
|
private void goWxOrNx(JSONObject param, String region_code, String device_code, String vehicle_code, AbstractTask connectorTask) { |
|
|
private void goWxOrNx(JSONObject param, String region_code, String device_code, String vehicle_code, AbstractTask connectorTask) { |
|
|
JSONObject jo = new JSONObject(); |
|
|
JSONObject jo = new JSONObject(); |
|
@ -426,14 +355,14 @@ public class HandheldServiceImpl implements HandheldService { |
|
|
MdBaseVehicle mdBaseVehicle = iMdBaseVehicleService.selectByVehicleCode(vehicle_code); |
|
|
MdBaseVehicle mdBaseVehicle = iMdBaseVehicleService.selectByVehicleCode(vehicle_code); |
|
|
if (mdBaseVehicle.getVehicle_type().equals(VehicleTypeEnum.TRAY.getVehicleCode())) |
|
|
if (mdBaseVehicle.getVehicle_type().equals(VehicleTypeEnum.TRAY.getVehicleCode())) |
|
|
throw new BadRequestException("钢托盘不能存放加工区!"); |
|
|
throw new BadRequestException("钢托盘不能存放加工区!"); |
|
|
param.put("region_code", region_code); |
|
|
|
|
|
jo.put("device_code", device_code); |
|
|
jo.put("device_code", device_code); |
|
|
jo.put("config_code", "ProcessingSMTTask"); |
|
|
jo.put("config_code", "ProcessingSMTTask"); |
|
|
jo.put("create_mode", GeneralDefinition.AUTO_CREATION); |
|
|
jo.put("create_mode", GeneralDefinition.AUTO_CREATION); |
|
|
jo.put("vehicle_code", vehicle_code); |
|
|
jo.put("vehicle_code", vehicle_code); |
|
|
jo.put("region_code", region_code); |
|
|
jo.put("region_code", region_code); |
|
|
param.put("target_region_code", region_code); |
|
|
|
|
|
jo.put("ext_data", param); |
|
|
jo.put("ext_data", param); |
|
|
|
|
|
param.put("region_code", region_code); |
|
|
|
|
|
param.put("target_region_code", region_code); |
|
|
connectorTask.apply(jo); |
|
|
connectorTask.apply(jo); |
|
|
iSchBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class) |
|
|
iSchBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class) |
|
|
.eq(SchBasePoint::getPoint_code, device_code) |
|
|
.eq(SchBasePoint::getPoint_code, device_code) |
|
@ -478,7 +407,7 @@ public class HandheldServiceImpl implements HandheldService { |
|
|
if (StrUtil.equals(status, "0")) { |
|
|
if (StrUtil.equals(status, "0")) { |
|
|
iSchBaseTaskService.updateTaskStatusByPointCode(pointCodes); |
|
|
iSchBaseTaskService.updateTaskStatusByPointCode(pointCodes); |
|
|
if (param.getJSONArray("pointCodes").size() > 0) { |
|
|
if (param.getJSONArray("pointCodes").size() > 0) { |
|
|
param.getJSONArray("pointCodes").stream().forEach(pointCode -> { |
|
|
param.getJSONArray("pointCodes").forEach(pointCode -> { |
|
|
cn.hutool.json.JSONObject jsonObject = JSONUtil.parseObj(pointCode); |
|
|
cn.hutool.json.JSONObject jsonObject = JSONUtil.parseObj(pointCode); |
|
|
iSchBaseVehiclematerialgroupService.remove(Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class) |
|
|
iSchBaseVehiclematerialgroupService.remove(Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class) |
|
|
.eq(SchBaseVehiclematerialgroup::getVehicle_code, jsonObject.get("vehicle_code"))); |
|
|
.eq(SchBaseVehiclematerialgroup::getVehicle_code, jsonObject.get("vehicle_code"))); |
|
@ -537,10 +466,18 @@ public class HandheldServiceImpl implements HandheldService { |
|
|
|| !mdBaseVehicle.getVehicle_type().equals(VehicleTypeEnum.RACKS_S06.getVehicleCode())) { |
|
|
|| !mdBaseVehicle.getVehicle_type().equals(VehicleTypeEnum.RACKS_S06.getVehicleCode())) { |
|
|
throw new BadRequestException("不是料架,生成搬运任务失败!"); |
|
|
throw new BadRequestException("不是料架,生成搬运任务失败!"); |
|
|
} |
|
|
} |
|
|
|
|
|
rackTask(param, vehicle_code, device_code, mdBaseVehicle); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void rackTask(JSONObject param, String vehicle_code, String device_code, MdBaseVehicle mdBaseVehicle) { |
|
|
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(device_code); |
|
|
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(device_code); |
|
|
if (ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("设备点位不存在!"); |
|
|
if (ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("设备点位不存在!"); |
|
|
AbstractTask connectorTask = taskFactory.getTask("RACKTask"); |
|
|
AbstractTask connectorTask = taskFactory.getTask("RACKTask"); |
|
|
// 准备参数:设备编码
|
|
|
// 准备参数:设备编码
|
|
|
|
|
|
applyTask(param, vehicle_code, device_code, mdBaseVehicle, connectorTask); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void applyTask(JSONObject param, String vehicle_code, String device_code, MdBaseVehicle mdBaseVehicle, AbstractTask connectorTask) { |
|
|
JSONObject jo = new JSONObject(); |
|
|
JSONObject jo = new JSONObject(); |
|
|
jo.put("device_code", device_code); |
|
|
jo.put("device_code", device_code); |
|
|
jo.put("config_code", "RACKTask"); |
|
|
jo.put("config_code", "RACKTask"); |
|
@ -608,7 +545,7 @@ public class HandheldServiceImpl implements HandheldService { |
|
|
@Override |
|
|
@Override |
|
|
public void updateRegionCodeByOrder(JSONArray json) { |
|
|
public void updateRegionCodeByOrder(JSONArray json) { |
|
|
Assert.noNullElements(json, "参数不能为空!"); |
|
|
Assert.noNullElements(json, "参数不能为空!"); |
|
|
json.stream().forEach(material -> { |
|
|
json.forEach(material -> { |
|
|
cn.hutool.json.JSONObject jsonObject = JSONUtil.parseObj(material); |
|
|
cn.hutool.json.JSONObject jsonObject = JSONUtil.parseObj(material); |
|
|
iSchBaseVehiclematerialgroupService.update(Wrappers.lambdaUpdate(SchBaseVehiclematerialgroup.class) |
|
|
iSchBaseVehiclematerialgroupService.update(Wrappers.lambdaUpdate(SchBaseVehiclematerialgroup.class) |
|
|
.eq(SchBaseVehiclematerialgroup::getOrder_code, jsonObject.getStr("order_code")) |
|
|
.eq(SchBaseVehiclematerialgroup::getOrder_code, jsonObject.getStr("order_code")) |
|
@ -626,7 +563,7 @@ public class HandheldServiceImpl implements HandheldService { |
|
|
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); |
|
|
List<JSONObject> jsonList = new ArrayList<>(); |
|
|
List<JSONObject> jsonList = new ArrayList<>(); |
|
|
list.stream().forEach(device -> { |
|
|
list.forEach(device -> { |
|
|
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(device); |
|
|
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(device); |
|
|
if (ObjectUtil.isNotEmpty(schBasePoint)) { |
|
|
if (ObjectUtil.isNotEmpty(schBasePoint)) { |
|
|
JSONObject map = new JSONObject(); |
|
|
JSONObject map = new JSONObject(); |
|
@ -643,8 +580,8 @@ public class HandheldServiceImpl implements HandheldService { |
|
|
deviceInLogin(JSONObject json) { |
|
|
deviceInLogin(JSONObject json) { |
|
|
Assert.notNull(json.getString("device_code"), "登录参数不能为空"); |
|
|
Assert.notNull(json.getString("device_code"), "登录参数不能为空"); |
|
|
if (StrUtil.isNotEmpty(json.getString("device_code"))) { |
|
|
if (StrUtil.isNotEmpty(json.getString("device_code"))) { |
|
|
Object regin_code = redisUtils.get("mobile:" + json.getString("device_code")); |
|
|
Object region_code = redisUtils.get("mobile:" + json.getString("device_code")); |
|
|
if (regin_code != null) { |
|
|
if (region_code != null) { |
|
|
throw new BadRequestException("当前设备工序已经登陆,无法继续选择"); |
|
|
throw new BadRequestException("当前设备工序已经登陆,无法继续选择"); |
|
|
} else { |
|
|
} else { |
|
|
SysParamServiceImpl sysParamService = SpringContextHolder.getBean(SysParamServiceImpl.class); |
|
|
SysParamServiceImpl sysParamService = SpringContextHolder.getBean(SysParamServiceImpl.class); |
|
@ -692,10 +629,7 @@ public class HandheldServiceImpl implements HandheldService { |
|
|
public boolean isLock() { |
|
|
public boolean isLock() { |
|
|
SysParamServiceImpl sysParamService = SpringContextHolder.getBean(SysParamServiceImpl.class); |
|
|
SysParamServiceImpl sysParamService = SpringContextHolder.getBean(SysParamServiceImpl.class); |
|
|
Param isConnectConnector = sysParamService.findByCode(GeneralDefinition.ADD_ROUTE_DOOR); |
|
|
Param isConnectConnector = sysParamService.findByCode(GeneralDefinition.ADD_ROUTE_DOOR); |
|
|
if (Integer.parseInt(isConnectConnector.getValue()) == 0) { |
|
|
return Integer.parseInt(isConnectConnector.getValue()) != 0; |
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|