跳过困料暂存区 后端数据校验
This commit is contained in:
@@ -57,4 +57,6 @@ public interface WmsToAcsService {
|
||||
* @return
|
||||
*/
|
||||
JSONObject getPointStatus(JSONArray whereJson);
|
||||
|
||||
JSONObject queryGT04Status();
|
||||
}
|
||||
|
||||
@@ -256,6 +256,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"));
|
||||
|
||||
if (ObjectUtil.isEmpty(type)) throw new BadRequestException("类型不能为空");
|
||||
if (ObjectUtil.isEmpty(point_code)) throw new BadRequestException("点位不能为空");
|
||||
@@ -282,6 +283,20 @@ 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);
|
||||
if (StrUtil.isNotEmpty(barcode.toString()) && !"0".equals(barcode.toString())) {
|
||||
for (int i = barcode.length(); i < 4; i++) {
|
||||
barcode.insert(0, "0");
|
||||
}
|
||||
JSONObject vehicle = new JSONObject() {{
|
||||
put("vehicle_type", "1");
|
||||
put("vehicle_code", barcode.toString());
|
||||
}};
|
||||
|
||||
WQLObject.getWQLObject("sch_base_point")
|
||||
.update(vehicle, "point_code = '" + point_code + "'");
|
||||
WQLObject.getWQLObject("st_ivt_structivt")
|
||||
.update(vehicle, "point_code = '" + point_code + "'");
|
||||
}
|
||||
HnjSendMaterialTask taskBean = SpringContextHolder.getBean(HnjSendMaterialTask.class);
|
||||
taskBean.createTask(param); // 创建任务
|
||||
} else if (StrUtil.equals(type, "3")) {
|
||||
@@ -323,14 +338,14 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
//Long material_id = null;
|
||||
//首先判断条码变化的是不是第一个满料盅缓存位
|
||||
//如果是的话说明困料区来的 先去库存表查询对应的条码的物料信息 并将对应的物料信息保存在redis中
|
||||
if (StrUtil.equals(is_first, "true")) {
|
||||
JSONObject ivtJson = wo_ivt.query("vehicle_code = '" + barcode + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(ivtJson)) {
|
||||
redisUtils.set(barcode, ivtJson.getString("material_id"));
|
||||
redisUtils.set(barcode + "-ivt_qty", ivtJson.getString("ivt_qty"));
|
||||
materialbaseDto = materialbaseService.findById(ivtJson.getLong("material_id"));
|
||||
}
|
||||
}
|
||||
// if (StrUtil.equals(is_first, "true")) {
|
||||
// JSONObject ivtJson = wo_ivt.query("vehicle_code = '" + barcode + "'").uniqueResult(0);
|
||||
// if (ObjectUtil.isNotEmpty(ivtJson)) {
|
||||
// redisUtils.set(barcode, ivtJson.getString("material_id"));
|
||||
// redisUtils.set(barcode + "-ivt_qty", ivtJson.getString("ivt_qty"));
|
||||
// materialbaseDto = materialbaseService.findById(ivtJson.getLong("material_id"));
|
||||
// }
|
||||
// }
|
||||
Object redis_material_id = redisUtils.get(barcode);
|
||||
String material_id = ObjectUtil.isEmpty(redis_material_id) ? null : String.valueOf(redis_material_id);
|
||||
Object redis_ivt_qty = redisUtils.get(barcode + "-ivt_qty");
|
||||
|
||||
@@ -60,4 +60,9 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
return AcsUtil.notifyAcs(api, whereJson);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject queryGT04Status() {
|
||||
String api = "api/wms/queryGT04Status";
|
||||
return AcsUtil.notifyAcs(api, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
package org.nl.wms.pda.inStruct.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
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.common.utils.RedisUtils;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.wms.basedata.service.MaterialbaseService;
|
||||
import org.nl.wms.basedata.service.VehicleService;
|
||||
import org.nl.wms.basedata.service.dto.MaterialbaseDto;
|
||||
import org.nl.wms.basedata.service.dto.VehicleDto;
|
||||
import org.nl.wms.ext.acs.service.AcsToWmsService;
|
||||
import org.nl.wms.pda.inStruct.service.InStructService;
|
||||
@@ -24,6 +29,8 @@ public class InStructServiceImpl implements InStructService {
|
||||
private final AcsToWmsService acsToWmsService;
|
||||
private final KlzhcwUtil klzhcwUtil;
|
||||
private final VehicleService vehicleService;
|
||||
private final RedisUtils redisUtils;
|
||||
private final MaterialbaseService materialbaseService;
|
||||
|
||||
@Override
|
||||
public JSONObject queryPoint() {
|
||||
@@ -47,15 +54,35 @@ public class InStructServiceImpl implements InStructService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public JSONObject confirm(JSONObject param) {
|
||||
String vehicle_code = param.getString("carrier_code");
|
||||
if (StrUtil.isNotBlank(vehicle_code)) {
|
||||
throw new BadRequestException("载具号不能为空");
|
||||
}
|
||||
VehicleDto vehicle = vehicleService.findByCode(vehicle_code);
|
||||
if (ObjectUtil.isNotEmpty(vehicle)) {
|
||||
throw new BadRequestException("载具号不存在");
|
||||
}
|
||||
JSONObject map = new JSONObject();
|
||||
VehicleDto vehicle = vehicleService.findByCode(param.getString("carrier_code"));
|
||||
String vehicle_type = "";
|
||||
if (ObjectUtil.isNotEmpty(vehicle)) {
|
||||
vehicle_type = vehicle.getVehicle_type();
|
||||
}
|
||||
map.put("vehicle_code", param.getString("carrier_code"));
|
||||
String type = param.getString("type");
|
||||
if ("2".equals(type)) {
|
||||
String material_code = param.getString("material_code");
|
||||
if (StrUtil.isBlank(material_code)) {
|
||||
throw new BadRequestException("满盅必须选择物料编码");
|
||||
}
|
||||
MaterialbaseDto material = materialbaseService.findByCode(material_code);
|
||||
if (ObjectUtil.isEmpty(material)) {
|
||||
throw new BadRequestException("物料不存在");
|
||||
}
|
||||
redisUtils.set(vehicle_code, material.getMaterial_id());
|
||||
redisUtils.set(vehicle_code + "-ivt_qty", "1");
|
||||
map.put("material_code", material_code);
|
||||
}
|
||||
map.put("vehicle_code", vehicle_code);
|
||||
map.put("vehicle_type", vehicle_type);
|
||||
map.put("material_code", param.getString("material_code"));
|
||||
LinkedList<JSONObject> ll = MyLinkedListService.getLinkedList();
|
||||
klzhcwUtil.judge(ll, map);
|
||||
JSONObject result = new JSONObject();
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
package org.nl.wms.pda.outStruct.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
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.RedisUtils;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.wms.basedata.service.VehicleService;
|
||||
import org.nl.wms.basedata.service.dto.VehicleDto;
|
||||
import org.nl.wms.pda.outStruct.service.OutStructService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -14,13 +19,26 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
@Slf4j
|
||||
public class OutStructServiceImpl implements OutStructService {
|
||||
|
||||
private final RedisUtils redisUtils;
|
||||
|
||||
private final VehicleService vehicleService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public JSONObject confirm(JSONObject param) {
|
||||
String carrier_code = param.getString("carrier_code");
|
||||
String vehicle_code = param.getString("carrier_code");
|
||||
if (StrUtil.isNotBlank(vehicle_code)) {
|
||||
throw new BadRequestException("载具号不能为空");
|
||||
}
|
||||
VehicleDto vehicle = vehicleService.findByCode(vehicle_code);
|
||||
if (ObjectUtil.isNotEmpty(vehicle)) {
|
||||
throw new BadRequestException("载具号不存在");
|
||||
}
|
||||
WQLObject wo = WQLObject.getWQLObject("ST_IVT_StructIvt");
|
||||
WQLObject wo_point = WQLObject.getWQLObject("sch_base_point");
|
||||
JSONObject jsonObject = wo.query("vehicle_code = '" + carrier_code + "'").uniqueResult(0);
|
||||
redisUtils.del(vehicle_code);
|
||||
redisUtils.del(vehicle_code + "-ivt_qty");
|
||||
JSONObject jsonObject = wo.query("vehicle_code = '" + vehicle + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(jsonObject)){
|
||||
jsonObject.put("vehicle_type","");
|
||||
jsonObject.put("vehicle_code","");
|
||||
@@ -32,7 +50,8 @@ public class OutStructServiceImpl implements OutStructService {
|
||||
jsonObject1.put("point_status","1");
|
||||
jsonObject1.put("lock_type","1");
|
||||
jsonObject1.put("task_id","");
|
||||
jsonObject1.put("task_id","");
|
||||
jsonObject1.put("vehicle_type", "");
|
||||
jsonObject1.put("vehicle_code", "");
|
||||
wo_point.update(jsonObject1);
|
||||
}
|
||||
JSONObject result = new JSONObject();
|
||||
|
||||
@@ -5,7 +5,7 @@ package org.nl.wms.pda.scanGroup;
|
||||
*/
|
||||
public enum HcwNumEnum {
|
||||
KLZHCQ(1, "KLZHCQ", 10),
|
||||
KLZCQ(2, "KLZCQ", 25),
|
||||
KLZCQ(2, "KLZCQ", 26),
|
||||
MLZZCQ(3, "MLZZCQ", 26),
|
||||
YLJQ(4, "YLJQ", 8),
|
||||
HNJQ(5, "HNJQ", 2),
|
||||
|
||||
@@ -138,7 +138,7 @@ public class WorkorderServiceImpl implements WorkordeService {
|
||||
Long deptId = currentUser.getUser().getDeptId();
|
||||
// String newCode = CodeUtil.getNewCode("PDM_SHIFTORDER");
|
||||
dto.setWorkorder_id(IdUtil.getSnowflake(1, 1).nextId());
|
||||
// dto.setWorkorder_code(newCode);
|
||||
dto.setWorkorder_code(CodeUtil.getNewCode("PDM_SHIFTORDER"));
|
||||
dto.setCreate_id(currentUserId);
|
||||
dto.setCreate_time(now);
|
||||
dto.setCreate_name(nickName);
|
||||
@@ -222,6 +222,8 @@ public class WorkorderServiceImpl implements WorkordeService {
|
||||
json.put("update_optname", nickName);
|
||||
json.put("update_time", now);
|
||||
wo.update(json);
|
||||
} else {
|
||||
throw new BadRequestException(resp.get("message").toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,11 +9,13 @@ 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.RedisUtils;
|
||||
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.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;
|
||||
@@ -228,38 +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 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 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);
|
||||
|
||||
//锁定取满任务的终点
|
||||
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);
|
||||
if (ObjectUtil.isNotEmpty(json3)) {
|
||||
@@ -360,11 +365,15 @@ public class HnjSendMaterialTask extends AbstractAcsTask {
|
||||
JSONObject taskObj1 = taskTab.query("is_delete='0' and point_code2 = '" + point_code1 + "' and task_status <> '" + TaskStatusEnum.FINISHED.getCode() + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(taskObj1)) throw new BadRequestException("当前点位" + point_code1 + "存在未完成的终点任务");
|
||||
|
||||
String device_code = pointTab.query("point_code = '" + point_code1 + "'").uniqueResult(0).getString("point_code");
|
||||
|
||||
JSONObject workOrderObj = workOrderTab.query("device_code = '" + workDevice + "' and order_status = '3' and is_delete ='0'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(workOrderObj)) throw new BadRequestException("该设备当前未生产或者已删除");
|
||||
|
||||
JSONObject point = pointTab.query("is_delete = '0' AND point_code = '" + point_code1 + "'").uniqueResult(0);
|
||||
String vehicle_code = point.getString("vehicle_code");
|
||||
RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class);
|
||||
redisUtils.set(vehicle_code, workOrderObj.getString("material_id"));
|
||||
redisUtils.set(vehicle_code + "-ivt_qty", "1");
|
||||
|
||||
Long task_group_id = IdUtil.getLongId();
|
||||
|
||||
SchTaskDto emptyDto = SchTaskDto.builder()
|
||||
|
||||
@@ -139,8 +139,20 @@ public class StructivtServiceImpl implements StructivtService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(StructivtDto dto) {
|
||||
if (StrUtil.isNotBlank(dto.getVehicle_type()) && StrUtil.isBlank(dto.getVehicle_code())) {
|
||||
throw new BadRequestException("请选择托盘编号");
|
||||
}
|
||||
if (StrUtil.isBlank(dto.getVehicle_type())
|
||||
&& StrUtil.isBlank(dto.getVehicle_code())
|
||||
&& 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");
|
||||
}
|
||||
WQLObject wo_point = WQLObject.getWQLObject("sch_base_point");
|
||||
System.out.println(dto.toString());
|
||||
// 找主表获取之前的数据
|
||||
StructivtDto structivtDto = this.findById(dto.getStockrecord_id());
|
||||
String region_code = structivtDto.getRegion_code();
|
||||
@@ -224,8 +236,8 @@ public class StructivtServiceImpl implements StructivtService {
|
||||
// 更新主表
|
||||
WQLObject wo = WQLObject.getWQLObject("st_ivt_structivt");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
if (ObjectUtil.isEmpty(dto.getMaterial_id())){
|
||||
json.put("material_id","");
|
||||
if (ObjectUtil.isEmpty(dto.getMaterial_id())) {
|
||||
json.put("material_id", "");
|
||||
}
|
||||
wo.update(json);
|
||||
|
||||
@@ -240,8 +252,8 @@ public class StructivtServiceImpl implements StructivtService {
|
||||
point_status = "3";
|
||||
}
|
||||
JSONObject jsonObject = wo_point.query("point_code = '" + dto.getPoint_code() + "'").uniqueResult(0);
|
||||
jsonObject.put("point_status",point_status);
|
||||
jsonObject.put("update_time",DateUtil.now());
|
||||
jsonObject.put("point_status", point_status);
|
||||
jsonObject.put("update_time", DateUtil.now());
|
||||
wo_point.update(jsonObject);
|
||||
|
||||
if (StrUtil.equals(region_code, RegionTypeEnum.KLZCQ.getCode()) || StrUtil.equals(region_code, RegionTypeEnum.GT2.getCode())) {
|
||||
|
||||
Reference in New Issue
Block a user