|
|
@ -44,8 +44,6 @@ import java.util.concurrent.TimeUnit; |
|
|
|
@Slf4j |
|
|
|
public class AcsToWmsServiceImpl implements AcsToWmsService { |
|
|
|
|
|
|
|
private final RedissonClient redissonClient; |
|
|
|
|
|
|
|
private final HLCallEmptyTask hlCallEmptyTask; |
|
|
|
|
|
|
|
private final HLSendMaterialTask hlSendMaterialTask; |
|
|
@ -187,19 +185,11 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public JSONObject apply(JSONObject param) { |
|
|
|
String point_code = param.getString("device_code"); |
|
|
|
if (StrUtil.isBlank(point_code)) { |
|
|
|
throw new BadRequestException("点位不能为空!"); |
|
|
|
} |
|
|
|
String type = param.getString("type"); |
|
|
|
if (StrUtil.isBlank(type)) { |
|
|
|
throw new BadRequestException("任务类型不能为空!"); |
|
|
|
} |
|
|
|
RLock lock = redissonClient.getFairLock("acs_to_wms:" + point_code); |
|
|
|
boolean try_lock = false; |
|
|
|
String task_code = null; |
|
|
|
try { |
|
|
|
try_lock = lock.tryLock(5, TimeUnit.SECONDS); |
|
|
|
if (try_lock) { |
|
|
|
String task_code; |
|
|
|
JSONObject point = param.getJSONObject("point"); |
|
|
|
if (ObjectUtil.isEmpty(point)) { |
|
|
|
point = WQLObject |
|
|
@ -242,11 +232,6 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { |
|
|
|
case YZ: |
|
|
|
method_param.put("workorder", param.getJSONObject("workorder")); |
|
|
|
method_param.put("vd", param.getJSONObject("vd")); |
|
|
|
JSONObject device = WQLObject |
|
|
|
.getWQLObject("pdm_bi_device") |
|
|
|
.query("device_code = '" + point.getString("device_code") + "'") |
|
|
|
.uniqueResult(0); |
|
|
|
method_param.put("device", device); |
|
|
|
task_code = yzSendMaterialTask.createTask(method_param); |
|
|
|
break; |
|
|
|
case SZ: |
|
|
@ -283,8 +268,22 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { |
|
|
|
break; |
|
|
|
case "3": |
|
|
|
// 送空
|
|
|
|
vehicle_code = TaskUtils.formatVehicleCode(param.getString("vehicle_code")); |
|
|
|
if ("0000".equals(vehicle_code)) { |
|
|
|
vehicle_code = point.getString("vehicle_code"); |
|
|
|
if (StrUtil.isBlank(vehicle_code) || "0000".equals(vehicle_code)) { |
|
|
|
throw new BadRequestException("未知载具编码!"); |
|
|
|
} |
|
|
|
} |
|
|
|
method_param.put("vehicle_code", vehicle_code); |
|
|
|
|
|
|
|
switch (region) { |
|
|
|
case FJ: |
|
|
|
JSONObject vd_update = new JSONObject(); |
|
|
|
vd_update.put("is_delete", TrueOrFalse.TRUE.value()); |
|
|
|
WQLObject |
|
|
|
.getWQLObject("st_ivt_vehicle_detail") |
|
|
|
.update(vd_update, "vehicle_type = '2' AND vehicle_code = '" + vehicle_code + "'"); |
|
|
|
task_code = fjSendEmptyTask.createTask(method_param); |
|
|
|
break; |
|
|
|
default: |
|
|
@ -310,11 +309,6 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { |
|
|
|
.query("is_delete = '0' AND device_code = '" + device_code + "' AND order_status = '3'") |
|
|
|
.uniqueResult(0); |
|
|
|
method_param.put("workorder", work_order); |
|
|
|
JSONObject device = WQLObject |
|
|
|
.getWQLObject("pdm_bi_device") |
|
|
|
.query("device_code = '" + device_code + "'") |
|
|
|
.uniqueResult(0); |
|
|
|
method_param.put("device", device); |
|
|
|
task_code = yzCallEmptyTask.createTask(method_param); |
|
|
|
break; |
|
|
|
case GTK: |
|
|
@ -327,15 +321,6 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { |
|
|
|
default: |
|
|
|
throw new BadRequestException("未知任务类型!"); |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (InterruptedException e) { |
|
|
|
log.error("lock fail!", e); |
|
|
|
} finally { |
|
|
|
if (try_lock) { |
|
|
|
lock.unlock(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
JSONObject result = new JSONObject(); |
|
|
|
result.put("message", "申请任务成功,任务编码 [" + task_code + "]"); |
|
|
|
result.put("status", HttpStatus.OK.value()); |
|
|
|