fix:修改缓存线异常处理相关功能

This commit is contained in:
2023-05-21 17:19:12 +08:00
parent 2e691aaef9
commit f01cf7bc98
10 changed files with 197 additions and 122 deletions

View File

@@ -86,4 +86,40 @@ public class AcsUtil {
} }
return result; return result;
} }
public static JSONObject notifyAcs(String api, JSONObject list) {
log.info("下发ACS参数----------------------------------------+"+api+",---"+list.toString());
//判断是否连接ACS系统
String isConnect = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("IS_CONNECT_ACS").getValue();
JSONObject result = new JSONObject();
if (StrUtil.equals(StatusEnum.STATUS_FLASE.getCode(), isConnect)) {
result.put("status", HttpStatus.OK.value());
result.put("message", "下发成功但未连接ACS!");
result.put("data", new JSONObject());
return result;
}
//ACS地址127.0.0.1:8010
String acsUrl = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("acs_url").getValue();
String url = acsUrl + api;
try {
String resultMsg = HttpRequest.post(url)
.body(String.valueOf(list))
.execute().body();
result = JSONObject.parseObject(resultMsg);
log.info("ACS相应参数----------------------------------------+"+api+",---"+result.toString());
} catch (Exception e) {
log.info("ACS反馈异常----------------------------------------+"+api+",---"+e.getMessage());
String msg = e.getMessage();
//ConnectException: Connection refused: connect
//网络不通
result.put("status", HttpStatus.BAD_REQUEST);
result.put("message", "网络不通,操作失败!");
result.put("data", new JSONObject());
result.put("error", msg);
}
return result;
}
} }

View File

@@ -283,7 +283,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService{
String vehicleCode = collect[i]; String vehicleCode = collect[i];
cachePosition.put("vehicle_code",vehicleCode.equals("0")?"": vehicleCode); cachePosition.put("vehicle_code",vehicleCode.equals("0")?"": vehicleCode);
if (vehicleCode.equals("99999")){ if (vehicleCode.equals("99999")){
cachePosition.put("err_type", StatusEnum.CACHE_POINT_SCAN_ERROR.getCode()); cachePosition.put("err_type", StatusEnum.CACHE_POINT_ERROR.getCode());
} }
positionTab.update(cachePosition,"position_code = '"+cachePosition.getString("position_code")+"'"); positionTab.update(cachePosition,"position_code = '"+cachePosition.getString("position_code")+"'");
} }

View File

