Merge branch 'b_lms' of http://121.40.234.130:8899/root/lanzhouhailiang_one into b_lms
This commit is contained in:
@@ -46,17 +46,18 @@ public interface IBstIvtCutpointivtService extends IService<BstIvtCutpointivt> {
|
||||
/**
|
||||
* 获取类型状态,没任务的点位
|
||||
* @param type 点位类型:1套轴对接位,2分切缓存位,3分切对接位
|
||||
* @param pointStatus 点位状态:1空位2有气涨轴3有子卷
|
||||
* @param pointStatus 点位状态:1空位、2有气涨轴、3有子卷
|
||||
* @param area 区域(0上1下)
|
||||
* @param sort 0:不排序,1:正序, 2:倒序
|
||||
* @return /
|
||||
*/
|
||||
List<BstIvtCutpointivt> getAreaNotTaskPointByStatus(String type, String pointStatus, String sort);
|
||||
List<BstIvtCutpointivt> getAreaNotTaskPointByStatus(String type, String pointStatus, String area, String sort);
|
||||
|
||||
/**
|
||||
* 获取同尺寸的气涨轴
|
||||
* @param type 点位类型:1套轴对接位,2分切缓存位,3分切对接位
|
||||
* @param size 气涨轴尺寸
|
||||
* @param area 区域
|
||||
* @param area 区域(0上1下)
|
||||
* @return /
|
||||
*/
|
||||
List<BstIvtCutpointivt> getPointByTypeAndShaftSize(String type, String size, String area);
|
||||
@@ -76,4 +77,11 @@ public interface IBstIvtCutpointivtService extends IService<BstIvtCutpointivt> {
|
||||
*/
|
||||
BstIvtCutpointivt getPintByAgvCode(String point, boolean flag);
|
||||
|
||||
/**
|
||||
* 获取类型1状态3,没任务的点位
|
||||
* @param location 区域:0上1下
|
||||
* @param area:区域:B1 B2 B3 B4
|
||||
* @return
|
||||
*/
|
||||
List<BstIvtCutpointivt> getAreaNotTaskPointByLocationAreaAndStatus(String location, String area);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,9 @@ import java.util.List;
|
||||
**/
|
||||
public interface BstIvtCutpointivtMapper extends BaseMapper<BstIvtCutpointivt> {
|
||||
|
||||
List<BstIvtCutpointivt> getAreaNotTaskPointByStatus(String type, String pointStatus, String sort);
|
||||
List<BstIvtCutpointivt> getAreaNotTaskPointByStatus(String type, String pointStatus, String area, String sort);
|
||||
|
||||
List<BstIvtCutpointivt> getPointByTypeAndShaftSize(String type, String size, String area);
|
||||
|
||||
List<BstIvtCutpointivt> getAreaNotTaskPointByLocationAreaAndStatus(String location, String area);
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
WHERE bic.point_type = #{type}
|
||||
AND bic.is_used = '1'
|
||||
AND bic.point_status = #{pointStatus}
|
||||
AND bic.point_location = #{area}
|
||||
AND 0 = (SELECT COUNT(*)
|
||||
FROM sch_base_task t
|
||||
WHERE t.task_status <![CDATA[ < ]]> '07'
|
||||
@@ -40,4 +41,22 @@
|
||||
WHERE t.task_status <![CDATA[ < ]]> '07'
|
||||
AND (t.point_code1 = bc.truss_point_code1 OR t.point_code1 = bc.truss_point_code2))
|
||||
</select>
|
||||
<select id="getAreaNotTaskPointByLocationAreaAndStatus"
|
||||
resultType="org.nl.b_lms.bst.ivt.cutpointivt.service.dao.BstIvtCutpointivt">
|
||||
SELECT DISTINCT bic.*
|
||||
FROM bst_ivt_cutpointivt bic
|
||||
LEFT JOIN pdm_bi_slittingproductionplan p ON p.qzzno = bic.qzz_no1 OR p.qzzno = bic.qzz_no2
|
||||
WHERE bic.point_type = '1'
|
||||
AND bic.is_used = '1'
|
||||
AND bic.point_status = '3'
|
||||
AND bic.point_location = #{location}
|
||||
AND 0 = (SELECT COUNT(*)
|
||||
FROM sch_base_task t
|
||||
WHERE t.task_status <![CDATA[ < ]]> '07'
|
||||
AND (t.point_code1 = bic.point_code OR t.point_code2 = bic.point_code
|
||||
OR t.point_code1 = bic.truss_point_code1 oR t.point_code2 = bic.truss_point_code1
|
||||
OR t.point_code1 = bic.truss_point_code2 oR t.point_code2 = bic.truss_point_code2)
|
||||
)
|
||||
AND LEFT(p.resource_name,2) = #{area}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -89,8 +89,8 @@ public class BstIvtCutpointivtServiceImpl extends ServiceImpl<BstIvtCutpointivtM
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BstIvtCutpointivt> getAreaNotTaskPointByStatus(String type, String pointStatus, String sort) {
|
||||
return bstIvtCutpointivtMapper.getAreaNotTaskPointByStatus(type, pointStatus, sort);
|
||||
public List<BstIvtCutpointivt> getAreaNotTaskPointByStatus(String type, String pointStatus, String area, String sort) {
|
||||
return bstIvtCutpointivtMapper.getAreaNotTaskPointByStatus(type, pointStatus, area, sort);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -113,4 +113,9 @@ public class BstIvtCutpointivtServiceImpl extends ServiceImpl<BstIvtCutpointivtM
|
||||
lam.eq(flag, BstIvtCutpointivt::getIs_used, "1").eq(BstIvtCutpointivt::getPoint_code, point);
|
||||
return bstIvtCutpointivtMapper.selectOne(lam);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BstIvtCutpointivt> getAreaNotTaskPointByLocationAreaAndStatus(String location, String area) {
|
||||
return bstIvtCutpointivtMapper.getAreaNotTaskPointByLocationAreaAndStatus(location, area);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
package org.nl.b_lms.bst.ivt.scale.bound.controller;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
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.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-03-12
|
||||
**/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/bstIvtScalebound")
|
||||
public class BstIvtScaleboundController {
|
||||
|
||||
@Autowired
|
||||
private IBstIvtScaleboundService bstIvtScaleboundService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询设备与称重机绑定")
|
||||
//@SaCheckPermission("@el.check('bstIvtScalebound:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page){
|
||||
return new ResponseEntity<>(TableDataInfo.build(bstIvtScaleboundService.queryAll(whereJson,page)),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增设备与称重机绑定")
|
||||
//@SaCheckPermission("@el.check('bstIvtScalebound:add')")
|
||||
public ResponseEntity
|
||||
<Object> create(@Validated @RequestBody BstIvtScalebound entity){
|
||||
bstIvtScaleboundService.create(entity);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改设备与称重机绑定")
|
||||
//@SaCheckPermission("@el.check('bstIvtScalebound:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody BstIvtScalebound entity){
|
||||
bstIvtScaleboundService.update(entity);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除设备与称重机绑定")
|
||||
//@SaCheckPermission("@el.check('bstIvtScalebound:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) {
|
||||
bstIvtScaleboundService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package org.nl.b_lms.bst.ivt.scale.bound.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.scale.bound.service.dao.BstIvtScalebound;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @description 服务接口
|
||||
* @author lyd
|
||||
* @date 2024-03-12
|
||||
**/
|
||||
public interface IBstIvtScaleboundService extends IService<BstIvtScalebound> {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param whereJson 条件
|
||||
* @param pageable 分页参数
|
||||
* @return IPage<BstIvtScalebound>
|
||||
*/
|
||||
IPage<BstIvtScalebound> queryAll(Map whereJson, PageQuery pageable);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param entity /
|
||||
*/
|
||||
void create(BstIvtScalebound entity);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param entity /
|
||||
*/
|
||||
void update(BstIvtScalebound entity);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Set<String> ids);
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package org.nl.b_lms.bst.ivt.scale.bound.service.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @description 添加'@Builder'注解最好不好添加'@NoArgsConstructor'
|
||||
* @author lyd
|
||||
* @date 2024-03-12
|
||||
**/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("bst_ivt_scalebound")
|
||||
public class BstIvtScalebound implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "scale_id", type = IdType.NONE)
|
||||
/** id标识 */
|
||||
private String scale_id;
|
||||
|
||||
/** 设备编码 */
|
||||
private String device_code;
|
||||
|
||||
/** 称重机编码 */
|
||||
private String scale_code;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package org.nl.b_lms.bst.ivt.scale.bound.service.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.nl.b_lms.bst.ivt.scale.bound.service.dao.BstIvtScalebound;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
* @date 2024-03-12
|
||||
**/
|
||||
public interface BstIvtScaleboundMapper extends BaseMapper<BstIvtScalebound> {
|
||||
|
||||
}
|
||||
@@ -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.scale.bound.service.dao.mapper.BstIvtScaleboundMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,25 @@
|
||||
package org.nl.b_lms.bst.ivt.scale.bound.service.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import lombok.Builder;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @description /
|
||||
* @author lyd
|
||||
* @date 2024-03-12
|
||||
**/
|
||||
@Data
|
||||
public class BstIvtScaleboundDto implements Serializable {
|
||||
|
||||
/** id标识 */
|
||||
private String scale_id;
|
||||
|
||||
/** 设备编码 */
|
||||
private String device_code;
|
||||
|
||||
/** 称重机编码 */
|
||||
private String scale_code;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package org.nl.b_lms.bst.ivt.scale.bound.service.dto;
|
||||
|
||||
import org.nl.common.domain.query.BaseQuery;
|
||||
import org.nl.b_lms.bst.ivt.scale.bound.service.dao.BstIvtScalebound;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
* @date 2024-03-12
|
||||
**/
|
||||
public class BstIvtScaleboundQuery extends BaseQuery<BstIvtScalebound> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package org.nl.b_lms.bst.ivt.scale.bound.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.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.b_lms.bst.ivt.scale.bound.service.IBstIvtScaleboundService;
|
||||
import org.nl.b_lms.bst.ivt.scale.bound.service.dao.mapper.BstIvtScaleboundMapper;
|
||||
import org.nl.b_lms.bst.ivt.scale.bound.service.dao.BstIvtScalebound;
|
||||
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-03-12
|
||||
**/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class BstIvtScaleboundServiceImpl extends ServiceImpl<BstIvtScaleboundMapper, BstIvtScalebound> implements IBstIvtScaleboundService {
|
||||
|
||||
@Autowired
|
||||
private BstIvtScaleboundMapper bstIvtScaleboundMapper;
|
||||
|
||||
@Override
|
||||
public IPage<BstIvtScalebound> queryAll(Map whereJson, PageQuery page){
|
||||
LambdaQueryWrapper<BstIvtScalebound> lam = new LambdaQueryWrapper<>();
|
||||
IPage<BstIvtScalebound> pages = new Page<>(page.getPage() + 1, page.getSize());
|
||||
bstIvtScaleboundMapper.selectPage(pages, lam);
|
||||
return pages;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(BstIvtScalebound entity) {
|
||||
|
||||
entity.setScale_id(IdUtil.getSnowflake(1, 1).nextIdStr());
|
||||
bstIvtScaleboundMapper.insert(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(BstIvtScalebound entity) {
|
||||
BstIvtScalebound dto = bstIvtScaleboundMapper.selectById(entity.getScale_id());
|
||||
if (dto == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
bstIvtScaleboundMapper.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAll(Set<String> ids) {
|
||||
// 真删除
|
||||
bstIvtScaleboundMapper.deleteBatchIds(ids);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package org.nl.b_lms.bst.ivt.scale.history.controller;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
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.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-03-12
|
||||
**/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/bstIvtScalehistory")
|
||||
public class BstIvtScalehistoryController {
|
||||
|
||||
@Autowired
|
||||
private IBstIvtScalehistoryService bstIvtScalehistoryService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询称重历史记录")
|
||||
//@SaCheckPermission("@el.check('bstIvtScalehistory:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page){
|
||||
return new ResponseEntity<>(TableDataInfo.build(bstIvtScalehistoryService.queryAll(whereJson,page)),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增称重历史记录")
|
||||
//@SaCheckPermission("@el.check('bstIvtScalehistory:add')")
|
||||
public ResponseEntity
|
||||
<Object> create(@Validated @RequestBody BstIvtScalehistory entity){
|
||||
bstIvtScalehistoryService.create(entity);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改称重历史记录")
|
||||
//@SaCheckPermission("@el.check('bstIvtScalehistory:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody BstIvtScalehistory entity){
|
||||
bstIvtScalehistoryService.update(entity);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除称重历史记录")
|
||||
//@SaCheckPermission("@el.check('bstIvtScalehistory:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) {
|
||||
bstIvtScalehistoryService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package org.nl.b_lms.bst.ivt.scale.history.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.scale.history.service.dao.BstIvtScalehistory;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @description 服务接口
|
||||
* @author lyd
|
||||
* @date 2024-03-12
|
||||
**/
|
||||
public interface IBstIvtScalehistoryService extends IService<BstIvtScalehistory> {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param whereJson 条件
|
||||
* @param pageable 分页参数
|
||||
* @return IPage<BstIvtScalehistory>
|
||||
*/
|
||||
IPage<BstIvtScalehistory> queryAll(Map whereJson, PageQuery pageable);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param entity /
|
||||
*/
|
||||
void create(BstIvtScalehistory entity);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param entity /
|
||||
*/
|
||||
void update(BstIvtScalehistory entity);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Set<String> ids);
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package org.nl.b_lms.bst.ivt.scale.history.service.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @description 添加'@Builder'注解最好不好添加'@NoArgsConstructor'
|
||||
* @author lyd
|
||||
* @date 2024-03-12
|
||||
**/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("bst_ivt_scalehistory")
|
||||
public class BstIvtScalehistory implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "history_id", type = IdType.NONE)
|
||||
/** id标识 */
|
||||
private String history_id;
|
||||
|
||||
/** 设备编码 */
|
||||
private String device_code;
|
||||
|
||||
/** 称重机编码 */
|
||||
private String scale_code;
|
||||
|
||||
/** 当前重量 */
|
||||
private String current_weight;
|
||||
|
||||
/** 上次重量 */
|
||||
private String last_weight;
|
||||
|
||||
/** 重量差 */
|
||||
private String weight_gap;
|
||||
|
||||
/** 记录时间 */
|
||||
private String record_time;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package org.nl.b_lms.bst.ivt.scale.history.service.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.nl.b_lms.bst.ivt.scale.history.service.dao.BstIvtScalehistory;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
* @date 2024-03-12
|
||||
**/
|
||||
public interface BstIvtScalehistoryMapper extends BaseMapper<BstIvtScalehistory> {
|
||||
|
||||
}
|
||||
@@ -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.scale.history.service.dao.mapper.BstIvtScalehistoryMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,37 @@
|
||||
package org.nl.b_lms.bst.ivt.scale.history.service.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import lombok.Builder;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @description /
|
||||
* @author lyd
|
||||
* @date 2024-03-12
|
||||
**/
|
||||
@Data
|
||||
public class BstIvtScalehistoryDto implements Serializable {
|
||||
|
||||
/** id标识 */
|
||||
private String history_id;
|
||||
|
||||
/** 设备编码 */
|
||||
private String device_code;
|
||||
|
||||
/** 称重机编码 */
|
||||
private String scale_code;
|
||||
|
||||
/** 当前重量 */
|
||||
private String current_weight;
|
||||
|
||||
/** 上次重量 */
|
||||
private String last_weight;
|
||||
|
||||
/** 重量差 */
|
||||
private String weight_gap;
|
||||
|
||||
/** 记录时间 */
|
||||
private String record_time;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package org.nl.b_lms.bst.ivt.scale.history.service.dto;
|
||||
|
||||
import org.nl.common.domain.query.BaseQuery;
|
||||
import org.nl.b_lms.bst.ivt.scale.history.service.dao.BstIvtScalehistory;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
* @date 2024-03-12
|
||||
**/
|
||||
public class BstIvtScalehistoryQuery extends BaseQuery<BstIvtScalehistory> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package org.nl.b_lms.bst.ivt.scale.history.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.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.b_lms.bst.ivt.scale.history.service.IBstIvtScalehistoryService;
|
||||
import org.nl.b_lms.bst.ivt.scale.history.service.dao.mapper.BstIvtScalehistoryMapper;
|
||||
import org.nl.b_lms.bst.ivt.scale.history.service.dao.BstIvtScalehistory;
|
||||
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-03-12
|
||||
**/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class BstIvtScalehistoryServiceImpl extends ServiceImpl<BstIvtScalehistoryMapper, BstIvtScalehistory> implements IBstIvtScalehistoryService {
|
||||
|
||||
@Autowired
|
||||
private BstIvtScalehistoryMapper bstIvtScalehistoryMapper;
|
||||
|
||||
@Override
|
||||
public IPage<BstIvtScalehistory> queryAll(Map whereJson, PageQuery page){
|
||||
LambdaQueryWrapper<BstIvtScalehistory> lam = new LambdaQueryWrapper<>();
|
||||
IPage<BstIvtScalehistory> pages = new Page<>(page.getPage() + 1, page.getSize());
|
||||
bstIvtScalehistoryMapper.selectPage(pages, lam);
|
||||
return pages;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(BstIvtScalehistory entity) {
|
||||
String now = DateUtil.now();
|
||||
|
||||
entity.setHistory_id(IdUtil.getSnowflake(1, 1).nextIdStr());
|
||||
entity.setRecord_time(now);
|
||||
bstIvtScalehistoryMapper.insert(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(BstIvtScalehistory entity) {
|
||||
BstIvtScalehistory dto = bstIvtScalehistoryMapper.selectById(entity.getHistory_id());
|
||||
if (dto == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
|
||||
String now = DateUtil.now();
|
||||
entity.setRecord_time(now);
|
||||
|
||||
bstIvtScalehistoryMapper.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAll(Set<String> ids) {
|
||||
// 真删除
|
||||
bstIvtScalehistoryMapper.deleteBatchIds(ids);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package org.nl.b_lms.pdm.subpackagerelation.controller;
|
||||
import java.util.Set;
|
||||
import java.util.Map;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.b_lms.pdm.subpackagerelation.dao.PdmBiSubpackagerelation;
|
||||
import org.nl.common.TableDataInfo;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -48,6 +49,31 @@ public class PdmBiSubpackagerelationController {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询订单装箱信息
|
||||
*
|
||||
* @param whereJson 查询条件
|
||||
* @param page 分页参数
|
||||
*/
|
||||
@GetMapping("/queryContainerization")
|
||||
@Log("查询订单装箱信息")
|
||||
public ResponseEntity<Object> queryContainerization(@RequestParam Map whereJson, PageQuery page) {
|
||||
return new ResponseEntity<>(TableDataInfo.build(pdmBiSubpackagerelationService.queryContainerization(whereJson, page)), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据订单号查询子卷信息
|
||||
*
|
||||
* @param whereJson 查询条件
|
||||
*/
|
||||
@GetMapping("/queryContainerNameBySaleOrder")
|
||||
@Log("查询订单装箱信息")
|
||||
public ResponseEntity<Object> queryContainerNameBySaleOrder(@RequestParam Map whereJson) {
|
||||
return new ResponseEntity<>(TableDataInfo.build(pdmBiSubpackagerelationService.queryContainerNameBySaleOrder(whereJson)), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
@@ -76,6 +102,14 @@ public class PdmBiSubpackagerelationController {
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/updateEntityList")
|
||||
@Log("子卷分配木箱规格")
|
||||
//@SaCheckPermission("@el.check(updateEntityList)")
|
||||
public ResponseEntity<Object> updateEntityList(@RequestBody JSONObject whereJson) {
|
||||
pdmBiSubpackagerelationService.updateEntityList(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.nl.b_lms.pdm.subpackagerelation.dao;
|
||||
import java.math.BigDecimal;
|
||||
import java.io.Serializable;
|
||||
|
||||
import jdk.nashorn.internal.ir.annotations.Ignore;
|
||||
import lombok.*;
|
||||
import lombok.Data;
|
||||
import lombok.Builder;
|
||||
@@ -20,11 +21,7 @@ import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
* @since 2024-02-01
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@ToString
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@SuppressWarnings("serial")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("pdm_bi_subpackagerelation")
|
||||
public class PdmBiSubpackagerelation extends Model<PdmBiSubpackagerelation> {
|
||||
|
||||
@@ -36,7 +33,7 @@ public class PdmBiSubpackagerelation extends Model<PdmBiSubpackagerelation> {
|
||||
* 子卷包装标识
|
||||
*/
|
||||
@TableId(value = "workorder_id", type = IdType.NONE)
|
||||
private Long workorder_id;
|
||||
private String workorder_id;
|
||||
|
||||
|
||||
/**
|
||||
@@ -186,7 +183,6 @@ public class PdmBiSubpackagerelation extends Model<PdmBiSubpackagerelation> {
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private String create_time;
|
||||
|
||||
|
||||
@@ -309,6 +305,11 @@ public class PdmBiSubpackagerelation extends Model<PdmBiSubpackagerelation> {
|
||||
*/
|
||||
private String ext_code;
|
||||
|
||||
/**
|
||||
* 木箱组
|
||||
*/
|
||||
private String box_group;
|
||||
|
||||
|
||||
/**
|
||||
* 获取主键值
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
package org.nl.b_lms.pdm.subpackagerelation.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.nl.b_lms.pdm.subpackagerelation.dao.PdmBiSubpackagerelation;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* {@code @Description:} 子卷包装关系表(PdmBiSubpackagerelation)数据持久层
|
||||
* {@code @Author:} gbx
|
||||
@@ -12,4 +17,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
public interface PdmBiSubpackagerelationMapper extends BaseMapper<PdmBiSubpackagerelation> {
|
||||
|
||||
|
||||
List<PdmBiSubpackagerelation> selectGroupedSubPackageRelation(Page<PdmBiSubpackagerelation> page, Map<String, Object> whereJson);
|
||||
|
||||
}
|
||||
|
||||
@@ -2,5 +2,19 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.nl.b_lms.pdm.subpackagerelation.dao.mapper.PdmBiSubpackagerelationMapper">
|
||||
|
||||
<select id="selectGroupedSubPackageRelation" resultType="org.nl.b_lms.pdm.subpackagerelation.dao.PdmBiSubpackagerelation">
|
||||
SELECT *
|
||||
FROM pdm_bi_subpackagerelation
|
||||
WHERE (sale_order_name, create_time) IN (
|
||||
SELECT sale_order_name, MAX(create_time) AS create_time
|
||||
FROM pdm_bi_subpackagerelation
|
||||
<if test="_parameter.containsKey('customer_name')">
|
||||
WHERE customer_name = #{customer_name}
|
||||
</if>
|
||||
GROUP BY sale_order_name
|
||||
)
|
||||
ORDER BY create_time DESC
|
||||
LIMIT #{page.offset}, #{page.size}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -22,7 +22,7 @@ public class PdmBiSubpackagerelationDto implements Serializable {
|
||||
/**
|
||||
* 子卷包装标识
|
||||
*/
|
||||
private Long workorder_id;
|
||||
private String workorder_id;
|
||||
/**
|
||||
* 木箱唯一码
|
||||
*/
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
package org.nl.b_lms.pdm.subpackagerelation.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.b_lms.pdm.subpackagerelation.dao.PdmBiSubpackagerelation;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
|
||||
/**
|
||||
@@ -29,6 +32,33 @@ public interface IpdmBiSubpackagerelationService extends IService<PdmBiSubpackag
|
||||
IPage<PdmBiSubpackagerelation> queryAll(Map whereJson, PageQuery pageable);
|
||||
|
||||
|
||||
/**
|
||||
* 查询订单装箱信息
|
||||
*
|
||||
* @param whereJson 查询条件
|
||||
* @param pageable 分页参数
|
||||
* @return IPage<PdmBiSubpackagerelation>
|
||||
*/
|
||||
IPage<PdmBiSubpackagerelation> queryContainerization(Map whereJson, PageQuery pageable);
|
||||
|
||||
|
||||
/**
|
||||
* 根据订单号查询子卷信息
|
||||
*
|
||||
* @param whereJson 查询条件
|
||||
* @return List<PdmBiSubpackagerelation>
|
||||
*/
|
||||
List<PdmBiSubpackagerelation> queryContainerNameBySaleOrder(Map whereJson);
|
||||
|
||||
|
||||
/**
|
||||
* 子卷分配木箱规格
|
||||
*
|
||||
* @param whereJson 分配信息
|
||||
*/
|
||||
void updateEntityList(@RequestBody JSONObject whereJson);
|
||||
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
package org.nl.b_lms.pdm.subpackagerelation.service.impl;
|
||||
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
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.UpdateWrapper;
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.nl.b_lms.pdm.subpackagerelation.dao.PdmBiSubpackagerelation;
|
||||
import org.nl.b_lms.pdm.subpackagerelation.dao.mapper.PdmBiSubpackagerelationMapper;
|
||||
import org.nl.b_lms.pdm.subpackagerelation.service.IpdmBiSubpackagerelationService;
|
||||
@@ -13,8 +19,9 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
@@ -39,11 +46,85 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
||||
*/
|
||||
@Override
|
||||
public IPage<PdmBiSubpackagerelation> queryAll(Map whereJson, PageQuery page) {
|
||||
|
||||
return pdmBiSubpackagerelationMapper.selectPage(new Page<>(page.getPage() + 1, page.getSize()), new QueryWrapper<PdmBiSubpackagerelation>()
|
||||
.lambda());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询订单装箱信息
|
||||
*
|
||||
* @param whereJson 查询条件
|
||||
* @param pageable 分页参数
|
||||
*/
|
||||
@Override
|
||||
public IPage<PdmBiSubpackagerelation> queryContainerization(Map whereJson, PageQuery pageable) {
|
||||
IPage<PdmBiSubpackagerelation> resultPage = new Page<>(pageable.getPage(), pageable.getSize());
|
||||
LambdaQueryWrapper<PdmBiSubpackagerelation> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if (whereJson.containsKey("customer_description")) {
|
||||
queryWrapper.like(PdmBiSubpackagerelation::getCustomer_description, whereJson.get("customer_description"));
|
||||
}
|
||||
if (whereJson.containsKey("sale_order_name")) {
|
||||
queryWrapper.like(PdmBiSubpackagerelation::getSale_order_name, whereJson.get("sale_order_name"));
|
||||
}
|
||||
if (whereJson.containsKey("customer_name")) {
|
||||
queryWrapper.like(PdmBiSubpackagerelation::getCustomer_name, whereJson.get("customer_name"));
|
||||
}
|
||||
if (whereJson.containsKey("status")) {
|
||||
if ("99".equals(whereJson.get("status"))) {
|
||||
queryWrapper.eq(PdmBiSubpackagerelation::getStatus, whereJson.get("status"));
|
||||
} else {
|
||||
queryWrapper.lt(PdmBiSubpackagerelation::getStatus, "99");
|
||||
}
|
||||
}
|
||||
queryWrapper.groupBy(PdmBiSubpackagerelation::getSale_order_name)
|
||||
.orderByDesc(PdmBiSubpackagerelation::getCreate_time);
|
||||
return pdmBiSubpackagerelationMapper.selectPage(resultPage, queryWrapper);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据订单号查询子卷信息
|
||||
*
|
||||
* @param whereJson 查询条件
|
||||
*/
|
||||
@Override
|
||||
public List<PdmBiSubpackagerelation> queryContainerNameBySaleOrder(Map whereJson) {
|
||||
LambdaQueryWrapper<PdmBiSubpackagerelation> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if (whereJson.containsKey("customer_description")) {
|
||||
queryWrapper.like(PdmBiSubpackagerelation::getCustomer_description, whereJson.get("customer_description"));
|
||||
}
|
||||
if (whereJson.containsKey("sale_order_name")) {
|
||||
queryWrapper.eq(PdmBiSubpackagerelation::getSale_order_name, whereJson.get("sale_order_name"));
|
||||
}
|
||||
if (whereJson.containsKey("customer_name")) {
|
||||
queryWrapper.like(PdmBiSubpackagerelation::getCustomer_name, whereJson.get("customer_name"));
|
||||
}
|
||||
if (whereJson.containsKey("status")) {
|
||||
if ("99".equals(whereJson.get("status"))) {
|
||||
queryWrapper.eq(PdmBiSubpackagerelation::getStatus, whereJson.get("status"));
|
||||
} else {
|
||||
queryWrapper.ge(PdmBiSubpackagerelation::getStatus, whereJson.get("status"));
|
||||
}
|
||||
}
|
||||
queryWrapper.orderByDesc(PdmBiSubpackagerelation::getBox_group);
|
||||
List<PdmBiSubpackagerelation> pdmBiSubpackagerelationList = pdmBiSubpackagerelationMapper.selectList(queryWrapper);
|
||||
Map<String, Long> countByGroup = pdmBiSubpackagerelationList.stream()
|
||||
.filter(item -> item.getBox_group() != null)
|
||||
.collect(Collectors.groupingBy(PdmBiSubpackagerelation::getBox_group, Collectors.counting()));
|
||||
pdmBiSubpackagerelationList.forEach(item -> {
|
||||
if (item.getBox_group() != null) {
|
||||
item.setQuanlity_in_box(BigDecimal.valueOf(countByGroup.getOrDefault(item.getBox_group(), null)));
|
||||
} else {
|
||||
item.setQuanlity_in_box(BigDecimal.ZERO);
|
||||
item.setBox_group("0");
|
||||
}
|
||||
});
|
||||
return pdmBiSubpackagerelationList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
@@ -69,6 +150,36 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
||||
pdmBiSubpackagerelationMapper.updateById(getBasicInfo(entity, false));
|
||||
}
|
||||
|
||||
/**
|
||||
* 子卷分配木箱规格
|
||||
*
|
||||
* @param whereJson 分配信息
|
||||
*/
|
||||
@Override
|
||||
public void updateEntityList(JSONObject whereJson) {
|
||||
List<String> entityList = JSONObject.parseArray(whereJson.getJSONArray("tableMater").toJSONString(), PdmBiSubpackagerelation.class).stream()
|
||||
.map(PdmBiSubpackagerelation::getWorkorder_id)
|
||||
.map(String::valueOf)
|
||||
.collect(Collectors.toList());
|
||||
;
|
||||
if (entityList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
List<PdmBiSubpackagerelation> pdmBiSubpackagerelationList = pdmBiSubpackagerelationMapper
|
||||
.selectList(new LambdaQueryWrapper<PdmBiSubpackagerelation>().eq(PdmBiSubpackagerelation::getSale_order_name, whereJson.getString("sale_order_name")));
|
||||
Integer maxBoxGroup = pdmBiSubpackagerelationList.stream()
|
||||
.map(PdmBiSubpackagerelation::getBox_group)
|
||||
.filter(Objects::nonNull)
|
||||
.map(Integer::parseInt)
|
||||
.max(Integer::compareTo)
|
||||
.orElse(0) + 1;
|
||||
UpdateWrapper<PdmBiSubpackagerelation> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.set("box_type", whereJson.getString("checked"));
|
||||
updateWrapper.set("box_group", maxBoxGroup);
|
||||
updateWrapper.in("workorder_id", entityList);
|
||||
pdmBiSubpackagerelationMapper.update(null, updateWrapper);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
@@ -89,11 +200,11 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
||||
* @param isCreate 是否创建
|
||||
*/
|
||||
private PdmBiSubpackagerelation getBasicInfo(PdmBiSubpackagerelation entity, boolean isCreate) {
|
||||
if (isCreate) {
|
||||
entity.setCreate_id(Long.valueOf(SecurityUtils.getCurrentUserId()));
|
||||
entity.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||
entity.setCreate_time(DateUtil.now());
|
||||
}
|
||||
if (isCreate) {
|
||||
entity.setCreate_id(Long.valueOf(SecurityUtils.getCurrentUserId()));
|
||||
entity.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||
entity.setCreate_time(DateUtil.now());
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ public class TwoLashTask extends AbstractAcsTask {
|
||||
.class_type(json.getString("task_type"))
|
||||
.dtl_type(String.valueOf(dtl_type))
|
||||
.remark(json.getString("remark"))
|
||||
.interaction_json(interaction_json.toString())
|
||||
.interaction_json(interaction_json)
|
||||
.build();
|
||||
resultList.add(dto);
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ public class TwoOutTask extends AbstractAcsTask {
|
||||
.task_type(json.getString("acs_task_type"))
|
||||
.start_device_code(json.getString("point_code1"))
|
||||
.next_device_code(json.getString("point_code2"))
|
||||
.vehicle_code(json.getString("vehicle_code"))
|
||||
.vehicle_code(json.getString("vehicle_code2"))
|
||||
.priority(json.getString("priority"))
|
||||
.class_type(json.getString("task_type"))
|
||||
.dtl_type(String.valueOf(dtl_type))
|
||||
|
||||
@@ -76,6 +76,7 @@ public class SendAirShaftAgvTask extends AbstractAcsTask {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||
SchBaseTask task = taskService.getById(taskObj.getString("task_id"));
|
||||
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
|
||||
@@ -163,7 +164,6 @@ public class SendAirShaftAgvTask extends AbstractAcsTask {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
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());
|
||||
|
||||
@@ -74,6 +74,7 @@ public class SendCopperFoilSubRollTrussTask extends AbstractAcsTask {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||
SchBaseTask task = taskService.getById(taskObj.getString("task_id"));
|
||||
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
|
||||
@@ -126,7 +127,6 @@ public class SendCopperFoilSubRollTrussTask extends AbstractAcsTask {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
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());
|
||||
|
||||
@@ -67,6 +67,7 @@ public class SlitterDownAgvTask extends AbstractAcsTask {
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||
SchBaseTask task = taskService.getById(taskObj.getString("task_id"));
|
||||
@@ -128,7 +129,6 @@ public class SlitterDownAgvTask extends AbstractAcsTask {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
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());
|
||||
|
||||
@@ -177,7 +177,6 @@ public class SlitterDownTrussTask extends AbstractAcsTask {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
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());
|
||||
|
||||
@@ -72,7 +72,7 @@ public class TrussCallAirShaftTask extends AbstractAcsTask {
|
||||
.agv_system_type(agv_system_type)
|
||||
.priority(task.getPriority())
|
||||
.remark(task.getRemark())
|
||||
.params2(task.getRequest_param())
|
||||
.interaction_json(task.getRequest_param())
|
||||
.product_area(task.getProduct_area())
|
||||
.build();
|
||||
resultList.add(dto);
|
||||
@@ -80,6 +80,7 @@ public class TrussCallAirShaftTask extends AbstractAcsTask {
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||
SchBaseTask task = taskService.getById(taskObj.getString("task_id"));
|
||||
@@ -196,7 +197,6 @@ public class TrussCallAirShaftTask extends AbstractAcsTask {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
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());
|
||||
|
||||
@@ -67,6 +67,7 @@ public class TrussCallShaftCacheTask extends AbstractAcsTask {
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||
SchBaseTask task = taskService.getById(taskObj.getString("task_id"));
|
||||
@@ -79,11 +80,16 @@ public class TrussCallShaftCacheTask extends AbstractAcsTask {
|
||||
// 更改任务状态为完成
|
||||
task.setTask_status(TaskStatusEnum.FINISHED.getCode());
|
||||
String startPoint = task.getPoint_code1();
|
||||
String endPoint = task.getPoint_code2();
|
||||
BstIvtShafttubeivt startPointObj = shafttubeivtService.getByPointCode(startPoint, false);
|
||||
BstIvtShafttubeivt endPointObj = shafttubeivtService.getByPointCode(endPoint, false);
|
||||
// 起点清空
|
||||
startPointObj.setHave_qzz("0");
|
||||
TaskUtils.updateOptMessageByBShaftPoint(startPointObj);
|
||||
shafttubeivtService.updateById(startPointObj);
|
||||
endPointObj.setHave_qzz("1");
|
||||
TaskUtils.updateOptMessageByBShaftPoint(endPointObj);
|
||||
shafttubeivtService.updateById(endPointObj);
|
||||
}
|
||||
// 取消
|
||||
if (status.equals(IOSEnum.IS_NOTANDYES.code("否"))) {
|
||||
@@ -126,7 +132,6 @@ public class TrussCallShaftCacheTask extends AbstractAcsTask {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
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());
|
||||
|
||||
@@ -79,6 +79,7 @@ public class TrussSendAirShaftTask extends AbstractAcsTask {
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||
SchBaseTask task = taskService.getById(taskObj.getString("task_id"));
|
||||
@@ -168,7 +169,6 @@ public class TrussSendAirShaftTask extends AbstractAcsTask {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
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());
|
||||
|
||||
@@ -32,7 +32,7 @@ import java.util.List;
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class TrussSendShaftCacheTask extends AbstractAcsTask {
|
||||
class TrussSendShaftCacheTask extends AbstractAcsTask {
|
||||
private final String THIS_CLASS = TrussSendShaftCacheTask.class.getName();
|
||||
@Autowired
|
||||
private IschBaseTaskService taskService;
|
||||
@@ -68,6 +68,7 @@ public class TrussSendShaftCacheTask extends AbstractAcsTask {
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||
SchBaseTask task = taskService.getById(taskObj.getString("task_id"));
|
||||
@@ -133,7 +134,6 @@ public class TrussSendShaftCacheTask extends AbstractAcsTask {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
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());
|
||||
|
||||
@@ -185,7 +185,6 @@ public class UpShaftTrussTask extends AbstractAcsTask {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
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());
|
||||
|
||||
@@ -12,7 +12,6 @@ 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.pdm.bi.slittingproductionplan.service.IPdmBiSlittingproductionplanService;
|
||||
import org.nl.b_lms.pdm.bi.slittingproductionplan.service.dao.PdmBiSlittingproductionplan;
|
||||
import org.nl.b_lms.sch.task.service.IschBaseTaskService;
|
||||
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;
|
||||
@@ -23,7 +22,6 @@ import org.nl.modules.common.exception.BadRequestException;
|
||||
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.Isolation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
@@ -45,8 +43,6 @@ public class AutoCallAirShaftTask {
|
||||
@Autowired
|
||||
private IPdmBiSlittingproductionplanService slittingproductionplanService;
|
||||
@Autowired
|
||||
private IschBaseTaskService taskService;
|
||||
@Autowired
|
||||
private TrussCallAirShaftTask trussCallAirShaftTask;
|
||||
@Autowired
|
||||
private WmsToAcsService wmsToAcsService;
|
||||
@@ -55,23 +51,21 @@ public class AutoCallAirShaftTask {
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void run() {
|
||||
// 1、获取空的插拔轴位(无任务) todo:(目前都是上区域,下区域未考虑)
|
||||
// 1、获取空的插拔轴位(无任务)
|
||||
List<BstIvtShafttubeivt> emptyPoints = bstIvtShafttubeivtService.getAllShaftPointsByConditions("2","0","0");
|
||||
emptyPoints.forEach(empty -> {
|
||||
// 标箔:1,锂电:2
|
||||
String specification = empty.getQzz_generation();
|
||||
String location;
|
||||
String location = empty.getPoint_location();
|
||||
String area;
|
||||
if ("1".equals(specification)) {
|
||||
location = "0";
|
||||
if ("0".equals(empty.getPoint_location())) {
|
||||
if (SlitterConstant.SLITTER_STANDARD_FOIL.equals(specification)) {
|
||||
if (SlitterConstant.SLITTER_AREA_UP.equals(location)) {
|
||||
area = "B2";
|
||||
} else {
|
||||
area = "B4";
|
||||
}
|
||||
} else {
|
||||
location = "1";
|
||||
if ("0".equals(empty.getPoint_location())) {
|
||||
if (SlitterConstant.SLITTER_AREA_UP.equals(location)) {
|
||||
area = "B1";
|
||||
} else {
|
||||
area = "B3";
|
||||
@@ -81,15 +75,15 @@ public class AutoCallAirShaftTask {
|
||||
List<SlitterPlanDistinctDto> plans = slittingproductionplanService.getAllCutPlan(area);
|
||||
if (plans.size() == 0) {
|
||||
// 如果不需要套轴,就只做拔轴
|
||||
makePullShaft(empty);
|
||||
makePullShaft(empty, area);
|
||||
return;
|
||||
}
|
||||
// 查看套轴对接位是否满了
|
||||
List<BstIvtCutpointivt> emptyShaftPoint = bcutpointivtService.getAreaNotTaskPointByStatus("1", "1", "0");
|
||||
List<BstIvtCutpointivt> emptyShaftPoint = bcutpointivtService.getAreaNotTaskPointByStatus("1", "1", location, "0");
|
||||
// 如果满了就只做拔轴
|
||||
if (emptyShaftPoint.size() == 0) {
|
||||
// 如果不需要套轴,就只做拔轴
|
||||
makePullShaft(empty);
|
||||
makePullShaft(empty, area);
|
||||
return;
|
||||
}
|
||||
// 获取一个分切计划的Dto。一根轴可能有两个分切计划
|
||||
@@ -104,7 +98,7 @@ public class AutoCallAirShaftTask {
|
||||
// 获取其中一条
|
||||
PdmBiSlittingproductionplan needPlan = needPlans.get(0);
|
||||
String qzzSize = needPlan.getQzz_size();
|
||||
// 从套轴对接位获取相同气涨轴大小
|
||||
// 从套轴对接位获取相同气涨轴大小 (同标箔或者锂电分开)
|
||||
List<BstIvtCutpointivt> qzzPoint = bcutpointivtService.getPointByTypeAndShaftSize("1", qzzSize, area);
|
||||
if (qzzPoint.size() == 0) {
|
||||
// 调用ACS滚条气涨轴下来
|
||||
@@ -133,16 +127,25 @@ public class AutoCallAirShaftTask {
|
||||
param.put("qzz_no", ObjectUtil.isNotEmpty(startPoint.getQzz_no1())
|
||||
? startPoint.getQzz_no1() : startPoint.getQzz_no2());
|
||||
param.put("needPlan", planDto);
|
||||
param.put("is_pulling", "1");
|
||||
param.put("is_bushing", "1");
|
||||
param.put("task_type", "6");
|
||||
param.put("product_area", SlitterConstant.SLITTER_TASK_AREA);
|
||||
param.put("qzz_size", needPlan.getQzz_size());
|
||||
// 设置子卷号
|
||||
// 纸管规格、是否拔轴
|
||||
for (PdmBiSlittingproductionplan plan : needPlans) {
|
||||
if ("1".equals(plan.getLeft_or_right())) {
|
||||
param.put("left", plan.getContainer_name());
|
||||
if ("1".equals(plan.getPaper_tube_or_FRP())) {
|
||||
param.put("left", plan.getPaper_tube_model());
|
||||
} else {
|
||||
param.put("left", plan.getFRP_model());
|
||||
}
|
||||
} else {
|
||||
param.put("right", plan.getContainer_name());
|
||||
if ("1".equals(plan.getPaper_tube_or_FRP())) {
|
||||
param.put("right", plan.getPaper_tube_model());
|
||||
} else {
|
||||
param.put("right", plan.getFRP_model());
|
||||
}
|
||||
}
|
||||
}
|
||||
trussCallAirShaftTask.createTask(param);
|
||||
@@ -169,7 +172,7 @@ public class AutoCallAirShaftTask {
|
||||
throw new BadRequestException("气胀轴库找不到[" + qzzSize + "]规格的气涨轴");
|
||||
}
|
||||
BstIvtShafttubeivt shafttubeivt = shafttubeivts.get(0);
|
||||
// todo: 访问acs判断是否有无气涨轴
|
||||
// todo: 访问acs判断有无气涨轴
|
||||
boolean flag = true;
|
||||
if (!flag) {
|
||||
// 气涨轴库没有对应的气涨轴,就到气涨轴暂存区获取
|
||||
@@ -256,11 +259,12 @@ public class AutoCallAirShaftTask {
|
||||
}
|
||||
|
||||
/**
|
||||
* 不需要套轴,就只做拔轴
|
||||
* 不需要套轴,就只做拔轴(区分标箔、锂电)
|
||||
* @param empty 空的插拔轴点位
|
||||
* @param area 区域
|
||||
*/
|
||||
private void makePullShaft(BstIvtShafttubeivt empty) {
|
||||
List<BstIvtCutpointivt> notTaskPoints = bcutpointivtService.getAreaNotTaskPointByStatus("1", "3", "0");
|
||||
private void makePullShaft(BstIvtShafttubeivt empty, String area) {
|
||||
List<BstIvtCutpointivt> notTaskPoints = bcutpointivtService.getAreaNotTaskPointByLocationAreaAndStatus(empty.getPoint_location(), area);
|
||||
if (notTaskPoints.size() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ public class AutoSendAirShaftAgvTask {
|
||||
@SneakyThrows
|
||||
public void run() {
|
||||
// 获取套轴对接位有气涨轴没任务的点位
|
||||
List<BstIvtCutpointivt> cutPoints = bcutpointivtService.getAreaNotTaskPointByStatus("1", "2", "0");
|
||||
List<BstIvtCutpointivt> cutPoints = bcutpointivtService.getAreaNotTaskPointByStatus("1", "2", "0", "0");
|
||||
for (BstIvtCutpointivt cutPoint : cutPoints) {
|
||||
// 获取分切计划
|
||||
List<String> collect = Stream.of(cutPoint.getQzz_no1(), cutPoint.getQzz_no2())
|
||||
@@ -63,6 +63,7 @@ public class AutoSendAirShaftAgvTask {
|
||||
}
|
||||
// 获取任意一条
|
||||
PdmBiSlittingproductionplan demoPlan = plans.get(0);
|
||||
// 区域(B1, B2, B3, B4)
|
||||
String area = demoPlan.getResource_name().substring(0, 2);
|
||||
StIvtCutpointivt deviceCut = cutpointivtService.getOne(new LambdaQueryWrapper<StIvtCutpointivt>()
|
||||
.eq(StIvtCutpointivt::getExt_code, demoPlan.getResource_name()));
|
||||
@@ -81,7 +82,7 @@ public class AutoSendAirShaftAgvTask {
|
||||
}
|
||||
// 如果两个气涨轴编码则表示一组满了
|
||||
// 查找分切对接没任务的空位
|
||||
List<BstIvtCutpointivt> emptyPoint = slitterMapper.getEmptyCutPointNotTask(deviceCut.getSort_seq());
|
||||
List<BstIvtCutpointivt> emptyPoint = slitterMapper.getEmptyCutPointNotTask(area, deviceCut.getSort_seq());
|
||||
if (emptyPoint.size() == 0) {
|
||||
log.warn("找不到对应的位置!");
|
||||
return;
|
||||
|
||||
@@ -55,7 +55,7 @@ public class AutoSlitterDownAgvTask {
|
||||
cutPointIvts.forEach(cut -> {
|
||||
// cut是起点
|
||||
// 1、先去对应的套轴对接位,没有气涨轴(空位),没有任务的点位
|
||||
List<BstIvtCutpointivt> areaEmptyNotTaskPoint = cutpointivtService.getAreaNotTaskPointByStatus("1", "1", "2");
|
||||
List<BstIvtCutpointivt> areaEmptyNotTaskPoint = cutpointivtService.getAreaNotTaskPointByStatus("1", "1", "0", "2");
|
||||
if (areaEmptyNotTaskPoint.size() > 0) {
|
||||
BstIvtCutpointivt endPoint = areaEmptyNotTaskPoint.get(0);
|
||||
RLock lock = redissonClient.getLock(endPoint.getPoint_code());
|
||||
@@ -79,7 +79,7 @@ public class AutoSlitterDownAgvTask {
|
||||
}
|
||||
} else if (areaEmptyNotTaskPoint.size() == 0 && "3".equals(cut.getPoint_type())) {
|
||||
// 2、没有位置,就去分切缓存位
|
||||
areaEmptyNotTaskPoint = cutpointivtService.getAreaNotTaskPointByStatus("3", "1", "0");
|
||||
areaEmptyNotTaskPoint = cutpointivtService.getAreaNotTaskPointByStatus("3", "1", "0","0");
|
||||
}
|
||||
if (areaEmptyNotTaskPoint.size() == 0) {
|
||||
log.warn(cut.getProduct_area() + "该区域暂无位置存放满轴");
|
||||
|
||||
@@ -11,5 +11,29 @@ public interface SlitterConstant {
|
||||
* 任务区域:暂定Test
|
||||
*/
|
||||
String SLITTER_TASK_AREA = "B2";
|
||||
/**
|
||||
* 是/可能/使用...
|
||||
*/
|
||||
String SLITTER_YES = "1";
|
||||
/**
|
||||
* 否/不可能/不用...
|
||||
*/
|
||||
String SLITTER_NO = "0";
|
||||
/**
|
||||
* 标箔:1
|
||||
*/
|
||||
String SLITTER_STANDARD_FOIL = "1";
|
||||
/**
|
||||
* 锂电:2
|
||||
*/
|
||||
String SLITTER_LITHIUM_BATTERY = "2";
|
||||
/**
|
||||
* 区域:上
|
||||
*/
|
||||
String SLITTER_AREA_UP = "0";
|
||||
/**
|
||||
* 区域:下
|
||||
*/
|
||||
String SLITTER_AREA_DOWN = "1";
|
||||
|
||||
}
|
||||
|
||||
@@ -39,6 +39,8 @@ public class SlitterController {
|
||||
return new ResponseEntity<>(slitterService.acsFinishLoadShaft(entity), HttpStatus.OK);
|
||||
} else if ("3".equals(entity.getString("type"))) {
|
||||
return new ResponseEntity<>(slitterService.acsFinishShaftPluckTube(entity), HttpStatus.OK);
|
||||
} else if ("5".equals(entity.getString("type"))) {
|
||||
return new ResponseEntity<>(slitterService.acsSendShaftToCache(entity), HttpStatus.OK);
|
||||
}
|
||||
return new ResponseEntity<>(slitterService.acsRequestShaftLoadTube(entity), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -35,10 +35,11 @@ public interface SlitterMapper {
|
||||
|
||||
/**
|
||||
* 获取分切机下料位没任务的点位
|
||||
* @param sortSeq
|
||||
* @param area 区域
|
||||
* @param sortSeq 设备序号
|
||||
* @return
|
||||
*/
|
||||
List<BstIvtCutpointivt> getEmptyCutPointNotTask(BigDecimal sortSeq);
|
||||
List<BstIvtCutpointivt> getEmptyCutPointNotTask(String area, BigDecimal sortSeq);
|
||||
|
||||
/**
|
||||
* 获取分切机下一组分切计划对应的点位
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
FROM
|
||||
`bst_ivt_cutpointivt` bcp
|
||||
WHERE bcp.point_type = '3' AND bcp.point_status = '1' AND bcp.is_used = '1'
|
||||
AND bcp.product_area = #{area}
|
||||
AND 0 = (
|
||||
SELECT COUNT(*) FROM sch_base_task t
|
||||
WHERE t.task_status <![CDATA[ < ]]> '07' AND (t.point_code2 = bcp.point_code OR t.point_code2 = bcp.truss_point_code1
|
||||
|
||||
@@ -48,4 +48,31 @@ public interface SlitterService {
|
||||
* @return
|
||||
*/
|
||||
JSONObject mesSlittingMachineSendMaterial(JSONObject param);
|
||||
|
||||
|
||||
/**
|
||||
* 分切子卷获取LMS,AGV废箔称重重量
|
||||
* @param param "ResourceName": "设备编码"
|
||||
* @return
|
||||
* {
|
||||
* "RTOAL": 1,
|
||||
* "RTMSG": "操作成功!",
|
||||
* "RTYPE": "S",
|
||||
* "RTDAT": [
|
||||
* {
|
||||
* "ResourceName": "设备号",
|
||||
* "Weight": "差异重量",
|
||||
* “WeighDate”:"称重时间"
|
||||
* }
|
||||
* ]
|
||||
* }
|
||||
*/
|
||||
JSONObject mesGetWeighingOfWasteFoil(JSONObject param);
|
||||
|
||||
/**
|
||||
* 分切子卷获取LMS,AGV废箔称重重量MES提交废箔成功
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
JSONObject mesGetFinishWeighingOfWasteFoil(JSONObject param);
|
||||
}
|
||||
|
||||
@@ -8,8 +8,12 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
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.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.shafttubeivt.service.IBstIvtShafttubeivtService;
|
||||
import org.nl.b_lms.bst.ivt.shafttubeivt.service.dao.BstIvtShafttubeivt;
|
||||
import org.nl.b_lms.pdm.bi.slittingproductionplan.service.IPdmBiSlittingproductionplanService;
|
||||
@@ -20,12 +24,14 @@ 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.SendCopperFoilSubRollTrussTask;
|
||||
import org.nl.b_lms.sch.tasks.slitter.SlitterDownTrussTask;
|
||||
import org.nl.b_lms.sch.tasks.slitter.TrussCallShaftCacheTask;
|
||||
import org.nl.b_lms.sch.tasks.slitter.TrussSendAirShaftTask;
|
||||
import org.nl.b_lms.sch.tasks.slitter.constant.SlitterConstant;
|
||||
import org.nl.b_lms.sch.tasks.slitter.mapper.SlitterMapper;
|
||||
import org.nl.b_lms.sch.tasks.slitter.service.SlitterService;
|
||||
import org.nl.common.utils.TaskUtils;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.wms.ext.acs.service.WmsToAcsService;
|
||||
import org.redisson.api.RLock;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -43,6 +49,7 @@ import java.util.stream.Stream;
|
||||
* @author lyd
|
||||
* @date 2024-02-26
|
||||
**/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class SlitterServiceImpl implements SlitterService {
|
||||
|
||||
@@ -66,31 +73,38 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
private SendCopperFoilSubRollTrussTask sendCopperFoilSubRollTrussTask;
|
||||
@Autowired
|
||||
private RedissonClient redissonClient;
|
||||
@Autowired
|
||||
private TrussCallShaftCacheTask trussCallShaftCacheTask;
|
||||
@Autowired
|
||||
private IBstIvtScaleboundService scaleBoundService;
|
||||
@Autowired
|
||||
private IBstIvtScalehistoryService scaleHistoryService;
|
||||
@Autowired
|
||||
private WmsToAcsService wmsToAcsService;
|
||||
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public JSONObject acsRequestShaftLoadTube(JSONObject param) {
|
||||
JSONObject res = new JSONObject();
|
||||
JSONObject con = new JSONObject();
|
||||
String deviceCode = param.getString("device_code");
|
||||
RLock lock = redissonClient.getLock(deviceCode);
|
||||
boolean tryLock = lock.tryLock(10, TimeUnit.SECONDS);
|
||||
try {
|
||||
if (tryLock) {
|
||||
String size = param.getString("size");
|
||||
BstIvtShafttubeivt point = shafttubeivtService.getByPointCode(deviceCode, false);
|
||||
res.put("device_code", deviceCode);
|
||||
res.put("data", con);
|
||||
con.put("left", point.getTube_code1());
|
||||
con.put("right", point.getTube_code2());
|
||||
} else {
|
||||
throw new BadRequestException("系统繁忙,稍后在试");
|
||||
}
|
||||
} finally {
|
||||
if (tryLock) {
|
||||
lock.unlock();
|
||||
}
|
||||
String size = param.getString("size");
|
||||
BstIvtShafttubeivt point = shafttubeivtService.getByPointCode(deviceCode, false);
|
||||
// 判断尺寸是否相同
|
||||
if (!size.equals(point.getQzz_size())) {
|
||||
log.error("设备:{}对应的气胀轴尺寸不批对,需要气胀轴尺寸:{},实际尺寸:{}", deviceCode, point.getQzz_size(), size);
|
||||
throw new BadRequestException("设备:{ " + deviceCode + " }对应的气胀轴尺寸不批对" +
|
||||
",需要气胀轴尺寸:{ " + point.getQzz_size() + " },实际尺寸:{ " + size + " }");
|
||||
}
|
||||
res.put("device_code", deviceCode);
|
||||
res.put("data", con);
|
||||
con.put("left", point.getTube_code1());
|
||||
con.put("left_size", ObjectUtil.isNotEmpty(point.getTube_name1())
|
||||
? point.getTube_name1().split("\\|")[2].charAt(0) : "");
|
||||
con.put("right", point.getTube_code2());
|
||||
con.put("right_size", ObjectUtil.isNotEmpty(point.getTube_name2())
|
||||
? point.getTube_name2().split("\\|")[2].charAt(0) : "");
|
||||
con.put("number", ObjectUtil.isNotEmpty(point.getTube_code1()) && ObjectUtil.isNotEmpty(point.getTube_code2())
|
||||
? "2" : "1");
|
||||
res.put("code", HttpStatus.HTTP_OK);
|
||||
res.put("message", "任务请求成功!");
|
||||
return res;
|
||||
@@ -101,41 +115,34 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
public JSONObject acsFinishShaftPluckTube(JSONObject param) {
|
||||
JSONObject res = new JSONObject();
|
||||
String deviceCode = param.getString("device_code");
|
||||
RLock lock = redissonClient.getLock(deviceCode);
|
||||
boolean tryLock = lock.tryLock(10, TimeUnit.SECONDS);
|
||||
try {
|
||||
if (tryLock) {
|
||||
// 气涨轴编码
|
||||
String qzzNo = param.getString("qzz_no");
|
||||
List<PdmBiSlittingproductionplan> plans = slittingproductionplanService.getByQzzNo(qzzNo);
|
||||
if (plans.size() == 0) {
|
||||
throw new BadRequestException("查询不到气胀轴编码「" + qzzNo + "」对应的子卷信息!");
|
||||
}
|
||||
PdmBiSlittingproductionplan plan;
|
||||
if ("1".equals(deviceCode.substring(deviceCode.length() - 1))) {
|
||||
plan = plans.stream().filter(p -> "1".equals(p.getLeft_or_right())).findFirst().orElse(null);
|
||||
} else {
|
||||
plan = plans.stream().filter(p -> "2".equals(p.getLeft_or_right())).findFirst().orElse(null);
|
||||
}
|
||||
// 查找终点 todo: 如何确认是废箔还是成品
|
||||
// todo: 暂时写死去成品称重
|
||||
// 气涨轴编码
|
||||
String qzzNo = param.getString("qzz_no");
|
||||
String direction = param.getString("direction");
|
||||
List<PdmBiSlittingproductionplan> plans = slittingproductionplanService.getByQzzNo(qzzNo);
|
||||
if (plans.size() == 0) {
|
||||
throw new BadRequestException("查询不到气胀轴编码「" + qzzNo + "」对应的子卷信息!");
|
||||
}
|
||||
PdmBiSlittingproductionplan plan;
|
||||
if ("1".equals(direction)) {
|
||||
plan = plans.stream().filter(p -> "1".equals(p.getLeft_or_right())).findFirst().orElse(null);
|
||||
} else {
|
||||
plan = plans.stream().filter(p -> "2".equals(p.getLeft_or_right())).findFirst().orElse(null);
|
||||
}
|
||||
if (plan == null) {
|
||||
log.error("设备{}, 找不到气胀轴编码{}对应的分切计划!参数:{}",deviceCode, qzzNo, param);
|
||||
throw new BadRequestException("找不到气胀轴编码{ " + qzzNo + " }的分切计划!");
|
||||
}
|
||||
// 查找终点 todo: 如何确认是废箔还是成品
|
||||
// todo: 暂时写死去成品称重
|
||||
// BstIvtShafttubeivt one = shafttubeivtService.getOne(new LambdaQueryWrapper<BstIvtShafttubeivt>()
|
||||
// .eq(BstIvtShafttubeivt::getPoint_type, "4").eq(BstIvtShafttubeivt::getPoint_location, "0"));
|
||||
JSONObject taskParam = new JSONObject();
|
||||
taskParam.put("point_code1", deviceCode);
|
||||
taskParam.put("point_code2", "B_CZW01");
|
||||
taskParam.put("material_code", plan.getContainer_name());
|
||||
taskParam.put("task_type", "6");
|
||||
taskParam.put("product_area", SlitterConstant.SLITTER_TASK_AREA);
|
||||
sendCopperFoilSubRollTrussTask.createTask(taskParam);
|
||||
} else {
|
||||
throw new BadRequestException("系统繁忙,稍后在试");
|
||||
}
|
||||
} finally {
|
||||
if (tryLock) {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
JSONObject taskParam = new JSONObject();
|
||||
taskParam.put("point_code1", deviceCode);
|
||||
taskParam.put("point_code2", "B_CZW01");
|
||||
taskParam.put("material_code", plan.getContainer_name());
|
||||
taskParam.put("task_type", "6");
|
||||
taskParam.put("product_area", SlitterConstant.SLITTER_TASK_AREA);
|
||||
sendCopperFoilSubRollTrussTask.createTask(taskParam);
|
||||
res.put("code", HttpStatus.HTTP_OK);
|
||||
res.put("message", "任务请求成功!");
|
||||
return res;
|
||||
@@ -147,38 +154,28 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
// 参数:设备号,type,插拔轴位,qzzSize
|
||||
JSONObject res = new JSONObject();
|
||||
String deviceCode = param.getString("device_code");
|
||||
RLock lock = redissonClient.getLock(deviceCode);
|
||||
boolean tryLock = lock.tryLock(10, TimeUnit.SECONDS);
|
||||
try {
|
||||
if (tryLock) {
|
||||
String qzzNo = param.getString("qzz_no");
|
||||
if (ObjectUtil.isEmpty(qzzNo)) {
|
||||
throw new BadRequestException("气涨轴编码不能为空!");
|
||||
}
|
||||
List<PdmBiSlittingproductionplan> plans = slittingproductionplanService.getByQzzNo(qzzNo);
|
||||
if (plans.size() == 0) {
|
||||
throw new BadRequestException("查询不到气胀轴编码「" + qzzNo + "」对应的子卷信息!");
|
||||
}
|
||||
// 反馈 纸管尺寸
|
||||
JSONObject r = new JSONObject();
|
||||
res.put("data", r);
|
||||
r.put("device_code", deviceCode);
|
||||
for (PdmBiSlittingproductionplan plan : plans) {
|
||||
String s = String.valueOf("1".equals(plan.getPaper_tube_or_FRP())
|
||||
? plan.getPaper_tube_model()
|
||||
: plan.getFRP_model().split("\\|")[2].charAt(0));
|
||||
if ("1".equals(plan.getLeft_or_right())) {
|
||||
r.put("left_size", s);
|
||||
} else {
|
||||
r.put("right_size", s);
|
||||
}
|
||||
}
|
||||
String qzzNo = param.getString("qzz_no");
|
||||
if (ObjectUtil.isEmpty(qzzNo)) {
|
||||
log.error("气涨轴编码不能为空!");
|
||||
throw new BadRequestException("气涨轴编码不能为空!");
|
||||
}
|
||||
List<PdmBiSlittingproductionplan> plans = slittingproductionplanService.getByQzzNo(qzzNo);
|
||||
if (plans.size() == 0) {
|
||||
log.error("查询不到气胀轴编码「" + qzzNo + "」对应的子卷信息!");
|
||||
throw new BadRequestException("查询不到气胀轴编码「" + qzzNo + "」对应的子卷信息!");
|
||||
}
|
||||
// 反馈 纸管尺寸
|
||||
JSONObject r = new JSONObject();
|
||||
res.put("data", r);
|
||||
r.put("device_code", deviceCode);
|
||||
for (PdmBiSlittingproductionplan plan : plans) {
|
||||
String s = String.valueOf("1".equals(plan.getPaper_tube_or_FRP())
|
||||
? plan.getPaper_tube_model().split("\\|")[2].charAt(0)
|
||||
: plan.getFRP_model().split("\\|")[2].charAt(0));
|
||||
if ("1".equals(plan.getLeft_or_right())) {
|
||||
r.put("left_size", s);
|
||||
} else {
|
||||
throw new BadRequestException("系统繁忙,稍后在试");
|
||||
}
|
||||
} finally {
|
||||
if (tryLock) {
|
||||
lock.unlock();
|
||||
r.put("right_size", s);
|
||||
}
|
||||
}
|
||||
res.put("code", HttpStatus.HTTP_OK);
|
||||
@@ -191,93 +188,84 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public JSONObject acsFinishLoadShaft(JSONObject param) {
|
||||
JSONObject res = new JSONObject();
|
||||
// 穿拔轴位
|
||||
String deviceCode = param.getString("device_code");
|
||||
RLock lock = redissonClient.getLock(deviceCode);
|
||||
boolean tryLock = lock.tryLock(10, TimeUnit.SECONDS);
|
||||
// todo: 纸管
|
||||
String weight1 = param.getString("weight1");
|
||||
String material1 = param.getString("material1");
|
||||
String weight2 = param.getString("weight2");
|
||||
String material2 = param.getString("material2");
|
||||
// 判断是否有未完成的任务
|
||||
List<SchBaseTask> list = taskService.list(new LambdaQueryWrapper<SchBaseTask>()
|
||||
.eq(SchBaseTask::getPoint_code1, deviceCode)
|
||||
.lt(SchBaseTask::getTask_status, "07"));
|
||||
if (list.size() > 0) {
|
||||
log.error("点位[{}]存在未完成得任务!", deviceCode);
|
||||
throw new BadRequestException("点位[" + deviceCode + "]存在未完成得任务!");
|
||||
}
|
||||
BstIvtShafttubeivt startPoint = shafttubeivtService.getOne(new LambdaQueryWrapper<BstIvtShafttubeivt>()
|
||||
.eq(BstIvtShafttubeivt::getPoint_code, deviceCode));
|
||||
// 获取分切计划
|
||||
List<String> collect = Stream.of(startPoint.getContainer_name1(), startPoint.getContainer_name2())
|
||||
.filter(value -> value != null && !value.isEmpty()).collect(Collectors.toList());
|
||||
List<PdmBiSlittingproductionplan> plans = slittingproductionplanService.list(new LambdaQueryWrapper<PdmBiSlittingproductionplan>()
|
||||
.in(PdmBiSlittingproductionplan::getContainer_name, collect)
|
||||
.eq(PdmBiSlittingproductionplan::getIs_delete, "0"));
|
||||
if (plans.size() == 0) {
|
||||
log.error("找不到[{}]对应的分切计划!", collect);
|
||||
throw new BadRequestException("找不到[" + collect + "]对应的分切计划!");
|
||||
}
|
||||
// 当前套轴的分切计划
|
||||
PdmBiSlittingproductionplan demoPlan = plans.get(0);
|
||||
// 查找是否有同组的气胀轴位置
|
||||
BstIvtCutpointivt cutPoint = slitterMapper.getSameGroupPoint(demoPlan);
|
||||
if (ObjectUtil.isEmpty(cutPoint)) {
|
||||
// 也有可能在路上, 获取任务的终点
|
||||
String endPoint = slitterMapper.getSameGroupTaskPoint(demoPlan);
|
||||
if (ObjectUtil.isNotEmpty(endPoint)) {
|
||||
cutPoint = bcutpointivtService.getOne(new LambdaQueryWrapper<BstIvtCutpointivt>()
|
||||
.eq(BstIvtCutpointivt::getTruss_point_code1, endPoint).or()
|
||||
.eq(BstIvtCutpointivt::getTruss_point_code2, endPoint));
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isEmpty(cutPoint)) {
|
||||
// 获取一个空位 (上下区域)
|
||||
List<BstIvtCutpointivt> emptyNotTaskPoint = bcutpointivtService.getAreaNotTaskPointByStatus(
|
||||
"1", "1", startPoint.getPoint_location(), "1");
|
||||
if (emptyNotTaskPoint.size() == 0) {
|
||||
throw new BadRequestException("找不到可用套轴对接位!");
|
||||
}
|
||||
cutPoint = emptyNotTaskPoint.get(0);
|
||||
}
|
||||
// 枷锁
|
||||
RLock lockPoint = redissonClient.getLock(cutPoint.getPoint_code());
|
||||
boolean tryLockPoint = lockPoint.tryLock(0, TimeUnit.SECONDS);
|
||||
try {
|
||||
if (tryLock) {
|
||||
String taskCode = param.getString("task_code");
|
||||
// todo: 纸管
|
||||
String weight1 = param.getString("weight1");
|
||||
String material1 = param.getString("material1");
|
||||
String weight2 = param.getString("weight2");
|
||||
String material2 = param.getString("material2");
|
||||
// 判断是否有未完成的任务
|
||||
List<SchBaseTask> list = taskService.list(new LambdaQueryWrapper<SchBaseTask>()
|
||||
.eq(SchBaseTask::getPoint_code1, deviceCode)
|
||||
.lt(SchBaseTask::getTask_status, "07"));
|
||||
if (list.size() > 0) {
|
||||
throw new BadRequestException("点位[" + deviceCode + "]存在未完成得任务!");
|
||||
}
|
||||
BstIvtShafttubeivt startPoint = shafttubeivtService.getOne(new LambdaQueryWrapper<BstIvtShafttubeivt>()
|
||||
.eq(BstIvtShafttubeivt::getPoint_code, deviceCode));
|
||||
// 获取分切计划
|
||||
List<String> collect = Stream.of(startPoint.getContainer_name1(), startPoint.getContainer_name2())
|
||||
.filter(value -> value != null && !value.isEmpty()).collect(Collectors.toList());
|
||||
List<PdmBiSlittingproductionplan> plans = slittingproductionplanService.list(new LambdaQueryWrapper<PdmBiSlittingproductionplan>()
|
||||
.in(PdmBiSlittingproductionplan::getContainer_name, collect)
|
||||
.eq(PdmBiSlittingproductionplan::getIs_delete, "0"));
|
||||
if (plans.size() == 0) {
|
||||
throw new BadRequestException("找不到[" + collect + "]对应的分切计划!");
|
||||
}
|
||||
// 当前套轴的分切计划
|
||||
PdmBiSlittingproductionplan demoPlan = plans.get(0);
|
||||
// 查找是否有同组的气胀轴位置
|
||||
BstIvtCutpointivt cutPoint = slitterMapper.getSameGroupPoint(demoPlan);
|
||||
if (ObjectUtil.isEmpty(cutPoint)) {
|
||||
// 也有可能在路上, 获取任务的终点
|
||||
String endPoint = slitterMapper.getSameGroupTaskPoint(demoPlan);
|
||||
if (ObjectUtil.isNotEmpty(endPoint)) {
|
||||
cutPoint = bcutpointivtService.getOne(new LambdaQueryWrapper<BstIvtCutpointivt>()
|
||||
.eq(BstIvtCutpointivt::getTruss_point_code1, endPoint).or()
|
||||
.eq(BstIvtCutpointivt::getTruss_point_code2, endPoint));
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isEmpty(cutPoint)) {
|
||||
// 获取一个空位
|
||||
List<BstIvtCutpointivt> emptyNotTaskPoint = bcutpointivtService.getAreaNotTaskPointByStatus("1", "1", "1");
|
||||
if (emptyNotTaskPoint.size() == 0) {
|
||||
throw new BadRequestException("找不到可用套轴对接位!");
|
||||
}
|
||||
cutPoint = emptyNotTaskPoint.get(0);
|
||||
}
|
||||
// 枷锁
|
||||
RLock lockPoint = redissonClient.getLock(cutPoint.getPoint_code());
|
||||
boolean tryLockPoint = lockPoint.tryLock(5, TimeUnit.SECONDS);
|
||||
try {
|
||||
if (tryLockPoint) {
|
||||
// 分切计划设置套轴完成
|
||||
String qzzNo = IdUtil.getSnowflake(1,1).nextIdStr();
|
||||
plans.forEach(plan -> {
|
||||
plan.setIs_child_tz_ok("1");
|
||||
plan.setQzzno(qzzNo);
|
||||
TaskUtils.updateOptMessageBySlitterPlan(plan);
|
||||
});
|
||||
slittingproductionplanService.updateBatchById(plans);
|
||||
// 创建任务
|
||||
JSONObject taskParam = new JSONObject();
|
||||
taskParam.put("point_code1", startPoint.getPoint_code());
|
||||
taskParam.put("point_code2", "1".equals(demoPlan.getUp_or_down())
|
||||
? cutPoint.getTruss_point_code1() : cutPoint.getTruss_point_code2());
|
||||
taskParam.put("vehicle_code1", "1".equals(demoPlan.getUp_or_down()) ? qzzNo : "");
|
||||
taskParam.put("vehicle_code2", "2".equals(demoPlan.getUp_or_down()) ? qzzNo : "");
|
||||
taskParam.put("task_type", "6");
|
||||
taskParam.put("product_area", SlitterConstant.SLITTER_TASK_AREA);
|
||||
trussSendAirShaftTask.createTask(taskParam);
|
||||
} else {
|
||||
throw new BadRequestException("系统繁忙,稍后在试");
|
||||
}
|
||||
} finally {
|
||||
if (tryLockPoint) {
|
||||
lockPoint.unlock();
|
||||
}
|
||||
}
|
||||
if (tryLockPoint) {
|
||||
// 分切计划设置套轴完成
|
||||
String qzzNo = IdUtil.getSnowflake(1,1).nextIdStr();
|
||||
plans.forEach(plan -> {
|
||||
plan.setIs_child_tz_ok("1");
|
||||
plan.setQzzno(qzzNo);
|
||||
TaskUtils.updateOptMessageBySlitterPlan(plan);
|
||||
});
|
||||
slittingproductionplanService.updateBatchById(plans);
|
||||
// 创建任务
|
||||
JSONObject taskParam = new JSONObject();
|
||||
taskParam.put("point_code1", startPoint.getPoint_code());
|
||||
taskParam.put("point_code2", "1".equals(demoPlan.getUp_or_down())
|
||||
? cutPoint.getTruss_point_code1() : cutPoint.getTruss_point_code2());
|
||||
taskParam.put("vehicle_code1", "1".equals(demoPlan.getUp_or_down()) ? qzzNo : "");
|
||||
taskParam.put("vehicle_code2", "2".equals(demoPlan.getUp_or_down()) ? qzzNo : "");
|
||||
taskParam.put("task_type", "6");
|
||||
taskParam.put("product_area", SlitterConstant.SLITTER_TASK_AREA);
|
||||
trussSendAirShaftTask.createTask(taskParam);
|
||||
} else {
|
||||
throw new BadRequestException("系统繁忙,稍后在试");
|
||||
}
|
||||
} finally {
|
||||
if (tryLock) {
|
||||
lock.unlock();
|
||||
if (tryLockPoint) {
|
||||
lockPoint.unlock();
|
||||
}
|
||||
}
|
||||
res.put("code", HttpStatus.HTTP_OK);
|
||||
@@ -290,43 +278,32 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
public JSONObject acsSendShaftToCache(JSONObject param) {
|
||||
JSONObject res = new JSONObject();
|
||||
String deviceCode = param.getString("device_code");
|
||||
RLock lock = redissonClient.getLock(deviceCode);
|
||||
boolean tryLock = lock.tryLock(10, TimeUnit.SECONDS);
|
||||
try {
|
||||
if (tryLock) {
|
||||
String qzzSize = param.getString("qzz_size");
|
||||
// 判断是否有未完成的任务
|
||||
List<SchBaseTask> list = taskService.list(new LambdaQueryWrapper<SchBaseTask>()
|
||||
.eq(SchBaseTask::getPoint_code1, deviceCode)
|
||||
.lt(SchBaseTask::getTask_status, "07"));
|
||||
if (list.size() > 0) {
|
||||
throw new BadRequestException("点位[" + deviceCode + "]存在未完成得任务!");
|
||||
}
|
||||
BstIvtShafttubeivt startPoint = shafttubeivtService.getByPointCode(deviceCode, false);
|
||||
// 临时存放气涨轴尺寸
|
||||
startPoint.setQzz_size(qzzSize);
|
||||
// 获取空位
|
||||
List<BstIvtShafttubeivt> shafttubeivts = shafttubeivtService.getNotTaskShaftCacheEmpty(startPoint);
|
||||
if (shafttubeivts.size() == 0) {
|
||||
throw new BadRequestException("未找到可存放气涨轴规格「" + qzzSize + "」的空暂存位");
|
||||
}
|
||||
BstIvtShafttubeivt shafttubeivt = shafttubeivts.get(0);
|
||||
// 创建任务
|
||||
param.put("point_code1", deviceCode);
|
||||
param.put("point_code2", shafttubeivt.getPoint_code());
|
||||
// hint: 当前分切计划的气涨轴尺寸
|
||||
param.put("qzz_size", qzzSize);
|
||||
param.put("task_type", "6");
|
||||
param.put("product_area", SlitterConstant.SLITTER_TASK_AREA);
|
||||
param.put("is_bushing", "0");
|
||||
} else {
|
||||
throw new BadRequestException("系统繁忙,稍后在试");
|
||||
}
|
||||
} finally {
|
||||
if (tryLock) {
|
||||
lock.unlock();
|
||||
}
|
||||
String qzzSize = param.getString("size");
|
||||
// 判断是否有未完成的任务
|
||||
List<SchBaseTask> list = taskService.list(new LambdaQueryWrapper<SchBaseTask>()
|
||||
.eq(SchBaseTask::getPoint_code1, deviceCode)
|
||||
.lt(SchBaseTask::getTask_status, "07"));
|
||||
if (list.size() > 0) {
|
||||
throw new BadRequestException("点位[" + deviceCode + "]存在未完成得任务!");
|
||||
}
|
||||
BstIvtShafttubeivt startPoint = shafttubeivtService.getByPointCode(deviceCode, false);
|
||||
// 临时存放气涨轴尺寸
|
||||
startPoint.setQzz_size(qzzSize);
|
||||
// 获取空位
|
||||
List<BstIvtShafttubeivt> shafttubeivts = shafttubeivtService.getNotTaskShaftCacheEmpty(startPoint);
|
||||
if (shafttubeivts.size() == 0) {
|
||||
throw new BadRequestException("未找到可存放气涨轴规格「" + qzzSize + "」的空暂存位");
|
||||
}
|
||||
BstIvtShafttubeivt shafttubeivt = shafttubeivts.get(0);
|
||||
// 创建任务
|
||||
param.put("point_code1", deviceCode);
|
||||
param.put("point_code2", shafttubeivt.getPoint_code());
|
||||
// hint: 当前分切计划的气涨轴尺寸
|
||||
param.put("qzz_size", qzzSize);
|
||||
param.put("task_type", "6");
|
||||
param.put("product_area", SlitterConstant.SLITTER_TASK_AREA);
|
||||
param.put("is_bushing", "0");
|
||||
trussCallShaftCacheTask.createTask(param);
|
||||
res.put("code", HttpStatus.HTTP_OK);
|
||||
res.put("message", "请求成功");
|
||||
return res;
|
||||
@@ -360,6 +337,7 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
// 获得设备
|
||||
StIvtCutpointivt device = cutpointivtService.getOne(new LambdaQueryWrapper<StIvtCutpointivt>()
|
||||
.eq(StIvtCutpointivt::getExt_code, demoPlan.getResource_name()));
|
||||
String area = demoPlan.getResource_name().substring(0, 2);
|
||||
// 获取当前分切机的下一组分切计划(最多四条分切计划)
|
||||
// hint: 获取到的分切可能是不同组的但具有一定时间顺序
|
||||
List<PdmBiSlittingproductionplan> timePlans = slittingproductionplanService.list(new LambdaQueryWrapper<PdmBiSlittingproductionplan>()
|
||||
@@ -372,7 +350,7 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
if (timePlans.size() == 0) {
|
||||
// 如果没有下一组的分切计划,就只做下卷任务(判断下单/下双)
|
||||
// 获取分切对接位没任务的空位置
|
||||
List<BstIvtCutpointivt> emptyPoints = slitterMapper.getEmptyCutPointNotTask(device.getSort_seq());
|
||||
List<BstIvtCutpointivt> emptyPoints = slitterMapper.getEmptyCutPointNotTask(area, device.getSort_seq());
|
||||
if (emptyPoints.size() == 0) {
|
||||
throw new BadRequestException("分切机【" + device.getExt_code() + "】找不到对应的对接位!");
|
||||
}
|
||||
@@ -508,4 +486,67 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
res.put("message", "子卷出站任务生成成功!");
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject mesGetWeighingOfWasteFoil(JSONObject param) {
|
||||
JSONObject res = new JSONObject();
|
||||
JSONObject resData = new JSONObject();
|
||||
String resourceName = param.getString("ResourceName");
|
||||
// 获取称的设备号
|
||||
BstIvtScalebound scaleEquipment = scaleBoundService.getOne(new LambdaQueryWrapper<BstIvtScalebound>()
|
||||
.eq(BstIvtScalebound::getDevice_code, resourceName));
|
||||
// 下发给acs称重
|
||||
JSONArray acsParam = new JSONArray();
|
||||
JSONObject acsWeighing = new JSONObject();
|
||||
acsWeighing.put("device_code", scaleEquipment.getScale_code());
|
||||
acsWeighing.put("code", "to_command");
|
||||
acsWeighing.put("value", "6");
|
||||
acsWeighing.put("product_area", SlitterConstant.SLITTER_TASK_AREA);
|
||||
acsParam.add(acsWeighing);
|
||||
JSONObject action = wmsToAcsService.action(acsParam);
|
||||
if (HttpStatus.HTTP_OK == action.getInteger("status")) {
|
||||
// 记录数据库
|
||||
res.put("RTOAL", 1);
|
||||
res.put("RTMSG", "操作成功!");
|
||||
res.put("RTYPE", "S");
|
||||
res.put("RTDAT", resData);
|
||||
resData.put("ResourceName", resourceName);
|
||||
resData.put("Weight", "");
|
||||
resData.put("WeighDate", "");
|
||||
return res;
|
||||
}
|
||||
res.put("RTOAL", 0);
|
||||
res.put("RTMSG", "称重失败!");
|
||||
res.put("RTYPE", "F");
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject mesGetFinishWeighingOfWasteFoil(JSONObject param) {
|
||||
JSONObject res = new JSONObject();
|
||||
String resourceName = param.getString("ResourceName");
|
||||
// 获取称的设备号
|
||||
BstIvtScalebound scaleEquipment = scaleBoundService.getOne(new LambdaQueryWrapper<BstIvtScalebound>()
|
||||
.eq(BstIvtScalebound::getDevice_code, resourceName));
|
||||
// 下发给acs称重
|
||||
JSONArray acsParam = new JSONArray();
|
||||
JSONObject acsWeighing = new JSONObject();
|
||||
acsWeighing.put("device_code", scaleEquipment.getScale_code());
|
||||
acsWeighing.put("code", "to_command");
|
||||
acsWeighing.put("value", "8");
|
||||
acsWeighing.put("product_area", SlitterConstant.SLITTER_TASK_AREA);
|
||||
acsParam.add(acsWeighing);
|
||||
JSONObject action = wmsToAcsService.action(acsParam);
|
||||
if (HttpStatus.HTTP_OK == action.getInteger("status")) {
|
||||
// 记录数据库
|
||||
res.put("RTOAL", 1);
|
||||
res.put("RTMSG", "操作成功!");
|
||||
res.put("RTYPE", "S");
|
||||
return res;
|
||||
}
|
||||
res.put("RTOAL", 0);
|
||||
res.put("RTMSG", "操作失败!");
|
||||
res.put("RTYPE", "F");
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1145,6 +1145,8 @@ public class StIvtIostorinvOutServiceImpl extends ServiceImpl<StIvtIostorinvOutM
|
||||
WQLObject taskTab = WQLObject.getWQLObject("sch_base_task");
|
||||
// 点位表
|
||||
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point");
|
||||
// 载具扩展属性表
|
||||
WQLObject extTab = WQLObject.getWQLObject("md_pb_storagevehicleext");
|
||||
|
||||
// 查询异常货位任务集合
|
||||
String TaskCodeIn = taskMangeList.stream()
|
||||
@@ -1203,12 +1205,18 @@ public class StIvtIostorinvOutServiceImpl extends ServiceImpl<StIvtIostorinvOutM
|
||||
}
|
||||
}
|
||||
|
||||
// 查询木箱对应的载具
|
||||
JSONObject jsonExt = extTab.query("storagevehicle_code = '" + json.getString("storagevehicle_code") + "'").uniqueResult(0);
|
||||
|
||||
// 生成任务
|
||||
JSONObject jsonTaskParam = new JSONObject();
|
||||
jsonTaskParam.put("task_type", "010711");
|
||||
jsonTaskParam.put("point_code1", start_device_code);
|
||||
jsonTaskParam.put("point_code2", point_code);
|
||||
jsonTaskParam.put("vehicle_code", json.getString("storagevehicle_code"));
|
||||
if (ObjectUtil.isNotEmpty(jsonExt)) {
|
||||
jsonTaskParam.put("vehicle_code2", jsonExt.getString("storagevehicle_code"));
|
||||
}
|
||||
jsonTaskParam.put("task_group_id", task_group_id);
|
||||
jsonTaskParam.put("is_auto_issue", is_auto_issue);
|
||||
jsonTaskParam.put("table_fk", disDaoList.get(0).getIostorinv_id().toString());
|
||||
|
||||
Binary file not shown.
@@ -116,7 +116,7 @@ public class AcsToWmsController {
|
||||
}
|
||||
|
||||
/*@PostMapping("/getQZZInfo")
|
||||
|
||||
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> getQZZInfo(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(acsToWmsService.getQZZInfo(jo), HttpStatus.OK);
|
||||
@@ -177,5 +177,10 @@ public class AcsToWmsController {
|
||||
return new ResponseEntity<>(acsToWmsService.deviceApplyExceptional(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/slitterApply")
|
||||
@Log(value = "二期分切请求", isInterfaceLog = true, interfaceLogType = InterfaceLogType.ACS_TO_LMS)
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> slitterApply(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(acsToWmsService.slitterApply(param), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,4 +167,11 @@ public interface AcsToWmsService {
|
||||
* }
|
||||
*/
|
||||
JSONObject deviceApplyExceptional(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 二期分切请求
|
||||
* @param param /
|
||||
* @return /
|
||||
*/
|
||||
JSONObject slitterApply(JSONObject param);
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ 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.TwoBoxExcepTask;
|
||||
import org.nl.b_lms.sch.tasks.first_floor_area.MzhcwTask;
|
||||
import org.nl.b_lms.sch.tasks.slitter.service.SlitterService;
|
||||
import org.nl.b_lms.storage_manage.ios.enums.IOSEnum;
|
||||
import org.nl.b_lms.storage_manage.ios.enums.TASKEnum;
|
||||
import org.nl.b_lms.storage_manage.ios.service.iostorInv.util.service.*;
|
||||
@@ -47,6 +48,7 @@ import org.nl.wms.st.inbill.service.RawAssistIStorService;
|
||||
import org.nl.wms.st.inbill.service.StorPublicService;
|
||||
import org.redisson.api.RLock;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -126,6 +128,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
@Resource
|
||||
private MzhcwTask mzhcwTask;
|
||||
|
||||
private final SlitterService slitterService;
|
||||
|
||||
|
||||
/**
|
||||
* task_id:任务标识
|
||||
@@ -2012,6 +2016,11 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
point_code = inBussManageService.taskExceptional(whereJson);
|
||||
}
|
||||
}
|
||||
|
||||
if (ObjectUtil.isEmpty(point_code)) {
|
||||
throw new BadRequestException("点位为空!");
|
||||
}
|
||||
|
||||
result.put("status", HttpStatus.OK.value());
|
||||
result.put("message", "下发成功!");
|
||||
result.put("point_code", point_code);
|
||||
@@ -2029,4 +2038,56 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
return result;
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public JSONObject slitterApply(JSONObject param) {
|
||||
log.info("slitterApply请求参数:---------------------------------------------{}", param);
|
||||
JSONObject res = new JSONObject();
|
||||
String deviceCode = param.getString("device_code");
|
||||
String type = param.getString("type");
|
||||
if (ObjectUtil.isEmpty(type)) {
|
||||
throw new BadRequestException("任务类型「type」不能为空");
|
||||
}
|
||||
RLock lock = redissonClient.getLock(deviceCode);
|
||||
boolean tryLock = lock.tryLock(5, TimeUnit.SECONDS);
|
||||
try {
|
||||
if (tryLock) {
|
||||
switch (type) {
|
||||
case "1":
|
||||
// 申请套管
|
||||
res = slitterService.acsRequestShaftLoadTube(param);
|
||||
break;
|
||||
case "2":
|
||||
// 套管完成
|
||||
res = slitterService.acsFinishLoadShaft(param);
|
||||
break;
|
||||
case "3":
|
||||
// 拔轴完成
|
||||
res = slitterService.acsFinishShaftPluckTube(param);
|
||||
break;
|
||||
case "4":
|
||||
// 申请拔轴
|
||||
res = slitterService.acsRequestShaftPluckTube(param);
|
||||
break;
|
||||
case "5":
|
||||
// 缓存线已满,生产桁架任务
|
||||
res = slitterService.acsSendShaftToCache(param);
|
||||
break;
|
||||
default:
|
||||
log.error("slitterApply任务类型「{}」无效!,参数:---------------------------------------------{}", type, param);
|
||||
throw new BadRequestException("任务类型「" + type + "」无效!");
|
||||
}
|
||||
} else {
|
||||
log.error("slitterApply系统繁忙,参数:---------------------------------------------{}", param);
|
||||
throw new BadRequestException("系统繁忙,请稍后再试!");
|
||||
}
|
||||
} finally {
|
||||
if (tryLock) {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
log.info("slitterApply返回参数:---------------------------------------------{}", res);
|
||||
return res;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -59,7 +59,6 @@ public class AcsTaskDto {
|
||||
* 扩展参数
|
||||
*/
|
||||
private String params;
|
||||
private String params2;
|
||||
/**
|
||||
* 温度
|
||||
*/
|
||||
@@ -109,7 +108,7 @@ public class AcsTaskDto {
|
||||
/**
|
||||
* 任务扩展字段
|
||||
*/
|
||||
private String interaction_json;
|
||||
private JSONObject interaction_json;
|
||||
/**
|
||||
* 空点位
|
||||
*/
|
||||
|
||||
@@ -32,6 +32,7 @@ import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
@@ -139,8 +140,15 @@ public class TaskServiceImpl implements TaskService {
|
||||
// 任务处理类
|
||||
String processing_class = taskObj.getString("handle_class");
|
||||
String message = "";
|
||||
|
||||
try {
|
||||
Object obj = SpringContextHolder.getBean(Class.forName(processing_class));
|
||||
Object obj = new Object();
|
||||
try {
|
||||
obj = SpringContextHolder.getBean(Class.forName(processing_class));
|
||||
} catch (Exception e) {
|
||||
Class<?> clz = Class.forName(processing_class);
|
||||
obj = clz.newInstance();
|
||||
}
|
||||
// 调用每个任务类的method_name()强制结束方法
|
||||
Method m = obj.getClass().getMethod(method_name, String.class);
|
||||
JSONObject result = (JSONObject) m.invoke(obj, task_id);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.wms.st.outbill.rest;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -403,6 +404,7 @@ public class CheckOutBillController {
|
||||
|
||||
@PostMapping("/testBoxLash")
|
||||
@Log("木箱捆扎测试")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> testBoxLash(@RequestBody JSONObject whereJson) {
|
||||
lashManageService.createLashTask(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
|
||||
Reference in New Issue
Block a user