This commit is contained in:
2023-02-16 13:44:44 +08:00
parent cb7f56f2d6
commit 49e50b18b1
5 changed files with 120 additions and 70 deletions

View File

@@ -278,7 +278,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
JSONArray isLock = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type in ('4','5') AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1'").getResultJSONArray(0);
if (ObjectUtil.isEmpty(isLock)) {
if (placement_type.equals("03")) {
// 右通
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq desc").uniqueResult(0);
@@ -388,7 +388,6 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
struct_table.update(map, "struct_code = '" + struct_jo.getString("struct_code") + "'");
}
if (type.equals("4")) {
//查询该木箱对应的包装关系
@@ -508,6 +507,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
}
@Override
@Transactional(rollbackFor = Exception.class)
@SneakyThrows
public JSONObject deviceApply(JSONObject whereJson) {
log.info("deviceApply请求参数---------------------------------------------" + whereJson.toString());
String vehicle_code = whereJson.getString("vehicle_code");
@@ -521,68 +522,80 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
result.put("status", HttpStatus.OK.value());
result.put("message", "反馈成功!");
if (type.equals("1")) {
if (StrUtil.isEmpty(vehicle_code)) {
throw new BadRequestException("木箱码不能为空!");
}
if (StrUtil.isEmpty(weight)) {
throw new BadRequestException("重量不能为空!");
}
JSONObject sub_jo = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("package_box_sn = '" + vehicle_code + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(sub_jo)) {
throw new BadRequestException("未查询到该木箱对应的包装关系!");
}
//贴标申请
String print_type = "1";
if (StrUtil.isEmpty(print_type)) {
throw new BadRequestException("请指定一台打印机进行打印!");
}
RLock lock = redissonClient.getLock("acs_to_wms:" + type);
boolean tryLock = lock.tryLock(5, TimeUnit.SECONDS);
String print_code = "";
switch (print_type) {
case "1":
print_code = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("print_device1").getValue();
break;
case "2":
print_code = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("print_device2").getValue();
break;
default:
throw new BadRequestException("未查询到对应打印机!");
try {
if (tryLock) {
if (type.equals("1")) {
if (StrUtil.isEmpty(vehicle_code)) {
throw new BadRequestException("木箱码不能为空!");
}
if (StrUtil.isEmpty(weight)) {
throw new BadRequestException("重量不能为空!");
}
JSONObject sub_jo = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("package_box_sn = '" + vehicle_code + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(sub_jo)) {
throw new BadRequestException("未查询到该木箱对应的包装关系!");
}
//贴标申请
String print_type = "1";
if (StrUtil.isEmpty(print_type)) {
throw new BadRequestException("请指定一台打印机进行打印!");
}
String print_code = "";
switch (print_type) {
case "1":
print_code = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("print_device1").getValue();
break;
case "2":
print_code = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("print_device2").getValue();
break;
default:
throw new BadRequestException("未查询到对应打印机!");
}
JSONObject print_info = WQLObject.getWQLObject("pdm_bi_printinfo").query("print_name = '" + print_code + "'").uniqueResult(0);
JSONObject print_jo = new JSONObject();
print_jo.put("box_no", vehicle_code);
print_jo.put("print_type", print_info.getString("print_id"));
print_jo.put("box_weight", weight);
new PrintServiceImpl().customerPrint2(print_jo);
} else if (type.equals("2")) {
if (StrUtil.isEmpty(vehicle_code)) {
throw new BadRequestException("木箱码不能为空!");
}
JSONObject sub_jo = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("package_box_sn = '" + vehicle_code + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(sub_jo)) {
throw new BadRequestException("未查询到该木箱对应的包装关系!");
}
//捆扎申请
String box_length = sub_jo.getString("box_length");
String box_width = sub_jo.getString("box_width");
String box_high = sub_jo.getString("box_high");
JSONObject data = new JSONObject();
data.put("box_length", box_length);
data.put("box_width", box_width);
data.put("box_high", box_high);
data.put("bundle_times", 2);
result.put("data", data);
} else if (type.equals("3")) {
//烘箱出箱任务
String device_code = whereJson.getString("device_code");
JSONObject bake_jo = new JSONObject();
bake_jo.put("point_code", device_code);
bake_jo.put("option", "2");
new BakingServiceImpl().ovenInAndOut(bake_jo);
} else {
throw new BadRequestException("请输入正确的任务类型!");
}
}
JSONObject print_info = WQLObject.getWQLObject("pdm_bi_printinfo").query("print_name = '" + print_code + "'").uniqueResult(0);
JSONObject print_jo = new JSONObject();
print_jo.put("box_no", vehicle_code);
print_jo.put("print_type", print_info.getString("print_id"));
print_jo.put("box_weight", weight);
new PrintServiceImpl().customerPrint2(print_jo);
} else if (type.equals("2")) {
if (StrUtil.isEmpty(vehicle_code)) {
throw new BadRequestException("木箱码不能为空!");
} finally {
if (tryLock) {
lock.unlock();
}
JSONObject sub_jo = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("package_box_sn = '" + vehicle_code + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(sub_jo)) {
throw new BadRequestException("未查询到该木箱对应的包装关系!");
}
//捆扎申请
String box_length = sub_jo.getString("box_length");
String box_width = sub_jo.getString("box_width");
String box_high = sub_jo.getString("box_high");
JSONObject data = new JSONObject();
data.put("box_length", box_length);
data.put("box_width", box_width);
data.put("box_high", box_high);
data.put("bundle_times", 2);
result.put("data", data);
} else if (type.equals("3")) {
//烘箱出箱任务
String device_code = whereJson.getString("device_code");
JSONObject bake_jo = new JSONObject();
bake_jo.put("point_code", device_code);
bake_jo.put("option", "2");
new BakingServiceImpl().ovenInAndOut(bake_jo);
} else {
throw new BadRequestException("请输入正确的任务类型!");
}
return result;
}

View File

@@ -15,6 +15,9 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.modules.logging.annotation.Log;
import org.nl.modules.system.service.ParamService;
import org.nl.modules.wql.util.SpringContextHolder;
import org.nl.system.service.param.ISysParamService;
import org.nl.system.service.param.impl.SysParamServiceImpl;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
@@ -29,7 +32,6 @@ import org.springframework.web.bind.annotation.*;
@Slf4j
public class AppUpdateController {
private final ParamService paramService;
@PostMapping
@Log("app更新")
@@ -38,6 +40,7 @@ public class AppUpdateController {
public ResponseEntity<Object> appUpdate() {
JSONObject obj=new JSONObject();
// obj.put("versionName","1.0.1");
ISysParamService paramService = SpringContextHolder.getBean(SysParamServiceImpl.class);
String app_rul = paramService.findByCode("APP_URL").getValue();
String app_version = paramService.findByCode("APP_VERSION").getValue();
// obj.put("url","http://172.17.2.163:8080/apk/app.apk");

View File

@@ -80,7 +80,7 @@ public class ShippingServiceImpl implements ShippingService {
public JSONObject confirm(JSONObject whereJson) {
JSONArray rows = whereJson.getJSONArray("cut_rows");
String vehicle_code = whereJson.getString("vehicle_code");
if (StrUtil.isEmpty(vehicle_code)){
if (StrUtil.isEmpty(vehicle_code)) {
throw new BadRequestException("输入的载具号不能为空!");
}
@@ -189,9 +189,12 @@ public class ShippingServiceImpl implements ShippingService {
JSONObject right_point = WQLObject.getWQLObject("st_ivt_deliverypointivt").query("point_location = '" + empty_point.getString("point_location") + "' AND product_area = '" + empty_point.getString("product_area") + "' AND sort_seq = '" + empty_point.getString("sort_seq") + "' order by point_code desc").uniqueResult(0);
//判断是否存在任务
JSONObject task_jo = WQLObject.getWQLObject("sch_base_task").query("(point_code1 = '" + right_point.getString("point_code") + "' OR point_code2 = '" + right_point.getString("point_code") + "') AND task_status < '07' AND is_delete = '0'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(task_jo) && !right_point.getString("point_status").equals("01")) {
if (!right_point.getString("point_status").equals("01")) {
throw new BadRequestException(empty_point.getString("point_code") + "所在一截输送线缓存位存在货物,请使用【载具横移】功能将货物横移!");
}
if (ObjectUtil.isNotEmpty(task_jo)) {
throw new BadRequestException(empty_point.getString("point_code") + "所在一截输送线存在未完成的任务,请稍等几分钟后进行下发!");
}
}
//下发输送线任务
@@ -272,14 +275,17 @@ public class ShippingServiceImpl implements ShippingService {
//如果为左边点位判断右边是否存在未完成的任务,如果有则提示不能下发
//判断输送出来的任务起点是否靠近分切机,如果靠近分切机且远离分切机的点位上存在载具且不存在任务进行载具横移
char dtl_type = point_jo.getString("point_code").charAt(point_jo.getString("point_code").length() - 1);
/*if (Integer.valueOf(String.valueOf(dtl_type)) % 2 != 0) {
if (Integer.valueOf(String.valueOf(dtl_type)) % 2 != 0) {
JSONObject right_point = WQLObject.getWQLObject("st_ivt_deliverypointivt").query("point_location = '" + point_jo.getString("point_location") + "' AND product_area = '" + point_jo.getString("product_area") + "' AND sort_seq = '" + point_jo.getString("sort_seq") + "' order by point_code desc").uniqueResult(0);
//判断是否存在任务
JSONObject task_jo = WQLObject.getWQLObject("sch_base_task").query("(point_code1 = '" + right_point.getString("point_code") + "' OR point_code2 = '" + right_point.getString("point_code") + "') AND task_status < '07' AND is_delete = '0'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(task_jo)) {
throw new BadRequestException(point_jo.getString("point_code") + "所在一截输送线存在未完成的任务,请稍等几分钟后进行下发!");
}
}*/
if (!right_point.getString("point_status").equals("01")) {
throw new BadRequestException(point_jo.getString("point_code") + "所在一截输送线缓存位存在货物,请使用【载具横移】功能将货物横移!");
}
}
//下发输送线任务
JSONObject form = new JSONObject();
@@ -327,7 +333,7 @@ public class ShippingServiceImpl implements ShippingService {
.addParam("product_area", product_area)
.addParam("sort_seq", sort_seq)
.addParam("find_type", "2")
.addParam("flag", "17").process().uniqueResult(0);
.addParam("flag", "18").process().uniqueResult(0);
if (ObjectUtil.isNotEmpty(left_point)) {
//创建载具横移任务
String translate_code1 = point_code;
@@ -339,7 +345,7 @@ public class ShippingServiceImpl implements ShippingService {
tran_jo.put("vehicle_code2", del_jo.getString("vehicle_code"));
tran_jo.put("task_type", "010406");
cutConveyorTask.createTask(tran_jo);
}else {
} else {
throw new BadRequestException("该点位所在输送线对应的上料位存在载具,不能横移!");
}
}

View File

@@ -601,6 +601,33 @@
ENDQUERY
ENDIF
IF 输入.flag = "18"
QUERY
SELECT
*
FROM
st_ivt_deliverypointivt ivt
WHERE
sort_seq = 输入.sort_seq
AND
product_area = 输入.product_area
AND
point_location = 输入.point_location
AND
point_code <> 输入.point_code
OPTION 输入.find_type = "1"
point_status <> '01'
ENDOPTION
OPTION 输入.find_type = "2"
point_status = '01'
ENDOPTION
OPTION 输入.find_type = "3"
point_status = '03'
ENDOPTION
ENDSELECT
ENDQUERY
ENDIF

View File

@@ -149,7 +149,8 @@ public class CutConveyorTask extends AbstractAcsTask {
JSONObject tran_jo = new JSONObject();
tran_jo.put("point_code1",translate_code1);
tran_jo.put("point_code2",translate_code2);
tran_jo.put("vehicle_code",jsonTask.getString("vehicle_code"));
tran_jo.put("vehicle_code",right_point.getString("qzzno"));
tran_jo.put("vehicle_code2",right_point.getString("vehicle_code"));
tran_jo.put("task_type","010406");
this.createTask(tran_jo);
@@ -208,7 +209,7 @@ public class CutConveyorTask extends AbstractAcsTask {
.addParam("product_area", product_area)
.addParam("sort_seq", sort_seq)
.addParam("find_type", "2")
.addParam("flag", "17").process().uniqueResult(0);
.addParam("flag", "18").process().uniqueResult(0);
if (ObjectUtil.isNotEmpty(left_point)) {
//创建载具横移任务
String translate_code1 = point_code2;
@@ -217,7 +218,7 @@ public class CutConveyorTask extends AbstractAcsTask {
tran_jo.put("point_code1",translate_code1);
tran_jo.put("point_code2",translate_code2);
tran_jo.put("vehicle_code",jsonTask.getString("vehicle_code"));
tran_jo.put("vehicle_code2",jsonIvt.getString("vehicle_code"));
tran_jo.put("vehicle_code2",jsonTask.getString("vehicle_code2"));
tran_jo.put("task_type","010406");
this.createTask(tran_jo);
}