add:捆扎任务
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
package org.nl.b_lms.sch.point.dao.mapper;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.nl.b_lms.sch.point.dao.SchBasePoint;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* {@code @Description:} 点位基础表(SchBasePoint)数据持久层
|
||||
* {@code @Author:} gbx
|
||||
@@ -11,5 +14,9 @@ import org.nl.b_lms.sch.point.dao.SchBasePoint;
|
||||
*/
|
||||
public interface SchBasePointMapper extends BaseMapper<SchBasePoint> {
|
||||
|
||||
|
||||
/**
|
||||
* 获取捆扎区域的点位木箱信息
|
||||
* @return 点位木箱信息集合
|
||||
*/
|
||||
List<JSONObject> queryKZPoint();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
<?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.sch.point.dao.mapper.SchBasePointMapper">
|
||||
<select id="queryKZPoint" resultType="com.alibaba.fastjson.JSONObject">
|
||||
SELECT
|
||||
point.*,
|
||||
box.*,
|
||||
sub.sale_order_name
|
||||
FROM
|
||||
sch_base_point point
|
||||
LEFT JOIN bst_ivt_boxinfo box ON point.vehicle_code = box.box_no
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
MAX(sale_order_name) AS sale_order_name,
|
||||
package_box_sn
|
||||
FROM
|
||||
pdm_bi_subpackagerelation
|
||||
WHERE
|
||||
1 = 1
|
||||
group by package_box_sn
|
||||
) sub ON point.vehicle_code = sub.package_box_sn
|
||||
WHERE
|
||||
point.is_used = '1'
|
||||
AND point.is_delete = '0'
|
||||
AND point.region_code = 'BKZ01'
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,196 @@
|
||||
package org.nl.b_lms.sch.tasks;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import org.nl.b_lms.sch.point.dao.SchBasePoint;
|
||||
import org.nl.b_lms.sch.point.service.IschBasePointService;
|
||||
import org.nl.b_lms.storage_manage.database.service.IBstIvtBoxlashboundService;
|
||||
import org.nl.b_lms.storage_manage.database.service.dao.BstIvtBoxlashbound;
|
||||
import org.nl.b_lms.storage_manage.ios.enums.IOSEnum;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.wms.sch.AcsTaskDto;
|
||||
import org.nl.wms.sch.manage.AbstractAcsTask;
|
||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 二期捆扎任务类
|
||||
* Created by Lxy on 2024/1/19.
|
||||
*/
|
||||
public class TwoLashTask extends AbstractAcsTask {
|
||||
|
||||
/**
|
||||
* 处理类
|
||||
*/
|
||||
private final String THIS_CLASS = TwoLashTask.class.getName();
|
||||
|
||||
@Override
|
||||
public List<AcsTaskDto> addTask() {
|
||||
/*
|
||||
* 下发给ACS时需要特殊处理
|
||||
*/
|
||||
JSONArray arr = WQLObject.getWQLObject("SCH_BASE_Task").query("handle_class = '" + THIS_CLASS + "' and task_status = '" + TaskStatusEnum.START_AND_POINT.getCode() + "' and is_delete ='0'").getResultJSONArray(0);
|
||||
|
||||
ArrayList<AcsTaskDto> resultList = new ArrayList<>();
|
||||
for (int i = 0; i < arr.size(); i++) {
|
||||
JSONObject json = arr.getJSONObject(i);
|
||||
|
||||
char dtl_type = json.getString("task_type").charAt(json.getString("task_type").length() - 1);
|
||||
AcsTaskDto dto = AcsTaskDto.builder()
|
||||
.ext_task_id(json.getString("task_id"))
|
||||
.task_code(json.getString("task_code"))
|
||||
.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"))
|
||||
.priority(json.getString("priority"))
|
||||
.class_type(json.getString("task_type"))
|
||||
.dtl_type(String.valueOf(dtl_type))
|
||||
.remark(json.getString("remark"))
|
||||
.build();
|
||||
resultList.add(dto);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||
// 点位表
|
||||
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point");
|
||||
// 木箱绑定表
|
||||
WQLObject boxTab = WQLObject.getWQLObject("bst_ivt_boxlashbound");
|
||||
|
||||
// 更新任务的参数
|
||||
JSONObject map = new JSONObject();
|
||||
|
||||
/*
|
||||
* 1-执行中, 2-完成 ,0-acs取消
|
||||
*/
|
||||
// 执行中
|
||||
if (status.equals(TaskStatusEnum.EXECUTING.getCode())) {
|
||||
|
||||
map.put("task_status", TaskStatusEnum.EXECUTING.getCode());
|
||||
}
|
||||
|
||||
// 完成
|
||||
if (status.equals(TaskStatusEnum.FINISHED.getCode())) {
|
||||
|
||||
map.put("task_status", TaskStatusEnum.FINISHED.getCode());
|
||||
}
|
||||
|
||||
// 取消
|
||||
if (status.equals(IOSEnum.IS_NOTANDYES.code("否"))) {
|
||||
|
||||
if (taskObj.getIntValue("task_status") > Integer.valueOf(TaskStatusEnum.ISSUE.getCode())) {
|
||||
throw new BadRequestException("任务已执行不能取消");
|
||||
}
|
||||
|
||||
// 更新任务表删除字段
|
||||
map.put("is_delete", IOSEnum.IS_NOTANDYES.code("是"));
|
||||
|
||||
// 减去终点点位载具数量
|
||||
JSONObject pointDao = pointTab.query("point_code = '" + taskObj.getString("point_code2") + "'").uniqueResult(0);
|
||||
|
||||
pointDao.put("vehicle_qty", NumberUtil.sub(pointDao.getIntValue("vehicle_qty"),1));
|
||||
|
||||
if (pointDao.getIntValue("vehicle_qty") <= 0) {
|
||||
// 清空载具号
|
||||
pointDao.put("vehicle_code", "");
|
||||
pointDao.put("vehicle_qty",0);
|
||||
}
|
||||
pointTab.update(pointDao);
|
||||
|
||||
// 删除木箱绑定数据
|
||||
boxTab.delete("box_no = '"+taskObj.getString("vehicle_code")+"'");
|
||||
|
||||
}
|
||||
map.put("update_optid", SecurityUtils.getCurrentUserId());
|
||||
map.put("update_optname", SecurityUtils.getCurrentNickName());
|
||||
map.put("update_time", DateUtil.now());
|
||||
|
||||
WQLObject.getWQLObject("SCH_BASE_Task").update(map, "task_id = '" + taskObj.getString("task_id") + "'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void findStartPoint() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void findNextPoint() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public String createTask(JSONObject form) {
|
||||
|
||||
if (StrUtil.isBlank(form.getString("task_type"))) {
|
||||
throw new BadRequestException("业务类型不能为空!");
|
||||
}
|
||||
|
||||
if (StrUtil.isBlank(form.getString("start_device_code"))) {
|
||||
throw new BadRequestException("起点不能为空!");
|
||||
}
|
||||
|
||||
if (StrUtil.isBlank(form.getString("next_device_code"))) {
|
||||
throw new BadRequestException("终点不能为空!");
|
||||
}
|
||||
|
||||
if (StrUtil.isBlank(form.getString("vehicle_code"))) {
|
||||
throw new BadRequestException("托盘号不能为空!");
|
||||
}
|
||||
|
||||
if (StrUtil.isBlank(form.getString("is_auto_issue"))) {
|
||||
throw new BadRequestException("是否自动下发不能为空!");
|
||||
}
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
json.put("task_code", IdUtil.getSnowflake(1, 1).nextId());
|
||||
json.put("task_type", form.getString("task_type"));
|
||||
json.put("vehicle_code", form.getString("vehicle_code"));
|
||||
json.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
|
||||
json.put("point_code1", form.getString("start_device_code"));
|
||||
json.put("point_code2", form.getString("next_device_code"));
|
||||
json.put("is_auto_issue", form.getString("is_auto_issue"));
|
||||
json.put("handle_class", this.getClass().getName());
|
||||
json.put("create_id", SecurityUtils.getCurrentUserId());
|
||||
json.put("create_name", SecurityUtils.getCurrentUsername());
|
||||
json.put("create_time", DateUtil.now());
|
||||
json.put("priority", "1");
|
||||
json.put("acs_task_type", "7");
|
||||
|
||||
WQLObject.getWQLObject("SCH_BASE_Task").insert(json);
|
||||
return json.getString("task_id");
|
||||
}
|
||||
|
||||
@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());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancel(String task_id) {
|
||||
JSONObject taskObj = WQLObject.getWQLObject("SCH_BASE_Task").query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
this.updateTaskStatus(taskObj, IOSEnum.ACS_RESULT.code("取消"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.nl.b_lms.storage_manage.database.controller;
|
||||
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author author
|
||||
* @since 2024-02-06
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/bst-ivt-boxlashbound")
|
||||
public class BstIvtBoxlashboundController {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.nl.b_lms.storage_manage.database.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.b_lms.storage_manage.database.service.dao.BstIvtBoxlashbound;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author author
|
||||
* @since 2024-02-06
|
||||
*/
|
||||
public interface IBstIvtBoxlashboundService extends IService<BstIvtBoxlashbound> {
|
||||
|
||||
}
|
||||
@@ -67,6 +67,11 @@ public class BstIvtBoxinfo implements Serializable {
|
||||
*/
|
||||
private String box_high;
|
||||
|
||||
/*
|
||||
* 捆绑数量
|
||||
*/
|
||||
private String lash_num;
|
||||
|
||||
/*
|
||||
* 插入时间
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package org.nl.b_lms.storage_manage.database.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 lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author author
|
||||
* @since 2024-02-06
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("bst_ivt_boxlashbound")
|
||||
public class BstIvtBoxlashbound implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId
|
||||
private Long lash_id;
|
||||
|
||||
private Long bound_id;
|
||||
|
||||
private String box_no;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.nl.b_lms.storage_manage.database.service.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.nl.b_lms.storage_manage.database.service.dao.BstIvtBoxlashbound;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author author
|
||||
* @since 2024-02-06
|
||||
*/
|
||||
public interface BstIvtBoxlashboundMapper extends BaseMapper<BstIvtBoxlashbound> {
|
||||
|
||||
}
|
||||
@@ -1,6 +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.sch.point.dao.mapper.SchBasePointMapper">
|
||||
|
||||
<mapper namespace="org.nl.b_lms.storage_manage.database.service.dao.mapper.BstIvtBoxlashboundMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -34,6 +34,8 @@ public class BstIvtBoxinfoServiceImpl extends ServiceImpl<BstIvtBoxinfoMapper, B
|
||||
.insert_time(DateUtil.now())
|
||||
.build();
|
||||
|
||||
//TODO 根据木箱规格判断木箱的捆扎次数
|
||||
|
||||
// 截取子卷号
|
||||
String description = whereJson.getString("Description");
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package org.nl.b_lms.storage_manage.database.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.nl.b_lms.storage_manage.database.service.IBstIvtBoxlashboundService;
|
||||
import org.nl.b_lms.storage_manage.database.service.dao.BstIvtBoxlashbound;
|
||||
import org.nl.b_lms.storage_manage.database.service.dao.mapper.BstIvtBoxlashboundMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author author
|
||||
* @since 2024-02-06
|
||||
*/
|
||||
@Service
|
||||
public class BstIvtBoxlashboundServiceImpl extends ServiceImpl<BstIvtBoxlashboundMapper, BstIvtBoxlashbound> implements IBstIvtBoxlashboundService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,196 @@
|
||||
package org.nl.b_lms.storage_manage.ios.service.iostorInv.util.impl;
|
||||
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.b_lms.sch.point.dao.SchBasePoint;
|
||||
import org.nl.b_lms.sch.point.dao.mapper.SchBasePointMapper;
|
||||
import org.nl.b_lms.sch.point.service.IschBasePointService;
|
||||
import org.nl.b_lms.sch.tasks.TwoLashTask;
|
||||
import org.nl.b_lms.storage_manage.database.service.IBstIvtBoxinfoService;
|
||||
import org.nl.b_lms.storage_manage.database.service.IBstIvtBoxlashboundService;
|
||||
import org.nl.b_lms.storage_manage.database.service.dao.BstIvtBoxinfo;
|
||||
import org.nl.b_lms.storage_manage.database.service.dao.BstIvtBoxlashbound;
|
||||
import org.nl.b_lms.storage_manage.ios.enums.IOSEnum;
|
||||
import org.nl.b_lms.storage_manage.ios.service.iostorInv.util.service.LashManageService;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 捆扎业务处理 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-11-10
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class LashManageServiceImpl implements LashManageService {
|
||||
|
||||
/**
|
||||
* 木箱信息服务
|
||||
*/
|
||||
@Autowired
|
||||
private IBstIvtBoxinfoService iBstIvtBoxinfoService;
|
||||
|
||||
/**
|
||||
* 点位服务
|
||||
*/
|
||||
@Autowired
|
||||
private IschBasePointService ischBasePointService;
|
||||
|
||||
/**
|
||||
* 点位mapper服务
|
||||
*/
|
||||
@Autowired
|
||||
private SchBasePointMapper schBasePointMapper;
|
||||
|
||||
/**
|
||||
* 木箱捆扎绑定服务
|
||||
*/
|
||||
@Autowired
|
||||
private IBstIvtBoxlashboundService iBstIvtBoxlashboundService;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void createLashTask(JSONObject whereJson) {
|
||||
/*
|
||||
* 1.判断此木箱是否需要堆叠
|
||||
* 2.插入木箱捆扎绑定表
|
||||
* 3.生成任务
|
||||
*/
|
||||
// 查询木箱信息
|
||||
BstIvtBoxinfo boxDao = iBstIvtBoxinfoService.getOne(
|
||||
new QueryWrapper<BstIvtBoxinfo>().lambda()
|
||||
.eq(BstIvtBoxinfo::getBox_no, whereJson.getString("box_no"))
|
||||
);
|
||||
|
||||
if (ObjectUtil.isEmpty(boxDao)) {
|
||||
throw new BadRequestException("没有此木箱信息:"+whereJson.getString("box_no"));
|
||||
}
|
||||
|
||||
JSONObject jsonSub = WQLObject.getWQLObject("pdm_bi_subpackagerelation")
|
||||
.query("package_box_sn = '" + boxDao.getBox_no() + "'")
|
||||
.uniqueResult(0);
|
||||
|
||||
/*
|
||||
* 查看点位是否为空:
|
||||
* 为空记当前载具号,载具数量为1,
|
||||
* 不为空,加载具数量,当点位载具数量与木箱信息捆扎数量相同时下发捆绑
|
||||
*/
|
||||
// 查询捆扎的两个点位及木箱信息
|
||||
List<JSONObject> pointDaoList = schBasePointMapper.queryKZPoint();
|
||||
|
||||
if (ObjectUtil.isEmpty(pointDaoList)) {
|
||||
throw new BadRequestException("点位不存在,或未启用!");
|
||||
}
|
||||
|
||||
// 是否要移动至捆扎位
|
||||
String is_move = IOSEnum.IS_NOTANDYES.code("否");
|
||||
// 桁架任务终点
|
||||
String end_point;
|
||||
|
||||
// 判断是否有相同订单号、木箱规格的木箱
|
||||
List<JSONObject> likeBoxList = pointDaoList.stream()
|
||||
.filter(row -> ObjectUtil.isNotEmpty(row.getString("box_length")) &&
|
||||
ObjectUtil.isNotEmpty(row.getString("box_width")) &&
|
||||
ObjectUtil.isNotEmpty(row.getString("box_high")) &&
|
||||
ObjectUtil.isNotEmpty(row.getString("sale_order_name"))
|
||||
|
||||
)
|
||||
.filter(row -> row.getString("box_length").equals(boxDao.getBox_length()) &&
|
||||
row.getString("box_width").equals(boxDao.getBox_width()) &&
|
||||
row.getString("box_high").equals(boxDao.getBox_high()) &&
|
||||
row.getString("sale_order_name").equals(jsonSub.getString("sale_order_name"))
|
||||
)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (ObjectUtil.isNotEmpty(likeBoxList)) {
|
||||
// 加载具数量
|
||||
JSONObject jsonPoint = likeBoxList.get(0);
|
||||
|
||||
jsonPoint.put("vehicle_qty", NumberUtil.add(jsonPoint.getBigDecimal("vehicle_qty"),1));
|
||||
|
||||
if (jsonPoint.getIntValue("vehicle_qty") == Integer.parseInt(boxDao.getLash_num())) {
|
||||
// 相同清空载具以及数量
|
||||
jsonPoint.put("vehicle_qty",0);
|
||||
jsonPoint.put("vehicle_code","");
|
||||
is_move = IOSEnum.IS_NOTANDYES.code("是");
|
||||
}
|
||||
|
||||
end_point = jsonPoint.getString("point_code");
|
||||
ischBasePointService.updateById(JSON.parseObject(jsonPoint.toString(), SchBasePoint.class));
|
||||
|
||||
// 查询此点位绑定木箱表
|
||||
BstIvtBoxlashbound boundDao = iBstIvtBoxlashboundService.getOne(
|
||||
new QueryWrapper<BstIvtBoxlashbound>().lambda()
|
||||
.eq(BstIvtBoxlashbound::getBox_no, jsonPoint.getString("box_no"))
|
||||
);
|
||||
/*
|
||||
* 插入绑定木箱表
|
||||
*/
|
||||
BstIvtBoxlashbound insertBound = BstIvtBoxlashbound.builder()
|
||||
.lash_id(IdUtil.getLongId())
|
||||
.bound_id(boundDao.getBound_id())
|
||||
.box_no(boxDao.getBox_no())
|
||||
.build();
|
||||
iBstIvtBoxlashboundService.save(insertBound);
|
||||
|
||||
} else {
|
||||
// 判断是否有载具
|
||||
List<JSONObject> empPointList = pointDaoList.stream()
|
||||
.filter(row -> ObjectUtil.isEmpty(row.getString("vehicle_code")))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (ObjectUtil.isNotEmpty(empPointList)) {
|
||||
// 有空位
|
||||
JSONObject jsonPoint = empPointList.get(0);
|
||||
|
||||
// 加载具数量、更新载具号
|
||||
jsonPoint.put("vehicle_qty", NumberUtil.add(jsonPoint.getBigDecimal("vehicle_qty"),1));
|
||||
jsonPoint.put("vehicle_code",boxDao.getBox_no());
|
||||
|
||||
end_point = jsonPoint.getString("point_code");
|
||||
ischBasePointService.updateById(JSON.parseObject(jsonPoint.toString(), SchBasePoint.class));
|
||||
/*
|
||||
* 插入绑定木箱表
|
||||
*/
|
||||
BstIvtBoxlashbound insertBound = BstIvtBoxlashbound.builder()
|
||||
.lash_id(IdUtil.getLongId())
|
||||
.bound_id(IdUtil.getLongId())
|
||||
.box_no(boxDao.getBox_no())
|
||||
.build();
|
||||
iBstIvtBoxlashboundService.save(insertBound);
|
||||
} else {
|
||||
// 没有空位
|
||||
throw new BadRequestException("没有空位!");
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 生成任务并下发
|
||||
*/
|
||||
JSONObject jsonTaskParam = new JSONObject();
|
||||
jsonTaskParam.put("task_type", "010504");
|
||||
jsonTaskParam.put("start_device_code", whereJson.getString("device_code"));
|
||||
jsonTaskParam.put("next_device_code", end_point);
|
||||
jsonTaskParam.put("vehicle_code", whereJson.getString("box_no"));
|
||||
jsonTaskParam.put("is_auto_issue", is_move);
|
||||
|
||||
TwoLashTask taskBean = new TwoLashTask();
|
||||
taskBean.createTask(jsonTaskParam);
|
||||
taskBean.immediateNotifyAcs(null);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package org.nl.b_lms.storage_manage.ios.service.iostorInv.util.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 捆扎业务处理 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-11-16
|
||||
*/
|
||||
public interface LashManageService {
|
||||
|
||||
/**
|
||||
* 创建桁架任务
|
||||
* @param whereJson {
|
||||
* device_code:起点
|
||||
* box_no: 箱号
|
||||
*
|
||||
* }
|
||||
*/
|
||||
void createLashTask(JSONObject whereJson);
|
||||
|
||||
}
|
||||
Binary file not shown.
@@ -22,7 +22,8 @@ public enum RegionTypeEnum {
|
||||
PD01("19", "盘点区", "1645705331612979200"),
|
||||
TWO_ZZ01("20", "二期暂存区", ""),
|
||||
TWO_TTP01("21", "二期空托盘区", "1750471797729529856"),
|
||||
TWO_MX01("22", "二期木箱区", "1752254266938101760");
|
||||
TWO_MX01("22", "二期木箱区", "1752254266938101760"),
|
||||
TWO_KZ01("23", "二期捆扎区", "1754774130626007040");
|
||||
|
||||
private String name;
|
||||
private String code;
|
||||
|
||||
@@ -3,12 +3,12 @@ package org.nl.wms.st.outbill.rest;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.b_lms.sch.point.service.IschBasePointService;
|
||||
import org.nl.b_lms.storage_manage.database.service.IBstIvtBoxinfoService;
|
||||
import org.nl.b_lms.storage_manage.ios.enums.IOSEnum;
|
||||
import org.nl.b_lms.storage_manage.ios.service.iostorInv.IStIvtIostorinvOutService;
|
||||
import org.nl.b_lms.storage_manage.ios.service.iostorInv.util.impl.InBoxManageServiceImpl;
|
||||
import org.nl.b_lms.storage_manage.ios.service.iostorInv.util.impl.InVehicleManageServiceImpl;
|
||||
import org.nl.b_lms.storage_manage.ios.service.iostorInv.util.impl.OutBoxManageServiceImpl;
|
||||
import org.nl.b_lms.storage_manage.ios.service.iostorInv.util.impl.OutVehicleManageServiceImpl;
|
||||
import org.nl.b_lms.storage_manage.ios.service.iostorInv.util.impl.*;
|
||||
import org.nl.b_lms.storage_manage.ios.service.iostorInv.util.service.LashManageService;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.nl.wms.st.inbill.service.CheckOutBillService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -38,6 +38,8 @@ public class CheckOutBillController {
|
||||
@Autowired
|
||||
private IStIvtIostorinvOutService iStIvtIostorinvOutService;
|
||||
|
||||
private final LashManageService lashManageService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询出库单")
|
||||
|
||||
@@ -393,4 +395,11 @@ public class CheckOutBillController {
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/testBoxLash")
|
||||
@Log("木箱捆扎测试")
|
||||
public ResponseEntity<Object> testBoxLash(@RequestBody JSONObject whereJson) {
|
||||
lashManageService.createLashTask(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user