add:增加手持装箱接口
This commit is contained in:
@@ -1,24 +1,25 @@
|
||||
package org.nl.b_lms.pdm.subpackagerelation.controller;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.Map;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.b_lms.pdm.subpackagerelation.dao.PdmBiSubpackagerelation;
|
||||
import org.nl.common.TableDataInfo;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.b_lms.pdm.subpackagerelation.dao.PdmBiSubpackagerelation;
|
||||
import org.nl.b_lms.pdm.subpackagerelation.service.IpdmBiSubpackagerelationService;
|
||||
import org.nl.common.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.redisson.api.RLock;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.nl.b_lms.pdm.subpackagerelation.service.IpdmBiSubpackagerelationService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
||||
/**
|
||||
@@ -33,6 +34,8 @@ import org.nl.b_lms.pdm.subpackagerelation.service.IpdmBiSubpackagerelationServi
|
||||
@Slf4j
|
||||
public class PdmBiSubpackagerelationController {
|
||||
|
||||
@Resource
|
||||
private RedissonClient redissonClient;
|
||||
|
||||
@Resource
|
||||
private IpdmBiSubpackagerelationService pdmBiSubpackagerelationService;
|
||||
@@ -52,6 +55,7 @@ public class PdmBiSubpackagerelationController {
|
||||
|
||||
|
||||
@GetMapping("/queryBoxSpec")
|
||||
@SaIgnore
|
||||
@Log("查询待检区木箱规格")
|
||||
public ResponseEntity<Object> queryBoxSpec(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(pdmBiSubpackagerelationService.queryBoxSpec(whereJson, page), HttpStatus.OK);
|
||||
@@ -117,7 +121,22 @@ public class PdmBiSubpackagerelationController {
|
||||
@Log("子卷装箱")
|
||||
//@SaCheckPermission("@el.check(updateEntityList)")
|
||||
public ResponseEntity<Object> updateEntityList(@RequestBody JSONObject whereJson) {
|
||||
pdmBiSubpackagerelationService.updateEntityList(whereJson);
|
||||
RLock lock = redissonClient.getLock("updateEntityList");
|
||||
boolean tryLock = false;
|
||||
try {
|
||||
tryLock = lock.tryLock(0, TimeUnit.SECONDS);
|
||||
if (tryLock) {
|
||||
pdmBiSubpackagerelationService.updateEntityList(whereJson);
|
||||
} else {
|
||||
log.info("子卷装箱操作正在执行被锁住。");
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
} finally {
|
||||
if (tryLock) {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.nl.b_lms.pdm.subpackagerelation.dao.PdmBiSubpackagerelation;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.nl.b_lms.pdm.subpackagerelation.dto.PdmBiSubpackagerelationDto;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
|
||||
|
||||
@@ -28,6 +29,6 @@ public interface PdmBiSubpackagerelationMapper extends BaseMapper<PdmBiSubpackag
|
||||
@Param("status") String status);
|
||||
|
||||
|
||||
List<PdmBiSubpackagerelation> queryContainerNameBySaleOrder( @Param("sale_order_name") String sale_order_name,@Param("container_name") String container_name);
|
||||
List<PdmBiSubpackagerelationDto> queryContainerNameBySaleOrder(@Param("sale_order_name") String sale_order_name, @Param("container_name") String container_name);
|
||||
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
ORDER BY
|
||||
MAX(create_time) DESC
|
||||
</select>
|
||||
<select id="queryContainerNameBySaleOrder" resultType="org.nl.b_lms.pdm.subpackagerelation.dao.PdmBiSubpackagerelation">
|
||||
<select id="queryContainerNameBySaleOrder" resultType="org.nl.b_lms.pdm.subpackagerelation.dto.PdmBiSubpackagerelationDto">
|
||||
SELECT a.*,
|
||||
b.*,
|
||||
(CASE
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package org.nl.b_lms.pdm.subpackagerelation.dto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.*;
|
||||
import lombok.Data;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
|
||||
/**
|
||||
@@ -35,10 +35,7 @@ public class PdmBiSubpackagerelationDto implements Serializable {
|
||||
* 木箱自身重量
|
||||
*/
|
||||
private BigDecimal box_weight;
|
||||
/**
|
||||
* 保质期
|
||||
*/
|
||||
private String quality_guaran_period;
|
||||
|
||||
/**
|
||||
* 销售订单及行号
|
||||
*/
|
||||
@@ -51,90 +48,16 @@ public class PdmBiSubpackagerelationDto implements Serializable {
|
||||
* 客户名称
|
||||
*/
|
||||
private String customer_description;
|
||||
/**
|
||||
* 产品编码
|
||||
*/
|
||||
private String product_name;
|
||||
/**
|
||||
* 产品描述
|
||||
*/
|
||||
private String product_description;
|
||||
/**
|
||||
* 入库日期
|
||||
*/
|
||||
private String date_of_FG_inbound;
|
||||
|
||||
/**
|
||||
* 子卷号
|
||||
*/
|
||||
private String container_name;
|
||||
/**
|
||||
* 产品规格(幅宽)
|
||||
*/
|
||||
private String width;
|
||||
/**
|
||||
* 产品厚度
|
||||
*/
|
||||
private String thickness;
|
||||
/**
|
||||
* 单位面积质量
|
||||
*/
|
||||
private BigDecimal mass_per_unit_area;
|
||||
/**
|
||||
* 净重
|
||||
*/
|
||||
private BigDecimal net_weight;
|
||||
/**
|
||||
* 长度
|
||||
*/
|
||||
private BigDecimal length;
|
||||
/**
|
||||
* 制造完成日期
|
||||
*/
|
||||
private String date_of_production;
|
||||
/**
|
||||
* 计划外分切的子卷
|
||||
*/
|
||||
private String is_un_plan_production;
|
||||
/**
|
||||
* 子卷的物性值1
|
||||
*/
|
||||
private String un_plan_product_property1;
|
||||
/**
|
||||
* 子卷的物性值2
|
||||
*/
|
||||
private String un_plan_product_property2;
|
||||
/**
|
||||
* 子卷的物性值3
|
||||
*/
|
||||
private String un_plan_product_property3;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private Long create_id;
|
||||
/**
|
||||
* 创建人姓名
|
||||
*/
|
||||
private String create_name;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String create_time;
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private String status;
|
||||
/**
|
||||
* 是否需要重打外包装标签
|
||||
*/
|
||||
private String isRePrintPackageBoxLabel;
|
||||
/**
|
||||
* 是否需要拆包重打子卷标签
|
||||
*/
|
||||
private String isUnPackBox;
|
||||
|
||||
/**
|
||||
* 木箱料号
|
||||
*/
|
||||
@@ -143,66 +66,24 @@ public class PdmBiSubpackagerelationDto implements Serializable {
|
||||
* SAP批次
|
||||
*/
|
||||
private String sap_pcsn;
|
||||
|
||||
|
||||
/**
|
||||
* 交货单号
|
||||
* 木箱组
|
||||
*/
|
||||
private String vbeln;
|
||||
private String box_group;
|
||||
/**
|
||||
* 交货单行号
|
||||
* 子卷规格
|
||||
*/
|
||||
private String posnr;
|
||||
private String paper_tube_description;
|
||||
/**
|
||||
* 木箱长度
|
||||
* 纸管重量
|
||||
*/
|
||||
private String box_length;
|
||||
private String paper_weight;
|
||||
/**
|
||||
* 木箱宽度
|
||||
* 子卷重量
|
||||
*/
|
||||
private String box_width;
|
||||
/**
|
||||
* 木箱高度
|
||||
*/
|
||||
private String box_high;
|
||||
/**
|
||||
* 销售订单描述
|
||||
*/
|
||||
private String sale_order_description;
|
||||
/**
|
||||
* 客户要求规格幅宽
|
||||
*/
|
||||
private String width_standard;
|
||||
/**
|
||||
* 物料标准厚度
|
||||
*/
|
||||
private String thickness_request;
|
||||
/**
|
||||
* 实际木箱自身重量
|
||||
*/
|
||||
private BigDecimal real_weight;
|
||||
/**
|
||||
* 包装关系类型
|
||||
*/
|
||||
private String sub_type;
|
||||
/**
|
||||
* 客户需求抗拉下限
|
||||
*/
|
||||
private String demand_limit;
|
||||
/**
|
||||
* 内控标准抗拉下限
|
||||
*/
|
||||
private String standard_limit;
|
||||
/**
|
||||
* 生产实际抗拉值
|
||||
*/
|
||||
private String actual_value;
|
||||
/**
|
||||
* 解绑删除标识
|
||||
*/
|
||||
private String need_delete;
|
||||
/**
|
||||
* 储存地点
|
||||
*/
|
||||
private String ext_code;
|
||||
private String weight;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.b_lms.pdm.subpackagerelation.dao.PdmBiSubpackagerelation;
|
||||
import org.nl.b_lms.pdm.subpackagerelation.dto.PdmBiSubpackagerelationDto;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
@@ -58,7 +59,7 @@ public interface IpdmBiSubpackagerelationService extends IService<PdmBiSubpackag
|
||||
* @param whereJson 查询条件
|
||||
* @return List<PdmBiSubpackagerelation>
|
||||
*/
|
||||
List<PdmBiSubpackagerelation> queryContainerNameBySaleOrder(Map whereJson);
|
||||
List<PdmBiSubpackagerelationDto> queryContainerNameBySaleOrder(Map whereJson);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,6 +25,7 @@ import org.nl.b_lms.pdm.info.dao.PdmBiOrderbominfo;
|
||||
import org.nl.b_lms.pdm.info.service.IPdmBiOrderbominfoService;
|
||||
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.dto.PdmBiSubpackagerelationDto;
|
||||
import org.nl.b_lms.pdm.subpackagerelation.service.IpdmBiSubpackagerelationService;
|
||||
import org.nl.b_lms.sch.point.dao.BstIvtPackageinfoivt;
|
||||
import org.nl.b_lms.sch.point.dao.mapper.BstIvtPackageinfoivtMapper;
|
||||
@@ -189,8 +190,8 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
||||
* @param whereJson 查询条件
|
||||
*/
|
||||
@Override
|
||||
public List<PdmBiSubpackagerelation> queryContainerNameBySaleOrder(Map whereJson) {
|
||||
List<PdmBiSubpackagerelation> pdmBiSubpackagerelationList;
|
||||
public List<PdmBiSubpackagerelationDto> queryContainerNameBySaleOrder(Map whereJson) {
|
||||
List<PdmBiSubpackagerelationDto> pdmBiSubpackagerelationList;
|
||||
//请求来源
|
||||
if (!whereJson.containsKey("type")) {
|
||||
whereJson.put("type", PackageInfoIvtEnum.REQUEST_SOURCE.code("PC"));
|
||||
@@ -210,7 +211,7 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
||||
}
|
||||
Map<String, Long> countByGroup = pdmBiSubpackagerelationList.stream()
|
||||
.filter(item -> item.getBox_group() != null)
|
||||
.collect(Collectors.groupingBy(PdmBiSubpackagerelation::getBox_group, Collectors.counting()));
|
||||
.collect(Collectors.groupingBy(PdmBiSubpackagerelationDto::getBox_group, Collectors.counting()));
|
||||
pdmBiSubpackagerelationList.forEach(r -> {
|
||||
//获取子卷长度
|
||||
// int containerLength = getMaxNum(null, r.getPaper_tube_description());
|
||||
@@ -271,7 +272,7 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
||||
throw new BadRequestException("无选中子卷信息");
|
||||
}
|
||||
//检查是否存在已分配规格的子卷号
|
||||
List<PdmBiSubpackagerelation> isOutBox = packagerelationList.stream().filter(r -> r.getStatus().equals("0")).collect(Collectors.toList());
|
||||
List<PdmBiSubpackagerelation> isOutBox = packagerelationList.stream().filter(r -> !r.getStatus().equals("99")).collect(Collectors.toList());
|
||||
if (isOutBox.size() > 0) {
|
||||
throw new BadRequestException("标记为黄色的子卷号为已分配且对应的木箱已出库,请重新选择未分配木箱规格的子卷");
|
||||
}
|
||||
@@ -307,7 +308,7 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
||||
.collect(Collectors.toSet());
|
||||
List<PdmBiSlittingproductionplan> planList = iPdmBiSlittingproductionplanService.list(new LambdaQueryWrapper<PdmBiSlittingproductionplan>().in(PdmBiSlittingproductionplan::getContainer_name, containerNameList));
|
||||
if (CollectionUtils.isEmpty(planList)) {
|
||||
throw new BadRequestException("需要装箱的子卷号不存在分切计划");
|
||||
throw new BadRequestException("存在查询不到分切计划的子卷号");
|
||||
}
|
||||
BigDecimal totalWeight;
|
||||
totalWeight = planList.stream()
|
||||
@@ -319,7 +320,7 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
||||
if (totalWeight.compareTo(new BigDecimal(0)) == 0) {
|
||||
throw new BadRequestException("分切计划的子卷重量不能为0");
|
||||
}
|
||||
outBox(workIdList, containerNameList, deviceCode, maxBoxGroup, whereJson.getString("checked"), totalWeight);
|
||||
outBox(workIdList, containerNameList, deviceCode, maxBoxGroup,whereJson,totalWeight);
|
||||
} catch (Exception e) {
|
||||
throw new BadRequestException(e.getMessage());
|
||||
}
|
||||
@@ -374,11 +375,11 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
||||
/**
|
||||
* 空木箱出库
|
||||
*/
|
||||
private void outBox(List<String> workIdList, Set<String> containerNameList, String deviceCode, Integer maxBoxGroup, String boxType, BigDecimal totalWeight) {
|
||||
private void outBox(List<String> workIdList, Set<String> containerNameList, String deviceCode, Integer maxBoxGroup, JSONObject whereJson, BigDecimal totalWeight) {
|
||||
JSONObject boxInfo = new JSONObject();
|
||||
//确定装箱区终点
|
||||
boxInfo.put("device_code", deviceCode);
|
||||
boxInfo.put("material_code", boxType);
|
||||
boxInfo.put("material_code",whereJson.getString("checked"));
|
||||
boxInfo.put("num", workIdList.size());
|
||||
String boxSn = outBoxManageService.outBox(boxInfo);
|
||||
BstIvtBoxinfo boxDao = iBstIvtBoxinfoService.getOne(
|
||||
@@ -397,13 +398,11 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
||||
if (totalWeight.compareTo(new BigDecimal(0)) == 0) {
|
||||
throw new BadRequestException("理论毛重不能为0");
|
||||
}
|
||||
StopWatch stopWatch1 = new StopWatch();
|
||||
stopWatch1.start();
|
||||
//更新及子卷包装状态已分配规格及木箱规格组
|
||||
String weightTotal = totalWeight.toString();
|
||||
CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
updateBoxGroup(maxBoxGroup, workIdList, boxSn, boxType, weightTotal);
|
||||
updateBoxGroup(maxBoxGroup, workIdList, boxSn, whereJson.getString("checked"), weightTotal);
|
||||
} catch (Exception e) {
|
||||
log.error("子卷装箱异常,更新子卷包装关系异常:" + e);
|
||||
}
|
||||
@@ -411,7 +410,7 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
||||
//给MES传输子卷包装关系
|
||||
CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
transferBoxPackageToMes(true, null, containerNameList, boxSn, weightTotal);
|
||||
transferBoxPackageToMes(false, whereJson, containerNameList, boxSn, weightTotal);
|
||||
} catch (Exception e) {
|
||||
log.error("子卷装箱异常,给MES传输子卷包装关系异常:" + e);
|
||||
}
|
||||
@@ -424,6 +423,8 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
||||
log.error("子卷装箱异常,待检区->装箱区agv确定起点任务创建异常:" + e);
|
||||
}
|
||||
}, pool);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user