add: 废箔称重

This commit is contained in:
2024-03-12 18:06:58 +08:00
parent 598b91733c
commit b5efde54cc
23 changed files with 884 additions and 0 deletions

View File

@@ -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);
}
}

View File

@@ -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);
}

View File

@@ -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;
}

View File

@@ -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> {
}

View File

@@ -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>

View File

@@ -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;
}

View File

@@ -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> {
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -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);
}

View File

@@ -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;
}

View File

@@ -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> {
}

View File

@@ -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>

View File

@@ -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;
}

View File

@@ -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> {
}

View File

@@ -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);
}
}

View File

@@ -48,4 +48,31 @@ public interface SlitterService {
* @return
*/
JSONObject mesSlittingMachineSendMaterial(JSONObject param);
/**
* 分切子卷获取LMSAGV废箔称重重量
* @param param "ResourceName": "设备编码"
* @return
* {
* "RTOAL": 1,
* "RTMSG": "操作成功!",
* "RTYPE": "S",
* "RTDAT": [
* {
* "ResourceName": "设备号",
* "Weight": "差异重量",
* “WeighDate”"称重时间"
* }
* ]
* }
*/
JSONObject mesGetWeighingOfWasteFoil(JSONObject param);
/**
* 分切子卷获取LMSAGV废箔称重重量MES提交废箔成功
* @param param
* @return
*/
JSONObject mesGetFinishWeighingOfWasteFoil(JSONObject param);
}

View File

@@ -11,6 +11,9 @@ 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;
@@ -28,6 +31,7 @@ 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;
@@ -71,6 +75,12 @@ public class SlitterServiceImpl implements SlitterService {
private RedissonClient redissonClient;
@Autowired
private TrussCallShaftCacheTask trussCallShaftCacheTask;
@Autowired
private IBstIvtScaleboundService scaleBoundService;
@Autowired
private IBstIvtScalehistoryService scaleHistoryService;
@Autowired
private WmsToAcsService wmsToAcsService;
@Override
public JSONObject acsRequestShaftLoadTube(JSONObject param) {
@@ -476,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;
}
}