|
@ -3,6 +3,7 @@ package org.nl.b_lms.pda.service.impl; |
|
|
import cn.hutool.core.date.DateUtil; |
|
|
import cn.hutool.core.date.DateUtil; |
|
|
import cn.hutool.core.util.IdUtil; |
|
|
import cn.hutool.core.util.IdUtil; |
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
import cn.hutool.http.HttpStatus; |
|
|
import cn.hutool.http.HttpStatus; |
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import com.alibaba.fastjson.JSONObject; |
|
@ -27,7 +28,6 @@ import org.nl.modules.common.exception.BadRequestException; |
|
|
import org.nl.modules.wql.core.bean.WQLObject; |
|
|
import org.nl.modules.wql.core.bean.WQLObject; |
|
|
import org.nl.system.service.dict.dao.Dict; |
|
|
import org.nl.system.service.dict.dao.Dict; |
|
|
import org.nl.system.service.dict.dao.mapper.SysDictMapper; |
|
|
import org.nl.system.service.dict.dao.mapper.SysDictMapper; |
|
|
import org.nl.wms.basedata.master.service.dto.MaterialbaseDto; |
|
|
|
|
|
import org.nl.wms.ext.acs.service.WmsToAcsService; |
|
|
import org.nl.wms.ext.acs.service.WmsToAcsService; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
@ -127,7 +127,7 @@ public class StockingIvtServiceImpl implements StockingIvtService { |
|
|
log.info("手持入管芯库的数据:{}", jo); |
|
|
log.info("手持入管芯库的数据:{}", jo); |
|
|
String pointCode = jo.getString("point_code"); |
|
|
String pointCode = jo.getString("point_code"); |
|
|
String vehicleCode = jo.getString("vehicle_code"); |
|
|
String vehicleCode = jo.getString("vehicle_code"); |
|
|
//入库,operate_type=1
|
|
|
//托盘入库operate_type=1;托盘出库operate_type=0
|
|
|
String operate_type = jo.getString("operate_type"); |
|
|
String operate_type = jo.getString("operate_type"); |
|
|
|
|
|
|
|
|
BstIvtStockingivt pointByCode = stockingivtService.getPointByCode(pointCode, true); |
|
|
BstIvtStockingivt pointByCode = stockingivtService.getPointByCode(pointCode, true); |
|
@ -140,10 +140,12 @@ public class StockingIvtServiceImpl implements StockingIvtService { |
|
|
if (!vehicleCode.contains("GX")) { |
|
|
if (!vehicleCode.contains("GX")) { |
|
|
throw new BadRequestException("请扫描或输入正确的托盘码!"); |
|
|
throw new BadRequestException("请扫描或输入正确的托盘码!"); |
|
|
} |
|
|
} |
|
|
|
|
|
//管芯入库
|
|
|
|
|
|
if(operate_type.equals("1")){ |
|
|
//点位类型必须为入库点,point_type = 0
|
|
|
//点位类型必须为入库点,point_type = 0
|
|
|
String point_type = pointByCode.getPoint_type(); |
|
|
String point_type = pointByCode.getPoint_type(); |
|
|
if (!point_type.equals("0")) { |
|
|
if (!point_type.equals("0")) { |
|
|
throw new BadRequestException("请扫描管芯库入库点!"); |
|
|
throw new BadRequestException("请扫描一楼管芯库入库限位点!"); |
|
|
} |
|
|
} |
|
|
//校验所扫点位上托盘是否和扫码托盘一致
|
|
|
//校验所扫点位上托盘是否和扫码托盘一致
|
|
|
if (!vehicleCode.equals(pointByCode.getVehicle_code())) { |
|
|
if (!vehicleCode.equals(pointByCode.getVehicle_code())) { |
|
@ -164,13 +166,50 @@ public class StockingIvtServiceImpl implements StockingIvtService { |
|
|
param.put("point_code1", pointByCode.getPoint_code()); |
|
|
param.put("point_code1", pointByCode.getPoint_code()); |
|
|
param.put("point_code2", endPoint.getPoint_code()); |
|
|
param.put("point_code2", endPoint.getPoint_code()); |
|
|
param.put("vehicle_code", vehicleCode); |
|
|
param.put("vehicle_code", vehicleCode); |
|
|
|
|
|
param.put("operate_type", operate_type); |
|
|
param.put("task_type", SlitterEnum.TASK_TYPE.code("托盘入管芯库任务")); |
|
|
param.put("task_type", SlitterEnum.TASK_TYPE.code("托盘入管芯库任务")); |
|
|
param.put("product_area", SlitterConstant.SLITTER_TASK_AREA); |
|
|
param.put("product_area", SlitterConstant.SLITTER_TASK_AREA); |
|
|
instorStockAgvTask.createTask(param); |
|
|
instorStockAgvTask.createTask(param); |
|
|
|
|
|
}else if(operate_type.equals("0")){ |
|
|
|
|
|
//空盘回收
|
|
|
|
|
|
//点位类型必须为入库点,point_type = 0
|
|
|
|
|
|
String point_type = pointByCode.getPoint_type(); |
|
|
|
|
|
if (!point_type.equals("3")) { |
|
|
|
|
|
throw new BadRequestException("请扫描二楼备货区点位!"); |
|
|
|
|
|
} |
|
|
|
|
|
//校验所扫点位上托盘是否和扫码托盘一致
|
|
|
|
|
|
if (!vehicleCode.equals(pointByCode.getVehicle_code())) { |
|
|
|
|
|
throw new BadRequestException("点位:"+pointCode+"已存在托盘"+pointByCode.getVehicle_code()+",与扫码托盘不一致!"); |
|
|
|
|
|
} |
|
|
|
|
|
//判断是否已经下发了任务
|
|
|
|
|
|
JSONObject task1 = isSingleTask(pointCode); |
|
|
|
|
|
if ( ObjectUtil.isNotEmpty(task1)) { |
|
|
|
|
|
throw new BadRequestException("点位:" + pointCode + "存在未完成的任务:"+task1.getString("task_code")); |
|
|
|
|
|
} |
|
|
|
|
|
//生成空盘回收任务,两个点
|
|
|
|
|
|
List<BstIvtStockingivt> list = stockingivtService.getEmptyPointNotTask("0"); |
|
|
|
|
|
//优先分配一楼入库限位点,若没有再查询一楼管芯库点
|
|
|
|
|
|
if (list.size() == 0) { |
|
|
|
|
|
list = stockingivtService.getEmptyPointNotTask("1"); |
|
|
|
|
|
if(list.size() == 0){ |
|
|
|
|
|
throw new BadRequestException("管芯库暂无空闲点位回收空托盘!"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
BstIvtStockingivt endPoint = list.get(0); |
|
|
|
|
|
JSONObject param = new JSONObject(); |
|
|
|
|
|
param.put("point_code1", pointByCode.getPoint_code()); |
|
|
|
|
|
param.put("point_code2", endPoint.getPoint_code()); |
|
|
|
|
|
param.put("vehicle_code", vehicleCode); |
|
|
|
|
|
param.put("operate_type", operate_type); |
|
|
|
|
|
param.put("task_type", SlitterEnum.TASK_TYPE.code("托盘回收任务")); |
|
|
|
|
|
param.put("product_area", SlitterConstant.SLITTER_TASK_AREA); |
|
|
|
|
|
instorStockAgvTask.createTask(param); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JSONObject res = new JSONObject(); |
|
|
JSONObject res = new JSONObject(); |
|
|
res.put("status", HttpStatus.HTTP_OK); |
|
|
res.put("status", HttpStatus.HTTP_OK); |
|
|
res.put("message", "入管芯库任务生成成功!"); |
|
|
res.put("message", "操作成功!"); |
|
|
return res; |
|
|
return res; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -191,6 +230,9 @@ public class StockingIvtServiceImpl implements StockingIvtService { |
|
|
public JSONObject moveStock(JSONObject jo) { |
|
|
public JSONObject moveStock(JSONObject jo) { |
|
|
// param: point_code vehicle_code
|
|
|
// param: point_code vehicle_code
|
|
|
log.info("手持管芯备货的数据:{}", jo); |
|
|
log.info("手持管芯备货的数据:{}", jo); |
|
|
|
|
|
if (ObjectUtil.isEmpty(jo)) { |
|
|
|
|
|
throw new BadRequestException("数据不能为空,请选择一条记录后再操作!"); |
|
|
|
|
|
} |
|
|
String pointCode = jo.getString("point_code"); |
|
|
String pointCode = jo.getString("point_code"); |
|
|
String vehicleCode = jo.getString("vehicle_code"); |
|
|
String vehicleCode = jo.getString("vehicle_code"); |
|
|
|
|
|
|
|
@ -308,11 +350,20 @@ public class StockingIvtServiceImpl implements StockingIvtService { |
|
|
if (ObjectUtil.isNotEmpty(papervehicle) && !papervehicle.getMaterial_code().equals(material_code)) { |
|
|
if (ObjectUtil.isNotEmpty(papervehicle) && !papervehicle.getMaterial_code().equals(material_code)) { |
|
|
throw new BadRequestException("当前排-列已有物料为【" + papervehicle.getMaterial_code() + "】,如需要修改请先清除库存,再进行绑定!"); |
|
|
throw new BadRequestException("当前排-列已有物料为【" + papervehicle.getMaterial_code() + "】,如需要修改请先清除库存,再进行绑定!"); |
|
|
} |
|
|
} |
|
|
|
|
|
//查询当前物料是否和之前排同类型物料,不一致提示报错
|
|
|
|
|
|
List<MdPbPapervehicle> papers = papervehicleService.list(new LambdaQueryWrapper<MdPbPapervehicle>() |
|
|
|
|
|
.eq(MdPbPapervehicle::getVehicle_code, vehicle_code) |
|
|
|
|
|
.eq(MdPbPapervehicle::getRow_num, row_num)); |
|
|
|
|
|
if(papers.size()>0){ |
|
|
|
|
|
if(! StrUtil.equals(papers.get(0).getMaterial_code(), material_code)){ |
|
|
|
|
|
throw new BadRequestException("当前排已有物料为【" + papers.get(0).getMaterial_code() + "】,不允许添加其他类型物料!"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
//查询当前管芯编码是否在托盘中
|
|
|
//查询当前管芯编码是否在托盘中
|
|
|
MdPbPapervehicle papervehicle_flag = papervehicleService.getOne(new LambdaQueryWrapper<MdPbPapervehicle>() |
|
|
MdPbPapervehicle papervehicle_flag = papervehicleService.getOne(new LambdaQueryWrapper<MdPbPapervehicle>() |
|
|
.eq(MdPbPapervehicle::getPaper_code, paper_code)); |
|
|
.eq(MdPbPapervehicle::getPaper_code, paper_code)); |
|
|
if (ObjectUtil.isNotEmpty(papervehicle_flag)) { |
|
|
if (ObjectUtil.isNotEmpty(papervehicle_flag)) { |
|
|
throw new BadRequestException("当前管芯编码已存在托盘上:" + papervehicle_flag.getVehicle_code() + "所在位置排列:"+papervehicle_flag.getRow_num()+"-"+papervehicle_flag.getCol_num()); |
|
|
throw new BadRequestException("当前管芯编码已存在托盘上:" + papervehicle_flag.getVehicle_code() + ",位置排列:"+papervehicle_flag.getRow_num()+"-"+papervehicle_flag.getCol_num()); |
|
|
} |
|
|
} |
|
|
//获取当前纸管的高度
|
|
|
//获取当前纸管的高度
|
|
|
// 解析描述数组
|
|
|
// 解析描述数组
|
|
@ -322,44 +373,30 @@ public class StockingIvtServiceImpl implements StockingIvtService { |
|
|
|
|
|
|
|
|
//校验高度差要大于50MM,否则不允许进行绑定
|
|
|
//校验高度差要大于50MM,否则不允许进行绑定
|
|
|
int num = Integer.parseInt(row_num); |
|
|
int num = Integer.parseInt(row_num); |
|
|
if (num == 1) { |
|
|
if (num > 0) { |
|
|
//只判断第二排的纸管长度
|
|
|
|
|
|
int nextNum = num + 1; |
|
|
|
|
|
MdPbPapervehicle nextPaper = papervehicleService.getOne(new LambdaQueryWrapper<MdPbPapervehicle>().eq(MdPbPapervehicle::getVehicle_code, vehicle_code) |
|
|
|
|
|
.eq(MdPbPapervehicle::getRow_num, nextNum)); |
|
|
|
|
|
if (ObjectUtil.isNotEmpty(nextPaper)) { |
|
|
|
|
|
//获取第二排的纸管高度和纸管类型
|
|
|
|
|
|
String nextMaterialName = nextPaper.getMaterial_name(); |
|
|
|
|
|
String[] nextArray = nextMaterialName.replaceAll("\\|[\\u4e00-\\u9fa5]+$", "").split("\\|"); |
|
|
|
|
|
int nextLength = Integer.parseInt(nextArray[nextArray.length - 1]); |
|
|
|
|
|
if (Math.abs(nextLength - currLength) <= 50 && !material_code.equals(nextPaper.getMaterial_code())) { |
|
|
|
|
|
throw new BadRequestException("相邻排的纸管高度差要大于等于50MM!"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
//判断后一排的纸管高度
|
|
|
//判断后一排的纸管高度
|
|
|
int nextNum = num + 1; |
|
|
int nextNum = num + 1; |
|
|
MdPbPapervehicle nextPaper = papervehicleService.getOne(new LambdaQueryWrapper<MdPbPapervehicle>().eq(MdPbPapervehicle::getVehicle_code, vehicle_code) |
|
|
List<MdPbPapervehicle> nextPaper = papervehicleService.list(new LambdaQueryWrapper<MdPbPapervehicle>().eq(MdPbPapervehicle::getVehicle_code, vehicle_code) |
|
|
.eq(MdPbPapervehicle::getRow_num, nextNum)); |
|
|
.eq(MdPbPapervehicle::getRow_num, nextNum)); |
|
|
if (ObjectUtil.isNotEmpty(nextPaper)) { |
|
|
if (nextPaper.size()>0) { |
|
|
//获取后一排的纸管高度和纸管类型
|
|
|
//获取后一排的纸管高度和纸管类型
|
|
|
String nextMaterialName = nextPaper.getMaterial_name(); |
|
|
String nextMaterialName = nextPaper.get(0).getMaterial_name(); |
|
|
String[] nextArray = nextMaterialName.replaceAll("\\|[\\u4e00-\\u9fa5]+$", "").split("\\|"); |
|
|
String[] nextArray = nextMaterialName.replaceAll("\\|[\\u4e00-\\u9fa5]+$", "").split("\\|"); |
|
|
int nextLength = Integer.parseInt(nextArray[nextArray.length - 1]); |
|
|
int nextLength = Integer.parseInt(nextArray[nextArray.length - 1]); |
|
|
if (Math.abs(nextLength - currLength) <= 50 && !material_code.equals(nextPaper.getMaterial_code())) { |
|
|
if (Math.abs(nextLength - currLength) <= 50 && !material_code.equals(nextPaper.get(0).getMaterial_code())) { |
|
|
throw new BadRequestException("相邻排的纸管高度差要大于等于50MM!"); |
|
|
throw new BadRequestException("相邻排的纸管高度差要大于等于50MM!"); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
//判断前一排的纸管高度
|
|
|
//判断前一排的纸管高度
|
|
|
int preNum = num - 1; |
|
|
int preNum = num - 1; |
|
|
MdPbPapervehicle prePaper = papervehicleService.getOne(new LambdaQueryWrapper<MdPbPapervehicle>().eq(MdPbPapervehicle::getVehicle_code, vehicle_code) |
|
|
List<MdPbPapervehicle> prePaper = papervehicleService.list(new LambdaQueryWrapper<MdPbPapervehicle>().eq(MdPbPapervehicle::getVehicle_code, vehicle_code) |
|
|
.eq(MdPbPapervehicle::getRow_num, preNum)); |
|
|
.eq(MdPbPapervehicle::getRow_num, preNum)); |
|
|
if (ObjectUtil.isNotEmpty(prePaper)) { |
|
|
if (ObjectUtil.isNotEmpty(prePaper)) { |
|
|
//获取后一排的纸管高度和纸管类型
|
|
|
//获取后一排的纸管高度和纸管类型
|
|
|
String preMaterialName = prePaper.getMaterial_name(); |
|
|
String preMaterialName = prePaper.get(0).getMaterial_name(); |
|
|
String[] preArray = preMaterialName.replaceAll("\\|[\\u4e00-\\u9fa5]+$", "").split("\\|"); |
|
|
String[] preArray = preMaterialName.replaceAll("\\|[\\u4e00-\\u9fa5]+$", "").split("\\|"); |
|
|
int preLength = Integer.parseInt(preArray[preArray.length - 1]); |
|
|
int preLength = Integer.parseInt(preArray[preArray.length - 1]); |
|
|
if (Math.abs(preLength - currLength) <= 50 && !material_code.equals(prePaper.getMaterial_code())) { |
|
|
if (Math.abs(preLength - currLength) <= 50 && !material_code.equals(prePaper.get(0).getMaterial_code())) { |
|
|
throw new BadRequestException("相邻排的纸管高度差要大于等于50MM!"); |
|
|
throw new BadRequestException("相邻排的纸管高度差要大于等于50MM!"); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|