Compare commits
6 Commits
dacbe67cc8
...
06ecce096b
| Author | SHA1 | Date |
|---|---|---|
|
|
06ecce096b | |
|
|
dbe48a46a2 | |
|
|
2c232359a3 | |
|
|
985d43e346 | |
|
|
e46c1bc472 | |
|
|
1ea7db9ae3 |
|
|
@ -1,5 +1,6 @@
|
||||||
package com.nflg.wms.admin;
|
package com.nflg.wms.admin;
|
||||||
|
|
||||||
|
import com.sap.conn.jco.JCoException;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
@ -16,13 +17,14 @@ import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
@EnableRetry
|
@EnableRetry
|
||||||
public class AdminApplication {
|
public class AdminApplication {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) throws JCoException {
|
||||||
SpringApplication.run(AdminApplication.class, args);
|
SpringApplication.run(AdminApplication.class, args);
|
||||||
log.info("服务已启动");
|
log.info("服务已启动");
|
||||||
// log.info("---------------------- Sa-Token SSO 模式二 Client 端启动成功 ----------------------");
|
// log.info("---------------------- Sa-Token SSO 模式二 Client 端启动成功 ----------------------");
|
||||||
// log.info("配置信息:" + SaSsoManager.getClientConfig());
|
// log.info("配置信息:" + SaSsoManager.getClientConfig());
|
||||||
|
|
||||||
// SapService sapService= SpringUtil.getBean(SapService.class);
|
// SapService sapService= SpringUtil.getBean(SapService.class);
|
||||||
|
// sapService.zwm00_MB017("1309976");
|
||||||
// log.info(JSONUtil.toJsonStr(sapService.searchOrder("0000101808")));
|
// log.info(JSONUtil.toJsonStr(sapService.searchOrder("0000101808")));
|
||||||
// log.info(JSONUtil.toJsonStr(sapService.getMaterialInfoInOrder("7500188009","0000101808","2100053760")));
|
// log.info(JSONUtil.toJsonStr(sapService.getMaterialInfoInOrder("7500188009","0000101808","2100053760")));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,15 +2,22 @@ package com.nflg.wms.admin.controller;
|
||||||
|
|
||||||
import com.nflg.wms.admin.pojo.dto.LdapDepartmentDTO;
|
import com.nflg.wms.admin.pojo.dto.LdapDepartmentDTO;
|
||||||
import com.nflg.wms.admin.pojo.dto.LdapUserDTO;
|
import com.nflg.wms.admin.pojo.dto.LdapUserDTO;
|
||||||
|
import com.nflg.wms.admin.service.SapService;
|
||||||
import com.nflg.wms.common.pojo.ApiResult;
|
import com.nflg.wms.common.pojo.ApiResult;
|
||||||
import com.nflg.wms.repository.entity.Language;
|
import com.nflg.wms.common.pojo.qo.C_MaterialReturnItemQO;
|
||||||
import com.nflg.wms.repository.service.ILanguageService;
|
import com.nflg.wms.repository.service.ILanguageService;
|
||||||
import com.nflg.wms.starter.BaseController;
|
import com.nflg.wms.starter.BaseController;
|
||||||
|
import com.sap.conn.jco.JCoException;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -27,15 +34,46 @@ public class TestController extends BaseController {
|
||||||
// @Resource
|
// @Resource
|
||||||
// private LdapService ldapService;
|
// private LdapService ldapService;
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SapService sapService;
|
||||||
@GetMapping("/add")
|
@GetMapping("/add")
|
||||||
public void add() {
|
public void add() throws JCoException {
|
||||||
Language language = new Language()
|
// try {
|
||||||
.setCode("test1")
|
sapService.zwm00_MB017("1309976");
|
||||||
.setName("测试1")
|
// }
|
||||||
.setValue("aaa")
|
// catch (Exception e)
|
||||||
.setIco("")
|
// {
|
||||||
.setZone("");
|
//
|
||||||
languageService.save(language);
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
List<C_MaterialReturnItemQO>items=new ArrayList<>();
|
||||||
|
C_MaterialReturnItemQO item=new C_MaterialReturnItemQO()
|
||||||
|
.setBatchNumber("1")
|
||||||
|
.setSerialNumber("2222")
|
||||||
|
.setResbMatnr("2147854512")
|
||||||
|
.setResbWerks("1020")
|
||||||
|
.setMsebErfmg(new BigDecimal(1.2));
|
||||||
|
|
||||||
|
|
||||||
|
items.add( item);
|
||||||
|
|
||||||
|
C_MaterialReturnItemQO item1=new C_MaterialReturnItemQO()
|
||||||
|
.setBatchNumber("12333")
|
||||||
|
.setSerialNumber("222112")
|
||||||
|
.setResbMatnr("2147854512")
|
||||||
|
.setResbWerks("1020")
|
||||||
|
.setMsebErfmg(new BigDecimal(1.8));
|
||||||
|
items.add( item1);
|
||||||
|
|
||||||
|
// Language language = new Language()
|
||||||
|
// .setCode("test1")
|
||||||
|
// .setName("测试1")
|
||||||
|
// .setValue("aaa")
|
||||||
|
// .setIco("")
|
||||||
|
// .setZone("");
|
||||||
|
// languageService.save(language);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -53,4 +91,14 @@ public class TestController extends BaseController {
|
||||||
public ApiResult<List<LdapUserDTO>> syncUsers() {
|
public ApiResult<List<LdapUserDTO>> syncUsers() {
|
||||||
return ApiResult.success(Collections.emptyList());
|
return ApiResult.success(Collections.emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 打印SAP函数参数,需在控制台查看
|
||||||
|
* @param functionName SAP函数名
|
||||||
|
*/
|
||||||
|
@GetMapping("/sap/function/params")
|
||||||
|
public ApiResult<Void> printSAPFunctionParams(@Valid @RequestParam @NotBlank String functionName) throws JCoException {
|
||||||
|
sapService.printMeta(functionName);
|
||||||
|
return ApiResult.success();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -25,10 +25,9 @@ import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static cn.dev33.satoken.SaManager.log;
|
import static cn.dev33.satoken.SaManager.log;
|
||||||
|
|
||||||
|
|
@ -74,139 +73,151 @@ public class NormalPGIControllerService {
|
||||||
@Resource
|
@Resource
|
||||||
private StringRedisTemplate stringRedisTemplate;
|
private StringRedisTemplate stringRedisTemplate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据订单编号获取订单详情信息,包括订单头信息和订单行项目信息。
|
||||||
|
* <p>
|
||||||
|
* 该方法首先根据订单编号查询订单主表信息,若不存在则返回 null;
|
||||||
|
* 若存在,则进一步查询订单行项目列表,并结合 SAP 系统同步物料相关信息,
|
||||||
|
* 最终组装成 PDAOrderVO 对象返回。
|
||||||
|
*
|
||||||
|
* @param orderNo 订单编号,用于查询订单主表和子表数据
|
||||||
|
* @return PDAOrderVO 包含订单头信息和行项目信息的视图对象;若未找到对应订单则返回 null
|
||||||
|
* @throws Exception 查询或业务处理过程中可能抛出的异常
|
||||||
|
*/
|
||||||
public PDAOrderVO getOrderItemByOrderNo(@RequestParam String orderNo) throws Exception {
|
public PDAOrderVO getOrderItemByOrderNo(@RequestParam String orderNo) throws Exception {
|
||||||
//return ApiResult.success(wmsSrmOrderItemService.getOrderItem(orderId));
|
// 根据订单编号查询订单主表信息
|
||||||
PDAOrderVO pdaOrderVO = new PDAOrderVO();
|
|
||||||
|
|
||||||
WmsSrmOrder order = wmsSrmOrderService.lambdaQuery().eq(WmsSrmOrder::getNoteNum, orderNo).one();
|
WmsSrmOrder order = wmsSrmOrderService.lambdaQuery().eq(WmsSrmOrder::getNoteNum, orderNo).one();
|
||||||
if (Objects.isNull(order))
|
if (Objects.isNull(order))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
PDAOrderVO pdaOrderVO = new PDAOrderVO();
|
||||||
|
// 设置订单头基本信息
|
||||||
pdaOrderVO.setNoteNum(order.getNoteNum());
|
pdaOrderVO.setNoteNum(order.getNoteNum());
|
||||||
pdaOrderVO.setSupplierNum(order.getSupplierNum());
|
pdaOrderVO.setSupplierNum(order.getSupplierNum());
|
||||||
pdaOrderVO.setSupplierName(order.getSupplierName());
|
pdaOrderVO.setSupplierName(order.getSupplierName());
|
||||||
|
|
||||||
List<WmsSrmOrderItem> orderItemList = wmsSrmOrderItemService.lambdaQuery().eq(WmsSrmOrderItem::getOrderId, order.getId()).list();
|
// 查询订单行项目列表
|
||||||
if (CollectionUtil.isNotEmpty(orderItemList)) {
|
List<WmsSrmOrderItem> orderItemList = wmsSrmOrderItemService.lambdaQuery()
|
||||||
List<PDAOrderItemVO> orderItemVOList = new ArrayList<>();
|
.eq(WmsSrmOrderItem::getOrderId, order.getId())
|
||||||
|
.list();
|
||||||
|
|
||||||
for (WmsSrmOrderItem item : orderItemList) {
|
if (CollectionUtil.isEmpty(orderItemList)) {
|
||||||
PDAOrderItemVO itemVO = new PDAOrderItemVO();
|
return pdaOrderVO;
|
||||||
itemVO.setId(item.getId());
|
|
||||||
itemVO.setPoLineNumber(item.getPoLineNumber());
|
|
||||||
itemVO.setPoNum(item.getPoNum());
|
|
||||||
itemVO.setItemCode(item.getItemCode());
|
|
||||||
itemVO.setItemName(item.getItemName());
|
|
||||||
itemVO.setIsQuality(item.getIsQuality());
|
|
||||||
itemVO.setOrderQty(item.getOrderQty());
|
|
||||||
itemVO.setUomCode(item.getUomCode());
|
|
||||||
itemVO.setDeliveryQty(item.getDeliveryQty());
|
|
||||||
|
|
||||||
|
|
||||||
SAPSyncParamsDTO syncParamsDTO = sapCommonService.getMaterialInfoInOrder(item.getPoNum(), order.getSupplierNum(), item.getItemCode());
|
|
||||||
if (Objects.nonNull(syncParamsDTO)) {
|
|
||||||
itemVO.setItemName(syncParamsDTO.getMaktx());
|
|
||||||
itemVO.setUomCode(syncParamsDTO.getMeins());
|
|
||||||
itemVO.setOrderQty(syncParamsDTO.getMenge());
|
|
||||||
itemVO.setReceivedWarehouse(syncParamsDTO.getWarehouseNo());
|
|
||||||
itemVO.setBinNos(syncParamsDTO.getBinNos());
|
|
||||||
itemVO.setLbprt(syncParamsDTO.getLbprt());
|
|
||||||
itemVO.setTransportNum(syncParamsDTO.getTransportNum());
|
|
||||||
boolean isQuality ;
|
|
||||||
if (syncParamsDTO.getKzkri().equals("X"))
|
|
||||||
isQuality = true;
|
|
||||||
else
|
|
||||||
isQuality = false;
|
|
||||||
|
|
||||||
itemVO.setIsQuality(isQuality);
|
|
||||||
|
|
||||||
orderItemVOList.add(itemVO);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
pdaOrderVO.setOrderItemVOList(orderItemVOList);
|
|
||||||
}
|
}
|
||||||
|
// if (CollectionUtil.isNotEmpty(orderItemList)) {
|
||||||
|
List<PDAOrderItemVO> orderItemVOList = new ArrayList<>();
|
||||||
|
// 遍历订单行项目,填充详细信息并从 SAP 获取补充数据
|
||||||
|
for (WmsSrmOrderItem item : orderItemList) {
|
||||||
|
PDAOrderItemVO itemVO = new PDAOrderItemVO();
|
||||||
|
itemVO.setId(item.getId());
|
||||||
|
itemVO.setPoLineNumber(item.getPoLineNumber());
|
||||||
|
itemVO.setPoNum(item.getPoNum());
|
||||||
|
itemVO.setItemCode(item.getItemCode());
|
||||||
|
itemVO.setItemName(item.getItemName());
|
||||||
|
itemVO.setIsQuality(item.getIsQuality());
|
||||||
|
itemVO.setOrderQty(item.getOrderQty());
|
||||||
|
itemVO.setUomCode(item.getUomCode());
|
||||||
|
itemVO.setDeliveryQty(item.getDeliveryQty());
|
||||||
|
// 从 SAP 系统获取物料相关信息
|
||||||
|
SAPSyncParamsDTO syncParamsDTO = sapCommonService.getMaterialInfoInOrder(item.getPoNum(), order.getSupplierNum(), item.getItemCode());
|
||||||
|
if (Objects.nonNull(syncParamsDTO)) {
|
||||||
|
itemVO.setItemName(syncParamsDTO.getMaktx());
|
||||||
|
itemVO.setUomCode(syncParamsDTO.getMeins());
|
||||||
|
itemVO.setOrderQty(syncParamsDTO.getMenge());
|
||||||
|
itemVO.setReceivedWarehouse(syncParamsDTO.getWarehouseNo());
|
||||||
|
itemVO.setBinNos(syncParamsDTO.getBinNos());
|
||||||
|
itemVO.setLbprt(syncParamsDTO.getLbprt());
|
||||||
|
itemVO.setTransportNum(syncParamsDTO.getTransportNum());
|
||||||
|
// 判断是否质检
|
||||||
|
boolean isQuality = "X".equals(syncParamsDTO.getKzkri());
|
||||||
|
itemVO.setIsQuality(isQuality);
|
||||||
|
orderItemVOList.add(itemVO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 设置订单行项目列表到返回对象中
|
||||||
|
pdaOrderVO.setOrderItemVOList(orderItemVOList);
|
||||||
return pdaOrderVO;
|
return pdaOrderVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
|
||||||
public void takeDelivery(List<SrmMaterialReceiptQO> request) {
|
|
||||||
VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(request)).throwMessage("收货参数为空");
|
|
||||||
List<WmsSrmMaterialReceipt> receipts = new ArrayList<>();
|
|
||||||
List<WmsSrmMaterialReceiptItem> receiptitems = new ArrayList<>();
|
|
||||||
List<WmsInTaskItem> tasks = new ArrayList<>();
|
|
||||||
List<SRMLineVOListItem> srmLineVOListItems = new ArrayList<>();
|
|
||||||
|
|
||||||
request.forEach(item -> {
|
private void validateScanCodes(SrmMaterialReceiptQO item, SAPSyncParamsDTO materialInfoInOrder) {
|
||||||
SAPSyncParamsDTO materialInfoInOrder = null;
|
String lbprt = materialInfoInOrder.getLbprt();
|
||||||
try {
|
//判断序列号、批次号是否规范
|
||||||
materialInfoInOrder = sapCommonService.getMaterialInfoInOrder(item.getPoNum(), item.getSupplierNum(), item.getItemCode());
|
// 1 - 批次号为空,序列号为空
|
||||||
} catch (Exception e) {
|
// 2 - 批次号必填,序列号为空
|
||||||
log.error("获取物料信息失败", e);
|
// 3 - 批次号为空,序列号必填
|
||||||
throw new RuntimeException(e);
|
// 4 - 批次号必填,序列号必填
|
||||||
}
|
if ("2".equals(lbprt) || "4".equals(lbprt)) {
|
||||||
VUtil.trueThrowBusinessError(Objects.isNull(materialInfoInOrder)).throwMessage("无法获取到有效订单信息" + item.getPoNum());
|
VUtil.trueThrowBusinessError(
|
||||||
//判断收货数量是否大于了未收数量
|
CollectionUtil.isEmpty(item.getScanCodes()) ||
|
||||||
VUtil.trueThrowBusinessError(item.getReceiptNum().add(item.getCrossNumber()).compareTo(materialInfoInOrder.getTransportNum()) > 0).throwMessage("无法获取到有效订单信息" + item.getPoNum());
|
item.getScanCodes().stream().anyMatch(code -> StrUtil.isBlank(code.getBatchNumber()))
|
||||||
//判断序列号、批次号是否规范
|
).throwMessage("此物料[" + item.getItemCode() + "]必须填写批次号,订单号:" + item.getPoNum());
|
||||||
// 1 - 批次号为空,序列号为空
|
}
|
||||||
// 2 - 批次号必填,序列号为空
|
|
||||||
// 3 - 批次号为空,序列号必填
|
|
||||||
// 4 - 批次号必填,序列号必填
|
|
||||||
|
|
||||||
//批次號必填
|
if ("3".equals(lbprt) || "4".equals(lbprt)) {
|
||||||
if (materialInfoInOrder.getLbprt().equals("2") || materialInfoInOrder.getLbprt().equals("4")) {
|
VUtil.trueThrowBusinessError(
|
||||||
VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(item.getScanCodes()) || item.getScanCodes().stream().anyMatch(code -> StrUtil.isBlank(code.getBatchNumber()))).throwMessage("此物料[" + item.getItemCode() + "]必须填写批次号" + item.getPoNum());
|
CollectionUtil.isEmpty(item.getScanCodes()) ||
|
||||||
}
|
item.getScanCodes().stream().anyMatch(code -> StrUtil.isBlank(code.getSerialNumber()))
|
||||||
|
).throwMessage("此物料[" + item.getItemCode() + "]必须填写序列号,订单号:" + item.getPoNum());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//序列號必填
|
/**
|
||||||
if (materialInfoInOrder.getLbprt().equals("3") || materialInfoInOrder.getLbprt().equals("4")) {
|
* 推送质检物料到SRM
|
||||||
VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(item.getScanCodes()) || item.getScanCodes().stream().anyMatch(code -> StrUtil.isBlank(code.getSerialNumber()))).throwMessage("此物料[" + item.getItemCode() + "]必须填写序列号" + item.getPoNum());
|
*/
|
||||||
}
|
private void pushInspectionMaterialsToSRM(SrmMaterialReceiptQO receiptQO, List<SRMLineVOListItem> srmLineVOListItems) {
|
||||||
List<String> serialNumbers = new ArrayList<>();
|
SRMInspectionInputDTO pushDto = new SRMInspectionInputDTO();
|
||||||
List<String> batchNumbers = new ArrayList<>();
|
SRMInspectionContentDTO content = new SRMInspectionContentDTO();
|
||||||
boolean isQuality = materialInfoInOrder.getKzkri().equals("X") ? true : false;
|
content.setLineVOList(srmLineVOListItems);
|
||||||
if (!isQuality) {
|
content.setSupplierName(receiptQO.getSupplierName());
|
||||||
// 保存收货信息
|
content.setSupplierNum(receiptQO.getSupplierNum());
|
||||||
WmsSrmMaterialReceipt receipt = new WmsSrmMaterialReceipt();
|
content.setReceiveNum("ZJ-" + receiptQO.getNoteNum());
|
||||||
Long receiptId = IdUtil.getSnowflakeNextId();
|
content.setReceiveType("BY_DELIVERY");
|
||||||
receipt.setId(receiptId);
|
pushDto.setContent(content);
|
||||||
receipt.setOrderItemId(item.getOrderItemId());
|
pushDto.setCode("SCAN_RCV_RECEIVE_TO_SRM");
|
||||||
receipt.setReceiptNum(item.getReceiptNum());
|
pushInspectionMaterialsToSRM(pushDto);
|
||||||
receipt.setCrossNumber(item.getCrossNumber());
|
}
|
||||||
receipt.setIsQuality(isQuality);
|
|
||||||
receipt.setCreateTime(LocalDateTime.now());
|
|
||||||
receipt.setCreateUserId(UserUtil.getUserId());
|
|
||||||
receipt.setCreateUserName(UserUtil.getUserName());
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收货单、质检单、任务单组装
|
||||||
|
*/
|
||||||
|
private void generyReceipt(SrmMaterialReceiptQO item,
|
||||||
|
boolean isQuality,
|
||||||
|
SAPSyncParamsDTO materialInfoInOrder,
|
||||||
|
List<WmsSrmMaterialReceipt> receipts,
|
||||||
|
List<WmsSrmMaterialReceiptItem> receiptItems,
|
||||||
|
List<WmsInTaskItem> tasks,
|
||||||
|
List<SRMLineVOListItem> srmLineVOListItems
|
||||||
|
) {
|
||||||
|
// 保存收货信息
|
||||||
|
WmsSrmMaterialReceipt receipt = new WmsSrmMaterialReceipt();
|
||||||
|
Long receiptId = IdUtil.getSnowflakeNextId();
|
||||||
|
receipt.setId(receiptId);
|
||||||
|
receipt.setOrderItemId(item.getOrderItemId());
|
||||||
|
receipt.setReceiptNum(item.getReceiptNum());
|
||||||
|
receipt.setCrossNumber(item.getCrossNumber());
|
||||||
|
receipt.setIsQuality(isQuality);
|
||||||
|
receipt.setCreateTime(LocalDateTime.now());
|
||||||
|
receipt.setCreateUserId(UserUtil.getUserId());
|
||||||
|
receipt.setCreateUserName(UserUtil.getUserName());
|
||||||
|
//条码内容
|
||||||
|
if (CollectionUtil.isNotEmpty(item.getScanCodes())) {
|
||||||
|
item.getScanCodes().forEach(scanCode -> {
|
||||||
|
WmsSrmMaterialReceiptItem receiptItem = new WmsSrmMaterialReceiptItem();
|
||||||
|
receiptItem.setCodeId(scanCode.getCodeId());
|
||||||
|
receiptItem.setCodeNum(scanCode.getCodeNum());
|
||||||
|
receiptItem.setBatchNumber(scanCode.getBatchNumber());
|
||||||
|
receiptItem.setSerialNumber(scanCode.getSerialNumber());
|
||||||
|
receiptItem.setCodeContent(scanCode.getCodeContent());
|
||||||
|
receiptItem.setOrderItemId(item.getOrderItemId());
|
||||||
|
receiptItem.setCreateUserId(UserUtil.getUserId());
|
||||||
|
receiptItem.setCreateUserName(UserUtil.getUserName());
|
||||||
|
receiptItem.setCreateTime(LocalDateTime.now());
|
||||||
|
receiptItem.setReceiptId(receiptId);
|
||||||
|
receiptItem.setId(IdUtil.getSnowflakeNextId());
|
||||||
|
receiptItems.add(receiptItem);
|
||||||
|
|
||||||
//条码内容
|
//上架任务
|
||||||
if (CollectionUtil.isNotEmpty(item.getScanCodes())) {
|
|
||||||
item.getScanCodes().forEach(scanCode -> {
|
|
||||||
WmsSrmMaterialReceiptItem receiptItem = new WmsSrmMaterialReceiptItem();
|
|
||||||
receiptItem.setCodeId(scanCode.getCodeId());
|
|
||||||
receiptItem.setCodeNum(scanCode.getCodeNum());
|
|
||||||
receiptItem.setBatchNumber(scanCode.getBatchNumber());
|
|
||||||
receiptItem.setSerialNumber(scanCode.getSerialNumber());
|
|
||||||
receiptItem.setCodeContent(scanCode.getCodeContent());
|
|
||||||
receiptItem.setOrderItemId(item.getOrderItemId());
|
|
||||||
receiptItem.setCreateUserId(UserUtil.getUserId());
|
|
||||||
receiptItem.setCreateUserName(UserUtil.getUserName());
|
|
||||||
receiptItem.setCreateTime(LocalDateTime.now());
|
|
||||||
receiptItem.setReceiptId(receiptId);
|
|
||||||
receiptItem.setId(IdUtil.getSnowflakeNextId());
|
|
||||||
receiptitems.add(receiptItem);
|
|
||||||
if (!serialNumbers.contains(receiptItem.getSerialNumber())) {
|
|
||||||
serialNumbers.add(receiptItem.getSerialNumber());
|
|
||||||
}
|
|
||||||
if (!batchNumbers.contains(receiptItem.getBatchNumber())) {
|
|
||||||
batchNumbers.add(receiptItem.getBatchNumber());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
receipts.add(receipt);
|
|
||||||
//生成上架任务
|
|
||||||
WmsInTaskItem taskItem = new WmsInTaskItem();
|
WmsInTaskItem taskItem = new WmsInTaskItem();
|
||||||
taskItem.setPoNum(item.getPoNum())
|
taskItem.setPoNum(item.getPoNum())
|
||||||
.setPoLineNumber(item.getPoLineNumber())
|
.setPoLineNumber(item.getPoLineNumber())
|
||||||
|
|
@ -225,57 +236,72 @@ public class NormalPGIControllerService {
|
||||||
.setFactory(materialInfoInOrder.getWerks())
|
.setFactory(materialInfoInOrder.getWerks())
|
||||||
.setDataStatus((short) 0)
|
.setDataStatus((short) 0)
|
||||||
.setFailResult("")
|
.setFailResult("")
|
||||||
.setSerialNumber(serialNumbers.isEmpty() ? "" : String.join(";", serialNumbers))
|
.setSerialNumber(scanCode.getSerialNumber())
|
||||||
.setBatchNumber(batchNumbers.isEmpty() ? "" : String.join(";", batchNumbers))
|
.setBatchNumber(scanCode.getBatchNumber())
|
||||||
.setInspectionQty(new BigDecimal(0.00))
|
.setInspectionQty(new BigDecimal(0.00))
|
||||||
.setSupplierNum(item.getSupplierNum())
|
.setSupplierNum(item.getSupplierNum())
|
||||||
.setInspectionOrder("");
|
.setInspectionOrder("");
|
||||||
tasks.add(taskItem);
|
tasks.add(taskItem);
|
||||||
} else {
|
|
||||||
//质检物料发送到质检单
|
|
||||||
SRMLineVOListItem srmItem = new SRMLineVOListItem();
|
|
||||||
srmItem.setItemCode(item.getItemCode());
|
|
||||||
srmItem.setItemName(materialInfoInOrder.getMaktx());
|
|
||||||
srmItem.setUnit(materialInfoInOrder.getMeins());
|
|
||||||
srmItem.setFactory(materialInfoInOrder.getWerks());
|
|
||||||
srmItem.setReceivedWarehouse(materialInfoInOrder.getWarehouseNo());
|
|
||||||
srmItem.setReceiveBatchNum(batchNumbers.isEmpty() ? "" : String.join(";", batchNumbers));
|
|
||||||
srmItem.setReceivedQty(item.getReceiptNum());
|
|
||||||
srmItem.setSerialNum(serialNumbers.isEmpty() ? "" : String.join(";", serialNumbers));
|
|
||||||
srmItem.setLineNumber(Integer.valueOf(item.getLineNumber()));
|
|
||||||
srmItem.setNoteNum(item.getNoteNum());
|
|
||||||
srmItem.setReceivedDate(DateTime.now());
|
|
||||||
srmItem.setInspectionFlag("Y");
|
|
||||||
srmLineVOListItems.add(srmItem);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (isQuality) {
|
||||||
|
//质检物料发送到质检单
|
||||||
|
SRMLineVOListItem srmItem = new SRMLineVOListItem();
|
||||||
|
srmItem.setItemCode(item.getItemCode());
|
||||||
|
srmItem.setItemName(materialInfoInOrder.getMaktx());
|
||||||
|
srmItem.setUnit(materialInfoInOrder.getMeins());
|
||||||
|
srmItem.setFactory(materialInfoInOrder.getWerks());
|
||||||
|
srmItem.setReceivedWarehouse(materialInfoInOrder.getWarehouseNo());
|
||||||
|
srmItem.setReceiveBatchNum(scanCode.getBatchNumber());
|
||||||
|
srmItem.setReceivedQty(item.getReceiptNum());
|
||||||
|
srmItem.setSerialNum(scanCode.getSerialNumber());
|
||||||
|
srmItem.setLineNumber(Integer.valueOf(item.getLineNumber()));
|
||||||
|
srmItem.setNoteNum(item.getNoteNum());
|
||||||
|
srmItem.setReceivedDate(DateTime.now());
|
||||||
|
srmItem.setInspectionFlag("Y");
|
||||||
|
srmLineVOListItems.add(srmItem);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
receipts.add(receipt);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存送货信息
|
||||||
|
* */
|
||||||
|
public void takeDelivery(List<SrmMaterialReceiptQO> request) {
|
||||||
|
VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(request)).throwMessage("收货参数为空");
|
||||||
|
List<WmsSrmMaterialReceipt> receipts = new ArrayList<>();
|
||||||
|
List<WmsSrmMaterialReceiptItem> receiptitems = new ArrayList<>();
|
||||||
|
List<WmsInTaskItem> tasks = new ArrayList<>();
|
||||||
|
List<SRMLineVOListItem> srmLineVOListItems = new ArrayList<>();
|
||||||
|
|
||||||
|
request.forEach(item -> {
|
||||||
|
SAPSyncParamsDTO materialInfoInOrder = null;
|
||||||
|
try {
|
||||||
|
materialInfoInOrder = sapCommonService.getMaterialInfoInOrder(item.getPoNum(), item.getSupplierNum(), item.getItemCode());
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("获取物料信息失败", e);
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
VUtil.trueThrowBusinessError(Objects.isNull(materialInfoInOrder)).throwMessage("无法获取到有效订单信息" + item.getPoNum());
|
||||||
|
//数量验证(判断收货数量是否大于了未收数量)
|
||||||
|
VUtil.trueThrowBusinessError(item.getReceiptNum().add(item.getCrossNumber()).compareTo(materialInfoInOrder.getTransportNum()) > 0).throwMessage("无法获取到有效订单信息" + item.getPoNum());
|
||||||
|
//序列号和批次号验证
|
||||||
|
validateScanCodes(item, materialInfoInOrder);
|
||||||
|
boolean isQuality = materialInfoInOrder.getKzkri().equals("X") ? true : false;
|
||||||
|
// 生成相关单据
|
||||||
|
generyReceipt(item, isQuality, materialInfoInOrder, receipts, receiptitems, tasks, srmLineVOListItems);
|
||||||
});
|
});
|
||||||
|
//推送质检单
|
||||||
if (Objects.nonNull(srmLineVOListItems) && !srmLineVOListItems.isEmpty()) {
|
if (Objects.nonNull(srmLineVOListItems) && !srmLineVOListItems.isEmpty()) {
|
||||||
SrmMaterialReceiptQO receiptQO = request.get(0);
|
SrmMaterialReceiptQO receiptQO = request.get(0);
|
||||||
SRMInspectionInputDTO pushDto = new SRMInspectionInputDTO();
|
pushInspectionMaterialsToSRM(receiptQO, srmLineVOListItems);
|
||||||
SRMInspectionContentDTO content = new SRMInspectionContentDTO();
|
|
||||||
content.setLineVOList(srmLineVOListItems);
|
|
||||||
content.setSupplierName(receiptQO.getSupplierName());
|
|
||||||
content.setSupplierNum(receiptQO.getSupplierNum());
|
|
||||||
content.setReceiveNum("ZJ-" + receiptQO.getNoteNum());
|
|
||||||
content.setReceiveType("BY_DELIVERY");
|
|
||||||
pushDto.setContent(content);
|
|
||||||
pushDto.setCode("SCAN_RCV_RECEIVE_TO_SRM");
|
|
||||||
pushInspectionMaterialsToSRM(pushDto);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Objects.nonNull(receipts) && !receipts.isEmpty()) {
|
|
||||||
wmsSrmMaterialReceiptService.saveBatch(receipts);
|
|
||||||
}
|
|
||||||
if (Objects.nonNull(receipts) && !receipts.isEmpty()) {
|
|
||||||
wmsSrmMaterialReceiptItemService.saveBatch(receiptitems);
|
|
||||||
}
|
|
||||||
if (Objects.nonNull(receipts) && !receipts.isEmpty()) {
|
|
||||||
if (!taskService.generateTask(tasks, (short) 1))
|
|
||||||
log.error("收货单生成上架任务失败");
|
|
||||||
}
|
}
|
||||||
|
//生成wms的单据
|
||||||
|
wmsSrmMaterialReceiptService.generateReceiptInfo(receipts, receiptitems, tasks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 将检验物料信息推送到SRM系统
|
* 将检验物料信息推送到SRM系统
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,12 @@ import com.nflg.wms.admin.pojo.dto.ZIM003105DTO;
|
||||||
import com.nflg.wms.admin.pojo.dto.ZIM003DTO;
|
import com.nflg.wms.admin.pojo.dto.ZIM003DTO;
|
||||||
import com.nflg.wms.common.constant.STATE;
|
import com.nflg.wms.common.constant.STATE;
|
||||||
import com.nflg.wms.common.exception.NflgException;
|
import com.nflg.wms.common.exception.NflgException;
|
||||||
|
import com.nflg.wms.common.pojo.dto.C_MaterialReturnDTO;
|
||||||
|
import com.nflg.wms.common.pojo.dto.C_MaterialReturnQueryDTO;
|
||||||
import com.nflg.wms.common.pojo.dto.SAPOrderDTO;
|
import com.nflg.wms.common.pojo.dto.SAPOrderDTO;
|
||||||
import com.nflg.wms.common.pojo.dto.SAPSyncFromDTO;
|
import com.nflg.wms.common.pojo.dto.SAPSyncFromDTO;
|
||||||
|
import com.nflg.wms.common.pojo.qo.C_MaterialReturnItemQO;
|
||||||
|
import com.nflg.wms.common.pojo.qo.C_MaterialReturnQO;
|
||||||
import com.nflg.wms.common.util.VUtil;
|
import com.nflg.wms.common.util.VUtil;
|
||||||
import com.sap.conn.jco.*;
|
import com.sap.conn.jco.*;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
|
@ -30,9 +34,10 @@ public class SapService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 扫码质检入库
|
* 扫码质检入库
|
||||||
|
*
|
||||||
* @param dto 数据
|
* @param dto 数据
|
||||||
*/
|
*/
|
||||||
public String zim003_105(ZIM003105DTO dto){
|
public String zim003_105(ZIM003105DTO dto) {
|
||||||
Map<String, Object> parameters = new HashMap<>();
|
Map<String, Object> parameters = new HashMap<>();
|
||||||
parameters.put("I_EBELN", dto.getEbeln());
|
parameters.put("I_EBELN", dto.getEbeln());
|
||||||
parameters.put("I_MBLNR", dto.getMblnr());
|
parameters.put("I_MBLNR", dto.getMblnr());
|
||||||
|
|
@ -53,10 +58,10 @@ public class SapService {
|
||||||
list1.add(Map.of("WERKS", dto.getItem1().getWerks()));
|
list1.add(Map.of("WERKS", dto.getItem1().getWerks()));
|
||||||
tables.put("T_LIST1", list1);
|
tables.put("T_LIST1", list1);
|
||||||
|
|
||||||
if (CollectionUtil.isNotEmpty(dto.getItem2())){
|
if (CollectionUtil.isNotEmpty(dto.getItem2())) {
|
||||||
List<Map<String, Object>> list2 = new ArrayList<>();
|
List<Map<String, Object>> list2 = new ArrayList<>();
|
||||||
dto.getItem2().forEach(item -> {
|
dto.getItem2().forEach(item -> {
|
||||||
Map<String, Object> map=new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
map.put("EBELP", item.getEBELP());
|
map.put("EBELP", item.getEBELP());
|
||||||
map.put("SERNR", item.getSERNR());
|
map.put("SERNR", item.getSERNR());
|
||||||
map.put("FLAG", item.getFLAG());
|
map.put("FLAG", item.getFLAG());
|
||||||
|
|
@ -66,14 +71,15 @@ public class SapService {
|
||||||
}
|
}
|
||||||
|
|
||||||
JCoParameterList tOut = execReturnParameter("ZIM_003_105", parameters, tables);
|
JCoParameterList tOut = execReturnParameter("ZIM_003_105", parameters, tables);
|
||||||
return StrUtil.equals(tOut.getString("TYPE"),"S")? "" : tOut.getString("MSG");
|
return StrUtil.equals(tOut.getString("TYPE"), "S") ? "" : tOut.getString("MSG");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 扫码入库
|
* 扫码入库
|
||||||
|
*
|
||||||
* @param dto 数据
|
* @param dto 数据
|
||||||
*/
|
*/
|
||||||
public String zim003(ZIM003DTO dto){
|
public String zim003(ZIM003DTO dto) {
|
||||||
Map<String, Object> parameters = new HashMap<>();
|
Map<String, Object> parameters = new HashMap<>();
|
||||||
parameters.put("EBELP", dto.getEbeln());
|
parameters.put("EBELP", dto.getEbeln());
|
||||||
parameters.put("USNAM", dto.getUsnam());
|
parameters.put("USNAM", dto.getUsnam());
|
||||||
|
|
@ -90,10 +96,10 @@ public class SapService {
|
||||||
list1.add(Map.of("KZKRI", dto.getItem1().getKZKRI()));
|
list1.add(Map.of("KZKRI", dto.getItem1().getKZKRI()));
|
||||||
tables.put("T_LIST1", list1);
|
tables.put("T_LIST1", list1);
|
||||||
|
|
||||||
if (CollectionUtil.isNotEmpty(dto.getItem2())){
|
if (CollectionUtil.isNotEmpty(dto.getItem2())) {
|
||||||
List<Map<String, Object>> list2 = new ArrayList<>();
|
List<Map<String, Object>> list2 = new ArrayList<>();
|
||||||
dto.getItem2().forEach(item -> {
|
dto.getItem2().forEach(item -> {
|
||||||
Map<String, Object> map=new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
map.put("EBELP", item.getEBELP());
|
map.put("EBELP", item.getEBELP());
|
||||||
map.put("SERNR", item.getSERNR());
|
map.put("SERNR", item.getSERNR());
|
||||||
map.put("FLAG", item.getFLAG());
|
map.put("FLAG", item.getFLAG());
|
||||||
|
|
@ -103,30 +109,31 @@ public class SapService {
|
||||||
}
|
}
|
||||||
|
|
||||||
JCoParameterList tOut = execReturnParameter("ZIM_003", parameters, tables);
|
JCoParameterList tOut = execReturnParameter("ZIM_003", parameters, tables);
|
||||||
return StrUtil.equals(tOut.getString("TYPE"),"S")? "" : tOut.getString("MSG");
|
return StrUtil.equals(tOut.getString("TYPE"), "S") ? "" : tOut.getString("MSG");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存库存
|
* 保存库存
|
||||||
* @param factory 工厂编号
|
*
|
||||||
* @param materialNo 物料编号
|
* @param factory 工厂编号
|
||||||
|
* @param materialNo 物料编号
|
||||||
* @param warehouseNo 仓库编号
|
* @param warehouseNo 仓库编号
|
||||||
* @param binNos 储位编号列表
|
* @param binNos 储位编号列表
|
||||||
*/
|
*/
|
||||||
public void ZWM3A02(String factory,String materialNo,String warehouseNo,Collection<String> binNos) {
|
public void ZWM3A02(String factory, String materialNo, String warehouseNo, Collection<String> binNos) {
|
||||||
Map<String, Object> parameters = new HashMap<>();
|
Map<String, Object> parameters = new HashMap<>();
|
||||||
parameters.put("WERKS", factory);
|
parameters.put("WERKS", factory);
|
||||||
parameters.put("MATNR", materialNo);
|
parameters.put("MATNR", materialNo);
|
||||||
parameters.put("LGORT", warehouseNo);
|
parameters.put("LGORT", warehouseNo);
|
||||||
parameters.put("LGPBE", StrUtil.join("/",binNos));
|
parameters.put("LGPBE", StrUtil.join("/", binNos));
|
||||||
|
|
||||||
JCoTable tOut = execReturnTable("ZWM3A02", parameters);
|
JCoTable tOut = execReturnTable("ZWM3A02", parameters);
|
||||||
|
|
||||||
if (tOut.getNumRows() > 0){
|
if (tOut.getNumRows() > 0) {
|
||||||
tOut.setRow(0);
|
tOut.setRow(0);
|
||||||
VUtil.trueThrowBusinessError(StrUtil.equals(tOut.getString("E_TYPE"),"E"))
|
VUtil.trueThrowBusinessError(StrUtil.equals(tOut.getString("E_TYPE"), "E"))
|
||||||
.throwMessage(tOut.getString("E_MSG"));
|
.throwMessage(tOut.getString("E_MSG"));
|
||||||
}else {
|
} else {
|
||||||
log.error("保存库存失败");
|
log.error("保存库存失败");
|
||||||
VUtil.trueThrowBusinessError(true).throwMessage("保存库存失败");
|
VUtil.trueThrowBusinessError(true).throwMessage("保存库存失败");
|
||||||
}
|
}
|
||||||
|
|
@ -134,9 +141,10 @@ public class SapService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取库存信息
|
* 获取库存信息
|
||||||
* @param factory 工厂编号
|
*
|
||||||
|
* @param factory 工厂编号
|
||||||
* @param warehouseNo 仓库编号
|
* @param warehouseNo 仓库编号
|
||||||
* @param materialNo 物料编号
|
* @param materialNo 物料编号
|
||||||
*/
|
*/
|
||||||
public SAPSyncFromDTO zwm3a01(String factory, String warehouseNo, String materialNo) {
|
public SAPSyncFromDTO zwm3a01(String factory, String warehouseNo, String materialNo) {
|
||||||
return zwm3a01(factory, Collections.singletonList(warehouseNo), Collections.singletonList(materialNo), null, null)
|
return zwm3a01(factory, Collections.singletonList(warehouseNo), Collections.singletonList(materialNo), null, null)
|
||||||
|
|
@ -145,7 +153,8 @@ public class SapService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取库存信息
|
* 获取库存信息
|
||||||
* @param factory 工厂编号
|
*
|
||||||
|
* @param factory 工厂编号
|
||||||
* @param warehouseNos 仓库编号列表
|
* @param warehouseNos 仓库编号列表
|
||||||
* @param beginTime 开始时间,格式yyyyMMdd
|
* @param beginTime 开始时间,格式yyyyMMdd
|
||||||
* @param endTime 结束时间,格式yyyyMMdd
|
* @param endTime 结束时间,格式yyyyMMdd
|
||||||
|
|
@ -193,7 +202,8 @@ public class SapService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取订单中物料的信息
|
* 获取订单中物料的信息
|
||||||
* @param orderNo 采购单号
|
*
|
||||||
|
* @param orderNo 采购单号
|
||||||
* @param supplierNo 供应商编号
|
* @param supplierNo 供应商编号
|
||||||
* @param materialNo 物料编号
|
* @param materialNo 物料编号
|
||||||
*/
|
*/
|
||||||
|
|
@ -231,6 +241,7 @@ public class SapService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 搜索订单
|
* 搜索订单
|
||||||
|
*
|
||||||
* @param supplierNo 供应商编码
|
* @param supplierNo 供应商编码
|
||||||
*/
|
*/
|
||||||
public List<SAPOrderDTO> searchOrder(String supplierNo) {
|
public List<SAPOrderDTO> searchOrder(String supplierNo) {
|
||||||
|
|
@ -256,6 +267,57 @@ public class SapService {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 成本中心退库查询
|
||||||
|
* 根据退库单号查询物料退库信息
|
||||||
|
*
|
||||||
|
* @param resebRsNum 退库单号
|
||||||
|
* @return 预留单号
|
||||||
|
*/
|
||||||
|
public List<C_MaterialReturnQueryDTO> zwm00_MB017(String resebRsNum) throws JCoException {
|
||||||
|
Map<String, Object> parameters = new HashMap<>();
|
||||||
|
parameters.put("I_RSNUM", resebRsNum);
|
||||||
|
JCoFunction function = exec("ZWM00_MB017", parameters, null);
|
||||||
|
JCoTable tOut = function.getTableParameterList().getTable("T_OUT");
|
||||||
|
log.info("SAP返回: {}", tOut);
|
||||||
|
List<C_MaterialReturnQueryDTO> result = new ArrayList<>();
|
||||||
|
// if (out.getString("TYPE").equals("S")) {
|
||||||
|
for (int i = 0; i < tOut.getNumRows(); i++) {
|
||||||
|
tOut.setRow(i);
|
||||||
|
result.add(new C_MaterialReturnQueryDTO()
|
||||||
|
.setResbRspos(tOut.getString("RSPOS"))
|
||||||
|
.setMaktx(tOut.getString("MAKTX"))
|
||||||
|
.setResbMatnr(tOut.getString("MATNR"))
|
||||||
|
.setResbBdmng(tOut.getString("BDMNG"))
|
||||||
|
.setResbLgort(tOut.getString("LGORT"))
|
||||||
|
.setResbWerks(tOut.getString("WERKS"))
|
||||||
|
.setResbMeins(tOut.getString("MEINS")));
|
||||||
|
}
|
||||||
|
log.debug("数据:{}", JSONUtil.toJsonStr(result));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 成本中心退库确认
|
||||||
|
private C_MaterialReturnDTO zwm00_MB112(C_MaterialReturnQO request) {
|
||||||
|
Map<String, Object> parameters = new HashMap<>();
|
||||||
|
parameters.put("I_RSNUM", request.getResbRsNum());
|
||||||
|
parameters.put("I_USNAM", request.getResbRsNum());
|
||||||
|
List<C_MaterialReturnItemQO> items = request.getItems();
|
||||||
|
//
|
||||||
|
// / /Map<String, Map<String, Double>> summary = items.stream()
|
||||||
|
// / / .collect(Collectors.groupingBy(
|
||||||
|
// / / C_MaterialReturnItemQO::getResbRspos,
|
||||||
|
// / /
|
||||||
|
// / / Collectors.groupingBy(
|
||||||
|
// / / C_MaterialReturnItemQO::getResbMatnr,
|
||||||
|
// / /Collectors.summingDouble(item -> Double.parseDouble(item.getMsebErfmg()))
|
||||||
|
// / / )
|
||||||
|
// / / ));
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
//成本中心领料查询
|
||||||
|
//成本中心领料
|
||||||
private JCoTable execReturnTable(String functionName, Map<String, Object> parameters) {
|
private JCoTable execReturnTable(String functionName, Map<String, Object> parameters) {
|
||||||
return execReturnTable(functionName, parameters, null, "T_OUT");
|
return execReturnTable(functionName, parameters, null, "T_OUT");
|
||||||
}
|
}
|
||||||
|
|
@ -266,7 +328,7 @@ public class SapService {
|
||||||
|
|
||||||
private JCoTable execReturnTable(String functionName, Map<String, Object> parameters, Map<String, List<Map<String, Object>>> tables, String outName) {
|
private JCoTable execReturnTable(String functionName, Map<String, Object> parameters, Map<String, List<Map<String, Object>>> tables, String outName) {
|
||||||
try {
|
try {
|
||||||
JCoFunction function=exec(functionName,parameters,tables);
|
JCoFunction function = exec(functionName, parameters, tables);
|
||||||
JCoTable out = function.getTableParameterList().getTable(outName);
|
JCoTable out = function.getTableParameterList().getTable(outName);
|
||||||
log.info("SAP返回: {}", out);
|
log.info("SAP返回: {}", out);
|
||||||
return out;
|
return out;
|
||||||
|
|
@ -278,7 +340,7 @@ public class SapService {
|
||||||
|
|
||||||
private JCoParameterList execReturnParameter(String functionName, Map<String, Object> parameters, Map<String, List<Map<String, Object>>> tables) {
|
private JCoParameterList execReturnParameter(String functionName, Map<String, Object> parameters, Map<String, List<Map<String, Object>>> tables) {
|
||||||
try {
|
try {
|
||||||
JCoFunction function=exec(functionName,parameters,tables);
|
JCoFunction function = exec(functionName, parameters, tables);
|
||||||
JCoParameterList out = function.getExportParameterList();
|
JCoParameterList out = function.getExportParameterList();
|
||||||
log.info("SAP返回: {}", out);
|
log.info("SAP返回: {}", out);
|
||||||
return out;
|
return out;
|
||||||
|
|
@ -291,7 +353,11 @@ public class SapService {
|
||||||
private JCoFunction exec(String functionName, Map<String, Object> parameters, Map<String, List<Map<String, Object>>> tables) throws JCoException {
|
private JCoFunction exec(String functionName, Map<String, Object> parameters, Map<String, List<Map<String, Object>>> tables) throws JCoException {
|
||||||
log.info("SAP functionName:{}", functionName);
|
log.info("SAP functionName:{}", functionName);
|
||||||
JCoFunction function = repository.getFunction(functionName);
|
JCoFunction function = repository.getFunction(functionName);
|
||||||
|
printMeta(function);
|
||||||
|
|
||||||
log.info("SAP ImportParameter:{}", JSONUtil.toJsonStr(parameters));
|
log.info("SAP ImportParameter:{}", JSONUtil.toJsonStr(parameters));
|
||||||
|
log.info("---{}", function.getImportParameterList().getListMetaData());
|
||||||
|
|
||||||
if (CollectionUtil.isNotEmpty(parameters)) {
|
if (CollectionUtil.isNotEmpty(parameters)) {
|
||||||
parameters.forEach((name, value) -> function.getImportParameterList().setValue(name, value));
|
parameters.forEach((name, value) -> function.getImportParameterList().setValue(name, value));
|
||||||
}
|
}
|
||||||
|
|
@ -309,4 +375,58 @@ public class SapService {
|
||||||
function.execute(destination);
|
function.execute(destination);
|
||||||
return function;
|
return function;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void printMeta(String functionName) throws JCoException {
|
||||||
|
JCoFunction function = repository.getFunction(functionName);
|
||||||
|
printMeta(function);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void printMeta(JCoFunction function){
|
||||||
|
log.trace("-------------------------------------------------------");
|
||||||
|
log.trace("SAP {} 方法参数信息", function.getName());
|
||||||
|
log.trace("-- Import结构");
|
||||||
|
printParameterField(function.getImportParameterList());
|
||||||
|
log.trace("-- Changing结构");
|
||||||
|
printParameterField(function.getChangingParameterList());
|
||||||
|
log.trace("-- Export结构");
|
||||||
|
printParameterField(function.getExportParameterList());
|
||||||
|
log.trace("-- Table结构");
|
||||||
|
printParameterField(function.getTableParameterList());
|
||||||
|
log.trace("-------------------------------------------------------");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void printParameterField(JCoParameterList parameterList){
|
||||||
|
if (Objects.nonNull(parameterList)) {
|
||||||
|
JCoParameterFieldIterator iterator = parameterList.getParameterFieldIterator();
|
||||||
|
if (Objects.nonNull(iterator)) {
|
||||||
|
while (iterator.hasNextField()) {
|
||||||
|
JCoParameterField field = iterator.nextParameterField();
|
||||||
|
log.trace("名称:{},类型:{},描述:{}", field.getName(), field.getTypeAsString(),field.getDescription());
|
||||||
|
if (field.isTable()){
|
||||||
|
printJCoTable(field.getTable());
|
||||||
|
}else if (field.isStructure()){
|
||||||
|
printStructure(field.getStructure());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void printJCoTable(JCoTable table){
|
||||||
|
log.trace("Table结构");
|
||||||
|
JCoRecordFieldIterator iterator=table.getRecordFieldIterator();
|
||||||
|
while (iterator.hasNextField()) {
|
||||||
|
JCoRecordField field = iterator.nextRecordField();
|
||||||
|
log.trace("名称:{},类型:{},描述:{}", field.getName(), field.getTypeAsString(),field.getDescription());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void printStructure(JCoStructure structure){
|
||||||
|
log.trace("Structure结构");
|
||||||
|
JCoRecordFieldIterator iterator=structure.getRecordFieldIterator();
|
||||||
|
while (iterator.hasNextField()) {
|
||||||
|
JCoRecordField field = iterator.nextRecordField();
|
||||||
|
log.trace("名称:{},类型:{},描述:{}", field.getName(), field.getTypeAsString(),field.getDescription());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ logging:
|
||||||
level:
|
level:
|
||||||
root: info
|
root: info
|
||||||
com:
|
com:
|
||||||
nflg: debug
|
nflg: trace
|
||||||
alibaba:
|
alibaba:
|
||||||
cloud:
|
cloud:
|
||||||
nacos: debug
|
nacos: debug
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.nflg.wms.common.pojo.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class C_MaterialReturnDTO {
|
||||||
|
//物料凭证(202移动类型凭证)
|
||||||
|
private String eMblnr;
|
||||||
|
|
||||||
|
//物料凭证年度
|
||||||
|
private String eMJahr;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.nflg.wms.common.pojo.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class C_MaterialReturnQueryDTO {
|
||||||
|
// 预留项目号 RESB-RSPOS
|
||||||
|
private String resbRspos;
|
||||||
|
//MAKTX 物料描述
|
||||||
|
private String maktx;
|
||||||
|
//RESB-MATNR 物料号
|
||||||
|
private String resbMatnr;
|
||||||
|
//RESB-BDMNG 需求数量
|
||||||
|
private String resbBdmng;
|
||||||
|
// RESB-LGORT 库存地点
|
||||||
|
private String resbLgort;
|
||||||
|
// RESB-WERKS 工厂
|
||||||
|
private String resbWerks;
|
||||||
|
//RESB-MEINS 单位
|
||||||
|
private String resbMeins;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
package com.nflg.wms.common.pojo.qo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class C_MaterialReturnItemQO {
|
||||||
|
|
||||||
|
//预留项目号
|
||||||
|
private String resbRspos;
|
||||||
|
|
||||||
|
// 物料号
|
||||||
|
private String resbMatnr;
|
||||||
|
|
||||||
|
//实退数量
|
||||||
|
private BigDecimal msebErfmg;
|
||||||
|
|
||||||
|
//库存地点
|
||||||
|
private String resbLgort;
|
||||||
|
|
||||||
|
// 工厂
|
||||||
|
private String resbWerks;
|
||||||
|
|
||||||
|
// 单位
|
||||||
|
private String resbMeins;
|
||||||
|
|
||||||
|
// 批次
|
||||||
|
/**
|
||||||
|
* 批次号
|
||||||
|
*/
|
||||||
|
private String batchNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 序列号,多个序列号使用;号隔开
|
||||||
|
*/
|
||||||
|
private String serialNumber;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.nflg.wms.common.pojo.qo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class C_MaterialReturnQO {
|
||||||
|
//预留号
|
||||||
|
private String resbRsNum;
|
||||||
|
|
||||||
|
//PDA操作员
|
||||||
|
private String pdaOperator;
|
||||||
|
|
||||||
|
// 预留单退料详情信息
|
||||||
|
private List<C_MaterialReturnItemQO> items;
|
||||||
|
}
|
||||||
|
|
@ -1,11 +1,15 @@
|
||||||
package com.nflg.wms.repository.service;
|
package com.nflg.wms.repository.service;
|
||||||
|
|
||||||
|
import com.nflg.wms.repository.entity.WmsInTaskItem;
|
||||||
import com.nflg.wms.repository.entity.WmsSrmMaterialReceipt;
|
import com.nflg.wms.repository.entity.WmsSrmMaterialReceipt;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.nflg.wms.repository.entity.WmsSrmMaterialReceiptItem;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 服务类
|
* 服务类
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author 代码生成器生成
|
* @author 代码生成器生成
|
||||||
|
|
@ -13,4 +17,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
*/
|
*/
|
||||||
public interface IWmsSrmMaterialReceiptService extends IService<WmsSrmMaterialReceipt> {
|
public interface IWmsSrmMaterialReceiptService extends IService<WmsSrmMaterialReceipt> {
|
||||||
|
|
||||||
|
void generateReceiptInfo(List<WmsSrmMaterialReceipt> receipts,
|
||||||
|
List<WmsSrmMaterialReceiptItem> receiptitems,
|
||||||
|
List<WmsInTaskItem> tasks);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,23 @@
|
||||||
package com.nflg.wms.repository.service.impl;
|
package com.nflg.wms.repository.service.impl;
|
||||||
|
|
||||||
|
import com.nflg.wms.repository.entity.WmsInTaskItem;
|
||||||
import com.nflg.wms.repository.entity.WmsSrmMaterialReceipt;
|
import com.nflg.wms.repository.entity.WmsSrmMaterialReceipt;
|
||||||
|
import com.nflg.wms.repository.entity.WmsSrmMaterialReceiptItem;
|
||||||
import com.nflg.wms.repository.mapper.WmsSrmMaterialReceiptMapper;
|
import com.nflg.wms.repository.mapper.WmsSrmMaterialReceiptMapper;
|
||||||
import com.nflg.wms.repository.service.IWmsSrmMaterialReceiptService;
|
import com.nflg.wms.repository.service.*;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import static cn.dev33.satoken.SaManager.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 服务实现类
|
* 服务实现类
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author 代码生成器生成
|
* @author 代码生成器生成
|
||||||
|
|
@ -17,4 +26,24 @@ import org.springframework.stereotype.Service;
|
||||||
@Service
|
@Service
|
||||||
public class WmsSrmMaterialReceiptServiceImpl extends ServiceImpl<WmsSrmMaterialReceiptMapper, WmsSrmMaterialReceipt> implements IWmsSrmMaterialReceiptService {
|
public class WmsSrmMaterialReceiptServiceImpl extends ServiceImpl<WmsSrmMaterialReceiptMapper, WmsSrmMaterialReceipt> implements IWmsSrmMaterialReceiptService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IWmsSrmMaterialReceiptItemService wmsSrmMaterialReceiptItemService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IWmsInTaskService taskService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public void generateReceiptInfo(List<WmsSrmMaterialReceipt> receipts, List<WmsSrmMaterialReceiptItem> receiptitems, List<WmsInTaskItem> tasks) {
|
||||||
|
if (Objects.nonNull(receipts) && !receipts.isEmpty()) {
|
||||||
|
saveBatch(receipts);
|
||||||
|
}
|
||||||
|
if (Objects.nonNull(receipts) && !receipts.isEmpty()) {
|
||||||
|
wmsSrmMaterialReceiptItemService.saveBatch(receiptitems);
|
||||||
|
}
|
||||||
|
if (Objects.nonNull(receipts) && !receipts.isEmpty()) {
|
||||||
|
if (!taskService.generateTask(tasks, (short) 1))
|
||||||
|
log.error("收货单生成上架任务失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue