feat: bug-884 添加【副产品(拆解)入库】业务

This commit is contained in:
曹鹏飞 2025-11-12 10:48:56 +08:00
parent a693a94d58
commit 578151527a
3 changed files with 63 additions and 14 deletions

View File

@ -60,7 +60,7 @@ public class SapService {
JCoStructure result = function.getExportParameterList().getStructure("OUTPUT1");
VUtil.trueThrowBusinessError(!StrUtil.equals("S", result.getString("TYPE")))
.throwMessage("SAP错误:" + result.getString("MSG"));
.throwMessage("SAP:" + result.getString("MSG"));
return Pair.of(result.getString("MAT_DOC"), result.getString("DOC_YEAR"));
}
@ -70,7 +70,13 @@ public class SapService {
*/
public List<ZWM3A23VO> zwm3a23(ZWM3A23QO request) {
Map<String, Object> parameters = new HashMap<>();
parameters.put("i_werks", request.getWerks());
parameters.put("I_WERKS", request.getWerks());
if (Objects.nonNull(request.getStartDate())) {
parameters.put("S_DATE", DateTimeUtil.format(request.getStartDate(), "yyyyMMdd"));
}
if (Objects.nonNull(request.getEndDate())) {
parameters.put("E_DATE", DateTimeUtil.format(request.getEndDate(), "yyyyMMdd"));
}
Map<String, List<Map<String, Object>>> tables = new HashMap<>();
if (CollectionUtil.isNotEmpty(request.getArbpls())) {
@ -98,7 +104,7 @@ public class SapService {
JCoFunction function = exec("ZWM3A23", parameters, tables);
VUtil.trueThrowBusinessError(!StrUtil.equals("S", function.getExportParameterList().getString("E_TYPE")))
.throwMessage("SAP错误:" + function.getExportParameterList().getString("E_MSG"));
.throwMessage("SAP:" + function.getExportParameterList().getString("E_MSG"));
JCoTable table = function.getTableParameterList().getTable("OUTPUT1");
return JCoUtil.toBeanList(table, ZWM3A23VO.class);
@ -124,7 +130,7 @@ public class SapService {
List<String> errors = lrs.stream().filter(lr -> !StrUtil.equals(lr.getType(), "S"))
.map(ZWM00_MB116ReturnVO::getMessage)
.toList();
VUtil.trueThrowBusinessError(CollectionUtil.isNotEmpty(errors)).throwMessage("SAP错误" + StrUtil.join(",", errors));
VUtil.trueThrowBusinessError(CollectionUtil.isNotEmpty(errors)).throwMessage("SAP" + StrUtil.join(",", errors));
return new ZWM00_MB116VO()
.setMblnr(function.getExportParameterList().getString("E_MBLNR"))
@ -150,7 +156,7 @@ public class SapService {
ZWM00MB007DTO dto = JCoUtil.toBean(eOutput, ZWM00MB007DTO.class);
if (StrUtil.isBlank(dto.getAufnr())) {
VUtil.trueThrowBusinessError(!StrUtil.equals(eReturn.getString("TYPE"), "S"))
.throwMessage("SAP错误:" + eReturn.getString("MESSAGE"));
.throwMessage("SAP:" + eReturn.getString("MESSAGE"));
return null;
} else {
return dto;
@ -188,7 +194,7 @@ public class SapService {
JCoParameterList pl = function.getExportParameterList();
log.info("E_MBLNR:{}", pl.getString("E_MBLNR"));
VUtil.trueThrowBusinessError(StrUtil.isBlank(pl.getString("E_MBLNR")))
.throwMessage("SAP错误");
.throwMessage("SAP");
VUtil.trueHandle(StrUtil.isBlank(pl.getString("E_MBLNR"))).trueHandle(() -> {
JCoTable table = function.getTableParameterList().getTable("T_RETURN");
log.error("SAP错误信息:{}", table);
@ -210,7 +216,7 @@ public class SapService {
JCoStructure structure = function.getExportParameterList().getStructure("E_RETURN");
VUtil.trueThrowBusinessError(!StrUtil.equals(structure.getString("TYPE"), "S"))
.throwMessage("SAP错误:" + structure.getString("MSG"));
.throwMessage("SAP:" + structure.getString("MSG"));
JCoTable ot1 = function.getTableParameterList().getTable("OUTPUT1");
VUtil.trueThrowBusinessError(ot1.getNumRows() == 0).throwMessage("没有订单数据");
@ -252,7 +258,7 @@ public class SapService {
JCoParameterList jparameters = execReturnParameter("ZWM3A06", parameters, tables);
JCoStructure structure = jparameters.getStructure("OUTPUT");
VUtil.trueThrowBusinessError(!StrUtil.equals(structure.getString("TYPE"), "S"))
.throwMessage("SAP错误:" + structure.getString("MSG"));
.throwMessage("SAP:" + structure.getString("MSG"));
return Pair.of(structure.getString("MAT_DOC"), structure.getString("DOC_YEAR"));
}
@ -279,7 +285,7 @@ public class SapService {
JCoFunction function = exec("ZWM3A18", parameters, tables);
JCoStructure structure = function.getExportParameterList().getStructure("OUTPUT1");
VUtil.trueThrowBusinessError(!StrUtil.equals(structure.getString("TYPE"), "S"))
.throwMessage("SAP错误" + structure.getString("MSG"));
.throwMessage("SAP" + structure.getString("MSG"));
return Pair.of(structure.getString("MAT_DOC"), structure.getString("DOC_YEAR"));
}
@ -304,7 +310,7 @@ public class SapService {
JCoStructure structure = function.getExportParameterList().getStructure("OUTPUT1");
print("OUTPUT1", structure);
VUtil.trueThrowBusinessError(!StrUtil.equals(structure.getString("TYPE"), "S"))
.throwMessage("SAP错误" + structure.getString("MSG"));
.throwMessage("SAP" + structure.getString("MSG"));
return Pair.of(Pair.of(structure.getString("MAT_DOC_101"), structure.getString("DOC_YEAR_101"))
, Pair.of(structure.getString("MAT_DOC_103"), structure.getString("DOC_YEAR_103")));
@ -332,7 +338,7 @@ public class SapService {
List<Map<String, Object>> tOut = JCoUtil.toMapList(table);
VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(tOut)).throwMessage("SAP未返回结果");
VUtil.trueThrowBusinessError(!StrUtil.equals(tOut.get(0).get("E_TYPE").toString(), "S"))
.throwMessage("SAP错误" + tOut.get(0).get("E_MSG"));
.throwMessage("SAP" + tOut.get(0).get("E_MSG"));
}
/**
@ -401,7 +407,7 @@ public class SapService {
JCoStructure structure = function.getExportParameterList().getStructure("E_RETURN");
VUtil.trueThrow(!StrUtil.equals(structure.getString("TYPE"), "S"))
.throwMessage(STATE.SAPErr, "SAP错误" + structure.getString("MSG"));
.throwMessage(STATE.SAPErr, "SAP" + structure.getString("MSG"));
JCoTable table = function.getTableParameterList().getTable("T_OUT");
log.info("SAP返回: {}", table);
@ -1289,7 +1295,7 @@ public class SapService {
JCoFunction function = exec("ZWM3A19", parameters, null);
JCoParameterList structure = function.getExportParameterList();
VUtil.trueThrowBusinessError(!StrUtil.equals(structure.getString("E_TYPE"), "S"))
.throwMessage("SAP错误:" + structure.getString("E_MSG"));
.throwMessage("SAP:" + structure.getString("E_MSG"));
JCoTable ot1 = function.getTableParameterList().getTable("HEAD");
@ -1339,7 +1345,7 @@ public class SapService {
JCoStructure structure = function.getExportParameterList().getStructure("OUTPUT");
print("输出参数OUTPUT", structure);
VUtil.trueThrowBusinessError(!StrUtil.equals(structure.getString("TYPE"), "S"))
.throwMessage("SAP错误" + structure.getString("MSG"));
.throwMessage("SAP" + structure.getString("MSG"));
return Pair.of(structure.getString("MAT_DOC"), structure.getString("DOC_YEAR"));
}

View File

@ -2,7 +2,9 @@ package com.nflg.wms.common.pojo.qo;
import lombok.Data;
import java.time.LocalDate;
import java.util.List;
import java.util.Objects;
@Data
public class ZWM3A23QO {
@ -26,4 +28,24 @@ public class ZWM3A23QO {
* 工作中心列表
*/
private List<String> arbpls;
/**
* 开始时间
*/
private LocalDate startDate;
/**
* 结束时间
*/
private LocalDate endDate;
public LocalDate getEndDate() {
if (Objects.nonNull(endDate)) {
return endDate;
}
if (Objects.nonNull(startDate)) {
return LocalDate.now();
}
return null;
}
}

View File

@ -3,6 +3,7 @@ package com.nflg.wms.common.pojo.vo;
import cn.hutool.core.util.StrUtil;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.nflg.wms.common.util.BomUtil;
import com.nflg.wms.common.util.DateTimeUtil;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Positive;
@ -28,6 +29,10 @@ public class ZWM3A23VO {
*/
private String rsnum;
public String getRsnum() {
return StrUtil.removeAllPrefix(rsnum, "0");
}
/**
* 物料号
*/
@ -48,6 +53,10 @@ public class ZWM3A23VO {
*/
private String vornr;
public String getVornr() {
return StrUtil.removeAllPrefix(vornr, "0");
}
/**
* 序列号
*/
@ -109,11 +118,19 @@ public class ZWM3A23VO {
*/
private String rsnum2;
public String getRsnum2() {
return StrUtil.removeAllPrefix(rsnum2, "0");
}
/**
* 预留/相关需求的项目编号
*/
private String rspos;
public String getRspos() {
return StrUtil.removeAllPrefix(rspos, "0");
}
/**
* 库存地点
*/
@ -138,6 +155,10 @@ public class ZWM3A23VO {
*/
private String bdter;
public String getBdter() {
return DateTimeUtil.formatFromMillis(bdter);
}
/**
* 申请数量
*/