Merge branch 'b_lms' of http://121.40.234.130:8899/root/lanzhouhailiang_one into b_lms
# Conflicts: # lms/nladmin-system/src/main/java/org/nl/b_lms/sch/tasks/slitter/service/SlitterService.java # lms/nladmin-system/src/main/java/org/nl/b_lms/sch/tasks/slitter/service/impl/SlitterServiceImpl.java
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
package org.nl.b_lms.bst.ivt.papervehicle.controller;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.b_lms.bst.ivt.papervehicle.service.IMdPbPapervehicleService;
|
||||
import org.nl.common.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.b_lms.bst.ivt.papervehicle.service.dao.MdPbPapervehicle;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
/**
|
||||
* @author lyd
|
||||
* @date 2024-06-04
|
||||
**/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/mdPbPapervehicle")
|
||||
public class MdPbPapervehicleController {
|
||||
|
||||
@Autowired
|
||||
private IMdPbPapervehicleService mdPbPapervehicleService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询管芯托盘库存")
|
||||
//@SaCheckPermission("@el.check('mdPbPapervehicle:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page){
|
||||
return new ResponseEntity<>(TableDataInfo.build(mdPbPapervehicleService.queryAll(whereJson,page)),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增管芯托盘库存")
|
||||
//@SaCheckPermission("@el.check('mdPbPapervehicle:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody MdPbPapervehicle entity){
|
||||
mdPbPapervehicleService.create(entity);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改管芯托盘库存")
|
||||
//@SaCheckPermission("@el.check('mdPbPapervehicle:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody MdPbPapervehicle entity){
|
||||
mdPbPapervehicleService.update(entity);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除管芯托盘库存")
|
||||
//@SaCheckPermission("@el.check('mdPbPapervehicle:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) {
|
||||
mdPbPapervehicleService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package org.nl.b_lms.bst.ivt.papervehicle.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.b_lms.bst.ivt.papervehicle.service.dao.MdPbPapervehicle;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @description 服务接口
|
||||
* @author lyd
|
||||
* @date 2024-06-04
|
||||
**/
|
||||
public interface IMdPbPapervehicleService extends IService<MdPbPapervehicle> {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param whereJson 条件
|
||||
* @param pageable 分页参数
|
||||
* @return IPage<MdPbPapervehicle>
|
||||
*/
|
||||
IPage<MdPbPapervehicle> queryAll(Map whereJson, PageQuery pageable);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param entity /
|
||||
*/
|
||||
void create(MdPbPapervehicle entity);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param entity /
|
||||
*/
|
||||
void update(MdPbPapervehicle entity);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Set<String> ids);
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package org.nl.b_lms.bst.ivt.papervehicle.service.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
* @description /
|
||||
* @date 2024-06-04
|
||||
**/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("md_pb_papervehicle")
|
||||
public class MdPbPapervehicle implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 载具标识 */
|
||||
@TableId(value = "ivt_id", type = IdType.NONE)
|
||||
private String ivt_id;
|
||||
|
||||
/**
|
||||
* 托盘号
|
||||
*/
|
||||
private String vehicle_code;
|
||||
|
||||
/**
|
||||
* 排
|
||||
*/
|
||||
private String row_num;
|
||||
|
||||
/**
|
||||
* 物料号
|
||||
*/
|
||||
private String material_code;
|
||||
|
||||
/**
|
||||
* 物料名称
|
||||
*/
|
||||
private String material_name;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private BigDecimal qty;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private Long update_optid;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private String update_optname;
|
||||
|
||||
/**
|
||||
* 修改人姓名
|
||||
*/
|
||||
private String update_time;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package org.nl.b_lms.bst.ivt.papervehicle.service.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.nl.b_lms.bst.ivt.papervehicle.service.dao.MdPbPapervehicle;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
* @date 2024-06-04
|
||||
**/
|
||||
public interface MdPbPapervehicleMapper extends BaseMapper<MdPbPapervehicle> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.nl.b_lms.bst.ivt.papervehicle.service.dao.mapper.MdPbPapervehicleMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,62 @@
|
||||
package org.nl.b_lms.bst.ivt.papervehicle.service.dto;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
* @description /
|
||||
* @date 2024-06-04
|
||||
**/
|
||||
@Data
|
||||
@Builder
|
||||
public class MdPbPapervehicleDto implements Serializable {
|
||||
|
||||
/**
|
||||
* 载具标识
|
||||
*/
|
||||
private String ivt_id;
|
||||
|
||||
/**
|
||||
* 托盘号
|
||||
*/
|
||||
private String vehicle_code;
|
||||
|
||||
/**
|
||||
* 排
|
||||
*/
|
||||
private String row_num;
|
||||
|
||||
/**
|
||||
* 物料号
|
||||
*/
|
||||
private String material_code;
|
||||
|
||||
/**
|
||||
* 物料名称
|
||||
*/
|
||||
private String material_name;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private BigDecimal qty;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private Long update_optid;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private String update_optname;
|
||||
/**
|
||||
* 修改人姓名
|
||||
*/
|
||||
private String update_time;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package org.nl.b_lms.bst.ivt.papervehicle.service.dto;
|
||||
|
||||
import org.nl.common.domain.query.BaseQuery;
|
||||
import org.nl.b_lms.bst.ivt.papervehicle.service.dao.MdPbPapervehicle;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
* @date 2024-06-04
|
||||
**/
|
||||
public class MdPbPapervehicleQuery extends BaseQuery<MdPbPapervehicle> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package org.nl.b_lms.bst.ivt.papervehicle.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
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.papervehicle.service.dao.mapper.MdPbPapervehicleMapper;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @description 服务实现
|
||||
* @author lyd
|
||||
* @date 2024-06-04
|
||||
**/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class MdPbPapervehicleServiceImpl extends ServiceImpl<MdPbPapervehicleMapper, MdPbPapervehicle> implements IMdPbPapervehicleService {
|
||||
|
||||
@Autowired
|
||||
private MdPbPapervehicleMapper mdPbPapervehicleMapper;
|
||||
|
||||
@Override
|
||||
public IPage<MdPbPapervehicle> queryAll(Map whereJson, PageQuery page){
|
||||
LambdaQueryWrapper<MdPbPapervehicle> lam = new LambdaQueryWrapper<>();
|
||||
IPage<MdPbPapervehicle> pages = new Page<>(page.getPage() + 1, page.getSize());
|
||||
mdPbPapervehicleMapper.selectPage(pages, lam);
|
||||
return pages;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(MdPbPapervehicle entity) {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
entity.setIvt_id(IdUtil.getSnowflake(1, 1).nextIdStr());
|
||||
entity.setUpdate_optid(Long.valueOf(currentUserId));
|
||||
entity.setUpdate_optname(nickName);
|
||||
entity.setUpdate_time(now);
|
||||
mdPbPapervehicleMapper.insert(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(MdPbPapervehicle entity) {
|
||||
MdPbPapervehicle dto = mdPbPapervehicleMapper.selectById(entity.getIvt_id());
|
||||
if (dto == null) {
|
||||
throw new BadRequestException("被删除或无权限,操作失败");
|
||||
}
|
||||
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
entity.setUpdate_optid(Long.valueOf(currentUserId));
|
||||
entity.setUpdate_optname(nickName);
|
||||
entity.setUpdate_time(now);
|
||||
|
||||
mdPbPapervehicleMapper.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAll(Set<String> ids) {
|
||||
// 真删除
|
||||
mdPbPapervehicleMapper.deleteBatchIds(ids);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import org.nl.common.domain.query.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.b_lms.bst.ivt.stockingivt.service.dao.BstIvtStockingivt;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -40,4 +41,38 @@ public interface IBstIvtStockingivtService extends IService<BstIvtStockingivt> {
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Set<String> ids);
|
||||
|
||||
/**
|
||||
* 获取备货区中指定条件的货位
|
||||
* @param pointType 类型:0暂存位置,1靠近分切机
|
||||
* @param tube 纸管号 两个都是一样的,因此拿一个就行
|
||||
* @param location 位置:0上区域,1下区域
|
||||
* @param qty 数量
|
||||
* @return /
|
||||
*/
|
||||
List<BstIvtStockingivt> getPaperTubePoint(String pointType, String tube, String location, int qty);
|
||||
|
||||
/**
|
||||
* 获取备货区空位,没有任务的位置
|
||||
* @param location 位置:0上区域,1下区域
|
||||
* @param pointType 类型:0暂存位置,1靠近分切机
|
||||
* @return /
|
||||
*/
|
||||
List<BstIvtStockingivt> getEmptyPointNotTask(String location, String pointType);
|
||||
|
||||
/**
|
||||
* 根据点位编码获取备货区点位
|
||||
* @param pointCode 编码
|
||||
* @param flag 是否校验可用
|
||||
* @return /
|
||||
*/
|
||||
BstIvtStockingivt getPointByCode(String pointCode, boolean flag);
|
||||
|
||||
/**
|
||||
* 获取一个可以搬走的位置
|
||||
* @param location 位置:0上区域,1下区域
|
||||
* @param pointType 类型:0暂存位置,1靠近分切机
|
||||
* @return /
|
||||
*/
|
||||
BstIvtStockingivt getCanMovePointOne(String location, String pointType);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.nl.b_lms.bst.ivt.stockingivt.service.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Builder;
|
||||
@@ -76,5 +77,7 @@ public class BstIvtStockingivt implements Serializable {
|
||||
|
||||
/** 规划 */
|
||||
private String plan;
|
||||
@TableField(exist = false)
|
||||
private Integer qty;
|
||||
|
||||
}
|
||||
|
||||
@@ -3,10 +3,30 @@ package org.nl.b_lms.bst.ivt.stockingivt.service.dao.mapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.nl.b_lms.bst.ivt.stockingivt.service.dao.BstIvtStockingivt;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
* @date 2024-02-26
|
||||
**/
|
||||
public interface BstIvtStockingivtMapper extends BaseMapper<BstIvtStockingivt> {
|
||||
|
||||
/**
|
||||
* 获取备货区中指定条件的货位
|
||||
* @param pointType 类型:0暂存位置,1靠近分切机
|
||||
* @param tube 纸管号 两个都是一样的,因此拿一个就行
|
||||
* @param location 位置:0上区域,1下区域
|
||||
* @param qty 数量
|
||||
* @return /
|
||||
*/
|
||||
List<BstIvtStockingivt> getPaperTubePoint(String pointType, String tube, String location, int qty);
|
||||
/**
|
||||
* 获取备货区空位,没有任务的位置
|
||||
* @param location 位置:0上区域,1下区域
|
||||
* @param pointType 类型:0暂存位置,1靠近分切机
|
||||
* @return /
|
||||
*/
|
||||
List<BstIvtStockingivt> getEmptyPointNotTask(String location, String pointType);
|
||||
|
||||
BstIvtStockingivt getCanMovePointOne(String location, String pointType);
|
||||
}
|
||||
|
||||
@@ -2,4 +2,49 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.nl.b_lms.bst.ivt.stockingivt.service.dao.mapper.BstIvtStockingivtMapper">
|
||||
|
||||
<select id="getPaperTubePoint" resultType="org.nl.b_lms.bst.ivt.stockingivt.service.dao.BstIvtStockingivt">
|
||||
SELECT bs.*,
|
||||
mp.qty
|
||||
FROM `bst_ivt_stockingivt` bs
|
||||
LEFT JOIN md_pb_papervehicle mp ON mp.vehicle_code = bs.vehicle_code
|
||||
WHERE bs.point_location = #{location}
|
||||
AND bs.point_type = #{pointType}
|
||||
AND bs.ivt_status = '1'
|
||||
AND bs.is_used = '1'
|
||||
AND mp.material_code = #{tube}
|
||||
AND mp.qty <![CDATA[ >= ]]> #{qty}
|
||||
AND 0 = (SELECT COUNT(*)
|
||||
FROM sch_base_task t
|
||||
WHERE (t.point_code1 = bs.point_code OR t.point_code2 = bs.point_code OR
|
||||
t.point_code3 = bs.point_code)
|
||||
AND t.task_status <![CDATA[ < ]]> '07')
|
||||
</select>
|
||||
<select id="getEmptyPointNotTask"
|
||||
resultType="org.nl.b_lms.bst.ivt.stockingivt.service.dao.BstIvtStockingivt">
|
||||
SELECT bs.*
|
||||
FROM `bst_ivt_stockingivt` bs
|
||||
WHERE bs.point_type = #{pointType}
|
||||
AND bs.point_location = #{location}
|
||||
AND bs.is_used = '1'
|
||||
AND bs.ivt_status = '0'
|
||||
AND 0 = (SELECT COUNT(*)
|
||||
FROM sch_base_task t
|
||||
WHERE (t.point_code1 = bs.point_code OR t.point_code2 = bs.point_code OR
|
||||
t.point_code3 = bs.point_code)
|
||||
AND t.task_status <![CDATA[ < ]]> '07')
|
||||
</select>
|
||||
<select id="getCanMovePointOne"
|
||||
resultType="org.nl.b_lms.bst.ivt.stockingivt.service.dao.BstIvtStockingivt">
|
||||
SELECT bs.*
|
||||
FROM `bst_ivt_stockingivt` bs
|
||||
LEFT JOIN md_pb_papervehicle mp ON mp.vehicle_code = bs.vehicle_code
|
||||
WHERE bs.point_type = #{pointType}
|
||||
AND bs.point_location = #{location}
|
||||
AND 0 = (SELECT COUNT(*)
|
||||
FROM sch_base_task t
|
||||
WHERE (t.point_code1 = bs.point_code OR t.point_code2 = bs.point_code OR
|
||||
t.point_code3 = bs.point_code)
|
||||
AND t.task_status <![CDATA[ < ]]> '07')
|
||||
ORDER BY bs.ivt_status, mp.qty LIMIT 1
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.b_lms.sch.tasks.slitter.constant.SlitterConstant;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
@@ -17,6 +18,7 @@ import org.nl.b_lms.bst.ivt.stockingivt.service.dao.BstIvtStockingivt;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -77,4 +79,27 @@ public class BstIvtStockingivtServiceImpl extends ServiceImpl<BstIvtStockingivtM
|
||||
bstIvtStockingivtMapper.deleteBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BstIvtStockingivt> getPaperTubePoint(String pointType, String tube, String location, int qty) {
|
||||
return bstIvtStockingivtMapper.getPaperTubePoint(pointType, tube, location, qty);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BstIvtStockingivt> getEmptyPointNotTask(String location, String pointType) {
|
||||
return bstIvtStockingivtMapper.getEmptyPointNotTask(location, pointType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BstIvtStockingivt getPointByCode(String pointCode, boolean flag) {
|
||||
LambdaQueryWrapper<BstIvtStockingivt> lam = new LambdaQueryWrapper<>();
|
||||
lam.eq(BstIvtStockingivt::getPoint_code, pointCode)
|
||||
.eq(flag, BstIvtStockingivt::getIs_used, SlitterConstant.SLITTER_YES);
|
||||
return bstIvtStockingivtMapper.selectOne(lam);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BstIvtStockingivt getCanMovePointOne(String location, String pointType) {
|
||||
return bstIvtStockingivtMapper.getCanMovePointOne(location, pointType);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
package org.nl.b_lms.sch.tasks.slitter;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
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;
|
||||
import org.nl.b_lms.sch.task.service.IschBaseTaskService;
|
||||
import org.nl.b_lms.storage_manage.ios.enums.IOSEnum;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.common.utils.TaskUtils;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.wms.sch.AcsTaskDto;
|
||||
import org.nl.wms.sch.manage.AbstractAcsTask;
|
||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 备货区送纸管到机械手旁边的备货区 - AGV任务
|
||||
* @Date: 2024/6/4
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class StockAreaCallTubeTask extends AbstractAcsTask {
|
||||
private final String THIS_CLASS = StockAreaCallTubeTask.class.getName();
|
||||
@Autowired
|
||||
private IschBaseTaskService taskService;
|
||||
@Autowired
|
||||
private IBstIvtStockingivtService stockingivtService;
|
||||
@Override
|
||||
public List<AcsTaskDto> addTask() {
|
||||
/*
|
||||
* 下发给ACS时需要特殊处理
|
||||
*/
|
||||
List<SchBaseTask> taskList = taskService.getIssueTasks(THIS_CLASS);
|
||||
|
||||
ArrayList<AcsTaskDto> resultList = new ArrayList<>();
|
||||
String agv_system_type = "2";
|
||||
for (SchBaseTask task : taskList) {
|
||||
AcsTaskDto dto = AcsTaskDto.builder()
|
||||
.ext_task_id(task.getTask_id())
|
||||
.task_code(task.getTask_code())
|
||||
.task_type(task.getAcs_task_type())
|
||||
.start_device_code(task.getPoint_code1())
|
||||
.next_device_code(task.getPoint_code2())
|
||||
.start_device_code2(task.getPoint_code3())
|
||||
.next_device_code2(task.getPoint_code4())
|
||||
.vehicle_code(task.getVehicle_code())
|
||||
.agv_system_type(agv_system_type)
|
||||
.priority(task.getPriority())
|
||||
.remark(task.getRemark())
|
||||
.product_area(task.getProduct_area())
|
||||
.build();
|
||||
resultList.add(dto);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||
SchBaseTask task = taskService.getById(taskObj.getString("task_id"));
|
||||
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
|
||||
// 更新任务状态为执行中
|
||||
task.setTask_status(TaskStatusEnum.EXECUTING.getCode());
|
||||
}
|
||||
if (StrUtil.equals(status, TaskStatusEnum.FINISHED.getCode())) {
|
||||
task.setTask_status(TaskStatusEnum.FINISHED.getCode());
|
||||
String startPoint = task.getPoint_code1();
|
||||
String endPoint = task.getPoint_code2();
|
||||
BstIvtStockingivt startPointObj = stockingivtService.getPointByCode(startPoint, false);
|
||||
BstIvtStockingivt endPointObj = stockingivtService.getPointByCode(endPoint, false);
|
||||
// 互换资源 (交换载具号)
|
||||
endPointObj.setIvt_status("1");
|
||||
endPointObj.setVehicle_code(task.getVehicle_code());
|
||||
TaskUtils.updateOptMessageByBStockingPoint(endPointObj);
|
||||
stockingivtService.update(endPointObj);
|
||||
startPointObj.setVehicle_code("");
|
||||
startPointObj.setIvt_status("0");
|
||||
TaskUtils.updateOptMessageByBStockingPoint(startPointObj);
|
||||
stockingivtService.update(startPointObj);
|
||||
}
|
||||
// 取消
|
||||
if (status.equals(IOSEnum.IS_NOTANDYES.code("否"))) {
|
||||
task.setTask_status(TaskStatusEnum.FINISHED.getCode());
|
||||
}
|
||||
task.setUpdate_time(DateUtil.now());
|
||||
taskService.updateById(task);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createTask(JSONObject form) {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
|
||||
SchBaseTask task = new SchBaseTask();
|
||||
task.setTask_id(IdUtil.getSnowflake(1, 1).nextIdStr());
|
||||
task.setTask_code(IdUtil.getSnowflake(1, 1).nextIdStr());
|
||||
task.setTask_status(TaskStatusEnum.START_AND_POINT.getCode());
|
||||
task.setPoint_code1(form.getString("point_code1"));
|
||||
task.setPoint_code2(form.getString("point_code2"));
|
||||
task.setVehicle_code(form.getString("vehicle_code"));
|
||||
task.setAcs_task_type("3");
|
||||
task.setIs_delete("0");
|
||||
task.setRequest_param(form.toJSONString());
|
||||
task.setTask_type(form.getString("task_type"));
|
||||
task.setProduct_area(form.getString("product_area"));
|
||||
task.setCreate_id(currentUserId);
|
||||
task.setCreate_name(currentUsername);
|
||||
task.setCreate_time(DateUtil.now());
|
||||
task.setHandle_class(THIS_CLASS);
|
||||
//根据类型获取对应的任务优先级
|
||||
JSONObject priority_jo = WQL.getWO("PDA_COOLIN").addParam("flag", "3").addParam("task_type", task.getTask_type()).process().uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(priority_jo)) {
|
||||
task.setPriority("1");
|
||||
} else {
|
||||
task.setPriority(priority_jo.getString("value"));
|
||||
}
|
||||
taskService.save(task);
|
||||
this.immediateNotifyAcs(null);
|
||||
return task.getTask_id();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forceFinish(String task_id) {
|
||||
JSONObject taskObj = WQLObject.getWQLObject("SCH_BASE_Task").query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
this.updateTaskStatus(taskObj, TaskStatusEnum.FINISHED.getCode());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void cancel(String task_id) {
|
||||
JSONObject taskObj = WQLObject.getWQLObject("SCH_BASE_Task").query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
this.updateTaskStatus(taskObj, "0");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,168 @@
|
||||
package org.nl.b_lms.sch.tasks.slitter;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
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;
|
||||
import org.nl.b_lms.sch.task.service.IschBaseTaskService;
|
||||
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.storage_manage.ios.enums.IOSEnum;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.common.utils.TaskUtils;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.wms.sch.AcsTaskDto;
|
||||
import org.nl.wms.sch.manage.AbstractAcsTask;
|
||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 备货区(靠近机械手)送走托盘到暂存位置的备货区 - AGV任务
|
||||
* @Date: 2024/6/4
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class StockAreaSendVehicleTask extends AbstractAcsTask {
|
||||
private final String THIS_CLASS = StockAreaSendVehicleTask.class.getName();
|
||||
@Autowired
|
||||
private IschBaseTaskService taskService;
|
||||
@Autowired
|
||||
private IBstIvtStockingivtService stockingivtService;
|
||||
@Autowired
|
||||
private StockAreaCallTubeTask stockAreaCallTubeTask;
|
||||
@Override
|
||||
public List<AcsTaskDto> addTask() {
|
||||
/*
|
||||
* 下发给ACS时需要特殊处理
|
||||
*/
|
||||
List<SchBaseTask> taskList = taskService.getIssueTasks(THIS_CLASS);
|
||||
|
||||
ArrayList<AcsTaskDto> resultList = new ArrayList<>();
|
||||
String agv_system_type = "2";
|
||||
for (SchBaseTask task : taskList) {
|
||||
AcsTaskDto dto = AcsTaskDto.builder()
|
||||
.ext_task_id(task.getTask_id())
|
||||
.task_code(task.getTask_code())
|
||||
.task_type(task.getAcs_task_type())
|
||||
.start_device_code(task.getPoint_code1())
|
||||
.next_device_code(task.getPoint_code2())
|
||||
.start_device_code2("")
|
||||
.next_device_code2(task.getPoint_code4())
|
||||
.vehicle_code(task.getVehicle_code())
|
||||
.agv_system_type(agv_system_type)
|
||||
.priority(task.getPriority())
|
||||
.remark(task.getRemark())
|
||||
.product_area(task.getProduct_area())
|
||||
.build();
|
||||
resultList.add(dto);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||
SchBaseTask task = taskService.getById(taskObj.getString("task_id"));
|
||||
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
|
||||
// 更新任务状态为执行中
|
||||
task.setTask_status(TaskStatusEnum.EXECUTING.getCode());
|
||||
}
|
||||
if (StrUtil.equals(status, TaskStatusEnum.FINISHED.getCode())) {
|
||||
task.setTask_status(TaskStatusEnum.FINISHED.getCode());
|
||||
String startPoint = task.getPoint_code1();
|
||||
String endPoint = task.getPoint_code2();
|
||||
BstIvtStockingivt startPointObj = stockingivtService.getPointByCode(startPoint, false);
|
||||
BstIvtStockingivt endPointObj = stockingivtService.getPointByCode(endPoint, false);
|
||||
// 互换资源 (交换载具号)
|
||||
endPointObj.setIvt_status("1");
|
||||
endPointObj.setVehicle_code(task.getVehicle_code());
|
||||
TaskUtils.updateOptMessageByBStockingPoint(endPointObj);
|
||||
stockingivtService.update(endPointObj);
|
||||
startPointObj.setVehicle_code("");
|
||||
startPointObj.setIvt_status("0");
|
||||
TaskUtils.updateOptMessageByBStockingPoint(startPointObj);
|
||||
stockingivtService.update(startPointObj);
|
||||
// 创建搬运任务, 将所需要的纸管对应的托盘换过来。
|
||||
String requestParam = task.getRequest_param();
|
||||
JSONObject jsonObject = JSONObject.parseObject(requestParam);
|
||||
if (ObjectUtil.isEmpty(requestParam)) {
|
||||
throw new BadRequestException("任务 code = " + task.getTask_code() + " 参数错误");
|
||||
}
|
||||
JSONObject callPoint = jsonObject.getJSONObject("call_point");
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("point_code1", callPoint.getString("point_code"));
|
||||
param.put("point_code2", startPoint);
|
||||
param.put("vehicle_code", callPoint.getString("vehicle_code"));
|
||||
param.put("task_type", SlitterEnum.TASK_TYPE.code("备货区送纸管"));
|
||||
param.put("product_area", SlitterConstant.SLITTER_TASK_AREA);
|
||||
stockAreaCallTubeTask.createTask(param);
|
||||
}
|
||||
// 取消
|
||||
if (status.equals(IOSEnum.IS_NOTANDYES.code("否"))) {
|
||||
task.setTask_status(TaskStatusEnum.FINISHED.getCode());
|
||||
}
|
||||
task.setUpdate_time(DateUtil.now());
|
||||
taskService.updateById(task);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createTask(JSONObject form) {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
JSONObject callPoint = form.getJSONObject("call_point");
|
||||
SchBaseTask task = new SchBaseTask();
|
||||
task.setTask_id(IdUtil.getSnowflake(1, 1).nextIdStr());
|
||||
task.setTask_code(IdUtil.getSnowflake(1, 1).nextIdStr());
|
||||
task.setTask_status(TaskStatusEnum.START_AND_POINT.getCode());
|
||||
task.setPoint_code1(form.getString("point_code1"));
|
||||
task.setPoint_code2(form.getString("point_code2"));
|
||||
task.setPoint_code3(callPoint.getString("point_code"));
|
||||
task.setVehicle_code(form.getString("vehicle_code"));
|
||||
task.setAcs_task_type("3");
|
||||
task.setIs_delete("0");
|
||||
task.setRemark("point3只是记录点,不会下到ACS");
|
||||
task.setRequest_param(form.toJSONString());
|
||||
task.setTask_type(form.getString("task_type"));
|
||||
task.setProduct_area(form.getString("product_area"));
|
||||
task.setCreate_id(currentUserId);
|
||||
task.setCreate_name(currentUsername);
|
||||
task.setCreate_time(DateUtil.now());
|
||||
task.setHandle_class(THIS_CLASS);
|
||||
//根据类型获取对应的任务优先级
|
||||
JSONObject priority_jo = WQL.getWO("PDA_COOLIN").addParam("flag", "3").addParam("task_type", task.getTask_type()).process().uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(priority_jo)) {
|
||||
task.setPriority("1");
|
||||
} else {
|
||||
task.setPriority(priority_jo.getString("value"));
|
||||
}
|
||||
taskService.save(task);
|
||||
this.immediateNotifyAcs(null);
|
||||
return task.getTask_id();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forceFinish(String task_id) {
|
||||
JSONObject taskObj = WQLObject.getWQLObject("SCH_BASE_Task").query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
this.updateTaskStatus(taskObj, TaskStatusEnum.FINISHED.getCode());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void cancel(String task_id) {
|
||||
JSONObject taskObj = WQLObject.getWQLObject("SCH_BASE_Task").query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
this.updateTaskStatus(taskObj, "0");
|
||||
}
|
||||
}
|
||||
@@ -10,23 +10,31 @@ 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.shafttubeivt.service.IBstIvtShafttubeivtService;
|
||||
import org.nl.b_lms.bst.ivt.shafttubeivt.service.dao.BstIvtShafttubeivt;
|
||||
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.pdm.bi.slittingproductionplan.service.IPdmBiSlittingproductionplanService;
|
||||
import org.nl.b_lms.pdm.bi.slittingproductionplan.service.dao.PdmBiSlittingproductionplan;
|
||||
import org.nl.b_lms.sch.tasks.slitter.StockAreaCallTubeTask;
|
||||
import org.nl.b_lms.sch.tasks.slitter.StockAreaSendVehicleTask;
|
||||
import org.nl.b_lms.sch.tasks.slitter.TrussCallAirShaftTask;
|
||||
import org.nl.b_lms.sch.tasks.slitter.TrussCallShaftCacheTask;
|
||||
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.dto.SlitterPlanDistinctDto;
|
||||
import org.nl.b_lms.sch.tasks.slitter.util.SlitterTaskUtil;
|
||||
import org.nl.common.enums.NoticeTypeEnum;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.common.utils.TaskUtils;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.system.service.notice.ISysNoticeService;
|
||||
import org.nl.wms.ext.acs.service.WmsToAcsService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
@@ -51,8 +59,17 @@ public class AutoCallAirShaftTask {
|
||||
private WmsToAcsService wmsToAcsService;
|
||||
@Autowired
|
||||
private TrussCallShaftCacheTask trussCallShaftCacheTask;
|
||||
@Autowired
|
||||
private IBstIvtStockingivtService stockingivtService;
|
||||
@Autowired
|
||||
private ISysNoticeService noticeService;
|
||||
@Autowired
|
||||
private StockAreaSendVehicleTask stockAreaSendVehicleTask;
|
||||
@Autowired
|
||||
private StockAreaCallTubeTask stockAreaCallTubeTask;
|
||||
|
||||
/**
|
||||
* hint: 目前只是考虑了上区域
|
||||
* 执行套轴和拔轴任务的逻辑处理。
|
||||
* 该方法首先寻找空闲的插拔轴位,然后根据不同的条件(如标箔或锂电)来确定区域。接着,它会检查是否有分切计划需要执行,
|
||||
* 并根据计划来决定是进行套轴还是拔轴操作。如果需要套轴,它会寻找合适的套轴位置,并且在没有合适位置时会触发滚条气涨轴的操作。
|
||||
@@ -63,7 +80,8 @@ public class AutoCallAirShaftTask {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void run() {
|
||||
// 1、获取空的插拔轴位(无任务)
|
||||
List<BstIvtShafttubeivt> emptyPoints = bstIvtShafttubeivtService.getAllShaftPointsByConditions("2","0","0");
|
||||
List<BstIvtShafttubeivt> emptyPoints = bstIvtShafttubeivtService.getAllShaftPointsByConditions("2",
|
||||
"0","0");
|
||||
emptyPoints.forEach(empty -> {
|
||||
// 标箔:1,锂电:2 改:大小:4代5代
|
||||
String specification = empty.getQzz_generation();
|
||||
@@ -76,7 +94,8 @@ public class AutoCallAirShaftTask {
|
||||
return;
|
||||
}
|
||||
// 查看套轴对接位是否满了
|
||||
List<BstIvtCutpointivt> emptyShaftPoint = bcutpointivtService.getAreaNotTaskPointByStatus("1", "1", location, "0");
|
||||
List<BstIvtCutpointivt> emptyShaftPoint = bcutpointivtService.getAreaNotTaskPointByStatus("1",
|
||||
"1", location, "0");
|
||||
// 如果满了就只做拔轴
|
||||
if (emptyShaftPoint.size() == 0) {
|
||||
// 如果不需要套轴,就只做拔轴
|
||||
@@ -111,6 +130,7 @@ public class AutoCallAirShaftTask {
|
||||
toAcsOutShaft(qzzSize, location, empty);
|
||||
// 保存所需要的分切计划数据到点位上(套轴对接位)更新分切计划
|
||||
saveCutPlanMessage(empty, needPlans, qzzSize);
|
||||
toCallAgvMovePaperTube(needPlans, location, empty);
|
||||
return;
|
||||
}
|
||||
// 查找一条没任务的点位
|
||||
@@ -121,6 +141,7 @@ public class AutoCallAirShaftTask {
|
||||
toAcsOutShaft(qzzSize, location, empty);
|
||||
// 保存所需要的分切计划数据到点位上(套轴对接位)更新分切计划
|
||||
saveCutPlanMessage(empty, needPlans, qzzSize);
|
||||
toCallAgvMovePaperTube(needPlans, location, empty);
|
||||
return;
|
||||
}
|
||||
// 创建任务
|
||||
@@ -159,6 +180,7 @@ public class AutoCallAirShaftTask {
|
||||
// 拔管数量
|
||||
param.put("pullCount", oldPlans.size());
|
||||
trussCallAirShaftTask.createTask(param);
|
||||
toCallAgvMovePaperTube(needPlans, location, empty);
|
||||
// 将分切计划is_paper_ok 1(纸管已经准备好) -> 2(已经套轴)
|
||||
needPlans.forEach(p -> {
|
||||
p.setIs_paper_ok("2");
|
||||
@@ -168,6 +190,75 @@ public class AutoCallAirShaftTask {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 呼叫AGV更换纸管
|
||||
* @param needPlans 所需要套轴的分切计划
|
||||
* @param location 位置
|
||||
*/
|
||||
public void toCallAgvMovePaperTube(List<PdmBiSlittingproductionplan> needPlans, String location, BstIvtShafttubeivt empty) {
|
||||
// 最多两根
|
||||
List<String> tubes = needPlans.stream().map(plan -> {
|
||||
if (SlitterConstant.SLITTER_TYPE_PAPER.equals(plan.getPaper_tube_or_FRP())) {
|
||||
return plan.getPaper_tube_material();
|
||||
} else {
|
||||
return plan.getFRP_material();
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
// 判断当前区域location对应的备货区是否含有相同的纸管 校验了不在搬运中
|
||||
// type=1, 关联对象material_code=纸管, qty > 0
|
||||
List<BstIvtStockingivt> useList = stockingivtService.getPaperTubePoint("1", tubes.get(0), location, tubes.size());
|
||||
if (useList.size() > 0) {
|
||||
// 说明三个位置中有包含此纸管的数据。
|
||||
return;
|
||||
}
|
||||
// 查找type=0的位置中是否存在 校验了不在搬运中
|
||||
List<BstIvtStockingivt> stockingivtList = stockingivtService.getPaperTubePoint("0", tubes.get(0), location, tubes.size());
|
||||
if (stockingivtList.size() == 0) {
|
||||
// 不存在则站内通知
|
||||
noticeService.createNotice("备货区找不到[" + tubes.get(0) + "]的纸管信息",
|
||||
"点位[" + empty.getPoint_name() + "]无法从备货区找到纸管信息",
|
||||
NoticeTypeEnum.EXCEPTION.getCode());
|
||||
return;
|
||||
}
|
||||
// 找一个点位: 目的需要的点位
|
||||
BstIvtStockingivt needPoint = stockingivtList.get(0);
|
||||
// 找到就创建AGV搬运任务
|
||||
// 查找一个没有任务的空位
|
||||
List<BstIvtStockingivt> list = stockingivtService.getEmptyPointNotTask(location, "0");
|
||||
if (list.size() == 0) {
|
||||
noticeService.createNotice("备货区找不到空位置搬运",
|
||||
"点位[" + empty.getPoint_name() + "]无法从备货区找到空位",
|
||||
NoticeTypeEnum.EXCEPTION.getCode());
|
||||
return;
|
||||
}
|
||||
BstIvtStockingivt endPoint = list.get(0);
|
||||
// 筛选3个位置中数量最少的搬走
|
||||
BstIvtStockingivt needMovePoint = stockingivtService.getCanMovePointOne(location, "1");
|
||||
// 空位就直接创建搬过来的任务
|
||||
if ("0".equals(needMovePoint.getIvt_status())) {
|
||||
// 直接搬过来即可
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("point_code1", needPoint.getPoint_code());
|
||||
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);
|
||||
stockAreaCallTubeTask.createTask(param);
|
||||
return;
|
||||
}
|
||||
// 创建任务 -> HINT: 在此任务完成之后会调用搬回来的任务,因此任务中要记录需要搬运的点位放在任务请求参数中。
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("point_code1", needMovePoint.getPoint_code());
|
||||
param.put("point_code2", endPoint.getPoint_code());
|
||||
param.put("vehicle_code", needMovePoint.getVehicle_code());
|
||||
param.put("material_code", tubes.get(0));
|
||||
param.put("call_point", needPoint);
|
||||
param.put("task_type", SlitterEnum.TASK_TYPE.code("备货区送载具"));
|
||||
param.put("product_area", SlitterConstant.SLITTER_TASK_AREA);
|
||||
stockAreaSendVehicleTask.createTask(param);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取对应的气胀轴库1
|
||||
* @param qzzSize 气涨轴尺寸
|
||||
|
||||
@@ -20,7 +20,8 @@ public enum SlitterEnum {
|
||||
* 任务类型
|
||||
*/
|
||||
TASK_TYPE(MapOf.of("穿拔轴缓存<>穿拔轴位", "010801", "穿拔轴缓存<>分切对接位", "010802", "穿拔轴位<>气胀轴缓存位", "010803"
|
||||
, "分切机下料AGV任务", "010804", "分切机上气胀轴", "010805", "分切机下气胀轴", "010806"));
|
||||
, "分切机下料AGV任务", "010804", "分切机上气胀轴", "010805", "分切机下气胀轴", "010806", "备货区送载具", "010807"
|
||||
, "备货区送纸管", "010808"));
|
||||
private Map<String, String> code;
|
||||
|
||||
public String code(String desc) {
|
||||
|
||||
@@ -72,4 +72,9 @@ public class SlitterController {
|
||||
public ResponseEntity<Object> create6(@RequestBody JSONObject entity){
|
||||
return new ResponseEntity<>(slitterService.mesGetFinishWeighingOfWasteFoil(entity), HttpStatus.CREATED);
|
||||
}
|
||||
@PostMapping("/test7")
|
||||
@Log("1111")
|
||||
public ResponseEntity<Object> create7(@RequestBody JSONObject entity){
|
||||
return new ResponseEntity<>(slitterService.acsToReduceTube(entity), HttpStatus.CREATED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,4 +98,11 @@ public interface SlitterService {
|
||||
JSONObject downRolls(JSONObject param);
|
||||
|
||||
JSONObject moveVehicle(JSONObject param);
|
||||
|
||||
/**
|
||||
* 扣除纸管数据
|
||||
* @param param /
|
||||
* @return /
|
||||
*/
|
||||
JSONObject acsToReduceTube(JSONObject param);
|
||||
}
|
||||
|
||||
@@ -8,16 +8,22 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import lombok.SneakyThrows;
|
||||
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.scale.bound.service.IBstIvtScaleboundService;
|
||||
import org.nl.b_lms.bst.ivt.scale.bound.service.dao.BstIvtScalebound;
|
||||
import org.nl.b_lms.bst.ivt.scale.history.service.IBstIvtScalehistoryService;
|
||||
import org.nl.b_lms.bst.ivt.scale.history.service.dao.BstIvtScalehistory;
|
||||
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;
|
||||
import org.nl.b_lms.bst.ivt.stockingivt.service.dao.BstIvtStockingivt;
|
||||
import org.nl.b_lms.pdm.bi.slittingproductionplan.service.IPdmBiSlittingproductionplanService;
|
||||
import org.nl.b_lms.pdm.bi.slittingproductionplan.service.dao.PdmBiSlittingproductionplan;
|
||||
import org.nl.b_lms.sch.point.dao.StIvtCutpointivt;
|
||||
@@ -87,9 +93,15 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
private IBstIvtScaleboundService scaleboundService;
|
||||
@Autowired
|
||||
private MoveVehicleAgvTask moveVehicleAgvTask;
|
||||
@Autowired
|
||||
private IBstIvtStockingivtService stockingivtService;
|
||||
@Autowired
|
||||
private IMdPbPapervehicleService papervehicleService;
|
||||
|
||||
@Override
|
||||
|
||||
public JSONObject acsRequestShaftLoadTube(JSONObject param) {
|
||||
log.info("acs申请套轴的输入参数为:{}", param);
|
||||
JSONObject res = new JSONObject();
|
||||
JSONObject con = new JSONObject();
|
||||
String deviceCode = param.getString("device_code");
|
||||
@@ -128,6 +140,7 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public JSONObject acsFinishShaftPluckTube(JSONObject param) {
|
||||
log.info("acs申请拔轴完毕的输入参数为:{}", param);
|
||||
JSONObject res = new JSONObject();
|
||||
String deviceCode = param.getString("device_code");
|
||||
BstIvtShafttubeivt CBJ = shafttubeivtService.getByPointCode(deviceCode, false);
|
||||
@@ -146,6 +159,7 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public JSONObject acsRequestShaftPluckTube(JSONObject param) {
|
||||
log.info("acs申请拔轴的输入参数为:{}", param);
|
||||
// 反馈拔轴机构上的纸管信息
|
||||
// 参数:设备号,type,插拔轴位,qzzSize
|
||||
JSONObject res = new JSONObject();
|
||||
@@ -280,6 +294,7 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public JSONObject acsSendShaftToCache(JSONObject param) {
|
||||
log.info("ACS申请送气涨轴到气涨轴暂存位的输入参数为:{}", param);
|
||||
JSONObject res = new JSONObject();
|
||||
String deviceCode = param.getString("device_code");
|
||||
String qzzSize = param.getString("size");
|
||||
@@ -317,25 +332,30 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
@Override
|
||||
// @Transactional(rollbackFor = Exception.class)
|
||||
public JSONObject mesSlittingMachineSendMaterial(JSONObject param) {
|
||||
log.info("分切机下料的输入参数为:{}", param);
|
||||
JSONObject res = new JSONObject();
|
||||
// todo: 获取子卷号数组
|
||||
JSONArray containers = param.getJSONArray("container");
|
||||
List<String> containerList = containers.toJavaList(String.class);
|
||||
if (containerList.size() == 0) {
|
||||
log.error("子卷参数不能为空!");
|
||||
throw new BadRequestException("子卷参数不能为空!");
|
||||
}
|
||||
// 获取分切计划,最多4个需要出站的任务
|
||||
List<PdmBiSlittingproductionplan> currentPlans = slittingproductionplanService.list(new LambdaQueryWrapper<PdmBiSlittingproductionplan>()
|
||||
.in(PdmBiSlittingproductionplan::getContainer_name, containerList)
|
||||
.eq(PdmBiSlittingproductionplan::getIs_delete, SlitterConstant.SLITTER_NO)
|
||||
.eq(PdmBiSlittingproductionplan::getStatus, "05"));
|
||||
List<PdmBiSlittingproductionplan> currentPlans = slittingproductionplanService.list(
|
||||
new LambdaQueryWrapper<PdmBiSlittingproductionplan>()
|
||||
.in(PdmBiSlittingproductionplan::getContainer_name, containerList)
|
||||
.eq(PdmBiSlittingproductionplan::getIs_delete, SlitterConstant.SLITTER_NO)
|
||||
.eq(PdmBiSlittingproductionplan::getStatus, "05"));
|
||||
if (currentPlans.size() == 0) {
|
||||
log.error("当前子卷已经出卷或者不存在!");
|
||||
throw new BadRequestException("当前子卷已经出卷或者不存在!");
|
||||
}
|
||||
// 获取上轴分切计划和下轴分切计划,各一条
|
||||
PdmBiSlittingproductionplan currentUpPlan = currentPlans.stream().filter(p -> "1".equals(p.getUp_or_down())).findFirst().orElse(null);
|
||||
PdmBiSlittingproductionplan currentDownPlan = currentPlans.stream().filter(p -> "2".equals(p.getUp_or_down())).findFirst().orElse(null);
|
||||
|
||||
PdmBiSlittingproductionplan currentUpPlan = currentPlans.stream()
|
||||
.filter(p -> "1".equals(p.getUp_or_down())).findFirst().orElse(null);
|
||||
PdmBiSlittingproductionplan currentDownPlan = currentPlans.stream()
|
||||
.filter(p -> "2".equals(p.getUp_or_down())).findFirst().orElse(null);
|
||||
// 获取其中一条分切计划
|
||||
PdmBiSlittingproductionplan demoPlan = currentPlans.get(0);
|
||||
// 获得设备
|
||||
@@ -344,11 +364,13 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
String area = demoPlan.getContainer_name().substring(0, 2);
|
||||
// 获取当前分切机的下一组分切计划(最多四条分切计划)
|
||||
// hint: 获取到的分切可能是不同组的但具有一定时间顺序
|
||||
List<PdmBiSlittingproductionplan> timePlans = slittingproductionplanService.list(new LambdaQueryWrapper<PdmBiSlittingproductionplan>()
|
||||
.eq(PdmBiSlittingproductionplan::getResource_name, device.getExt_code())
|
||||
.eq(PdmBiSlittingproductionplan::getStatus, "03")
|
||||
.eq(PdmBiSlittingproductionplan::getIs_delete, "0")
|
||||
.orderByAsc(PdmBiSlittingproductionplan::getUpdate_time));
|
||||
List<PdmBiSlittingproductionplan> timePlans = slittingproductionplanService.list(
|
||||
new LambdaQueryWrapper<PdmBiSlittingproductionplan>()
|
||||
.eq(PdmBiSlittingproductionplan::getResource_name, device.getExt_code())
|
||||
.eq(PdmBiSlittingproductionplan::getStatus, "03")
|
||||
.eq(PdmBiSlittingproductionplan::getIs_delete, "0")
|
||||
.orderByAsc(PdmBiSlittingproductionplan::getUpdate_time));
|
||||
log.info("获取下一组分切计划:{}", timePlans);
|
||||
// 任务参数
|
||||
JSONObject taskParam = new JSONObject();
|
||||
if (timePlans.size() == 0) {
|
||||
@@ -356,6 +378,7 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
// 获取分切对接位没任务的空位置
|
||||
List<BstIvtCutpointivt> emptyPoints = slitterMapper.getEmptyCutPointNotTask(area, device.getSort_seq());
|
||||
if (emptyPoints.size() == 0) {
|
||||
log.error("分切机【" + device.getExt_code() + "】找不到对应的对接位!");
|
||||
throw new BadRequestException("分切机【" + device.getExt_code() + "】找不到对应的对接位!");
|
||||
}
|
||||
// 枷锁
|
||||
@@ -497,6 +520,7 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
|
||||
@Override
|
||||
public JSONObject mesGetWeighingOfWasteFoil(JSONObject param) {
|
||||
log.info("分切子卷获取LMS,AGV废箔称重重量的输入参数为:{}", param);
|
||||
JSONObject res = new JSONObject();
|
||||
JSONObject resData = new JSONObject();
|
||||
String resourceName = param.getString("ResourceName");
|
||||
@@ -545,6 +569,7 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
|
||||
@Override
|
||||
public JSONObject mesGetFinishWeighingOfWasteFoil(JSONObject param) {
|
||||
log.info("分切子卷获取LMS,AGV废箔称重重量MES提交废箔成功的输入参数为:{}", param);
|
||||
JSONObject res = new JSONObject();
|
||||
String resourceName = param.getString("ResourceName");
|
||||
// 获取称的设备号
|
||||
@@ -571,6 +596,7 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
|
||||
@Override
|
||||
public JSONObject acsSendSubVolume(JSONObject param) {
|
||||
log.info("套管工位请求判断去成品还是废箔的输入参数为:{}", param);
|
||||
JSONObject res = new JSONObject();
|
||||
String deviceCode = param.getString("device_code");
|
||||
BstIvtShafttubeivt device = shafttubeivtService.getByPointCode(deviceCode, false);
|
||||
@@ -626,6 +652,7 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
|
||||
@Override
|
||||
public JSONObject downRolls(JSONObject param) {
|
||||
log.info("下卷的输入参数为:{}", param);
|
||||
// param: device_code
|
||||
String device_code = param.getString("device_code");
|
||||
StIvtCutpointivt deviceCode = cutpointivtService.getPintByExtCode(device_code, false);
|
||||
@@ -671,4 +698,23 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
result.put("message", "任务下发成功!");
|
||||
return null;
|
||||
}
|
||||
|
||||
public JSONObject acsToReduceTube(JSONObject param) {
|
||||
log.info("扣除纸管数据的输入参数为:{}", param);
|
||||
// param: device_code row_num
|
||||
if (ObjectUtil.isEmpty(param.getString("row_num"))) {
|
||||
log.error("设备:{},排数不能为空", param.getString("device_code"));
|
||||
throw new BadRequestException("设备:" + param.getString("device_code") + "排数不能为空");
|
||||
}
|
||||
BstIvtStockingivt device = stockingivtService.getPointByCode(param.getString("device_code"), false);
|
||||
UpdateWrapper<MdPbPapervehicle> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.eq("vehicle_code", device.getVehicle_code())
|
||||
.eq("row_num", param.getString("row_num"))
|
||||
.setSql("qty=qty-1");
|
||||
papervehicleService.update(updateWrapper);
|
||||
JSONObject res = new JSONObject();
|
||||
res.put("code", HttpStatus.HTTP_OK);
|
||||
res.put("message", "请求成功!");
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
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;
|
||||
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.task.dao.SchBaseTask;
|
||||
|
||||
@@ -102,4 +103,14 @@ public class TaskUtils {
|
||||
point.setUpdate_optname(SecurityUtils.getCurrentUsername());
|
||||
point.setUpdate_time(DateUtil.now());
|
||||
}
|
||||
|
||||
/**
|
||||
* 赋值备货区的修改时间、人等信息
|
||||
* @param point 备货区
|
||||
*/
|
||||
public static void updateOptMessageByBStockingPoint(BstIvtStockingivt point) {
|
||||
point.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
||||
point.setUpdate_optname(SecurityUtils.getCurrentUsername());
|
||||
point.setUpdate_time(DateUtil.now());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user