fix: 1、分切下料缓存
2、内包间新增97信号直接套轴完成
3、手持分切暂存送料到内包间
4、手持清理分切暂存数据
This commit is contained in:
@@ -92,4 +92,11 @@ public interface IBstIvtCutpointivtService extends IService<BstIvtCutpointivt> {
|
||||
* @return /
|
||||
*/
|
||||
List<BstIvtCutpointivt> getAllHalfPlacePoints(String type, String pointStatus, String location);
|
||||
|
||||
/**
|
||||
* 获取分切暂存下拉框
|
||||
* @param pointType /
|
||||
* @return /
|
||||
*/
|
||||
List<BstIvtCutpointivt> getPintByAgvCodesByPointType(String pointType);
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import org.nl.b_lms.bst.ivt.cutpointivt.service.IBstIvtCutpointivtService;
|
||||
import org.nl.b_lms.bst.ivt.cutpointivt.service.dao.BstIvtCutpointivt;
|
||||
import org.nl.b_lms.bst.ivt.cutpointivt.service.dao.mapper.BstIvtCutpointivtMapper;
|
||||
import org.nl.b_lms.bst.ivt.cutpointivt.service.dto.BstIvtCutpointivtQuery;
|
||||
import org.nl.b_lms.sch.tasks.slitter.constant.SlitterConstant;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
@@ -123,4 +124,10 @@ public class BstIvtCutpointivtServiceImpl extends ServiceImpl<BstIvtCutpointivtM
|
||||
public List<BstIvtCutpointivt> getAllHalfPlacePoints(String type, String pointStatus, String location) {
|
||||
return bstIvtCutpointivtMapper.getAllHalfPlacePoints(type, pointStatus, location);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BstIvtCutpointivt> getPintByAgvCodesByPointType(String pointType) {
|
||||
return bstIvtCutpointivtMapper.selectList(new LambdaQueryWrapper<BstIvtCutpointivt>()
|
||||
.eq(BstIvtCutpointivt::getPoint_type, pointType));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,4 +67,23 @@ public class SlitterPdaController {
|
||||
public ResponseEntity<Object> cutIn(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(slitterDevices.cutIn(param), HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("/sendSubVolumeToNBJ")
|
||||
@Log("分切缓存到内包间任务")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> sendSubVolumeToNBJ(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(slitterDevices.pdaSendSubVolumeToNBJ(param), HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("/getCutCacheAgvPoints")
|
||||
@Log("获取分切暂存位AGV点位下拉框数据")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> getCutCacheAgvPoints() {
|
||||
return new ResponseEntity<>(slitterDevices.getCutCacheAgvPoints(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/toCleanCutCacheInventory")
|
||||
@Log("清理分切缓存到内包间")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> toCleanCutCacheInventory(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(slitterDevices.toCleanCutCacheInventory(param), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,12 +88,10 @@ public class SendAirShaftAgvTask extends AbstractAcsTask {
|
||||
if (StrUtil.equals(status, TaskStatusEnum.FINISHED.getCode())) {
|
||||
task.setTask_status(TaskStatusEnum.FINISHED.getCode());
|
||||
// 互换资源
|
||||
String startPoint = task.getPoint_code1();
|
||||
BstIvtCutpointivt startPointObj = bcutpointivtService.getPintByAgvCode(startPoint, false);
|
||||
// update: 在acs请求取货完成就已经清空点位信息
|
||||
String endPoint = task.getPoint_code2();
|
||||
BstIvtCutpointivt endPointObj = bcutpointivtService.getPintByAgvCode(endPoint, false);
|
||||
TaskUtils.pointExchangeResources(startPointObj, endPointObj, "2");
|
||||
bcutpointivtService.updateById(startPointObj);
|
||||
TaskUtils.pointMaintenanceInventory(task, endPointObj, "2");
|
||||
bcutpointivtService.updateById(endPointObj);
|
||||
// 分切计划状态修改02->03
|
||||
List<String> collect = Stream.of(task.getVehicle_code(), task.getVehicle_code2())
|
||||
|
||||
@@ -82,12 +82,10 @@ public class SlitterDownAgvTask extends AbstractAcsTask {
|
||||
}
|
||||
task.setTask_status(TaskStatusEnum.FINISHED.getCode());
|
||||
// 互换资源
|
||||
String startPoint = task.getPoint_code1();
|
||||
BstIvtCutpointivt startPointObj = bcutpointivtService.getPintByAgvCode(startPoint, false);
|
||||
// update: 在acs请求取货完成就已经清空点位信息
|
||||
String endPoint = task.getPoint_code2();
|
||||
BstIvtCutpointivt endPointObj = bcutpointivtService.getPintByAgvCode(endPoint, false);
|
||||
TaskUtils.pointExchangeResources(startPointObj, endPointObj, "3");
|
||||
bcutpointivtService.updateById(startPointObj);
|
||||
TaskUtils.pointMaintenanceInventory(task, endPointObj, "3");
|
||||
bcutpointivtService.updateById(endPointObj);
|
||||
}
|
||||
// 取消
|
||||
|
||||
@@ -68,6 +68,7 @@ public class StockAreaCallTubeTask extends AbstractAcsTask {
|
||||
.start_device_code2(task.getPoint_code3())
|
||||
.next_device_code2(task.getPoint_code4())
|
||||
.vehicle_code(task.getVehicle_code())
|
||||
.interaction_json(JSONObject.parseObject(task.getRequest_param()))
|
||||
.agv_system_type(agv_system_type)
|
||||
.priority(task.getPriority())
|
||||
.product_area(task.getProduct_area())
|
||||
@@ -101,33 +102,6 @@ public class StockAreaCallTubeTask extends AbstractAcsTask {
|
||||
TaskUtils.updateOptMessageByBStockingPoint(startPointObj);
|
||||
stockingivtService.update(startPointObj);
|
||||
|
||||
|
||||
//下发ACS点位库存信息
|
||||
List<MdPbPapervehicle> list = mdPbPapervehicleService.list(new LambdaQueryWrapper<MdPbPapervehicle>().eq(MdPbPapervehicle::getVehicle_code, task.getVehicle_code()));
|
||||
String[] material_codes = new String[list.size()];
|
||||
String[] material_specs = new String[list.size()];
|
||||
int[] qtys = new int[list.size()];
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
MdPbPapervehicle vehicle = list.get(i);
|
||||
String material_code = vehicle.getMaterial_code();
|
||||
int qty = vehicle.getQty().intValue();
|
||||
if (containscode(material_codes, material_code)) {
|
||||
int index = getIndex(material_codes, material_code);
|
||||
qtys[index] += qty;
|
||||
} else {
|
||||
material_codes[i] = vehicle.getMaterial_code();
|
||||
String spec = SlitterTaskUtil.getComposePaperTubeInformation(vehicle.getMaterial_name());
|
||||
material_specs[i] = spec;
|
||||
qtys[i] = qty;
|
||||
}
|
||||
}
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("to_material", material_codes);
|
||||
jsonObject.put("to_spec", material_codes);
|
||||
jsonObject.put("to_qty", qtys);
|
||||
jsonObject.put("device_code", material_specs);
|
||||
wmsToAcsService.getTubeMsg(jsonObject);
|
||||
|
||||
}
|
||||
// 取消
|
||||
if (status.equals(IOSEnum.IS_NOTANDYES.code("否"))) {
|
||||
@@ -137,25 +111,6 @@ public class StockAreaCallTubeTask extends AbstractAcsTask {
|
||||
taskService.updateById(task);
|
||||
}
|
||||
|
||||
public boolean containscode(String[] names, String name) {
|
||||
for (String n : names) {
|
||||
if (name.equals(n)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// 获取name在数组中的索引
|
||||
public int getIndex(String[] names, String name) {
|
||||
for (int i = 0; i < names.length; i++) {
|
||||
if (name.equals(names[i])) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1; // 如果找不到返回-1
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createTask(JSONObject form) {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
|
||||
@@ -5,7 +5,10 @@ import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.b_lms.bst.ivt.papervehicle.service.IMdPbPapervehicleService;
|
||||
import org.nl.b_lms.bst.ivt.papervehicle.service.dao.MdPbPapervehicle;
|
||||
import org.nl.b_lms.bst.ivt.stockingivt.service.IBstIvtStockingivtService;
|
||||
import org.nl.b_lms.bst.ivt.stockingivt.service.dao.BstIvtStockingivt;
|
||||
import org.nl.b_lms.sch.task.dao.SchBaseTask;
|
||||
@@ -28,6 +31,8 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.nl.b_lms.sch.tasks.slitter.util.SlitterTaskUtil.doSavePaperInfos;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 备货区(靠近机械手)送走托盘到暂存位置的备货区 - AGV任务
|
||||
@@ -43,6 +48,8 @@ public class StockAreaSendVehicleTask extends AbstractAcsTask {
|
||||
private IBstIvtStockingivtService stockingivtService;
|
||||
@Autowired
|
||||
private StockAreaCallTubeTask stockAreaCallTubeTask;
|
||||
@Autowired
|
||||
private IMdPbPapervehicleService mdPbPapervehicleService;
|
||||
@Override
|
||||
public List<AcsTaskDto> addTask() {
|
||||
/*
|
||||
@@ -107,6 +114,9 @@ public class StockAreaSendVehicleTask extends AbstractAcsTask {
|
||||
param.put("vehicle_code", callPoint.getString("vehicle_code"));
|
||||
param.put("task_type", SlitterEnum.TASK_TYPE.code("备货区送纸管"));
|
||||
param.put("product_area", SlitterConstant.SLITTER_TASK_AREA);
|
||||
List<MdPbPapervehicle> paperList = mdPbPapervehicleService.list(new LambdaQueryWrapper<MdPbPapervehicle>()
|
||||
.eq(MdPbPapervehicle::getVehicle_code, callPoint.getString("vehicle_code")));
|
||||
doSavePaperInfos(paperList, param);
|
||||
stockAreaCallTubeTask.createTask(param);
|
||||
}
|
||||
// 取消
|
||||
|
||||
@@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.b_lms.bst.ivt.cutpointivt.service.IBstIvtCutpointivtService;
|
||||
import org.nl.b_lms.bst.ivt.cutpointivt.service.dao.BstIvtCutpointivt;
|
||||
import org.nl.b_lms.bst.ivt.papervehicle.service.IMdPbPapervehicleService;
|
||||
import org.nl.b_lms.bst.ivt.papervehicle.service.dao.MdPbPapervehicle;
|
||||
import org.nl.b_lms.bst.ivt.shafttubeivt.service.IBstIvtShafttubeivtService;
|
||||
import org.nl.b_lms.bst.ivt.shafttubeivt.service.dao.BstIvtShafttubeivt;
|
||||
import org.nl.b_lms.bst.ivt.stockingivt.service.IBstIvtStockingivtService;
|
||||
@@ -33,6 +35,8 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.nl.b_lms.sch.tasks.slitter.util.SlitterTaskUtil.*;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Date: 2024/2/1
|
||||
@@ -64,6 +68,8 @@ public class AutoCallAirShaftTask {
|
||||
private StockAreaSendVehicleTask stockAreaSendVehicleTask;
|
||||
@Autowired
|
||||
private StockAreaCallTubeTask stockAreaCallTubeTask;
|
||||
@Autowired
|
||||
private IMdPbPapervehicleService mdPbPapervehicleService;
|
||||
|
||||
/**
|
||||
* hint: 目前只是考虑了上区域
|
||||
@@ -256,7 +262,10 @@ public class AutoCallAirShaftTask {
|
||||
param.put("point_code2", needMovePoint.getPoint_code());
|
||||
param.put("vehicle_code", needPoint.getVehicle_code());
|
||||
param.put("task_type", SlitterEnum.TASK_TYPE.code("备货区送纸管"));
|
||||
param.put("product_area", SlitterConstant.SLITTER_TASK_AREA);
|
||||
// 存储纸管信息
|
||||
List<MdPbPapervehicle> paperList = mdPbPapervehicleService.list(new LambdaQueryWrapper<MdPbPapervehicle>()
|
||||
.eq(MdPbPapervehicle::getVehicle_code, needPoint.getVehicle_code()));
|
||||
doSavePaperInfos(paperList, param);
|
||||
stockAreaCallTubeTask.createTask(param);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
package org.nl.b_lms.sch.tasks.slitter.auto;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.b_lms.bst.ivt.cutpointivt.service.IBstIvtCutpointivtService;
|
||||
import org.nl.b_lms.bst.ivt.cutpointivt.service.dao.BstIvtCutpointivt;
|
||||
import org.nl.b_lms.sch.tasks.slitter.SlitterDownAgvTask;
|
||||
import org.nl.b_lms.sch.tasks.slitter.constant.SlitterConstant;
|
||||
import org.nl.b_lms.sch.tasks.slitter.constant.SlitterEnum;
|
||||
import org.nl.b_lms.sch.tasks.slitter.mapper.SlitterMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 自动任务 分切机满卷下料(分切对接位:3)去拔轴 AGV任务
|
||||
* 先去套轴对接位,(标箔,套轴对接位不够的情况下是去分切缓存位)
|
||||
* 改成:先去暂存位,手持送到内包间
|
||||
*
|
||||
* 分切对接位和分切缓存位公用类
|
||||
* @Date: 2024/2/1
|
||||
* @see SlitterDownAgvTask#createTask(JSONObject)
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class AutoSlitterCacheDownAgvTask {
|
||||
|
||||
@Autowired
|
||||
private IBstIvtCutpointivtService cutpointivtService;
|
||||
@Autowired
|
||||
private SlitterDownAgvTask slitterDownAgvTask;
|
||||
@Autowired
|
||||
private SlitterMapper slitterMapper;
|
||||
/**
|
||||
* 业务:
|
||||
* 分切下料满卷(分切计划是结束),通过气涨轴编码可定位。
|
||||
* 先往套轴对接位送,不够再送分切缓存位(针对B2,B4车间)
|
||||
*/
|
||||
public void run() {
|
||||
// 获取分切对接位满轴数据 todo: 先不考虑区域,后期添加
|
||||
// bct.point_type IN ('2', '3') -> bct.point_type = '3'
|
||||
List<BstIvtCutpointivt> cutPointIvts = slitterMapper.getAreaFullVolume();
|
||||
cutPointIvts.forEach(cut -> {
|
||||
// cut是起点
|
||||
// remove: 1、先去对应的套轴对接位,没有气涨轴(空位),没有任务的点位
|
||||
// update: 1、去分切缓存位,在由手持下发到内包间
|
||||
List<BstIvtCutpointivt> areaEmptyNotTaskPoint = cutpointivtService.getAreaNotTaskPointByStatus("2", "1", "0","0");
|
||||
if (areaEmptyNotTaskPoint.size() == 0) {
|
||||
log.warn(cut.getProduct_area() + "该区域暂无位置存放满轴");
|
||||
return;
|
||||
}
|
||||
// 生成任务
|
||||
BstIvtCutpointivt endPoint = areaEmptyNotTaskPoint.get(0);
|
||||
toCreateTask(cut, endPoint);
|
||||
});
|
||||
}
|
||||
|
||||
private void toCreateTask(BstIvtCutpointivt cut, BstIvtCutpointivt endPoint) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("point_code1", cut.getPoint_code());
|
||||
param.put("point_code2", endPoint.getPoint_code());
|
||||
param.put("vehicle_code1", cut.getQzz_no1());
|
||||
param.put("vehicle_code2", cut.getQzz_no2());
|
||||
param.put("task_type", SlitterEnum.TASK_TYPE.code("分切机下料AGV任务"));
|
||||
param.put("product_area", SlitterConstant.SLITTER_TASK_AREA);
|
||||
slitterDownAgvTask.createTask(param);
|
||||
}
|
||||
}
|
||||
@@ -26,12 +26,13 @@ import java.util.stream.Stream;
|
||||
* @Author: lyd
|
||||
* @Description: 自动任务 分切机满卷下料(分切对接位:3)去拔轴 AGV任务
|
||||
* 先去套轴对接位,(标箔,套轴对接位不够的情况下是去分切缓存位)
|
||||
*
|
||||
* update: 业务不需要
|
||||
* 分切对接位和分切缓存位公用类
|
||||
* @Date: 2024/2/1
|
||||
* @see SlitterDownAgvTask#createTask(JSONObject)
|
||||
*/
|
||||
@Slf4j
|
||||
@Deprecated
|
||||
@Component
|
||||
public class AutoSlitterDownAgvTask {
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ public enum SlitterEnum {
|
||||
*/
|
||||
TASK_TYPE(MapOf.of("穿拔轴缓存<>穿拔轴位", "010801", "穿拔轴缓存<>分切对接位", "010802", "穿拔轴位<>气胀轴缓存位", "010803"
|
||||
, "分切机下料AGV任务", "010804", "分切机上气胀轴", "010805", "分切机下气胀轴", "010806", "备货区送载具", "010807"
|
||||
, "备货区送纸管", "010808", "分切机下料桁架任务", "010809"));
|
||||
, "备货区送纸管", "010808", "分切机下料桁架任务", "010809", "分切机下料AGV到内包间", "010810"));
|
||||
private Map<String, String> code;
|
||||
|
||||
public String code(String desc) {
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<select id="getAreaFullVolume" resultType="org.nl.b_lms.bst.ivt.cutpointivt.service.dao.BstIvtCutpointivt">
|
||||
SELECT bct.*
|
||||
FROM `bst_ivt_cutpointivt` bct
|
||||
WHERE bct.point_type IN ('2', '3')
|
||||
WHERE bct.point_type = '3'
|
||||
AND bct.point_status = '3'
|
||||
AND bct.is_used = '1'
|
||||
AND 0 = (SELECT COUNT(*)
|
||||
|
||||
@@ -120,4 +120,31 @@ public interface SlitterService {
|
||||
JSONObject doInitShaftPoint(JSONObject param);
|
||||
|
||||
JSONObject cutIn(JSONObject param);
|
||||
|
||||
/**
|
||||
* 二期acs请求取货完成
|
||||
* @param param /
|
||||
* @return /
|
||||
*/
|
||||
JSONObject acsActionFinishRequestToRelease(JSONObject param);
|
||||
|
||||
/**
|
||||
* 手持下卷到内包间
|
||||
* @param param /
|
||||
* @return /
|
||||
*/
|
||||
JSONObject pdaSendSubVolumeToNBJ(JSONObject param);
|
||||
|
||||
/**
|
||||
* 获取分切暂存位AGV点位下拉框数据
|
||||
* @return
|
||||
*/
|
||||
JSONArray getCutCacheAgvPoints();
|
||||
|
||||
/**
|
||||
* 清理分切缓存到内包间
|
||||
* @param param /
|
||||
* @return /
|
||||
*/
|
||||
JSONObject toCleanCutCacheInventory(JSONObject param);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,10 @@ import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.common.utils.TaskUtils;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.system.service.param.ISysParamService;
|
||||
import org.nl.system.service.param.dao.Param;
|
||||
import org.nl.wms.ext.acs.service.WmsToAcsService;
|
||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||
import org.redisson.api.RLock;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -49,6 +52,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
@@ -101,6 +105,10 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
private IBstIvtStockingivtService stockingivtService;
|
||||
@Autowired
|
||||
private IMdPbPapervehicleService papervehicleService;
|
||||
@Autowired
|
||||
private SlitterDownAgvTask slitterDownAgvTask;
|
||||
@Autowired
|
||||
private ISysParamService paramService;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -111,6 +119,10 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
String deviceCode = param.getString("device_code");
|
||||
String size = param.getString("size");
|
||||
BstIvtShafttubeivt point = shafttubeivtService.getByPointCode(deviceCode, false);
|
||||
Param autoSendEmpty = paramService.findByCode("autoSendEmpty");
|
||||
if (ObjectUtil.isEmpty(autoSendEmpty)) {
|
||||
throw new BadRequestException("未配置是否直接送气胀轴");
|
||||
}
|
||||
// 判断尺寸是否相同
|
||||
if (!size.equals(point.getQzz_size())) {
|
||||
log.error("设备:{}对应的气胀轴尺寸不批对,需要气胀轴尺寸:{},实际尺寸:{}", deviceCode, point.getQzz_size(), size);
|
||||
@@ -127,7 +139,11 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
// point.getTube_code1() 编码 , getTube_name1() : 纸制筒管|纸管|6英寸|1300 or 纸制筒管|纸管|3英寸|12|650
|
||||
res.put("device_code", deviceCode);
|
||||
res.put("data", con);
|
||||
con.put("is_bushing", list.size() > 0 ? SlitterConstant.SLITTER_YES : SlitterConstant.SLITTER_NO);
|
||||
if ("1".equals(autoSendEmpty.getValue())) {
|
||||
con.put("is_bushing", "2");
|
||||
} else {
|
||||
con.put("is_bushing", list.size() > 0 ? SlitterConstant.SLITTER_YES : SlitterConstant.SLITTER_NO);
|
||||
}
|
||||
con.put("left", point.getTube_code1());
|
||||
con.put("leftSize", ObjectUtil.isNotEmpty(point.getTube_name1())
|
||||
? point.getTube_name1().split("\\|")[2].charAt(0) : "");
|
||||
@@ -820,4 +836,141 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public JSONObject acsActionFinishRequestToRelease(JSONObject param) {
|
||||
String taskCode = param.getString("task_code");
|
||||
if (ObjectUtil.isEmpty(taskCode)) {
|
||||
throw new BadRequestException("ACS二楼请求取货完成失败,任务号不能为空!");
|
||||
}
|
||||
SchBaseTask task = taskService.getOne(new LambdaQueryWrapper<SchBaseTask>().eq(SchBaseTask::getTask_code, taskCode));
|
||||
// 起点释放
|
||||
String startPoint = task.getPoint_code1();
|
||||
BstIvtCutpointivt startPointObj = bcutpointivtService.getPintByAgvCode(startPoint, false);
|
||||
startPointObj.setPoint_status("1");
|
||||
startPointObj.setQzz_no1("");
|
||||
startPointObj.setQzz_no2("");
|
||||
TaskUtils.updateOptMessageByBCutPoint(startPointObj);
|
||||
bcutpointivtService.updateById(startPointObj);
|
||||
task.setTask_status(TaskStatusEnum.PICK_UP_COMPLETED.getCode());
|
||||
TaskUtils.updateOptMessageByTask(task);
|
||||
taskService.updateById(task);
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("status", HttpStatus.HTTP_OK);
|
||||
result.put("message", "反馈取货成功!");
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject pdaSendSubVolumeToNBJ(JSONObject param) {
|
||||
log.info("手持申请送子卷到内包间参数:{}", param);
|
||||
// param: point_code
|
||||
String pointCode = param.getString("point_code");
|
||||
RLock open = redissonClient.getLock(pointCode);
|
||||
boolean openLock;
|
||||
try {
|
||||
openLock = open.tryLock(0, TimeUnit.SECONDS);
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
try {
|
||||
if (openLock) {
|
||||
BstIvtCutpointivt point = bcutpointivtService.getPintByAgvCode(pointCode, false);
|
||||
if (Objects.equals(point.getPoint_status(), "1")) {
|
||||
// 如果是没货
|
||||
throw new BadRequestException("点位:" + point.getPoint_code() + "检测无货,请确保任务执行完毕后触发!");
|
||||
}
|
||||
List<BstIvtCutpointivt> areaEmptyNotTaskPoint = bcutpointivtService.getAreaNotTaskPointByStatus("1",
|
||||
"1", "0", "2");
|
||||
if (areaEmptyNotTaskPoint.size() == 0) {
|
||||
throw new BadRequestException("请求搬运失败,内包间没有可存放位置!");
|
||||
}
|
||||
BstIvtCutpointivt endPoint = areaEmptyNotTaskPoint.get(0);
|
||||
RLock lock = redissonClient.getLock(endPoint.getPoint_code());
|
||||
boolean tryLock;
|
||||
try {
|
||||
tryLock = lock.tryLock(0, TimeUnit.SECONDS);
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
try {
|
||||
if (tryLock) {
|
||||
JSONObject taskParam = new JSONObject();
|
||||
taskParam.put("point_code1", point.getPoint_code());
|
||||
taskParam.put("point_code2", endPoint.getPoint_code());
|
||||
taskParam.put("vehicle_code1", point.getQzz_no1());
|
||||
taskParam.put("vehicle_code2", point.getQzz_no2());
|
||||
taskParam.put("task_type", SlitterEnum.TASK_TYPE.code("分切机下料AGV到内包间"));
|
||||
taskParam.put("product_area", SlitterConstant.SLITTER_TASK_AREA);
|
||||
slitterDownAgvTask.createTask(taskParam);
|
||||
} else {
|
||||
throw new BadRequestException("系统繁忙,稍后在试!!");
|
||||
}
|
||||
} finally {
|
||||
if (tryLock) {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new BadRequestException("系统繁忙,稍后在试!!");
|
||||
}
|
||||
} finally {
|
||||
if (openLock) {
|
||||
open.unlock();
|
||||
}
|
||||
}
|
||||
JSONObject res = new JSONObject();
|
||||
res.put("status", HttpStatus.HTTP_OK);
|
||||
res.put("message", "请求成功!");
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray getCutCacheAgvPoints() {
|
||||
List<BstIvtCutpointivt> list = bcutpointivtService.getPintByAgvCodesByPointType("3");
|
||||
JSONArray jsonArray = list.stream()
|
||||
.map(item -> {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("text", item.getPoint_code());
|
||||
jsonObject.put("value", item.getPoint_name());
|
||||
return jsonObject;
|
||||
})
|
||||
.collect(Collectors.toCollection(JSONArray::new));
|
||||
return jsonArray;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject toCleanCutCacheInventory(JSONObject param) {
|
||||
log.info("手持清理分切暂存位参数:{}", param);
|
||||
// param: point_code
|
||||
String pointCode = param.getString("point_code");
|
||||
RLock open = redissonClient.getLock(pointCode);
|
||||
boolean openLock;
|
||||
try {
|
||||
openLock = open.tryLock(0, TimeUnit.SECONDS);
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
try {
|
||||
if (openLock) {
|
||||
BstIvtCutpointivt agvCode = bcutpointivtService.getPintByAgvCode(pointCode, false);
|
||||
agvCode.setQzz_no1("");
|
||||
agvCode.setQzz_no2("");
|
||||
agvCode.setPoint_status("1");
|
||||
TaskUtils.updateOptMessageByBCutPoint(agvCode);
|
||||
bcutpointivtService.updateById(agvCode);
|
||||
} else {
|
||||
throw new BadRequestException("系统繁忙,稍后在试!!");
|
||||
}
|
||||
} finally {
|
||||
if (openLock) {
|
||||
open.unlock();
|
||||
}
|
||||
}
|
||||
JSONObject res = new JSONObject();
|
||||
res.put("status", HttpStatus.HTTP_OK);
|
||||
res.put("message", "库存清除成功!");
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,9 @@ package org.nl.b_lms.sch.tasks.slitter.util;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.nl.b_lms.bst.ivt.papervehicle.service.dao.MdPbPapervehicle;
|
||||
import org.nl.b_lms.bst.ivt.stockingivt.service.dao.BstIvtStockingivt;
|
||||
import org.nl.b_lms.pdm.bi.slittingproductionplan.service.dao.PdmBiSlittingproductionplan;
|
||||
import org.nl.b_lms.sch.tasks.slitter.constant.SlitterConstant;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
@@ -178,4 +181,64 @@ public class SlitterTaskUtil {
|
||||
}
|
||||
return "1";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询是否包含在内
|
||||
* @param names 数组
|
||||
* @param name 自负床
|
||||
* @return Boolean 是 {@code true} or 否{@code false}
|
||||
*/
|
||||
public static boolean containscode(String[] names, String name) {
|
||||
for (String n : names) {
|
||||
if (name.equals(n)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取name在数组中的索引
|
||||
* @param names 数组
|
||||
* @param name 校验字符
|
||||
* @return 索引
|
||||
*/
|
||||
public static int getIndex(String[] names, String name) {
|
||||
for (int i = 0; i < names.length; i++) {
|
||||
if (name.equals(names[i])) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
// 如果找不到返回-1
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 业务:备货区送纸管托盘时候,将纸管信息带给任务中的参数
|
||||
* @param paperList 备货区纸管信息
|
||||
* @param param 任务参数json
|
||||
*/
|
||||
public static void doSavePaperInfos(List<MdPbPapervehicle> paperList, JSONObject param) {
|
||||
String[] material_codes = new String[paperList.size()];
|
||||
String[] material_specs = new String[paperList.size()];
|
||||
int[] qtys = new int[paperList.size()];
|
||||
for (int i = 0; i < paperList.size(); i++) {
|
||||
MdPbPapervehicle vehicle = paperList.get(i);
|
||||
String materialCode = vehicle.getMaterial_code();
|
||||
int qty = vehicle.getQty().intValue();
|
||||
if (containscode(material_codes, materialCode)) {
|
||||
int index = getIndex(material_codes, materialCode);
|
||||
qtys[index] += qty;
|
||||
} else {
|
||||
material_codes[i] = vehicle.getMaterial_code();
|
||||
String spec = getComposePaperTubeInformation(vehicle.getMaterial_name());
|
||||
material_specs[i] = spec;
|
||||
qtys[i] = qty;
|
||||
}
|
||||
}
|
||||
param.put("to_material", material_codes);
|
||||
param.put("to_spec", material_codes);
|
||||
param.put("to_qty", qtys);
|
||||
param.put("device_code", material_specs);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.nl.common.utils;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.b_lms.bst.ivt.cutpointivt.service.dao.BstIvtCutpointivt;
|
||||
import org.nl.b_lms.bst.ivt.shafttubeivt.service.dao.BstIvtShafttubeivt;
|
||||
@@ -44,6 +45,24 @@ public class TaskUtils {
|
||||
source.setUpdate_time(now);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据任务维护分切点位库存
|
||||
* @param taskObj 任务
|
||||
* @param endPointObj 点位
|
||||
* @param status 状态
|
||||
*/
|
||||
public static void pointMaintenanceInventory(SchBaseTask task, BstIvtCutpointivt target, String status) {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
target.setQzz_no1(task.getVehicle_code());
|
||||
target.setQzz_no2(task.getVehicle_code2());
|
||||
target.setPoint_status(status);
|
||||
target.setUpdate_optid(currentUserId);
|
||||
target.setUpdate_optname(currentUsername);
|
||||
target.setUpdate_time(now);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用0,1,2,3四个的二进制字符表示是下单(双)上单(双)
|
||||
* @param currentUpPlan 要下来的上轴
|
||||
|
||||
@@ -110,12 +110,17 @@ public class AcsToWmsController {
|
||||
}
|
||||
|
||||
@PostMapping("/actionFinishRequest")
|
||||
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> actionFinishRequest(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(acsToWmsService.actionFinishRequest(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/actionFinishRequest2")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> actionFinishRequest2(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(acsToWmsService.actionFinishRequest2(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
/*@PostMapping("/getQZZInfo")
|
||||
|
||||
@SaIgnore
|
||||
|
||||
@@ -202,4 +202,11 @@ public interface AcsToWmsService {
|
||||
* @return /
|
||||
*/
|
||||
JSONObject getBoxInfo(JSONObject param);
|
||||
|
||||
/**
|
||||
* 二楼取货完成请求
|
||||
* @param param /
|
||||
* @return /
|
||||
*/
|
||||
JSONObject actionFinishRequest2(JSONObject param);
|
||||
}
|
||||
|
||||
@@ -2310,4 +2310,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
jsonObject.put("status", HttpStatus.OK.value());
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject actionFinishRequest2(JSONObject param) {
|
||||
return slitterService.acsActionFinishRequestToRelease(param);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ public enum TaskStatusEnum {
|
||||
ISSUE("05", "下发"),
|
||||
EXECUTING("06", "执行中"),
|
||||
FINISHED("07", "完成"),
|
||||
PICK_UP_COMPLETED("071", "取货完成,执行中"),
|
||||
CANCEL("08", "取消");
|
||||
|
||||
private String name;
|
||||
|
||||
Reference in New Issue
Block a user