This commit is contained in:
lyd
2022-10-25 20:30:25 +08:00
21 changed files with 172 additions and 191 deletions

View File

@@ -172,7 +172,10 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
String point_code = whereJson.getString("point_code");
String vehicle_type = whereJson.getString("vehicle_type");
String vehicle_code = whereJson.getString("vehicle_code");
String qty = whereJson.getString("vehicle_num");
//载具数量
String vehicle_num = whereJson.getString("vehicle_num");
//物料数量
String material_num = whereJson.getString("material_num");
if (ObjectUtil.isEmpty(type)) throw new BadRequestException("类型不能为空");
if (ObjectUtil.isEmpty(point_code)) throw new BadRequestException("点位不能为空");
@@ -190,24 +193,24 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
*/
if (StrUtil.equals(type, "1")) {
// 1.共挤线申请空盘: 调用空托盘出库处理类创建任务
if (ObjectUtil.isEmpty(qty)) throw new BadRequestException("数量不能为空");
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("qty", qty);
param.put("qty", material_num);
// 创建任务
GjxCallEmpVehicleTask taskBean = SpringContextHolder.getBean(GjxCallEmpVehicleTask.class);
taskBean.createTask(param);
} else if (StrUtil.equals(type, "2")) {
// 2.共挤线满托入库: 调用物料入库处理类创建任务
if (ObjectUtil.isEmpty(qty) || (StrUtil.equals(qty, "0")))
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", qty); // 满料位
param.put("qty", material_num); // 满料位
param.put("vehicle_type", vehicle_type);
param.put("vehicle_code", vehicle_code);
@@ -215,11 +218,11 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
String task_id = taskBean.createTask(param); // 创建任务
} else if (StrUtil.equals(type, "3")) {
// 3.油漆线申请空盘: 调用空托盘出库处理类创建任务
if (ObjectUtil.isEmpty(qty)) throw new BadRequestException("数量不能为空");
if (ObjectUtil.isEmpty(vehicle_num)) throw new BadRequestException("数量不能为空");
JSONObject param = new JSONObject();
param.put("point_code2", point_code);
param.put("qty", qty);
param.put("qty", vehicle_num);
// 创建任务
YqxCallEmpVehicleTask taskBean = SpringContextHolder.getBean(YqxCallEmpVehicleTask.class);
String task_id = taskBean.createTask(param);
@@ -237,12 +240,12 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
} else if (StrUtil.equals(type, "5")) {
// 5.油漆线空盘入库: 调用空托盘入库处理类创建任务
if (ObjectUtil.isEmpty(point_code)) throw new BadRequestException("点位不能为空");
if (ObjectUtil.isEmpty(qty)) 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", qty);
param.put("qty", vehicle_num);
param.put("vehicle_type", vehicle_type);
// 创建任务
YqxSendEmpVehicleTask taskBean = SpringContextHolder.getBean(YqxSendEmpVehicleTask.class);
@@ -256,10 +259,10 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
// 查询载具号对应的数量
JSONObject jsonVeQty = new JSONObject();
if (ObjectUtil.isEmpty(qty)) {
if (ObjectUtil.isEmpty(vehicle_num)) {
if (ObjectUtil.isEmpty(jsonVeQty)) throw new BadRequestException("请先手持扫码");
} else {
jsonVeQty.put("qty", qty);
jsonVeQty.put("qty", vehicle_num);
}
param.put("qty", jsonVeQty.getString("qty"));
@@ -273,6 +276,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
} else if (StrUtil.equals(type, "7")) {
JSONObject param = new JSONObject();
param.put("point_code1", point_code);
param.put("qty", material_num);
// 1.生成起点确定的任务
SpringContextHolder.getBean(YqxSendMaterialTask.class).createTask(param);
} else if (StrUtil.equals(type, "8")) {
@@ -281,7 +285,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
param.put("point_code1", point_code);
param.put("vehicle_code", vehicle_code);
param.put("vehicle_type", vehicle_type);
param.put("qty", qty);
param.put("qty", material_num);
HkxSendMaterialTask taskBean = SpringContextHolder.getBean(HkxSendMaterialTask.class);
String task_id = taskBean.createTask(param);

View File

@@ -1,5 +1,6 @@
package org.nl.wms.pda.callmaterial.service.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
@@ -8,7 +9,6 @@ import lombok.extern.slf4j.Slf4j;
import org.nl.modules.wql.WQL;
import org.nl.wms.ext.acs.service.AcsToWmsService;
import org.nl.wms.pda.callmaterial.service.CallMaterialService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -43,18 +43,18 @@ public class CallMaterialServiceImpl implements CallMaterialService {
JSONObject result = new JSONObject();
// 1、准备参数point_code、type = 4
JSONObject param = new JSONObject();
param.put("type","4");
param.put("point_code",whereJson.getString("point_code"));
param.put("type", "4");
param.put("point_code", whereJson.getString("point_code"));
// 2、调用接口
JSONObject json = acsToWmsService.apply(param);
if (StrUtil.equals(json.getString("status"), "200")) {
if (ObjectUtil.isEmpty(json) || StrUtil.equals(json.getString("status"), "200")) {
result.put("result", "");
result.put("code", "1");
result.put("desc", "操作成功");
} else {
result.put("result", "");
result.put("code", "0");
result.put("desc", "操作失败:"+json.getString("message"));
result.put("desc", "操作失败:" + json.getString("message"));
}
return result;
}

View File

@@ -47,8 +47,7 @@
FROM
sch_base_region
WHERE
is_used = '1'
AND region_code = 'YQQY01'
region_code = 'YQQY01'
ENDSELECT
ENDQUERY
@@ -65,8 +64,7 @@
WHERE
is_used = '1'
AND is_delete = '0'
AND is_host = '0'
AND device_point_type = '3'
AND point_type = '3'
OPTION 输入.region_id <> ""
region_id = 输入.region_id
@@ -74,4 +72,4 @@
ENDSELECT
ENDQUERY
ENDIF
ENDIF

View File

@@ -1,5 +1,6 @@
package org.nl.wms.pda.callvehicle.service.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
@@ -9,8 +10,6 @@ import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.wms.ext.acs.service.AcsToWmsService;
import org.nl.wms.pda.callvehicle.service.CallVehicleService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -50,21 +49,21 @@ public class CallVehicleServiceImpl implements CallVehicleService {
String region_id = whereJson.getString("region_id");
JSONObject jsonObject = WQLObject.getWQLObject("sch_base_region").query("region_id ='" + region_id + "'").uniqueResult(0);
String region_code = jsonObject.getString("region_code");
if (StrUtil.equals(region_code, "GJQY01")) param.put("type","1");
if (StrUtil.equals(region_code, "YQQY01")) param.put("type","3");
if (StrUtil.equals(region_code, "GJQY01")) param.put("type", "1");
if (StrUtil.equals(region_code, "YQQY01")) param.put("type", "3");
param.put("point_code",whereJson.getString("point_code"));
param.put("vehicle_num",whereJson.getString("qty"));
param.put("point_code", whereJson.getString("point_code"));
param.put("vehicle_num", whereJson.getString("qty"));
// 2、调用接口
JSONObject json = acsToWmsService.apply(param);
if (StrUtil.equals(json.getString("status"), "200")) {
if (ObjectUtil.isEmpty(json) || StrUtil.equals(json.getString("status"), "200")) {
result.put("result", "");
result.put("code", "1");
result.put("desc", "操作成功");
} else {
result.put("result", "");
result.put("code", "0");
result.put("desc", "操作失败:"+json.getString("message"));
result.put("desc", "操作失败:" + json.getString("message"));
}
return result;
}

View File

@@ -47,8 +47,7 @@
FROM
sch_base_region
WHERE
is_used = '1'
AND region_code in ('YQQY01','GJQY01')
region_code in ('YQQY01','GJQY01')
ENDSELECT
ENDQUERY
@@ -65,8 +64,7 @@
WHERE
is_used = '1'
AND is_delete = '0'
AND is_host = '0'
AND device_point_type = '1'
AND point_type = '1'
OPTION 输入.region_id <> ""
region_id = 输入.region_id
@@ -74,4 +72,4 @@
ENDSELECT
ENDQUERY
ENDIF
ENDIF

View File

@@ -1,32 +0,0 @@
package org.nl.wms.pda.emptyandqty.rest;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.modules.logging.annotation.Log;
import org.nl.wms.pda.emptyandqty.service.EmptyAndQtyService;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequiredArgsConstructor
@Api(tags = "手持空托盘与数量绑定")
@RequestMapping("api/pda/emptyAndQty")
@Slf4j
public class EmptyAndQtyController {
private final EmptyAndQtyService emptyAndQtyService;
@PostMapping("/confirm")
@Log("绑定")
@ApiOperation("绑定")
public ResponseEntity<Object> confirm(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(emptyAndQtyService.confirm(whereJson), HttpStatus.OK);
}
}

View File

@@ -1,13 +0,0 @@
package org.nl.wms.pda.emptyandqty.service;
import com.alibaba.fastjson.JSONObject;
public interface EmptyAndQtyService {
/**
* 绑定
* @param whereJson /
* @return JSONObject
*/
JSONObject confirm(JSONObject whereJson);
}

View File

@@ -1,51 +0,0 @@
package org.nl.wms.pda.emptyandqty.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.modules.common.utils.SecurityUtils;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.SpringContextHolder;
import org.nl.wms.basedata.service.VehicleService;
import org.nl.wms.basedata.service.dto.VehicleDto;
import org.nl.wms.pda.emptyandqty.service.EmptyAndQtyService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
@RequiredArgsConstructor
@Slf4j
public class EmptyAndQtyServiceImpl implements EmptyAndQtyService {
@Override
@Transactional(rollbackFor = Exception.class)
public JSONObject confirm(JSONObject whereJson) {
String vehicle_code = whereJson.getString("vehicle_code");
String qty = whereJson.getString("qty");
WQLObject vqTab = WQLObject.getWQLObject("PDM_BI_vehicleQty");
VehicleDto byCode = SpringContextHolder.getBean(VehicleService.class).findByCode(vehicle_code);
// 插入记录
JSONObject json = new JSONObject();
json.put("vehicleqty_id", IdUtil.getSnowflake(1, 1).nextId());
json.put("vehicle_id", byCode.getVehicle_id());
json.put("vehicle_code", vehicle_code);
json.put("qty", qty);
json.put("create_id", SecurityUtils.getCurrentUserId());
json.put("create_name", SecurityUtils.getCurrentNickName());
json.put("create_time", DateUtil.now());
vqTab.insert(json);
// 返回成功
JSONObject result = new JSONObject();
result.put("srb", "");
result.put("code", "1");
result.put("desc", "操作成功");
return result;
}
}

View File

@@ -1,5 +1,6 @@
package org.nl.wms.pda.sendmaterial.service.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
@@ -9,8 +10,6 @@ import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.wms.ext.acs.service.AcsToWmsService;
import org.nl.wms.pda.sendmaterial.service.SendMaterialService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -50,21 +49,21 @@ public class SendMaterialServiceImpl implements SendMaterialService {
String region_id = whereJson.getString("region_id");
JSONObject jsonObject = WQLObject.getWQLObject("sch_base_region").query("region_id ='" + region_id + "'").uniqueResult(0);
String region_code = jsonObject.getString("region_code");
if (StrUtil.equals(region_code, "GJQY01")) param.put("type","2");
if (StrUtil.equals(region_code, "HKQY01")) param.put("type","8");
if (StrUtil.equals(region_code, "GJQY01")) param.put("type", "2");
if (StrUtil.equals(region_code, "HKQY01")) param.put("type", "8");
param.put("point_code",whereJson.getString("point_code"));
param.put("qty",whereJson.getString("qty"));
param.put("point_code", whereJson.getString("point_code"));
param.put("material_num", whereJson.getString("qty"));
// 2、调用接口
JSONObject json = acsToWmsService.apply(param);
if (StrUtil.equals(json.getString("status"), "200")) {
if (ObjectUtil.isEmpty(json) || StrUtil.equals(json.getString("status"), "200")) {
result.put("result", "");
result.put("code", "1");
result.put("desc", "操作成功");
} else {
result.put("result", "");
result.put("code", "0");
result.put("desc", "操作失败:"+json.getString("message"));
result.put("desc", "操作失败:" + json.getString("message"));
}
return result;
}

View File

@@ -47,8 +47,7 @@
FROM
sch_base_region
WHERE
is_used = '1'
AND region_code in ('HKQY01','GJQY01')
region_code in ('HKQY01','GJQY01')
ENDSELECT
ENDQUERY
@@ -65,8 +64,7 @@
WHERE
is_used = '1'
AND is_delete = '0'
AND is_host = '0'
AND device_point_type = '2'
AND point_type = '3'
OPTION 输入.region_id <> ""
region_id = 输入.region_id
@@ -74,4 +72,4 @@
ENDSELECT
ENDQUERY
ENDIF
ENDIF

View File

@@ -47,8 +47,7 @@
FROM
sch_base_region
WHERE
is_used = '1'
AND region_code in ('SSX01','YQQY01')
region_code in ('SSX01','YQQY01')
ENDSELECT
ENDQUERY
@@ -65,8 +64,7 @@
WHERE
is_used = '1'
AND is_delete = '0'
AND is_host = '0'
AND device_point_type = '6'
AND point_type = '6'
OPTION 输入.region_id <> ""
region_id = 输入.region_id
@@ -87,8 +85,7 @@
WHERE
is_used = '1'
AND is_delete = '0'
AND is_host = '0'
AND device_point_type = '4'
AND point_type = '4'
OPTION 输入.region_id <> ""
region_id = 输入.region_id
@@ -96,4 +93,4 @@
ENDSELECT
ENDQUERY
ENDIF
ENDIF

View File

@@ -1,7 +1,6 @@
package org.nl.wms.sch.tasks.callEmpty;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
@@ -20,6 +19,7 @@ import org.nl.wms.sch.manage.AbstractAcsTask;
import org.nl.wms.sch.manage.TaskStatusEnum;
import org.nl.wms.sch.tasks.AcsTaskDto;
import org.nl.wms.sch.tasks.RegionTypeEnum;
import org.nl.wms.util.IdUtil;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -142,7 +142,7 @@ public class GjxCallEmpVehicleTask extends AbstractAcsTask {
pointTab.update(jsonStart);
// 更新终点(叠盘架状态)
jsonEnd.put("vehicle_qty", NumberUtil.add(jsonEnd.getString("vehicle_qty"),jsonTask.getString("vehicle_qty")));
jsonEnd.put("vehicle_qty", NumberUtil.add(jsonEnd.getString("vehicle_qty"), jsonTask.getString("vehicle_qty")));
jsonEnd.put("lock_type", "1");
jsonEnd.put("point_status", "2");
jsonEnd.put("vehicle_type", jsonTask.getString("vehicle_type"));
@@ -156,9 +156,9 @@ public class GjxCallEmpVehicleTask extends AbstractAcsTask {
} else {
// 终点在供给线线: 更新起点(叠盘架)数量
JSONObject jsonStart = pointTab.query("point_code = '" + point_code1 + "'").uniqueResult(0);
jsonStart.put("vehicle_qty",NumberUtil.sub(jsonStart.getString("vehicle_qty"),"1"));
jsonStart.put("vehicle_qty", NumberUtil.sub(jsonStart.getString("vehicle_qty"), "1"));
jsonStart.put("lock_type", "1");
if (StrUtil.equals(jsonStart.getString("vehicle_qty"),"0")) {
if (StrUtil.equals(jsonStart.getString("vehicle_qty"), "0")) {
jsonStart.put("point_status", "1");
jsonStart.put("vehicle_type", "");
}
@@ -213,6 +213,8 @@ public class GjxCallEmpVehicleTask extends AbstractAcsTask {
.task_id(org.nl.wms.util.IdUtil.getLongId())
.task_code(CodeUtil.getNewCode("TASK_CODE"))
.task_type("")
.acs_task_type("2")
.task_name("暂存位->叠盘架空载具")
.task_status(TaskStatusEnum.START_AND_POINT.getCode())
.point_code1(jsonZcKtp.getString("point_code"))
.point_code2(jsonDpjStart2.getString("point_code"))
@@ -242,12 +244,14 @@ public class GjxCallEmpVehicleTask extends AbstractAcsTask {
if (ObjectUtil.isEmpty(jsonStartPoint)) continue;
// 判断找到的空载具点位是否是等待点
if (StrUtil.equals(jsonEmpWait.getString("point_code"),jsonStartPoint.getString("point_code"))) {
if (StrUtil.equals(jsonEmpWait.getString("point_code"), jsonStartPoint.getString("point_code"))) {
// 创建 养生A区空载具等待点 --> 叠盘架
SchTaskDto dto = SchTaskDto.builder()
.task_id(org.nl.wms.util.IdUtil.getLongId())
.task_id(IdUtil.getLongId())
.task_code(CodeUtil.getNewCode("TASK_CODE"))
.task_type("")
.acs_task_type("2")
.task_name("养生A区-> 叠盘架空载具")
.task_status(TaskStatusEnum.START_AND_POINT.getCode())
.point_code1(jsonStartPoint.getString("point_code"))
.point_code2(jsonDpjStart2.getString("point_code"))
@@ -271,6 +275,8 @@ public class GjxCallEmpVehicleTask extends AbstractAcsTask {
.task_id(org.nl.wms.util.IdUtil.getLongId())
.task_code(CodeUtil.getNewCode("TASK_CODE"))
.task_type("")
.acs_task_type("3")
.task_name("养生A区>叠盘架空载具")
.task_status(TaskStatusEnum.START_AND_POINT.getCode())
.point_code1(jsonStartPoint.getString("point_code"))
.point_code2(jsonDpjStart2.getString("point_code"))
@@ -287,7 +293,7 @@ public class GjxCallEmpVehicleTask extends AbstractAcsTask {
jsonStartPoint.put("lock_type", "2");
pointTab.update(jsonStartPoint);
// 锁等待点
jsonEmpWait.put("lock_type","2");
jsonEmpWait.put("lock_type", "2");
pointTab.update(jsonEmpWait);
} else {
continue;
@@ -323,20 +329,20 @@ public class GjxCallEmpVehicleTask extends AbstractAcsTask {
SchTaskDto dto = SchTaskDto.builder().task_id(org.nl.wms.util.IdUtil.getLongId())
.task_code(CodeUtil.getNewCode("TASK_CODE"))
.task_type("")
.task_name("共挤线叫空载具")
.task_status(TaskStatusEnum.SURE_END.getCode())
.point_code2(point_code2)
.vehicle_code(form.getString("vehicle_code"))
.vehicle_type(workOrderObj.getString("vehicle_type"))
.vehicle_qty(form.getIntValue("qty"))
.task_group_id(org.nl.wms.util.IdUtil.getLongId())
.task_group_id(IdUtil.getLongId())
.handle_class(THIS_CLASS)
.create_time(DateUtil.now())
.build();
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
taskTab.insert(json);
this.findStartPoint();
// this.immediateNotifyAcs();
this.immediateNotifyAcs();
return String.valueOf(dto.getTask_id());
}
@@ -357,16 +363,24 @@ public class GjxCallEmpVehicleTask extends AbstractAcsTask {
/*
* 下发给ACS时需要特殊处理
*/
JSONArray arr = WQLObject.getWQLObject("SCH_BASE_Task").query("handle_class = '"+THIS_CLASS+"' and task_status = '"+TaskStatusEnum.START_AND_POINT.getCode()+"' and is_delete ='0'").getResultJSONArray(0);
JSONArray arr = WQLObject.getWQLObject("SCH_BASE_Task").query("handle_class = '" + THIS_CLASS + "' and task_status = '" + TaskStatusEnum.START_AND_POINT.getCode() + "' and is_delete ='0'").getResultJSONArray(0);
ArrayList<AcsTaskDto> resultList = new ArrayList<>();
for (int i = 0; i < arr.size(); i++) {
JSONObject json = arr.getJSONObject(i);
String point_code1 = json.getString("point_code1");
//判断起点是否属于养生A区
if (point_code1.startsWith("2")) {
//养生A区发给ACS需要新的点位(2101-03-1----->21011-03-1)
point_code1 = point_code1.substring(0, 4) + "1" + point_code1.substring(4, 9);
}
AcsTaskDto dto = AcsTaskDto.builder()
.task_id(json.getString("task_id"))
.task_code(json.getString("task_code"))
.task_type(json.getString("acs_task_type"))
.start_device_code(json.getString("point_code1"))
.start_device_code(point_code1)
.next_device_code(json.getString("point_code3"))
.vehicle_code(json.getString("vehicle_code"))
.vehicle_type(json.getString("vehicle_type"))

View File

@@ -1,7 +1,6 @@
package org.nl.wms.sch.tasks.callEmpty;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
@@ -15,20 +14,14 @@ import org.nl.modules.common.utils.SecurityUtils;
import org.nl.modules.system.util.CodeUtil;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.SpringContextHolder;
import org.nl.wms.pdm.service.DeviceService;
import org.nl.wms.pdm.service.dto.DeviceDto;
import org.nl.wms.sch.SchTaskDto;
import org.nl.wms.sch.manage.AbstractAcsTask;
import org.nl.wms.sch.manage.TaskStatusEnum;
import org.nl.wms.sch.service.PointService;
import org.nl.wms.sch.service.dto.PointDto;
import org.nl.wms.sch.tasks.AcsTaskDto;
import org.nl.wms.sch.tasks.RegionTypeEnum;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
@@ -225,6 +218,8 @@ public class YqxCallEmpVehicleTask extends AbstractAcsTask {
.task_id(org.nl.wms.util.IdUtil.getLongId())
.task_code(CodeUtil.getNewCode("TASK_CODE"))
.task_type("")
.acs_task_type("2")
.task_name("暂存位>叠盘架空载具")
.task_status(TaskStatusEnum.START_AND_POINT.getCode())
.point_code1(jsonZcKtp.getString("point_code"))
.point_code2(jsonDpjStart2.getString("point_code"))
@@ -260,6 +255,8 @@ public class YqxCallEmpVehicleTask extends AbstractAcsTask {
.task_id(org.nl.wms.util.IdUtil.getLongId())
.task_code(CodeUtil.getNewCode("TASK_CODE"))
.task_type("")
.acs_task_type("2")
.task_name("养生A区>叠盘架空载具")
.task_status(TaskStatusEnum.START_AND_POINT.getCode())
.point_code1(jsonStartPoint.getString("point_code"))
.point_code2(jsonDpjStart2.getString("point_code"))
@@ -283,6 +280,8 @@ public class YqxCallEmpVehicleTask extends AbstractAcsTask {
.task_id(org.nl.wms.util.IdUtil.getLongId())
.task_code(CodeUtil.getNewCode("TASK_CODE"))
.task_type("")
.acs_task_type("3")
.task_name("养生A区>叠盘架空载具")
.task_status(TaskStatusEnum.START_AND_POINT.getCode())
.point_code1(jsonStartPoint.getString("point_code"))
.point_code2(jsonDpjStart2.getString("point_code"))
@@ -335,6 +334,7 @@ public class YqxCallEmpVehicleTask extends AbstractAcsTask {
SchTaskDto dto = SchTaskDto.builder().task_id(org.nl.wms.util.IdUtil.getLongId())
.task_code(CodeUtil.getNewCode("TASK_CODE"))
.task_type("")
.task_name("油漆线叫空载具")
.task_status(TaskStatusEnum.SURE_END.getCode())
.point_code2(point_code2)
.vehicle_code(form.getString("vehicle_code"))
@@ -347,8 +347,7 @@ public class YqxCallEmpVehicleTask extends AbstractAcsTask {
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
taskTab.insert(json);
this.findStartPoint();
// this.immediateNotifyAcs();
this.immediateNotifyAcs();
return String.valueOf(dto.getTask_id());
}
@@ -375,11 +374,18 @@ public class YqxCallEmpVehicleTask extends AbstractAcsTask {
ArrayList<AcsTaskDto> resultList = new ArrayList<>();
for (int i = 0; i < arr.size(); i++) {
JSONObject json = arr.getJSONObject(i);
String point_code1 = json.getString("point_code1");
//判断起点是否属于养生A区
if (point_code1.startsWith("2")) {
//养生A区发给ACS需要新的点位(2101-03-1----->21011-03-1)
point_code1 = point_code1.substring(0, 4) + "1" + point_code1.substring(4, 9);
}
AcsTaskDto dto = AcsTaskDto.builder()
.task_id(json.getString("task_id"))
.task_code(json.getString("task_code"))
.task_type(json.getString("acs_task_type"))
.start_device_code(json.getString("point_code1"))
.start_device_code(point_code1)
.next_device_code(json.getString("point_code3"))
.vehicle_code(json.getString("vehicle_code"))
.vehicle_type(json.getString("vehicle_type"))

View File

@@ -195,11 +195,15 @@ public class YqxCallMaterialTask extends AbstractAcsTask {
ArrayList<AcsTaskDto> acsTaskArr = new ArrayList<>();
for (int i = 0; i < arr.size(); i++) {
JSONObject json = arr.getJSONObject(i);
//养生A区发给ACS需要新的点位(2101-03-1----->21011-03-1)
String point_code =json.getString("point_code1");
String newPoint = point_code.substring(0, 4) + "1" + point_code.substring(4, 9);
AcsTaskDto dto = AcsTaskDto.builder()
.task_id(json.getString("task_id"))
.task_code(json.getString("task_code"))
.task_type(json.getString("acs_task_type"))
.start_device_code(json.getString("point_code1"))
.start_device_code(newPoint)
.next_device_code(json.getString("point_code3"))
.vehicle_code(json.getString("vehicle_code"))
.vehicle_type(json.getString("vehicle_type"))
@@ -231,6 +235,8 @@ public class YqxCallMaterialTask extends AbstractAcsTask {
.task_id(IdUtil.getLongId())
.task_code(CodeUtil.getNewCode("TASK_CODE"))
.task_type("task_type")
.task_name("油漆线叫料")
.material_qty(qty)
.task_status(TaskStatusEnum.SURE_END.getCode())
.point_code2(point_code2)
.vehicle_code(vehicle_code)
@@ -287,6 +293,11 @@ public class YqxCallMaterialTask extends AbstractAcsTask {
taskObj.put("update_time", DateUtil.now());
taskTab.update(taskObj);
return taskObj.getString("point_code3");
//养生A区发给ACS需要新的点位(2101-03-1----->21011-03-1)
String point_code =taskObj.getString("point_code3");
String newPoint = point_code.substring(0, 4) + "1" + point_code.substring(4, 9);
return newPoint;
}
}

View File

@@ -129,6 +129,7 @@ public class HtSendEmpVehicleTask extends AbstractAcsTask {
SchTaskDto dto = SchTaskDto.builder().task_id(org.nl.wms.util.IdUtil.getLongId())
.task_code(CodeUtil.getNewCode("TASK_CODE"))
.task_type("")
.task_name("电梯送空载具")
.task_status(TaskStatusEnum.SURE_START.getCode())
.point_code1(point_code1)
.vehicle_code(form.getString("vehicle_code"))
@@ -392,7 +393,11 @@ public class HtSendEmpVehicleTask extends AbstractAcsTask {
jsonEndPoint.put("lock_type", "2");
pointTab.update(jsonEndPoint);
}
//判断点位是否属于养生A区
if (point_code.startsWith("2")) {
//养生A区发给ACS需要新的点位(2101-03-1----->21011-03-1)
point_code = point_code.substring(0, 4) + "1" + point_code.substring(4, 9);
}
return point_code;
}
@@ -406,12 +411,21 @@ public class HtSendEmpVehicleTask extends AbstractAcsTask {
ArrayList<AcsTaskDto> resultList = new ArrayList<>();
for (int i = 0; i < arr.size(); i++) {
JSONObject json = arr.getJSONObject(i);
String point_code3=json.getString("point_code3");
//判断终点是否属于养生A区
if (point_code3.startsWith("2")) {
//养生A区发给ACS需要新的点位(2101-03-1----->21011-03-1)
point_code3 = point_code3.substring(0, 4) + "1" + point_code3.substring(4, 9);
}
AcsTaskDto dto = AcsTaskDto.builder()
.task_id(json.getString("task_id"))
.task_code(json.getString("task_code"))
.task_type(json.getString("acs_task_type"))
.start_device_code(json.getString("point_code1"))
.next_device_code(json.getString("point_code3"))
.next_device_code(point_code3)
.vehicle_code(json.getString("vehicle_code"))
.vehicle_type(json.getString("vehicle_type"))
.priority(json.getString("priority"))

View File

@@ -1,7 +1,6 @@
package org.nl.wms.sch.tasks.sendEmpty;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
@@ -11,9 +10,7 @@ import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.common.utils.SecurityUtils;
import org.nl.modules.system.util.CodeUtil;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.wms.sch.SchTaskDto;
import org.nl.wms.sch.manage.AbstractAcsTask;
@@ -197,7 +194,6 @@ public class YqxSendEmpVehicleTask extends AbstractAcsTask {
}
@Override
public void cancel(String task_id) {
@@ -349,7 +345,11 @@ public class YqxSendEmpVehicleTask extends AbstractAcsTask {
jsonEndPoint.put("lock_type", "2");
pointTab.update(jsonEndPoint);
}
//判断点位是否属于养生A区
if (point_code.startsWith("2")) {
//养生A区发给ACS需要新的点位(2101-03-1----->21011-03-1)
point_code = point_code.substring(0, 4) + "1" + point_code.substring(4, 9);
}
return point_code;
}
@@ -358,17 +358,25 @@ public class YqxSendEmpVehicleTask extends AbstractAcsTask {
/*
* 下发给ACS时需要特殊处理
*/
JSONArray arr = WQLObject.getWQLObject("SCH_BASE_Task").query("handle_class = '"+THIS_CLASS+"' and task_status = '"+TaskStatusEnum.START_AND_POINT.getCode()+"' and is_delete ='0'").getResultJSONArray(0);
JSONArray arr = WQLObject.getWQLObject("SCH_BASE_Task").query("handle_class = '" + THIS_CLASS + "' and task_status = '" + TaskStatusEnum.START_AND_POINT.getCode() + "' and is_delete ='0'").getResultJSONArray(0);
ArrayList<AcsTaskDto> resultList = new ArrayList<>();
for (int i = 0; i < arr.size(); i++) {
JSONObject json = arr.getJSONObject(i);
String point_code3 = json.getString("point_code3");
//判断终点是否属于养生A区
if (point_code3.startsWith("2")) {
//养生A区发给ACS需要新的点位(2101-03-1----->21011-03-1)
point_code3 = point_code3.substring(0, 4) + "1" + point_code3.substring(4, 9);
}
AcsTaskDto dto = AcsTaskDto.builder()
.task_id(json.getString("task_id"))
.task_code(json.getString("task_code"))
.task_type(json.getString("task_type"))
.start_device_code(json.getString("point_code1"))
.next_device_code(json.getString("point_code3"))
.next_device_code(point_code3)
.vehicle_code(json.getString("vehicle_code"))
.vehicle_type(json.getString("vehicle_type"))
.priority(json.getString("priority"))

View File

@@ -217,12 +217,16 @@ public class GjxSendMaterialTask extends AbstractAcsTask {
ArrayList<AcsTaskDto> acsTaskArr = new ArrayList<>();
for (int i = 0; i < arr.size(); i++) {
JSONObject json = arr.getJSONObject(i);
//养生A区发给ACS需要新的点位(2101-03-1----->21011-03-1)
String point_code = json.getString("point_code3");
String newPoint = point_code.substring(0, 4) + "1" + point_code.substring(4, 9);
AcsTaskDto dto = AcsTaskDto.builder()
.task_id(json.getString("task_id"))
.task_code(json.getString("task_code"))
.task_type(json.getString("acs_task_type"))
.start_device_code(json.getString("point_code1"))
.next_device_code(json.getString("point_code3"))
.next_device_code(newPoint)
.vehicle_code(json.getString("vehicle_code"))
.vehicle_type(json.getString("vehicle_type"))
.priority(json.getString("priority"))
@@ -244,11 +248,20 @@ public class GjxSendMaterialTask extends AbstractAcsTask {
WQLObject workOrderTab = WQLObject.getWQLObject("PDM_BD_WorkOrder");
//点位基础表【SCH_BASE_Point】
WQLObject pointTab = WQLObject.getWQLObject("SCH_BASE_Point");
//任务表【SCH_BASE_Task】
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task");
//判断当前点是否有未完成的任务
JSONObject taskObj = taskTab.query("is_delete='0' and point_code1 = '" + point_code1 + "' and task_status <> '" + TaskStatusEnum.FINISHED.getCode() + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(taskObj)) throw new BadRequestException("当前点位" + point_code1 + "存在未完成的任务");
String device_code = pointTab.query("point_code = '" + point_code1 + "'").uniqueResult(0).getString("device_code");
JSONObject workOrderObj = workOrderTab.query("device_code = '" + device_code + "' and order_status = '3' and is_delete ='0'").uniqueResult(0);
if (ObjectUtil.isEmpty(workOrderObj)) throw new BadRequestException("该设备当前未生产或者已删除");
SchTaskDto dto = SchTaskDto.builder()
.task_id(IdUtil.getLongId())
.task_code(CodeUtil.getNewCode("TASK_CODE"))
@@ -257,6 +270,7 @@ public class GjxSendMaterialTask extends AbstractAcsTask {
.task_status(TaskStatusEnum.SURE_START.getCode())
.point_code1(point_code1)
.vehicle_code(vehicle_code)
.material_qty(qty)
.material_info_id(workOrderObj.getLong("workorder_id"))
.material_id(workOrderObj.getLong("material_id"))
.vehicle_type(vehicle_type)
@@ -264,8 +278,7 @@ public class GjxSendMaterialTask extends AbstractAcsTask {
.create_time(DateUtil.now())
.request_param(whereJson.toJSONString())
.build();
//任务表【SCH_BASE_Task】
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task");
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
taskTab.insert(json);
@@ -315,9 +328,13 @@ public class GjxSendMaterialTask extends AbstractAcsTask {
taskObj.put("update_time", DateUtil.now());
taskTab.update(taskObj);
//养生A区发给ACS需要新的点位(2101-03-1----->21011-03-1)
String point_code = jsonOnePoint.getString("point_code");
String newPoint = point_code.substring(0, 4) + "1" + point_code.substring(4, 9);
// 点位上锁
jsonOnePoint.put("lock_type", "2");
pointTab.update(jsonOnePoint);
return jsonOnePoint.getString("point_code");
return newPoint;
}
}

View File

@@ -207,6 +207,13 @@ public class HkxSendMaterialTask extends AbstractAcsTask {
String vehicle_code = whereJson.getString("vehicle_code");
String qty = whereJson.getString("qty");
//任务表【SCH_BASE_Task】
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task");
//判断当前点是否有未完成的任务
JSONObject taskObj = taskTab.query("is_delete='0' and point_code1 = '" + point_code1 + "' and task_status <> '" + TaskStatusEnum.FINISHED.getCode() + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(taskObj)) throw new BadRequestException("当前点位" + point_code1 + "存在未完成的任务");
//生产工单表【PDM_BD_WorkOrder】
WQLObject workOrderTab = WQLObject.getWQLObject("PDM_BD_WorkOrder");
//点位基础表【SCH_BASE_Point】
@@ -221,6 +228,7 @@ public class HkxSendMaterialTask extends AbstractAcsTask {
.task_code(CodeUtil.getNewCode("TASK_CODE"))
.task_type("task_type")
.task_name("豪凯线满料")
.material_qty(qty)
.task_status(TaskStatusEnum.SURE_START.getCode())
.point_code1(point_code1)
.vehicle_code(vehicle_code)
@@ -231,8 +239,6 @@ public class HkxSendMaterialTask extends AbstractAcsTask {
.create_time(DateUtil.now())
.request_param(whereJson.toJSONString())
.build();
//任务表【SCH_BASE_Task】
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task");
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
taskTab.insert(json);

View File

@@ -144,6 +144,14 @@ public class YqxSendMaterialTask extends AbstractAcsTask {
WQLObject workOrderTab = WQLObject.getWQLObject("PDM_BD_WorkOrder");
//点位基础表【SCH_BASE_Point】
WQLObject pointTab = WQLObject.getWQLObject("SCH_BASE_Point");
//任务表【SCH_BASE_Task】
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task");
//判断当前点是否有未完成的任务
JSONObject taskObj = taskTab.query("is_delete='0' and point_code1 = '" + point_code1 + "' and task_status <> '" + TaskStatusEnum.FINISHED.getCode() + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(taskObj)) throw new BadRequestException("当前点位" + point_code1 + "存在未完成的任务");
String device_code = pointTab.query("point_code = '" + point_code1 + "'").uniqueResult(0).getString("device_code");
JSONObject workOrderObj = workOrderTab.query("device_code = '" + device_code + "' and order_status = '3' and is_delete ='0'").uniqueResult(0);
@@ -166,7 +174,6 @@ public class YqxSendMaterialTask extends AbstractAcsTask {
.request_param(whereJson.toJSONString())
.build();
//任务表【SCH_BASE_Task】
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task");
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
taskTab.insert(json);

View File

@@ -116,6 +116,7 @@
<el-table-column v-if="false" prop="task_id" label="任务标识" />
<el-table-column prop="task_code" label="任务编码" min-width="100" show-overflow-tooltip />
<el-table-column v-if="false" prop="task_type" label="任务类型" />
<el-table-column prop="acs_task_type" label="acs任务类型" min-width="120" show-overflow-tooltip/>
<el-table-column prop="task_ame" label="任务描述" min-width="120" show-overflow-tooltip />
<el-table-column v-if="false" prop="task_type_name" label="任务类型" min-width="120" show-overflow-tooltip />
<el-table-column v-if="false" prop="task_status" label="任务状态" />