add: 优化
This commit is contained in:
@@ -16,9 +16,12 @@ import org.nl.wms.pdm.bi.dao.PdmBiRawfoilworkorder;
|
||||
import org.nl.wms.pdm.bi.service.IpdmBiRawfoilworkorderService;
|
||||
import org.nl.wms.pdm.ivt.raw.service.IstIvtSbpointivtService;
|
||||
import org.nl.wms.pdm.ivt.raw.service.dao.StIvtSbpointivt;
|
||||
import org.nl.wms.sch.point.service.ISchBasePointService;
|
||||
import org.nl.wms.sch.point.service.dao.SchBasePoint;
|
||||
import org.nl.wms.sch.task.service.ISchBaseTaskService;
|
||||
import org.nl.wms.sch.task.service.dao.SchBaseTask;
|
||||
import org.nl.wms.sch.task_manage.core.constant.GeneralDefinition;
|
||||
import org.nl.wms.sch.task_manage.core.constant.RegionConstant;
|
||||
import org.nl.wms.sch.task_manage.tasks.raw.RawCallRollTrussTask;
|
||||
import org.nl.wms.sch.task_manage.tasks.raw.RawDownAGVTask;
|
||||
import org.nl.wms.sch.task_manage.tasks.slitter.SlitterSendRollAGVTask;
|
||||
@@ -30,8 +33,10 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import static org.nl.wms.sch.task_manage.core.constant.hot.HotConstant.*;
|
||||
import static org.nl.wms.util.TaskUtils.createVirtualContainer;
|
||||
|
||||
/**
|
||||
@@ -56,6 +61,9 @@ public class RawFoilPdaServiceImpl implements RawFoilPdaService {
|
||||
private IstIvtSbpointivtService stIvtSbpointivtService;
|
||||
@Autowired
|
||||
private SlitterSendRollAGVTask slitterSendRollAGVTask;
|
||||
|
||||
@Autowired
|
||||
private ISchBasePointService pointService;
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public JSONObject needEmptyVehicle(JSONObject param) {
|
||||
@@ -190,6 +198,16 @@ public class RawFoilPdaServiceImpl implements RawFoilPdaService {
|
||||
}
|
||||
PdmBiRawfoilworkorder order = rawfoilworkorderService.getByContainerName(orderCode);
|
||||
|
||||
// 找对接位(状态是空的,没有任务的) 如果只有一个位置不能下生箔agv任务
|
||||
List<SchBasePoint> points = pointService.getHotNotTaskPoint2(RegionConstant.A1, RegionConstant.REGION_A1_HXZC,
|
||||
POINT_TYPE_HOT_DOCKING, POINT_STATUS_EMPTY,"1");
|
||||
if (points.size()<2){
|
||||
throw new BadRequestException("对接位已有两个被占用,请尽快处理");
|
||||
}
|
||||
// 锁定位置设置为待绑定
|
||||
SchBasePoint schBasePoint = points.get(0);
|
||||
schBasePoint.setPoint_status(POINT_STATUS_BINDING);
|
||||
pointService.updateById(schBasePoint);
|
||||
if (ObjectUtil.isNotEmpty(order)) {
|
||||
order.setTheory_height(new BigDecimal(theory_height));
|
||||
order.setProductin_qty(new BigDecimal(productin_qty));
|
||||
|
||||
@@ -119,6 +119,11 @@ public class SlitterPdaServiceImpl implements SlitterPdaService {
|
||||
if (isTask) {
|
||||
throw new BadRequestException("点位[" + pointCode + "、" + zcPoint + "]已经创建过任务!");
|
||||
}
|
||||
|
||||
if (!pointCode.contains("_M")){
|
||||
throw new BadRequestException("点位[" + pointCode + "]有误,请扫描满轴位!");
|
||||
}
|
||||
|
||||
//校验分切上料任务数
|
||||
Boolean isTask2 = taskService.checkHaveTaskByPointsType();
|
||||
// 判断是否呼叫过任务
|
||||
@@ -487,7 +492,7 @@ public class SlitterPdaServiceImpl implements SlitterPdaService {
|
||||
plan.setSplit_group(virtualContainer);
|
||||
plan.setDescription("-");
|
||||
plan.setWare_house("-");
|
||||
plan.setResource_name(cutDevice.getPoint_code());
|
||||
plan.setResource_name(cutDevice.getExt_code());
|
||||
plan.setManufacture_sort("1");
|
||||
plan.setMfg_order_name("-");
|
||||
plan.setManufacture_date(DateUtil.format(new Date(), "yyyy-MM-dd"));
|
||||
|
||||
@@ -384,7 +384,7 @@ public class NbjPdaServiceImpl implements NbjPdaService {
|
||||
.map(item -> {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("text", item.getPoint_code());
|
||||
jsonObject.put("value", item.getPoint_code());
|
||||
jsonObject.put("value", item.getExt_code());
|
||||
return jsonObject;
|
||||
})
|
||||
.collect(Collectors.toCollection(JSONArray::new));
|
||||
|
||||
@@ -99,7 +99,7 @@ public interface ISchBasePointService extends IService<SchBasePoint> {
|
||||
*/
|
||||
List<SchBasePoint> getHotNotTaskPoint(String area, String region, String pointType, String pointStatus);
|
||||
|
||||
List<SchBasePoint> getHotNotTaskPoint2(String area, String region, String pointType, String pointStatus);
|
||||
List<SchBasePoint> getHotNotTaskPoint2(String area, String region, String pointType, String pointStatus,String lockType);
|
||||
|
||||
/**
|
||||
* 从点位查找以下条件可用的没任务点位
|
||||
|
||||
@@ -35,7 +35,7 @@ public interface SchBasePointMapper extends BaseMapper<SchBasePoint> {
|
||||
*/
|
||||
List<SchBasePoint> getHotNotTaskPoint(String area, String region, String pointType, String pointStatus);
|
||||
|
||||
List<SchBasePoint> getHotNotTaskPoint2(String area, String region, String pointType, String pointStatus);
|
||||
List<SchBasePoint> getHotNotTaskPoint2(String area, String region, String pointType, String pointStatus,String lockType);
|
||||
|
||||
|
||||
List<SchBasePoint> getAllBusinessNotTaskPoint(String area, String region, String pointType, String pointStatus,
|
||||
|
||||
@@ -47,6 +47,9 @@
|
||||
<if test="pointType != null">
|
||||
AND p.point_type = #{pointType}
|
||||
</if>
|
||||
<if test="lockType != null">
|
||||
AND p.lock_type = #{lockType}
|
||||
</if>
|
||||
AND p.point_status = #{pointStatus}
|
||||
AND p.is_used = TRUE
|
||||
AND 0 = (SELECT COUNT(*) FROM sch_base_task t WHERE t.task_status <![CDATA[<]]> '071' and t.task_status <![CDATA[<>]]> '07'
|
||||
|
||||
@@ -273,8 +273,8 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SchBasePoint> getHotNotTaskPoint2(String area, String region, String pointType, String pointStatus) {
|
||||
return pointMapper.getHotNotTaskPoint2(area, region, pointType, pointStatus);
|
||||
public List<SchBasePoint> getHotNotTaskPoint2(String area, String region, String pointType, String pointStatus,String lockType) {
|
||||
return pointMapper.getHotNotTaskPoint2(area, region, pointType, pointStatus,lockType);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -15,6 +15,8 @@ public class HotConstant {
|
||||
/** 点位状态:待质检 */
|
||||
public final static String POINT_STATUS_WAIT_QUALITY = "3";
|
||||
|
||||
/** 点位类型:烘箱对接位 */
|
||||
public final static String POINT_STATUS_BINDING = "5";
|
||||
/** 烘箱点位(非对接位)状态 -空位 */
|
||||
public final static String HOT_STATUS_EMPTY = "01";
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public class InHotDockingTrussTask extends AbstractTask {
|
||||
TaskUtils.taskLock(RegionConstant.REGION_A1_HXZC + "5", () -> {
|
||||
// 找个对接位(状态是空的,没有任务的)
|
||||
List<SchBasePoint> endPoints = pointService.getHotNotTaskPoint2(RegionConstant.A1, RegionConstant.REGION_A1_HXZC,
|
||||
POINT_TYPE_HOT_DOCKING, POINT_STATUS_EMPTY);
|
||||
POINT_TYPE_HOT_DOCKING, POINT_STATUS_BINDING,"1");
|
||||
if (endPoints.size() == 0) {
|
||||
throw new BadRequestException("没有可用的烘箱对接位!");
|
||||
}
|
||||
@@ -74,9 +74,10 @@ public class InHotDockingTrussTask extends AbstractTask {
|
||||
// 点位赋值。
|
||||
String endPointCode = taskObj.getPoint_code2();
|
||||
SchBasePoint endPoint = pointService.getById(endPointCode);
|
||||
endPoint.setPoint_status("5");
|
||||
endPoint.setMaterial_code(orderCode);
|
||||
endPoint.setVehicle_code(taskObj.getVehicle_code());
|
||||
//添加入库锁
|
||||
endPoint.setLock_type("2");
|
||||
PointUtils.setUpdateByType(endPoint, taskFinishedType);
|
||||
pointService.updateById(endPoint);
|
||||
// 完成
|
||||
|
||||
@@ -95,6 +95,7 @@ public class InHotTrussTask extends AbstractTask {
|
||||
// 如果需要烘烤, 先找对应点
|
||||
List<StIvtHotpointivt> hotList = hotpointivtService.getNotTaskHotOven(order.getRoll_type(), "1","01");
|
||||
if (hotList.size() > 0) {
|
||||
|
||||
List<StIvtHotpointivt> hotListFilter = multiFilter(hotList);
|
||||
// 查找合适温度的点位
|
||||
for (StIvtHotpointivt hotPoint : hotListFilter) {
|
||||
@@ -185,16 +186,49 @@ public class InHotTrussTask extends AbstractTask {
|
||||
//先筛选烘箱没有母卷的点位
|
||||
for (String groupName : stIvtHotListMap.keySet()) {
|
||||
if (!groupNames.contains(groupName)) {
|
||||
return stIvtHotListMap.get(groupName);
|
||||
moveToFirst(hotList,stIvtHotListMap.get(groupName).get(0));
|
||||
return hotList;
|
||||
}
|
||||
}
|
||||
//再筛选烘箱里母卷少的点位
|
||||
return stIvtHotListMap.values().stream()
|
||||
List<StIvtHotpointivt> stIvtHotpointivts1 = stIvtHotListMap.values().stream()
|
||||
.filter(Objects::nonNull)
|
||||
.sorted(Comparator.comparingInt(List::size))
|
||||
.limit(1)
|
||||
.collect(Collectors.toList()).get(0);
|
||||
moveToFirst(hotList,stIvtHotpointivts1.get(0));
|
||||
return hotList;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 将列表中的指定元素移动到首位
|
||||
* @param list 要操作的列表
|
||||
* @param element 要移动到首位的元素
|
||||
* @param <T> 列表中元素的类型
|
||||
* @return 如果元素存在且移动成功返回true,否则返回false
|
||||
*/
|
||||
public static <T> boolean moveToFirst(List<T> list, T element) {
|
||||
// 检查列表是否为空
|
||||
if (list == null || list.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 查找元素在列表中的索引
|
||||
int index = list.indexOf(element);
|
||||
|
||||
// 如果元素不存在或已经在首位,则无需操作
|
||||
if (index == -1 || index == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 先移除元素,再添加到首位
|
||||
list.remove(index);
|
||||
list.add(0, element);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -56,7 +56,7 @@ public class OutHotToDockingTrussTask extends AbstractTask {
|
||||
TaskUtils.taskLock(REGION_A1_HXZC + "5", () -> {
|
||||
// 从烘箱对接位中找一个空位
|
||||
List<SchBasePoint> endPoints = pointService.getHotNotTaskPoint2(RegionConstant.A1, RegionConstant.REGION_A1_HXZC,
|
||||
POINT_TYPE_HOT_DOCKING, POINT_STATUS_EMPTY);
|
||||
POINT_TYPE_HOT_DOCKING, POINT_STATUS_EMPTY,"1");
|
||||
if (endPoints.size() == 0) {
|
||||
throw new BadRequestException("没有可用的烘箱对接位!");
|
||||
}
|
||||
|
||||
@@ -134,6 +134,14 @@ public class OutHotTrussTask extends AbstractTask {
|
||||
}
|
||||
// 起点清空
|
||||
hotClearPoint(startPoint, taskFinishedType);
|
||||
//如果是烘烤完毕暂存的,任务完成后起点设置为暂存中
|
||||
if ("04".equals(startPoint.getPoint_status())){
|
||||
StIvtHotpointivt hotpointivt = hotpointivtService.getPointByCode(startPointCode, false);
|
||||
hotpointivt.setPoint_status("03");
|
||||
hotpointivt.setInstorage_time(DateUtil.now());
|
||||
hotpointivtService.updateById(hotpointivt);
|
||||
}
|
||||
|
||||
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||
taskObj.setFinished_type(taskFinishedType.getCode());
|
||||
setUpdateByType(taskObj, taskFinishedType);
|
||||
|
||||
@@ -68,7 +68,7 @@ public class SlitterUpTrussTask extends AbstractTask {
|
||||
String pointCode = requestObj.getString("zc_point");
|
||||
// 终点为出口
|
||||
List<SchBasePoint> endPoints = pointService.getHotNotTaskPoint2("A1", HX_REGION,
|
||||
"5", "1");
|
||||
"5", "1","1");
|
||||
if (endPoints.size() == 0) {
|
||||
throw new BadRequestException("烘箱没有可以用的对接位!");
|
||||
}
|
||||
|
||||
@@ -59,6 +59,7 @@ public class PointUtils {
|
||||
point.setIng_task_code("");
|
||||
point.setSource_id("");
|
||||
point.setVehicle_qty(0);
|
||||
point.setLock_type("1");
|
||||
point.setMaterial_code("");
|
||||
point.setUpdate_time(DateUtil.now());
|
||||
setUpdateByType(point, taskFinishedType);
|
||||
|
||||
Reference in New Issue
Block a user