|
|
|
@ -1,6 +1,7 @@ |
|
|
|
package com.heai.modules.app.service.impl; |
|
|
|
|
|
|
|
import com.heai.common.utils.DateUtil; |
|
|
|
import com.heai.modules.app.dao.InventoryStockDao; |
|
|
|
import com.heai.modules.app.entity.StockOtherOutLineParam; |
|
|
|
import com.heai.modules.app.entity.StockOtherOutSaveParam; |
|
|
|
import com.heai.modules.app.service.StockOtherOutService; |
|
|
|
@ -34,9 +35,42 @@ public class StockOtherOutServiceImpl implements StockOtherOutService { |
|
|
|
/** 主过程要求往来单位占位 - rqrq */ |
|
|
|
private static final String PARTNER_ID_STAR = "*"; |
|
|
|
|
|
|
|
/** 库存标签其他出库物料前缀白名单 - rqrq */ |
|
|
|
private static final int STOCK_LABEL_PART_PARAM = 212; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private FunctionMapper functionMapper; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private InventoryStockDao inventoryStockDao; |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 参数212为空不允许扫,有值则物料编码必须命中其中一个前缀 - rqrq |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public void checkStockLabelPart(StockOtherOutLineParam line) { |
|
|
|
if (line == null || !StringUtils.hasText(line.getSite())) { |
|
|
|
throw new RuntimeException("工厂不能为空"); |
|
|
|
} |
|
|
|
if (!StringUtils.hasText(line.getPartNo())) { |
|
|
|
throw new RuntimeException("物料编码不能为空"); |
|
|
|
} |
|
|
|
assertPartPrefix(trim(line.getSite()), trim(line.getPartNo())); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 保存时按行再校验,避免只改页面绕过 - rqrq |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public void checkStockLabelParts(StockOtherOutSaveParam param) { |
|
|
|
if (param == null || param.getLines() == null || param.getLines().isEmpty()) { |
|
|
|
throw new RuntimeException("没有出库明细"); |
|
|
|
} |
|
|
|
for (int i = 0; i < param.getLines().size(); i++) { |
|
|
|
checkStockLabelPart(param.getLines().get(i)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 对齐 FunctionServiceImpl#saveSaveTrans,改用其他出库专用存储过程 - rqrq |
|
|
|
*/ |
|
|
|
@ -146,6 +180,28 @@ public class StockOtherOutServiceImpl implements StockOtherOutService { |
|
|
|
log.info("其他出库完成 transNo={}, 行数={} - rqrq", transNo, lines.size()); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 读取参数212,空则提示未维护,否则按中英文分号拆前缀 - rqrq |
|
|
|
*/ |
|
|
|
private void assertPartPrefix(String site, String partNo) { |
|
|
|
String raw = inventoryStockDao.GetSysParamenter(site, STOCK_LABEL_PART_PARAM); |
|
|
|
if (!StringUtils.hasText(raw)) { |
|
|
|
throw new RuntimeException("未维护库存标签其他出库白名单"); |
|
|
|
} |
|
|
|
String part = partNo.toUpperCase(); |
|
|
|
String[] prefixes = raw.trim().split("[;;]"); |
|
|
|
for (int i = 0; i < prefixes.length; i++) { |
|
|
|
String prefix = prefixes[i] == null ? "" : prefixes[i].trim(); |
|
|
|
if (!StringUtils.hasText(prefix)) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
if (part.startsWith(prefix.toUpperCase())) { |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
throw new RuntimeException("该功能只允许以下开头的物料进行其他出库:" + raw.trim()); |
|
|
|
} |
|
|
|
|
|
|
|
private static String trim(String s) { |
|
|
|
return s == null ? "" : s.trim(); |
|
|
|
} |
|
|
|
|