|
@ -8,7 +8,6 @@ import com.alibaba.fastjson.JSON; |
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import lombok.SneakyThrows; |
|
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import org.nl.modules.common.exception.BadRequestException; |
|
|
import org.nl.modules.common.exception.BadRequestException; |
|
|
import org.nl.modules.system.util.CodeUtil; |
|
|
import org.nl.modules.system.util.CodeUtil; |
|
@ -19,6 +18,7 @@ import org.nl.wms.basedata.eum.StandStatus; |
|
|
import org.nl.wms.basedata.eum.TrueOrFalse; |
|
|
import org.nl.wms.basedata.eum.TrueOrFalse; |
|
|
import org.nl.wms.basedata.eum.VehicleType; |
|
|
import org.nl.wms.basedata.eum.VehicleType; |
|
|
import org.nl.wms.basedata.service.dto.VehicleDto; |
|
|
import org.nl.wms.basedata.service.dto.VehicleDto; |
|
|
|
|
|
import org.nl.wms.common.PickType; |
|
|
import org.nl.wms.ext.acs.service.AcsToWmsService; |
|
|
import org.nl.wms.ext.acs.service.AcsToWmsService; |
|
|
import org.nl.wms.sch.manage.*; |
|
|
import org.nl.wms.sch.manage.*; |
|
|
import org.nl.wms.sch.task.call.empty.FJCallEmptyTask; |
|
|
import org.nl.wms.sch.task.call.empty.FJCallEmptyTask; |
|
@ -37,16 +37,12 @@ import org.nl.wms.sch.task.send.material.YZSendMaterialTask; |
|
|
import org.nl.wms.sch.task.to.pack.BTHCToPackageTask; |
|
|
import org.nl.wms.sch.task.to.pack.BTHCToPackageTask; |
|
|
import org.nl.wms.sch.task.to.pack.FJToPackageTask; |
|
|
import org.nl.wms.sch.task.to.pack.FJToPackageTask; |
|
|
import org.nl.wms.sch.task.util.TaskUtils; |
|
|
import org.nl.wms.sch.task.util.TaskUtils; |
|
|
import org.redisson.api.RLock; |
|
|
|
|
|
import org.redisson.api.RedissonClient; |
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
|
import org.springframework.http.HttpStatus; |
|
|
import org.springframework.http.HttpStatus; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
import java.lang.reflect.Method; |
|
|
import java.lang.reflect.Method; |
|
|
import java.util.Map; |
|
|
import java.util.Map; |
|
|
import java.util.concurrent.TimeUnit; |
|
|
|
|
|
|
|
|
|
|
|
@Service |
|
|
@Service |
|
|
@RequiredArgsConstructor |
|
|
@RequiredArgsConstructor |
|
@ -83,11 +79,6 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { |
|
|
|
|
|
|
|
|
private final SZCallMaterialTask szCallMaterialTask; |
|
|
private final SZCallMaterialTask szCallMaterialTask; |
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private RedissonClient redissonClient; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private AcsToWmsService acsToWmsService; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* task_id:任务标识 |
|
|
* task_id:任务标识 |
|
|
* task_code:任务编码 |
|
|
* task_code:任务编码 |
|
@ -209,34 +200,14 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
@SneakyThrows |
|
|
|
|
|
public JSONObject apply(JSONObject jsonObject) { |
|
|
|
|
|
String type = (String) jsonObject.get("type"); |
|
|
|
|
|
RLock lock = redissonClient.getLock("acs_to_wms:" + type); |
|
|
|
|
|
boolean tryLock = lock.tryLock(5, TimeUnit.SECONDS); |
|
|
|
|
|
try { |
|
|
|
|
|
if (tryLock) { |
|
|
|
|
|
return acsToWmsService.transApply(jsonObject); |
|
|
|
|
|
} |
|
|
|
|
|
} finally { |
|
|
|
|
|
if (tryLock) { |
|
|
|
|
|
lock.unlock(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public JSONObject transApply(JSONObject param) { |
|
|
public JSONObject apply(JSONObject param) { |
|
|
String point_code = param.getString("device_code"); |
|
|
String point_code = param.getString("device_code"); |
|
|
String type = param.getString("type"); |
|
|
if (StrUtil.isBlank(point_code)) { |
|
|
if (StrUtil.isBlank(type)) { |
|
|
throw new BadRequestException("点位不能为空!"); |
|
|
throw new BadRequestException("任务类型不能为空!"); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
String type = param.getString("type"); |
|
|
String task_code; |
|
|
String task_code; |
|
|
JSONObject point = param.getJSONObject("point"); |
|
|
JSONObject point = param.getJSONObject("point"); |
|
|
if (ObjectUtil.isEmpty(point)) { |
|
|
if (ObjectUtil.isEmpty(point)) { |
|
@ -262,7 +233,6 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { |
|
|
method_param.put("request_param", request_param); |
|
|
method_param.put("request_param", request_param); |
|
|
method_param.put("create_id", ACSSystem.id); |
|
|
method_param.put("create_id", ACSSystem.id); |
|
|
method_param.put("create_name", ACSSystem.nick_name); |
|
|
method_param.put("create_name", ACSSystem.nick_name); |
|
|
|
|
|
|
|
|
switch (type) { |
|
|
switch (type) { |
|
|
case "1": |
|
|
case "1": |
|
|
// 送料
|
|
|
// 送料
|
|
@ -279,10 +249,10 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { |
|
|
if (StrUtil.isBlank(weight)) { |
|
|
if (StrUtil.isBlank(weight)) { |
|
|
throw new BadRequestException("重量不能为空!"); |
|
|
throw new BadRequestException("重量不能为空!"); |
|
|
} |
|
|
} |
|
|
String is_full = param.getString("is_full"); |
|
|
workorder.put("real_qty", workorder.getIntValue("real_qty") + Integer.parseInt(weight)); |
|
|
if (StrUtil.isBlank(is_full)) { |
|
|
TaskUtils.addACSUpdateColum(workorder); |
|
|
throw new BadRequestException("是否满垛不能为空!"); |
|
|
WQLObject.getWQLObject("pdm_bd_workorder").update(workorder); |
|
|
} |
|
|
|
|
|
WQLObject vd_table = WQLObject.getWQLObject("st_ivt_vehicle_detail"); |
|
|
WQLObject vd_table = WQLObject.getWQLObject("st_ivt_vehicle_detail"); |
|
|
JSONObject vd_update = new JSONObject(); |
|
|
JSONObject vd_update = new JSONObject(); |
|
|
vd_update.put("is_delete", "1"); |
|
|
vd_update.put("is_delete", "1"); |
|
@ -298,7 +268,6 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { |
|
|
vd.put("vehicle_code", vehicle_code); |
|
|
vd.put("vehicle_code", vehicle_code); |
|
|
vd.put("material_id", workorder.getString("material_id")); |
|
|
vd.put("material_id", workorder.getString("material_id")); |
|
|
vd.put("weight", weight); |
|
|
vd.put("weight", weight); |
|
|
vd.put("is_full", is_full); |
|
|
|
|
|
vd.put("workorder_id", workorder.getString("workorder_id")); |
|
|
vd.put("workorder_id", workorder.getString("workorder_id")); |
|
|
vd.put("point_code", point_code); |
|
|
vd.put("point_code", point_code); |
|
|
vd.put("create_id", ACSSystem.id); |
|
|
vd.put("create_id", ACSSystem.id); |
|
@ -450,7 +419,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { |
|
|
case FJ: |
|
|
case FJ: |
|
|
method_param.put("workorder", param.getJSONObject("workorder")); |
|
|
method_param.put("workorder", param.getJSONObject("workorder")); |
|
|
method_param.put("vd", param.getJSONObject("vd")); |
|
|
method_param.put("vd", param.getJSONObject("vd")); |
|
|
task_code = yzSendMaterialTask.createTask(method_param); |
|
|
task_code = fjToPackageTask.createTask(method_param); |
|
|
break; |
|
|
break; |
|
|
case BTHC: |
|
|
case BTHC: |
|
|
TaskUtils.isNotEmptyPoint(point); |
|
|
TaskUtils.isNotEmptyPoint(point); |
|
@ -729,7 +698,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { |
|
|
|
|
|
|
|
|
if (workorder.getIntValue("order_status") < 5) { |
|
|
if (workorder.getIntValue("order_status") < 5) { |
|
|
workorder.put("order_status", WorkOrderEnum.ORDER_STATUS_FINISH.value()); |
|
|
workorder.put("order_status", WorkOrderEnum.ORDER_STATUS_FINISH.value()); |
|
|
|
|
|
if (!"0".equals(qty)) { |
|
|
workorder.put("real_qty", qty); |
|
|
workorder.put("real_qty", qty); |
|
|
|
|
|
} |
|
|
String unqualified_qty = jsonObject.getString("unqualified_qty"); |
|
|
String unqualified_qty = jsonObject.getString("unqualified_qty"); |
|
|
if (StrUtil.isNotBlank(unqualified_qty) && !"0".equals(unqualified_qty)) { |
|
|
if (StrUtil.isNotBlank(unqualified_qty) && !"0".equals(unqualified_qty)) { |
|
|
workorder.put("unqualified_qty", unqualified_qty); |
|
|
workorder.put("unqualified_qty", unqualified_qty); |
|
@ -738,7 +709,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { |
|
|
if (StrUtil.isNotBlank(qualified_qty) && !"0".equals(qualified_qty)) { |
|
|
if (StrUtil.isNotBlank(qualified_qty) && !"0".equals(qualified_qty)) { |
|
|
workorder.put("qualified_qty", qualified_qty); |
|
|
workorder.put("qualified_qty", qualified_qty); |
|
|
} else { |
|
|
} else { |
|
|
workorder.put("qualified_qty", Integer.parseInt(qty) - workorder.getIntValue("unqualified_qty")); |
|
|
workorder.put("qualified_qty", workorder.getIntValue("real_qty") - workorder.getIntValue("unqualified_qty")); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
workorder.put("realproduceend_date", DateUtil.now()); |
|
|
workorder.put("realproduceend_date", DateUtil.now()); |
|
@ -832,7 +803,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { |
|
|
|
|
|
|
|
|
JSONObject data = null; |
|
|
JSONObject data = null; |
|
|
if (!"0000".equals(vehicle_code)) { |
|
|
if (!"0000".equals(vehicle_code)) { |
|
|
data = WQLObject.getWQLObject("st_ivt_vehicle_detail") |
|
|
data = WQLObject |
|
|
|
|
|
.getWQLObject("st_ivt_vehicle_detail") |
|
|
.query("is_delete = '0' AND vehicle_type = '" + vehicle_type + "' AND vehicle_code = '" + vehicle_code + "'") |
|
|
.query("is_delete = '0' AND vehicle_type = '" + vehicle_type + "' AND vehicle_code = '" + vehicle_code + "'") |
|
|
.uniqueResult(0); |
|
|
.uniqueResult(0); |
|
|
} |
|
|
} |
|
@ -870,7 +842,10 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { |
|
|
} else { |
|
|
} else { |
|
|
update.put("vehicle_type", String.valueOf(Integer.parseInt(vehicle_type) + 2)); |
|
|
update.put("vehicle_type", String.valueOf(Integer.parseInt(vehicle_type) + 2)); |
|
|
} |
|
|
} |
|
|
WQLObject.getWQLObject("sch_base_point").update(update, "point_code = '" + point_code + "'"); |
|
|
WQLObject |
|
|
|
|
|
.getWQLObject("sch_base_point") |
|
|
|
|
|
.update(update, "point_code = '" + point_code + "'"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JSONObject result = new JSONObject(); |
|
|
JSONObject result = new JSONObject(); |
|
|
result.put("status", HttpStatus.OK.value()); |
|
|
result.put("status", HttpStatus.OK.value()); |
|
@ -917,7 +892,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { |
|
|
String vehicle_code = point.getString("vehicle_code"); |
|
|
String vehicle_code = point.getString("vehicle_code"); |
|
|
JSONObject data = null; |
|
|
JSONObject data = null; |
|
|
if (StrUtil.isNotBlank(vehicle_code) && !"0000".equals(vehicle_code)) { |
|
|
if (StrUtil.isNotBlank(vehicle_code) && !"0000".equals(vehicle_code)) { |
|
|
data = WQL.getWO("ACS_TO_WMS") |
|
|
data = WQL |
|
|
|
|
|
.getWO("ACS_TO_WMS") |
|
|
.addParam("flag", "1") |
|
|
.addParam("flag", "1") |
|
|
.addParam("vehicle_type", vehicle_type) |
|
|
.addParam("vehicle_type", vehicle_type) |
|
|
.addParam("vehicle_code", vehicle_code) |
|
|
.addParam("vehicle_code", vehicle_code) |
|
@ -940,13 +916,21 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
boolean to_package = false; |
|
|
boolean to_package = false; |
|
|
JSONObject workorder = WQL.getWO("ACS_TO_WMS") |
|
|
|
|
|
.addParam("flag", "2") |
|
|
WQLObject vd_table = WQLObject.getWQLObject("st_ivt_vehicle_detail"); |
|
|
.addParam("vehicle_code", vehicle_code) |
|
|
JSONObject vd = vd_table |
|
|
.process() |
|
|
.query("is_delete = '0' AND vehicle_type = '2' AND vehicle_code = '" + vehicle_code + "'") |
|
|
.uniqueResult(0); |
|
|
.uniqueResult(0); |
|
|
if (ObjectUtil.isNotEmpty(workorder)) { |
|
|
if (ObjectUtil.isNotEmpty(vd)) { |
|
|
to_package = TrueOrFalse.trueOrFalse("is_pri"); |
|
|
vd.put("is_fire", "1"); |
|
|
|
|
|
vd.put("is_in_kiln", "0"); |
|
|
|
|
|
vd_table.update(vd); |
|
|
|
|
|
|
|
|
|
|
|
JSONObject pn = TaskUtils.buildPN(PickType.GZ, vd.getLongValue("qty"), null); |
|
|
|
|
|
WQLObject.getWQLObject("das_produce_number").insert(pn); |
|
|
|
|
|
|
|
|
|
|
|
JSONObject workorder = WQLObject.getWQLObject("pdm_bd_workorder").query("workorder_id = " + vd.getString("workorder_id")).uniqueResult(0); |
|
|
|
|
|
to_package = TrueOrFalse.trueOrFalse(workorder.getString("is_pri")); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
JSONObject result = new JSONObject(); |
|
|
JSONObject result = new JSONObject(); |
|
@ -955,4 +939,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { |
|
|
result.put("data", to_package); |
|
|
result.put("data", to_package); |
|
|
return result; |
|
|
return result; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public JSONObject transApply(JSONObject param) { |
|
|
|
|
|
return null; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|