opt:修改单位取值为物料凭证单位、非分配单单位

This commit is contained in:
2026-10-21 17:14:52 +08:00
parent 1a49bcc5b1
commit f4b75aee65
10 changed files with 109 additions and 99 deletions

View File

@@ -13,7 +13,7 @@ import org.nl.wms.basedata_manage.service.dao.MdMeMaterialbase;
import org.nl.wms.basedata_manage.service.dto.MaterialInfoSyncQuery; import org.nl.wms.basedata_manage.service.dto.MaterialInfoSyncQuery;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;import org.nl.common.base.ResponseData; import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;

View File

@@ -37,6 +37,12 @@ public class MdMeMaterialbase implements Serializable {
*/ */
private String material_code; private String material_code;
/**
* 物料编码
*/
private String lastMaterialId;
/** /**
* 物料名称 * 物料名称
*/ */

View File

@@ -75,7 +75,6 @@ public class SectattrServiceImpl extends ServiceImpl<SectattrMapper, Sectattr> i
@Override @Override
public Sectattr findByCode(String code) { public Sectattr findByCode(String code) {
LambdaQueryWrapper<Sectattr> queryWrapper = new LambdaQueryWrapper<>(Sectattr.class) LambdaQueryWrapper<Sectattr> queryWrapper = new LambdaQueryWrapper<>(Sectattr.class)
.eq(Sectattr::getSect_code, code) .eq(Sectattr::getSect_code, code)
.eq(Sectattr::getIs_delete, BaseDataEnum.IS_YES_NOT.code("否")); .eq(Sectattr::getIs_delete, BaseDataEnum.IS_YES_NOT.code("否"));

View File

@@ -21,8 +21,8 @@ import org.springframework.util.StringUtils;
@Slf4j @Slf4j
public class SapApi { public class SapApi {
private static final String BASIC_AUTH_USER = "sb-164b126d-0398-4635-9d0d-8be99d6e3fdd!b6436|it-rt-dev-12nylocm!b39"; private static final String BASIC_AUTH_USER = "sb-44f42158-6589-470d-94e2-cb4ff68ff64e!b6440|it-rt-prd-mc97okah!b39";
private static final String BASIC_AUTH_PASSWORD = "e3530ba3-2243-4c09-9320-db961c08d04c$aVQJe8yGKZmbkvqE9a1opQU0P2uwRLkGMqHJvrrvmH8="; private static final String BASIC_AUTH_PASSWORD = "07c6eebc-1ff3-4f73-a4d8-870757951649$WTL_Vf-jxg8aWRlTvxP8BC8oloOYosae2JzQykImlpg=";
/** /**
* MM054 交货单收货确认 * MM054 交货单收货确认

View File

@@ -4,7 +4,7 @@ public class SapConstant {
/** SAP CPI Inbound 统一接口地址(各业务接口共用,通过 header.intf_id 区分) */ /** SAP CPI Inbound 统一接口地址(各业务接口共用,通过 header.intf_id 区分) */
public static final String SAP_INBOUND_URL2 = "https://dev-12nylocm.it-cpi010-rt.cpi.cn40.apps.platform.sapcloud.cn/http/ERP/Inbound"; public static final String SAP_INBOUND_URL2 = "https://dev-12nylocm.it-cpi010-rt.cpi.cn40.apps.platform.sapcloud.cn/http/ERP/Inbound";
public static final String SAP_INBOUND_URL = "https://dev-12nylocm.it-cpi010-rt.cpi.cn40.apps.platform.sapcloud.cn/http/QAS/Inbound"; public static final String SAP_INBOUND_URL = "https://prd-mc97okah.it-cpi010-rt.cpi.cn40.apps.platform.sapcloud.cn/http/PRD900/Inbound";
/** 接口编号:交货单确认 */ /** 接口编号:交货单确认 */
public static final String INTF_MM054 = "MM054"; public static final String INTF_MM054 = "MM054";

View File

@@ -94,17 +94,18 @@ public class InboundPdaController {
@Log("平库入库") @Log("平库入库")
@SaIgnore @SaIgnore
public ResponseEntity usualInbound(@RequestBody UsualInboundDto usualInboundDto) { public ResponseEntity usualInbound(@RequestBody UsualInboundDto usualInboundDto) {
inboundPdaService.usualInbound(usualInboundDto); // inboundPdaService.usualInbound(usualInboundDto);
return ResponseData.build(); // return ResponseData.build();
return null;
} }
// @PostMapping("/usualInboundList") @PostMapping("/usualInboundList")
// @Log("批量入平库") @Log("批量入平库")
// @SaIgnore @SaIgnore
// public ResponseEntity usualInboundList(@RequestBody UsualInboundBatchDto batchDto) { public ResponseEntity usualInboundList(@RequestBody UsualInboundBatchDto batchDto) {
// JSONObject result = inboundPdaService.usualInboundList(batchDto); JSONObject result = inboundPdaService.usualInboundList(batchDto);
// return ResponseData.build(result); return ResponseData.build(result);
// } }
@PostMapping("/returnInbound") @PostMapping("/returnInbound")
@Log("退料入库") @Log("退料入库")
@SaIgnore @SaIgnore

View File

@@ -17,13 +17,13 @@ public interface InboundPdaService {
void usualInbound(UsualInboundDto usualInboundDto); void usualInbound(UsualInboundDto usualInboundDto);
// /** /**
// * 批量入平库:对勾选的多张 SAP 物料凭证逐单执行平库入库。 * 批量入平库:对勾选的多张 SAP 物料凭证逐单执行平库入库。
// * *
// * @param batchDto 勾选行列表 + 可选库区 * @param batchDto 勾选行列表 + 可选库区
// * @return 执行结果汇总 {total, successCount, failCount, failList[]} * @return 执行结果汇总 {total, successCount, failCount, failList[]}
// */ */
// JSONObject usualInboundList(UsualInboundBatchDto batchDto); JSONObject usualInboundList(UsualInboundBatchDto batchDto);
void submitGroupPlateInbound(GroupPlateInboundDto dto, Boolean subTask); void submitGroupPlateInbound(GroupPlateInboundDto dto, Boolean subTask);

View File

@@ -528,64 +528,64 @@ public class InboundPdaServiceImpl implements InboundPdaService {
.apply("UPPER(unit_name) = {0}", val.toUpperCase()).last("limit 1")); .apply("UPPER(unit_name) = {0}", val.toUpperCase()).last("limit 1"));
} }
// @Override @Override
// public JSONObject usualInboundList(UsualInboundBatchDto batchDto) { public JSONObject usualInboundList(UsualInboundBatchDto batchDto) {
// if (batchDto == null || batchDto.getList() == null || batchDto.getList().isEmpty()) { if (batchDto == null || batchDto.getList() == null || batchDto.getList().isEmpty()) {
// throw new BadRequestException("批量入平库失败:未选择任何单据"); throw new BadRequestException("批量入平库失败:未选择任何单据");
// } }
// String sectCode = StrUtil.isNotBlank(batchDto.getSect_code()) String sectCode = StrUtil.isNotBlank(batchDto.getSect_code())
// ? batchDto.getSect_code().trim() :"R001"; ? batchDto.getSect_code().trim() :"R001";
// InboundPdaService self = SpringContextHolder.getBean(InboundPdaService.class); InboundPdaService self = SpringContextHolder.getBean(InboundPdaService.class);
// List<JSONObject> failList = new ArrayList<>(); List<JSONObject> failList = new ArrayList<>();
// int successCount = 0; int successCount = 0;
// int total = batchDto.getList().size(); int total = batchDto.getList().size();
// for (UsualInboundBatchDto.Item row : batchDto.getList()) { for (UsualInboundBatchDto.Item row : batchDto.getList()) {
// if (row == null) { if (row == null) {
// total--; total--;
// continue; continue;
// } }
// String billNo = StrUtil.blankToDefault(row.getMblnr(), String.valueOf(row.getId())); String billNo = StrUtil.blankToDefault(row.getMblnr(), String.valueOf(row.getId()));
// MaterialDocument document = resolveBatchDocument(row); MaterialDocument document = resolveBatchDocument(row);
// String skipReason = checkBatchRow(document); String skipReason = checkBatchRow(document);
// if (skipReason != null) { if (skipReason != null) {
// failList.add(buildBatchResult(billNo, skipReason)); failList.add(buildBatchResult(billNo, skipReason));
// continue; continue;
// } }
// try { try {
// self.usualInbound(buildUsualInboundDto(document, sectCode)); self.usualInbound(buildUsualInboundDto(document, sectCode));
// successCount++; successCount++;
// } catch (Exception e) { } catch (Exception e) {
// failList.add(buildBatchResult(billNo, e.getMessage())); failList.add(buildBatchResult(billNo, e.getMessage()));
// } }
// } }
// JSONObject result = new JSONObject(); JSONObject result = new JSONObject();
// result.put("total", total); result.put("total", total);
// result.put("successCount", successCount); result.put("successCount", successCount);
// result.put("failCount", failList.size()); result.put("failCount", failList.size());
// result.put("failList", failList); result.put("failList", failList);
// result.put("sect_code", sectCode); result.put("sect_code", sectCode);
// return result; return result;
// } }
//
// /** /**
// * 按 id 优先、mblnr 兜底定位物料凭证主单,供校验与明细反查共用。 * 按 id 优先、mblnr 兜底定位物料凭证主单,供校验与明细反查共用。
// */ */
// private MaterialDocument resolveBatchDocument(UsualInboundBatchDto.Item row) { private MaterialDocument resolveBatchDocument(UsualInboundBatchDto.Item row) {
// if (row.getId() != null) { if (row.getId() != null) {
// MaterialDocument document = documentMapper.selectById(row.getId()); MaterialDocument document = documentMapper.selectById(row.getId());
// if (document != null) { if (document != null) {
// return document; return document;
// } }
// } }
// if (StrUtil.isNotBlank(row.getMblnr())) { if (StrUtil.isNotBlank(row.getMblnr())) {
// return documentMapper.selectOne(new LambdaQueryWrapper<MaterialDocument>() return documentMapper.selectOne(new LambdaQueryWrapper<MaterialDocument>()
// .eq(MaterialDocument::getMblnr, row.getMblnr()) .eq(MaterialDocument::getMblnr, row.getMblnr())
// .eq(MaterialDocument::getBilltype, MaterialDocumentBillType.PURCHASE_IN.getCode()) .eq(MaterialDocument::getBilltype, MaterialDocumentBillType.PURCHASE_IN.getCode())
// .eq(MaterialDocument::getDeleted, 0) .eq(MaterialDocument::getDeleted, 0)
// .last("LIMIT 1")); .last("LIMIT 1"));
// } }
// return null; return null;
// } }
/** /**
* 批量前的单据校验:只处理「采购入库 + 已创建 + 入库方向」的单据,防止重复入库或入错方向。 * 批量前的单据校验:只处理「采购入库 + 已创建 + 入库方向」的单据,防止重复入库或入错方向。

View File

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.nl.common.exception.BadRequestException; import org.nl.common.exception.BadRequestException;
import org.nl.common.utils.IdUtil; import org.nl.common.utils.IdUtil;
@@ -243,23 +244,25 @@ public class StInventoryServiceImpl implements IStInventoryService {
.eq(GroupPlate::getMaterial_code, invParam.getMaterialCode()) .eq(GroupPlate::getMaterial_code, invParam.getMaterialCode())
.eq(GroupPlate::getStatus, GROUP_PLATE_STATUS.code("入库")); .eq(GroupPlate::getStatus, GROUP_PLATE_STATUS.code("入库"));
GroupPlate groupPlate = iMdPbGroupplateService.getOne(query); GroupPlate groupPlate = iMdPbGroupplateService.getOne(query);
//添加库存变动记录 if (ObjectUtils.isNotEmpty(groupPlate)) {
StIvtStructivtflow record = new StIvtStructivtflow(); //添加库存变动记录
record.setId(IdUtil.getStringId()); StIvtStructivtflow record = new StIvtStructivtflow();
record.setUpdate_time(DateUtil.now()); record.setId(IdUtil.getStringId());
record.setVehicle_code(invParam.getStoragevehicleCode()); record.setUpdate_time(DateUtil.now());
record.setMaterial_id(invParam.getMaterialCode()); record.setVehicle_code(invParam.getStoragevehicleCode());
record.setPcsn(invParam.getPcsn()); record.setMaterial_id(invParam.getMaterialCode());
record.setQty(groupPlate.getQty()); record.setPcsn(invParam.getPcsn());
record.setChange_qty(invParam.getQty()); record.setQty(groupPlate.getQty());
record.setSource_form_id(invParam.getExtCode()); record.setChange_qty(invParam.getQty());
record.setUnit_id(invParam.getUnitId()); record.setSource_form_id(invParam.getExtCode());
record.setStruct_code(invParam.getStructCode()); record.setUnit_id(invParam.getUnitId());
record.setStor_code(invParam.getStorCode()); record.setStruct_code(invParam.getStructCode());
record.setSect_code(invParam.getSectCode()); record.setStor_code(invParam.getStorCode());
record.setGrowth(true); record.setSect_code(invParam.getSectCode());
record.setTask_type(invParam.getRemark()); record.setGrowth(true);
recordsInFinish.add(record); record.setTask_type(invParam.getRemark());
recordsInFinish.add(record);
}
} }
stIvtStructivtflowService.saveBatch(recordsInFinish); stIvtStructivtflowService.saveBatch(recordsInFinish);
break; break;

View File

@@ -48,6 +48,8 @@ import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
/** /**
* 需求单库存调拨完成回传 SAP MM057 物料转储 * 需求单库存调拨完成回传 SAP MM057 物料转储
*/ */
@@ -56,6 +58,7 @@ import java.util.List;
public class SapDealLLDBBillPmDeamndCallBack implements CallbackStrategy { public class SapDealLLDBBillPmDeamndCallBack implements CallbackStrategy {
private static final DateTimeFormatter DATE_BASIC = DateTimeFormatter.BASIC_ISO_DATE; private static final DateTimeFormatter DATE_BASIC = DateTimeFormatter.BASIC_ISO_DATE;
private static final String DEFAULT_UNIT_NAME = "PCS";
@Autowired @Autowired
private IPmDemandService iPmDemandService; private IPmDemandService iPmDemandService;
@@ -243,9 +246,7 @@ public class SapDealLLDBBillPmDeamndCallBack implements CallbackStrategy {
item.setLgort(StrUtil.blankToDefault( item.setLgort(StrUtil.blankToDefault(
resolveInventoryLgort(demand.getInventory_dis()), resolveInventoryLgort(demand.getInventory_dis()),
dis != null ? dis.getSect_code() : "")); dis != null ? dis.getSect_code() : ""));
item.setMeins(StrUtil.blankToDefault( item.setMeins(StringUtils.isNotBlank(demand.getUnit())?demand.getUnit():DEFAULT_UNIT_NAME);
dis != null ? dis.getQty_unit_name() : null,
StrUtil.blankToDefault(param.getQty_unit_name(), demand.getUnit())));
item.setMenge(resolveQty(param, dis).doubleValue()); item.setMenge(resolveQty(param, dis).doubleValue());
item.setUmwrk(SapConstant.WERKS); item.setUmwrk(SapConstant.WERKS);
item.setSobkz(""); item.setSobkz("");