一些优化

This commit is contained in:
曹鹏飞 2025-08-04 15:54:18 +08:00
parent 75af7a687b
commit b1765b65a0
3 changed files with 78 additions and 105 deletions

View File

@ -852,7 +852,6 @@ public class StructuralPackageOrderController extends BaseController {
public void saveInventory(WmsInTaskItem item,BigDecimal total){ public void saveInventory(WmsInTaskItem item,BigDecimal total){
WmsInventory inventory = inventoryService.lambdaQuery() WmsInventory inventory = inventoryService.lambdaQuery()
.eq(WmsInventory::getMaterialNo, item.getItemCode()) .eq(WmsInventory::getMaterialNo, item.getItemCode())
.eq(WmsInventory::getExternalOrderNo, item.getPoNum())
.eq(WmsInventory::getBatchNumber, item.getBatchNumber()) .eq(WmsInventory::getBatchNumber, item.getBatchNumber())
.one(); .one();
if (Objects.isNull(inventory)) { if (Objects.isNull(inventory)) {
@ -861,9 +860,6 @@ public class StructuralPackageOrderController extends BaseController {
.setNum(total) .setNum(total)
.setFactoryNo(item.getFactory()) .setFactoryNo(item.getFactory())
.setWarehouseNo(item.getReceivedWarehouse()) .setWarehouseNo(item.getReceivedWarehouse())
.setBinNos(item.getStorageLocation())
.setExternalOrderNo(item.getPoNum())
.setRowNo(item.getPoLineNumber())
.setCreateBy(UserUtil.getUserName()) .setCreateBy(UserUtil.getUserName())
.setCreateTime(LocalDateTime.now()); .setCreateTime(LocalDateTime.now());
inventoryService.save(inventory); inventoryService.save(inventory);

View File

@ -6,6 +6,7 @@ import cn.hutool.json.JSONUtil;
import com.nflg.wms.admin.pojo.dto.SAPMaterialInfoInOrderDTO; import com.nflg.wms.admin.pojo.dto.SAPMaterialInfoInOrderDTO;
import com.nflg.wms.admin.pojo.dto.ZIM003105DTO; 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.Constant;
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.*; import com.nflg.wms.common.pojo.dto.*;
@ -18,6 +19,7 @@ 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;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.slf4j.MDC;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -43,7 +45,6 @@ public class SapService {
parameters.put("EBELN", orderNo); parameters.put("EBELN", orderNo);
Zim001QueryResultDTO result=new Zim001QueryResultDTO(); Zim001QueryResultDTO result=new Zim001QueryResultDTO();
try {
JCoFunction function = exec("ZIM_001_QUERY", parameters, null); JCoFunction function = exec("ZIM_001_QUERY", parameters, null);
JCoStructure structure = function.getExportParameterList().getStructure("OUTPUT"); JCoStructure structure = function.getExportParameterList().getStructure("OUTPUT");
@ -86,10 +87,6 @@ public class SapService {
result.setItem2(items2); result.setItem2(items2);
log.debug("数据:{}", JSONUtil.toJsonStr(result)); log.debug("数据:{}", JSONUtil.toJsonStr(result));
} catch (JCoException e) {
log.error("SAP错误", e);
VUtil.trueThrowBusinessError(true).throwMessage("SAP错误:" + e.getMessage());
}
return result; return result;
} }
@ -372,7 +369,7 @@ public class SapService {
* @param resebRsNum 退库单号 * @param resebRsNum 退库单号
* @return 预留单号 * @return 预留单号
*/ */
public List<C_MaterialReturnQueryDTO> zwm00_MB017(String resebRsNum) throws JCoException { public List<C_MaterialReturnQueryDTO> zwm00_MB017(String resebRsNum) {
Map<String, Object> parameters = new HashMap<>(); Map<String, Object> parameters = new HashMap<>();
parameters.put("I_RSNUM", resebRsNum); parameters.put("I_RSNUM", resebRsNum);
JCoFunction function = exec("ZWM00_MB017", parameters, null); JCoFunction function = exec("ZWM00_MB017", parameters, null);
@ -396,7 +393,7 @@ public class SapService {
} }
// 成本中心退库确认 // 成本中心退库确认
public C_MaterialReturnDTO zwm00_MB112(C_MaterialReturnQO request) throws JCoException { public C_MaterialReturnDTO zwm00_MB112(C_MaterialReturnQO request) {
Map<String, Object> parameters = new HashMap<>(); Map<String, Object> parameters = new HashMap<>();
parameters.put("I_RSNUM", request.getResbRsNum()); parameters.put("I_RSNUM", request.getResbRsNum());
parameters.put("I_USNAM", UserUtil.getUserName()); parameters.put("I_USNAM", UserUtil.getUserName());
@ -447,12 +444,12 @@ public class SapService {
} }
//成本中心领料查询 //成本中心领料查询
public C_MaterialOutboundQueryDTO zwm00_MB026(String resebRsNum) throws JCoException { public C_MaterialOutboundQueryDTO zwm00_MB026(String resebRsNum) {
return null; return null;
} }
public C_MaterialOutboundDTO ZWM00_MB115(C_MaterialOutboundQO request) throws JCoException { public C_MaterialOutboundDTO ZWM00_MB115(C_MaterialOutboundQO request) {
return null; return null;
} }
@ -468,30 +465,21 @@ 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 {
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;
} catch (JCoException ex) {
log.error("SAP错误", ex);
throw new NflgException(STATE.BusinessError, "SAP错误");
}
} }
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 {
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;
} catch (JCoException ex) {
log.error("SAP错误", ex);
throw new NflgException(STATE.BusinessError, "SAP错误");
}
} }
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) {
try {
functionName=functionName.toUpperCase(); functionName=functionName.toUpperCase();
log.info("SAP functionName:{}", functionName); log.info("SAP functionName:{}", functionName);
JCoFunction function = repository.getFunction(functionName); JCoFunction function = repository.getFunction(functionName);
@ -515,6 +503,10 @@ public class SapService {
} }
function.execute(destination); function.execute(destination);
return function; return function;
} catch (JCoException e) {
log.error("SAP调用异常", e);
throw new NflgException(STATE.BusinessError, "SAP调用异常:" + MDC.get(Constant.TRACE_ID));
}
} }
public void printMeta(String functionName) throws JCoException { public void printMeta(String functionName) throws JCoException {

View File

@ -48,11 +48,6 @@ public class WmsInventory implements Serializable {
*/ */
private String warehouseNo; private String warehouseNo;
/**
* 储位编号逗号分隔
*/
private String binNos;
/** /**
* 数量 * 数量
*/ */
@ -78,16 +73,6 @@ public class WmsInventory implements Serializable {
*/ */
private LocalDateTime updateTime; private LocalDateTime updateTime;
/**
* 采购单订单号
*/
private String externalOrderNo;
/**
* 采购单订单行号
*/
private String rowNo;
/** /**
* 批次号 * 批次号
*/ */