opt:提交备货区修改
This commit is contained in:
@@ -56,12 +56,18 @@ public class BstIvtStockingivtServiceImpl extends ServiceImpl<BstIvtStockingivtM
|
||||
private MaterialbaseService materialbaseService;
|
||||
@Autowired
|
||||
private IPdmBiOrderbominfoService pdmBiOrderbominfoService;
|
||||
@Autowired
|
||||
private IBstIvtStockingivtService stockingivtService;
|
||||
|
||||
@Override
|
||||
public IPage<BstIvtStockingivt> queryAll(Map whereJson, PageQuery page) {
|
||||
String point_code = (String) whereJson.get("point_code");
|
||||
String point_type = (String) whereJson.get("point_type");
|
||||
String point_location = (String) whereJson.get("point_location");
|
||||
String is_used = (String) whereJson.get("is_used");
|
||||
LambdaQueryWrapper<BstIvtStockingivt> lam = new LambdaQueryWrapper<>();
|
||||
lam.eq(ObjectUtil.isNotEmpty(point_code),BstIvtStockingivt::getPoint_code,point_code)
|
||||
.eq(ObjectUtil.isNotEmpty(point_type),BstIvtStockingivt::getPoint_type,point_type)
|
||||
.eq(ObjectUtil.isNotEmpty(point_location),BstIvtStockingivt::getPoint_location,point_location)
|
||||
.eq(ObjectUtil.isNotEmpty(is_used),BstIvtStockingivt::getIs_used,is_used);
|
||||
IPage<BstIvtStockingivt> pages = new Page<>(page.getPage() + 1, page.getSize());
|
||||
bstIvtStockingivtMapper.selectPage(pages, lam);
|
||||
return pages;
|
||||
@@ -110,8 +116,8 @@ public class BstIvtStockingivtServiceImpl extends ServiceImpl<BstIvtStockingivtM
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BstIvtStockingivt> getEmptyPointNotTask(String location, String pointType) {
|
||||
return bstIvtStockingivtMapper.getEmptyPointNotTask(location, pointType);
|
||||
public List<BstIvtStockingivt> getEmptyPointNotTask(String pointType) {
|
||||
return bstIvtStockingivtMapper.getEmptyPointNotTask(pointType);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -155,44 +161,57 @@ public class BstIvtStockingivtServiceImpl extends ServiceImpl<BstIvtStockingivtM
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public JSONObject operateIvt(JSONObject jsonObject) {
|
||||
log.info("手持操作管芯托盘 - {}", jsonObject);
|
||||
//载具托盘号
|
||||
String vehicle_code = jsonObject.getString("vehicle_code");
|
||||
//排
|
||||
String row_num = jsonObject.getString("row_num");
|
||||
//列
|
||||
String col_num = jsonObject.getString("col_num");
|
||||
//物料
|
||||
String material_code = jsonObject.getString("material_code");
|
||||
String point_code = jsonObject.getString("point_code");
|
||||
Integer now_qty = jsonObject.getInteger("qty");
|
||||
//管芯/纸管编码
|
||||
String paper_code = jsonObject.getString("paper_code");
|
||||
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
if (ObjectUtil.isEmpty(row_num)) {
|
||||
throw new BadRequestException("排数不能为空!");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(col_num)) {
|
||||
throw new BadRequestException("列数不能为空!");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(vehicle_code)) {
|
||||
throw new BadRequestException("托盘信息不能为空!");
|
||||
}
|
||||
if(!vehicle_code.contains("GX")){
|
||||
throw new BadRequestException("请扫描或输入正确的托盘码!");
|
||||
}
|
||||
//1-绑定;2-清除
|
||||
String type = jsonObject.getString("type");
|
||||
if (type.equals("1")) {
|
||||
//校验数据
|
||||
BstIvtStockingivt pointByCode = stockingivtService.getPointByCode(point_code, true);
|
||||
if (ObjectUtil.isEmpty(pointByCode)) {
|
||||
throw new BadRequestException("点位 [" + point_code + "] 不存在或者已被禁用!");
|
||||
if (ObjectUtil.isEmpty(material_code)) {
|
||||
throw new BadRequestException("物料编码不能为空!");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(vehicle_code)) {
|
||||
throw new BadRequestException("托盘信息不能为空!");
|
||||
if (ObjectUtil.isEmpty(paper_code)) {
|
||||
throw new BadRequestException("管芯/纸管编码不能为空!");
|
||||
}
|
||||
if(!vehicle_code.contains("GX")){
|
||||
throw new BadRequestException("请扫描或输入正确的托盘码!");
|
||||
}
|
||||
if(now_qty<=0 || now_qty>5){
|
||||
throw new BadRequestException("数量只允许输入1-5");
|
||||
}
|
||||
//
|
||||
MaterialbaseDto mater = materialbaseService.findByCode(material_code);
|
||||
String material_name = mater.getMaterial_name();
|
||||
|
||||
//查询当前载具和排是否存在库存
|
||||
MdPbPapervehicle papervehicle = papervehicleService.getOne(new LambdaQueryWrapper<MdPbPapervehicle>().eq(MdPbPapervehicle::getVehicle_code, vehicle_code)
|
||||
.eq(MdPbPapervehicle::getRow_num, row_num));
|
||||
//查询当前载具和排列是否存在库存
|
||||
MdPbPapervehicle papervehicle = papervehicleService.getOne(new LambdaQueryWrapper<MdPbPapervehicle>()
|
||||
.eq(MdPbPapervehicle::getVehicle_code, vehicle_code)
|
||||
.eq(MdPbPapervehicle::getRow_num, row_num)
|
||||
.eq(MdPbPapervehicle::getCol_num, col_num));
|
||||
if (ObjectUtil.isNotEmpty(papervehicle) && !papervehicle.getMaterial_code().equals(material_code)) {
|
||||
throw new BadRequestException("当前排物料为【" + papervehicle.getMaterial_code() + "】,与绑定的物料不同,如需要请先清除库存,再进行绑定!");
|
||||
throw new BadRequestException("当前排-列已有物料为【" + papervehicle.getMaterial_code() + "】,如需要修改请先清除库存,再进行绑定!");
|
||||
}
|
||||
//查询当前管芯编码是否在托盘中
|
||||
MdPbPapervehicle papervehicle_flag = papervehicleService.getOne(new LambdaQueryWrapper<MdPbPapervehicle>()
|
||||
.eq(MdPbPapervehicle::getPaper_code, paper_code));
|
||||
if (ObjectUtil.isNotEmpty(papervehicle_flag)) {
|
||||
throw new BadRequestException("当前管芯编码已存在托盘上:" + papervehicle_flag.getVehicle_code() + "所在位置排列:"+papervehicle_flag.getRow_num()+"-"+papervehicle_flag.getCol_num());
|
||||
}
|
||||
|
||||
//获取当前纸管的高度
|
||||
// 解析描述数组
|
||||
String[] tubeArray = material_name.replaceAll("\\|[\\u4e00-\\u9fa5]+$", "").split("\\|");
|
||||
@@ -229,7 +248,6 @@ public class BstIvtStockingivtServiceImpl extends ServiceImpl<BstIvtStockingivtM
|
||||
throw new BadRequestException("相邻排的纸管高度差要大于等于50MM!");
|
||||
}
|
||||
}
|
||||
|
||||
//判断前一排的纸管高度
|
||||
int preNum = num - 1;
|
||||
MdPbPapervehicle prePaper = papervehicleService.getOne(new LambdaQueryWrapper<MdPbPapervehicle>().eq(MdPbPapervehicle::getVehicle_code, vehicle_code)
|
||||
@@ -244,10 +262,8 @@ public class BstIvtStockingivtServiceImpl extends ServiceImpl<BstIvtStockingivtM
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (ObjectUtil.isNotEmpty(papervehicle)) {
|
||||
papervehicle.setQty(jsonObject.getBigDecimal("qty"));
|
||||
papervehicle.setQty(1);
|
||||
papervehicle.setUpdate_optid(currentUserId);
|
||||
papervehicle.setUpdate_optname(nickName);
|
||||
papervehicle.setUpdate_time(now);
|
||||
@@ -259,35 +275,17 @@ public class BstIvtStockingivtServiceImpl extends ServiceImpl<BstIvtStockingivtM
|
||||
papervehicle.setRow_num(row_num);
|
||||
papervehicle.setMaterial_code(material_code);
|
||||
papervehicle.setMaterial_name(material_name);
|
||||
papervehicle.setQty(jsonObject.getBigDecimal("qty"));
|
||||
papervehicle.setQty(1);
|
||||
papervehicle.setUpdate_optid(currentUserId);
|
||||
papervehicle.setUpdate_optname(nickName);
|
||||
papervehicle.setUpdate_time(now);
|
||||
papervehicleService.save(papervehicle);
|
||||
}
|
||||
// 插入托盘数据到点位
|
||||
// 检查托盘号是不是在其他点位上
|
||||
List<BstIvtStockingivt> stockingivts = bstIvtStockingivtMapper.selectList(new LambdaQueryWrapper<BstIvtStockingivt>()
|
||||
.eq(BstIvtStockingivt::getVehicle_code, vehicle_code)
|
||||
.ne(BstIvtStockingivt::getPoint_code, point_code));
|
||||
if (stockingivts.size() > 1) {
|
||||
throw new BadRequestException("该托盘绑定了多个位置!");
|
||||
}
|
||||
if (stockingivts.size() > 0) {
|
||||
BstIvtStockingivt bstIvtStockingivt = stockingivts.get(0);
|
||||
bstIvtStockingivt.setVehicle_code("");
|
||||
bstIvtStockingivtMapper.updateById(bstIvtStockingivt);
|
||||
}
|
||||
BstIvtStockingivt currentStock = bstIvtStockingivtMapper.selectOne(new LambdaQueryWrapper<BstIvtStockingivt>()
|
||||
.eq(BstIvtStockingivt::getPoint_code, point_code));
|
||||
currentStock.setVehicle_code(vehicle_code);
|
||||
currentStock.setIvt_status("1");
|
||||
bstIvtStockingivtMapper.updateById(currentStock);
|
||||
}
|
||||
|
||||
if (type.equals("2")) {
|
||||
}else if (type.equals("2")) {
|
||||
//清除管芯托盘库存
|
||||
papervehicleService.remove(new LambdaQueryWrapper<MdPbPapervehicle>().eq(MdPbPapervehicle::getVehicle_code, vehicle_code)
|
||||
.eq(MdPbPapervehicle::getRow_num, row_num));
|
||||
.eq(MdPbPapervehicle::getRow_num, row_num)
|
||||
.eq(MdPbPapervehicle::getCol_num, col_num));
|
||||
}
|
||||
|
||||
//判断绑定的纸管是否在机械手范围内,如果存在的话把最新库存推送给电气
|
||||
@@ -368,7 +366,9 @@ public class BstIvtStockingivtServiceImpl extends ServiceImpl<BstIvtStockingivtM
|
||||
// 获取数据
|
||||
List<MdPbPapervehicle> papers = papervehicleService.list(new LambdaQueryWrapper<MdPbPapervehicle>()
|
||||
.eq(MdPbPapervehicle::getVehicle_code, whereJson.get("vehicle_code"))
|
||||
.orderByAsc(MdPbPapervehicle::getRow_num));
|
||||
.orderByAsc(MdPbPapervehicle::getRow_num)
|
||||
.orderByAsc(MdPbPapervehicle::getCol_num)
|
||||
);
|
||||
return papers;
|
||||
}
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user