明天生产
This commit is contained in:
@@ -41,6 +41,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author zhouz
|
||||
@@ -211,6 +212,12 @@ public class MaterialbaseServiceImpl implements MaterialbaseService {
|
||||
JSONArray data = response_body.getJSONArray("data");
|
||||
// WQLObject unit_table = WQLObject.getWQLObject("md_pb_measureunit");
|
||||
WQLObject material_table = WQLObject.getWQLObject("md_me_materialbase");
|
||||
List<Object> material_codes = material_table
|
||||
.query()
|
||||
.getResultJSONArray(0)
|
||||
.stream()
|
||||
.map(o -> ((JSONObject) o).get("material_code"))
|
||||
.collect(Collectors.toList());
|
||||
Long user_id = SecurityUtils.getCurrentUserId();
|
||||
String nick_name = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
@@ -242,10 +249,7 @@ public class MaterialbaseServiceImpl implements MaterialbaseService {
|
||||
|
||||
// 查询是否存在这个物料
|
||||
String material_code = material.getString("material_code");
|
||||
JSONObject existMaterial = material_table
|
||||
.query("material_code = '" + material_code + "'")
|
||||
.uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(existMaterial)) {
|
||||
if (material_codes.contains(material_code)) {
|
||||
// 如果不存在则添加
|
||||
material.put("material_id", IdUtil.getSnowflake(1L, 1L));
|
||||
material.put("is_used", "1");
|
||||
@@ -253,14 +257,15 @@ public class MaterialbaseServiceImpl implements MaterialbaseService {
|
||||
material.put("create_name", nick_name);
|
||||
material.put("create_time", now);
|
||||
material_table.insert(material);
|
||||
material_codes.add(material_code);
|
||||
} else {
|
||||
// 如果存在则修改
|
||||
existMaterial.put("material_name", material.getString("material_name"));
|
||||
material.put("material_name", material.getString("material_name"));
|
||||
// existMaterial.put("unit_code", unit_code);
|
||||
existMaterial.put("update_optid", user_id);
|
||||
existMaterial.put("update_optname", nick_name);
|
||||
existMaterial.put("update_time", now);
|
||||
material_table.update(existMaterial);
|
||||
material.put("update_optid", user_id);
|
||||
material.put("update_optname", nick_name);
|
||||
material.put("update_time", now);
|
||||
material_table.update(material, "material_code = '" + material_code + "'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,5 +58,7 @@ public interface WmsToAcsService {
|
||||
*/
|
||||
JSONObject getPointStatus(JSONArray whereJson);
|
||||
|
||||
JSONObject queryGT04Status();
|
||||
JSONObject queryGT01Status();
|
||||
|
||||
JSONObject queryGT03Status();
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
@@ -256,7 +257,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
String point_code = whereJson.getString("device_code");
|
||||
String create_mode = whereJson.getString("create_mode");
|
||||
String is_auto_issue = whereJson.getString("is_auto_issue");
|
||||
StringBuilder barcode = new StringBuilder(whereJson.getString("barcode"));
|
||||
StringBuilder barcode = new StringBuilder(StrUtil.isBlank(whereJson.getString("barcode")) ? "" : whereJson.getString("barcode"));
|
||||
|
||||
if (ObjectUtil.isEmpty(type)) throw new BadRequestException("类型不能为空");
|
||||
if (ObjectUtil.isEmpty(point_code)) throw new BadRequestException("点位不能为空");
|
||||
@@ -314,6 +315,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
param.put("point_code1", point_code); // 叫料点
|
||||
param.put("create_mode", create_mode);
|
||||
param.put("is_auto_issue", is_auto_issue);
|
||||
param.put("to_gt01", whereJson.getBooleanValue("to_gt01"));
|
||||
// 创建任务
|
||||
KzdjwSendEmpVehicleTask taskBean = SpringContextHolder.getBean(KzdjwSendEmpVehicleTask.class);
|
||||
taskBean.createTask(param);
|
||||
@@ -375,7 +377,10 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
}
|
||||
structivtDto.setUpdate_time(DateUtil.now());
|
||||
structivtDto.setUpdate_optname("acs");
|
||||
structivtService.update(structivtDto);
|
||||
// structivtService.update(structivtDto);
|
||||
WQLObject
|
||||
.getWQLObject("st_ivt_structivt")
|
||||
.update(JSONObject.parseObject(JSONObject.toJSONString(structivtDto, SerializerFeature.WriteMapNullValue)));
|
||||
//同时修改该工位的点位状态
|
||||
JSONObject pointJson = wo.query("point_code = '" + device_code + "'").uniqueResult(0);
|
||||
pointJson.put("point_status", point_status);
|
||||
|
||||
@@ -61,8 +61,14 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject queryGT04Status() {
|
||||
String api = "api/wms/queryGT04Status";
|
||||
public JSONObject queryGT01Status() {
|
||||
String api = "api/wms/queryGT01Status";
|
||||
return AcsUtil.notifyAcs(api, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject queryGT03Status() {
|
||||
String api = "api/wms/queryGT03Status";
|
||||
return AcsUtil.notifyAcs(api, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,10 +5,12 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
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.ext.acs.service.AcsToWmsService;
|
||||
import org.nl.wms.ext.acs.service.WmsToAcsService;
|
||||
import org.nl.wms.pda.handlingTask.service.HandlingTaskService;
|
||||
import org.nl.wms.sch.tasks.RegionTypeEnum;
|
||||
|
||||
@@ -24,6 +26,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
public class HandlingTaskServiceImpl implements HandlingTaskService {
|
||||
|
||||
private final AcsToWmsService acsToWmsService;
|
||||
private final WmsToAcsService wmsToAcsService;
|
||||
|
||||
@Override
|
||||
public JSONObject queryPoint() {
|
||||
@@ -63,8 +66,7 @@ public class HandlingTaskServiceImpl implements HandlingTaskService {
|
||||
result.put("desc", "操作失败,不能搬运此任务!");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
else if (StrUtil.equals(start_region_code, RegionTypeEnum.MLZZCQ.getCode())) {
|
||||
} else if (StrUtil.equals(start_region_code, RegionTypeEnum.MLZZCQ.getCode())) {
|
||||
if (!StrUtil.equals(next_region_code, RegionTypeEnum.YLJQ.getCode())
|
||||
&& !StrUtil.equals(next_region_code, RegionTypeEnum.GT4.getCode())
|
||||
) {
|
||||
@@ -72,8 +74,7 @@ public class HandlingTaskServiceImpl implements HandlingTaskService {
|
||||
result.put("desc", "操作失败,不能搬运此任务!");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
else if (StrUtil.equals(start_region_code, RegionTypeEnum.GT4.getCode())) {
|
||||
} else if (StrUtil.equals(start_region_code, RegionTypeEnum.GT4.getCode())) {
|
||||
if (!StrUtil.equals(next_region_code, RegionTypeEnum.HNJQ.getCode())
|
||||
&& !StrUtil.equals(next_region_code, RegionTypeEnum.KLZHCQ.getCode())
|
||||
) {
|
||||
@@ -81,8 +82,7 @@ public class HandlingTaskServiceImpl implements HandlingTaskService {
|
||||
result.put("desc", "操作失败,不能搬运此任务!");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
else if (StrUtil.equals(start_region_code, RegionTypeEnum.HNJQ.getCode())) {
|
||||
} else if (StrUtil.equals(start_region_code, RegionTypeEnum.HNJQ.getCode())) {
|
||||
if (!StrUtil.equals(next_region_code, RegionTypeEnum.GT1.getCode())
|
||||
&& !StrUtil.equals(next_region_code, RegionTypeEnum.KLZHCQ.getCode())
|
||||
) {
|
||||
@@ -90,12 +90,28 @@ public class HandlingTaskServiceImpl implements HandlingTaskService {
|
||||
result.put("desc", "操作失败,不能搬运此任务!");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
result.put("code", "0");
|
||||
result.put("desc", "操作失败,不能搬运此任务!");
|
||||
return result;
|
||||
}
|
||||
if (RegionTypeEnum.GT1.getCode().equals(next_region_code)) {
|
||||
JSONObject gt01Status = wmsToAcsService.queryGT01Status();
|
||||
if (!gt01Status.getBooleanValue("GT01")) {
|
||||
result.put("code", "0");
|
||||
result.put("desc", "当前一号接驳滚筒区不允许放料盅!");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
if (RegionTypeEnum.MLZZCQ.getCode().equals(start_region_code)
|
||||
|| RegionTypeEnum.MLZZCQ.getCode().equals(next_region_code)) {
|
||||
JSONObject gt03Status = wmsToAcsService.queryGT03Status();
|
||||
if (!gt03Status.getBooleanValue("GT03")) {
|
||||
result.put("code", "0");
|
||||
result.put("desc", "满料盅缓存区正在滚动!");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
HandlingTask taskBean = SpringContextHolder.getBean(HandlingTask.class);
|
||||
taskBean.createTask(whereJson);
|
||||
result.put("code", "1");
|
||||
|
||||
@@ -46,6 +46,8 @@
|
||||
region_name
|
||||
FROM
|
||||
sch_base_region
|
||||
WHERE
|
||||
region_code IN ('KLZHCQ', 'MLZHCQ', 'HNJQ', 'GT1', 'GT4')
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
@@ -55,11 +55,11 @@ public class InStructServiceImpl implements InStructService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public JSONObject confirm(JSONObject param) {
|
||||
String vehicle_code = param.getString("carrier_code");
|
||||
if (StrUtil.isNotBlank(vehicle_code)) {
|
||||
if (StrUtil.isBlank(vehicle_code)) {
|
||||
throw new BadRequestException("载具号不能为空");
|
||||
}
|
||||
VehicleDto vehicle = vehicleService.findByCode(vehicle_code);
|
||||
if (ObjectUtil.isNotEmpty(vehicle)) {
|
||||
if (ObjectUtil.isEmpty(vehicle)) {
|
||||
throw new BadRequestException("载具号不存在");
|
||||
}
|
||||
JSONObject map = new JSONObject();
|
||||
|
||||
@@ -27,11 +27,11 @@ public class OutStructServiceImpl implements OutStructService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public JSONObject confirm(JSONObject param) {
|
||||
String vehicle_code = param.getString("carrier_code");
|
||||
if (StrUtil.isNotBlank(vehicle_code)) {
|
||||
if (StrUtil.isBlank(vehicle_code)) {
|
||||
throw new BadRequestException("载具号不能为空");
|
||||
}
|
||||
VehicleDto vehicle = vehicleService.findByCode(vehicle_code);
|
||||
if (ObjectUtil.isNotEmpty(vehicle)) {
|
||||
if (ObjectUtil.isEmpty(vehicle)) {
|
||||
throw new BadRequestException("载具号不存在");
|
||||
}
|
||||
WQLObject wo = WQLObject.getWQLObject("ST_IVT_StructIvt");
|
||||
|
||||
@@ -88,7 +88,7 @@ public class KlzhcwUtil {
|
||||
flag = this.equles26(ll, param);
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
return true;
|
||||
}
|
||||
|
||||
//判断是否有手持出库确认的 如果有就移除靠近滚筒1区的一个缓存
|
||||
|
||||
@@ -90,7 +90,7 @@ public class WorkorderServiceImpl implements WorkordeService {
|
||||
}
|
||||
// 工序名称
|
||||
map.put("workorder_procedure", whereJson.get("workorder_procedure"));
|
||||
JSONObject jsonObject = WQL.getWO("MPS_PRODUCEDURE001").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "ShiftOrder.update_time desc");
|
||||
JSONObject jsonObject = WQL.getWO("MPS_PRODUCEDURE001").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "ShiftOrder.create_time desc");
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
@@ -425,31 +425,29 @@ public class WorkorderServiceImpl implements WorkordeService {
|
||||
map.put("ext_order_id", workorder_id);
|
||||
map.put("type", "3");
|
||||
array.add(map);
|
||||
Map<String, Object> resp = wmsToAcsService.orderStatusUpdate(array);
|
||||
if (StrUtil.equals(String.valueOf(resp.get("status")), "200")) {
|
||||
JSONObject produceorderMap = JSONObject.parseObject(JSONObject.toJSONString(this.findById(Long.valueOf(workorder_id))));
|
||||
produceorderMap.put("workorder_id", workorder_id);
|
||||
produceorderMap.put("order_status", "5");
|
||||
produceorderMap.put("update_optid", currentUserId);
|
||||
produceorderMap.put("update_optname", nickName);
|
||||
produceorderMap.put("update_time", now);
|
||||
produceorderMap.put("realproduceend_date", now);
|
||||
wo.update(produceorderMap);
|
||||
wmsToAcsService.orderStatusUpdate(array);
|
||||
JSONObject produceorderMap = JSONObject.parseObject(JSONObject.toJSONString(this.findById(Long.valueOf(workorder_id))));
|
||||
produceorderMap.put("workorder_id", workorder_id);
|
||||
produceorderMap.put("order_status", "5");
|
||||
produceorderMap.put("update_optid", currentUserId);
|
||||
produceorderMap.put("update_optname", nickName);
|
||||
produceorderMap.put("update_time", now);
|
||||
produceorderMap.put("realproduceend_date", now);
|
||||
wo.update(produceorderMap);
|
||||
|
||||
// 操作成功后向 MES 反馈
|
||||
ParamDto has_mes = paramService.findByCode("has_mes");
|
||||
if (ObjectUtil.isNotEmpty(has_mes) && StrUtil.equals(has_mes.getValue(), "1")) {
|
||||
JSONObject mes_param = new JSONObject();
|
||||
mes_param.put("material_code", materialbaseService.findById(produceorderMap.getLong("material_id")).getMaterial_code());
|
||||
mes_param.put("workorder_code", produceorderMap.getString("workorder_code"));
|
||||
mes_param.put("workorder_qty", produceorderMap.getString("plan_qty"));
|
||||
mes_param.put("device_code", deviceService.findByCode(produceorderMap.getString("device_code")).getExtend_code());
|
||||
String workorder_uri = paramService.findByCode("mes_url").getValue() + "api/mes/materialIvt";
|
||||
HttpRequest
|
||||
.post(workorder_uri)
|
||||
.body(mes_param.toJSONString())
|
||||
.execute();
|
||||
}
|
||||
// 操作成功后向 MES 反馈
|
||||
ParamDto has_mes = paramService.findByCode("has_mes");
|
||||
if (ObjectUtil.isNotEmpty(has_mes) && StrUtil.equals(has_mes.getValue(), "1")) {
|
||||
JSONObject mes_param = new JSONObject();
|
||||
mes_param.put("material_code", materialbaseService.findById(produceorderMap.getLong("material_id")).getMaterial_code());
|
||||
mes_param.put("workorder_code", produceorderMap.getString("workorder_code"));
|
||||
mes_param.put("workorder_qty", produceorderMap.getString("plan_qty"));
|
||||
mes_param.put("device_code", deviceService.findByCode(produceorderMap.getString("device_code")).getExtend_code());
|
||||
String workorder_uri = paramService.findByCode("mes_url").getValue() + "api/mes/materialIvt";
|
||||
HttpRequest
|
||||
.post(workorder_uri)
|
||||
.body(mes_param.toJSONString())
|
||||
.execute();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -509,57 +507,65 @@ public class WorkorderServiceImpl implements WorkordeService {
|
||||
JSONArray data = response_body.getJSONArray("data");
|
||||
WQLObject workorder_table = WQLObject.getWQLObject("pdm_bd_workorder");
|
||||
List<String> workorder_codes = workorder_table
|
||||
.query("is_delete = '0'")
|
||||
.query()
|
||||
.getResultJSONArray(0)
|
||||
.stream()
|
||||
.map(o -> ((JSONObject) o).getString("workorder_code"))
|
||||
.collect(Collectors.toList());
|
||||
WQLObject material_table = WQLObject.getWQLObject("md_me_materialbase");
|
||||
List<String> material_codes = material_table
|
||||
.query("is_delete = '0'")
|
||||
.query()
|
||||
.getResultJSONArray(0)
|
||||
.stream()
|
||||
.map(o -> ((JSONObject) o).getString("material_code"))
|
||||
.collect(Collectors.toList());
|
||||
WQLObject device_table = WQLObject.getWQLObject("pdm_bi_device");
|
||||
List<String> device_codes = device_table
|
||||
.query()
|
||||
.getResultJSONArray(0)
|
||||
.stream()
|
||||
.map(o -> ((JSONObject) o).getString("device_code"))
|
||||
.collect(Collectors.toList());
|
||||
for (Object o : data) {
|
||||
JSONObject mes_workorder = (JSONObject) o;
|
||||
|
||||
// 判断工单是否存在,已存在则不处理
|
||||
// 判断工单是否存在
|
||||
String workorder_code = mes_workorder.getString("workorder_code");
|
||||
if (!workorder_codes.contains(workorder_code)) {
|
||||
// 判断物料是否存在,如果不存在则报错,让用户先去同步物料
|
||||
String material_code = mes_workorder.getString("material_code");
|
||||
if (!material_codes.contains(material_code)) {
|
||||
throw new BadRequestException("工单号[" + workorder_code + "]需要生产的物料不存在,请先同步物料");
|
||||
}
|
||||
// 判断物料是否存在,如果不存在则报错,让用户先去同步物料
|
||||
String material_code = mes_workorder.getString("material_code");
|
||||
if (!material_codes.contains(material_code)) {
|
||||
throw new BadRequestException("工单号[" + workorder_code + "]需要生产的物料不存在,请先同步物料");
|
||||
}
|
||||
|
||||
// 处理物料id
|
||||
Long material_id = material_table
|
||||
.query("is_delete = '0' AND material_code = '" + material_code + "'")
|
||||
.uniqueResult(0)
|
||||
.getLong("material_id");
|
||||
// 处理物料id
|
||||
Long material_id = material_table
|
||||
.query("is_delete = '0' AND material_code = '" + material_code + "'")
|
||||
.uniqueResult(0)
|
||||
.getLong("material_id");
|
||||
|
||||
// 处理工单数量
|
||||
int plan_qty = Integer.parseInt(mes_workorder.getString("workorder_qty")) / 1500;
|
||||
// 处理工单数量
|
||||
int plan_qty = Integer.parseInt(mes_workorder.getString("workorder_qty")) / 1500;
|
||||
|
||||
// 处理设备
|
||||
JSONObject device = device_table
|
||||
.query("is_delete = '0' AND extend_code = '" + mes_workorder.getString("device_code") + "'")
|
||||
.uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(device)) {
|
||||
throw new BadRequestException("工单号[" + workorder_code + "]的生产设备不存在");
|
||||
}
|
||||
// 处理设备
|
||||
String device_code = mes_workorder.getString("device_code");
|
||||
if (!device_codes.contains(device_code)) {
|
||||
throw new BadRequestException("工单号[" + workorder_code + "]的生产设备不存在");
|
||||
}
|
||||
JSONObject device = device_table.query("device_code = '" + device_code + "'").uniqueResult(0);
|
||||
|
||||
//添加工单
|
||||
WorkorderDto workorder = new WorkorderDto();
|
||||
workorder.setWorkorder_code(workorder_code);
|
||||
workorder.setMaterial_id(material_id);
|
||||
workorder.setPlan_qty(BigDecimal.valueOf(plan_qty));
|
||||
workorder.setDevice_id(device.getLong("device_id"));
|
||||
workorder.setDevice_code(device.getString("device_code"));
|
||||
//添加工单
|
||||
WorkorderDto workorder = new WorkorderDto();
|
||||
workorder.setWorkorder_code(workorder_code);
|
||||
workorder.setMaterial_id(material_id);
|
||||
workorder.setPlan_qty(BigDecimal.valueOf(plan_qty));
|
||||
workorder.setDevice_id(device.getLong("device_id"));
|
||||
workorder.setDevice_code(device.getString("device_code"));
|
||||
if (workorder_codes.contains(workorder_code)) {
|
||||
workorder_table.update(JSONObject.parseObject(JSONObject.toJSONString(workorder)), "workorder_code = '" + workorder_code + "'");
|
||||
} else {
|
||||
workorder.setOrder_status("1");
|
||||
this.create(workorder);
|
||||
workorder_codes.add(workorder_code);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@ public class YljCallMaterialTask extends AbstractAcsTask {
|
||||
@Override
|
||||
public String createTask(JSONObject whereJson) {
|
||||
|
||||
String workDevice = "HNJ01";
|
||||
String workDevice = whereJson.getString("point_code2");
|
||||
|
||||
String point_code2 = whereJson.getString("point_code2");
|
||||
String create_mode = whereJson.getString("create_mode");
|
||||
|
||||
@@ -315,18 +315,36 @@ public class HandlingTask extends AbstractAcsTask {
|
||||
|
||||
//任务表【SCH_BASE_Task】
|
||||
//判断当前点是否有未完成的任务
|
||||
JSONObject taskObj2 = taskTab.query("is_delete='0' and point_code2 = '" + next_point_code + "' and task_status <> '" + TaskStatusEnum.FINISHED.getCode() + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(taskObj2))
|
||||
throw new BadRequestException("当前点位" + next_point_code + "存在未完成的任务");
|
||||
JSONObject taskObj2;
|
||||
if ("GT04".equals(next_point_code)) {
|
||||
taskObj2 = taskTab.query("is_delete='0' and point_code2 = '" + next_point_code + "' and task_status <> '" + TaskStatusEnum.FINISHED.getCode() + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(taskObj2)) {
|
||||
throw new BadRequestException("[" + next_point_code + "]存在未完成的任务");
|
||||
}
|
||||
taskObj2 = taskTab.query("is_delete='0' and point_code1 = '" + next_point_code + "' and task_status <> '" + TaskStatusEnum.FINISHED.getCode() + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(taskObj2) && "GT01".equals(taskObj2.getString("point_code2"))) {
|
||||
throw new BadRequestException("请等待[GT04 -> GT01]的任务完成");
|
||||
}
|
||||
} else {
|
||||
taskObj2 = taskTab.query("is_delete='0' and (point_code2 = '" + next_point_code + "' OR point_code1 = '" + next_point_code + "') and task_status <> '" + TaskStatusEnum.FINISHED.getCode() + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(taskObj2))
|
||||
throw new BadRequestException("[" + next_point_code + "]存在未完成的任务");
|
||||
}
|
||||
|
||||
JSONObject taskObj1 = taskTab.query("is_delete='0' and point_code1 = '" + start_point_code + "' and task_status <> '" + TaskStatusEnum.FINISHED.getCode() + "'").uniqueResult(0);
|
||||
JSONObject taskObj1 = taskTab.query("is_delete='0' and (point_code1 = '" + start_point_code + "' OR point_code2 = '" + start_point_code + "') and task_status <> '" + TaskStatusEnum.FINISHED.getCode() + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(taskObj1))
|
||||
throw new BadRequestException("当前点位" + start_point_code + "存在未完成的任务");
|
||||
throw new BadRequestException("[" + start_point_code + "]存在未完成的任务");
|
||||
|
||||
JSONObject jsonObject = ivtTab.query("point_code = '" + start_point_code + "'").uniqueResult(0);
|
||||
|
||||
JSONObject jsonStart = pointTab.query("is_delete = '0' and is_used = '1' and point_code = '" + start_point_code + "'").uniqueResult(0);
|
||||
JSONObject jsonEnd = pointTab.query("is_delete = '0' and is_used = '1' and point_code = '" + next_point_code + "'").uniqueResult(0);
|
||||
if ("1".equals(jsonStart.getString("point_status"))) {
|
||||
throw new BadRequestException("起点[" + start_point_code + "]是空位");
|
||||
}
|
||||
if (!"1".equals(jsonEnd.getString("point_status")) && !"GT04".equals(next_point_code)) {
|
||||
throw new BadRequestException("终点[" + next_point_code + "]不是空位");
|
||||
}
|
||||
String region_codeS = jsonStart.getString("region_code");
|
||||
String region_codeE = jsonEnd.getString("region_code");
|
||||
if (StrUtil.equals(region_codeE, RegionTypeEnum.GT1.getCode())) {
|
||||
|
||||
@@ -13,7 +13,11 @@ import org.nl.modules.common.utils.SecurityUtils;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.wms.basedata.service.dto.MaterialbaseDto;
|
||||
import org.nl.wms.ext.acs.service.WmsToAcsService;
|
||||
import org.nl.wms.ext.acs.service.impl.WmsToAcsServiceImpl;
|
||||
import org.nl.wms.pda.scanGroup.KlzhcwUtil;
|
||||
import org.nl.wms.pda.scanGroup.MyLinkedListService;
|
||||
import org.nl.wms.sch.SchTaskDto;
|
||||
import org.nl.wms.sch.manage.AbstractAcsTask;
|
||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||
@@ -24,6 +28,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -93,24 +98,44 @@ public class KzdjwSendEmpVehicleTask extends AbstractAcsTask {
|
||||
taskTab.update(taskObj);
|
||||
|
||||
JSONObject ivtStart = ivtTab.query("point_code = '" + point_code1 + "'").uniqueResult(0);
|
||||
JSONObject ivtEnd = ivtTab.query("point_code = '" + point_code2 + "'").uniqueResult(0);
|
||||
|
||||
//修改终点库存
|
||||
ivtEnd.put("vehicle_type", taskObj.getString("vehicle_type"));
|
||||
ivtEnd.put("vehicle_code", taskObj.getString("vehicle_code"));
|
||||
ivtEnd.put("material_id", "");
|
||||
ivtEnd.put("instorage_time", DateUtil.now());
|
||||
ivtTab.update(ivtEnd);
|
||||
if ("GT01".equals(point_code2)) {
|
||||
LinkedList<JSONObject> ll = MyLinkedListService.getLinkedList();
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("vehicle_type", taskObj.getString("vehicle_type"));
|
||||
param.put("vehicle_code", taskObj.getString("vehicle_code"));
|
||||
param.put("ivt_qty", taskObj.getString("qty"));
|
||||
boolean flag = SpringContextHolder.getBean(KlzhcwUtil.class).judge(ll, param);
|
||||
if (flag) {
|
||||
jsonEnd.put("lock_type", "1");
|
||||
jsonEnd.put("task_id", "");
|
||||
jsonEnd.put("vehicle_type", "");
|
||||
jsonEnd.put("vehicle_code", "");
|
||||
jsonEnd.put("material_id", "");
|
||||
jsonEnd.put("point_status", "1");
|
||||
jsonEnd.put("update_time", DateUtil.now());
|
||||
pointTab.update(jsonEnd);
|
||||
}
|
||||
} else {
|
||||
|
||||
//解锁终点
|
||||
jsonEnd.put("lock_type", "1");
|
||||
jsonEnd.put("task_id", "");
|
||||
jsonEnd.put("vehicle_type", "");
|
||||
jsonEnd.put("vehicle_code", "");
|
||||
jsonEnd.put("material_id", "");
|
||||
jsonEnd.put("point_status", "2");
|
||||
jsonEnd.put("update_time", DateUtil.now());
|
||||
pointTab.update(jsonEnd);
|
||||
JSONObject ivtEnd = ivtTab.query("point_code = '" + point_code2 + "'").uniqueResult(0);
|
||||
//修改终点库存
|
||||
ivtEnd.put("vehicle_type", taskObj.getString("vehicle_type"));
|
||||
ivtEnd.put("vehicle_code", taskObj.getString("vehicle_code"));
|
||||
ivtEnd.put("material_id", "");
|
||||
ivtEnd.put("instorage_time", DateUtil.now());
|
||||
ivtTab.update(ivtEnd);
|
||||
|
||||
//解锁终点
|
||||
jsonEnd.put("lock_type", "1");
|
||||
jsonEnd.put("task_id", "");
|
||||
jsonEnd.put("vehicle_type", "");
|
||||
jsonEnd.put("vehicle_code", "");
|
||||
jsonEnd.put("material_id", "");
|
||||
jsonEnd.put("point_status", "2");
|
||||
jsonEnd.put("update_time", DateUtil.now());
|
||||
pointTab.update(jsonEnd);
|
||||
}
|
||||
|
||||
//修改起点库存
|
||||
ivtStart.put("vehicle_type", "");
|
||||
@@ -140,29 +165,53 @@ public class KzdjwSendEmpVehicleTask extends AbstractAcsTask {
|
||||
*/
|
||||
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point");
|
||||
JSONArray taskArr = taskTab.query("handle_class = '" + THIS_CLASS + "'and is_delete = '0' and task_status = '" + TaskStatusEnum.SURE_START.getCode() + "'").getResultJSONArray(0);
|
||||
WmsToAcsService wmsToAcsService = SpringContextHolder.getBean(WmsToAcsService.class);
|
||||
for (int i = 0; i < taskArr.size(); i++) {
|
||||
JSONObject taskObj = taskArr.getJSONObject(i);
|
||||
//区查询空盅缓存为是否有空位 如果有就生成到空盅缓存位的任务
|
||||
JSONObject json = pointTab.query("is_used = '1' AND is_delete = '0' AND lock_type = '1' AND point_status = '1' AND region_code = '" + RegionTypeEnum.KLZHCQ.getCode() + "' and point_code != 'KLZHC01'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)) {
|
||||
JSONObject ivtJson = ivtTab.query("point_code = '" + taskObj.getString("point_code1") + "'").uniqueResult(0);
|
||||
json.put("lock_type", "2");
|
||||
json.put("task_id", taskObj.getString("task_id"));
|
||||
json.put("update_time", DateUtil.now());
|
||||
pointTab.update(json);
|
||||
//更改任务表中的终点点位和状态
|
||||
taskObj.put("point_code2", json.getString("point_code"));
|
||||
taskObj.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
|
||||
taskObj.put("vehicle_code", ivtJson.getString("vehicle_code"));
|
||||
taskObj.put("vehicle_type", ivtJson.getString("vehicle_type"));
|
||||
taskObj.put("update_time", DateUtil.now());
|
||||
taskTab.update(taskObj);
|
||||
if ("klzdjwtogt01".equals(taskObj.getString("task_type"))) {
|
||||
JSONObject jsonObject = taskTab.query("is_delete = '0' AND task_status <> '" + TaskStatusEnum.FINISHED.getCode() + "' AND (point_code1 = 'GT01' OR point_code2 = 'GT01')").uniqueResult(0);
|
||||
JSONObject gt01Status = wmsToAcsService.queryGT01Status();
|
||||
if (ObjectUtil.isEmpty(jsonObject) && gt01Status.getBooleanValue("GT01")) {
|
||||
JSONObject ivtJson = ivtTab.query("point_code = '" + taskObj.getString("point_code1") + "'").uniqueResult(0);
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("lock_type", "2");
|
||||
json.put("task_id", taskObj.getString("task_id"));
|
||||
json.put("update_time", DateUtil.now());
|
||||
pointTab.update(json, "point_code = 'GT01'");
|
||||
//更改任务表中的终点点位和状态
|
||||
taskObj.put("point_code2", "GT01");
|
||||
taskObj.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
|
||||
taskObj.put("vehicle_code", ivtJson.getString("vehicle_code"));
|
||||
taskObj.put("vehicle_type", ivtJson.getString("vehicle_type"));
|
||||
taskObj.put("update_time", DateUtil.now());
|
||||
taskTab.update(taskObj);
|
||||
} else {
|
||||
taskObj.put("remark", "1号接驳位当前不允许进入");
|
||||
taskObj.put("update_time", DateUtil.now());
|
||||
taskTab.update(taskObj);
|
||||
}
|
||||
} else {
|
||||
taskObj.put("remark", "空盅缓存区没有空位!");
|
||||
taskObj.put("update_time", DateUtil.now());
|
||||
taskTab.update(taskObj);
|
||||
//区查询空盅缓存为是否有空位 如果有就生成到空盅缓存位的任务
|
||||
JSONObject json = pointTab.query("is_used = '1' AND is_delete = '0' AND lock_type = '1' AND point_status = '1' AND region_code = '" + RegionTypeEnum.KLZHCQ.getCode() + "' and point_code <> 'KLZHC01'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)) {
|
||||
JSONObject ivtJson = ivtTab.query("point_code = '" + taskObj.getString("point_code1") + "'").uniqueResult(0);
|
||||
json.put("lock_type", "2");
|
||||
json.put("task_id", taskObj.getString("task_id"));
|
||||
json.put("update_time", DateUtil.now());
|
||||
pointTab.update(json);
|
||||
//更改任务表中的终点点位和状态
|
||||
taskObj.put("point_code2", json.getString("point_code"));
|
||||
taskObj.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
|
||||
taskObj.put("vehicle_code", ivtJson.getString("vehicle_code"));
|
||||
taskObj.put("vehicle_type", ivtJson.getString("vehicle_type"));
|
||||
taskObj.put("update_time", DateUtil.now());
|
||||
taskTab.update(taskObj);
|
||||
} else {
|
||||
taskObj.put("remark", "空盅缓存区没有空位!");
|
||||
taskObj.put("update_time", DateUtil.now());
|
||||
taskTab.update(taskObj);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,14 +232,22 @@ public class KzdjwSendEmpVehicleTask extends AbstractAcsTask {
|
||||
|
||||
//任务表【SCH_BASE_Task】
|
||||
//判断当前点是否有未完成的任务
|
||||
JSONObject taskObj = taskTab.query("is_delete='0' and point_code1 = '" + point_code1 + "' and task_status <> '" + TaskStatusEnum.FINISHED.getCode() + "'").uniqueResult(0);
|
||||
JSONObject taskObj = taskTab.query("is_delete='0' and (point_code1 = '" + point_code1 + "' OR point_code2 = '" + point_code1 + "') and task_status <> '" + TaskStatusEnum.FINISHED.getCode() + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(taskObj))
|
||||
throw new BadRequestException("当前点位" + point_code1 + "存在未完成的任务");
|
||||
String vehicle_code = WQLObject
|
||||
.getWQLObject("st_ivt_structivt")
|
||||
.query("point_code = '" + point_code1 + "'")
|
||||
.uniqueResult(0)
|
||||
.getString("vehicle_code");
|
||||
if (StrUtil.isBlank(vehicle_code)) {
|
||||
throw new BadRequestException("当前点位[" + point_code1 + "]上没有载具");
|
||||
}
|
||||
|
||||
SchTaskDto dto = SchTaskDto.builder()
|
||||
.task_id(IdUtil.getLongId())
|
||||
.task_code(CodeUtil.getNewCode("TASK_CODE"))
|
||||
.task_type("klzdjwsendempty")
|
||||
.task_type(form.getBooleanValue("to_gt01") ? "klzdjwtogt01" : "klzdjwsendempty")
|
||||
.task_name("空料盅对接位呼叫送空盅")
|
||||
.task_status(TaskStatusEnum.SURE_START.getCode())
|
||||
.point_code1(point_code1)
|
||||
|
||||
@@ -230,43 +230,41 @@ public class HnjSendMaterialTask extends AbstractAcsTask {
|
||||
//1、查询未锁定,空料盅,空盅位暂存区的起始点位 如果有取空的点位 再判断取满时 是否有放货位
|
||||
JSONObject json1 = pointTab.query("is_used = '1' AND is_delete = '0' AND lock_type = '1' AND point_status = '2' AND region_code = '" + RegionTypeEnum.KLZHCQ.getCode() + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json1)) {
|
||||
JSONObject jsonObject = SpringContextHolder.getBean(WmsToAcsService.class).queryGT04Status();
|
||||
if (jsonObject.getBoolean("GT04")) {
|
||||
JSONObject json2 = pointTab.query("is_used = '1' AND is_delete = '0' AND lock_type = '1' AND point_status = '1' AND region_code = '" + RegionTypeEnum.GT1.getCode() + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json2)) {
|
||||
//锁定取空任务的起点
|
||||
json1.put("lock_type", "2");
|
||||
json1.put("task_id", taskObj.getString("task_id"));
|
||||
json1.put("update_time", DateUtil.now());
|
||||
pointTab.update(json1);
|
||||
JSONObject gt01Status = SpringContextHolder.getBean(WmsToAcsService.class).queryGT01Status();
|
||||
JSONObject json2 = pointTab.query("is_used = '1' AND is_delete = '0' AND lock_type = '1' AND point_status = '1' AND region_code = '" + RegionTypeEnum.GT1.getCode() + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json2) && gt01Status.getBooleanValue("GT01")) {
|
||||
//锁定取空任务的起点
|
||||
json1.put("lock_type", "2");
|
||||
json1.put("task_id", taskObj.getString("task_id"));
|
||||
json1.put("update_time", DateUtil.now());
|
||||
pointTab.update(json1);
|
||||
|
||||
//锁定取满任务的终点
|
||||
json2.put("lock_type", "2");
|
||||
json2.put("task_id", taskObj.getString("task_id"));
|
||||
json2.put("update_time", DateUtil.now());
|
||||
pointTab.update(json2);
|
||||
//锁定取满任务的终点
|
||||
json2.put("lock_type", "2");
|
||||
json2.put("task_id", taskObj.getString("task_id"));
|
||||
json2.put("update_time", DateUtil.now());
|
||||
pointTab.update(json2);
|
||||
|
||||
//更改取空任务中的载具信息 任务状态
|
||||
JSONObject ivtJson1 = ivtTab.query("point_code = '" + json1.getString("point_code") + "'").uniqueResult(0);
|
||||
taskObj.put("point_code1", json1.getString("point_code"));
|
||||
taskObj.put("vehicle_code", ivtJson1.getString("vehicle_code"));
|
||||
taskObj.put("vehicle_type", ivtJson1.getString("vehicle_type"));
|
||||
taskObj.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
|
||||
taskObj.put("update_time", DateUtil.now());
|
||||
taskTab.update(taskObj);
|
||||
//更改取空任务中的载具信息 任务状态
|
||||
JSONObject ivtJson1 = ivtTab.query("point_code = '" + json1.getString("point_code") + "'").uniqueResult(0);
|
||||
taskObj.put("point_code1", json1.getString("point_code"));
|
||||
taskObj.put("vehicle_code", ivtJson1.getString("vehicle_code"));
|
||||
taskObj.put("vehicle_type", ivtJson1.getString("vehicle_type"));
|
||||
taskObj.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
|
||||
taskObj.put("update_time", DateUtil.now());
|
||||
taskTab.update(taskObj);
|
||||
|
||||
//更改取满任务中的载具信息 任务状态
|
||||
JSONObject ivtJson2 = ivtTab.query("point_code = '" + taskObj2.getString("point_code1") + "'").uniqueResult(0);
|
||||
taskObj2.put("point_code2", json2.getString("point_code"));
|
||||
taskObj2.put("vehicle_code", ivtJson2.getString("vehicle_code"));
|
||||
taskObj2.put("vehicle_type", ivtJson2.getString("vehicle_type"));
|
||||
taskObj2.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
|
||||
taskObj2.put("update_time", DateUtil.now());
|
||||
taskTab.update(taskObj2);
|
||||
//更改取满任务中的载具信息 任务状态
|
||||
JSONObject ivtJson2 = ivtTab.query("point_code = '" + taskObj2.getString("point_code1") + "'").uniqueResult(0);
|
||||
taskObj2.put("point_code2", json2.getString("point_code"));
|
||||
taskObj2.put("vehicle_code", ivtJson2.getString("vehicle_code"));
|
||||
taskObj2.put("vehicle_type", ivtJson2.getString("vehicle_type"));
|
||||
taskObj2.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
|
||||
taskObj2.put("update_time", DateUtil.now());
|
||||
taskTab.update(taskObj2);
|
||||
|
||||
}
|
||||
} else {
|
||||
JSONObject json3 = pointTab.query("is_used = '1' AND is_delete = '0' AND lock_type = '1' AND point_status = '1' AND region_code = '" + RegionTypeEnum.KLZHCQ.getCode() + "' and point_code = 'KLZHC12'").uniqueResult(0);
|
||||
JSONObject json3 = pointTab.query("is_used = '1' AND is_delete = '0' AND lock_type = '1' AND point_status = '1' AND region_code = '" + RegionTypeEnum.KLZHCQ.getCode() + "' and point_code <> 'KLZHC12'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json3)) {
|
||||
//锁定取空任务的起点
|
||||
json1.put("lock_type", "2");
|
||||
|
||||
@@ -14,6 +14,7 @@ import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.wms.basedata.service.dto.MaterialbaseDto;
|
||||
import org.nl.wms.basedata.service.impl.MaterialbaseServiceImpl;
|
||||
import org.nl.wms.ext.acs.service.WmsToAcsService;
|
||||
import org.nl.wms.ext.acs.service.impl.WmsToAcsServiceImpl;
|
||||
import org.nl.wms.pda.scanGroup.KlzhcwUtil;
|
||||
import org.nl.wms.pda.scanGroup.MyLinkedListService;
|
||||
@@ -341,6 +342,10 @@ public class TimingSendMaterialTask extends AbstractAcsTask {
|
||||
String point_id = jsonObject.getString("point_id");
|
||||
JSONObject jsonObject1 = wo_point.query("point_id = '" + point_id + "' and is_delete = '0' and is_used = '1' and lock_type = '1' and point_status = '3'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(jsonObject1)) {
|
||||
JSONObject gt01Status = SpringContextHolder.getBean(WmsToAcsService.class).queryGT01Status();
|
||||
if (!gt01Status.getBooleanValue("GT01")) {
|
||||
return;
|
||||
}
|
||||
JSONObject jsonObject2 = wo_point.query("region_code = '" + RegionTypeEnum.GT1.getCode() + "' and is_delete = '0' and is_used = '1' and lock_type = '1'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(jsonObject2)) {
|
||||
JSONObject map = new JSONObject();
|
||||
|
||||
@@ -147,16 +147,25 @@ public class StructivtServiceImpl implements StructivtService {
|
||||
&& ObjectUtil.isNotEmpty(dto.getMaterial_id())) {
|
||||
throw new BadRequestException("选择物料编码必须选择托盘编号");
|
||||
}
|
||||
if (StrUtil.isNotEmpty(dto.getVehicle_code())
|
||||
&& ObjectUtil.isNotEmpty(dto.getMaterial_id())) {
|
||||
redisUtils.set(dto.getVehicle_code(), dto.getMaterial_id().toString());
|
||||
redisUtils.set(dto.getVehicle_code() + "-ivt_qty", "1");
|
||||
if (StrUtil.isNotBlank(dto.getVehicle_code())) {
|
||||
if (ObjectUtil.isNotEmpty(dto.getMaterial_id())) {
|
||||
redisUtils.set(dto.getVehicle_code(), dto.getMaterial_id().toString());
|
||||
redisUtils.set(dto.getVehicle_code() + "-ivt_qty", "1");
|
||||
} else {
|
||||
redisUtils.del(dto.getVehicle_code());
|
||||
redisUtils.del(dto.getVehicle_code() + "-ivt_qty");
|
||||
}
|
||||
}
|
||||
WQLObject wo_point = WQLObject.getWQLObject("sch_base_point");
|
||||
// 找主表获取之前的数据
|
||||
StructivtDto structivtDto = this.findById(dto.getStockrecord_id());
|
||||
String region_code = structivtDto.getRegion_code();
|
||||
if (structivtDto == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
String region_code = structivtDto.getRegion_code();
|
||||
if (StrUtil.isBlank(dto.getVehicle_code())
|
||||
|| !dto.getVehicle_code().equals(structivtDto.getVehicle_code())) {
|
||||
redisUtils.del(structivtDto.getVehicle_code());
|
||||
redisUtils.del(structivtDto.getVehicle_code() + "-ivt_qty");
|
||||
}
|
||||
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
|
||||
Reference in New Issue
Block a user