|
|
|
@ -1,11 +1,13 @@ |
|
|
|
package com.gaotao.modules.productionInbound.service.impl; |
|
|
|
|
|
|
|
import com.gaotao.common.exception.XJException; |
|
|
|
import com.gaotao.modules.inventoryStock.dao.InventoryStockMapper; |
|
|
|
import com.gaotao.modules.pms.entity.vo.PartLabelTemplateVo; |
|
|
|
import com.gaotao.modules.productionInbound.dao.ProductionInboundMapper; |
|
|
|
import com.gaotao.modules.productionInbound.service.ProductionInboundService; |
|
|
|
import com.gaotao.modules.inventoryStock.entity.InventoryStock; |
|
|
|
import com.gaotao.modules.inventoryStock.service.InventoryStockService; |
|
|
|
import com.gaotao.modules.schedule.mapper.ProcedureMapper; |
|
|
|
import com.gaotao.modules.sys.entity.SysUserEntity; |
|
|
|
import com.gaotao.modules.trans.entity.TransDetail; |
|
|
|
import com.gaotao.modules.trans.entity.TransDetailDto; |
|
|
|
@ -48,6 +50,9 @@ public class ProductionInboundServiceImpl implements ProductionInboundService { |
|
|
|
@Autowired |
|
|
|
private TransDetailSubService transDetailSubService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private ProcedureMapper procedureMapper; |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<Map<String, Object>> getQualifiedInboundList(String site, String warehouseId, String searchCode, String status) { |
|
|
|
SysUserEntity sysUserEntity = (SysUserEntity) SecurityUtils.getSubject().getPrincipal(); |
|
|
|
@ -81,6 +86,9 @@ public class ProductionInboundServiceImpl implements ProductionInboundService { |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public boolean confirmInboundStorage(String orderNo, String locationCode, List<Map<String, Object>> labels, String site, String buNo) { |
|
|
|
SysUserEntity sysUserEntity = (SysUserEntity) SecurityUtils.getSubject().getPrincipal(); |
|
|
|
String userName = sysUserEntity.getUsername(); |
|
|
|
|
|
|
|
logger.info("开始确认生产入库上架,入库单号: {}, 库位号: {}, 标签数量: {}", orderNo, locationCode, labels.size()); |
|
|
|
try { |
|
|
|
// 1. 验证库位是否存在且可用 |
|
|
|
@ -115,7 +123,18 @@ public class ProductionInboundServiceImpl implements ProductionInboundService { |
|
|
|
insertInventoryStock(orderNo, warehouseId, locationCode, labels, site, buNo); |
|
|
|
|
|
|
|
// 6. 生成入库事务记录 |
|
|
|
generateInboundTransaction(orderNo, warehouseId, locationCode, labels, site, buNo); |
|
|
|
String transNo = generateInboundTransaction(orderNo, warehouseId, locationCode, labels, site, buNo); |
|
|
|
|
|
|
|
// // 7. 基于工单BOM,生成入库倒冲数据 |
|
|
|
// // 调用存储过程 |
|
|
|
// Map<String, Object> resultMap = this.UspBackflushMaterialByOrder(site, buNo, transNo, orderNo, 1, userName); |
|
|
|
// //判断是否检验成功 |
|
|
|
// String resultCode = String.valueOf(resultMap.get("resultCode")); |
|
|
|
// if ("400".equalsIgnoreCase(resultCode)) { |
|
|
|
// String msg = String.valueOf(resultMap.get("resultMsg")); |
|
|
|
// String objectId = String.valueOf(resultMap.get("objectId")); |
|
|
|
// throw new XJException(msg,objectId); |
|
|
|
// } |
|
|
|
|
|
|
|
// 7. 异步调用ERP接口(这里可以发送消息到队列) |
|
|
|
//asyncCallErpInterface(orderNo, partNo, labels); |
|
|
|
@ -128,6 +147,20 @@ public class ProductionInboundServiceImpl implements ProductionInboundService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public Map<String, Object> UspBackflushMaterialByOrder(String site, String buNo, String transNo, String orderNo, int inQty, String userName) { |
|
|
|
List<Object> params = new ArrayList<>(); |
|
|
|
params.add(site); |
|
|
|
params.add(buNo); |
|
|
|
params.add(transNo); |
|
|
|
params.add(orderNo); |
|
|
|
params.add(inQty); |
|
|
|
params.add(userName); |
|
|
|
|
|
|
|
List<Map<String, Object>> resultList = procedureMapper.getProcedureData("UspBackflushMaterialByOrder", params); |
|
|
|
//处理返回的结果 |
|
|
|
return resultList.get(0); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 插入或更新库存数据 |
|
|
|
*/ |
|
|
|
@ -264,7 +297,7 @@ public class ProductionInboundServiceImpl implements ProductionInboundService { |
|
|
|
/** |
|
|
|
* 生成入库事务记录 |
|
|
|
*/ |
|
|
|
private void generateInboundTransaction(String orderNo, String warehouseId, String locationCode, List<Map<String, Object>> labels, String site,String buNo) { |
|
|
|
private String generateInboundTransaction(String orderNo, String warehouseId, String locationCode, List<Map<String, Object>> labels, String site,String buNo) { |
|
|
|
logger.info("开始生成生产入库事务记录,入库单号: {}", orderNo); |
|
|
|
|
|
|
|
// 构建TransDetailDto对象 |
|
|
|
@ -289,6 +322,8 @@ public class ProductionInboundServiceImpl implements ProductionInboundService { |
|
|
|
// 生成事务子明细记录 |
|
|
|
addSubTransactionDetails(transHeader.getTransno(), labels, site, buNo, transDetailList, warehouseId, locationCode); |
|
|
|
logger.info("入库事务子记录生成完成,事务单号: {}, 入库单号: {}, 明细记录数: {}", transHeader.getTransno(), orderNo, labels.size()); |
|
|
|
|
|
|
|
return transHeader.getTransno(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
|