rev:修改缓存线点位表task_id为task_code
This commit is contained in:
@@ -220,7 +220,6 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService{
|
||||
public List<DeviceDto> getDeviceList(String param) {
|
||||
List<DeviceDto> deviceList = WQL.getWO("ONEPART_QUERY").addParam("flag", "1").addParam("condition", param).process().getResultJSONArray(0).toJavaList(DeviceDto.class);
|
||||
List<DeviceDto> jobCountList = WQL.getWO("ONEPART_QUERY").addParam("flag", "3").process().getResultJSONArray(0).toJavaList(DeviceDto.class);
|
||||
Optional<List<DeviceDto>> jobCountLists = Optional.of(jobCountList);
|
||||
deviceList.forEach(r -> {
|
||||
//获取当前工单数
|
||||
Optional<DeviceDto> jobCount = jobCountList.stream().filter(j -> j.getDeviceCode().equals(r.getDeviceCode())).findFirst();
|
||||
@@ -236,6 +235,7 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService{
|
||||
if(!Objects.equals(r.getDevice_status(), StatusEnum.DEVICE_STATUS_OFF.getCode()) && !Objects.equals(r.getDevice_status(), StatusEnum.DEVICE_STATUS_ERROR.getCode())) {
|
||||
r.setIs_run("1");
|
||||
}
|
||||
//关机和故障则是不运行
|
||||
else{
|
||||
r.setIs_run("0");
|
||||
}
|
||||
|
||||
@@ -174,26 +174,6 @@ public class CacheLineHandController{
|
||||
return new ResponseEntity<>(cacheLineHandService.cacheLineOutBoxExceptionConfirm(param), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/cacheLineMaterInfoQuery")
|
||||
@Log("缓存线料箱条码查询料箱信息")
|
||||
@ApiOperation("缓存线料箱条码查询料箱信息")
|
||||
public ResponseEntity<JSONArray> cacheLineMaterInfoQuery(@RequestBody JSONObject param) {
|
||||
log.info("海亮缓存线手持服务 [缓存线料箱条码查询料箱信息] 接口被请求, 请求参数-{}", param);
|
||||
return new ResponseEntity<>(cacheLineHandService.cacheLineMaterInfoQuery(param), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/inOutEmptyBox")
|
||||
@Log("空箱初始化--出入空箱")
|
||||
@ApiOperation("空箱初始化--出入空箱")
|
||||
public ResponseEntity<Object> inOutEmptyBox(@RequestBody JSONObject param) {
|
||||
log.info("海亮缓存线手持服务 [空箱初始化--出入空箱] 接口被请求, 请求参数-{}", param);
|
||||
//参数校验
|
||||
if(StringUtils.isEmpty(param.getString("inOut_type")) || StringUtils.isEmpty(param.getString("wcsdevice_code")) || StringUtils.isEmpty(param.getString("vehicle_code"))) {
|
||||
throw new BizCoreException(ResultCode.VALIDATE_FAILED);
|
||||
}
|
||||
return new ResponseEntity<>(cacheLineHandService.inOutEmptyBox(param), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/inOutExceptionInstQuery")
|
||||
@Log("缓存线扫码异常-查询")
|
||||
@ApiOperation("缓存线扫码异常-查询")
|
||||
@@ -218,6 +198,26 @@ public class CacheLineHandController{
|
||||
return new ResponseEntity<>(cacheLineHandService.inOutExceptionInstConfirm(param), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/cacheLineMaterInfoQuery")
|
||||
@Log("缓存线料箱条码查询料箱信息")
|
||||
@ApiOperation("缓存线料箱条码查询料箱信息")
|
||||
public ResponseEntity<JSONArray> cacheLineMaterInfoQuery(@RequestBody JSONObject param) {
|
||||
log.info("海亮缓存线手持服务 [缓存线料箱条码查询料箱信息] 接口被请求, 请求参数-{}", param);
|
||||
return new ResponseEntity<>(cacheLineHandService.cacheLineMaterInfoQuery(param), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/inOutEmptyBox")
|
||||
@Log("空箱初始化--出入空箱")
|
||||
@ApiOperation("空箱初始化--出入空箱")
|
||||
public ResponseEntity<Object> inOutEmptyBox(@RequestBody JSONObject param) {
|
||||
log.info("海亮缓存线手持服务 [空箱初始化--出入空箱] 接口被请求, 请求参数-{}", param);
|
||||
//参数校验
|
||||
if(StringUtils.isEmpty(param.getString("inOut_type")) || StringUtils.isEmpty(param.getString("wcsdevice_code")) || StringUtils.isEmpty(param.getString("vehicle_code"))) {
|
||||
throw new BizCoreException(ResultCode.VALIDATE_FAILED);
|
||||
}
|
||||
return new ResponseEntity<>(cacheLineHandService.inOutEmptyBox(param), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/setfullBox")
|
||||
@Log("设置满框")
|
||||
@ApiOperation("设置满框")
|
||||
|
||||
@@ -534,6 +534,107 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
|
||||
return RestBusinessTemplate.execute(() -> finalResult);
|
||||
}
|
||||
|
||||
/**
|
||||
* 缓存线出箱异常-查询
|
||||
* 缓存线编码 wcsdevice_code
|
||||
* 缓存线位置编码 position_code
|
||||
*/
|
||||
@Override
|
||||
public JSONArray cacheLineOutBoxExceptionQuery(JSONObject param) {
|
||||
String wcsdevice_code = param.getString("wcsdevice_code");
|
||||
String position_code = param.getString("position_code");
|
||||
//根据缓存线编码和缓存线点位查找任务ID
|
||||
JSONObject posiObj = WQLObject.getWQLObject("sch_cacheline_position").query("cacheLine_code = '" + wcsdevice_code + "' and position_code = '" + position_code + "'").uniqueResult(0);
|
||||
//查不到点位信息
|
||||
if(null == posiObj) {
|
||||
throw new BadRequestException("未找到该缓存线的点位信息!");
|
||||
}
|
||||
//查不到任务信息
|
||||
if(StringUtils.isEmpty(posiObj.getString("task_code"))) {
|
||||
throw new BadRequestException("未找到该缓存线的点位的任务信息!");
|
||||
}
|
||||
JSONArray jsonArray = WQL.getWO("PDA_QUERY").addParam("flag", "10").addParam("task_code", posiObj.getString("task_code")).process().getResultJSONArray(0);
|
||||
//缓存线编码
|
||||
for(int i = 0; i < jsonArray.size(); i++) {
|
||||
JSONObject row = jsonArray.getJSONObject(i);
|
||||
row.put("wcsdevice_code", wcsdevice_code);
|
||||
}
|
||||
return jsonArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* 缓存线出箱异常确认
|
||||
* 出入类型 inOut_type:1.入满箱异常,2.出满箱异常
|
||||
* 缓存线位置编码 wcsdevice_code
|
||||
* 缓存线点位编码 position_code
|
||||
* 料箱码 vehicle_code
|
||||
*/
|
||||
@Override
|
||||
public CommonResult<Integer> cacheLineOutBoxExceptionConfirm(JSONObject param) {
|
||||
String inOut_type = param.getString("inOut_type");
|
||||
String cacheLine_code = param.getString("wcsdevice_code");
|
||||
String position_code = param.getString("position_code");
|
||||
String vehicle_code = param.getString("vehicle_code");
|
||||
//缓存线位置表
|
||||
WQLObject positionTab = WQLObject.getWQLObject("sch_cacheline_position");
|
||||
// 缓存线载具物料表
|
||||
WQLObject ivtTab = WQLObject.getWQLObject("sch_cacheline_vehilematerial");
|
||||
//1.确定缓存线点位
|
||||
JSONObject vehiobj = positionTab.query("position_code = '" + position_code + "' and cacheLine_code = '" + cacheLine_code + "'").uniqueResult(0);
|
||||
//2.绑定新料箱条码(入满箱或者入空箱),设置缓存线点位不为空
|
||||
vehiobj.put("vehicle_code", vehicle_code);
|
||||
vehiobj.put("is_empty", "0");
|
||||
//非雪花算法生产的ID为主键数据更新下需要拼接条件
|
||||
positionTab.update(vehiobj, "position_code = '" + position_code + "'");
|
||||
//3.删除入料箱之前的所有关联信息,包括物料,工序,生产区域
|
||||
ivtTab.delete("vehicle_code = '" + vehicle_code + "'");
|
||||
//4.初始化料箱
|
||||
HashMap<String,String> json = new HashMap<>();
|
||||
json.put("vehicle_code", vehicle_code);
|
||||
json.put("cacheLine_code", cacheLine_code);
|
||||
json.put("vehmaterial_id", IdUtil.getStringId());
|
||||
json.put("create_time", DateUtil.now());
|
||||
// 出空箱入满箱扫码异常
|
||||
if(StatusEnum.OUT_VEHICLE.getCode().equals(inOut_type)) {
|
||||
//5.通过缓存线位置表当前执行任务id,获取任务信息中的物料信息
|
||||
JSONObject positionInfo = positionTab.query("vehicle_code = '" + vehicle_code + "'").uniqueResult(0);
|
||||
//查不到点位信息
|
||||
if(null == positionInfo) {
|
||||
throw new BadRequestException("未找到该缓存线的点位信息!");
|
||||
}
|
||||
//获取当前任务信息
|
||||
JSONObject instructObj = WQLObject.getWQLObject("sch_base_task").query("task_code = '" + positionInfo.getString("task_code") + "'").uniqueResult(0);
|
||||
//查不到点位信息
|
||||
if(null == instructObj) {
|
||||
throw new BadRequestException("未找到该任务信息!");
|
||||
}
|
||||
//获取物料信息
|
||||
JSONObject meObj = WQLObject.getWQLObject("md_me_materialbase").query("material_id = '" + instructObj.get("material_id") + "'").uniqueResult(0);
|
||||
//查不到点位信息
|
||||
if(null == meObj) {
|
||||
throw new BadRequestException("未找到该物料信息!");
|
||||
}
|
||||
//6.重新新建该缓存线位置上的料箱为满箱及所属工序,生产区域等信息
|
||||
json.put("material_id", meObj.getString("material_id"));
|
||||
json.put("quantity", instructObj.getString("material_qty"));
|
||||
json.put("product_area", instructObj.getString("product_area"));
|
||||
json.put("vehicle_status", StatusEnum.CACHE_VEL_EMT.getCode());
|
||||
}
|
||||
// 出满箱入空箱
|
||||
if(StatusEnum.IN_VEHICLE.getCode().equals(inOut_type)) {
|
||||
//5.重新新建该缓存线位置上的料箱为空箱子,是空料箱没有放物料等其他信息
|
||||
//缓存线载具状态 1-空位、2-绿色空箱、3-黄色满箱、4-红色异常、5不显示
|
||||
json.put("vehicle_status", StatusEnum.STATUS_TRUE.getCode());
|
||||
json.put("material_id", "");
|
||||
json.put("weight", "0");
|
||||
json.put("quantity", "0");
|
||||
json.put("workprocedure_code", "");
|
||||
json.put("workprocedure_name", "");
|
||||
json.put("product_area", "");
|
||||
}
|
||||
return RestBusinessTemplate.execute(() -> ivtTab.insert(json).getSucess());
|
||||
}
|
||||
|
||||
/**
|
||||
* 缓存线扫码异常-查询
|
||||
*/
|
||||
@@ -607,107 +708,6 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 缓存线出箱异常-查询
|
||||
* 缓存线编码 wcsdevice_code
|
||||
* 缓存线位置编码 position_code
|
||||
*/
|
||||
@Override
|
||||
public JSONArray cacheLineOutBoxExceptionQuery(JSONObject param) {
|
||||
String wcsdevice_code = param.getString("wcsdevice_code");
|
||||
String position_code = param.getString("position_code");
|
||||
//根据缓存线编码和缓存线点位查找任务ID
|
||||
JSONObject posiObj = WQLObject.getWQLObject("sch_cacheline_position").query("cacheLine_code = '" + wcsdevice_code + "' and position_code = '" + position_code + "'").uniqueResult(0);
|
||||
//查不到点位信息
|
||||
if(null == posiObj) {
|
||||
throw new BadRequestException("未找到该缓存线的点位信息!");
|
||||
}
|
||||
//查不到任务信息
|
||||
if(StringUtils.isEmpty(posiObj.getString("task_code"))) {
|
||||
throw new BadRequestException("未找到该缓存线的点位的任务信息!");
|
||||
}
|
||||
JSONArray jsonArray = WQL.getWO("PDA_QUERY").addParam("flag", "10").addParam("task_code", posiObj.getString("task_code")).process().getResultJSONArray(0);
|
||||
//缓存线编码
|
||||
for(int i = 0; i < jsonArray.size(); i++) {
|
||||
JSONObject row = jsonArray.getJSONObject(i);
|
||||
row.put("wcsdevice_code", wcsdevice_code);
|
||||
}
|
||||
return jsonArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* 缓存线出箱异常确认
|
||||
* 出入类型 inOut_type:1.入满箱异常,2.出满箱异常
|
||||
* 缓存线位置编码 wcsdevice_code
|
||||
* 缓存线点位编码 position_code
|
||||
* 料箱码 vehicle_code
|
||||
*/
|
||||
@Override
|
||||
public CommonResult<Integer> cacheLineOutBoxExceptionConfirm(JSONObject param) {
|
||||
String inOut_type = param.getString("inOut_type");
|
||||
String cacheLine_code = param.getString("wcsdevice_code");
|
||||
String position_code = param.getString("position_code");
|
||||
String vehicle_code = param.getString("vehicle_code");
|
||||
//缓存线位置表
|
||||
WQLObject positionTab = WQLObject.getWQLObject("sch_cacheline_position");
|
||||
// 缓存线载具物料表
|
||||
WQLObject ivtTab = WQLObject.getWQLObject("sch_cacheline_vehilematerial");
|
||||
//1.确定缓存线点位
|
||||
JSONObject vehiobj = positionTab.query("vehicle_code = '" + vehicle_code + "' and cacheLine_code = '" + cacheLine_code + "'").uniqueResult(0);
|
||||
//2.绑定新料箱条码(入满箱或者入空箱),设置缓存线点位不为空
|
||||
vehiobj.put("vehicle_code", vehicle_code);
|
||||
vehiobj.put("is_empty", "0");
|
||||
//非雪花算法生产的ID为主键数据更新下需要拼接条件
|
||||
positionTab.update(vehiobj, "position_code = '" + position_code + "'");
|
||||
//3.删除入料箱之前的所有关联信息,包括物料,工序,生产区域
|
||||
ivtTab.delete("vehicle_code = '" + vehicle_code + "'");
|
||||
//4.初始化料箱
|
||||
HashMap<String,String> json = new HashMap<>();
|
||||
json.put("vehicle_code", vehicle_code);
|
||||
json.put("cacheLine_code", cacheLine_code);
|
||||
json.put("vehmaterial_id", IdUtil.getStringId());
|
||||
json.put("create_time", DateUtil.now());
|
||||
// 入满箱扫码异常
|
||||
if(StatusEnum.IN_VEHICLE.getCode().equals(inOut_type)) {
|
||||
//5.通过缓存线位置表当前执行任务id,获取任务信息中的物料信息
|
||||
JSONObject positionInfo = positionTab.query("vehicle_code = '" + vehicle_code + "'").uniqueResult(0);
|
||||
//查不到点位信息
|
||||
if(null == positionInfo) {
|
||||
throw new BadRequestException("未找到该缓存线的点位信息!");
|
||||
}
|
||||
//获取当前任务信息
|
||||
JSONObject instructObj = WQLObject.getWQLObject("sch_base_task").query("task_code = '" + positionInfo.getString("task_code") + "'").uniqueResult(0);
|
||||
//查不到点位信息
|
||||
if(null == instructObj) {
|
||||
throw new BadRequestException("未找到该任务信息!");
|
||||
}
|
||||
//获取物料信息
|
||||
JSONObject meObj = WQLObject.getWQLObject("md_me_materialbase").query("material_id = '" + instructObj.get("material_id") + "'").uniqueResult(0);
|
||||
//查不到点位信息
|
||||
if(null == meObj) {
|
||||
throw new BadRequestException("未找到该物料信息!");
|
||||
}
|
||||
//6.重新新建该缓存线位置上的料箱为满箱及所属工序,生产区域等信息
|
||||
json.put("material_id", meObj.getString("material_id"));
|
||||
json.put("quantity", instructObj.getString("material_qty"));
|
||||
json.put("product_area", instructObj.getString("product_area"));
|
||||
json.put("vehicle_status", StatusEnum.CACHE_VEL_EMT.getCode());
|
||||
}
|
||||
// 出满箱扫码异常
|
||||
if(StatusEnum.OUT_VEHICLE.getCode().equals(inOut_type)) {
|
||||
//5.重新新建该缓存线位置上的料箱为空箱子,是空料箱没有放物料等其他信息
|
||||
//缓存线载具状态 1-空位、2-绿色空箱、3-黄色满箱、4-红色异常、5不显示
|
||||
json.put("vehicle_status", StatusEnum.STATUS_TRUE.getCode());
|
||||
json.put("material_id", "");
|
||||
json.put("weight", "0");
|
||||
json.put("quantity", "0");
|
||||
json.put("workprocedure_code", "");
|
||||
json.put("workprocedure_name", "");
|
||||
json.put("product_area", "");
|
||||
}
|
||||
return RestBusinessTemplate.execute(() -> ivtTab.insert(json).getSucess());
|
||||
}
|
||||
|
||||
/**
|
||||
* AGV入箱子异常,(怎么判断入箱子异常) 缓存线编码 wcsdevice_code 满箱码 vehicle_code
|
||||
*/
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user