@@ -145,7 +145,7 @@ public class CacheLineHandController {
@PostMapping("/cacheLineOutBoxExceptionQuery") @PostMapping("/cacheLineOutBoxExceptionQuery")
@Log("缓存线出箱异常-查询") @Log("缓存线出箱异常-查询")
@ApiOperation("缓存线出箱异常-查询") @ApiOperation("缓存线出箱异常-查询")
public ResponseEntity<JSONArray> cacheLineOutBoxExceptionQuery(@RequestBody JSONObject param) { public ResponseEntity<Object> cacheLineOutBoxExceptionQuery(@RequestBody JSONObject param) {
log.info("海亮缓存线手持服务 [缓存线出箱异常-查询] 接口被请求, 请求参数-{}", param); log.info("海亮缓存线手持服务 [缓存线出箱异常-查询] 接口被请求, 请求参数-{}", param);
//参数校验 //参数校验
if (StringUtils.isBlank(param.getString("wcsdevice_code"))) { if (StringUtils.isBlank(param.getString("wcsdevice_code"))) {
@@ -274,15 +274,6 @@ public class CacheLineHandController {
return new ResponseEntity<>(HttpStatus.OK); return new ResponseEntity<>(HttpStatus.OK);
} }
@PostMapping("/setBlankPos")
@Log("设置缓存线货位为空位置")
@ApiOperation("设置缓存线货位为空位置")
public ResponseEntity<Object> setBlankPos(@RequestBody JSONObject param) {
log.info("海亮缓存线手持服务 [设置缓存线货位为空位置] 接口被请求, 请求参数-{}", param);
cacheLineHandService.setBlankPos(param);
return new ResponseEntity<>(HttpStatus.OK);
}
@PostMapping("/cacheLineExcepOpt") @PostMapping("/cacheLineExcepOpt")
@Log("缓存线异常处理") @Log("缓存线异常处理")
@ApiOperation("缓存线异常处理") @ApiOperation("缓存线异常处理")

View File

@@ -164,7 +164,7 @@ public interface CacheLineHandService{
* @author gbx * @author gbx
* @date 2023/3/24 * @date 2023/3/24
*/ */
CommonResult<Integer> cacheLineOutBoxExceptionConfirm(JSONObject param); JSONObject cacheLineOutBoxExceptionConfirm(JSONObject param);
/** /**
* 空箱初始化--出入空箱 * 空箱初始化--出入空箱
@@ -184,7 +184,7 @@ public interface CacheLineHandService{
* @author gbx * @author gbx
* @date 2023/3/24 * @date 2023/3/24
*/ */
CommonResult<Integer> setfullBox(JSONObject param); JSONObject setfullBox(JSONObject param);
/** /**
* 设置空框 * 设置空框
@@ -233,15 +233,6 @@ public interface CacheLineHandService{
*/ */
void agvOutBoxExceptionConfirm(JSONObject param); void agvOutBoxExceptionConfirm(JSONObject param);
/**
* 设置缓存线货位为空位置
*
* @param param 查询参数
* @author gbx
* @date 2023/3/24
*/
void setBlankPos(JSONObject param);
/** /**
* 缓存线出箱异常-查询 * 缓存线出箱异常-查询
* *
@@ -250,7 +241,7 @@ public interface CacheLineHandService{
* @author gbx * @author gbx
* @date 2023/3/24 * @date 2023/3/24
*/ */
JSONArray cacheLineOutBoxExceptionQuery(JSONObject param); List<Map> cacheLineOutBoxExceptionQuery(JSONObject param);
/** /**
* 缓存线异常处理 * 缓存线异常处理

View File

@@ -24,12 +24,21 @@ import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject; import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.WqlUtil; import org.nl.modules.wql.util.WqlUtil;
import org.nl.wms.ext.acs.service.WmsToAcsService; import org.nl.wms.ext.acs.service.WmsToAcsService;
import org.nl.wms.masterdata_manage.service.material.IMdMeMaterialbaseService;
import org.nl.wms.masterdata_manage.service.material.dao.MdMeMaterialbase;
import org.nl.wms.pda_manage.pda.dto.MaterialDto; import org.nl.wms.pda_manage.pda.dto.MaterialDto;
import org.nl.wms.pda_manage.pda.service.CacheLineHandService; import org.nl.wms.pda_manage.pda.service.CacheLineHandService;
import org.nl.wms.product_manage.service.device.IPdmBiDeviceService; import org.nl.wms.product_manage.service.device.IPdmBiDeviceService;
import org.nl.wms.product_manage.service.device.dao.PdmBiDevice; import org.nl.wms.product_manage.service.device.dao.PdmBiDevice;
import org.nl.wms.scheduler_manage.service.cacheline.ISchCachelinePositionService;
import org.nl.wms.scheduler_manage.service.cacheline.ISchCachelineVehilematerialService;
import org.nl.wms.scheduler_manage.service.cacheline.dao.SchCachelinePosition;
import org.nl.wms.scheduler_manage.service.cacheline.dao.SchCachelineVehilematerial;
import org.nl.wms.scheduler_manage.service.cacheline.dao.mapper.SchCachelinePositionMapper; import org.nl.wms.scheduler_manage.service.cacheline.dao.mapper.SchCachelinePositionMapper;
import org.nl.wms.scheduler_manage.service.cacheline.dao.mapper.SchCachelineVehilematerialMapper; import org.nl.wms.scheduler_manage.service.cacheline.dao.mapper.SchCachelineVehilematerialMapper;
import org.nl.wms.scheduler_manage.service.task.ISchBaseTaskService;
import org.nl.wms.scheduler_manage.service.task.dao.SchBaseTask;
import org.nl.wms.scheduler_manage.service.task.dao.mapper.SchBaseTaskMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
@@ -37,8 +46,8 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.*; import java.util.*;
import java.util.concurrent.*; import java.util.concurrent.CompletableFuture;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.ThreadPoolExecutor;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@@ -64,6 +73,16 @@ public class CacheLineHandServiceImpl implements CacheLineHandService {
private SchCachelineVehilematerialMapper vehilematerialMapper; private SchCachelineVehilematerialMapper vehilematerialMapper;
@Autowired @Autowired
private SchCachelinePositionMapper positionMapper; private SchCachelinePositionMapper positionMapper;
@Autowired
private SchBaseTaskMapper taskMapper;
@Autowired
private ISchCachelinePositionService positionService;
@Autowired
private ISchCachelineVehilematerialService vehilematerialService;
@Autowired
private IMdMeMaterialbaseService materialbaseService;
@Autowired
private ISchBaseTaskService taskService;
@Override @Override
public JSONArray dropdownListQuery(String param, String type) { public JSONArray dropdownListQuery(String param, String type) {
@@ -76,6 +95,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService {
return WQL.getWO("PDA_QUERY").addParam("flag", "6").addParam("condition", param).process().getResultJSONArray(0); return WQL.getWO("PDA_QUERY").addParam("flag", "6").addParam("condition", param).process().getResultJSONArray(0);
} }
@Override
public JSONArray appUpdate() { public JSONArray appUpdate() {
return WQL.getWO("PDA_QUERY").addParam("flag", "11").process().getResultJSONArray(0); return WQL.getWO("PDA_QUERY").addParam("flag", "11").process().getResultJSONArray(0);
} }
@@ -371,64 +391,56 @@ public class CacheLineHandServiceImpl implements CacheLineHandService {
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public CommonResult<Integer> setfullBox(JSONObject param) { public JSONObject setfullBox(JSONObject param) {
//物料ID //物料ID
String semimanufactures_uuid = param.getString("material_uuid"); String semimanufactures_uuid = param.getString("material_uuid");
// 缓存线位置编码 // 缓存线位置编码
String position_code = param.getString("position_code"); String position_code = param.getString("position_code");
// 料箱码 // 料箱码
String vehicle_code = param.getString("vehicle_code"); String vehicle_code = param.getString("vehicle_code");
//工序
// String workprocedure_code = param.getString("workprocedure_code");
// 缓存线 // 缓存线
String cacheLine_code = param.getString("wcsdevice_code"); String cacheLine_code = param.getString("wcsdevice_code");
String weight = param.getString("weight"); String weight = param.getString("weight");
String quantity = param.getString("quantity"); String quantity = param.getString("quantity");
if (StringUtils.isBlank(quantity) || param.getInteger("quantity") <= 0) { if (StringUtils.isBlank(quantity) || param.getInteger("quantity") <= 0) {
throw new BadRequestException("数量必须大于0!"); throw new BadRequestException("数量必须大于0!");
} }
//缓存线位置表
WQLObject positionTab = WQLObject.getWQLObject("sch_cacheline_position"); SchCachelinePosition vehiobj = positionService.getOne(new QueryWrapper<SchCachelinePosition>().eq("position_code", position_code));
// 缓存线位置
JSONObject vehiobj = positionTab.query("position_code = '" + position_code + "'").uniqueResult(0); if (ObjectUtil.isEmpty(vehiobj)) {
if (vehiobj == null) {
throw new BadRequestException("位置不存在,设置有误!"); throw new BadRequestException("位置不存在,设置有误!");
} }
//工序表
//WQLObject wpTab = WQLObject.getWQLObject("pdm_bi_workprocedure"); MdMeMaterialbase mater = materialbaseService.getOne(new QueryWrapper<MdMeMaterialbase>().eq("material_id", semimanufactures_uuid));
//物料表 if (ObjectUtil.isEmpty(mater)) {
WQLObject meTab = WQLObject.getWQLObject("md_me_materialbase");
// 查询工序信息
// JSONObject wpObj = wpTab.query("workprocedure_code = '" + workprocedure_code + "'").uniqueResult(0);
// if(ObjectUtil.isEmpty(wpObj)) {
// throw new BadRequestException("工序查询错误,请检查工序");
// }
JSONObject meObj = meTab.query("material_id = '" + semimanufactures_uuid + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(meObj)) {
throw new BadRequestException("物料查询错误,请检查物料"); throw new BadRequestException("物料查询错误,请检查物料");
} }
vehiobj.put("vehicle_code", vehicle_code);
//2.缓存线位置通过扫码绑定料箱条码 //2.缓存线位置通过扫码绑定料箱条码
positionTab.update(vehiobj, "position_code = '" + position_code + "'"); vehiobj.setVehicle_code(vehicle_code);
// 缓存线载具物料表 positionService.updateById(vehiobj);
WQLObject ivtTab = WQLObject.getWQLObject("sch_cacheline_vehilematerial");
//3.先删除料箱的所有关联信息,包括物料,工序,生产区域 //3.先删除料箱的所有关联信息,包括物料,工序,生产区域
ivtTab.delete("vehicle_code = '" + vehicle_code + "'"); vehilematerialService.removeByMap(MapOf.of("vehicle_code", vehicle_code));
// 物料信息
HashMap<String, String> json = new HashMap<>(); JSONObject json = new JSONObject();
json.put("vehmaterial_id", IdUtil.getStringId()); json.put("vehmaterial_id", IdUtil.getStringId());
json.put("vehicle_code", vehicle_code); json.put("vehicle_code", vehicle_code);
json.put("cacheLine_code", cacheLine_code); json.put("cacheLine_code", cacheLine_code);
json.put("material_id", meObj.getString("material_id")); json.put("material_id", mater.getMaterial_id());
json.put("weight", weight); json.put("weight", weight);
json.put("quantity", quantity); json.put("quantity", quantity);
// json.put("workprocedure_code", wpObj.getString("workprocedure_code"));
// json.put("workprocedure_name", wpObj.getString("workprocedure_name"));
//有箱有料 //有箱有料
json.put("vehicle_status", StatusEnum.CACHE_VEL_FULL.getCode()); json.put("vehicle_status", StatusEnum.CACHE_VEL_FULL.getCode());
json.put("create_time", DateUtil.now()); json.put("create_time", DateUtil.now());
//4.重新新建该缓存线位置上的料箱为满箱及所属工序,生产区域等信息 //4.重新新建该缓存线位置上的料箱为满箱及所属工序,生产区域等信息
return RestBusinessTemplate.execute(() -> ivtTab.insert(json).getSucess()); vehilematerialService.save(json.toJavaObject(SchCachelineVehilematerial.class));
JSONObject res = new JSONObject();
res.put("message", "设置成功");
return res;
} }
@Override @Override
@@ -440,19 +452,23 @@ public class CacheLineHandServiceImpl implements CacheLineHandService {
String vehicle_code = param.getString("vehicle_code"); String vehicle_code = param.getString("vehicle_code");
// 缓存线 // 缓存线
String wcsdevice_code = param.getString("wcsdevice_code"); String wcsdevice_code = param.getString("wcsdevice_code");
// 缓存线载具物料表
WQLObject ivtTab = WQLObject.getWQLObject("sch_cacheline_vehilematerial");
// 缓存线位置表 SchCachelinePosition vehiobj = positionService.getOne(new QueryWrapper<SchCachelinePosition>().eq("position_code", position_code));
WQLObject positionTab = WQLObject.getWQLObject("sch_cacheline_position"); if (ObjectUtil.isEmpty(vehiobj)) {
JSONObject vehiobj = positionTab.query("position_code = '" + position_code + "'").uniqueResult(0);
if (vehiobj == null) {
throw new BadRequestException("位置不存在,设置有误!"); throw new BadRequestException("位置不存在,设置有误!");
} }
//1.缓存线位置通过扫码绑定料箱条码 //1.缓存线位置通过扫码绑定料箱条码
vehiobj.put("vehicle_code", vehicle_code); vehiobj.setVehicle_code(vehicle_code);
positionTab.update(vehiobj, "position_code = '" + position_code + "'"); positionService.updateById(vehiobj);
//2.先删除料箱的所有关联信息,包括物料,工序,生产区域 //2.先删除料箱的所有关联信息,包括物料,工序,生产区域
ivtTab.delete("vehicle_code = '" + vehicle_code + "'"); vehilematerialService.removeByMap(MapOf.of("vehicle_code", vehicle_code));
// 3.重新新建该缓存线位置上的料箱为空箱子,是空料箱没有放物料等其他信息
JSONObject json = new JSONObject(); JSONObject json = new JSONObject();
json.put("vehmaterial_id", IdUtil.getStringId()); json.put("vehmaterial_id", IdUtil.getStringId());
json.put("vehicle_code", vehicle_code); json.put("vehicle_code", vehicle_code);
@@ -464,30 +480,13 @@ public class CacheLineHandServiceImpl implements CacheLineHandService {
json.put("workprocedure_code", ""); json.put("workprocedure_code", "");
json.put("workprocedure_name", ""); json.put("workprocedure_name", "");
json.put("create_time", DateUtil.now()); json.put("create_time", DateUtil.now());
// 3.重新新建该缓存线位置上的料箱为空箱子,是空料箱没有放物料等其他信息 vehilematerialService.save(json.toJavaObject(SchCachelineVehilematerial.class));
ivtTab.insert(json);
JSONObject res = new JSONObject(); JSONObject res = new JSONObject();
res.put("message", "设置成功"); res.put("message", "设置成功");
return res; return res;
} }
@Override
public void setBlankPos(JSONObject param) {
// 层数
String layer_num = param.getString("layer_num");
// 顺序号
String seat_order_num = param.getString("seat_order_num");
// 缓存线编码
String wcsdevice_code = param.getString("wcsdevice_code");
// 缓存线位置表
WQLObject positionTab = WQLObject.getWQLObject("sch_cacheline_position");
JSONObject json = positionTab.query("order_no = " + seat_order_num + " and layer_num = " + layer_num + " and cacheLine_code like '%" + wcsdevice_code + "%'").uniqueResult(0);
// 状态设置为空位
json.put("is_empty", "1");
json.put("vehicle_code", "");
positionTab.update(json);
}
/** /**
* 出入空箱,出入类型 inOut_type 1 入空箱 2 出空箱 缓存线编码 wcsdevice_code 料箱码 vehicle_code * 出入空箱,出入类型 inOut_type 1 入空箱 2 出空箱 缓存线编码 wcsdevice_code 料箱码 vehicle_code
* *
@@ -546,26 +545,27 @@ public class CacheLineHandServiceImpl implements CacheLineHandService {
* 缓存线位置编码 position_code * 缓存线位置编码 position_code
*/ */
@Override @Override
public JSONArray cacheLineOutBoxExceptionQuery(JSONObject param) { public List<Map> cacheLineOutBoxExceptionQuery(JSONObject param) {
String wcsdevice_code = param.getString("wcsdevice_code"); String wcsdevice_code = param.getString("wcsdevice_code");
String position_code = param.getString("position_code"); String position_code = param.getString("position_code");
//根据缓存线编码和缓存线点位查找任务ID //根据缓存线编码和缓存线点位查找任务ID
JSONObject posiObj = WQLObject.getWQLObject("sch_cacheline_position").query("cacheLine_code = '" + wcsdevice_code + "' and position_code = '" + position_code + "'").uniqueResult(0);
SchCachelinePosition cachelinePosition = positionService.getOne(new QueryWrapper<SchCachelinePosition>().eq("cacheLine_code", wcsdevice_code).eq("position_code", position_code));
//查不到点位信息 //查不到点位信息
if (null == posiObj) { if (ObjectUtil.isEmpty(cachelinePosition)) {
throw new BadRequestException("未找到该缓存线的点位信息!"); throw new BadRequestException("未找到该缓存线的点位信息!");
} }
//查不到任务信息 //查不到任务信息
if (StringUtils.isBlank(posiObj.getString("task_code"))) { if (StrUtil.isEmpty(cachelinePosition.getTask_code())) {
throw new BadRequestException("未找到该缓存线的点位的任务信息!"); throw new BadRequestException("未找到该缓存线的点位的任务信息!");
} }
JSONArray jsonArray = WQL.getWO("PDA_QUERY").addParam("flag", "10").addParam("task_code", posiObj.getString("task_code")).process().getResultJSONArray(0); //JSONArray jsonArray = WQL.getWO("PDA_QUERY").addParam("flag", "10").addParam("task_code", posiObj.getString("task_code")).process().getResultJSONArray(0);
List<Map> task_list = taskMapper.getTaskInfo(MapOf.of("task_code", cachelinePosition.getTask_code()));
//缓存线编码 //缓存线编码
for (int i = 0; i < jsonArray.size(); i++) { task_list.forEach(task -> {
JSONObject row = jsonArray.getJSONObject(i); task.put("wcsdevice_code", wcsdevice_code);
row.put("wcsdevice_code", wcsdevice_code); });
} return task_list;
return jsonArray;
} }
/** /**
@@ -576,54 +576,53 @@ public class CacheLineHandServiceImpl implements CacheLineHandService {
* 料箱码 vehicle_code * 料箱码 vehicle_code
*/ */
@Override @Override
public CommonResult<Integer> cacheLineOutBoxExceptionConfirm(JSONObject param) { public JSONObject cacheLineOutBoxExceptionConfirm(JSONObject param) {
String inOut_type = param.getString("inOut_type"); String inOut_type = param.getString("inOut_type");
String cacheLine_code = param.getString("wcsdevice_code"); String cacheLine_code = param.getString("wcsdevice_code");
String position_code = param.getString("position_code"); String position_code = param.getString("position_code");
String vehicle_code = param.getString("vehicle_code"); String vehicle_code = param.getString("vehicle_code");
//缓存线位置表
WQLObject positionTab = WQLObject.getWQLObject("sch_cacheline_position");
// 缓存线载具物料表
WQLObject ivtTab = WQLObject.getWQLObject("sch_cacheline_vehilematerial");
//1.确定缓存线点位 //1.确定缓存线点位
JSONObject vehiobj = positionTab.query("position_code = '" + position_code + "' and cacheLine_code = '" + cacheLine_code + "'").uniqueResult(0); SchCachelinePosition vehiobj = positionService.getOne(new QueryWrapper<SchCachelinePosition>().eq("position_code", position_code));
//2.绑定新料箱条码(入满箱或者入空箱),设置缓存线点位不为空 //2.绑定新料箱条码(入满箱或者入空箱),设置缓存线点位不为空
vehiobj.put("vehicle_code", vehicle_code); vehiobj.setVehicle_code(vehicle_code);
vehiobj.put("is_empty", "0"); vehiobj.setIs_empty("0");
//非雪花算法生产的ID为主键数据更新下需要拼接条件 positionService.updateById(vehiobj);
positionTab.update(vehiobj, "position_code = '" + position_code + "'");
//3.删除入料箱之前的所有关联信息,包括物料,工序,生产区域 //3.删除入料箱之前的所有关联信息,包括物料,工序,生产区域
ivtTab.delete("vehicle_code = '" + vehicle_code + "'"); vehilematerialService.removeByMap(MapOf.of("vehicle_code", vehicle_code));
//4.初始化料箱 //4.初始化料箱
HashMap<String, String> json = new HashMap<>(); JSONObject json = new JSONObject();
json.put("vehicle_code", vehicle_code); json.put("vehicle_code", vehicle_code);
json.put("cacheLine_code", cacheLine_code); json.put("cacheLine_code", cacheLine_code);
json.put("vehmaterial_id", IdUtil.getStringId()); json.put("vehmaterial_id", IdUtil.getStringId());
json.put("create_time", DateUtil.now()); json.put("create_time", DateUtil.now());
// 出空箱入满箱扫码异常 // 出空箱入满箱扫码异常
if (StatusEnum.OUT_VEHICLE.getCode().equals(inOut_type)) { if (StatusEnum.OUT_VEHICLE.getCode().equals(inOut_type)) {
//5.通过缓存线位置表当前执行任务id获取任务信息中的物料信息 //5.通过缓存线位置表当前执行任务id获取任务信息中的物料信息
JSONObject positionInfo = positionTab.query("vehicle_code = '" + vehicle_code + "'").uniqueResult(0); SchCachelinePosition positionInfo = positionService.getOne(new QueryWrapper<SchCachelinePosition>().eq("vehicle_code", vehicle_code));
//查不到点位信息 //查不到点位信息
if (null == positionInfo) { if (ObjectUtil.isEmpty(positionInfo)) {
throw new BadRequestException("未找到该缓存线的点位信息!"); throw new BadRequestException("未找到该缓存线的点位信息!");
} }
//获取当前任务信息 //获取当前任务信息
JSONObject instructObj = WQLObject.getWQLObject("sch_base_task").query("task_code = '" + positionInfo.getString("task_code") + "'").uniqueResult(0); SchBaseTask instructObj = taskService.getOne(new QueryWrapper<SchBaseTask>().eq("task_code", positionInfo.getTask_code()));
//查不到点位信息 //查不到点位信息
if (null == instructObj) { if (ObjectUtil.isEmpty(instructObj)) {
throw new BadRequestException("未找到该任务信息!"); throw new BadRequestException("未找到该任务信息!");
} }
//获取物料信息 //获取物料信息
JSONObject meObj = WQLObject.getWQLObject("md_me_materialbase").query("material_id = '" + instructObj.get("material_id") + "'").uniqueResult(0); MdMeMaterialbase mater = materialbaseService.getOne(new QueryWrapper<MdMeMaterialbase>().eq("material_id", instructObj.getMaterial_id()));
//查不到点位信息 if (ObjectUtil.isEmpty(mater)) {
if (null == meObj) { throw new BadRequestException("物料查询错误,请检查物料");
throw new BadRequestException("未找到该物料信息!");
} }
//6.重新新建该缓存线位置上的料箱为满箱及所属工序,生产区域等信息 //6.重新新建该缓存线位置上的料箱为满箱及所属工序,生产区域等信息
json.put("material_id", meObj.getString("material_id")); json.put("material_id", mater.getMaterial_id());
json.put("quantity", instructObj.getString("material_qty")); json.put("quantity", instructObj.getMaterial_qty());
json.put("product_area", instructObj.getString("product_area")); json.put("product_area", instructObj.getProduct_area());
json.put("vehicle_status", StatusEnum.CACHE_VEL_EMT.getCode()); json.put("vehicle_status", StatusEnum.CACHE_VEL_EMT.getCode());
} }
// 出满箱入空箱 // 出满箱入空箱
@@ -638,7 +637,12 @@ public class CacheLineHandServiceImpl implements CacheLineHandService {
json.put("workprocedure_name", ""); json.put("workprocedure_name", "");
json.put("product_area", ""); json.put("product_area", "");
} }
return RestBusinessTemplate.execute(() -> ivtTab.insert(json).getSucess());
vehilematerialService.save(json.toJavaObject(SchCachelineVehilematerial.class));
JSONObject res = new JSONObject();
res.put("message", "设置成功");
return res;
} }
/** /**
@@ -673,12 +677,11 @@ public class CacheLineHandServiceImpl implements CacheLineHandService {
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
// 1 扫码异常-入箱扫码 2 出箱扫码 // 1 扫码异常-入箱扫码 2 出箱扫码
jsonObject.put("type", type); jsonObject.put("type", type);
jsonObject.put("position_code", position_code); // jsonObject.put("position_code", position_code);
jsonObject.put("device_code", device_code); jsonObject.put("device_code", device_code);
jsonObject.put("vehicle_code", vehicle_code); jsonObject.put("vehicle_code", vehicle_code);
jsonArray.add(jsonObject);
try { try {
return RestBusinessTemplate.execute(() -> AcsUtil.notifyAcs("api/wms/issuedBarcode", jsonArray)); return RestBusinessTemplate.execute(() -> AcsUtil.notifyAcs("api/wms/issuedBarcode", jsonObject));
} catch (NullPointerException e) { } catch (NullPointerException e) {
throw new BadRequestException(e.toString()); throw new BadRequestException(e.toString());
} }
@@ -873,10 +876,21 @@ public class CacheLineHandServiceImpl implements CacheLineHandService {
public JSONObject deleteBox(JSONObject param) { public JSONObject deleteBox(JSONObject param) {
JSONObject res = new JSONObject(); JSONObject res = new JSONObject();
res.put("message", "删除失败"); res.put("message", "删除失败");
WQLObject cvTab = WQLObject.getWQLObject("SCH_CacheLine_VehileMaterial");
String vehicleCode = param.getString("vehicle_code"); String vehicleCode = param.getString("vehicle_code");
String position_code = param.getString("position_code");
if (ObjectUtil.isNotEmpty(vehicleCode)) { if (ObjectUtil.isNotEmpty(vehicleCode)) {
cvTab.delete("vehicle_code = '" + vehicleCode + "'"); //删除载具物料表
vehilematerialService.removeByMap(MapOf.of("vehicle_code", vehicleCode));
//维护点位的载具字段
SchCachelinePosition vehiobj = positionService.getOne(new QueryWrapper<SchCachelinePosition>().eq("position_code", position_code));
if (ObjectUtil.isEmpty(vehiobj)) {
throw new BadRequestException("位置不存在,设置有误!");
}
//缓存线位置通过扫码绑定料箱条码
vehiobj.setVehicle_code("");
positionService.updateById(vehiobj);
res.put("message", "删除成功"); res.put("message", "删除成功");
} }
return res; return res;

View File

@@ -1,6 +1,8 @@
package org.nl.wms.scheduler_manage.service.cacheline.dao; package org.nl.wms.scheduler_manage.service.cacheline.dao;
import java.math.BigDecimal; import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable; import java.io.Serializable;
import lombok.Data; import lombok.Data;
@@ -24,6 +26,7 @@ public class SchCachelinePosition implements Serializable {
/** /**
* 缓存线位置表-位置编码 * 缓存线位置表-位置编码
*/ */
@TableId(value = "position_code")
private String position_code; private String position_code;
/** /**

View File

@@ -1,6 +1,8 @@
package org.nl.wms.scheduler_manage.service.cacheline.dao; package org.nl.wms.scheduler_manage.service.cacheline.dao;
import java.math.BigDecimal; import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable; import java.io.Serializable;
import lombok.Data; import lombok.Data;
@@ -24,6 +26,7 @@ public class SchCachelineVehicle implements Serializable {
/** /**
* 缓存线载具表-编码 * 缓存线载具表-编码
*/ */
@TableId(value = "vehicle_code")
private String vehicle_code; private String vehicle_code;
/** /**

View File

@@ -1,6 +1,8 @@
package org.nl.wms.scheduler_manage.service.cacheline.dao; package org.nl.wms.scheduler_manage.service.cacheline.dao;
import java.math.BigDecimal; import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable; import java.io.Serializable;
import lombok.Data; import lombok.Data;
@@ -24,6 +26,7 @@ public class SchCachelineVehilematerial implements Serializable {
/** /**
* 载具物料表-物料标识 * 载具物料表-物料标识
*/ */
@TableId(value = "vehmaterial_id")
private String vehmaterial_id; private String vehmaterial_id;
/** /**

View File

@@ -1,8 +1,12 @@
package org.nl.wms.scheduler_manage.service.task.dao.mapper; package org.nl.wms.scheduler_manage.service.task.dao.mapper;
import org.apache.ibatis.annotations.Param;
import org.nl.wms.scheduler_manage.service.task.dao.SchBaseTask; import org.nl.wms.scheduler_manage.service.task.dao.SchBaseTask;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
import java.util.Map;
/** /**
* <p> * <p>
* 任务表 Mapper 接口 * 任务表 Mapper 接口
@@ -13,4 +17,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/ */
public interface SchBaseTaskMapper extends BaseMapper<SchBaseTask> { public interface SchBaseTaskMapper extends BaseMapper<SchBaseTask> {
List<Map> getTaskInfo (@Param("map") Map map);
} }

View File

@@ -2,4 +2,33 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.nl.wms.scheduler_manage.service.task.dao.mapper.SchBaseTaskMapper"> <mapper namespace="org.nl.wms.scheduler_manage.service.task.dao.mapper.SchBaseTaskMapper">
<select id="getTaskInfo" resultType="java.util.Map">
SELECT
task.task_id AS instruct_uuid,
task.task_code AS instructoperate_num,
task.task_name,
task.product_area,
class.class_name task_type,
task.vehicle_code,
task.vehicle_code2 AS outvehicle_code,
task.create_time,
dict.label AS status_name,
mater.material_code AS processmaterial_code,
point1.point_name AS startpoint_code,
point2.point_name AS nextpoint_code
FROM
sch_base_task task
LEFT JOIN sch_base_point point1 ON task.point_code1 = point1.point_code
LEFT JOIN sch_base_point point2 ON task.point_code2 = point2.point_code
LEFT JOIN md_me_materialbase mater ON task.material_id = mater.material_id
LEFT JOIN md_pb_classstandard class ON task.task_type = class.class_id
LEFT JOIN sys_dict dict ON dict.`value` = task.task_status AND dict.`code` = 'task_status'
<where>
task.is_delete = '0'
<if test="map.task_code != null and map.task_code != ''">
task.task_code = #{map.task_code}
</if>
</where>
</select>
</mapper> </mapper>