Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -29,7 +29,7 @@ public class ToWmsApiController {
|
|||||||
private IRequestLogService requestLogService;
|
private IRequestLogService requestLogService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 入库请求生成作业
|
* 请求生成入库作业
|
||||||
*/
|
*/
|
||||||
@PostMapping("/requestEnterByTrayCode")
|
@PostMapping("/requestEnterByTrayCode")
|
||||||
public AjaxResult requestEnterByTrayCode(@RequestBody RequestEnter requestEnter) {
|
public AjaxResult requestEnterByTrayCode(@RequestBody RequestEnter requestEnter) {
|
||||||
|
|||||||
@@ -40,5 +40,4 @@ public interface IToErpService {
|
|||||||
|
|
||||||
void AddStockinDetailByErpStockinDetail(ErpInStockinDetail erpInStockinetail);
|
void AddStockinDetailByErpStockinDetail(ErpInStockinDetail erpInStockinetail);
|
||||||
|
|
||||||
String getCargoSpaceByProductInfo(String productId);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -458,7 +458,7 @@ public class ToErpServiceImpl implements IToErpService {
|
|||||||
* 入库单据 -> 请求入库单列表
|
* 入库单据 -> 请求入库单列表
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Scheduled(fixedDelay = 60_000)
|
@Scheduled(fixedDelay = 600_000)
|
||||||
public AjaxResult getErpStockinList(){
|
public AjaxResult getErpStockinList(){
|
||||||
|
|
||||||
ErpStockinParam erpStockinParam = new ErpStockinParam();
|
ErpStockinParam erpStockinParam = new ErpStockinParam();
|
||||||
@@ -468,22 +468,31 @@ public class ToErpServiceImpl implements IToErpService {
|
|||||||
if (num > 0){
|
if (num > 0){
|
||||||
//当前时间
|
//当前时间
|
||||||
DateTime dateNow = DateUtil.date();
|
DateTime dateNow = DateUtil.date();
|
||||||
String dateStart = dateNow.offset(DateField.SECOND, -60).toString();
|
String dateStart = dateNow.offset(DateField.SECOND, -60).toString();//开始时间
|
||||||
String dateEnd = DateUtil.date().toString();
|
String dateEnd = DateUtil.date().toString();//当前时间
|
||||||
//todo 请求筛选时间似乎时分秒条件无效,只能筛选年月日条件
|
//todo 请求筛选时间似乎时分秒条件无效,只能筛选年月日条件
|
||||||
//todo 请求筛选时间似乎时分秒条件无效,只能筛选年月日条件
|
//todo 请求筛选时间似乎时分秒条件无效,只能筛选年月日条件
|
||||||
// erpStockinParam.setDate3Start(dateStart);//请求筛选:开始时间
|
// erpStockinParam.setDate3Start(dateStart);//请求筛选:开始时间
|
||||||
// erpStockinParam.setDate3End(dateEnd);//请求筛选:结束时间
|
// erpStockinParam.setDate3End(dateEnd);//请求筛选:结束时间
|
||||||
}
|
}
|
||||||
|
|
||||||
//测试
|
//测试参数 - 无主题筛选 - 默认关键字【冷】
|
||||||
erpStockinParam.setTitle("");
|
erpStockinParam.setTitle("");
|
||||||
// erpStockinParam.setNeedList(0);
|
//测试参数 - 入库状态(0=全部, 1=待入库, 2=已入库, 3=已取消...) 默认 - 1
|
||||||
|
//erpStockinParam.setComplete1(1);
|
||||||
|
//测试参数 - 无请求明细【0】
|
||||||
|
//erpStockinParam.setNeedList(0);
|
||||||
|
|
||||||
|
//=================================================================== 主单 =====================================================================
|
||||||
|
|
||||||
try {
|
try {
|
||||||
log.info(">>>>>>>>>>>>>>>>>>>> 开始更新入库单据 >>>>>>>>>>>>>>>>>>>>");
|
log.info(">>>>>>>>>>>>>>>>>>>> 开始更新入库单据 >>>>>>>>>>>>>>>>>>>>");
|
||||||
//------获取请求响应
|
//------获取请求响应
|
||||||
String response = getResponse(getStockinListUrl, erpStockinParam, "更新入库单据");
|
String response = getResponse(getStockinListUrl, erpStockinParam, "更新入库单据");
|
||||||
|
if (response == null) {
|
||||||
|
log.info("请求异常:响应信息为空!检查请求内容!");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
//------处理响应信息
|
//------处理响应信息
|
||||||
ErpStockinResponse res = JSONUtil.toBean(response, ErpStockinResponse.class);
|
ErpStockinResponse res = JSONUtil.toBean(response, ErpStockinResponse.class);
|
||||||
@@ -526,7 +535,7 @@ public class ToErpServiceImpl implements IToErpService {
|
|||||||
//------更新wms主单
|
//------更新wms主单
|
||||||
AddStockinByErpStockin(erpInStockin);
|
AddStockinByErpStockin(erpInStockin);
|
||||||
|
|
||||||
//========================================================================================================================================
|
//=================================================================== 明细 =====================================================================
|
||||||
|
|
||||||
//------根据主单【kuinlist】字段获取子单信息
|
//------根据主单【kuinlist】字段获取子单信息
|
||||||
if (erpStockinParam.getNeedList() == 1) {
|
if (erpStockinParam.getNeedList() == 1) {
|
||||||
@@ -555,8 +564,8 @@ public class ToErpServiceImpl implements IToErpService {
|
|||||||
erpInStockinDetail.setSpare2(Convert.toStr(details.get(2)));//产品型号 - product_id
|
erpInStockinDetail.setSpare2(Convert.toStr(details.get(2)));//产品型号 - product_id
|
||||||
|
|
||||||
//自动分配货位区域
|
//自动分配货位区域
|
||||||
String cargoSpace = getCargoSpaceByProductInfo(Convert.toStr(details.get(2)));
|
// String cargoSpace = getCargoSpaceByProductInfo(Convert.toStr(details.get(2)));
|
||||||
erpInStockinDetail.setWarehousePositionID(cargoSpace);//货位
|
// erpInStockinDetail.setWarehousePositionID(cargoSpace);//货位
|
||||||
|
|
||||||
//关联主单
|
//关联主单
|
||||||
erpInStockinDetail.setKuin(erpInStockin.getKuin());//入库id
|
erpInStockinDetail.setKuin(erpInStockin.getKuin());//入库id
|
||||||
@@ -589,6 +598,7 @@ public class ToErpServiceImpl implements IToErpService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成入库单据 -> 获取请求响应
|
* 生成入库单据 -> 获取请求响应
|
||||||
* @param url 请求地址
|
* @param url 请求地址
|
||||||
@@ -615,13 +625,15 @@ public class ToErpServiceImpl implements IToErpService {
|
|||||||
requestLog.setRequestUrl(url);
|
requestLog.setRequestUrl(url);
|
||||||
requestLog.setRequestMethod("POST");
|
requestLog.setRequestMethod("POST");
|
||||||
requestLog.setRequestBody(JSONUtil.toJsonStr(param));
|
requestLog.setRequestBody(JSONUtil.toJsonStr(param));
|
||||||
requestLog.setIsSuccessful("");
|
requestLog.setResponseBody(JSONUtil.toJsonStr(response));
|
||||||
|
requestLog.setIsSuccessful("1");
|
||||||
requestLogService.insertRequestLog(requestLog);
|
requestLogService.insertRequestLog(requestLog);
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("请求异常:" + e.getMessage());
|
log.error("请求异常:" + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -635,7 +647,7 @@ public class ToErpServiceImpl implements IToErpService {
|
|||||||
try {
|
try {
|
||||||
inStockin.setStockinGuid(erpInStockin.getStockinGuid());//guid
|
inStockin.setStockinGuid(erpInStockin.getStockinGuid());//guid
|
||||||
inStockin.setStockinId(erpInStockin.getKuin());//入库单据id
|
inStockin.setStockinId(erpInStockin.getKuin());//入库单据id
|
||||||
inStockin.setStatus(erpInStockin.getComplete1());//入库状态(区别erpInStockin.getStatus() - 审批状态)
|
inStockin.setStatus(erpInStockin.getComplete1());//入库状态(区别审批状态 - erpInStockin.getStatus())
|
||||||
inStockin.setCreateDate(DateUtil.now());//生成时间
|
inStockin.setCreateDate(DateUtil.now());//生成时间
|
||||||
inStockin.setErpBill(erpInStockin.getRkbh());//入库编号 RK_2025082107
|
inStockin.setErpBill(erpInStockin.getRkbh());//入库编号 RK_2025082107
|
||||||
inStockin.setInType(erpInStockin.getSort1());//入库类别
|
inStockin.setInType(erpInStockin.getSort1());//入库类别
|
||||||
@@ -688,74 +700,5 @@ public class ToErpServiceImpl implements IToErpService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 生成入库单据 -> 向子单明细分配入库货位
|
|
||||||
* 获取库存物料号 -> 货位id -> 存储区组group -> 状态:未占用 -> 按规则获取货位
|
|
||||||
* @param productId 物料号
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public String getCargoSpaceByProductInfo(String productId){
|
|
||||||
|
|
||||||
//>>>>>>>>>>>>>>获取物料库存信息 -> 有库存 -> 货位(cargospace) -> 存储区组(groupCodingNo) -> 根据groupCoding(由高到低) -> 获取状态1的货位分配
|
|
||||||
//>>>>>>>>>>>>>>获取物料库存信息 -> 无库存 -> 遍历存储区组(groupCodingNo) -> 查找全部货位空的区组 -> 根据groupCoding(由高到低) -> 获取状态1的货位分配
|
|
||||||
|
|
||||||
try {
|
|
||||||
//获取物料的货位集合 - 首先查找已经存放该物料的存储区
|
|
||||||
List<BasStock> stocks = basStockService.selectBasStockListByProductId(productId);
|
|
||||||
|
|
||||||
//如果集合空 - 寻找未被占用的存储区组放货
|
|
||||||
if (stocks.size() == 0) {
|
|
||||||
for (int i = 1; i <= 45; i++) {
|
|
||||||
BasCargoSpace cargospace = new BasCargoSpace();
|
|
||||||
|
|
||||||
//存储区
|
|
||||||
String groupCodingNo = String.format("%03d", i);
|
|
||||||
cargospace.setGroupCodingNo(groupCodingNo);
|
|
||||||
|
|
||||||
//获取【groupCodingNo】所有货位
|
|
||||||
List<BasCargoSpace> cargoSpaces = basCargoSpaceService.selectBasCargoSpaceList(cargospace);
|
|
||||||
|
|
||||||
//判断是否全部未占用,即某存储区全部为空位 - 避免物料混放
|
|
||||||
boolean isAllEmpty = cargoSpaces.stream().allMatch(c -> "1".equals(c.getStatus()));
|
|
||||||
|
|
||||||
//区域未占用 - 则分配最内侧货位
|
|
||||||
if (isAllEmpty && cargoSpaces.size() > 0) {
|
|
||||||
cargoSpaces.sort(Comparator.comparing(BasCargoSpace::getGroupCoding).reversed());
|
|
||||||
return cargoSpaces.get(0).getCargoSpaceId();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//如果物料已经存放在多个货位(区域) - 去重
|
|
||||||
List<BasStock> stocksNew = stocks.stream().distinct().collect(Collectors.toList());
|
|
||||||
|
|
||||||
//查询对应货位的区域在【BasCargoSpace】是否有空位 - 在groupCodingNo的分组中是否仍然有状态【1】的货位
|
|
||||||
for (BasStock stock : stocksNew){
|
|
||||||
//获取每种物料的存放货位信息
|
|
||||||
BasCargoSpace cargoSpace = basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(stock.getCargoSpaceId());
|
|
||||||
|
|
||||||
//获取每种物料的存放货位信息 - 存储区
|
|
||||||
String group = cargoSpace.getGroupCodingNo();
|
|
||||||
|
|
||||||
//获取该存储区组的所有货位
|
|
||||||
List<BasCargoSpace> cargoSpaces = basCargoSpaceService.selectBasCargoSpaceListByGroupCodingNo(group);
|
|
||||||
|
|
||||||
//在集合中获取状态为【1】的货位
|
|
||||||
for (BasCargoSpace cs : cargoSpaces){
|
|
||||||
//货位状态:1(未占用) -> 返回该货位结果
|
|
||||||
if ("1".equals(cs.getStatus())){
|
|
||||||
return cs.getCargoSpaceId();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}catch(Exception e){
|
|
||||||
log.error("入库子单获取目标货位失败,异常信息:" + e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,20 +23,28 @@ import com.ruoyi.common.utils.MessageUtils;
|
|||||||
import com.ruoyi.device.agv.service.IAgvContainerTaskService;
|
import com.ruoyi.device.agv.service.IAgvContainerTaskService;
|
||||||
import com.ruoyi.in.erp.service.ITransferBillCallbackService;
|
import com.ruoyi.in.erp.service.ITransferBillCallbackService;
|
||||||
import com.ruoyi.in.stockin.service.IInStockinService;
|
import com.ruoyi.in.stockin.service.IInStockinService;
|
||||||
|
import com.ruoyi.in.stockindetail.domain.InStockinDetail;
|
||||||
import com.ruoyi.in.stockindetail.service.IInStockinDetailService;
|
import com.ruoyi.in.stockindetail.service.IInStockinDetailService;
|
||||||
import com.ruoyi.job.mydojob.domain.MydoJob;
|
import com.ruoyi.job.mydojob.domain.MydoJob;
|
||||||
import com.ruoyi.job.mydojob.service.IMydoJobService;
|
import com.ruoyi.job.mydojob.service.IMydoJobService;
|
||||||
import com.ruoyi.job.mydojobdetail.domain.MydoJobDetail;
|
import com.ruoyi.job.mydojobdetail.domain.MydoJobDetail;
|
||||||
import com.ruoyi.job.mydojobdetail.service.IMydoJobDetailService;
|
import com.ruoyi.job.mydojobdetail.service.IMydoJobDetailService;
|
||||||
import com.ruoyi.out.outStockout.service.IOutStockoutService;
|
import com.ruoyi.out.outStockout.service.IOutStockoutService;
|
||||||
|
import com.ruoyi.pda.trayMsg.domain.TrayMsg;
|
||||||
|
import com.ruoyi.pda.trayMsg.service.ITrayMsgService;
|
||||||
|
import com.ruoyi.stock.stock.domain.BasStock;
|
||||||
|
import com.ruoyi.stock.stock.service.IBasStockService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 作业统计 Service 实现
|
* 作业统计 Service 实现
|
||||||
@@ -77,13 +85,141 @@ public class ToWmsServiceImpl implements IToWmsService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IBasRoadwayService basRoadwayService;
|
private IBasRoadwayService basRoadwayService;
|
||||||
|
|
||||||
|
//条码绑定
|
||||||
|
@Autowired
|
||||||
|
private ITrayMsgService trayMsgService;
|
||||||
|
|
||||||
|
//库存
|
||||||
|
@Autowired
|
||||||
|
private IBasStockService basStockService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public AjaxResult requestEnterByTrayCode(RequestEnter requestEnter) {
|
public AjaxResult requestEnterByTrayCode(RequestEnter requestEnter) {
|
||||||
|
|
||||||
|
//校验 - 条码空
|
||||||
|
if (StrUtil.isEmpty(requestEnter.getTrayCode())) {
|
||||||
|
return AjaxResult.error("托盘条码不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
//校验 - 条码已经有作业
|
||||||
|
if (ObjUtil.isNotNull(mydoJobService.selectMydoJobByTrayCode(requestEnter.getTrayCode()))) {
|
||||||
|
return AjaxResult.error("已存在该条码的入库作业:" + requestEnter.getTrayCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
//入库分配 20251210
|
||||||
|
//根据已绑定条码获取子单物料号
|
||||||
|
TrayMsg msg = new TrayMsg();
|
||||||
|
msg.setTrayCode(requestEnter.getTrayCode());
|
||||||
|
List<TrayMsg> list = trayMsgService.selectTrayMsgList(msg);
|
||||||
|
|
||||||
|
//校验 - 条码未绑定子单
|
||||||
|
if (!CollUtil.isNotEmpty(list)) {
|
||||||
|
log.info("未找到该托盘【" + requestEnter.getTrayCode() + "】绑定的子单据,请检查绑定列表");
|
||||||
|
return AjaxResult.error("该托盘未绑定子单据:" + requestEnter.getTrayCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取绑定的子单信息
|
||||||
|
InStockinDetail inStockinDetail = inStockinDetailService.selectInStockinDetailByStockinDetailId(list.get(0).getStockinDetailId());
|
||||||
|
|
||||||
|
//获取货位
|
||||||
|
String cargoSpaceId = getCargoSpaceByProductInfo(inStockinDetail.getProductId());
|
||||||
|
|
||||||
|
//是否有符合条件的货位
|
||||||
|
if (!StringUtils.isNotBlank(cargoSpaceId)) {
|
||||||
|
return AjaxResult.error("无符合条件的货位用于分配,请检查库存区占用情况,物料号:" + inStockinDetail.getProductId());
|
||||||
|
}
|
||||||
|
|
||||||
|
//返回入库作业参数
|
||||||
|
MydoJob mydoJob = new MydoJob();
|
||||||
|
HashMap<String, String> map = new HashMap<>();
|
||||||
|
map.put("v_param", "RK");
|
||||||
|
mydoJobService.getInJobId(map);//存储过程【util_serial_job】生成作业号
|
||||||
|
mydoJob.setJobId(map.get("v_serial"));
|
||||||
|
mydoJob.setCargoSpaceId(cargoSpaceId);
|
||||||
|
mydoJob.setInOrOut("1");
|
||||||
|
mydoJob.setTrayCode(requestEnter.getTrayCode());
|
||||||
|
|
||||||
|
|
||||||
|
// HashMap<String, String> result = new HashMap<>();
|
||||||
|
// result.put("cargoSpaceId",cargoSpaceId);
|
||||||
|
|
||||||
|
return AjaxResult.success(mydoJob);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* requestEnterByTrayCode -> 入库货位分配
|
||||||
|
* 入库任务请求根据托盘码 -> 向子单明细分配入库货位
|
||||||
|
* 获取库存物料号 -> 货位id -> 存储区组group -> 状态:未占用 -> 按规则获取货位
|
||||||
|
* @param productId 物料号
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getCargoSpaceByProductInfo(String productId){
|
||||||
|
|
||||||
|
//>>>>>>>>>>>>>>获取物料库存信息 -> 有库存 -> 货位(cargospace) -> 存储区组(groupCodingNo) -> 根据groupCoding(由高到低) -> 获取状态1的货位分配
|
||||||
|
//>>>>>>>>>>>>>>获取物料库存信息 -> 无库存 -> 遍历存储区组(groupCodingNo) -> 查找全部货位空的区组 -> 根据groupCoding(由高到低) -> 获取状态1的货位分配
|
||||||
|
|
||||||
|
try {
|
||||||
|
//获取物料的货位集合 - 首先查找已经存放该物料的存储区
|
||||||
|
List<BasStock> stocks = basStockService.selectBasStockListByProductId(productId);
|
||||||
|
|
||||||
|
//如果集合空 - 寻找未被占用的存储区组放货
|
||||||
|
if (stocks.size() == 0) {
|
||||||
|
for (int i = 1; i <= 45; i++) {
|
||||||
|
BasCargoSpace cargospace = new BasCargoSpace();
|
||||||
|
|
||||||
|
//存储区
|
||||||
|
String groupCodingNo = String.format("%03d", i);
|
||||||
|
cargospace.setGroupCodingNo(groupCodingNo);
|
||||||
|
|
||||||
|
//获取【groupCodingNo】所有货位
|
||||||
|
List<BasCargoSpace> cargoSpaces = basCargoSpaceService.selectBasCargoSpaceList(cargospace);
|
||||||
|
|
||||||
|
//判断是否全部未占用,即某存储区全部为空位 - 避免物料混放
|
||||||
|
boolean isAllEmpty = cargoSpaces.stream().allMatch(c -> "1".equals(c.getStatus()));
|
||||||
|
|
||||||
|
//区域未占用 - 则分配最内侧货位
|
||||||
|
if (isAllEmpty && cargoSpaces.size() > 0) {
|
||||||
|
cargoSpaces.sort(Comparator.comparing(BasCargoSpace::getGroupCoding).reversed());
|
||||||
|
return cargoSpaces.get(0).getCargoSpaceId();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//如果物料已经存放在多个货位(区域) - 去重
|
||||||
|
List<BasStock> stocksNew = stocks.stream().distinct().collect(Collectors.toList());
|
||||||
|
|
||||||
|
//查询对应货位的区域在【BasCargoSpace】是否有空位 - 在groupCodingNo的分组中是否仍然有状态【1】的货位
|
||||||
|
for (BasStock stock : stocksNew){
|
||||||
|
//获取每种物料的存放货位信息
|
||||||
|
BasCargoSpace cargoSpace = basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(stock.getCargoSpaceId());
|
||||||
|
|
||||||
|
//获取每种物料的存放货位信息 - 存储区
|
||||||
|
String group = cargoSpace.getGroupCodingNo();
|
||||||
|
|
||||||
|
//获取该存储区组的所有货位
|
||||||
|
List<BasCargoSpace> cargoSpaces = basCargoSpaceService.selectBasCargoSpaceListByGroupCodingNo(group);
|
||||||
|
|
||||||
|
//在集合中获取状态为【1】的货位
|
||||||
|
for (BasCargoSpace cs : cargoSpaces){
|
||||||
|
//货位状态:1(未占用) -> 返回该货位结果
|
||||||
|
if ("1".equals(cs.getStatus())){
|
||||||
|
return cs.getCargoSpaceId();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}catch(Exception e){
|
||||||
|
log.error("入库子单获取目标货位失败,异常信息:" + e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult selectMydoJobByEntranceId(RequestEnter requestEnter) {
|
public AjaxResult selectMydoJobByEntranceId(RequestEnter requestEnter) {
|
||||||
MydoJob param = new MydoJob();
|
MydoJob param = new MydoJob();
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
package com.ruoyi.bas.traycode.service.impl;
|
package com.ruoyi.bas.traycode.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.convert.Convert;
|
||||||
import com.ruoyi.bas.traycode.domain.BasTraycode;
|
import com.ruoyi.bas.traycode.domain.BasTraycode;
|
||||||
import com.ruoyi.bas.traycode.mapper.BasTraycodeMapper;
|
import com.ruoyi.bas.traycode.mapper.BasTraycodeMapper;
|
||||||
import com.ruoyi.bas.traycode.service.IBasTraycodeService;
|
import com.ruoyi.bas.traycode.service.IBasTraycodeService;
|
||||||
|
import com.ruoyi.bas.traycodeformat.domain.BasTraycodeFormat;
|
||||||
|
import com.ruoyi.bas.traycodeformat.service.IBasTraycodeFormatService;
|
||||||
import com.ruoyi.common.utils.DateUtils;
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -21,6 +24,8 @@ public class BasTraycodeServiceImpl implements IBasTraycodeService
|
|||||||
{
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
private BasTraycodeMapper basTraycodeMapper;
|
private BasTraycodeMapper basTraycodeMapper;
|
||||||
|
@Autowired
|
||||||
|
private IBasTraycodeFormatService basTraycodeFormatService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询条码信息
|
* 查询条码信息
|
||||||
@@ -56,24 +61,28 @@ public class BasTraycodeServiceImpl implements IBasTraycodeService
|
|||||||
public int insertBasTraycode(BasTraycode basTraycode)
|
public int insertBasTraycode(BasTraycode basTraycode)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
Integer i = basTraycodeMapper.selectBasTrayCodeMax();
|
BasTraycodeFormat basTraycodeFormat = basTraycodeFormatService.selectBasTraycodeFormatById(basTraycode.getFormatId());
|
||||||
if (i == null) {
|
|
||||||
i = 0;
|
|
||||||
}
|
|
||||||
int i1 = Integer.parseInt(basTraycode.getSpare1());
|
int i1 = Integer.parseInt(basTraycode.getSpare1());
|
||||||
//如果i<4位数,前面补0
|
//如果i<4位数,前面补0
|
||||||
String code = "";
|
String code = "";
|
||||||
for (int j = 0; j < i1; j++) {
|
for (int j = 0; j < i1; j++) {
|
||||||
code = String.format("%04d", i + 1 + j);
|
code = String.format("%07d",Convert.toInt( basTraycodeFormat.getSerialRule()) + 1 + j);
|
||||||
if("9999".equals( code)){
|
if(basTraycodeFormat.getMaxNum() < Convert.toLong( code)){
|
||||||
throw new RuntimeException("已生成最大值");
|
throw new RuntimeException("已生成最大值");
|
||||||
}
|
}
|
||||||
basTraycode.setTrayCode(code);
|
String finalCode = basTraycodeFormat.getBarcodeFormat()+code;
|
||||||
|
basTraycode.setTrayCode(finalCode);
|
||||||
basTraycode.setSpare1(null);
|
basTraycode.setSpare1(null);
|
||||||
basTraycode.setCreateTime(DateUtils.getNowDate());
|
basTraycode.setCreateTime(DateUtils.getNowDate());
|
||||||
basTraycode.setSpare2("Y");
|
basTraycode.setSpare2("Y");
|
||||||
basTraycodeMapper.insertBasTraycode(basTraycode);
|
basTraycodeMapper.insertBasTraycode(basTraycode);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
basTraycodeFormat.setSerialRule(Convert.toLong( code).toString());
|
||||||
|
basTraycodeFormatService.updateBasTraycodeFormat(basTraycodeFormat);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,20 +79,7 @@ public class BasTraycodeFormatServiceImpl implements IBasTraycodeFormatService
|
|||||||
public int updateBasTraycodeFormat(BasTraycodeFormat basTraycodeFormat)
|
public int updateBasTraycodeFormat(BasTraycodeFormat basTraycodeFormat)
|
||||||
{
|
{
|
||||||
BasTraycodeFormat old = selectBasTraycodeFormatById(basTraycodeFormat.getId());
|
BasTraycodeFormat old = selectBasTraycodeFormatById(basTraycodeFormat.getId());
|
||||||
int oldSerialRule = Convert.toInt(old.getSerialRule());
|
|
||||||
int newSerialRule = Convert.toInt(basTraycodeFormat.getSerialRule());
|
|
||||||
|
|
||||||
List<BasTraycode> traycodeList = new ArrayList<>();
|
|
||||||
for (int i = oldSerialRule; i < newSerialRule; i++) {
|
|
||||||
BasTraycode basTraycode = new BasTraycode();
|
|
||||||
basTraycode.setFormatId(basTraycodeFormat.getId());
|
|
||||||
String traycode = old.getBarcodeFormat()+ StrUtil.padPre(Convert.toStr(i),5,'0');
|
|
||||||
basTraycode.setTrayCode(traycode);
|
|
||||||
traycodeList.add(basTraycode);
|
|
||||||
}
|
|
||||||
basTraycodeFormat.setUpdateTime(DateUtils.getNowDate());
|
basTraycodeFormat.setUpdateTime(DateUtils.getNowDate());
|
||||||
//插入条码信息
|
|
||||||
basTraycodeService.insertBasTraycodeList(traycodeList);
|
|
||||||
return basTraycodeFormatMapper.updateBasTraycodeFormat(basTraycodeFormat);
|
return basTraycodeFormatMapper.updateBasTraycodeFormat(basTraycodeFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ public interface MydoJobMapper
|
|||||||
*/
|
*/
|
||||||
public int insertMydoJob(MydoJob mydoJob);
|
public int insertMydoJob(MydoJob mydoJob);
|
||||||
|
|
||||||
|
public void getInJobId(HashMap<String, String> map);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改任务表
|
* 修改任务表
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.ruoyi.job.mydojob.service;
|
|||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.job.mydojob.domain.MydoJob;
|
import com.ruoyi.job.mydojob.domain.MydoJob;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -36,6 +37,8 @@ public interface IMydoJobService
|
|||||||
*/
|
*/
|
||||||
public List<MydoJob> selectMydoJobListApi(MydoJob mydoJob);
|
public List<MydoJob> selectMydoJobListApi(MydoJob mydoJob);
|
||||||
|
|
||||||
|
public void getInJobId(HashMap<String, String> map);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增任务表
|
* 新增任务表
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -118,6 +118,11 @@ public class MydoJobServiceImpl implements IMydoJobService {
|
|||||||
return mydoJobMapper.selectMydoJobList(mydoJob);
|
return mydoJobMapper.selectMydoJobList(mydoJob);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getInJobId(HashMap<String, String> map){
|
||||||
|
mydoJobMapper.getInJobId(map);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增任务表
|
* 新增任务表
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public class TrayMsgServiceImpl implements ITrayMsgService
|
|||||||
* @return trayMsg
|
* @return trayMsg
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@DataScope(warehouseAlias = "w")
|
// @DataScope(warehouseAlias = "w")
|
||||||
public List<TrayMsg> selectTrayMsgList(TrayMsg trayMsg)
|
public List<TrayMsg> selectTrayMsgList(TrayMsg trayMsg)
|
||||||
{
|
{
|
||||||
return trayMsgMapper.selectTrayMsgList(trayMsg);
|
return trayMsgMapper.selectTrayMsgList(trayMsg);
|
||||||
|
|||||||
@@ -106,7 +106,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
where mj.job_id = #{jobId}
|
where mj.job_id = #{jobId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertMydoJob" parameterType="MydoJob">
|
<select id="getInJobId" statementType="CALLABLE" parameterType="java.util.Map">
|
||||||
|
{ CALL util_serial_job(
|
||||||
|
#{v_param,jdbcType=VARCHAR,mode=IN},
|
||||||
|
#{v_serial,mode=OUT,jdbcType=VARCHAR}
|
||||||
|
) }
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertMydoJob">
|
||||||
insert into mydo_job
|
insert into mydo_job
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
<if test="jobId != null and jobId != ''">job_id,</if>
|
<if test="jobId != null and jobId != ''">job_id,</if>
|
||||||
|
|||||||
@@ -44,6 +44,7 @@
|
|||||||
"sortablejs": "1.10.2",
|
"sortablejs": "1.10.2",
|
||||||
"splitpanes": "2.4.1",
|
"splitpanes": "2.4.1",
|
||||||
"vue": "2.6.12",
|
"vue": "2.6.12",
|
||||||
|
"vue-barcode": "^1.3.0",
|
||||||
"vue-count-to": "1.0.13",
|
"vue-count-to": "1.0.13",
|
||||||
"vue-cropper": "0.5.5",
|
"vue-cropper": "0.5.5",
|
||||||
"vue-easy-print": "^0.0.8",
|
"vue-easy-print": "^0.0.8",
|
||||||
|
|||||||
@@ -103,7 +103,7 @@
|
|||||||
<div class="qrcode-container">
|
<div class="qrcode-container">
|
||||||
<vue-qr
|
<vue-qr
|
||||||
:text="qrCodeValue"
|
:text="qrCodeValue"
|
||||||
:size="180"
|
:size="80"
|
||||||
:margin="0"
|
:margin="0"
|
||||||
:correctLevel="2"
|
:correctLevel="2"
|
||||||
error-correction-level="M"
|
error-correction-level="M"
|
||||||
@@ -116,8 +116,8 @@
|
|||||||
|
|
||||||
<!-- 打印专用区域(隐藏) -->
|
<!-- 打印专用区域(隐藏) -->
|
||||||
<vue-easy-print style="display: none;" ref="easyPrint2">
|
<vue-easy-print style="display: none;" ref="easyPrint2">
|
||||||
<div class="vue-easy-print" style="page-break-after:always">
|
<div class="vue-easy-print">
|
||||||
<div class="label-content">
|
<div class="print-label">
|
||||||
<div class="preview-box">
|
<div class="preview-box">
|
||||||
<div class="preview-content">
|
<div class="preview-content">
|
||||||
<div class="preview-row">
|
<div class="preview-row">
|
||||||
@@ -158,10 +158,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- 二维码区域 -->
|
<!-- 二维码区域 -->
|
||||||
<div class="qrcode-container">
|
<div class="qrcode-container" style="top:2mm;right:2mm;">
|
||||||
<vue-qr
|
<vue-qr
|
||||||
:text="qrCodeValue"
|
:text="qrCodeValue"
|
||||||
:size="180"
|
:size="120"
|
||||||
:margin="0"
|
:margin="0"
|
||||||
:correctLevel="2"
|
:correctLevel="2"
|
||||||
error-correction-level="M"
|
error-correction-level="M"
|
||||||
@@ -969,7 +969,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.preview-display {
|
.preview-display {
|
||||||
padding: 0 20px 20px;
|
padding: 0 10px 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.label-content {
|
.label-content {
|
||||||
@@ -978,6 +978,19 @@ export default {
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 打印单页标签尺寸(按实际贴纸尺寸调整) */
|
||||||
|
.print-label {
|
||||||
|
width: 90mm; /* 贴纸宽度 */
|
||||||
|
height: 30mm; /* 贴纸高度 */
|
||||||
|
padding: 6mm; /* 安全边距 */
|
||||||
|
box-sizing: border-box;
|
||||||
|
display: flex;
|
||||||
|
align-items: stretch;
|
||||||
|
background: #fff;
|
||||||
|
border: 1px solid #e4e7ed;
|
||||||
|
border-radius: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
.preview-box {
|
.preview-box {
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
font-family: 'Arial', sans-serif;
|
font-family: 'Arial', sans-serif;
|
||||||
@@ -1103,26 +1116,63 @@ export default {
|
|||||||
@media print {
|
@media print {
|
||||||
@page {
|
@page {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
size: auto;
|
size: 90mm 30mm;
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.vue-easy-print {
|
||||||
|
width: 90mm;
|
||||||
|
height: 30mm;
|
||||||
|
}
|
||||||
|
|
||||||
.preview-box {
|
.preview-box {
|
||||||
border: none;
|
border: none;
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
padding: 0;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
|
|
||||||
|
.preview-content {
|
||||||
|
margin-right: 38mm;
|
||||||
|
padding-right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.preview-row {
|
||||||
|
margin-bottom: 4px;
|
||||||
|
min-height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.preview-label {
|
||||||
|
font-size: 14px;
|
||||||
|
min-width: 10mm;
|
||||||
|
margin-right: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.preview-value {
|
||||||
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.qrcode-container {
|
.qrcode-container {
|
||||||
border: none;
|
border: none;
|
||||||
position: absolute !important;
|
position: absolute !important;
|
||||||
top: 20px !important;
|
top: 2mm !important;
|
||||||
right: 20px !important;
|
right: 2mm !important;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 提高打印品质,避免缩放导致模糊 */
|
||||||
|
* {
|
||||||
|
-webkit-print-color-adjust: exact;
|
||||||
|
print-color-adjust: exact;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -150,7 +150,7 @@
|
|||||||
<!-- 添加或修改条码信息对话框 -->
|
<!-- 添加或修改条码信息对话框 -->
|
||||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||||
<!-- <el-form-item label="格式ID" prop="formatId">
|
<el-form-item label="格式ID" prop="formatId">
|
||||||
<el-select v-model="form.formatId" placeholder="请选择格式ID">
|
<el-select v-model="form.formatId" placeholder="请选择格式ID">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in traycodeFormatList"
|
v-for="item in traycodeFormatList"
|
||||||
@@ -159,7 +159,7 @@
|
|||||||
:value="item.id"
|
:value="item.id"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>-->
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="数量" prop="spare1" v-if="form.id == null">
|
<el-form-item label="数量" prop="spare1" v-if="form.id == null">
|
||||||
<el-input v-model="form.spare1" placeholder="请输入数量" />
|
<el-input v-model="form.spare1" placeholder="请输入数量" />
|
||||||
@@ -189,10 +189,13 @@
|
|||||||
<!-- 打印模板 -->
|
<!-- 打印模板 -->
|
||||||
<vue-easy-print v-show="true" ref="easyPrint2">
|
<vue-easy-print v-show="true" ref="easyPrint2">
|
||||||
<div v-for="item in printData" :key="item.id" style="page-break-after:always" class="vue-easy-print">
|
<div v-for="item in printData" :key="item.id" style="page-break-after:always" class="vue-easy-print">
|
||||||
<vue-qr :text='item.trayCode' :size="150" :margin="10" :align-item="center" :correctLevel="2"></vue-qr>
|
<vue-barcode
|
||||||
<div>
|
:value=item.trayCode
|
||||||
<span class="num">{{ item.trayCode }}</span>
|
format="CODE39"
|
||||||
</div>
|
width="2"
|
||||||
|
height="100"
|
||||||
|
display-value
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</vue-easy-print>
|
</vue-easy-print>
|
||||||
</div>
|
</div>
|
||||||
@@ -203,14 +206,15 @@ import { listTraycode, getTraycode, delTraycode, addTraycode, updateTraycode } f
|
|||||||
import { listTraycodeFormat } from "@/api/bas/traycodeFormat"
|
import { listTraycodeFormat } from "@/api/bas/traycodeFormat"
|
||||||
import vueEasyPrint from 'vue-easy-print'
|
import vueEasyPrint from 'vue-easy-print'
|
||||||
import VueQr from 'vue-qr'
|
import VueQr from 'vue-qr'
|
||||||
|
import VueBarcode from 'vue-barcode'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Traycode",
|
name: "Traycode",
|
||||||
dicts:['sys_yes_no'],
|
dicts:['sys_yes_no'],
|
||||||
components: {
|
components: {
|
||||||
vueEasyPrint,
|
vueEasyPrint,
|
||||||
VueQr
|
VueQr,
|
||||||
|
VueBarcode
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -455,7 +459,7 @@ export default {
|
|||||||
|
|
||||||
@media print {
|
@media print {
|
||||||
@page {
|
@page {
|
||||||
size: A4;
|
size: 80mm 50mm;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user