|
|
|
@ -1,11 +1,13 @@ |
|
|
|
package org.springblade.wms.service.impl; |
|
|
|
package org.springblade.wms.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import jakarta.annotation.Resource; |
|
|
|
import jakarta.annotation.Resource; |
|
|
|
import jakarta.servlet.http.HttpServletResponse; |
|
|
|
import jakarta.servlet.http.HttpServletResponse; |
|
|
|
import net.sourceforge.barbecue.Barcode; |
|
|
|
import net.sourceforge.barbecue.Barcode; |
|
|
|
@ -18,10 +20,12 @@ import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
import org.springblade.core.secure.BladeUser; |
|
|
|
import org.springblade.core.secure.BladeUser; |
|
|
|
import org.springblade.wms.excel.StRequisitionExcel; |
|
|
|
import org.springblade.wms.excel.StRequisitionExcel; |
|
|
|
import org.springblade.wms.mapper.StRequisitionMapper; |
|
|
|
import org.springblade.wms.mapper.StRequisitionMapper; |
|
|
|
|
|
|
|
import org.springblade.wms.mapper.StUserRightMapper; |
|
|
|
import org.springblade.wms.pojo.dto.StRequisitionDTO; |
|
|
|
import org.springblade.wms.pojo.dto.StRequisitionDTO; |
|
|
|
import org.springblade.wms.pojo.entity.StGoods; |
|
|
|
import org.springblade.wms.pojo.entity.StGoods; |
|
|
|
import org.springblade.wms.pojo.entity.StRequisition; |
|
|
|
import org.springblade.wms.pojo.entity.StRequisition; |
|
|
|
import org.springblade.wms.pojo.entity.StStockInoutRecord; |
|
|
|
import org.springblade.wms.pojo.entity.StStockInoutRecord; |
|
|
|
|
|
|
|
import org.springblade.wms.pojo.entity.StUserRight; |
|
|
|
import org.springblade.wms.pojo.vo.StRequisitionVO; |
|
|
|
import org.springblade.wms.pojo.vo.StRequisitionVO; |
|
|
|
import org.springblade.wms.service.*; |
|
|
|
import org.springblade.wms.service.*; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
@ -52,6 +56,8 @@ public class StRequisitionServiceImpl extends BaseServiceImpl<StRequisitionMappe |
|
|
|
IStGoodsService stGoodsService; |
|
|
|
IStGoodsService stGoodsService; |
|
|
|
@Resource |
|
|
|
@Resource |
|
|
|
IStRealtimeStockService stRealtimeStockService; |
|
|
|
IStRealtimeStockService stRealtimeStockService; |
|
|
|
|
|
|
|
@Resource |
|
|
|
|
|
|
|
StUserRightMapper stUserRightMapper; |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public IPage<StRequisitionVO> selectStRequisitionPage(IPage<StRequisitionVO> page, StRequisitionVO stRequisition) { |
|
|
|
public IPage<StRequisitionVO> selectStRequisitionPage(IPage<StRequisitionVO> page, StRequisitionVO stRequisition) { |
|
|
|
return page.setRecords(baseMapper.selectStRequisitionPage(page, stRequisition)); |
|
|
|
return page.setRecords(baseMapper.selectStRequisitionPage(page, stRequisition)); |
|
|
|
@ -198,29 +204,21 @@ public class StRequisitionServiceImpl extends BaseServiceImpl<StRequisitionMappe |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public Map<String, Object> getBarCode(Long srId) { |
|
|
|
public Map<String, Object> getBarCode(Long srId) { |
|
|
|
// 1. 初始化返回数据结构(与原有getBarCode方法保持一致)
|
|
|
|
|
|
|
|
// Map<String, Object> data = new HashMap<>(1);
|
|
|
|
|
|
|
|
// List<Map<String, String>> list = new ArrayList<>();
|
|
|
|
|
|
|
|
// Map<String, String> map = new HashMap<>();
|
|
|
|
|
|
|
|
Map<String, Object> resultMap = new HashMap<>(2); |
|
|
|
Map<String, Object> resultMap = new HashMap<>(2); |
|
|
|
|
|
|
|
|
|
|
|
StRequisition stRequisition = getById(srId); |
|
|
|
StRequisition stRequisition = getById(srId); |
|
|
|
|
|
|
|
|
|
|
|
// 2. 核心:处理出库单号,生成条形码(Base64格式)
|
|
|
|
// 处理出库单号,生成条形码(Base64格式)
|
|
|
|
// 出库单号原值(空则显示"/")
|
|
|
|
// 出库单号原值(空则显示"/")
|
|
|
|
String invadjCodeValue = StringUtils.isNotBlank(stRequisition.getInvadjCode()) ? stRequisition.getInvadjCode() : "/"; |
|
|
|
String invadjCodeValue = StringUtils.isNotBlank(stRequisition.getInvadjCode()) ? stRequisition.getInvadjCode() : "/"; |
|
|
|
resultMap.put("invadjCode", invadjCodeValue); |
|
|
|
resultMap.put("invadjCode", invadjCodeValue); |
|
|
|
// 生成出库单号条形码(尺寸:宽300,高80,可根据打印需求调整)
|
|
|
|
// 生成出库单号条形码(尺寸:宽300,高80,可根据打印需求调整)
|
|
|
|
resultMap.put("invadjCodeBar", generateBarcodeAsBase64(invadjCodeValue, 200, 50)); |
|
|
|
resultMap.put("invadjCodeBar", generateBarcodeAsBase64(invadjCodeValue, 200, 50)); |
|
|
|
|
|
|
|
|
|
|
|
String buyCodeValue = StringUtils.isNotBlank(stRequisition.getBuyCode()) ? stRequisition.getBuyCode() : "/"; |
|
|
|
String goodsCodeValue = StringUtils.isNotBlank(stRequisition.getPrtno()) ? stRequisition.getPrtno() : "/"; |
|
|
|
resultMap.put("buyCode", buyCodeValue); |
|
|
|
resultMap.put("goodsCode", goodsCodeValue); |
|
|
|
// 生成出库单号条形码(尺寸:宽300,高80,可根据打印需求调整)
|
|
|
|
// 生成出库单号条形码(尺寸:宽300,高80,可根据打印需求调整)
|
|
|
|
resultMap.put("buyCodeBar", generateBarcodeAsBase64(buyCodeValue, 200, 50)); |
|
|
|
resultMap.put("goodsCodeBar", generateBarcodeAsBase64(goodsCodeValue, 200, 50)); |
|
|
|
|
|
|
|
|
|
|
|
// 4. 组装返回数据(与原有方法结构统一)
|
|
|
|
|
|
|
|
// list.add(map);
|
|
|
|
|
|
|
|
// data.put("data", list);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return resultMap; |
|
|
|
return resultMap; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -251,6 +249,32 @@ public class StRequisitionServiceImpl extends BaseServiceImpl<StRequisitionMappe |
|
|
|
if (ObjectUtil.isNull(requisition)) { |
|
|
|
if (ObjectUtil.isNull(requisition)) { |
|
|
|
throw new ServiceException("领料单不存在,ID:" + srId); |
|
|
|
throw new ServiceException("领料单不存在,ID:" + srId); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String urTypeStorehouse = StUserRight.UR_TYPE_STOREHOUSE; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 查询用户是否有该库房的操作权限
|
|
|
|
|
|
|
|
Long count = stUserRightMapper.selectCount(Wrappers.lambdaQuery(StUserRight.class) |
|
|
|
|
|
|
|
.eq(StUserRight::getUserId, user.getUserId()) |
|
|
|
|
|
|
|
.eq(StUserRight::getTheId, shId) |
|
|
|
|
|
|
|
.eq(StUserRight::getUrType, urTypeStorehouse) |
|
|
|
|
|
|
|
.eq(StUserRight::getIsDeleted, 0) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 无权限 → 直接拦截
|
|
|
|
|
|
|
|
if (count == null || count == 0) { |
|
|
|
|
|
|
|
throw new ServiceException("您无当前库房操作权限,不允许入库!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<String> piNos = stRealtimeStockService.findBySlIdAndGoodsCode(slId, requisition.getPrtno()); |
|
|
|
|
|
|
|
String requisitionPiNo = requisition.getPiNo(); |
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(piNos)) { |
|
|
|
|
|
|
|
// 库位已有库存 → 必须和转移单 pino 一致
|
|
|
|
|
|
|
|
boolean pinoMatch = piNos.stream().anyMatch(p -> p.equals(requisitionPiNo)); |
|
|
|
|
|
|
|
if (!pinoMatch) { |
|
|
|
|
|
|
|
throw new ServiceException("批次号不匹配!当前库位批次:" + piNos + ",物料入库批次:" + requisitionPiNo); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
requisition.setCurStatus(StRequisition.CUR_STATUS_PUSH); |
|
|
|
requisition.setCurStatus(StRequisition.CUR_STATUS_PUSH); |
|
|
|
baseMapper.updateById(requisition); |
|
|
|
baseMapper.updateById(requisition); |
|
|
|
|
|
|
|
|
|
|
|
|