no message
parent
0bc5829e0a
commit
ae7f78db63
|
|
@ -34,6 +34,7 @@ public interface LogService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询
|
* 分页查询
|
||||||
|
*
|
||||||
* @param criteria 查询条件
|
* @param criteria 查询条件
|
||||||
* @param pageable 分页参数
|
* @param pageable 分页参数
|
||||||
* @return /
|
* @return /
|
||||||
|
|
@ -42,6 +43,7 @@ public interface LogService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询全部数据
|
* 查询全部数据
|
||||||
|
*
|
||||||
* @param criteria 查询条件
|
* @param criteria 查询条件
|
||||||
* @return /
|
* @return /
|
||||||
*/
|
*/
|
||||||
|
|
@ -49,6 +51,7 @@ public interface LogService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询用户日志
|
* 查询用户日志
|
||||||
|
*
|
||||||
* @param criteria 查询条件
|
* @param criteria 查询条件
|
||||||
* @param pageable 分页参数
|
* @param pageable 分页参数
|
||||||
* @return -
|
* @return -
|
||||||
|
|
@ -57,19 +60,23 @@ public interface LogService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存日志数据
|
* 保存日志数据
|
||||||
|
*
|
||||||
* @param username 用户
|
* @param username 用户
|
||||||
* @param browser 浏览器
|
* @param browser 浏览器
|
||||||
* @param ip 请求IP
|
* @param ip 请求IP
|
||||||
* @param joinPoint /
|
* @param joinPoint /
|
||||||
* @param log 日志实体
|
* @param log 日志实体
|
||||||
*/
|
*/
|
||||||
@Async
|
|
||||||
void save(String url, String returnValue, String username, String browser, String ip, JoinPoint joinPoint, Log log);
|
void save(String url, String returnValue, String username, String browser, String ip, JoinPoint joinPoint, Log log);
|
||||||
|
|
||||||
@Async
|
|
||||||
void saveLog(Log log);
|
void saveLog(Log log);
|
||||||
|
|
||||||
|
void saveLogInfo(Object object, String ip, String url, String resultJson, String description, long time, String logType);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询异常详情
|
* 查询异常详情
|
||||||
|
*
|
||||||
* @param id 日志ID
|
* @param id 日志ID
|
||||||
* @return Object
|
* @return Object
|
||||||
*/
|
*/
|
||||||
|
|
@ -77,6 +84,7 @@ public interface LogService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出日志
|
* 导出日志
|
||||||
|
*
|
||||||
* @param logs 待导出的数据
|
* @param logs 待导出的数据
|
||||||
* @param response /
|
* @param response /
|
||||||
* @throws IOException /
|
* @throws IOException /
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ import cn.hutool.core.lang.Dict;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.json.JSONObject;
|
import cn.hutool.json.JSONObject;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.youchain.domain.Log;
|
import com.youchain.domain.Log;
|
||||||
import com.youchain.repository.LogRepository;
|
import com.youchain.repository.LogRepository;
|
||||||
import com.youchain.service.LogService;
|
import com.youchain.service.LogService;
|
||||||
|
|
@ -34,6 +35,7 @@ import org.aspectj.lang.ProceedingJoinPoint;
|
||||||
import org.aspectj.lang.reflect.MethodSignature;
|
import org.aspectj.lang.reflect.MethodSignature;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
|
@ -43,6 +45,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.lang.reflect.Parameter;
|
import java.lang.reflect.Parameter;
|
||||||
|
import java.sql.Timestamp;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -77,9 +80,9 @@ public class LogServiceImpl implements LogService {
|
||||||
Page<Log> page = logRepository.findAll(((root, criteriaQuery, cb) -> QueryHelp.getPredicate(root, criteria, cb)), pageable);
|
Page<Log> page = logRepository.findAll(((root, criteriaQuery, cb) -> QueryHelp.getPredicate(root, criteria, cb)), pageable);
|
||||||
return PageUtil.toPage(page.map(logSmallMapper::toDto));
|
return PageUtil.toPage(page.map(logSmallMapper::toDto));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@Async
|
||||||
public void save(String url,String returnValue,String username, String browser, String ip, JoinPoint joinPoint, Log log_data) {
|
public void save(String url,String returnValue,String username, String browser, String ip, JoinPoint joinPoint, Log log_data) {
|
||||||
if (log_data == null) {
|
if (log_data == null) {
|
||||||
throw new IllegalArgumentException("Log 不能为 null!");
|
throw new IllegalArgumentException("Log 不能为 null!");
|
||||||
|
|
@ -113,6 +116,7 @@ public class LogServiceImpl implements LogService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@Async
|
||||||
public void saveLog(Log log_data) {
|
public void saveLog(Log log_data) {
|
||||||
if (log_data == null) {
|
if (log_data == null) {
|
||||||
throw new IllegalArgumentException("Log 不能为 null!");
|
throw new IllegalArgumentException("Log 不能为 null!");
|
||||||
|
|
@ -120,6 +124,26 @@ public class LogServiceImpl implements LogService {
|
||||||
logRepository.save(log_data);
|
logRepository.save(log_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@Async
|
||||||
|
public void saveLogInfo(Object object,String ip, String url, String resultJson, String description, long time, String logType) {
|
||||||
|
// 设置日志信息
|
||||||
|
Log log_data = new Log();
|
||||||
|
log_data.setDescription(description);
|
||||||
|
log_data.setLogType(logType);
|
||||||
|
log_data.setMethod(url);
|
||||||
|
log_data.setParams(JSON.toJSONString(object));
|
||||||
|
log_data.setReturnData(resultJson);
|
||||||
|
log_data.setRequestIp(ip);
|
||||||
|
log_data.setTime(time);
|
||||||
|
log_data.setUsername("admin");
|
||||||
|
log_data.setAddress("内网IP");
|
||||||
|
log_data.setBrowser("Chrome 123");
|
||||||
|
log_data.setCreateTime(new Timestamp(new Date().getTime()));
|
||||||
|
logRepository.save(log_data);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据方法和传入的参数获取请求参数
|
* 根据方法和传入的参数获取请求参数
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,9 @@
|
||||||
package com.youchain.appupdate.rest;
|
package com.youchain.appupdate.rest;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateTime;
|
|
||||||
import cn.hutool.core.util.NumberUtil;
|
|
||||||
import cn.hutool.json.JSONArray;
|
import cn.hutool.json.JSONArray;
|
||||||
import com.youchain.annotation.AnonymousAccess;
|
import com.youchain.annotation.AnonymousAccess;
|
||||||
import com.youchain.annotation.Log;
|
|
||||||
import com.youchain.appupdate.ReturnJson.RLocLayout;
|
|
||||||
import com.youchain.basicdata.service.impl.PointServiceImpl;
|
|
||||||
import com.youchain.businessdata.domain.AgvTask;
|
|
||||||
import com.youchain.businessdata.repository.AgvTaskRepository;
|
|
||||||
import com.youchain.businessdata.repository.PickDetailRepository;
|
|
||||||
import com.youchain.businessdata.repository.TaskRepository;
|
|
||||||
import com.youchain.businessdata.service.impl.*;
|
import com.youchain.businessdata.service.impl.*;
|
||||||
import com.youchain.report_data.utils.PieChart;
|
import com.youchain.report_data.utils.PieChart;
|
||||||
import com.youchain.utils.AreaNameDic;
|
|
||||||
import com.youchain.utils.BaseStatus;
|
|
||||||
import com.youchain.utils.DateUtil;
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
@ -28,7 +16,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,26 +3,17 @@ package com.youchain.appupdate.rest;
|
||||||
import cn.hutool.core.date.DateTime;
|
import cn.hutool.core.date.DateTime;
|
||||||
import cn.hutool.core.util.NumberUtil;
|
import cn.hutool.core.util.NumberUtil;
|
||||||
import cn.hutool.json.JSONArray;
|
import cn.hutool.json.JSONArray;
|
||||||
import com.alibaba.druid.sql.visitor.functions.Substring;
|
|
||||||
import com.youchain.annotation.AnonymousAccess;
|
import com.youchain.annotation.AnonymousAccess;
|
||||||
import com.youchain.annotation.Log;
|
|
||||||
import com.youchain.appupdate.ReturnJson.RLocLayout;
|
import com.youchain.appupdate.ReturnJson.RLocLayout;
|
||||||
import com.youchain.basicdata.domain.Item;
|
|
||||||
import com.youchain.basicdata.repository.ItemRepository;
|
|
||||||
import com.youchain.basicdata.service.ItemService;
|
|
||||||
import com.youchain.basicdata.service.StockService;
|
|
||||||
import com.youchain.basicdata.service.impl.PointServiceImpl;
|
import com.youchain.basicdata.service.impl.PointServiceImpl;
|
||||||
import com.youchain.businessdata.domain.AgvTask;
|
import com.youchain.businessdata.domain.AgvTask;
|
||||||
import com.youchain.businessdata.repository.AgvTaskRepository;
|
import com.youchain.businessdata.repository.AgvTaskRepository;
|
||||||
import com.youchain.businessdata.repository.AsnDetailRepository;
|
|
||||||
import com.youchain.businessdata.repository.PickDetailRepository;
|
import com.youchain.businessdata.repository.PickDetailRepository;
|
||||||
import com.youchain.businessdata.repository.TaskRepository;
|
|
||||||
import com.youchain.businessdata.service.*;
|
import com.youchain.businessdata.service.*;
|
||||||
import com.youchain.businessdata.service.impl.AsnDetailServiceImpl;
|
import com.youchain.businessdata.service.impl.AsnDetailServiceImpl;
|
||||||
import com.youchain.businessdata.service.impl.InventoryServiceImpl;
|
import com.youchain.businessdata.service.impl.InventoryServiceImpl;
|
||||||
import com.youchain.businessdata.service.impl.PickDetailServiceImpl;
|
import com.youchain.businessdata.service.impl.PickDetailServiceImpl;
|
||||||
import com.youchain.businessdata.service.impl.TaskServiceImpl;
|
import com.youchain.businessdata.service.impl.TaskServiceImpl;
|
||||||
import com.youchain.modules.system.service.DictService;
|
|
||||||
import com.youchain.report_data.utils.PieChart;
|
import com.youchain.report_data.utils.PieChart;
|
||||||
import com.youchain.utils.AreaNameDic;
|
import com.youchain.utils.AreaNameDic;
|
||||||
import com.youchain.utils.BaseStatus;
|
import com.youchain.utils.BaseStatus;
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ import com.youchain.basicdata.service.dto.PointDto;
|
||||||
import com.youchain.basicdata.service.dto.PointQueryCriteria;
|
import com.youchain.basicdata.service.dto.PointQueryCriteria;
|
||||||
import com.youchain.basicdata.service.dto.PointSmallDto;
|
import com.youchain.basicdata.service.dto.PointSmallDto;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
@ -29,15 +30,16 @@ import java.util.Set;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @author liuxue
|
||||||
* @website https://eladmin.vip
|
* @website https://eladmin.vip
|
||||||
* @description 服务接口
|
* @description 服务接口
|
||||||
* @author liuxue
|
|
||||||
* @date 2023-07-26
|
* @date 2023-07-26
|
||||||
**/
|
**/
|
||||||
public interface PointService {
|
public interface PointService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询数据分页
|
* 查询数据分页
|
||||||
|
*
|
||||||
* @param criteria 条件
|
* @param criteria 条件
|
||||||
* @param pageable 分页参数
|
* @param pageable 分页参数
|
||||||
* @return Map<String, Object>
|
* @return Map<String, Object>
|
||||||
|
|
@ -46,6 +48,7 @@ public interface PointService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询所有数据不分页
|
* 查询所有数据不分页
|
||||||
|
*
|
||||||
* @param criteria 条件参数
|
* @param criteria 条件参数
|
||||||
* @return List<PointDto>
|
* @return List<PointDto>
|
||||||
*/
|
*/
|
||||||
|
|
@ -54,12 +57,14 @@ public interface PointService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询所有数据不分页
|
* 查询所有数据不分页
|
||||||
|
*
|
||||||
* @return List<PointDto>
|
* @return List<PointDto>
|
||||||
*/
|
*/
|
||||||
List<PointSmallDto> queryKyPointList();
|
List<PointSmallDto> queryKyPointList();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据ID查询
|
* 根据ID查询
|
||||||
|
*
|
||||||
* @param id ID
|
* @param id ID
|
||||||
* @return PointDto
|
* @return PointDto
|
||||||
*/
|
*/
|
||||||
|
|
@ -67,6 +72,7 @@ public interface PointService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据ID查询
|
* 根据ID查询
|
||||||
|
*
|
||||||
* @param id ID
|
* @param id ID
|
||||||
* @return PointDto
|
* @return PointDto
|
||||||
*/
|
*/
|
||||||
|
|
@ -74,6 +80,7 @@ public interface PointService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建
|
* 创建
|
||||||
|
*
|
||||||
* @param resources /
|
* @param resources /
|
||||||
* @return PointDto
|
* @return PointDto
|
||||||
*/
|
*/
|
||||||
|
|
@ -81,18 +88,21 @@ public interface PointService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编辑
|
* 编辑
|
||||||
|
*
|
||||||
* @param resources /
|
* @param resources /
|
||||||
*/
|
*/
|
||||||
void update(Point resources);
|
void update(Point resources);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 多选删除
|
* 多选删除
|
||||||
|
*
|
||||||
* @param ids /
|
* @param ids /
|
||||||
*/
|
*/
|
||||||
void deleteAll(Long[] ids);
|
void deleteAll(Long[] ids);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出数据
|
* 导出数据
|
||||||
|
*
|
||||||
* @param all 待导出的数据
|
* @param all 待导出的数据
|
||||||
* @param response /
|
* @param response /
|
||||||
* @throws IOException /
|
* @throws IOException /
|
||||||
|
|
@ -101,6 +111,7 @@ public interface PointService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* dto转实体
|
* dto转实体
|
||||||
|
*
|
||||||
* @param pointDto
|
* @param pointDto
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -116,17 +127,19 @@ public interface PointService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据code查找库区
|
* 根据code查找库区
|
||||||
|
*
|
||||||
* @param code-编号
|
* @param code-编号
|
||||||
* @param status-状态
|
* @param status-状态
|
||||||
* @param type-类型
|
* @param type-类型
|
||||||
* @param areaName-库区名称
|
* @param areaCode-库区代码
|
||||||
* @param goodType-存储类型
|
* @param goodType-存储类型
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Point findByCode(String code,String status,String type,String areaName,String goodType,Double itemHeight);
|
Point findByCode(String code, String status, String type, String areaCode, String goodType, Double itemHeight);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 得到指定点位
|
* 得到指定点位
|
||||||
|
*
|
||||||
* @param code
|
* @param code
|
||||||
* @param status
|
* @param status
|
||||||
* @param type
|
* @param type
|
||||||
|
|
@ -139,6 +152,7 @@ public interface PointService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据小库区编号查询点位集合
|
* 根据小库区编号查询点位集合
|
||||||
|
*
|
||||||
* @param beat_code
|
* @param beat_code
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -206,7 +206,7 @@ public class PointServiceImpl implements PointService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Point findByCode(String code, String status, String type, String areaName, String goodType,Double itemHeight) {
|
public Point findByCode(String code, String status, String type, String areaCode, String goodType, Double itemHeight) {
|
||||||
StringBuilder hql = new StringBuilder("from Point point where point.enabled = true");
|
StringBuilder hql = new StringBuilder("from Point point where point.enabled = true");
|
||||||
Map<String, Object> params = new HashMap<>();
|
Map<String, Object> params = new HashMap<>();
|
||||||
if (code != null && !code.isEmpty()) {
|
if (code != null && !code.isEmpty()) {
|
||||||
|
|
@ -225,9 +225,9 @@ public class PointServiceImpl implements PointService {
|
||||||
hql.append(" and point.description = :goodType");
|
hql.append(" and point.description = :goodType");
|
||||||
params.put("goodType", goodType);
|
params.put("goodType", goodType);
|
||||||
}
|
}
|
||||||
if (areaName != null && !areaName.isEmpty()) {
|
if (areaCode != null && !areaCode.isEmpty()) {
|
||||||
hql.append(" and point.area.name = :areaName");
|
hql.append(" and point.area.code = :areaCode");
|
||||||
params.put("areaName", areaName);
|
params.put("areaCode", areaCode);
|
||||||
}
|
}
|
||||||
if (itemHeight != null) {
|
if (itemHeight != null) {
|
||||||
hql.append(" and point.itemHeight = :itemHeight");
|
hql.append(" and point.itemHeight = :itemHeight");
|
||||||
|
|
@ -235,8 +235,8 @@ public class PointServiceImpl implements PointService {
|
||||||
}
|
}
|
||||||
Query query = entityMapper.createQuery(hql.toString());
|
Query query = entityMapper.createQuery(hql.toString());
|
||||||
params.forEach(query::setParameter);
|
params.forEach(query::setParameter);
|
||||||
Optional<Point> pointList = query.getResultStream().findFirst();
|
List<Point> pointList = query.getResultList();
|
||||||
return pointList.isPresent() ? pointList.get() : null;
|
return pointList.isEmpty() ? null : pointList.get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -294,14 +294,14 @@ public class StockServiceImpl implements StockService {
|
||||||
}
|
}
|
||||||
//容器类型:小件入库则入小件缓存区、大件入库则入大件缓存区
|
//容器类型:小件入库则入小件缓存区、大件入库则入大件缓存区
|
||||||
Map<String, String> stockTypeToAreaMap = new HashMap<>();
|
Map<String, String> stockTypeToAreaMap = new HashMap<>();
|
||||||
stockTypeToAreaMap.put("小件入库", "小件存储区");
|
stockTypeToAreaMap.put("小件入库", AreaNameDic.XJQ);
|
||||||
stockTypeToAreaMap.put("大件入库", "大件存储区");
|
stockTypeToAreaMap.put("大件入库", AreaNameDic.DJQ);
|
||||||
if (!stockTypeToAreaMap.containsKey(stock.getStockType())) {
|
if (!stockTypeToAreaMap.containsKey(stock.getStockType())) {
|
||||||
throw new RuntimeException(stock.getStockType() + "容器类型错误!");
|
throw new RuntimeException(stock.getStockType() + "容器类型错误!");
|
||||||
}
|
}
|
||||||
String areaName = stockTypeToAreaMap.get(stock.getStockType());
|
String areaCode = stockTypeToAreaMap.get(stock.getStockType());
|
||||||
|
|
||||||
Point endPoint = validateEndPoint(item, areaName);//验证目标点位
|
Point endPoint = validateEndPoint(item, areaCode);//验证目标点位
|
||||||
checkPointStatus(srcPoint);//验证源点位状态
|
checkPointStatus(srcPoint);//验证源点位状态
|
||||||
AgvTask agvTask = createAndSendAgvTask(BizStatus.ASN, stock, srcPoint, endPoint);//生成AGV任务
|
AgvTask agvTask = createAndSendAgvTask(BizStatus.ASN, stock, srcPoint, endPoint);//生成AGV任务
|
||||||
AsnDetail asnDetail = asnDetailService.createAsnDetail(item, stock, srcPoint, propC1, boxNumber, propC3, Timestamp.valueOf(DateUtil.formatDateTime(DateUtil.parse(propD1))), orderQty, QRCode);
|
AsnDetail asnDetail = asnDetailService.createAsnDetail(item, stock, srcPoint, propC1, boxNumber, propC3, Timestamp.valueOf(DateUtil.formatDateTime(DateUtil.parse(propD1))), orderQty, QRCode);
|
||||||
|
|
@ -389,14 +389,14 @@ public class StockServiceImpl implements StockService {
|
||||||
return srcPoint;
|
return srcPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Point validateEndPoint(Item item, String areaName) {
|
private Point validateEndPoint(Item item, String areaCode) {
|
||||||
Double itemHeight = null;
|
Double itemHeight = null;
|
||||||
if ("小件存储区".equals(areaName)) {
|
if (AreaNameDic.XJQ.equals(areaCode)) {
|
||||||
itemHeight = item.getExtendD2();//整托高度
|
itemHeight = item.getExtendD2();//整托高度
|
||||||
}
|
}
|
||||||
Point endPoint = pointService.findByCode(null, BaseStatus.FREE, BaseStatus.STORAGE, areaName, null, itemHeight);
|
Point endPoint = pointService.findByCode(null, BaseStatus.FREE, BaseStatus.STORAGE, areaCode, null, itemHeight);
|
||||||
if (endPoint == null) {
|
if (endPoint == null) {
|
||||||
throw new RuntimeException(areaName + "没有空闲点位!");
|
throw new RuntimeException(areaCode + "没有空闲点位!");
|
||||||
}
|
}
|
||||||
return endPoint;
|
return endPoint;
|
||||||
}
|
}
|
||||||
|
|
@ -439,19 +439,19 @@ public class StockServiceImpl implements StockService {
|
||||||
|
|
||||||
private void handleFullContainerCall(String itemCode, Point endPoint) {
|
private void handleFullContainerCall(String itemCode, Point endPoint) {
|
||||||
Item item = validateItem(itemCode);//验证物料
|
Item item = validateItem(itemCode);//验证物料
|
||||||
String endPointAreaName = endPoint.getArea().getCode();
|
String endPointAreaCode = endPoint.getArea().getCode();
|
||||||
//只允许叫料区叫满车
|
//只允许叫料区叫满车
|
||||||
if (!isValidMCJLArea(endPointAreaName)) {
|
if (!isValidMCJLArea(endPointAreaCode)) {
|
||||||
throw new RuntimeException(endPoint.getCode() + "点位不能叫满车!");
|
throw new RuntimeException(endPoint.getCode() + "点位不能叫满车!");
|
||||||
}
|
}
|
||||||
String areaName = "";
|
String areaCode = AreaNameDic.DJQ+","+AreaNameDic.XJQ;
|
||||||
List<Inventory> inventoryList = inventoryService.queryInventory(item.getId(), areaName);
|
List<Inventory> inventoryList = inventoryService.queryInventory(item.getId(), areaCode);
|
||||||
if (inventoryList.isEmpty()) {
|
if (inventoryList.isEmpty()) {
|
||||||
throw new RuntimeException(itemCode + "物料无库存,呼叫失败!");
|
throw new RuntimeException(itemCode + "物料无库存,呼叫失败!");
|
||||||
}
|
}
|
||||||
PickDetail pickDetail = pickDetailService.createPickDetail(item, "");
|
PickDetail pickDetail = pickDetailService.createPickDetail(item, "");
|
||||||
try {
|
try {
|
||||||
pickDetailService.allocateAll(pickDetail.getId(), endPoint, areaName);
|
pickDetailService.allocateAll(pickDetail.getId(), endPoint, areaCode);
|
||||||
List<Task> taskList = taskService.getPickNotAllTask(pickDetail.getId());
|
List<Task> taskList = taskService.getPickNotAllTask(pickDetail.getId());
|
||||||
AgvTask agvTask = taskList.get(0).getAgvTask();
|
AgvTask agvTask = taskList.get(0).getAgvTask();
|
||||||
sendAgvTaskAndHandleResponse(agvTask);
|
sendAgvTaskAndHandleResponse(agvTask);
|
||||||
|
|
@ -464,8 +464,8 @@ public class StockServiceImpl implements StockService {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isValidMCJLArea(String areaName) {
|
private boolean isValidMCJLArea(String areaCode) {
|
||||||
return AreaNameDic.JLQ.equals(areaName);
|
return AreaNameDic.JLQ.equals(areaCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -25,13 +25,14 @@ import org.springframework.data.jpa.repository.Query;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @website https://eladmin.vip
|
|
||||||
* @author huojin
|
* @author huojin
|
||||||
|
* @website https://eladmin.vip
|
||||||
* @date 2023-08-16
|
* @date 2023-08-16
|
||||||
**/
|
**/
|
||||||
public interface PickDetailRepository extends JpaRepository<PickDetail, Long>, JpaSpecificationExecutor<PickDetail> {
|
public interface PickDetailRepository extends JpaRepository<PickDetail, Long>, JpaSpecificationExecutor<PickDetail> {
|
||||||
/**
|
/**
|
||||||
* 查询前后桶出库的数量
|
* 查询前后桶出库的数量
|
||||||
|
*
|
||||||
* @param time 2023-12-09 00:00:00
|
* @param time 2023-12-09 00:00:00
|
||||||
* @param status PICK_ALL 已完成 ALLOCATE 待执行
|
* @param status PICK_ALL 已完成 ALLOCATE 待执行
|
||||||
* @return
|
* @return
|
||||||
|
|
@ -44,6 +45,7 @@ public interface PickDetailRepository extends JpaRepository<PickDetail, Long>, J
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询前后桶出库全部数据
|
* 查询前后桶出库全部数据
|
||||||
|
*
|
||||||
* @param time 2023-12-09 00:00:00
|
* @param time 2023-12-09 00:00:00
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -52,25 +54,31 @@ public interface PickDetailRepository extends JpaRepository<PickDetail, Long>, J
|
||||||
" UNION select a.* from data_pick_detail a INNER JOIN base_item b on a.item_id = b.id " +
|
" UNION select a.* from data_pick_detail a INNER JOIN base_item b on a.item_id = b.id " +
|
||||||
"WHERE b.name = '前桶' and a.create_time > :time ", nativeQuery = true)
|
"WHERE b.name = '前桶' and a.create_time > :time ", nativeQuery = true)
|
||||||
List<PickDetail> queryOutQHAllData(String time);
|
List<PickDetail> queryOutQHAllData(String time);
|
||||||
|
|
||||||
@Query(value = "SELECT p FROM PickDetail p WHERE p.pick.id=?1 and p.item.id=?2", nativeQuery = false)
|
@Query(value = "SELECT p FROM PickDetail p WHERE p.pick.id=?1 and p.item.id=?2", nativeQuery = false)
|
||||||
List<PickDetail> findRepeat(Long pickId, Long itemId);
|
List<PickDetail> findRepeat(Long pickId, Long itemId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询待分配的出库明细
|
* 查询已分配的出库明细
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Query(value = "SELECT p FROM PickDetail p WHERE p.orderQty>p.allocatedQty", nativeQuery = false)
|
@Query(value = " FROM PickDetail p WHERE p.orderQty-p.allocatedQty=0 and p.pick.id=?1 ")
|
||||||
List<PickDetail> findByAllocate();
|
List<PickDetail> findByAllocate(Long pickId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询未拣货完成的出库明细
|
* 查询未拣货完成的出库明细
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Query(value = "SELECT p FROM PickDetail p WHERE p.allocatedQty>p.pickedQty and p.pick.id=?1", nativeQuery = false)
|
@Query(value = "SELECT p FROM PickDetail p WHERE p.allocatedQty>p.pickedQty and p.pick.id=?1")
|
||||||
List<PickDetail> findByPickNo(Long pickId);
|
List<PickDetail> findByPickNo(Long pickId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询当前出库单是否有未分配完的明细
|
* 查询当前出库单未分配完的明细
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Query(value = "SELECT p FROM PickDetail p WHERE p.orderQty>p.allocatedQty and p.pick.id=?1", nativeQuery = false)
|
@Query(value = "SELECT p FROM PickDetail p WHERE p.orderQty>p.allocatedQty and p.pick.id=?1")
|
||||||
List<PickDetail> findByAllocate(Long pickId);
|
List<PickDetail> findByPickDetailNoAllocate(Long pickId);
|
||||||
}
|
}
|
||||||
|
|
@ -31,8 +31,8 @@ public interface PickRepository extends JpaRepository<Pick, Long>, JpaSpecificat
|
||||||
@Query(value = "SELECT p FROM Pick p WHERE p.id=?1 and p.lineNo=?2")
|
@Query(value = "SELECT p FROM Pick p WHERE p.id=?1 and p.lineNo=?2")
|
||||||
List<Pick> findRepeat(long gdDetailId, int no);
|
List<Pick> findRepeat(long gdDetailId, int no);
|
||||||
|
|
||||||
@Query(value = "SELECT p FROM Pick p WHERE p.status=?1 ")
|
@Query(value = " FROM Pick p WHERE p.status=?1 ")
|
||||||
List<Pick> findByStatus(String status);
|
List<Pick> findByPickStatus(String status);
|
||||||
|
|
||||||
@Query(value = " FROM Pick p WHERE p.code=?1 and p.code=?2 and p.code=?3 ")
|
@Query(value = " FROM Pick p WHERE p.code=?1 and p.code=?2 and p.code=?3 ")
|
||||||
Pick findByPick(String gdNo, String completeCode, String station);
|
Pick findByPick(String gdNo, String completeCode, String station);
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,6 @@ public class GdDetailController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping
|
@GetMapping
|
||||||
@Log("查询gdDetail")
|
|
||||||
@ApiOperation("查询gdDetail")
|
@ApiOperation("查询gdDetail")
|
||||||
@PreAuthorize("@el.check('gdDetail:list')")
|
@PreAuthorize("@el.check('gdDetail:list')")
|
||||||
public ResponseEntity<Object> queryGdDetail(GdDetailQueryCriteria criteria, Pageable pageable){
|
public ResponseEntity<Object> queryGdDetail(GdDetailQueryCriteria criteria, Pageable pageable){
|
||||||
|
|
|
||||||
|
|
@ -1,32 +1,18 @@
|
||||||
package com.youchain.businessdata.rest;
|
package com.youchain.businessdata.rest;
|
||||||
|
|
||||||
import cn.hutool.json.JSONUtil;
|
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import com.youchain.annotation.AnonymousAccess;
|
import com.youchain.annotation.AnonymousAccess;
|
||||||
import com.youchain.annotation.Log;
|
import com.youchain.annotation.Log;
|
||||||
import com.youchain.appupdate.inputJson.ContainerIn;
|
|
||||||
import com.youchain.appupdate.inputJson.MissionStateCallback;
|
import com.youchain.appupdate.inputJson.MissionStateCallback;
|
||||||
import com.youchain.basicdata.domain.Point;
|
|
||||||
import com.youchain.basicdata.domain.Stock;
|
|
||||||
import com.youchain.basicdata.repository.StockRepository;
|
|
||||||
import com.youchain.basicdata.service.PointService;
|
|
||||||
import com.youchain.businessdata.domain.AgvTask;
|
import com.youchain.businessdata.domain.AgvTask;
|
||||||
import com.youchain.businessdata.domain.Task;
|
|
||||||
import com.youchain.businessdata.service.AgvTaskService;
|
import com.youchain.businessdata.service.AgvTaskService;
|
||||||
import com.youchain.businessdata.service.TaskService;
|
|
||||||
import com.youchain.businessdata.service.dto.AgvTaskDto;
|
import com.youchain.businessdata.service.dto.AgvTaskDto;
|
||||||
import com.youchain.exception.handler.ApiResult;
|
import com.youchain.exception.handler.ApiResult;
|
||||||
import com.youchain.utils.AreaNameDic;
|
|
||||||
import com.youchain.utils.BaseStatus;
|
|
||||||
import com.youchain.utils.BizStatus;
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
|
||||||
|
|
@ -1,29 +1,20 @@
|
||||||
package com.youchain.businessdata.rest;
|
package com.youchain.businessdata.rest;
|
||||||
|
|
||||||
|
import com.youchain.exception.handler.ApiResult;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
import com.youchain.RequestData.*;
|
import com.youchain.RequestData.*;
|
||||||
import com.youchain.annotation.AnonymousAccess;
|
import com.youchain.annotation.AnonymousAccess;
|
||||||
import com.youchain.annotation.Log;
|
import com.youchain.annotation.Log;
|
||||||
import com.youchain.basicdata.domain.BigBom;
|
|
||||||
import com.youchain.basicdata.domain.BigItem;
|
|
||||||
import com.youchain.basicdata.domain.Item;
|
|
||||||
import com.youchain.basicdata.repository.BigBomRepository;
|
|
||||||
import com.youchain.basicdata.repository.BigItemRepository;
|
|
||||||
import com.youchain.basicdata.repository.ItemRepository;
|
|
||||||
import com.youchain.businessdata.service.GdDetailService;
|
|
||||||
import com.youchain.businessdata.service.GdService;
|
import com.youchain.businessdata.service.GdService;
|
||||||
import com.youchain.businessdata.service.PickService;
|
import com.youchain.businessdata.service.PickService;
|
||||||
import com.youchain.exception.BadRequestException;
|
|
||||||
import com.youchain.exception.handler.ApiResult;
|
|
||||||
import com.youchain.modules.system.service.DeptService;
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import java.util.List;
|
|
||||||
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
||||||
import static org.springframework.http.HttpStatus.OK;
|
import static org.springframework.http.HttpStatus.OK;
|
||||||
|
|
||||||
|
|
@ -34,10 +25,6 @@ import static org.springframework.http.HttpStatus.OK;
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class MesController {
|
public class MesController {
|
||||||
private final GdService gdService;
|
private final GdService gdService;
|
||||||
private final DeptService deptService;
|
|
||||||
private final ItemRepository itemRepository;
|
|
||||||
private final BigBomRepository bigBomRepository;
|
|
||||||
private final BigItemRepository bigItemRepository;
|
|
||||||
private final PickService pickService;
|
private final PickService pickService;
|
||||||
|
|
||||||
@PostMapping("/yclbl")
|
@PostMapping("/yclbl")
|
||||||
|
|
@ -45,47 +32,12 @@ public class MesController {
|
||||||
@ApiOperation("mes-原材料备料")
|
@ApiOperation("mes-原材料备料")
|
||||||
@AnonymousAccess
|
@AnonymousAccess
|
||||||
public ResponseEntity<Object> yclbl(@Validated @RequestBody Yclbl yclbl) {
|
public ResponseEntity<Object> yclbl(@Validated @RequestBody Yclbl yclbl) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
gdService.materialBL(yclbl);
|
gdService.materialBL(yclbl);
|
||||||
return successResponse("备料成功!");
|
return successResponse("备料成功!");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return badResponse("备料失败:" + e.getMessage());
|
return badResponse("备料失败:" + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* *//* 添加工单单头*//*
|
|
||||||
Gd gd = gdService.createGd(yclbl.getOrderNo(), yclbl.getTaskCode(), yclbl.getStation());
|
|
||||||
if (yclbl.getBlzc() != null) {
|
|
||||||
String orderType = BaseStatus.GD_TYPE_CT;
|
|
||||||
Set<ZcData> blzc = yclbl.getBlzc();
|
|
||||||
for (ZcData zcData : blzc) {
|
|
||||||
*//* 验证成套 物料*//*
|
|
||||||
BigItem bigItem = verifiedBigItem(zcData.getCompleteCode());
|
|
||||||
Set<ItemDate> itemDates = zcData.getBlzcmx();
|
|
||||||
for (ItemDate itemDate : itemDates) {
|
|
||||||
*//* 验证单品 物料*//*
|
|
||||||
Item item = verifiedItem(itemDate.getItemCode());
|
|
||||||
*//* 验证BOM*//*
|
|
||||||
BigBom bigBom = verifiedBigBom(bigItem, item, itemDate.getItemQty());
|
|
||||||
*//* 添加工单明细*//*
|
|
||||||
GdDetail gdDetail = gdDetailService.save(zcData.getLineNo(), gd, orderType, bigItem, zcData.getCompleteQty(), item, itemDate.getItemQty(), itemDate.getItemQty() * zcData.getCompleteQty());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (yclbl.getBlzcmx() != null) {
|
|
||||||
String orderType = BaseStatus.GD_TYPE_DP;
|
|
||||||
Set<ItemDate> itemDateList = yclbl.getBlzcmx();
|
|
||||||
for (ItemDate itemDate : itemDateList) {
|
|
||||||
*//* 验证单品物料*//*
|
|
||||||
Item item = verifiedItem(itemDate.getItemCode());
|
|
||||||
*//* 添加工单明细*//*
|
|
||||||
GdDetail gdDetail = gdDetailService.save(itemDate.getLineNo(), gd, orderType, null, null, item, itemDate.getItemQty(), itemDate.getItemQty());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*//* 生成 出库明细*//*
|
|
||||||
gdService.addPickDetail(gd);
|
|
||||||
ApiResult apiResult = ApiResult.result(200, "成功", null);
|
|
||||||
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -150,47 +102,13 @@ public class MesController {
|
||||||
return new ResponseEntity<>(ApiResult.result(200, "成功", null), HttpStatus.OK);
|
return new ResponseEntity<>(ApiResult.result(200, "成功", null), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 验证成套物料
|
|
||||||
*/
|
|
||||||
private BigItem verifiedBigItem(String completeCode) {
|
|
||||||
BigItem bigItem = bigItemRepository.findByBigItemCode(completeCode);
|
|
||||||
if (bigItem == null) {
|
|
||||||
throw new BadRequestException(HttpStatus.INTERNAL_SERVER_ERROR, "未维护成套物料" + completeCode);
|
|
||||||
} else {
|
|
||||||
return bigItem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Item verifiedItem(String itemCode) {
|
|
||||||
Item item = itemRepository.findByItemCode(itemCode);
|
|
||||||
if (item == null) {
|
|
||||||
throw new BadRequestException(HttpStatus.INTERNAL_SERVER_ERROR, "未维护单品物料" + itemCode);
|
|
||||||
} else {
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private BigBom verifiedBigBom(BigItem bigItem, Item item, Double itemQty) {
|
|
||||||
List<BigBom> bigBomList = bigBomRepository.findRepeat(bigItem.getId(), item.getId());
|
|
||||||
if (bigBomList.size() > 0) {
|
|
||||||
return bigBomList.get(0);
|
|
||||||
} else {
|
|
||||||
// 添加BOM
|
|
||||||
BigBom bigBom = new BigBom();
|
|
||||||
bigBom.setBigItem(bigItem);
|
|
||||||
bigBom.setItem(item);
|
|
||||||
bigBom.setQuantity(itemQty);
|
|
||||||
bigBom.setDept(deptService.getDefaultDept());
|
|
||||||
bigBomRepository.save(bigBom);
|
|
||||||
return bigBom;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private ResponseEntity<Object> badResponse(String message) {
|
private ResponseEntity<Object> badResponse(String message) {
|
||||||
|
|
||||||
return new ResponseEntity<>(ApiResult.fail(BAD_REQUEST.value(), message, ""), HttpStatus.BAD_REQUEST);
|
return new ResponseEntity<>(ApiResult.fail(BAD_REQUEST.value(), message, ""), HttpStatus.BAD_REQUEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private ResponseEntity<Object> successResponse(String message) {
|
private ResponseEntity<Object> successResponse(String message) {
|
||||||
return new ResponseEntity<>(ApiResult.fail(OK.value(), message, ""), HttpStatus.OK);
|
return new ResponseEntity<>(ApiResult.fail(OK.value(), message, ""), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,6 @@ public class PickController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping
|
@GetMapping
|
||||||
@Log("查询pick")
|
|
||||||
@ApiOperation("查询pick")
|
@ApiOperation("查询pick")
|
||||||
@PreAuthorize("@el.check('pick:list')")
|
@PreAuthorize("@el.check('pick:list')")
|
||||||
public ResponseEntity<Object> queryPick(PickQueryCriteria criteria, Pageable pageable){
|
public ResponseEntity<Object> queryPick(PickQueryCriteria criteria, Pageable pageable){
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,7 @@ public class PickDetailController {
|
||||||
if (pickDetailIds.size() > 0) {
|
if (pickDetailIds.size() > 0) {
|
||||||
for (Long id : pickDetailIds) {
|
for (Long id : pickDetailIds) {
|
||||||
PickDetailDto pickDetailDto = pickDetailService.findById(id);
|
PickDetailDto pickDetailDto = pickDetailService.findById(id);
|
||||||
pickDetailService.allocate(id, pickDetailDto.getOrderQty(),null);
|
pickDetailService.allocate(id, pickDetailDto.getOrderQty(),null,null);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return new ResponseEntity(ApiResult.fail(BAD_REQUEST.value(), "参数错误或者为null", ""), HttpStatus.BAD_REQUEST);
|
return new ResponseEntity(ApiResult.fail(BAD_REQUEST.value(), "参数错误或者为null", ""), HttpStatus.BAD_REQUEST);
|
||||||
|
|
|
||||||
|
|
@ -22,21 +22,23 @@ import com.youchain.businessdata.domain.GdDetail;
|
||||||
import com.youchain.businessdata.service.dto.GdDetailDto;
|
import com.youchain.businessdata.service.dto.GdDetailDto;
|
||||||
import com.youchain.businessdata.service.dto.GdDetailQueryCriteria;
|
import com.youchain.businessdata.service.dto.GdDetailQueryCriteria;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @author huojin
|
||||||
* @website https://eladmin.vip
|
* @website https://eladmin.vip
|
||||||
* @description 服务接口
|
* @description 服务接口
|
||||||
* @author huojin
|
|
||||||
* @date 2024-06-06
|
* @date 2024-06-06
|
||||||
**/
|
**/
|
||||||
public interface GdDetailService {
|
public interface GdDetailService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询数据分页
|
* 查询数据分页
|
||||||
|
*
|
||||||
* @param criteria 条件
|
* @param criteria 条件
|
||||||
* @param pageable 分页参数
|
* @param pageable 分页参数
|
||||||
* @return Map<String, Object>
|
* @return Map<String, Object>
|
||||||
|
|
@ -45,6 +47,7 @@ public interface GdDetailService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询所有数据不分页
|
* 查询所有数据不分页
|
||||||
|
*
|
||||||
* @param criteria 条件参数
|
* @param criteria 条件参数
|
||||||
* @return List<GdDetailDto>
|
* @return List<GdDetailDto>
|
||||||
*/
|
*/
|
||||||
|
|
@ -52,6 +55,7 @@ public interface GdDetailService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据ID查询
|
* 根据ID查询
|
||||||
|
*
|
||||||
* @param id ID
|
* @param id ID
|
||||||
* @return GdDetailDto
|
* @return GdDetailDto
|
||||||
*/
|
*/
|
||||||
|
|
@ -59,6 +63,7 @@ public interface GdDetailService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建
|
* 创建
|
||||||
|
*
|
||||||
* @param resources /
|
* @param resources /
|
||||||
* @return GdDetailDto
|
* @return GdDetailDto
|
||||||
*/
|
*/
|
||||||
|
|
@ -66,35 +71,24 @@ public interface GdDetailService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编辑
|
* 编辑
|
||||||
|
*
|
||||||
* @param resources /
|
* @param resources /
|
||||||
*/
|
*/
|
||||||
void update(GdDetail resources);
|
void update(GdDetail resources);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 多选删除
|
* 多选删除
|
||||||
|
*
|
||||||
* @param ids /
|
* @param ids /
|
||||||
*/
|
*/
|
||||||
void deleteAll(Long[] ids);
|
void deleteAll(Long[] ids);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出数据
|
* 导出数据
|
||||||
|
*
|
||||||
* @param all 待导出的数据
|
* @param all 待导出的数据
|
||||||
* @param response /
|
* @param response /
|
||||||
* @throws IOException /
|
* @throws IOException /
|
||||||
*/
|
*/
|
||||||
void download(List<GdDetailDto> all, HttpServletResponse response) throws IOException;
|
void download(List<GdDetailDto> all, HttpServletResponse response) throws IOException;
|
||||||
|
|
||||||
/**
|
|
||||||
* 添加工单明细
|
|
||||||
* @param lineNo 行号
|
|
||||||
* @param gd 工单
|
|
||||||
* @param orderType 分配类型 成套,单品
|
|
||||||
* @param bigItem 成套 物料
|
|
||||||
* @param completeQty 成套数
|
|
||||||
* @param item 单品物料
|
|
||||||
* @param itemQty 每套单品数
|
|
||||||
* @param orderQty 未拆分数量
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
GdDetail save(int lineNo,Gd gd, String orderType, BigItem bigItem, Double completeQty, Item item, Double itemQty,Double orderQty);
|
|
||||||
}
|
}
|
||||||
|
|
@ -27,21 +27,23 @@ import com.youchain.businessdata.service.dto.InventoryDto;
|
||||||
import com.youchain.businessdata.service.dto.InventoryQueryCriteria;
|
import com.youchain.businessdata.service.dto.InventoryQueryCriteria;
|
||||||
import com.youchain.modules.system.domain.Dept;
|
import com.youchain.modules.system.domain.Dept;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @author huojin
|
||||||
* @website https://eladmin.vip
|
* @website https://eladmin.vip
|
||||||
* @description 服务接口
|
* @description 服务接口
|
||||||
* @author huojin
|
|
||||||
* @date 2023-08-22
|
* @date 2023-08-22
|
||||||
**/
|
**/
|
||||||
public interface InventoryService {
|
public interface InventoryService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询数据分页
|
* 查询数据分页
|
||||||
|
*
|
||||||
* @param criteria 条件
|
* @param criteria 条件
|
||||||
* @param pageable 分页参数
|
* @param pageable 分页参数
|
||||||
* @return Map<String, Object>
|
* @return Map<String, Object>
|
||||||
|
|
@ -51,6 +53,7 @@ public interface InventoryService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询所有数据不分页
|
* 查询所有数据不分页
|
||||||
|
*
|
||||||
* @param criteria 条件参数
|
* @param criteria 条件参数
|
||||||
* @return List<InventoryDto>
|
* @return List<InventoryDto>
|
||||||
*/
|
*/
|
||||||
|
|
@ -60,6 +63,7 @@ public interface InventoryService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据ID查询
|
* 根据ID查询
|
||||||
|
*
|
||||||
* @param id ID
|
* @param id ID
|
||||||
* @return InventoryDto
|
* @return InventoryDto
|
||||||
*/
|
*/
|
||||||
|
|
@ -67,6 +71,7 @@ public interface InventoryService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建
|
* 创建
|
||||||
|
*
|
||||||
* @param resources /
|
* @param resources /
|
||||||
* @return InventoryDto
|
* @return InventoryDto
|
||||||
*/
|
*/
|
||||||
|
|
@ -74,18 +79,21 @@ public interface InventoryService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编辑
|
* 编辑
|
||||||
|
*
|
||||||
* @param resources /
|
* @param resources /
|
||||||
*/
|
*/
|
||||||
void update(Inventory resources);
|
void update(Inventory resources);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 多选删除
|
* 多选删除
|
||||||
|
*
|
||||||
* @param ids /
|
* @param ids /
|
||||||
*/
|
*/
|
||||||
void deleteAll(Long[] ids);
|
void deleteAll(Long[] ids);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出数据
|
* 导出数据
|
||||||
|
*
|
||||||
* @param all 待导出的数据
|
* @param all 待导出的数据
|
||||||
* @param response /
|
* @param response /
|
||||||
* @throws IOException /
|
* @throws IOException /
|
||||||
|
|
@ -94,7 +102,7 @@ public interface InventoryService {
|
||||||
|
|
||||||
Inventory toEntity(InventoryDto inventoryDto);
|
Inventory toEntity(InventoryDto inventoryDto);
|
||||||
|
|
||||||
List<Inventory> queryInventory(long itemId,String areaName);
|
List<Inventory> queryInventory(long itemId, String areaCode);
|
||||||
|
|
||||||
Inventory getInventory(ItemKey itemKey, Point point, Stock stock, Dept dept, String type);
|
Inventory getInventory(ItemKey itemKey, Point point, Stock stock, Dept dept, String type);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,21 +25,23 @@ import com.youchain.businessdata.domain.PickDetail;
|
||||||
import com.youchain.businessdata.service.dto.PickDetailDto;
|
import com.youchain.businessdata.service.dto.PickDetailDto;
|
||||||
import com.youchain.businessdata.service.dto.PickDetailQueryCriteria;
|
import com.youchain.businessdata.service.dto.PickDetailQueryCriteria;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @author huojin
|
||||||
* @website https://eladmin.vip
|
* @website https://eladmin.vip
|
||||||
* @description 服务接口
|
* @description 服务接口
|
||||||
* @author huojin
|
|
||||||
* @date 2023-08-16
|
* @date 2023-08-16
|
||||||
**/
|
**/
|
||||||
public interface PickDetailService {
|
public interface PickDetailService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询数据分页
|
* 查询数据分页
|
||||||
|
*
|
||||||
* @param criteria 条件
|
* @param criteria 条件
|
||||||
* @param pageable 分页参数
|
* @param pageable 分页参数
|
||||||
* @return Map<String, Object>
|
* @return Map<String, Object>
|
||||||
|
|
@ -48,6 +50,7 @@ public interface PickDetailService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询所有数据不分页
|
* 查询所有数据不分页
|
||||||
|
*
|
||||||
* @param criteria 条件参数
|
* @param criteria 条件参数
|
||||||
* @return List<PickDetailDto>
|
* @return List<PickDetailDto>
|
||||||
*/
|
*/
|
||||||
|
|
@ -55,6 +58,7 @@ public interface PickDetailService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据ID查询
|
* 根据ID查询
|
||||||
|
*
|
||||||
* @param id ID
|
* @param id ID
|
||||||
* @return PickDetailDto
|
* @return PickDetailDto
|
||||||
*/
|
*/
|
||||||
|
|
@ -62,6 +66,7 @@ public interface PickDetailService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建
|
* 创建
|
||||||
|
*
|
||||||
* @param resources /
|
* @param resources /
|
||||||
* @return PickDetailDto
|
* @return PickDetailDto
|
||||||
*/
|
*/
|
||||||
|
|
@ -69,18 +74,21 @@ public interface PickDetailService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编辑
|
* 编辑
|
||||||
|
*
|
||||||
* @param resources /
|
* @param resources /
|
||||||
*/
|
*/
|
||||||
void update(PickDetail resources);
|
void update(PickDetail resources);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 多选删除
|
* 多选删除
|
||||||
|
*
|
||||||
* @param ids /
|
* @param ids /
|
||||||
*/
|
*/
|
||||||
void deleteAll(Long[] ids);
|
void deleteAll(Long[] ids);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出数据
|
* 导出数据
|
||||||
|
*
|
||||||
* @param all 待导出的数据
|
* @param all 待导出的数据
|
||||||
* @param response /
|
* @param response /
|
||||||
* @throws IOException /
|
* @throws IOException /
|
||||||
|
|
@ -90,7 +98,7 @@ public interface PickDetailService {
|
||||||
/**
|
/**
|
||||||
* 分配
|
* 分配
|
||||||
*/
|
*/
|
||||||
void allocate(long id,double quantity,String areaName);
|
String allocate(long id, double quantity, String areaName, Point endPoint);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 整出分配
|
* 整出分配
|
||||||
|
|
@ -104,12 +112,14 @@ public interface PickDetailService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 统计数量
|
* 统计数量
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
long count();
|
long count();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dto转实体
|
* Dto转实体
|
||||||
|
*
|
||||||
* @param pickDetailDto
|
* @param pickDetailDto
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -121,8 +131,16 @@ public interface PickDetailService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建出库单明细
|
* 创建出库单明细
|
||||||
|
*
|
||||||
* @param pick->出库单
|
* @param pick->出库单
|
||||||
* @param gdDetails->工单明细
|
* @param gdDetails->工单明细
|
||||||
*/
|
*/
|
||||||
void createPickDetail(Pick pick, List<GdDetail> gdDetails);
|
void createPickDetail(Pick pick, List<GdDetail> gdDetails);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分配出库单
|
||||||
|
*
|
||||||
|
* @param pick->出库单
|
||||||
|
*/
|
||||||
|
void allocatePick(Pick pick);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,19 +16,29 @@
|
||||||
package com.youchain.businessdata.service.dto;
|
package com.youchain.businessdata.service.dto;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.youchain.annotation.Query;
|
import com.youchain.annotation.Query;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @website https://eladmin.vip
|
|
||||||
* @author huojin
|
* @author huojin
|
||||||
|
* @website https://eladmin.vip
|
||||||
* @date 2024-06-11
|
* @date 2024-06-11
|
||||||
**/
|
**/
|
||||||
@Data
|
@Data
|
||||||
public class PickQueryCriteria {
|
public class PickQueryCriteria {
|
||||||
|
|
||||||
/** 模糊 */
|
/**
|
||||||
|
* 工单编码
|
||||||
|
*/
|
||||||
@Query(type = Query.Type.INNER_LIKE)
|
@Query(type = Query.Type.INNER_LIKE)
|
||||||
private String code;
|
private String gdCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态
|
||||||
|
*/
|
||||||
|
@Query(type = Query.Type.EQUAL)
|
||||||
|
private String status;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -200,8 +200,8 @@ public class GdServiceImpl implements GdService {
|
||||||
/** 创建工单明细 */
|
/** 创建工单明细 */
|
||||||
List<GdDetail> gdDetailList = createGdDetailsCPAndDP(gd, yclbl);
|
List<GdDetail> gdDetailList = createGdDetailsCPAndDP(gd, yclbl);
|
||||||
|
|
||||||
/** 创建出库单和出库明细 */
|
/** 添加出库单和出库明细 */
|
||||||
createPickAndPickDetail(gd, gdDetailList);
|
addPickAndPickDetail(gd, gdDetailList);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -414,7 +414,7 @@ public class GdServiceImpl implements GdService {
|
||||||
return packageCheck;
|
return packageCheck;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createPickAndPickDetail(Gd gd, List<GdDetail> gdDetailList) {
|
private void addPickAndPickDetail(Gd gd, List<GdDetail> gdDetailList) {
|
||||||
AtomicInteger lineNo = new AtomicInteger(1);
|
AtomicInteger lineNo = new AtomicInteger(1);
|
||||||
/** 成品工单明细集合 */
|
/** 成品工单明细集合 */
|
||||||
List<GdDetail> cpGdDetailList = gdDetailList.stream()
|
List<GdDetail> cpGdDetailList = gdDetailList.stream()
|
||||||
|
|
@ -425,19 +425,8 @@ public class GdServiceImpl implements GdService {
|
||||||
Map<String, List<GdDetail>> groupedByCpCodeMap = cpGdDetailList.stream()
|
Map<String, List<GdDetail>> groupedByCpCodeMap = cpGdDetailList.stream()
|
||||||
.collect(Collectors.groupingBy(gdDetail -> gdDetail.getBigItem().getCode()));
|
.collect(Collectors.groupingBy(gdDetail -> gdDetail.getBigItem().getCode()));
|
||||||
|
|
||||||
/** 根据工单明细生成出库单和出库单明细 */
|
/** 根据成品工单明细生成出库单和出库单明细 */
|
||||||
groupedByCpCodeMap.forEach((code, gdDetails) -> {
|
createPickAndPickDetail(gd, groupedByCpCodeMap, lineNo);
|
||||||
PackageCheck packageCheck = validatePackageCheck(code);// 验证翻包套数是否存在
|
|
||||||
double xqTaoQty = gdDetails.get(0).getBigItemQty();//需求套数
|
|
||||||
double fbTaoQty = packageCheck.getQuantity();//翻包套数
|
|
||||||
double chkQty = Math.ceil(xqTaoQty / fbTaoQty);//生成出库单数量
|
|
||||||
|
|
||||||
for (int i = 0; i < chkQty; i++) {
|
|
||||||
Pick pick = pickService.createPick(gd, lineNo.getAndIncrement(), code);
|
|
||||||
pickDetailService.createPickDetail(pick, gdDetails);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
/** 单品工单明细集合 */
|
/** 单品工单明细集合 */
|
||||||
List<GdDetail> dpGdDetailList = gdDetailList.stream()
|
List<GdDetail> dpGdDetailList = gdDetailList.stream()
|
||||||
|
|
@ -448,11 +437,29 @@ public class GdServiceImpl implements GdService {
|
||||||
Map<String, List<GdDetail>> groupedByDpCodeMap = dpGdDetailList.stream()
|
Map<String, List<GdDetail>> groupedByDpCodeMap = dpGdDetailList.stream()
|
||||||
.collect(Collectors.groupingBy(gdDetail -> gdDetail.getItem().getCode()));
|
.collect(Collectors.groupingBy(gdDetail -> gdDetail.getItem().getCode()));
|
||||||
|
|
||||||
/** 根据工单明细生成出库单和出库单明细 */
|
/** 根据单品工单明细生成出库单和出库单明细 */
|
||||||
groupedByDpCodeMap.forEach((code, gdDetails) -> {
|
createPickAndPickDetail(gd, groupedByDpCodeMap, lineNo);
|
||||||
Pick pick = pickService.createPick(gd, lineNo.getAndIncrement(), code);
|
|
||||||
pickDetailService.createPickDetail(pick, gdDetails);
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void createPickAndPickDetail(Gd gd, Map<String, List<GdDetail>> groupedByDpCodeMap, AtomicInteger lineNo) {
|
||||||
|
|
||||||
|
groupedByDpCodeMap.forEach((code, gdDetails) -> {
|
||||||
|
PackageCheck packageCheck = validatePackageCheck(code);// 验证翻包套数是否存在
|
||||||
|
double xqTaoQty = 0;//需求套数
|
||||||
|
if (BaseStatus.GD_TYPE_CT.equals(gdDetails.get(0).getOrderType())) {
|
||||||
|
xqTaoQty = gdDetails.get(0).getBigItemQty();
|
||||||
|
} else if (BaseStatus.GD_TYPE_DP.equals(gdDetails.get(0).getOrderType())) {
|
||||||
|
xqTaoQty = gdDetails.get(0).getItemQty();//需求套数
|
||||||
|
}
|
||||||
|
double fbTaoQty = packageCheck.getQuantity();//翻包套数
|
||||||
|
double chkQty = Math.ceil(xqTaoQty / fbTaoQty);//生成出库单数量
|
||||||
|
for (int i = 0; i < chkQty; i++) {
|
||||||
|
Pick pick = pickService.createPick(gd, lineNo.getAndIncrement(), code);
|
||||||
|
pickDetailService.createPickDetail(pick, gdDetails);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -137,17 +137,17 @@ public class InventoryServiceImpl implements InventoryService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Inventory> queryInventory(long itemId, String areaName) {
|
public List<Inventory> queryInventory(long itemId, String areaCode) {
|
||||||
StringBuilder hql = new StringBuilder("FROM Inventory inv WHERE inv.itemKey.item.id = :itemId AND inv.quantity > inv.queuedQty ");
|
StringBuilder hql = new StringBuilder("FROM Inventory inv WHERE inv.itemKey.item.id = :itemId AND inv.quantity > inv.queuedQty ");
|
||||||
Map<String, Object> params = new HashMap<>();
|
Map<String, Object> params = new HashMap<>();
|
||||||
params.put("itemId", itemId);
|
params.put("itemId", itemId);
|
||||||
if (areaName.contains(",")) {
|
if (areaCode.contains(",")) {
|
||||||
List<String> areas = Arrays.asList(areaName.split(","));
|
List<String> areas = Arrays.asList(areaCode.split(","));
|
||||||
hql.append(" AND inv.point.area.name IN (:areaNames)");
|
hql.append(" AND inv.point.area.code IN (:areaCode)");
|
||||||
params.put("areaNames", areas);
|
params.put("areaCode", areas);
|
||||||
} else {
|
} else {
|
||||||
hql.append(" AND inv.point.area.name = :areaName");
|
hql.append(" AND inv.point.area.code = :areaCode");
|
||||||
params.put("areaName", areaName);
|
params.put("areaCode", areaCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
hql.append(" ORDER BY inv.createTime");
|
hql.append(" ORDER BY inv.createTime");
|
||||||
|
|
|
||||||
|
|
@ -15,12 +15,9 @@
|
||||||
*/
|
*/
|
||||||
package com.youchain.businessdata.service.impl;
|
package com.youchain.businessdata.service.impl;
|
||||||
|
|
||||||
import com.youchain.basicdata.domain.Box;
|
|
||||||
import com.youchain.basicdata.domain.Item;
|
import com.youchain.basicdata.domain.Item;
|
||||||
import com.youchain.basicdata.domain.Point;
|
import com.youchain.basicdata.domain.Point;
|
||||||
import com.youchain.basicdata.domain.Stock;
|
import com.youchain.basicdata.domain.Stock;
|
||||||
import com.youchain.basicdata.repository.BoxRepository;
|
|
||||||
import com.youchain.basicdata.repository.StockRepository;
|
|
||||||
import com.youchain.basicdata.service.ItemService;
|
import com.youchain.basicdata.service.ItemService;
|
||||||
import com.youchain.basicdata.service.PointService;
|
import com.youchain.basicdata.service.PointService;
|
||||||
import com.youchain.basicdata.service.dto.ItemDto;
|
import com.youchain.basicdata.service.dto.ItemDto;
|
||||||
|
|
@ -29,24 +26,20 @@ import com.youchain.businessdata.repository.*;
|
||||||
import com.youchain.businessdata.service.InventoryService;
|
import com.youchain.businessdata.service.InventoryService;
|
||||||
import com.youchain.businessdata.service.TaskService;
|
import com.youchain.businessdata.service.TaskService;
|
||||||
import com.youchain.businessdata.service.dto.InventoryDto;
|
import com.youchain.businessdata.service.dto.InventoryDto;
|
||||||
import com.youchain.exception.BadRequestException;
|
|
||||||
import com.youchain.exception.handler.ApiResult;
|
|
||||||
import com.youchain.modules.quartz.utils.TimeNumberUtils;
|
import com.youchain.modules.quartz.utils.TimeNumberUtils;
|
||||||
import com.youchain.modules.system.domain.Dept;
|
import com.youchain.modules.system.domain.Dept;
|
||||||
|
import com.youchain.service.LogService;
|
||||||
import com.youchain.utils.*;
|
import com.youchain.utils.*;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import com.youchain.businessdata.service.PickDetailService;
|
import com.youchain.businessdata.service.PickDetailService;
|
||||||
import com.youchain.businessdata.service.dto.PickDetailDto;
|
import com.youchain.businessdata.service.dto.PickDetailDto;
|
||||||
import com.youchain.businessdata.service.dto.PickDetailQueryCriteria;
|
import com.youchain.businessdata.service.dto.PickDetailQueryCriteria;
|
||||||
import com.youchain.businessdata.service.mapstruct.PickDetailMapper;
|
import com.youchain.businessdata.service.mapstruct.PickDetailMapper;
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
@ -54,8 +47,6 @@ import javax.persistence.EntityManager;
|
||||||
import javax.persistence.Query;
|
import javax.persistence.Query;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author huojin
|
* @author huojin
|
||||||
* @website https://eladmin.vip
|
* @website https://eladmin.vip
|
||||||
|
|
@ -70,10 +61,11 @@ public class PickDetailServiceImpl implements PickDetailService {
|
||||||
private final GdDetailRepository gdDetailRepository;
|
private final GdDetailRepository gdDetailRepository;
|
||||||
private final PickDetailMapper pickDetailMapper;
|
private final PickDetailMapper pickDetailMapper;
|
||||||
private final InventoryService inventoryService;
|
private final InventoryService inventoryService;
|
||||||
private final BoxRepository boxRepository;
|
|
||||||
private final AgvTaskRepository agvTaskRepository;
|
private final AgvTaskRepository agvTaskRepository;
|
||||||
private final TaskService taskService;
|
private final TaskService taskService;
|
||||||
private final ItemService itemService;
|
private final ItemService itemService;
|
||||||
|
private final PointService pointService;
|
||||||
|
private final LogService logService;
|
||||||
private final EntityManager entityMapper;
|
private final EntityManager entityMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -141,7 +133,7 @@ public class PickDetailServiceImpl implements PickDetailService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public synchronized void allocate(long id, double quantity, String areaName) {
|
public synchronized String allocate(long id, double quantity, String areaName, Point endPoint) {
|
||||||
if (areaName == null) {
|
if (areaName == null) {
|
||||||
areaName = "大件存储区,小件存储区";
|
areaName = "大件存储区,小件存储区";
|
||||||
}
|
}
|
||||||
|
|
@ -151,15 +143,18 @@ public class PickDetailServiceImpl implements PickDetailService {
|
||||||
Item item = itemService.toEntity(itemDto);
|
Item item = itemService.toEntity(itemDto);
|
||||||
Dept dept = item.getDept();//仓库
|
Dept dept = item.getDept();//仓库
|
||||||
Pick pick = pd.getPick();
|
Pick pick = pd.getPick();
|
||||||
// Box box = boxRepository.getBoxByItem(item.getId());
|
|
||||||
Point endPoint = pick.getPoint();//目标点位
|
|
||||||
if (pd.getOrderQty() > pd.getAllocatedQty()) {
|
if (pd.getAllocatedQty() >= pd.getOrderQty()) {
|
||||||
|
return pick.getCode() + "出库单;" + item.getCode() + "数量已分配!";
|
||||||
|
}
|
||||||
List<Inventory> Inventorys = inventoryService.queryInventory(item.getId(), areaName);
|
List<Inventory> Inventorys = inventoryService.queryInventory(item.getId(), areaName);
|
||||||
if (Inventorys.size() > 0) {
|
if (Inventorys.isEmpty()) {
|
||||||
|
return pick.getCode() + "出库单;" + item.getCode() + "物料库存不足,请先补充库存!";
|
||||||
|
}
|
||||||
double allocateQty = 0;
|
double allocateQty = 0;
|
||||||
double unQty = quantity;//未分配数量
|
double unQty = quantity;//未分配数量
|
||||||
for (Inventory inv : Inventorys) {
|
for (Inventory inv : Inventorys) {
|
||||||
Stock stock = inv.getStock();//容器
|
|
||||||
Point startPoint = inv.getPoint();//起始点位
|
Point startPoint = inv.getPoint();//起始点位
|
||||||
if (unQty == 0) {
|
if (unQty == 0) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -176,24 +171,8 @@ public class PickDetailServiceImpl implements PickDetailService {
|
||||||
unQty -= allocateQty;
|
unQty -= allocateQty;
|
||||||
/* 更新出库单明细状态*/
|
/* 更新出库单明细状态*/
|
||||||
pd.setAllocatedQty(pd.getAllocatedQty() + allocateQty);
|
pd.setAllocatedQty(pd.getAllocatedQty() + allocateQty);
|
||||||
if (pd.getOrderQty().equals(pd.getAllocatedQty())) {
|
|
||||||
pd.setStatus(BizStatus.ALLOCATE);
|
|
||||||
}
|
|
||||||
pickDetailRepository.save(pd);
|
pickDetailRepository.save(pd);
|
||||||
/* 更新出库单状态*/
|
|
||||||
List<PickDetail> pickDetailList = pickDetailRepository.findByAllocate(pick.getId());
|
|
||||||
if (pickDetailList.size() < 1) {
|
|
||||||
pick.setStatus(BizStatus.ALLOCATE);
|
|
||||||
pickRepository.save(pick);
|
|
||||||
} else {
|
|
||||||
if (pick.getStatus().equals(BizStatus.OPEN)) {
|
|
||||||
pick.setStatus(BizStatus.ASSIGN);
|
|
||||||
pickRepository.save(pick);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//生成搬运任务
|
|
||||||
/*AgvTask agvTask = new AgvTask(BizStatus.PICK, stock.getCode(), startPoint.getCode(), endPoint.getCode(), BizStatus.OPEN, "01");
|
|
||||||
agvTaskRepository.save(agvTask);*/
|
|
||||||
//生成Task
|
//生成Task
|
||||||
Task task = new Task();
|
Task task = new Task();
|
||||||
task.setTaskType(BizStatus.PICK);
|
task.setTaskType(BizStatus.PICK);
|
||||||
|
|
@ -213,27 +192,21 @@ public class PickDetailServiceImpl implements PickDetailService {
|
||||||
task.setPlanQty(allocateQty);
|
task.setPlanQty(allocateQty);
|
||||||
task.setInventory(inv);
|
task.setInventory(inv);
|
||||||
task.setDept(dept);
|
task.setDept(dept);
|
||||||
// task.setAgvTask(agvTask);
|
|
||||||
taskService.create(task);
|
taskService.create(task);
|
||||||
}
|
}
|
||||||
} else {
|
return pick.getCode() + "出库单;" + item.getCode() + "分配成功!";
|
||||||
throw new BadRequestException(HttpStatus.NOT_IMPLEMENTED, "库存不足:" + item.getCode());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
throw new RuntimeException("已分配,请勿重复操作!");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public synchronized void allocateAll(long id, Point endPoint, String areaName) throws Exception {
|
public synchronized void allocateAll(long id, Point endPoint, String areaCode) throws Exception {
|
||||||
PickDetailDto pickDetailDto = findById(id);
|
PickDetailDto pickDetailDto = findById(id);
|
||||||
PickDetail pd = toEntity(pickDetailDto);//Dto转实体
|
PickDetail pd = toEntity(pickDetailDto);//Dto转实体
|
||||||
ItemDto itemDto = pickDetailDto.getItem();
|
ItemDto itemDto = pickDetailDto.getItem();
|
||||||
Item item = itemService.toEntity(itemDto);
|
Item item = itemService.toEntity(itemDto);
|
||||||
Dept dept = item.getDept();//仓库
|
Dept dept = item.getDept();//仓库
|
||||||
List<Inventory> Inventorys = inventoryService.queryInventory(item.getId(), areaName);
|
List<Inventory> Inventorys = inventoryService.queryInventory(item.getId(), areaCode);
|
||||||
if (Inventorys.size() > 0) {
|
if (Inventorys.size() > 0) {
|
||||||
Inventory inv = Inventorys.get(0);
|
Inventory inv = Inventorys.get(0);
|
||||||
//库存冻结状态不允许出库
|
//库存冻结状态不允许出库
|
||||||
|
|
@ -396,10 +369,63 @@ public class PickDetailServiceImpl implements PickDetailService {
|
||||||
pickDetail.setItem(gdDetail.getItem());
|
pickDetail.setItem(gdDetail.getItem());
|
||||||
pickDetail.setLineNo(lineNo.getAndIncrement());
|
pickDetail.setLineNo(lineNo.getAndIncrement());
|
||||||
pickDetail.setStatus(BizStatus.OPEN);
|
pickDetail.setStatus(BizStatus.OPEN);
|
||||||
|
if (BaseStatus.GD_TYPE_CT.equals(gdDetail.getOrderType())) {
|
||||||
|
pickDetail.setOrderQty(gdDetail.getItemQty() * gdDetail.getBigItemQty());
|
||||||
|
} else {
|
||||||
pickDetail.setOrderQty(gdDetail.getItemQty());
|
pickDetail.setOrderQty(gdDetail.getItemQty());
|
||||||
|
}
|
||||||
pickDetail.setSourceId(gdDetail.getId());
|
pickDetail.setSourceId(gdDetail.getId());
|
||||||
pickDetail.setDept(gdDetail.getDept());
|
pickDetail.setDept(gdDetail.getDept());
|
||||||
pickDetailRepository.save(pickDetail);
|
pickDetailRepository.save(pickDetail);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void allocatePick(Pick pick) {
|
||||||
|
|
||||||
|
//目标库位
|
||||||
|
Point endPoint = null;
|
||||||
|
if (pick.getPoint() == null) {
|
||||||
|
endPoint = pointService.findByCode(null, BaseStatus.FREE, BaseStatus.BOX, AreaNameDic.FBQ, null, null);
|
||||||
|
if (endPoint == null) {
|
||||||
|
logService.saveLogInfo(pick.getCode(), pick.getCode(), "/pick/allocatePick", "分配失败,翻包区没有空闲点位!", "出库单分配", 200, "info");
|
||||||
|
throw new IllegalArgumentException(pick.getCode() + "分配失败,翻包区没有空闲点位!");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
endPoint = pick.getPoint();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
List<String> MsgList = new ArrayList<>();//存放提示信息
|
||||||
|
//查询出待分配的pickDetail
|
||||||
|
List<PickDetail> pickDetails = pickDetailRepository.findByPickDetailNoAllocate(pick.getId());
|
||||||
|
for (PickDetail pickDetail : pickDetails) {
|
||||||
|
MsgList.add(allocate(pickDetail.getId(), pickDetail.getOrderQty(), null, endPoint));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 更新出库单状态并写入目标点位*/
|
||||||
|
refreshPickStatus(pick, endPoint, pickDetails);
|
||||||
|
|
||||||
|
//保存日志
|
||||||
|
logService.saveLogInfo(pick.getCode(), pick.getCode(), "/pick/allocatePick", MsgList.toString(), "出库单分配", 200, "info");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshPickStatus(Pick pick, Point endPoint, List<PickDetail> openPickDetails) {
|
||||||
|
List<PickDetail> allocatePickDetailList = pickDetailRepository.findByAllocate(pick.getId());
|
||||||
|
if (allocatePickDetailList.size() == openPickDetails.size()) {
|
||||||
|
pick.setStatus(BizStatus.ALLOCATE);
|
||||||
|
pick.setPoint(endPoint);
|
||||||
|
pickRepository.save(pick);
|
||||||
|
endPoint.setStatus(BaseStatus.USED);
|
||||||
|
pointService.update(endPoint);
|
||||||
|
} else if (allocatePickDetailList.size() > 0) {
|
||||||
|
pick.setStatus(BizStatus.ASSIGN);
|
||||||
|
pick.setPoint(endPoint);
|
||||||
|
pickRepository.save(pick);
|
||||||
|
endPoint.setStatus(BaseStatus.USED);
|
||||||
|
pointService.update(endPoint);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,6 @@ public class QuartzJobController {
|
||||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Log("执行定时任务")
|
|
||||||
@ApiOperation("执行定时任务")
|
@ApiOperation("执行定时任务")
|
||||||
@PutMapping(value = "/exec/{id}")
|
@PutMapping(value = "/exec/{id}")
|
||||||
@PreAuthorize("@el.check('timing:edit')")
|
@PreAuthorize("@el.check('timing:edit')")
|
||||||
|
|
|
||||||
|
|
@ -31,56 +31,48 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class pickTask {
|
public class pickTask {
|
||||||
@Autowired
|
|
||||||
public PickDetailRepository pickDetailRepository;
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public PickDetailService pickDetailService;
|
public PickDetailService pickDetailService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public PickDetailRepository pickDetailRepository;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public PickRepository pickRepository;
|
public PickRepository pickRepository;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public TaskRepository taskRepository;
|
public TaskRepository taskRepository;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public AgvTaskRepository agvTaskRepository;
|
public AgvTaskRepository agvTaskRepository;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public AgvTaskService agvTaskService;
|
public AgvTaskService agvTaskService;
|
||||||
|
|
||||||
private Map<String, List<Integer>> groupedTasks = new HashMap<>();
|
|
||||||
|
|
||||||
private long lastTaskTime = System.currentTimeMillis();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 定时检测出库单,分配库存
|
* 定时检测出库单,分配库存
|
||||||
*/
|
*/
|
||||||
public void allocate() {
|
public void allocatePick() {
|
||||||
System.out.println("定时检测物料,分配库存");
|
|
||||||
/* 查询待分配的出库明细*/
|
List<Pick> pickList = pickRepository.findByPickStatus(BizStatus.OPEN);
|
||||||
List<PickDetail> pickDetailList=pickDetailRepository.findByAllocate();
|
if (pickList.isEmpty()) {
|
||||||
List<String> arr=new ArrayList<>();//没有库存的物料集合
|
throw new RuntimeException("无待分配的出库单!");
|
||||||
for (PickDetail pickDetail:pickDetailList){
|
} else {
|
||||||
/* 没有库存 不用分配*/
|
for (Pick pick : pickList) {
|
||||||
if (arr.contains(pickDetail.getItem().getCode())){
|
pickDetailService.allocatePick(pick);
|
||||||
continue;
|
|
||||||
}
|
|
||||||
/* 分配库存*/
|
|
||||||
try {
|
|
||||||
pickDetailService.allocate(pickDetail.getId(), pickDetail.getOrderQty()-pickDetail.getAllocatedQty(), null);
|
|
||||||
}catch (BadRequestException b){
|
|
||||||
if (b.getStatus().equals(501)){
|
|
||||||
/* 库存不足*/
|
|
||||||
String itemCode= StringUtils.substringAfterLast(b.getMessage(), ":");
|
|
||||||
arr.add(itemCode);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
System.out.println("分配出库单,库存不足:"+arr);
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* 定时检测出库单,生成《备料》搬运任务
|
* 定时检测出库单,生成《备料》搬运任务
|
||||||
*/
|
*/
|
||||||
public void pickAgvTask() {
|
public void pickAgvTask() {
|
||||||
/*查询分配完成的出库单*/
|
/*查询分配完成的出库单*/
|
||||||
List<Pick> pickList=pickRepository.findByStatus(BizStatus.ALLOCATE);
|
List<Pick> pickList = pickRepository.findByPickStatus(BizStatus.ALLOCATE);
|
||||||
for (Pick pick : pickList) {
|
for (Pick pick : pickList) {
|
||||||
List<Task> taskList = taskRepository.findByPick(pick.getId());
|
List<Task> taskList = taskRepository.findByPick(pick.getId());
|
||||||
for (Task task : taskList) {
|
for (Task task : taskList) {
|
||||||
|
|
@ -95,68 +87,7 @@ public class pickTask {
|
||||||
pick.setStatus(BizStatus.PICKUP);
|
pick.setStatus(BizStatus.PICKUP);
|
||||||
pickRepository.save(pick);
|
pickRepository.save(pick);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
public void pickTask() {
|
|
||||||
//按线边分组 下发出库任务
|
|
||||||
List<Object> objectList = agvTaskRepository.queryGroupAgvTask();
|
|
||||||
for (Object obj : objectList) {
|
|
||||||
List<AgvTask> agvTaskList = agvTaskRepository.queryLineAgvTask(obj.toString());
|
|
||||||
for (AgvTask agvTask : agvTaskList) {
|
|
||||||
List<Integer> agvTaskList1 = groupedTasks.get(obj.toString());
|
|
||||||
if (agvTaskList1 == null) {
|
|
||||||
groupedTasks.computeIfAbsent(obj.toString(), k -> new CopyOnWriteArrayList<>()).add(agvTask.getId());
|
|
||||||
} else if (agvTaskList1.size() <= 4) {
|
|
||||||
boolean containsElement = agvTaskList1.contains(agvTask.getId());
|
|
||||||
if (!containsElement) {
|
|
||||||
groupedTasks.computeIfAbsent(obj.toString(), k -> new CopyOnWriteArrayList<>()).add(agvTask.getId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 检查是否满足四个为一组或者时间超过五分钟
|
|
||||||
if ((isGroupingConditionsMet() || timeExceeded()) && isLine() ) {
|
|
||||||
issueGroupedTasks();
|
|
||||||
groupedTasks.clear();
|
|
||||||
lastTaskTime = System.currentTimeMillis();
|
|
||||||
}else{
|
|
||||||
log.info("小件出库料箱任务未满足条件!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isLine() {
|
|
||||||
// 判断缓存输送线上的料箱总数+AGV执行中的数量 不能超过6个
|
|
||||||
int queryCount = agvTaskService.QueryCount("6x1");
|
|
||||||
|
|
||||||
//出库料箱AGV执行中的数量
|
|
||||||
//List<AgvTask> agvTaskList= agvTaskService.findByAgvList(BizStatus.PICK,"PICKER_MOVE");
|
|
||||||
if(queryCount<=6){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isGroupingConditionsMet() {
|
|
||||||
// 判断是否满足四个为一组的条件
|
|
||||||
return groupedTasks.values().stream().anyMatch(tasks -> tasks.size() == 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean timeExceeded() {
|
|
||||||
// 判断时间是否超过3分钟
|
|
||||||
return System.currentTimeMillis() - lastTaskTime >= 2 * 60 * 1000;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void issueGroupedTasks() {
|
|
||||||
// 实现任务下发的逻辑
|
|
||||||
// 可以遍历groupedTasks,处理每个分组的任务
|
|
||||||
for (List<Integer> tasksInGroup : groupedTasks.values()) {
|
|
||||||
List<AgvTask> agvTaskList= agvTaskService.findById(tasksInGroup);
|
|
||||||
String rul=agvTaskService.sendAgvTaskLXImpl(agvTaskList);
|
|
||||||
System.out.println(rul);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ public class BaseStatus {
|
||||||
public static Boolean F =false;
|
public static Boolean F =false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 点位类型-按钮盒点位
|
* 点位类型-线边点位
|
||||||
*/
|
*/
|
||||||
public static String BOX = "BOX";
|
public static String BOX = "BOX";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ArrayBlockingQueue;
|
import java.util.concurrent.ArrayBlockingQueue;
|
||||||
import java.util.concurrent.BlockingQueue;
|
import java.util.concurrent.BlockingQueue;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
@ -22,13 +23,10 @@ public class EladminSystemApplicationTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
List<Integer> list1 = Arrays.asList();
|
Map<String, List<String>> concurrentMapMsg = new ConcurrentHashMap<>();
|
||||||
List<Integer> list2 = Arrays.asList();
|
List<String> list1 = Arrays.asList("001库存不足!","002库存不足!", "003分配成功");
|
||||||
|
concurrentMapMsg.put("GD202406261053", list1);
|
||||||
List<Integer> list3 = new ArrayList<>(list1);
|
System.out.println(list1);
|
||||||
list3.addAll(list2);
|
|
||||||
|
|
||||||
System.out.println(list3); // 输出: [1, 2, 3, 4, 5]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final int MAX_TASK_COUNT = 4;
|
private static final int MAX_TASK_COUNT = 4;
|
||||||
|
|
@ -37,6 +35,14 @@ public class EladminSystemApplicationTests {
|
||||||
private List<Integer> taskQueue = new ArrayList<>(MAX_TASK_COUNT);
|
private List<Integer> taskQueue = new ArrayList<>(MAX_TASK_COUNT);
|
||||||
|
|
||||||
void aa(){
|
void aa(){
|
||||||
|
List<Integer> list1 = Arrays.asList();
|
||||||
|
List<Integer> list2 = Arrays.asList();
|
||||||
|
|
||||||
|
List<Integer> list3 = new ArrayList<>(list1);
|
||||||
|
list3.addAll(list2);
|
||||||
|
|
||||||
|
System.out.println(list3); // 输出: [1, 2, 3, 4, 5]
|
||||||
|
|
||||||
/*double taoQty=2;//基础套数
|
/*double taoQty=2;//基础套数
|
||||||
double xTaoQty=3;//需求套数
|
double xTaoQty=3;//需求套数
|
||||||
double ckdQty=Math.ceil(xTaoQty/taoQty);//生成出库单数量
|
double ckdQty=Math.ceil(xTaoQty/taoQty);//生成出库单数量
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue