add:空木箱库
This commit is contained in:
@@ -2,9 +2,16 @@ package org.nl.b_lms.bst.ivt.boxstack.controller;
|
|||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.nl.b_lms.bst.ivt.boxstack.service.IBstIvtBoxStockUpPlanService;
|
import org.nl.b_lms.bst.ivt.boxstack.service.IBstIvtBoxStockUpPlanService;
|
||||||
|
import org.nl.b_lms.bst.ivt.boxstack.service.dto.BstIvtBoxStockUpPlanDto;
|
||||||
|
import org.nl.b_lms.bst.ivt.boxstack.service.dto.BstIvtBoxStockUpPlanQuery;
|
||||||
|
import org.nl.common.domain.query.PageQuery;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description TODO
|
* @Description TODO
|
||||||
@@ -16,4 +23,35 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
@RequestMapping("/api/bstIvtBoxStockUpPlan")
|
@RequestMapping("/api/bstIvtBoxStockUpPlan")
|
||||||
public class BstIvtBoxStockUpPlanController {
|
public class BstIvtBoxStockUpPlanController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IBstIvtBoxStockUpPlanService boxStockUpPlanService;
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
public ResponseEntity<Object> query(BstIvtBoxStockUpPlanQuery whereJson, PageQuery page) {
|
||||||
|
return new ResponseEntity<>(boxStockUpPlanService.queryAll(whereJson, page), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
public ResponseEntity<Object> create(@Validated @RequestBody BstIvtBoxStockUpPlanDto entity) {
|
||||||
|
boxStockUpPlanService.create(entity);
|
||||||
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/finish")
|
||||||
|
public ResponseEntity<Object> finish(@Validated @RequestBody BstIvtBoxStockUpPlanDto entity) {
|
||||||
|
boxStockUpPlanService.finish(entity);
|
||||||
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping
|
||||||
|
public ResponseEntity<Object> update(@Validated @RequestBody BstIvtBoxStockUpPlanDto entity) {
|
||||||
|
boxStockUpPlanService.update(entity);
|
||||||
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping
|
||||||
|
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) {
|
||||||
|
boxStockUpPlanService.deleteAll(ids);
|
||||||
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -21,6 +21,8 @@ public enum BoxStackEnum {
|
|||||||
TASK_TYPE(MapOf.of("木箱入库", "010702", "木箱出库", "010704", "木箱移库", "010705","木箱缓存区到对接位", "010706","木箱行架", "010706","木箱对接位到缓存区", "010707")),
|
TASK_TYPE(MapOf.of("木箱入库", "010702", "木箱出库", "010704", "木箱移库", "010705","木箱缓存区到对接位", "010706","木箱行架", "010706","木箱对接位到缓存区", "010707")),
|
||||||
// 木箱出入库任务二次分配类型
|
// 木箱出入库任务二次分配类型
|
||||||
AGV_ACTION_TYPE(MapOf.of("普通任务", "1", "取货二次分配", "2", "放货二次分配", "3", "取放货二次分配", "4")),
|
AGV_ACTION_TYPE(MapOf.of("普通任务", "1", "取货二次分配", "2", "放货二次分配", "3", "取放货二次分配", "4")),
|
||||||
|
//AGV取放货完成
|
||||||
|
TASK_ACTION_TYPE(MapOf.of("请求取货", "1", "取货完成", "2", "请求放货", "3", "放货完成", "4")),
|
||||||
//木箱库二次分配等待点
|
//木箱库二次分配等待点
|
||||||
AGV_WAIT_POINT(MapOf.of("木箱等待点1", "MX_WAIT_1", "木箱等待点2", "MX_WAIT_2")),
|
AGV_WAIT_POINT(MapOf.of("木箱等待点1", "MX_WAIT_1", "木箱等待点2", "MX_WAIT_2")),
|
||||||
//木箱库ACS任务类型
|
//木箱库ACS任务类型
|
||||||
@@ -34,7 +36,8 @@ public enum BoxStackEnum {
|
|||||||
//备货计划状态
|
//备货计划状态
|
||||||
STOCK_UP_STATUS(MapOf.of("未开始", "1", "执行中", "2", "完成", "3")),
|
STOCK_UP_STATUS(MapOf.of("未开始", "1", "执行中", "2", "完成", "3")),
|
||||||
//木箱库区域
|
//木箱库区域
|
||||||
POINT_STATUS(MapOf.of("密集区", "1", "零散区", "2", "缓存区", "3", "对接区", "4", "等待区", "5"));
|
|
||||||
|
POINT_STATUS(MapOf.of("密集区", "1", "零散区", "2", "缓存区", "3", "等待区", "4"));
|
||||||
|
|
||||||
|
|
||||||
private Map<String, String> code;
|
private Map<String, String> code;
|
||||||
|
|||||||
@@ -2,6 +2,11 @@ package org.nl.b_lms.bst.ivt.boxstack.service;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import org.nl.b_lms.bst.ivt.boxstack.service.dao.BstIvtBoxStockUpPlan;
|
import org.nl.b_lms.bst.ivt.boxstack.service.dao.BstIvtBoxStockUpPlan;
|
||||||
|
import org.nl.b_lms.bst.ivt.boxstack.service.dto.BstIvtBoxStockUpPlanDto;
|
||||||
|
import org.nl.b_lms.bst.ivt.boxstack.service.dto.BstIvtBoxStockUpPlanQuery;
|
||||||
|
import org.nl.common.domain.query.PageQuery;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description TODO
|
* @Description TODO
|
||||||
@@ -10,6 +15,40 @@ import org.nl.b_lms.bst.ivt.boxstack.service.dao.BstIvtBoxStockUpPlan;
|
|||||||
*/
|
*/
|
||||||
public interface IBstIvtBoxStockUpPlanService extends IService<BstIvtBoxStockUpPlan> {
|
public interface IBstIvtBoxStockUpPlanService extends IService<BstIvtBoxStockUpPlan> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询
|
||||||
|
*
|
||||||
|
* @param whereJson
|
||||||
|
* @param page
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Object queryAll(BstIvtBoxStockUpPlanQuery whereJson, PageQuery page);
|
||||||
|
|
||||||
// List<BstIvtBoxStockUpPlan> getByStackId(String stackId);
|
/**
|
||||||
|
* 创建
|
||||||
|
*
|
||||||
|
* @param entity
|
||||||
|
*/
|
||||||
|
void create(BstIvtBoxStockUpPlanDto entity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑
|
||||||
|
*
|
||||||
|
* @param entity /
|
||||||
|
*/
|
||||||
|
void update(BstIvtBoxStockUpPlanDto entity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*
|
||||||
|
* @param ids
|
||||||
|
*/
|
||||||
|
void deleteAll(Set<String> ids);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 完成
|
||||||
|
* @param entity
|
||||||
|
*/
|
||||||
|
void finish(BstIvtBoxStockUpPlanDto entity);
|
||||||
}
|
}
|
||||||
@@ -41,11 +41,6 @@ public class BstIvtBoxStockUpPlan implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Integer stock_up_num;
|
private Integer stock_up_num;
|
||||||
|
|
||||||
/**
|
|
||||||
* 备货日期 yyyy-MM-dd
|
|
||||||
*/
|
|
||||||
private String stock_plan_time;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否已经进行备货 1、未开始 2、执行中 3、完成
|
* 是否已经进行备货 1、未开始 2、执行中 3、完成
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,9 +1,16 @@
|
|||||||
package org.nl.b_lms.bst.ivt.boxstack.service.dao.mapper;
|
package org.nl.b_lms.bst.ivt.boxstack.service.dao.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.nl.b_lms.bst.ivt.boxstack.service.dao.BstIvtBoxStockUpPlan;
|
import org.nl.b_lms.bst.ivt.boxstack.service.dao.BstIvtBoxStockUpPlan;
|
||||||
|
import org.nl.b_lms.bst.ivt.boxstack.service.dto.BstIvtBoxStockUpPlanQuery;
|
||||||
|
import org.nl.common.domain.query.PageQuery;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
public interface BstIvtBoxStockUpPlanMapper extends BaseMapper<BstIvtBoxStockUpPlan> {
|
public interface BstIvtBoxStockUpPlanMapper extends BaseMapper<BstIvtBoxStockUpPlan> {
|
||||||
|
|
||||||
|
List<Map> pageQuery(@Param("query") BstIvtBoxStockUpPlanQuery whereJson, @Param("pageQuery") PageQuery pageQuery);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,4 +2,19 @@
|
|||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!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.boxstack.service.dao.mapper.BstIvtBoxStockUpPlanMapper">
|
<mapper namespace="org.nl.b_lms.bst.ivt.boxstack.service.dao.mapper.BstIvtBoxStockUpPlanMapper">
|
||||||
|
|
||||||
|
<select id="pageQuery" resultType="java.util.Map">
|
||||||
|
select * from bst_ivt_boxstockup_plan
|
||||||
|
<where>
|
||||||
|
<if test="query != null">
|
||||||
|
<if test="query.box_info != null and query.box_info != ''">
|
||||||
|
AND (box_spec LIKE CONCAT('%', #{query.box_info}, '%')
|
||||||
|
OR box_spec_name LIKE CONCAT('%', #{query.box_info}, '%'))
|
||||||
|
</if>
|
||||||
|
<if test="query.stock_plan_status != null and query.stock_plan_status != ''">
|
||||||
|
AND stock_plan_status = #{query.stock_plan_status}
|
||||||
|
</if>
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
bs.max_layer_count,
|
bs.max_layer_count,
|
||||||
bs.point_status,
|
bs.point_status,
|
||||||
bs.box_spec,
|
bs.box_spec,
|
||||||
|
bs.box_no,
|
||||||
bs.x,
|
bs.x,
|
||||||
bs.y,
|
bs.y,
|
||||||
bs.is_used,
|
bs.is_used,
|
||||||
@@ -37,6 +38,16 @@
|
|||||||
<if test="query.is_used != null">
|
<if test="query.is_used != null">
|
||||||
AND bs.is_used = #{query.is_used}
|
AND bs.is_used = #{query.is_used}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="query.isHasGoods != null">
|
||||||
|
<choose>
|
||||||
|
<when test="query.isHasGoods == true">
|
||||||
|
AND (bs.box_spec IS NOT NULL AND bs.box_spec != '')
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
AND (bs.box_spec IS NULL OR bs.box_spec = '')
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
</if>
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
ORDER BY bs.stack_code ASC
|
ORDER BY bs.stack_code ASC
|
||||||
|
|||||||
@@ -30,12 +30,7 @@ public class BstIvtBoxStockUpPlanDto implements Serializable {
|
|||||||
private Integer stock_up_num;
|
private Integer stock_up_num;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 备货日期 yyyy-MM-dd
|
*
|
||||||
*/
|
|
||||||
private String stock_plan_time;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否已经进行备货 0否 1是
|
|
||||||
*/
|
*/
|
||||||
private String stock_plan_status;
|
private String stock_plan_status;
|
||||||
|
|
||||||
|
|||||||
@@ -9,4 +9,6 @@ import lombok.Data;
|
|||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class BstIvtBoxStockUpPlanQuery {
|
public class BstIvtBoxStockUpPlanQuery {
|
||||||
|
private String box_info;
|
||||||
|
private String stock_plan_status;
|
||||||
}
|
}
|
||||||
@@ -30,4 +30,9 @@ public class BstIvtBoxstackQuery {
|
|||||||
* 是否弃用
|
* 是否弃用
|
||||||
*/
|
*/
|
||||||
private Boolean is_used;
|
private Boolean is_used;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否有货
|
||||||
|
*/
|
||||||
|
private Boolean isHasGoods;
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,29 @@
|
|||||||
package org.nl.b_lms.bst.ivt.boxstack.service.impl;
|
package org.nl.b_lms.bst.ivt.boxstack.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.github.pagehelper.Page;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.b_lms.bst.ivt.boxstack.enums.BoxStackEnum;
|
||||||
import org.nl.b_lms.bst.ivt.boxstack.service.IBstIvtBoxStockUpPlanService;
|
import org.nl.b_lms.bst.ivt.boxstack.service.IBstIvtBoxStockUpPlanService;
|
||||||
import org.nl.b_lms.bst.ivt.boxstack.service.dao.BstIvtBoxStockUpPlan;
|
import org.nl.b_lms.bst.ivt.boxstack.service.dao.BstIvtBoxStockUpPlan;
|
||||||
import org.nl.b_lms.bst.ivt.boxstack.service.dao.mapper.BstIvtBoxStockUpPlanMapper;
|
import org.nl.b_lms.bst.ivt.boxstack.service.dao.mapper.BstIvtBoxStockUpPlanMapper;
|
||||||
|
import org.nl.b_lms.bst.ivt.boxstack.service.dto.BstIvtBoxStockUpPlanDto;
|
||||||
|
import org.nl.b_lms.bst.ivt.boxstack.service.dto.BstIvtBoxStockUpPlanQuery;
|
||||||
|
import org.nl.common.TableDataInfo;
|
||||||
|
import org.nl.common.domain.query.PageQuery;
|
||||||
|
import org.nl.common.utils.IdUtil;
|
||||||
|
import org.nl.common.utils.SecurityUtils;
|
||||||
|
import org.nl.modules.common.exception.BadRequestException;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description TODO
|
* @Description TODO
|
||||||
@@ -16,9 +34,80 @@ import org.springframework.stereotype.Service;
|
|||||||
@Service
|
@Service
|
||||||
public class BstIvtBoxStockUpPlanServiceImpl extends ServiceImpl<BstIvtBoxStockUpPlanMapper, BstIvtBoxStockUpPlan> implements IBstIvtBoxStockUpPlanService {
|
public class BstIvtBoxStockUpPlanServiceImpl extends ServiceImpl<BstIvtBoxStockUpPlanMapper, BstIvtBoxStockUpPlan> implements IBstIvtBoxStockUpPlanService {
|
||||||
|
|
||||||
// @Override
|
@Resource
|
||||||
// public List<BstIvtBoxStockUpPlan> getByStackId(String stackId) {
|
private BstIvtBoxStockUpPlanMapper boxStockUpPlanMapper;
|
||||||
// return this.list(new LambdaQueryWrapper<BstIvtBoxStockUpPlan>().eq(BstIvtBoxStockUpPlan::getStack_id, stackId));
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object queryAll(BstIvtBoxStockUpPlanQuery whereJson, PageQuery pageQuery) {
|
||||||
|
Page<Object> page = PageHelper.startPage(pageQuery.getPage() + 1, pageQuery.getSize());
|
||||||
|
List<Map> list = boxStockUpPlanMapper.pageQuery(whereJson, pageQuery);
|
||||||
|
TableDataInfo<Map> build = TableDataInfo.build(list);
|
||||||
|
build.setTotalElements(page.getTotal());
|
||||||
|
return build;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void create(BstIvtBoxStockUpPlanDto entity) {
|
||||||
|
BstIvtBoxStockUpPlan boxStockUpPlan = new BstIvtBoxStockUpPlan();
|
||||||
|
boxStockUpPlan.setStockup_plan_id(IdUtil.getStringId());
|
||||||
|
boxStockUpPlan.setBox_spec(entity.getBox_spec());
|
||||||
|
boxStockUpPlan.setBox_spec_name(entity.getBox_spec_name());
|
||||||
|
boxStockUpPlan.setStock_up_num(entity.getStock_up_num());
|
||||||
|
boxStockUpPlan.setStock_plan_status(BoxStackEnum.STOCK_UP_STATUS.code("未开始"));
|
||||||
|
boxStockUpPlan.setCreated_id(SecurityUtils.getCurrentUserId());
|
||||||
|
boxStockUpPlan.setCreated_name(SecurityUtils.getCurrentUsername());
|
||||||
|
boxStockUpPlan.setCreated_time(DateUtil.now());
|
||||||
|
boxStockUpPlanMapper.insert(boxStockUpPlan);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void update(BstIvtBoxStockUpPlanDto entity) {
|
||||||
|
BstIvtBoxStockUpPlan stockUpPlan = this.getById(entity.getStockup_plan_id());
|
||||||
|
if (ObjectUtil.isNull(stockUpPlan)) {
|
||||||
|
throw new BadRequestException("备货计划不存在.");
|
||||||
|
}
|
||||||
|
if (!BoxStackEnum.STOCK_UP_STATUS.code("未开始").equals(stockUpPlan.getStock_plan_status())) {
|
||||||
|
throw new BadRequestException("备货计划已开始,不允许修改.");
|
||||||
|
}
|
||||||
|
stockUpPlan.setBox_spec(entity.getBox_spec());
|
||||||
|
stockUpPlan.setBox_spec_name(entity.getBox_spec_name());
|
||||||
|
stockUpPlan.setStock_up_num(entity.getStock_up_num());
|
||||||
|
stockUpPlan.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||||
|
stockUpPlan.setUpdate_name(SecurityUtils.getCurrentUsername());
|
||||||
|
stockUpPlan.setUpdate_time(DateUtil.now());
|
||||||
|
boxStockUpPlanMapper.updateById(stockUpPlan);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void deleteAll(Set<String> ids) {
|
||||||
|
ids.forEach(id -> {
|
||||||
|
BstIvtBoxStockUpPlan stockUpPlan = this.getById(id);
|
||||||
|
if (ObjectUtil.isNull(stockUpPlan)) {
|
||||||
|
throw new BadRequestException("备货计划不存在.");
|
||||||
|
}
|
||||||
|
if (!BoxStackEnum.STOCK_UP_STATUS.code("未开始").equals(stockUpPlan.getStock_plan_status())) {
|
||||||
|
throw new BadRequestException("备货计划已开始,不允许删除.");
|
||||||
|
}
|
||||||
|
boxStockUpPlanMapper.deleteById(id);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void finish(BstIvtBoxStockUpPlanDto entity) {
|
||||||
|
BstIvtBoxStockUpPlan stockUpPlan = this.getById(entity.getStockup_plan_id());
|
||||||
|
if (ObjectUtil.isNull(stockUpPlan)) {
|
||||||
|
throw new BadRequestException("备货计划不存在.");
|
||||||
|
}
|
||||||
|
if (BoxStackEnum.STOCK_UP_STATUS.code("完成").equals(stockUpPlan.getStock_plan_status())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
stockUpPlan.setStock_plan_status(BoxStackEnum.STOCK_UP_STATUS.code("完成"));
|
||||||
|
stockUpPlan.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||||
|
stockUpPlan.setUpdate_name(SecurityUtils.getCurrentUsername());
|
||||||
|
stockUpPlan.setUpdate_time(DateUtil.now());
|
||||||
|
boxStockUpPlanMapper.updateById(stockUpPlan);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,6 @@ package org.nl.b_lms.bst.ivt.boxstack.service.impl;
|
|||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
@@ -11,8 +10,6 @@ import com.github.pagehelper.PageHelper;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.nl.b_lms.bst.ivt.boxstack.service.IBstIvtBoxstackService;
|
import org.nl.b_lms.bst.ivt.boxstack.service.IBstIvtBoxstackService;
|
||||||
import org.nl.b_lms.bst.ivt.boxstack.service.IBstIvtBoxStockUpPlanService;
|
|
||||||
import org.nl.b_lms.bst.ivt.boxstack.service.dao.BstIvtBoxStockUpPlan;
|
|
||||||
import org.nl.b_lms.bst.ivt.boxstack.service.dao.BstIvtBoxstack;
|
import org.nl.b_lms.bst.ivt.boxstack.service.dao.BstIvtBoxstack;
|
||||||
import org.nl.b_lms.bst.ivt.boxstack.service.dao.mapper.BstIvtBoxstackMapper;
|
import org.nl.b_lms.bst.ivt.boxstack.service.dao.mapper.BstIvtBoxstackMapper;
|
||||||
import org.nl.b_lms.bst.ivt.boxstack.service.dto.BstIvtBoxstackDto;
|
import org.nl.b_lms.bst.ivt.boxstack.service.dto.BstIvtBoxstackDto;
|
||||||
|
|||||||
@@ -1,16 +1,13 @@
|
|||||||
package org.nl.b_lms.pda.controller;
|
package org.nl.b_lms.pda.controller;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.annotation.SaIgnore;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.nl.b_lms.pda.service.BoxStackInOutService;
|
import org.nl.b_lms.pda.service.BoxStackInOutService;
|
||||||
import org.nl.modules.logging.annotation.Log;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description TODO
|
* @Description TODO
|
||||||
@@ -26,9 +23,26 @@ public class BoxStackInOutController {
|
|||||||
private BoxStackInOutService boxStackInOutService;
|
private BoxStackInOutService boxStackInOutService;
|
||||||
|
|
||||||
@PostMapping("/boxIn")
|
@PostMapping("/boxIn")
|
||||||
@Log("木箱入库")
|
@SaIgnore
|
||||||
public ResponseEntity<Object> confirmPass(@RequestBody JSONObject reqParam) {
|
public ResponseEntity<Object> boxIn(@RequestBody JSONObject reqParam) {
|
||||||
boxStackInOutService.boxIn(reqParam);
|
return new ResponseEntity<>(boxStackInOutService.boxIn(reqParam), HttpStatus.OK);
|
||||||
return new ResponseEntity<>( HttpStatus.OK);
|
}
|
||||||
|
|
||||||
|
@PostMapping("/updateWeight")
|
||||||
|
@SaIgnore
|
||||||
|
public ResponseEntity<Object> updateWeight(@RequestBody JSONObject reqParam) {
|
||||||
|
return new ResponseEntity<>(boxStackInOutService.updateWeight(reqParam),HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/updatePoint")
|
||||||
|
@SaIgnore
|
||||||
|
public ResponseEntity<Object> updatePoint(@RequestBody JSONObject reqParam) {
|
||||||
|
return new ResponseEntity<>(boxStackInOutService.updatePoint(reqParam), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/getBoxSpecInfo")
|
||||||
|
@SaIgnore
|
||||||
|
public ResponseEntity<Object> getBoxSpecInfo() {
|
||||||
|
return new ResponseEntity<>(boxStackInOutService.getBoxSpecInfo(), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,8 @@ package org.nl.b_lms.pda.service;
|
|||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description TODO
|
* @Description TODO
|
||||||
* @Author Gengby
|
* @Author Gengby
|
||||||
@@ -10,9 +12,32 @@ import com.alibaba.fastjson.JSONObject;
|
|||||||
public interface BoxStackInOutService {
|
public interface BoxStackInOutService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 入库
|
* 空木箱入库
|
||||||
*
|
*
|
||||||
* @param reqParam
|
* @param reqParam
|
||||||
*/
|
*/
|
||||||
void boxIn(JSONObject reqParam);
|
JSONObject boxIn(JSONObject reqParam);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 维护空木箱重量
|
||||||
|
*
|
||||||
|
* @param reqParam
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
JSONObject updateWeight(JSONObject reqParam);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 维护空木箱库存
|
||||||
|
*
|
||||||
|
* @param reqParam
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
JSONObject updatePoint(JSONObject reqParam);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取木箱规格信息
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Map<String,Object> getBoxSpecInfo();
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package org.nl.b_lms.pda.service.impl;
|
package org.nl.b_lms.pda.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
@@ -11,19 +12,25 @@ import org.nl.b_lms.bst.ivt.boxstack.enums.BoxStackEnum;
|
|||||||
import org.nl.b_lms.bst.ivt.boxstack.service.IBstIvtBoxstackService;
|
import org.nl.b_lms.bst.ivt.boxstack.service.IBstIvtBoxstackService;
|
||||||
import org.nl.b_lms.bst.ivt.boxstack.service.dao.BstIvtBoxstack;
|
import org.nl.b_lms.bst.ivt.boxstack.service.dao.BstIvtBoxstack;
|
||||||
import org.nl.b_lms.pda.service.BoxStackInOutService;
|
import org.nl.b_lms.pda.service.BoxStackInOutService;
|
||||||
|
import org.nl.b_lms.sch.task.dao.SchBaseTask;
|
||||||
import org.nl.b_lms.sch.task.service.IschBaseTaskService;
|
import org.nl.b_lms.sch.task.service.IschBaseTaskService;
|
||||||
import org.nl.b_lms.sch.tasks.boxstack.MxInTask;
|
import org.nl.b_lms.sch.tasks.boxstack.MxInTask;
|
||||||
import org.nl.b_lms.storage_manage.database.service.IBstIvtBoxinfoService;
|
import org.nl.b_lms.storage_manage.database.service.IBstIvtBoxinfoService;
|
||||||
import org.nl.b_lms.storage_manage.database.service.dao.BstIvtBoxinfo;
|
import org.nl.b_lms.storage_manage.database.service.dao.BstIvtBoxinfo;
|
||||||
|
import org.nl.b_lms.storage_manage.md.dao.MdMeMaterialBase;
|
||||||
|
import org.nl.b_lms.storage_manage.md.service.MaterialbaseService;
|
||||||
|
import org.nl.common.utils.SecurityUtils;
|
||||||
import org.nl.modules.common.exception.BadRequestException;
|
import org.nl.modules.common.exception.BadRequestException;
|
||||||
import org.nl.system.service.param.ISysParamService;
|
import org.nl.system.service.param.ISysParamService;
|
||||||
import org.nl.system.service.param.dao.Param;
|
import org.nl.system.service.param.dao.Param;
|
||||||
import org.nl.wms.sch.service.PointService;
|
import org.nl.wms.sch.service.PointService;
|
||||||
import org.redisson.api.RLock;
|
import org.redisson.api.RLock;
|
||||||
import org.redisson.api.RedissonClient;
|
import org.redisson.api.RedissonClient;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -50,10 +57,12 @@ public class BoxStackInOutServiceImpl implements BoxStackInOutService {
|
|||||||
private IBstIvtBoxstackService boxstackService;
|
private IBstIvtBoxstackService boxstackService;
|
||||||
@Resource
|
@Resource
|
||||||
private ISysParamService paramService;
|
private ISysParamService paramService;
|
||||||
|
@Autowired
|
||||||
|
private MaterialbaseService materialbaseService;
|
||||||
|
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
@Override
|
@Override
|
||||||
public void boxIn(JSONObject reqParam) {
|
public JSONObject boxIn(JSONObject reqParam) {
|
||||||
String pointCode = reqParam.getString("point_code");
|
String pointCode = reqParam.getString("point_code");
|
||||||
if (StringUtils.isBlank(pointCode)) {
|
if (StringUtils.isBlank(pointCode)) {
|
||||||
throw new BadRequestException("请输入入库点位");
|
throw new BadRequestException("请输入入库点位");
|
||||||
@@ -61,10 +70,14 @@ public class BoxStackInOutServiceImpl implements BoxStackInOutService {
|
|||||||
Optional.ofNullable(pointService.findByCode(pointCode))
|
Optional.ofNullable(pointService.findByCode(pointCode))
|
||||||
.orElseThrow(() -> new BadRequestException("入库点位不存在"));
|
.orElseThrow(() -> new BadRequestException("入库点位不存在"));
|
||||||
|
|
||||||
String vehicleCodeStr = reqParam.getString("vehicle_code");
|
String vehicleCodeStr = reqParam.getString("vehicle_code").replaceAll("\\s+", "");
|
||||||
if (StringUtils.isBlank(vehicleCodeStr)) {
|
if (StringUtils.isBlank(vehicleCodeStr)) {
|
||||||
throw new BadRequestException("请输入木箱号");
|
throw new BadRequestException("请输入木箱号");
|
||||||
}
|
}
|
||||||
|
List<SchBaseTask> tasksByVehicleCode = taskService.findTasksByVehicleCode(vehicleCodeStr);
|
||||||
|
if (CollectionUtils.isNotEmpty(tasksByVehicleCode)) {
|
||||||
|
throw new BadRequestException("该木箱号已经存在任务");
|
||||||
|
}
|
||||||
String[] vehicleCodes = vehicleCodeStr.split(",");
|
String[] vehicleCodes = vehicleCodeStr.split(",");
|
||||||
List<String> boxSpecs = new ArrayList<>();
|
List<String> boxSpecs = new ArrayList<>();
|
||||||
|
|
||||||
@@ -75,6 +88,9 @@ public class BoxStackInOutServiceImpl implements BoxStackInOutService {
|
|||||||
if (ObjectUtil.isEmpty(boxinfo)) {
|
if (ObjectUtil.isEmpty(boxinfo)) {
|
||||||
throw new BadRequestException("木箱号: " + boxNo + " 不存在");
|
throw new BadRequestException("木箱号: " + boxNo + " 不存在");
|
||||||
}
|
}
|
||||||
|
if (ObjectUtil.isEmpty(boxinfo.getBox_weight())) {
|
||||||
|
throw new BadRequestException("木箱号: " + boxNo + "重量信息未维护");
|
||||||
|
}
|
||||||
boxSpecs.add(boxinfo.getMaterial_code());
|
boxSpecs.add(boxinfo.getMaterial_code());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -118,12 +134,104 @@ public class BoxStackInOutServiceImpl implements BoxStackInOutService {
|
|||||||
lock.unlock();
|
lock.unlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
JSONObject resp = new JSONObject();
|
||||||
|
resp.put("status", "200");
|
||||||
|
resp.put("message", "操作成功");
|
||||||
|
return resp;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONObject updateWeight(JSONObject reqParam) {
|
||||||
|
String vehicle_code = reqParam.getString("vehicle_code");
|
||||||
|
if (StringUtils.isBlank(vehicle_code)) {
|
||||||
|
throw new BadRequestException("请输入木箱号");
|
||||||
|
}
|
||||||
|
BigDecimal weight = reqParam.getBigDecimal("weight");
|
||||||
|
if (weight == null || weight.compareTo(BigDecimal.ZERO) <= 0) {
|
||||||
|
throw new BadRequestException("木箱重量不能为空并且大于0");
|
||||||
|
}
|
||||||
|
BstIvtBoxinfo boxinfo = boxinfoService.getOne(
|
||||||
|
new LambdaQueryWrapper<BstIvtBoxinfo>().eq(BstIvtBoxinfo::getBox_no, vehicle_code));
|
||||||
|
if (ObjectUtil.isEmpty(boxinfo)) {
|
||||||
|
throw new BadRequestException("木箱信息不存在");
|
||||||
|
}
|
||||||
|
boxinfo.setBox_weight(String.valueOf(weight));
|
||||||
|
boxinfoService.updateById(boxinfo);
|
||||||
|
JSONObject resp = new JSONObject();
|
||||||
|
resp.put("status", "200");
|
||||||
|
resp.put("message", "操作成功");
|
||||||
|
return resp;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONObject updatePoint(JSONObject reqParam) {
|
||||||
|
String pointCode = reqParam.getString("point_code");
|
||||||
|
if (StringUtils.isBlank(pointCode)) {
|
||||||
|
throw new BadRequestException("请输入入库点位");
|
||||||
|
}
|
||||||
|
String vehicleCodeStr = reqParam.getString("vehicle_code");
|
||||||
|
if (StringUtils.isBlank(vehicleCodeStr)) {
|
||||||
|
throw new BadRequestException("请输入木箱号");
|
||||||
|
}
|
||||||
|
String material_code = reqParam.getString("material_code");
|
||||||
|
if (StringUtils.isBlank(material_code)) {
|
||||||
|
throw new BadRequestException("请输入木箱规格");
|
||||||
|
}
|
||||||
|
BstIvtBoxstack boxstack = boxstackService.getOne(new LambdaQueryWrapper<BstIvtBoxstack>()
|
||||||
|
.eq(BstIvtBoxstack::getStack_code, pointCode));
|
||||||
|
if (ObjectUtil.isEmpty(boxstack)) {
|
||||||
|
throw new BadRequestException("堆叠点位信息不存在");
|
||||||
|
}
|
||||||
|
for (String vehicle_code : vehicleCodeStr.split(",")) {
|
||||||
|
BstIvtBoxinfo ivtBoxinfo = boxinfoService.getOne(new LambdaQueryWrapper<BstIvtBoxinfo>().eq(BstIvtBoxinfo::getBox_no, vehicle_code));
|
||||||
|
if (ObjectUtil.isEmpty(ivtBoxinfo)) {
|
||||||
|
throw new BadRequestException(vehicle_code + "木箱信息不存在");
|
||||||
|
}
|
||||||
|
if (!StrUtil.equals(ivtBoxinfo.getMaterial_code(), material_code)) {
|
||||||
|
throw new BadRequestException(vehicle_code + "木箱规格不一致");
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isEmpty(ivtBoxinfo.getBox_weight())) {
|
||||||
|
throw new BadRequestException(vehicle_code + "请维护木箱重量");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
boxstack.setBox_spec(material_code);
|
||||||
|
boxstack.setBox_no(vehicleCodeStr);
|
||||||
|
boxstack.setCurrent_layer_count(vehicleCodeStr.split(",").length);
|
||||||
|
boxstack.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||||
|
boxstack.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||||
|
boxstack.setUpdate_time(DateUtil.now());
|
||||||
|
boxstackService.updateById(boxstack);
|
||||||
|
JSONObject resp = new JSONObject();
|
||||||
|
resp.put("status", "200");
|
||||||
|
resp.put("message", "操作成功");
|
||||||
|
return resp;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> getBoxSpecInfo() {
|
||||||
|
List<MdMeMaterialBase> list = materialbaseService.list(new LambdaQueryWrapper<MdMeMaterialBase>().like(MdMeMaterialBase::getMaterial_name, "木箱"));
|
||||||
|
List<Map<String, String>> data = list.stream()
|
||||||
|
.map(item -> {
|
||||||
|
Map<String, String> map = new HashMap<>();
|
||||||
|
map.put("value", item.getMaterial_code());
|
||||||
|
map.put("text", item.getMaterial_name());
|
||||||
|
return map;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
Map<String, Object> resp = new HashMap<>();
|
||||||
|
resp.put("status", "200");
|
||||||
|
resp.put("message", "查询成功");
|
||||||
|
resp.put("data", data);
|
||||||
|
return resp;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleLooseAreaIn(String pointCode, String firstMaterial, String vehicleCodeStr) {
|
private void handleLooseAreaIn(String pointCode, String firstMaterial, String vehicleCodeStr) {
|
||||||
List<BstIvtBoxstack> emptyLoosePoints = boxstackService.list(
|
List<BstIvtBoxstack> emptyLoosePoints = boxstackService.list(
|
||||||
new LambdaQueryWrapper<BstIvtBoxstack>()
|
new LambdaQueryWrapper<BstIvtBoxstack>()
|
||||||
.isNull(BstIvtBoxstack::getBox_spec)
|
.and(wrapper -> wrapper
|
||||||
|
.isNull(BstIvtBoxstack::getBox_spec)
|
||||||
|
.or()
|
||||||
|
.eq(BstIvtBoxstack::getBox_spec, "")
|
||||||
|
)
|
||||||
.eq(BstIvtBoxstack::getCurrent_layer_count, 0)
|
.eq(BstIvtBoxstack::getCurrent_layer_count, 0)
|
||||||
.eq(BstIvtBoxstack::getPoint_status, BoxStackEnum.POINT_STATUS.code("零散区"))
|
.eq(BstIvtBoxstack::getPoint_status, BoxStackEnum.POINT_STATUS.code("零散区"))
|
||||||
.eq(BstIvtBoxstack::getIs_used, BoxStackEnum.IS_USED.code("启用"))
|
.eq(BstIvtBoxstack::getIs_used, BoxStackEnum.IS_USED.code("启用"))
|
||||||
@@ -146,6 +254,7 @@ public class BoxStackInOutServiceImpl implements BoxStackInOutService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void handleDenseAreaIn(String pointCode, String firstMaterial, String vehicleCodeStr) {
|
private void handleDenseAreaIn(String pointCode, String firstMaterial, String vehicleCodeStr) {
|
||||||
|
//获取已经密集区有该规格的列的库位
|
||||||
List<BstIvtBoxstack> firstRowWithMaterial = boxstackService.list(
|
List<BstIvtBoxstack> firstRowWithMaterial = boxstackService.list(
|
||||||
new LambdaQueryWrapper<BstIvtBoxstack>()
|
new LambdaQueryWrapper<BstIvtBoxstack>()
|
||||||
.eq(BstIvtBoxstack::getBox_spec, firstMaterial)
|
.eq(BstIvtBoxstack::getBox_spec, firstMaterial)
|
||||||
@@ -153,79 +262,103 @@ public class BoxStackInOutServiceImpl implements BoxStackInOutService {
|
|||||||
.eq(BstIvtBoxstack::getX, 1)
|
.eq(BstIvtBoxstack::getX, 1)
|
||||||
.eq(BstIvtBoxstack::getIs_used, BoxStackEnum.IS_USED.code("启用"))
|
.eq(BstIvtBoxstack::getIs_used, BoxStackEnum.IS_USED.code("启用"))
|
||||||
);
|
);
|
||||||
|
//获取密集区每一列都是空位的点位
|
||||||
if (!CollectionUtils.isEmpty(firstRowWithMaterial)) {
|
|
||||||
for (BstIvtBoxstack stack : firstRowWithMaterial) {
|
|
||||||
Integer y = stack.getY();
|
|
||||||
|
|
||||||
List<BstIvtBoxstack> emptyPointsInColumn = boxstackService.list(
|
|
||||||
new LambdaQueryWrapper<BstIvtBoxstack>()
|
|
||||||
.isNull(BstIvtBoxstack::getBox_spec)
|
|
||||||
.eq(BstIvtBoxstack::getCurrent_layer_count, 0)
|
|
||||||
.eq(BstIvtBoxstack::getPoint_status, BoxStackEnum.POINT_STATUS.code("密集区"))
|
|
||||||
.eq(BstIvtBoxstack::getY, y)
|
|
||||||
.eq(BstIvtBoxstack::getIs_used, BoxStackEnum.IS_USED.code("启用"))
|
|
||||||
);
|
|
||||||
|
|
||||||
if (CollectionUtils.isEmpty(emptyPointsInColumn)) continue;
|
|
||||||
|
|
||||||
List<String> emptyStackCodes = emptyPointsInColumn.stream()
|
|
||||||
.map(BstIvtBoxstack::getStack_code)
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
BstIvtBoxstack waitPoint = boxstackService.getOne(
|
|
||||||
new LambdaQueryWrapper<BstIvtBoxstack>()
|
|
||||||
.eq(BstIvtBoxstack::getPoint_status, BoxStackEnum.POINT_STATUS.code("等待区"))
|
|
||||||
.eq(BstIvtBoxstack::getY, y)
|
|
||||||
.eq(BstIvtBoxstack::getIs_used, BoxStackEnum.IS_USED.code("启用"))
|
|
||||||
);
|
|
||||||
|
|
||||||
if (waitPoint == null) continue;
|
|
||||||
|
|
||||||
int waitingTasks = taskService.checkHaveTaskByNext(Arrays.asList(waitPoint.getStack_code())).size();
|
|
||||||
int assignTasks = taskService.checkHaveTaskByNext(emptyStackCodes).size();
|
|
||||||
|
|
||||||
if (emptyPointsInColumn.size() > waitingTasks + assignTasks) {
|
|
||||||
JSONObject taskParam = buildTaskParam(firstMaterial, vehicleCodeStr,
|
|
||||||
BoxStackEnum.AGV_ACTION_TYPE.code("放货二次分配"),
|
|
||||||
BoxStackEnum.TASK_TYPE.code("木箱入库"),
|
|
||||||
pointCode, waitPoint.getStack_code());
|
|
||||||
mxInTask.createTask(taskParam);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
List<BstIvtBoxstack> firstRowEmpty = boxstackService.list(
|
List<BstIvtBoxstack> firstRowEmpty = boxstackService.list(
|
||||||
new LambdaQueryWrapper<BstIvtBoxstack>()
|
new LambdaQueryWrapper<BstIvtBoxstack>()
|
||||||
.isNull(BstIvtBoxstack::getBox_spec)
|
.and(wrapper -> wrapper
|
||||||
|
.isNull(BstIvtBoxstack::getBox_spec)
|
||||||
|
.or()
|
||||||
|
.eq(BstIvtBoxstack::getBox_spec, "")
|
||||||
|
)
|
||||||
.eq(BstIvtBoxstack::getCurrent_layer_count, 0)
|
.eq(BstIvtBoxstack::getCurrent_layer_count, 0)
|
||||||
.eq(BstIvtBoxstack::getX, 1)
|
.eq(BstIvtBoxstack::getX, 1)
|
||||||
.eq(BstIvtBoxstack::getPoint_status, BoxStackEnum.POINT_STATUS.code("密集区"))
|
.eq(BstIvtBoxstack::getPoint_status, BoxStackEnum.POINT_STATUS.code("密集区"))
|
||||||
.eq(BstIvtBoxstack::getIs_used, BoxStackEnum.IS_USED.code("启用"))
|
.eq(BstIvtBoxstack::getIs_used, BoxStackEnum.IS_USED.code("启用"))
|
||||||
);
|
);
|
||||||
|
if (!CollectionUtils.isEmpty(firstRowWithMaterial)) {
|
||||||
if (CollectionUtils.isEmpty(firstRowEmpty)) {
|
handleTask(firstRowWithMaterial, pointCode, firstMaterial, vehicleCodeStr, true);
|
||||||
throw new BadRequestException("无可用货位,请稍后入库");
|
} else if (!CollectionUtils.isEmpty(firstRowEmpty)) {
|
||||||
|
handleTask(firstRowEmpty, pointCode, firstMaterial, vehicleCodeStr, false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
BstIvtBoxstack selectedStack = firstRowEmpty.get(0);
|
private void handleTask(List<BstIvtBoxstack> boxstackList, String pointCode, String firstMaterial, String vehicleCodeStr, Boolean isFirst) {
|
||||||
BstIvtBoxstack waitPoint = boxstackService.getOne(
|
Boolean flag = false;
|
||||||
new LambdaQueryWrapper<BstIvtBoxstack>()
|
Map<Integer, List<BstIvtBoxstack>> boxStackGroupedByY = boxstackList.stream()
|
||||||
.eq(BstIvtBoxstack::getPoint_status, BoxStackEnum.POINT_STATUS.code("等待区"))
|
.collect(Collectors.groupingBy(BstIvtBoxstack::getY));
|
||||||
.eq(BstIvtBoxstack::getY, selectedStack.getY())
|
for (Integer y : boxStackGroupedByY.keySet()) {
|
||||||
.eq(BstIvtBoxstack::getIs_used, BoxStackEnum.IS_USED.code("启用"))
|
List<BstIvtBoxstack> emptyPointsInColumn = boxstackService.list(
|
||||||
);
|
new LambdaQueryWrapper<BstIvtBoxstack>()
|
||||||
|
.and(wrapper -> wrapper
|
||||||
if (waitPoint == null) {
|
.isNull(BstIvtBoxstack::getBox_spec)
|
||||||
throw new BadRequestException("未找到对应等待区位置,请检查配置");
|
.or()
|
||||||
|
.eq(BstIvtBoxstack::getBox_spec, "")
|
||||||
|
)
|
||||||
|
.eq(BstIvtBoxstack::getCurrent_layer_count, 0)
|
||||||
|
.eq(BstIvtBoxstack::getPoint_status, BoxStackEnum.POINT_STATUS.code("密集区"))
|
||||||
|
.eq(BstIvtBoxstack::getY, y)
|
||||||
|
.eq(BstIvtBoxstack::getIs_used, BoxStackEnum.IS_USED.code("启用"))
|
||||||
|
);
|
||||||
|
if (CollectionUtils.isEmpty(emptyPointsInColumn)) continue;
|
||||||
|
BstIvtBoxstack waitPoint = boxstackService.getOne(
|
||||||
|
new LambdaQueryWrapper<BstIvtBoxstack>()
|
||||||
|
.eq(BstIvtBoxstack::getPoint_status, BoxStackEnum.POINT_STATUS.code("等待区"))
|
||||||
|
.eq(BstIvtBoxstack::getY, y)
|
||||||
|
.eq(BstIvtBoxstack::getIs_used, BoxStackEnum.IS_USED.code("启用"))
|
||||||
|
);
|
||||||
|
if (waitPoint == null) continue;
|
||||||
|
List<String> emptyStackCodes = emptyPointsInColumn.stream()
|
||||||
|
.map(BstIvtBoxstack::getStack_code)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
List<SchBaseTask> schBaseTasks = taskService.checkHaveTaskByNext(Arrays.asList(waitPoint.getStack_code()));
|
||||||
|
if (!CollectionUtils.isEmpty(schBaseTasks)) {
|
||||||
|
SchBaseTask schBaseTask = schBaseTasks.get(0);
|
||||||
|
String boxNoStr = schBaseTask.getVehicle_code();
|
||||||
|
if (boxNoStr != null) {
|
||||||
|
String boxNo = boxNoStr.split(",")[0];
|
||||||
|
BstIvtBoxinfo boxinfo = boxinfoService.getOne(new LambdaQueryWrapper<BstIvtBoxinfo>()
|
||||||
|
.eq(BstIvtBoxinfo::getBox_no, boxNo));
|
||||||
|
if (ObjectUtil.isNotNull(boxinfo)) {
|
||||||
|
if (!StrUtil.equals(boxinfo.getMaterial_code(), firstMaterial)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int waitingTasks = schBaseTasks.size();
|
||||||
|
int assignTasks = taskService.checkHaveTaskByNext(emptyStackCodes).size();
|
||||||
|
int hasGoodsSize = boxstackService.list(
|
||||||
|
new LambdaQueryWrapper<BstIvtBoxstack>()
|
||||||
|
.gt(BstIvtBoxstack::getCurrent_layer_count, 0)
|
||||||
|
.eq(BstIvtBoxstack::getPoint_status, BoxStackEnum.POINT_STATUS.code("密集区"))
|
||||||
|
.eq(BstIvtBoxstack::getY, y)
|
||||||
|
.eq(BstIvtBoxstack::getIs_used, BoxStackEnum.IS_USED.code("启用"))
|
||||||
|
).size();
|
||||||
|
if (emptyPointsInColumn.size() >= waitingTasks + assignTasks + hasGoodsSize) {
|
||||||
|
JSONObject taskParam = buildTaskParam(firstMaterial, vehicleCodeStr,
|
||||||
|
BoxStackEnum.AGV_ACTION_TYPE.code("放货二次分配"),
|
||||||
|
BoxStackEnum.TASK_TYPE.code("木箱入库"),
|
||||||
|
pointCode, waitPoint.getStack_code());
|
||||||
|
mxInTask.createTask(taskParam);
|
||||||
|
flag = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!flag && isFirst) {
|
||||||
|
List<BstIvtBoxstack> firstRowEmpty = boxstackService.list(
|
||||||
|
new LambdaQueryWrapper<BstIvtBoxstack>()
|
||||||
|
.and(wrapper -> wrapper
|
||||||
|
.isNull(BstIvtBoxstack::getBox_spec)
|
||||||
|
.or()
|
||||||
|
.eq(BstIvtBoxstack::getBox_spec, "")
|
||||||
|
)
|
||||||
|
.eq(BstIvtBoxstack::getCurrent_layer_count, 0)
|
||||||
|
.eq(BstIvtBoxstack::getX, 1)
|
||||||
|
.eq(BstIvtBoxstack::getPoint_status, BoxStackEnum.POINT_STATUS.code("密集区"))
|
||||||
|
.eq(BstIvtBoxstack::getIs_used, BoxStackEnum.IS_USED.code("启用"))
|
||||||
|
);
|
||||||
|
handleTask(firstRowEmpty, pointCode, firstMaterial, vehicleCodeStr, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
JSONObject taskParam = buildTaskParam(firstMaterial, vehicleCodeStr,
|
|
||||||
BoxStackEnum.AGV_ACTION_TYPE.code("放货二次分配"),
|
|
||||||
BoxStackEnum.TASK_TYPE.code("木箱入库"),
|
|
||||||
pointCode, waitPoint.getStack_code());
|
|
||||||
mxInTask.createTask(taskParam);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private JSONObject buildTaskParam(String materialCode, String vehicleCode,
|
private JSONObject buildTaskParam(String materialCode, String vehicleCode,
|
||||||
|
|||||||
@@ -161,6 +161,29 @@ public interface IschBaseTaskService extends IService<SchBaseTask> {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<SchBaseTask> checkHaveTaskByNext(List<String> noHasGoodsPointCodeList);
|
List<SchBaseTask> checkHaveTaskByNext(List<String> noHasGoodsPointCodeList);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param point_code1
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<SchBaseTask> checkHaveTaskByStart(String point_code1);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param point_code1List
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<SchBaseTask> checkHaveTaskByStart(List<String> point_code1List);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据载具号获取任务
|
||||||
|
* @param vehicleCodeStr
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<SchBaseTask> findTasksByVehicleCode(String vehicleCodeStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -253,6 +253,30 @@ public class SchBaseTaskServiceImpl extends ServiceImpl<SchBaseTaskMapper, SchBa
|
|||||||
return list(lqw);
|
return list(lqw);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SchBaseTask> checkHaveTaskByStart(List<String> point1List) {
|
||||||
|
LambdaQueryWrapper<SchBaseTask> lqw = new QueryWrapper<SchBaseTask>().lambda();
|
||||||
|
lqw.lt(SchBaseTask::getTask_status, TaskStatusEnum.FINISHED.getCode())
|
||||||
|
.and(la -> la.in(SchBaseTask::getPoint_code1, point1List));
|
||||||
|
return list(lqw);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SchBaseTask> checkHaveTaskByStart(String point_code1) {
|
||||||
|
LambdaQueryWrapper<SchBaseTask> lqw = new QueryWrapper<SchBaseTask>().lambda();
|
||||||
|
lqw.lt(SchBaseTask::getTask_status, TaskStatusEnum.FINISHED.getCode())
|
||||||
|
.and(la -> la.eq(SchBaseTask::getPoint_code1, point_code1));
|
||||||
|
return list(lqw);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SchBaseTask> findTasksByVehicleCode(String vehicleCodeStr) {
|
||||||
|
LambdaQueryWrapper<SchBaseTask> lqw = new QueryWrapper<SchBaseTask>().lambda();
|
||||||
|
lqw.lt(SchBaseTask::getTask_status, TaskStatusEnum.FINISHED.getCode())
|
||||||
|
.and(la -> la.eq(SchBaseTask::getVehicle_code, vehicleCodeStr));
|
||||||
|
return list(lqw);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import javax.annotation.Resource;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -157,6 +158,7 @@ public class MxInTask extends AbstractAcsTask {
|
|||||||
.vehicle_code(vehicleCode)
|
.vehicle_code(vehicleCode)
|
||||||
//二次分配要用的类型
|
//二次分配要用的类型
|
||||||
.vehicle_code2(form.getString("vehicle_code2"))
|
.vehicle_code2(form.getString("vehicle_code2"))
|
||||||
|
.material_code(form.getString("material_code"))
|
||||||
.point_code1(pointCode1)
|
.point_code1(pointCode1)
|
||||||
.point_code2(pointCode2)
|
.point_code2(pointCode2)
|
||||||
.task_group_id(form.getString("task_group_id"))
|
.task_group_id(form.getString("task_group_id"))
|
||||||
@@ -175,7 +177,7 @@ public class MxInTask extends AbstractAcsTask {
|
|||||||
taskService.save(task);
|
taskService.save(task);
|
||||||
//如果目标点位没有空位先创建不下发
|
//如果目标点位没有空位先创建不下发
|
||||||
if (isSend) {
|
if (isSend) {
|
||||||
this.immediateNotifyAcs(null);
|
// this.immediateNotifyAcs(null);
|
||||||
}
|
}
|
||||||
return task.getTask_id();
|
return task.getTask_id();
|
||||||
}
|
}
|
||||||
@@ -226,22 +228,54 @@ public class MxInTask extends AbstractAcsTask {
|
|||||||
if (boxstack == null) {
|
if (boxstack == null) {
|
||||||
throw new BadRequestException("等待点不存在!");
|
throw new BadRequestException("等待点不存在!");
|
||||||
}
|
}
|
||||||
|
if (!StrUtil.equals(boxstack.getPoint_status(), BoxStackEnum.POINT_STATUS.code("等待区"))) {
|
||||||
|
return point_code2;
|
||||||
|
}
|
||||||
Integer y = boxstack.getY();
|
Integer y = boxstack.getY();
|
||||||
List<BstIvtBoxstack> list = boxstackService.list(new LambdaQueryWrapper<BstIvtBoxstack>()
|
List<BstIvtBoxstack> list = boxstackService.list(new LambdaQueryWrapper<BstIvtBoxstack>()
|
||||||
.eq(BstIvtBoxstack::getY, y)
|
.eq(BstIvtBoxstack::getY, y)
|
||||||
.eq(BstIvtBoxstack::getIs_used, IOSEnum.IS_NOTANDYES.code("是"))
|
.eq(BstIvtBoxstack::getIs_used, IOSEnum.IS_NOTANDYES.code("是"))
|
||||||
.eq(BstIvtBoxstack::getPoint_status, BoxStackEnum.POINT_STATUS.code("密集区"))
|
.eq(BstIvtBoxstack::getPoint_status, BoxStackEnum.POINT_STATUS.code("密集区"))
|
||||||
.isNull(BstIvtBoxstack::getBox_spec)
|
.and(wrapper -> wrapper
|
||||||
|
.isNull(BstIvtBoxstack::getBox_spec)
|
||||||
|
.or()
|
||||||
|
.eq(BstIvtBoxstack::getBox_spec, "")
|
||||||
|
)
|
||||||
.eq(BstIvtBoxstack::getCurrent_layer_count, 0)
|
.eq(BstIvtBoxstack::getCurrent_layer_count, 0)
|
||||||
.orderByAsc(BstIvtBoxstack::getX));
|
.orderByAsc(BstIvtBoxstack::getX));
|
||||||
for (BstIvtBoxstack bstIvtBoxstack : list) {
|
for (BstIvtBoxstack bstIvtBoxstack : list) {
|
||||||
List<SchBaseTask> schBaseTasks = taskService.checkHaveTaskByNext(Arrays.asList(bstIvtBoxstack.getStack_code()));
|
List<SchBaseTask> schBaseTasks = taskService.checkHaveTaskByNext(Arrays.asList(bstIvtBoxstack.getStack_code()));
|
||||||
if (CollectionUtils.isEmpty(schBaseTasks)) {
|
if (CollectionUtils.isEmpty(schBaseTasks)) {
|
||||||
baseTask.setPoint_code2(bstIvtBoxstack.getStack_code());
|
List<BstIvtBoxstack> stackCodeList = boxstackService.list(new LambdaQueryWrapper<BstIvtBoxstack>()
|
||||||
baseTask.setRemark("二次分配成功");
|
.eq(BstIvtBoxstack::getY, y)
|
||||||
baseTask.setUpdate_time(DateUtil.now());
|
.eq(BstIvtBoxstack::getIs_used, IOSEnum.IS_NOTANDYES.code("是"))
|
||||||
taskService.updateById(baseTask);
|
.eq(BstIvtBoxstack::getPoint_status, BoxStackEnum.POINT_STATUS.code("密集区"))
|
||||||
return bstIvtBoxstack.getStack_code();
|
.eq(BstIvtBoxstack::getBox_spec, baseTask.getMaterial_code())
|
||||||
|
.gt(BstIvtBoxstack::getCurrent_layer_count, 0)
|
||||||
|
.lt(BstIvtBoxstack::getX, bstIvtBoxstack.getX()));
|
||||||
|
List<SchBaseTask> havePoint1Tasks = new ArrayList<>();
|
||||||
|
if (!CollectionUtils.isEmpty(stackCodeList)) {
|
||||||
|
havePoint1Tasks = taskService.checkHaveTaskByStart(stackCodeList.stream().map(BstIvtBoxstack::getStack_code).collect(Collectors.toList()));
|
||||||
|
}
|
||||||
|
if (CollectionUtils.isEmpty(havePoint1Tasks)) {
|
||||||
|
baseTask.setPoint_code2(bstIvtBoxstack.getStack_code());
|
||||||
|
baseTask.setRemark("二次分配成功");
|
||||||
|
baseTask.setUpdate_time(DateUtil.now());
|
||||||
|
taskService.updateById(baseTask);
|
||||||
|
return bstIvtBoxstack.getStack_code();
|
||||||
|
} else {
|
||||||
|
List<BstIvtBoxstack> boxstackList = boxstackService.list(new LambdaQueryWrapper<BstIvtBoxstack>()
|
||||||
|
.in(BstIvtBoxstack::getStack_code, stackCodeList)
|
||||||
|
.lt(BstIvtBoxstack::getCurrent_layer_count, 0));
|
||||||
|
if (CollectionUtils.isEmpty(boxstackList)) {
|
||||||
|
baseTask.setPoint_code2(bstIvtBoxstack.getStack_code());
|
||||||
|
baseTask.setRemark("二次分配成功");
|
||||||
|
baseTask.setUpdate_time(DateUtil.now());
|
||||||
|
taskService.updateById(baseTask);
|
||||||
|
return bstIvtBoxstack.getStack_code();
|
||||||
|
}
|
||||||
|
throw new BadRequestException("该列暂时存在木箱移库任务,等移库任务完成再分配");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw new BadRequestException("等待点所在列暂时无空位!");
|
throw new BadRequestException("等待点所在列暂时无空位!");
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.nl.b_lms.bst.ivt.boxstack.enums.BoxStackEnum;
|
||||||
import org.nl.b_lms.bst.ivt.boxstack.service.IBstIvtBoxstackService;
|
import org.nl.b_lms.bst.ivt.boxstack.service.IBstIvtBoxstackService;
|
||||||
import org.nl.b_lms.bst.ivt.boxstack.service.IBstIvtBoxStockUpPlanService;
|
import org.nl.b_lms.bst.ivt.boxstack.service.IBstIvtBoxStockUpPlanService;
|
||||||
import org.nl.b_lms.bst.ivt.boxstack.service.dao.BstIvtBoxStockUpPlan;
|
import org.nl.b_lms.bst.ivt.boxstack.service.dao.BstIvtBoxStockUpPlan;
|
||||||
@@ -33,7 +35,9 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -53,7 +57,7 @@ public class MxMoveTask extends AbstractAcsTask {
|
|||||||
@Resource
|
@Resource
|
||||||
private IBstIvtBoxstackService boxstackService;
|
private IBstIvtBoxstackService boxstackService;
|
||||||
@Resource
|
@Resource
|
||||||
private IBstIvtBoxStockUpPlanService boxstacklayerService;
|
private IBstIvtBoxStockUpPlanService boxStockUpPlanService;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -111,21 +115,8 @@ public class MxMoveTask extends AbstractAcsTask {
|
|||||||
BstIvtBoxstack boxstack = boxstackService.getOne(new LambdaQueryWrapper<BstIvtBoxstack>()
|
BstIvtBoxstack boxstack = boxstackService.getOne(new LambdaQueryWrapper<BstIvtBoxstack>()
|
||||||
.eq(BstIvtBoxstack::getStack_code, schBaseTask.getPoint_code2()));
|
.eq(BstIvtBoxstack::getStack_code, schBaseTask.getPoint_code2()));
|
||||||
if (!ObjectUtil.isEmpty(boxstack)) {
|
if (!ObjectUtil.isEmpty(boxstack)) {
|
||||||
for (int i = 0; i < boxNos.length; i++) {
|
|
||||||
//修改每层的木箱号信息
|
|
||||||
// String boxNo = boxNos[i];
|
|
||||||
// BstIvtBoxStockUpPlan boxstacklayer = boxstacklayerService.getOne(new LambdaQueryWrapper<BstIvtBoxStockUpPlan>()
|
|
||||||
// .eq(BstIvtBoxStockUpPlan::getStack_id, boxstack.getStack_id())
|
|
||||||
// .eq(BstIvtBoxStockUpPlan::getLayer_index, i + 1));
|
|
||||||
// if (!ObjectUtil.isEmpty(boxstacklayer)) {
|
|
||||||
// boxstacklayer.setBox_code(boxNo);
|
|
||||||
// boxstacklayer.setUpdate_time(now);
|
|
||||||
// boxstacklayer.setUpdate_id(currentUserId);
|
|
||||||
// boxstacklayer.setUpdate_name(currentNickName);
|
|
||||||
// boxstacklayerService.updateById(boxstacklayer);
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
boxstack.setCurrent_layer_count(boxNos.length);
|
boxstack.setCurrent_layer_count(boxNos.length);
|
||||||
|
boxstack.setBox_no(vehicle_code);
|
||||||
boxstack.setBox_spec(box_spec);
|
boxstack.setBox_spec(box_spec);
|
||||||
boxstack.setUpdate_time(now);
|
boxstack.setUpdate_time(now);
|
||||||
boxstack.setUpdate_id(currentUserId);
|
boxstack.setUpdate_id(currentUserId);
|
||||||
@@ -134,6 +125,26 @@ public class MxMoveTask extends AbstractAcsTask {
|
|||||||
}
|
}
|
||||||
//3.更改任务状态为完成
|
//3.更改任务状态为完成
|
||||||
updateWrapper.set(SchBaseTask::getTask_status, TaskStatusEnum.FINISHED.getCode());
|
updateWrapper.set(SchBaseTask::getTask_status, TaskStatusEnum.FINISHED.getCode());
|
||||||
|
//4.判断该备货计划的任务是否都完成了 如果是的话则修改该备货计划任务状态为完成
|
||||||
|
String task_group_id = schBaseTask.getTask_group_id();
|
||||||
|
if (!ObjectUtil.isEmpty(task_group_id)) {
|
||||||
|
List<SchBaseTask> taskList = taskService.list(new LambdaQueryWrapper<SchBaseTask>()
|
||||||
|
.eq(SchBaseTask::getTask_group_id, task_group_id)
|
||||||
|
.eq(SchBaseTask::getIs_delete, 0)
|
||||||
|
.lt(SchBaseTask::getTask_status, TaskStatusEnum.FINISHED.getCode()));
|
||||||
|
if (taskList.size() <= 1) {
|
||||||
|
BstIvtBoxStockUpPlan stockUpPlan = boxStockUpPlanService.getOne(new LambdaQueryWrapper<BstIvtBoxStockUpPlan>()
|
||||||
|
.eq(BstIvtBoxStockUpPlan::getStockup_plan_id, schBaseTask.getTask_group_id()));
|
||||||
|
if (!ObjectUtil.isEmpty(stockUpPlan)) {
|
||||||
|
stockUpPlan.setStock_plan_status(BoxStackEnum.STOCK_UP_STATUS.code("完成"));
|
||||||
|
stockUpPlan.setUpdate_id(currentUserId);
|
||||||
|
stockUpPlan.setUpdate_name(currentNickName);
|
||||||
|
stockUpPlan.setUpdate_time(now);
|
||||||
|
boxStockUpPlanService.updateById(stockUpPlan);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
// 取消
|
// 取消
|
||||||
if (status.equals(IOSEnum.IS_NOTANDYES.code("否"))) {
|
if (status.equals(IOSEnum.IS_NOTANDYES.code("否"))) {
|
||||||
@@ -190,7 +201,7 @@ public class MxMoveTask extends AbstractAcsTask {
|
|||||||
taskService.save(task);
|
taskService.save(task);
|
||||||
//如果目标点位没有空位先创建不下发
|
//如果目标点位没有空位先创建不下发
|
||||||
if (isSend) {
|
if (isSend) {
|
||||||
this.immediateNotifyAcs(null);
|
//this.immediateNotifyAcs(null);
|
||||||
}
|
}
|
||||||
return task.getTask_id();
|
return task.getTask_id();
|
||||||
}
|
}
|
||||||
@@ -226,15 +237,87 @@ public class MxMoveTask extends AbstractAcsTask {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String againGetPoint(String taskCode) {
|
public String againGetPoint(String taskCode) {
|
||||||
return null;
|
SchBaseTask baseTask = taskService.getOne(new LambdaQueryWrapper<SchBaseTask>()
|
||||||
|
.eq(SchBaseTask::getTask_code, taskCode)
|
||||||
|
.eq(SchBaseTask::getIs_delete, IOSEnum.IS_SEND.code("否"))
|
||||||
|
.eq(SchBaseTask::getTask_status, TaskStatusEnum.EXECUTING.getCode()));
|
||||||
|
if (baseTask == null) {
|
||||||
|
throw new BadRequestException("该任务未执行或不存在!");
|
||||||
|
}
|
||||||
|
//获取木箱规格
|
||||||
|
String point_code1 = baseTask.getPoint_code1();
|
||||||
|
BstIvtBoxstack boxstack = boxstackService.getOne(new LambdaQueryWrapper<BstIvtBoxstack>()
|
||||||
|
.eq(BstIvtBoxstack::getStack_code, point_code1)
|
||||||
|
.eq(BstIvtBoxstack::getIs_used, IOSEnum.IS_NOTANDYES.code("是")));
|
||||||
|
if (boxstack == null) {
|
||||||
|
throw new BadRequestException("等待点不存在!");
|
||||||
|
}
|
||||||
|
if (!StrUtil.equals(boxstack.getPoint_status(), BoxStackEnum.POINT_STATUS.code("等待区"))) {
|
||||||
|
return point_code1;
|
||||||
|
}
|
||||||
|
Integer y = boxstack.getY();
|
||||||
|
List<BstIvtBoxstack> list = boxstackService.list(new LambdaQueryWrapper<BstIvtBoxstack>()
|
||||||
|
.eq(BstIvtBoxstack::getY, y)
|
||||||
|
.eq(BstIvtBoxstack::getIs_used, IOSEnum.IS_NOTANDYES.code("是"))
|
||||||
|
.eq(BstIvtBoxstack::getPoint_status, BoxStackEnum.POINT_STATUS.code("密集区"))
|
||||||
|
.eq(BstIvtBoxstack::getBox_spec, baseTask.getMaterial_code())
|
||||||
|
.gt(BstIvtBoxstack::getCurrent_layer_count, 0)
|
||||||
|
.orderByDesc(BstIvtBoxstack::getX));
|
||||||
|
for (BstIvtBoxstack bstIvtBoxstack : list) {
|
||||||
|
//先判断该点位是否存在起点任务
|
||||||
|
List<SchBaseTask> havePoint1Tasks = taskService.checkHaveTaskByStart(bstIvtBoxstack.getStack_code());
|
||||||
|
if (CollectionUtils.isEmpty(havePoint1Tasks)) {
|
||||||
|
//如果不存在,判断该点位及外层点位的任务
|
||||||
|
List<String> stackCodeList = boxstackService.list(new LambdaQueryWrapper<BstIvtBoxstack>()
|
||||||
|
.eq(BstIvtBoxstack::getY, y)
|
||||||
|
.eq(BstIvtBoxstack::getIs_used, IOSEnum.IS_NOTANDYES.code("是"))
|
||||||
|
.eq(BstIvtBoxstack::getPoint_status, BoxStackEnum.POINT_STATUS.code("密集区"))
|
||||||
|
.and(wrapper -> wrapper
|
||||||
|
.isNull(BstIvtBoxstack::getBox_spec)
|
||||||
|
.or()
|
||||||
|
.eq(BstIvtBoxstack::getBox_spec, "")
|
||||||
|
)
|
||||||
|
.eq(BstIvtBoxstack::getCurrent_layer_count, 0)
|
||||||
|
.gt(BstIvtBoxstack::getX, bstIvtBoxstack.getX()))
|
||||||
|
.stream()
|
||||||
|
.map(BstIvtBoxstack::getStack_code)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
List<SchBaseTask> havePoint2Tasks = new ArrayList<>();
|
||||||
|
if (!CollectionUtils.isEmpty(stackCodeList)) {
|
||||||
|
havePoint2Tasks = taskService.checkHaveTaskByNext(stackCodeList);
|
||||||
|
}
|
||||||
|
if (CollectionUtils.isEmpty(havePoint2Tasks)) {
|
||||||
|
baseTask.setPoint_code1(bstIvtBoxstack.getStack_code());
|
||||||
|
baseTask.setVehicle_code(bstIvtBoxstack.getBox_no());
|
||||||
|
baseTask.setRemark("二次分配成功");
|
||||||
|
baseTask.setUpdate_time(DateUtil.now());
|
||||||
|
taskService.updateById(baseTask);
|
||||||
|
return bstIvtBoxstack.getStack_code();
|
||||||
|
} else {
|
||||||
|
throw new BadRequestException("暂时存在入库任务,等入库任务完成再分配");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new BadRequestException("等待点所在列暂时无空位!");
|
||||||
}
|
}
|
||||||
|
|
||||||
public String againPutPoint(String taskCode) {
|
@Transactional(rollbackFor = Exception.class)
|
||||||
return null;
|
public void getFinish(String taskCode) {
|
||||||
}
|
|
||||||
|
|
||||||
public void getFinish() {
|
|
||||||
//更新起点库存
|
//更新起点库存
|
||||||
//起点层数
|
SchBaseTask baseTask = taskService.getOne(new LambdaQueryWrapper<SchBaseTask>()
|
||||||
|
.eq(SchBaseTask::getTask_code, taskCode)
|
||||||
|
.eq(SchBaseTask::getIs_delete, IOSEnum.IS_SEND.code("否"))
|
||||||
|
.eq(SchBaseTask::getTask_status, TaskStatusEnum.EXECUTING.getCode()));
|
||||||
|
if (baseTask == null) {
|
||||||
|
throw new BadRequestException("该任务未执行或不存在!");
|
||||||
|
}
|
||||||
|
BstIvtBoxstack boxstack = boxstackService.getOne(new LambdaQueryWrapper<BstIvtBoxstack>()
|
||||||
|
.eq(BstIvtBoxstack::getStack_code, baseTask.getPoint_code1()));
|
||||||
|
|
||||||
|
boxstack.setCurrent_layer_count(0);
|
||||||
|
boxstack.setBox_no("");
|
||||||
|
boxstack.setBox_spec("");
|
||||||
|
boxstack.setUpdate_time(DateUtil.now());
|
||||||
|
boxstackService.updateById(boxstack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
package org.nl.b_lms.sch.tasks.boxstack.auto;
|
package org.nl.b_lms.sch.tasks.boxstack.auto;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.nl.b_lms.bst.ivt.boxstack.enums.BoxStackEnum;
|
import org.nl.b_lms.bst.ivt.boxstack.enums.BoxStackEnum;
|
||||||
import org.nl.b_lms.bst.ivt.boxstack.service.IBstIvtBoxStockUpPlanService;
|
import org.nl.b_lms.bst.ivt.boxstack.service.IBstIvtBoxStockUpPlanService;
|
||||||
@@ -16,11 +16,10 @@ import org.nl.b_lms.bst.ivt.boxstack.service.dao.BstIvtBoxstack;
|
|||||||
import org.nl.b_lms.sch.task.dao.SchBaseTask;
|
import org.nl.b_lms.sch.task.dao.SchBaseTask;
|
||||||
import org.nl.b_lms.sch.task.service.IschBaseTaskService;
|
import org.nl.b_lms.sch.task.service.IschBaseTaskService;
|
||||||
import org.nl.b_lms.sch.tasks.boxstack.MxMoveTask;
|
import org.nl.b_lms.sch.tasks.boxstack.MxMoveTask;
|
||||||
import org.nl.common.utils.IdUtil;
|
|
||||||
import org.redisson.api.RLock;
|
import org.redisson.api.RLock;
|
||||||
import org.redisson.api.RedissonClient;
|
import org.redisson.api.RedissonClient;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@@ -46,7 +45,7 @@ public class AutoMxMoveTask {
|
|||||||
@Resource
|
@Resource
|
||||||
private IBstIvtBoxStockUpPlanService stockUpPlanService;
|
private IBstIvtBoxStockUpPlanService stockUpPlanService;
|
||||||
|
|
||||||
//木箱备货密集区->缓存区的自动搬运任务
|
//木箱备货密集区、零散区->缓存区的自动搬运任务
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
this.sendMxMove();
|
this.sendMxMove();
|
||||||
@@ -57,6 +56,7 @@ public class AutoMxMoveTask {
|
|||||||
|
|
||||||
|
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void sendMxMove() {
|
public void sendMxMove() {
|
||||||
log.info(THIS_CLASS + "-根据装箱计划木箱库移库定时任务开始执行扫描。");
|
log.info(THIS_CLASS + "-根据装箱计划木箱库移库定时任务开始执行扫描。");
|
||||||
RLock lock = redissonClient.getLock("boxMove");
|
RLock lock = redissonClient.getLock("boxMove");
|
||||||
@@ -65,8 +65,7 @@ public class AutoMxMoveTask {
|
|||||||
if (tryLock) {
|
if (tryLock) {
|
||||||
//获取木箱备货计划
|
//获取木箱备货计划
|
||||||
List<BstIvtBoxStockUpPlan> stockUpPlans = stockUpPlanService.list(new LambdaQueryWrapper<BstIvtBoxStockUpPlan>()
|
List<BstIvtBoxStockUpPlan> stockUpPlans = stockUpPlanService.list(new LambdaQueryWrapper<BstIvtBoxStockUpPlan>()
|
||||||
.eq(BstIvtBoxStockUpPlan::getStock_plan_status, BoxStackEnum.STOCK_UP_STATUS.code("未开始"))
|
.eq(BstIvtBoxStockUpPlan::getStock_plan_status, BoxStackEnum.STOCK_UP_STATUS.code("未开始")));
|
||||||
.eq(BstIvtBoxStockUpPlan::getStock_plan_time, DateUtil.today()));
|
|
||||||
for (BstIvtBoxStockUpPlan stockUpPlan : stockUpPlans) {
|
for (BstIvtBoxStockUpPlan stockUpPlan : stockUpPlans) {
|
||||||
//备货木箱
|
//备货木箱
|
||||||
String box_spec = stockUpPlan.getBox_spec();
|
String box_spec = stockUpPlan.getBox_spec();
|
||||||
@@ -76,7 +75,7 @@ public class AutoMxMoveTask {
|
|||||||
.eq(BstIvtBoxStockUpPlan::getBox_spec, box_spec)
|
.eq(BstIvtBoxStockUpPlan::getBox_spec, box_spec)
|
||||||
.eq(BstIvtBoxStockUpPlan::getStock_plan_status, BoxStackEnum.STOCK_UP_STATUS.code("执行中")));
|
.eq(BstIvtBoxStockUpPlan::getStock_plan_status, BoxStackEnum.STOCK_UP_STATUS.code("执行中")));
|
||||||
if (executingStockUpPlans.size() > 0) {
|
if (executingStockUpPlans.size() > 0) {
|
||||||
if (StringUtils.isNotBlank(stockUpPlan.getRemark())) {
|
if (StringUtils.isBlank(stockUpPlan.getRemark())) {
|
||||||
stockUpPlan.setRemark("有同规格的木箱移库备货计划正在执行");
|
stockUpPlan.setRemark("有同规格的木箱移库备货计划正在执行");
|
||||||
stockUpPlanService.updateById(stockUpPlan);
|
stockUpPlanService.updateById(stockUpPlan);
|
||||||
}
|
}
|
||||||
@@ -88,118 +87,158 @@ public class AutoMxMoveTask {
|
|||||||
.in(BstIvtBoxstack::getPoint_status, BoxStackEnum.POINT_STATUS.code("密集区"), BoxStackEnum.POINT_STATUS.code("零散区"))
|
.in(BstIvtBoxstack::getPoint_status, BoxStackEnum.POINT_STATUS.code("密集区"), BoxStackEnum.POINT_STATUS.code("零散区"))
|
||||||
.eq(BstIvtBoxstack::getIs_used, BoxStackEnum.IS_USED.code("启用")));
|
.eq(BstIvtBoxstack::getIs_used, BoxStackEnum.IS_USED.code("启用")));
|
||||||
if (boxstacks.size() < stock_up_num) {
|
if (boxstacks.size() < stock_up_num) {
|
||||||
|
if (StringUtils.isBlank(stockUpPlan.getRemark())) {
|
||||||
|
stockUpPlan.setRemark("木箱备货数量大于库存数量,暂时不生成");
|
||||||
|
stockUpPlanService.updateById(stockUpPlan);
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//判断木箱库中
|
//根据区域分组
|
||||||
}
|
Map<String, List<BstIvtBoxstack>> groupedByPointStatus = boxstacks.stream()
|
||||||
//获取装箱计划
|
.collect(Collectors.groupingBy(BstIvtBoxstack::getPoint_status));
|
||||||
List<String> zxjhs = new ArrayList<>();
|
List<BstIvtBoxstack> miJiQuList = groupedByPointStatus.getOrDefault(BoxStackEnum.POINT_STATUS.code("密集区"), Collections.emptyList());
|
||||||
for (String box_spec : zxjhs) {
|
List<BstIvtBoxstack> lingSanQuList = groupedByPointStatus.getOrDefault(BoxStackEnum.POINT_STATUS.code("零散区"), Collections.emptyList());
|
||||||
//判断木箱库是否存在该木箱规格的木箱
|
if (miJiQuList.size() >= stock_up_num) {
|
||||||
List<BstIvtBoxstack> hasGoodsPoint = boxstackService.list(new LambdaQueryWrapper<BstIvtBoxstack>()
|
Map<Integer, List<BstIvtBoxstack>> listMapByY = miJiQuList.stream()
|
||||||
.eq(BstIvtBoxstack::getBox_spec, box_spec)
|
.collect(Collectors.groupingBy(BstIvtBoxstack::getY));
|
||||||
.notIn(BstIvtBoxstack::getPoint_status, BoxStackEnum.POINT_STATUS.code("缓存区"))
|
List<Integer> sortedYs = new ArrayList<>(listMapByY.keySet());
|
||||||
.eq(BstIvtBoxstack::getIs_used, BoxStackEnum.IS_USED.code("启用")));
|
Collections.sort(sortedYs);
|
||||||
if (!CollectionUtil.isEmpty(hasGoodsPoint)) {
|
String task_group_id = stockUpPlan.getStockup_plan_id();
|
||||||
//查询缓存区可用库位的数量
|
// 已生成任务数
|
||||||
List<BstIvtBoxstack> hcqNoHasGoodsPointList = boxstackService.list(new LambdaQueryWrapper<BstIvtBoxstack>()
|
int createdTaskCount = 0;
|
||||||
.isNull(BstIvtBoxstack::getBox_spec)
|
List<JSONObject> taskList = new ArrayList<>();
|
||||||
.eq(BstIvtBoxstack::getPoint_status, BoxStackEnum.POINT_STATUS.code("缓存区"))
|
for (Integer y : sortedYs) {
|
||||||
.eq(BstIvtBoxstack::getX, 1)
|
List<BstIvtBoxstack> columns = listMapByY.get(y);
|
||||||
.eq(BstIvtBoxstack::getIs_used, BoxStackEnum.IS_USED.code("启用")));
|
// 获取该列的等待点
|
||||||
if (hcqNoHasGoodsPointList.size() <= 3) {
|
BstIvtBoxstack waitPoint = boxstackService.getOne(new LambdaQueryWrapper<BstIvtBoxstack>()
|
||||||
//获取缓存区相同木箱规格的的第一排的库位
|
.eq(BstIvtBoxstack::getY, y)
|
||||||
List<BstIvtBoxstack> hcqHasGoodsPointList = boxstackService.list(new LambdaQueryWrapper<BstIvtBoxstack>()
|
.eq(BstIvtBoxstack::getIs_used, BoxStackEnum.IS_USED.code("启用"))
|
||||||
.eq(BstIvtBoxstack::getBox_spec, box_spec)
|
.eq(BstIvtBoxstack::getPoint_status, BoxStackEnum.POINT_STATUS.code("等待区")));
|
||||||
.eq(BstIvtBoxstack::getPoint_status, BoxStackEnum.POINT_STATUS.code("缓存区"))
|
|
||||||
.eq(BstIvtBoxstack::getX, 1)
|
|
||||||
.eq(BstIvtBoxstack::getIs_used, BoxStackEnum.IS_USED.code("启用")));
|
|
||||||
//遍历相同木箱规格同列不同排的库位是否大于最大数量
|
|
||||||
int currentCanUseCount = 0;
|
|
||||||
for (BstIvtBoxstack bstIvtBoxstack : hcqHasGoodsPointList) {
|
|
||||||
Integer x = bstIvtBoxstack.getX();
|
|
||||||
Integer y = bstIvtBoxstack.getY();
|
|
||||||
List<BstIvtBoxstack> list = boxstackService.list(new LambdaQueryWrapper<BstIvtBoxstack>()
|
|
||||||
.isNull(BstIvtBoxstack::getBox_spec)
|
|
||||||
.eq(BstIvtBoxstack::getY, y)
|
|
||||||
.eq(BstIvtBoxstack::getIs_used, BoxStackEnum.IS_USED.code("启用"))
|
|
||||||
.notIn(BstIvtBoxstack::getX, x)
|
|
||||||
.eq(BstIvtBoxstack::getPoint_status, BoxStackEnum.POINT_STATUS.code("缓存区")));
|
|
||||||
currentCanUseCount += list.size();
|
|
||||||
}
|
|
||||||
if (currentCanUseCount <= 3) {
|
|
||||||
List<String> taskTypes = new ArrayList<>(Collections.singletonList(BoxStackEnum.TASK_TYPE.code("木箱移库")));
|
|
||||||
List<SchBaseTask> existTask = taskService.getExistTasks(taskTypes);
|
|
||||||
if (existTask.size() >= 3) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//如果存在则根据装箱计划获取需要移库的木箱规格的数量
|
|
||||||
int needBoxNum = 10;
|
|
||||||
int hasBoxNum = hasGoodsPoint.stream()
|
|
||||||
.map(BstIvtBoxstack::getCurrent_layer_count)
|
|
||||||
.filter(Objects::nonNull)
|
|
||||||
.mapToInt(Integer::intValue)
|
|
||||||
.sum();
|
|
||||||
//如果需要的木箱数量小于木箱库内的该木箱规格的数量
|
|
||||||
if (needBoxNum <= hasBoxNum) {
|
|
||||||
List<BstIvtBoxstack> sortedList = hasGoodsPoint.stream()
|
|
||||||
.sorted(Comparator
|
|
||||||
.comparing(BstIvtBoxstack::getY)
|
|
||||||
.thenComparing(Comparator.comparingInt(BstIvtBoxstack::getX).reversed()))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
List<BstIvtBoxstack> selected = new ArrayList<>();
|
|
||||||
int total = 0;
|
|
||||||
for (BstIvtBoxstack boxstack : sortedList) {
|
|
||||||
if (total >= needBoxNum) break;
|
|
||||||
Integer layerCount = boxstack.getCurrent_layer_count();
|
|
||||||
selected.add(boxstack);
|
|
||||||
total += layerCount;
|
|
||||||
}
|
|
||||||
String task_group_id = IdUtil.getStringId();
|
|
||||||
for (int i = 0; i < selected.size(); i++) {
|
|
||||||
JSONObject requestParam = new JSONObject();
|
|
||||||
requestParam.put("needQty", needBoxNum);
|
|
||||||
JSONObject taskParam = new JSONObject();
|
|
||||||
taskParam.put("task_group_id", task_group_id);
|
|
||||||
taskParam.put("material_code", box_spec);
|
|
||||||
taskParam.put("vehicle_code2", BoxStackEnum.AGV_ACTION_TYPE.code("取放货二次分配"));
|
|
||||||
taskParam.put("task_type", BoxStackEnum.TASK_TYPE.code("木箱移库"));
|
|
||||||
taskParam.put("vehicle_code", null);
|
|
||||||
taskParam.put("point_code1", BoxStackEnum.AGV_WAIT_POINT.code("木箱等待点1"));
|
|
||||||
taskParam.put("point_code2", BoxStackEnum.AGV_WAIT_POINT.code("木箱等待点2"));
|
|
||||||
taskParam.put("requestParam", requestParam);
|
|
||||||
mxMoveTask.createTask(taskParam);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
String task_group_id = IdUtil.getStringId();
|
|
||||||
//如果需要的该木箱规格的数量大于木箱库内的数量
|
|
||||||
for (int i = 0; i < hasGoodsPoint.size(); i++) {
|
|
||||||
JSONObject requestParam = new JSONObject();
|
|
||||||
requestParam.put("needQty", hasBoxNum);
|
|
||||||
JSONObject taskParam = new JSONObject();
|
|
||||||
taskParam.put("task_group_id", task_group_id);
|
|
||||||
taskParam.put("material_code", box_spec);
|
|
||||||
taskParam.put("vehicle_code2", BoxStackEnum.AGV_ACTION_TYPE.code("取放货二次分配"));
|
|
||||||
taskParam.put("task_type", BoxStackEnum.TASK_TYPE.code("木箱移库"));
|
|
||||||
taskParam.put("vehicle_code", null);
|
|
||||||
taskParam.put("point_code1", BoxStackEnum.AGV_WAIT_POINT.code("木箱等待点1"));
|
|
||||||
taskParam.put("point_code2", BoxStackEnum.AGV_WAIT_POINT.code("木箱等待点2"));
|
|
||||||
taskParam.put("requestParam", requestParam);
|
|
||||||
mxMoveTask.createTask(taskParam);
|
|
||||||
}
|
|
||||||
// for (BstIvtBoxstack bstIvtBoxstack : hasGoodsPoint) {
|
|
||||||
// List<BstIvtBoxStockUpPlan> boxstacklayerList = boxstacklayerService.list(new LambdaQueryWrapper<BstIvtBoxStockUpPlan>()
|
|
||||||
// .eq(BstIvtBoxStockUpPlan::getStack_id, bstIvtBoxstack.getStack_id()));
|
|
||||||
// String vehicle_code = boxstacklayerList.stream()
|
|
||||||
// .map(BstIvtBoxStockUpPlan::getBox_code)
|
|
||||||
// .filter(Objects::nonNull)
|
|
||||||
// .filter(boxNo -> !boxNo.isEmpty())
|
|
||||||
// .collect(Collectors.joining(","));
|
|
||||||
|
|
||||||
// }
|
if (waitPoint == null) {
|
||||||
//TODO 是否修改装箱计划中剩余需要移库木箱的数量
|
log.warn("列 {} 没有找到等待区库位", y);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < columns.size(); i++) {
|
||||||
|
if (createdTaskCount >= stock_up_num) break;
|
||||||
|
|
||||||
|
List<BstIvtBoxstack> nextList = boxstackService.list(new LambdaQueryWrapper<BstIvtBoxstack>()
|
||||||
|
.and(wrapper -> wrapper
|
||||||
|
.isNull(BstIvtBoxstack::getBox_spec)
|
||||||
|
.or()
|
||||||
|
.eq(BstIvtBoxstack::getBox_spec, "")
|
||||||
|
)
|
||||||
|
.eq(BstIvtBoxstack::getPoint_status, BoxStackEnum.POINT_STATUS.code("缓存区"))
|
||||||
|
.eq(BstIvtBoxstack::getIs_used, BoxStackEnum.IS_USED.code("启用"))
|
||||||
|
.eq(BstIvtBoxstack::getCurrent_layer_count, 0));
|
||||||
|
String point_code2 = null;
|
||||||
|
List<String> point_code2List = taskList.stream().map(task -> task.getString("point_code2")).collect(Collectors.toList());
|
||||||
|
for (int j = 0; j < nextList.size(); j++) {
|
||||||
|
BstIvtBoxstack bstIvtBoxstack = nextList.get(j);
|
||||||
|
List<SchBaseTask> baseTasks = taskService.checkHaveTaskByNext(Arrays.asList(bstIvtBoxstack.getStack_code()));
|
||||||
|
if (CollectionUtils.isEmpty(baseTasks) && !point_code2List.contains(bstIvtBoxstack.getStack_code())) {
|
||||||
|
point_code2 = bstIvtBoxstack.getStack_code();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (point_code2 == null) {
|
||||||
|
log.warn("缓存区没有空位");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// 构建任务参数
|
||||||
|
JSONObject requestParam = new JSONObject();
|
||||||
|
JSONObject taskParam = new JSONObject();
|
||||||
|
taskParam.put("task_group_id", task_group_id);
|
||||||
|
taskParam.put("material_code", box_spec);
|
||||||
|
taskParam.put("vehicle_code2", BoxStackEnum.AGV_ACTION_TYPE.code("取货二次分配"));
|
||||||
|
taskParam.put("task_type", BoxStackEnum.TASK_TYPE.code("木箱移库"));
|
||||||
|
taskParam.put("vehicle_code", null);
|
||||||
|
taskParam.put("point_code1", waitPoint.getStack_code());
|
||||||
|
taskParam.put("point_code2", point_code2);
|
||||||
|
taskParam.put("requestParam", requestParam);
|
||||||
|
// 创建任务
|
||||||
|
taskList.add(taskParam);
|
||||||
|
createdTaskCount++;
|
||||||
|
}
|
||||||
|
if (createdTaskCount >= stock_up_num) break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (taskList.size() == stock_up_num) {
|
||||||
|
for (JSONObject taskParam : taskList) {
|
||||||
|
mxMoveTask.createTask(taskParam);
|
||||||
|
}
|
||||||
|
stockUpPlan.setStock_plan_status(BoxStackEnum.STOCK_UP_STATUS.code("执行中"));
|
||||||
|
stockUpPlan.setRemark("");
|
||||||
|
stockUpPlan.setUpdate_time(DateUtil.now());
|
||||||
|
stockUpPlanService.updateById(stockUpPlan);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (StringUtils.isBlank(stockUpPlan.getRemark())) {
|
||||||
|
stockUpPlan.setRemark("木箱缓存区空位不足,暂时不生成任务");
|
||||||
|
stockUpPlan.setUpdate_time(DateUtil.now());
|
||||||
|
stockUpPlanService.updateById(stockUpPlan);
|
||||||
|
}
|
||||||
|
} else if (lingSanQuList.size() >= stock_up_num) {
|
||||||
|
//查询零散区该规格数量
|
||||||
|
String task_group_id = stockUpPlan.getStockup_plan_id();
|
||||||
|
// 已生成任务数
|
||||||
|
int createdTaskCount = 0;
|
||||||
|
List<JSONObject> taskList = new ArrayList<>();
|
||||||
|
for (int i = 0; i < lingSanQuList.size(); i++) {
|
||||||
|
if (createdTaskCount >= stock_up_num) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
BstIvtBoxstack bstIvtBoxstack = lingSanQuList.get(i);
|
||||||
|
List<BstIvtBoxstack> emptyPointList = boxstackService.list(new LambdaQueryWrapper<BstIvtBoxstack>()
|
||||||
|
.and(wrapper -> wrapper
|
||||||
|
.isNull(BstIvtBoxstack::getBox_spec)
|
||||||
|
.or()
|
||||||
|
.eq(BstIvtBoxstack::getBox_spec, "")
|
||||||
|
)
|
||||||
|
.eq(BstIvtBoxstack::getPoint_status, BoxStackEnum.POINT_STATUS.code("缓存区"))
|
||||||
|
.eq(BstIvtBoxstack::getIs_used, BoxStackEnum.IS_USED.code("启用"))
|
||||||
|
.eq(BstIvtBoxstack::getCurrent_layer_count, 0));
|
||||||
|
List<String> point_code2List = taskList.stream().map(task -> task.getString("point_code2")).collect(Collectors.toList());
|
||||||
|
for (BstIvtBoxstack ivtBoxstack : emptyPointList) {
|
||||||
|
List<SchBaseTask> schBaseTasks = taskService.checkHaveTaskByNext(Arrays.asList(ivtBoxstack.getStack_code()));
|
||||||
|
if (!CollectionUtils.isEmpty(schBaseTasks) || point_code2List.contains(ivtBoxstack.getStack_code())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
JSONObject taskParam = new JSONObject();
|
||||||
|
JSONObject requestParam = new JSONObject();
|
||||||
|
taskParam.put("task_group_id", task_group_id);
|
||||||
|
taskParam.put("material_code", box_spec);
|
||||||
|
taskParam.put("vehicle_code2", BoxStackEnum.AGV_ACTION_TYPE.code("普通任务"));
|
||||||
|
taskParam.put("task_type", BoxStackEnum.TASK_TYPE.code("木箱移库"));
|
||||||
|
taskParam.put("vehicle_code", bstIvtBoxstack.getBox_no());
|
||||||
|
taskParam.put("point_code1", bstIvtBoxstack.getStack_code());
|
||||||
|
taskParam.put("point_code2", ivtBoxstack.getStack_code());
|
||||||
|
taskParam.put("requestParam", requestParam);
|
||||||
|
taskList.add(taskParam);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
createdTaskCount++;
|
||||||
|
}
|
||||||
|
if (taskList.size() == stock_up_num) {
|
||||||
|
for (JSONObject taskParam : taskList) {
|
||||||
|
mxMoveTask.createTask(taskParam);
|
||||||
|
}
|
||||||
|
stockUpPlan.setRemark("");
|
||||||
|
stockUpPlan.setStock_plan_status(BoxStackEnum.STOCK_UP_STATUS.code("执行中"));
|
||||||
|
stockUpPlanService.updateById(stockUpPlan);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (StringUtils.isBlank(stockUpPlan.getRemark())) {
|
||||||
|
stockUpPlan.setRemark("木箱缓存区空位不足,暂时不生成任务");
|
||||||
|
stockUpPlan.setUpdate_time(DateUtil.now());
|
||||||
|
stockUpPlanService.updateById(stockUpPlan);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (StringUtils.isBlank(stockUpPlan.getRemark())) {
|
||||||
|
stockUpPlan.setRemark("密集区或零散区该规格数量小于备货数量,暂时不生成任务");
|
||||||
|
stockUpPlan.setUpdate_time(DateUtil.now());
|
||||||
|
stockUpPlanService.updateById(stockUpPlan);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ package org.nl.b_lms.storage_manage.database.controller;
|
|||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import org.nl.b_lms.pdm.subpackagerelation.service.IpdmBiSubpackagerelationService;
|
import org.nl.b_lms.pdm.subpackagerelation.service.IpdmBiSubpackagerelationService;
|
||||||
import org.nl.b_lms.storage_manage.database.service.IBstIvtBoxinfoService;
|
import org.nl.b_lms.storage_manage.database.service.IBstIvtBoxinfoService;
|
||||||
|
import org.nl.b_lms.storage_manage.database.service.dao.BstIvtBoxinfo;
|
||||||
import org.nl.modules.logging.annotation.Log;
|
import org.nl.modules.logging.annotation.Log;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@@ -37,7 +38,7 @@ public class BstIvtBoxinfoController {
|
|||||||
|
|
||||||
@GetMapping("/boxivtquery")
|
@GetMapping("/boxivtquery")
|
||||||
@Log("查询木箱库存信息")
|
@Log("查询木箱库存信息")
|
||||||
public ResponseEntity<Object> boxIvtQuery(@RequestParam Map whereJson, Pageable page) {
|
public ResponseEntity<Object> boxIvtQuery(@RequestParam Map whereJson, Pageable page) {
|
||||||
return new ResponseEntity<>(iBstIvtBoxinfoService.boxIvtQuery(whereJson, page), HttpStatus.OK);
|
return new ResponseEntity<>(iBstIvtBoxinfoService.boxIvtQuery(whereJson, page), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,6 +48,13 @@ public class BstIvtBoxinfoController {
|
|||||||
return new ResponseEntity<>(iBstIvtBoxinfoService.saveBoxInfo(jsonObject), HttpStatus.OK);
|
return new ResponseEntity<>(iBstIvtBoxinfoService.saveBoxInfo(jsonObject), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PutMapping
|
||||||
|
@Log("修改木箱信息")
|
||||||
|
public ResponseEntity<Object> updateBoxInfo(@RequestBody JSONObject jsonObject) {
|
||||||
|
iBstIvtBoxinfoService.updateBoxInfo(jsonObject);
|
||||||
|
return new ResponseEntity<>( HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping("/getBoxInfo")
|
@PostMapping("/getBoxInfo")
|
||||||
@Log("查询木箱信息")
|
@Log("查询木箱信息")
|
||||||
public ResponseEntity<Object> query(@RequestBody JSONObject jsonObject) {
|
public ResponseEntity<Object> query(@RequestBody JSONObject jsonObject) {
|
||||||
|
|||||||
@@ -54,4 +54,6 @@ public interface IBstIvtBoxinfoService extends IService<BstIvtBoxinfo> {
|
|||||||
* @return 木箱信息
|
* @return 木箱信息
|
||||||
*/
|
*/
|
||||||
Object boxIvtQuery(Map whereJson, Pageable page);
|
Object boxIvtQuery(Map whereJson, Pageable page);
|
||||||
|
|
||||||
|
void updateBoxInfo(JSONObject jsonObject);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,14 +3,13 @@
|
|||||||
<mapper namespace="org.nl.b_lms.storage_manage.database.service.dao.mapper.BstIvtBoxinfoMapper">
|
<mapper namespace="org.nl.b_lms.storage_manage.database.service.dao.mapper.BstIvtBoxinfoMapper">
|
||||||
<select id="getPageQuery" resultType="java.util.Map">
|
<select id="getPageQuery" resultType="java.util.Map">
|
||||||
SELECT
|
SELECT
|
||||||
stack_stat.box_spec,
|
stack_stat.box_spec as material_code,
|
||||||
stack_stat.total_layer_count,
|
stack_stat.total_layer_count as ivt_num,
|
||||||
MAX(box.material_name) AS material_name,
|
MAX(box.material_name) AS material_name,
|
||||||
MAX(box.box_length) AS box_length,
|
MAX(box.box_length) AS box_length,
|
||||||
MAX(box.box_width) AS box_width,
|
MAX(box.box_width) AS box_width,
|
||||||
MAX(box.box_high) AS box_high,
|
MAX(box.box_high) AS box_high,
|
||||||
MAX(box.num) AS num,
|
MAX(box.num) AS num
|
||||||
COUNT(box.material_code) AS ivt_num
|
|
||||||
FROM
|
FROM
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
@@ -22,6 +21,7 @@
|
|||||||
is_used = '1'
|
is_used = '1'
|
||||||
AND box_spec IS NOT NULL
|
AND box_spec IS NOT NULL
|
||||||
AND box_spec != ''
|
AND box_spec != ''
|
||||||
|
AND point_status = '3'
|
||||||
GROUP BY
|
GROUP BY
|
||||||
box_spec
|
box_spec
|
||||||
) stack_stat
|
) stack_stat
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ public class BstIvtBoxinfoServiceImpl extends ServiceImpl<BstIvtBoxinfoMapper, B
|
|||||||
if (whereJson.containsKey("is_packing")) {
|
if (whereJson.containsKey("is_packing")) {
|
||||||
queryWrapper.eq(BstIvtBoxinfo::getIs_packing, whereJson.get("is_packing"));
|
queryWrapper.eq(BstIvtBoxinfo::getIs_packing, whereJson.get("is_packing"));
|
||||||
}
|
}
|
||||||
queryWrapper.orderByDesc(BstIvtBoxinfo::getInsert_time);
|
queryWrapper.orderByDesc(BstIvtBoxinfo::getBox_no);
|
||||||
IPage<BstIvtBoxinfo> result = bstIvtBoxinfoMapper.selectPage(new Page<>(page.getPageNumber() + 1, page.getPageSize()), queryWrapper);
|
IPage<BstIvtBoxinfo> result = bstIvtBoxinfoMapper.selectPage(new Page<>(page.getPageNumber() + 1, page.getPageSize()), queryWrapper);
|
||||||
mapReslt.put("content", result.getRecords());
|
mapReslt.put("content", result.getRecords());
|
||||||
mapReslt.put("totalElements", result.getTotal());
|
mapReslt.put("totalElements", result.getTotal());
|
||||||
@@ -213,4 +213,18 @@ public class BstIvtBoxinfoServiceImpl extends ServiceImpl<BstIvtBoxinfoMapper, B
|
|||||||
build.setTotalElements(page.getTotal());
|
build.setTotalElements(page.getTotal());
|
||||||
return build;
|
return build;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateBoxInfo(JSONObject jsonObject) {
|
||||||
|
String box_id = jsonObject.getString("box_id");
|
||||||
|
BstIvtBoxinfo boxinfo = this.getById(box_id);
|
||||||
|
if (boxinfo == null){
|
||||||
|
throw new BadRequestException("未查询到该木箱对应的木箱信息");
|
||||||
|
}
|
||||||
|
boxinfo.setIs_packing(jsonObject.getString("is_packing"));
|
||||||
|
boxinfo.setNum(jsonObject.getString("num"));
|
||||||
|
boxinfo.setBox_weight(jsonObject.getString("box_weight"));
|
||||||
|
boxinfo.setVehicle_type(jsonObject.getString("vehicle_type"));
|
||||||
|
this.updateById(boxinfo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -213,7 +213,6 @@ public class AcsToWmsController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/secondaryAllocationPoint")
|
@PostMapping("/secondaryAllocationPoint")
|
||||||
@Log("二次分配")
|
|
||||||
@SaIgnore
|
@SaIgnore
|
||||||
ResponseEntity<Object> secondaryAllocationPoint(@RequestBody JSONObject whereJson) {
|
ResponseEntity<Object> secondaryAllocationPoint(@RequestBody JSONObject whereJson) {
|
||||||
log.info("木箱库二次分配接口请求参数:---------------------------------------------" + whereJson.toString());
|
log.info("木箱库二次分配接口请求参数:---------------------------------------------" + whereJson.toString());
|
||||||
@@ -224,4 +223,10 @@ public class AcsToWmsController {
|
|||||||
}
|
}
|
||||||
return new ResponseEntity<>(acsToWmsService.secondaryAllocationPoint(taskCode, actionType), HttpStatus.OK);
|
return new ResponseEntity<>(acsToWmsService.secondaryAllocationPoint(taskCode, actionType), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/agvActionRequest")
|
||||||
|
@SaIgnore
|
||||||
|
ResponseEntity<Object> agvActionrequest(@RequestBody JSONObject whereJson) {
|
||||||
|
return new ResponseEntity<>(acsToWmsService.agvActionRequest(whereJson), HttpStatus.OK);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -221,4 +221,12 @@ public interface AcsToWmsService {
|
|||||||
* @return JSONObject 返回信息
|
* @return JSONObject 返回信息
|
||||||
*/
|
*/
|
||||||
Map<String, Object> secondaryAllocationPoint(String taskCode, String actionType);
|
Map<String, Object> secondaryAllocationPoint(String taskCode, String actionType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AGV动作请求
|
||||||
|
*
|
||||||
|
* @param whereJson
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Map<String, Object> agvActionRequest(JSONObject whereJson);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2054,34 +2054,18 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
|||||||
SchBaseTask task = taskService.getOne(new LambdaQueryWrapper<SchBaseTask>().eq(SchBaseTask::getTask_code, taskCode));
|
SchBaseTask task = taskService.getOne(new LambdaQueryWrapper<SchBaseTask>().eq(SchBaseTask::getTask_code, taskCode));
|
||||||
switch (actionType) {
|
switch (actionType) {
|
||||||
case "2":
|
case "2":
|
||||||
if (StrUtil.equals(task.getTask_type(), BoxStackEnum.TASK_TYPE.code("木箱出库"))) {
|
|
||||||
|
|
||||||
}
|
|
||||||
// 取货分配
|
// 取货分配
|
||||||
//pointCode = getNewPoint(taskCode, actionType);
|
pointCode = mxMoveTask.againGetPoint(taskCode);
|
||||||
result.put("data", pointCode);
|
result.put("data", pointCode);
|
||||||
result.put("message", taskCode + "取放货分配成功,新点位为:" + pointCode);
|
result.put("message", taskCode + "取放货分配成功,新点位为:" + pointCode);
|
||||||
break;
|
break;
|
||||||
case "3":
|
case "3":
|
||||||
//放货二次分配
|
//放货二次分配
|
||||||
if (StrUtil.equals(task.getTask_type(), BoxStackEnum.TASK_TYPE.code("木箱入库"))) {
|
pointCode = mxInTask.againPutPoint(taskCode);
|
||||||
mxInTask.againPutPoint(taskCode);
|
result.put("data", pointCode);
|
||||||
}
|
result.put("message", taskCode + "取放货分配成功,新点位为:" + pointCode);
|
||||||
|
break;
|
||||||
case "4":
|
case "4":
|
||||||
if (StrUtil.equals(task.getTask_type(), BoxStackEnum.TASK_TYPE.code("木箱移库"))) {
|
|
||||||
//判断起点是否还是等待点,如果是的话就是取货二次分配
|
|
||||||
//否则判断终点是否还是等待点,如果是的话就是放货二次分配
|
|
||||||
if (StrUtil.equals("","")){
|
|
||||||
mxMoveTask.againGetPoint(taskCode);
|
|
||||||
} else if (StrUtil.equals("","")){
|
|
||||||
mxMoveTask.againPutPoint(taskCode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 取货放货二次分配
|
|
||||||
//updatePointStatus(taskCode, actionType);
|
|
||||||
action = taskCode + "取放货完成!";
|
|
||||||
result.put("data", action);
|
|
||||||
result.put("message", taskCode + "取放货完成!");
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
@@ -2100,4 +2084,19 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
|||||||
log.info("一楼装箱区点位二次分配" + taskCode + "---------------------------------------------" + result);
|
log.info("一楼装箱区点位二次分配" + taskCode + "---------------------------------------------" + result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> agvActionRequest(JSONObject whereJson) {
|
||||||
|
log.info("木箱库AGV取放货动作请求,请求参数:" + whereJson);
|
||||||
|
String taskCode = whereJson.getString("taskCode");
|
||||||
|
String actionType = whereJson.getString("actionType");
|
||||||
|
if (StrUtil.equals(BoxStackEnum.TASK_ACTION_TYPE.code("取货完成"), actionType)) {
|
||||||
|
mxMoveTask.getFinish(taskCode);
|
||||||
|
}
|
||||||
|
Map<String, Object> result = new HashMap<>();
|
||||||
|
result.put("status", "200");
|
||||||
|
result.put("message", "请求成功");
|
||||||
|
log.info("木箱库AGV取放货动作请求完成,响应参数:" + result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,6 +68,16 @@
|
|||||||
@change="hand"
|
@change="hand"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="是否有货">
|
||||||
|
<el-switch
|
||||||
|
v-model="query.isHasGoods"
|
||||||
|
active-value="0"
|
||||||
|
inactive-value="1"
|
||||||
|
active-color="#C0CCDA"
|
||||||
|
inactive-color="#409EFF"
|
||||||
|
@change="hand"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
<rrOperation :crud="crud" />
|
<rrOperation :crud="crud" />
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -0,0 +1,246 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<!--工具栏-->
|
||||||
|
<div class="head-container">
|
||||||
|
<div v-if="crud.props.searchToggle">
|
||||||
|
<!-- 搜索 -->
|
||||||
|
<el-form
|
||||||
|
:inline="true"
|
||||||
|
class="demo-form-inline"
|
||||||
|
label-position="right"
|
||||||
|
label-width="90px"
|
||||||
|
label-suffix=":"
|
||||||
|
>
|
||||||
|
<el-form-item label="木箱信息">
|
||||||
|
<el-input
|
||||||
|
v-model="query.box_info"
|
||||||
|
clearable
|
||||||
|
placeholder="输入木箱信息"
|
||||||
|
style="width: 185px;"
|
||||||
|
class="filter-item"
|
||||||
|
@keyup.enter.native="crud.toQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备货状态">
|
||||||
|
<el-select
|
||||||
|
v-model="query.stock_plan_status"
|
||||||
|
clearable
|
||||||
|
filterable
|
||||||
|
size="mini"
|
||||||
|
class="filter-item"
|
||||||
|
style="width: 185px;"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in dict.stock_plan_status"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<rrOperation :crud="crud" />
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||||
|
<crudOperation :permission="permission" />
|
||||||
|
<!--表单组件-->
|
||||||
|
<el-dialog
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
:before-close="crud.cancelCU"
|
||||||
|
:visible.sync="crud.status.cu > 0"
|
||||||
|
:title="crud.status.title"
|
||||||
|
width="500px"
|
||||||
|
>
|
||||||
|
<br>
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" size="mini" label-width="120px">
|
||||||
|
<el-form-item label="木箱规格" prop="box_spec">
|
||||||
|
<el-input
|
||||||
|
v-model="form.box_spec"
|
||||||
|
style="width: 300px;"
|
||||||
|
clearable
|
||||||
|
@click.native="openMaterialDialog"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="木箱规格名称" prop="box_spec_name">
|
||||||
|
<el-input v-model="form.box_spec_name" disabled style="width: 300px;" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备货数量" prop="stock_up_num">
|
||||||
|
<el-input
|
||||||
|
v-model.number="form.stock_up_num"
|
||||||
|
style="width: 300px;"
|
||||||
|
oninput="this.value = this.value.replace(/[^0-9]/g, '')"
|
||||||
|
placeholder="请输入大于等于1的整数"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="text" @click="crud.cancelCU">取消</el-button>
|
||||||
|
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
<!--表格渲染-->
|
||||||
|
<el-table
|
||||||
|
ref="table"
|
||||||
|
v-loading="crud.loading"
|
||||||
|
:data="crud.data"
|
||||||
|
size="mini"
|
||||||
|
:row-style="rowStyle"
|
||||||
|
style="width: 100%;"
|
||||||
|
@selection-change="crud.selectionChangeHandler"
|
||||||
|
>
|
||||||
|
<el-table-column type="selection" width="55" />
|
||||||
|
<el-table-column prop="box_spec" label="木箱规格" width="140px" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="box_spec_name" label="木箱规格名称" width="200px" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="stock_up_num" label="木箱备货数量" width="100px" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="stock_plan_status" label="备货状态" show-overflow-tooltip>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ dict.label.stock_plan_status[scope.row.stock_plan_status] }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="remark" label="备注" width="150px" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="created_name" label="创建人" min-width="150" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="created_time" label="创建时间" min-width="150" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="update_name" label="修改人" min-width="150" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="update_time" label="修改时间" min-width="150" show-overflow-tooltip />
|
||||||
|
<el-table-column v-permission="[]" label="操作" width="200px" align="center" fixed="right">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<udOperation
|
||||||
|
style="display: inline"
|
||||||
|
:data="scope.row"
|
||||||
|
:permission="permission"
|
||||||
|
:is-visiable-del="false"
|
||||||
|
/>
|
||||||
|
<el-button slot="right" size="mini" type="text" icon="el-icon-success" @click="doOperate(scope.row)">完成</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<!--分页组件-->
|
||||||
|
<pagination />
|
||||||
|
</div>
|
||||||
|
<mater-dialog
|
||||||
|
:key="materialDialogKey"
|
||||||
|
ref="materDialog"
|
||||||
|
:dialog-show="dialogMaterialVisible"
|
||||||
|
is-single
|
||||||
|
mater-opt-code="木箱"
|
||||||
|
@handleSetMaterialValue="handleSetMaterialValue"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import crudStockUpPlan from './stock_up_plan'
|
||||||
|
import CRUD, { crud, form, header, presenter } from '@crud/crud'
|
||||||
|
import rrOperation from '@crud/RR.operation'
|
||||||
|
import crudOperation from '@crud/CRUD.operation'
|
||||||
|
import udOperation from '@crud/UD.operation'
|
||||||
|
import pagination from '@crud/Pagination'
|
||||||
|
import MaterDialog from '../MaterDialog'
|
||||||
|
|
||||||
|
const defaultForm = {
|
||||||
|
stockup_plan_id: null,
|
||||||
|
box_spec: null,
|
||||||
|
box_spec_name: null,
|
||||||
|
stock_up_num: 1,
|
||||||
|
stock_plan_status: null,
|
||||||
|
remark: null,
|
||||||
|
create_id: null,
|
||||||
|
create_name: null,
|
||||||
|
create_time: null,
|
||||||
|
update_id: null,
|
||||||
|
update_name: null,
|
||||||
|
update_time: null
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'StockUpPlan',
|
||||||
|
components: { pagination, crudOperation, rrOperation, udOperation, MaterDialog },
|
||||||
|
dicts: ['stock_plan_status'],
|
||||||
|
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||||
|
cruds() {
|
||||||
|
return CRUD({
|
||||||
|
title: '木箱备货计划',
|
||||||
|
url: 'api/bstIvtBoxStockUpPlan',
|
||||||
|
idField: 'stockup_plan_id',
|
||||||
|
sort: 'stockup_plan_id,desc',
|
||||||
|
crudMethod: { ...crudStockUpPlan },
|
||||||
|
optShow: {
|
||||||
|
add: true,
|
||||||
|
edit: true,
|
||||||
|
del: true,
|
||||||
|
download: false,
|
||||||
|
reset: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
permission: {},
|
||||||
|
dialogMaterialVisible: false,
|
||||||
|
materialDialogKey: 0,
|
||||||
|
rules: {
|
||||||
|
box_spec: [
|
||||||
|
{ required: true, message: '木箱规格不能为空', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
box_spec_name: [
|
||||||
|
{ required: true, message: '木箱规格名称不能为空', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
stock_up_num: [
|
||||||
|
{ required: true, message: '木箱备货数量不能为空', trigger: 'blur' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||||
|
[CRUD.HOOK.beforeRefresh]() {
|
||||||
|
return true
|
||||||
|
},
|
||||||
|
doOperate(row) {
|
||||||
|
crudStockUpPlan.finish(row).then(res => {
|
||||||
|
this.crud.toQuery()
|
||||||
|
this.crud.notify('操作成功', 'success')
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleBoxNoBlur(value) {
|
||||||
|
console.log(value)
|
||||||
|
if (!value || value.trim() === '') {
|
||||||
|
this.form.current_layer_count = 0
|
||||||
|
} else {
|
||||||
|
const boxNoArray = value.split(',')
|
||||||
|
this.form.current_layer_count = boxNoArray.length
|
||||||
|
}
|
||||||
|
},
|
||||||
|
openMaterialDialog() {
|
||||||
|
if (this.crud.status.edit > 0) return // 如果是编辑状态,则不允许重新选择
|
||||||
|
this.dialogMaterialVisible = true
|
||||||
|
this.materialDialogKey += 1
|
||||||
|
},
|
||||||
|
handleSetMaterialValue(material) {
|
||||||
|
this.form.box_spec = material.material_code
|
||||||
|
this.form.box_spec_name = material.material_name
|
||||||
|
this.dialogMaterialVisible = false
|
||||||
|
},
|
||||||
|
rowStyle({ row, index }) {
|
||||||
|
const backgroun = {}
|
||||||
|
if (row.container_name != null && row.update_time != null && row.update_time != undefined) {
|
||||||
|
const now = new Date()
|
||||||
|
const before = new Date(row.update_time)
|
||||||
|
const diff = now.getTime() - before.getTime()
|
||||||
|
const min = Math.floor(diff / (1000 * 60))
|
||||||
|
console.log(min)
|
||||||
|
if (min > 120) {
|
||||||
|
backgroun.background = 'red'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return backgroun
|
||||||
|
},
|
||||||
|
hand(value) {
|
||||||
|
this.crud.toQuery()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
export function add(data) {
|
||||||
|
return request({
|
||||||
|
url: 'api/bstIvtBoxStockUpPlan',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function del(ids) {
|
||||||
|
return request({
|
||||||
|
url: 'api/bstIvtBoxStockUpPlan',
|
||||||
|
method: 'delete',
|
||||||
|
data: ids
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function edit(data) {
|
||||||
|
return request({
|
||||||
|
url: 'api/bstIvtBoxStockUpPlan',
|
||||||
|
method: 'put',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function finish(data) {
|
||||||
|
return request({
|
||||||
|
url: 'api/bstIvtBoxStockUpPlan/finish',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export default { add, edit, del, finish }
|
||||||
Reference in New Issue
Block a user