完成零部件出库单的接口,zwm3a19的接口存在问题需要重新处理,少了一个删除装箱单的接口
This commit is contained in:
parent
bc341d2fba
commit
90abcd3054
|
|
@ -10,10 +10,7 @@ import com.nflg.wms.admin.service.ComponentOutboundControllerService;
|
|||
import com.nflg.wms.admin.service.SapService;
|
||||
import com.nflg.wms.common.pojo.ApiResult;
|
||||
import com.nflg.wms.common.pojo.PageData;
|
||||
import com.nflg.wms.common.pojo.dto.InventoryDTO;
|
||||
import com.nflg.wms.common.pojo.dto.ZWM3A20DTO;
|
||||
import com.nflg.wms.common.pojo.dto.ZWM3A20ITEMDTO;
|
||||
import com.nflg.wms.common.pojo.dto.ZWM3A20ITSERNRDTO;
|
||||
import com.nflg.wms.common.pojo.dto.*;
|
||||
import com.nflg.wms.common.pojo.qo.*;
|
||||
import com.nflg.wms.common.pojo.vo.*;
|
||||
import com.nflg.wms.common.util.PageUtil;
|
||||
|
|
@ -68,8 +65,9 @@ public class ComponentOutboundController {
|
|||
|
||||
/**
|
||||
* 零部件的出库单列表
|
||||
*
|
||||
* @param request 零部件出库单搜索条件参数对象,包含分页信息和搜索条件
|
||||
* @return 返回分页的零部件出库单数据,包含分页信息
|
||||
* @return 返回分页的零部件出库单数据,包含分页信息
|
||||
*/
|
||||
@PostMapping("search")
|
||||
public ApiResult<PageData<ComponentOutboundVO>> search(@Valid @RequestBody ComponentOutboundQO request) {
|
||||
|
|
@ -80,7 +78,7 @@ public class ComponentOutboundController {
|
|||
/**
|
||||
* 出库单详情列表
|
||||
*
|
||||
* @param outboundId 出库单ID,不能为空
|
||||
* @param outboundId 出库单ID,不能为空
|
||||
* @return 出库单详情列表
|
||||
*/
|
||||
@GetMapping("getItems")
|
||||
|
|
@ -100,7 +98,8 @@ public class ComponentOutboundController {
|
|||
|
||||
/**
|
||||
* 出库单详情列表
|
||||
* @param itemId 出库单详情ID,不能为空
|
||||
*
|
||||
* @param itemId 出库单详情ID,不能为空
|
||||
* @return 扫码信息
|
||||
*/
|
||||
@GetMapping("getItems")
|
||||
|
|
@ -112,6 +111,7 @@ public class ComponentOutboundController {
|
|||
|
||||
/**
|
||||
* 确认出库单
|
||||
*
|
||||
* @param request 确认出库单的参数对象
|
||||
*/
|
||||
@PostMapping("pda/confirm")
|
||||
|
|
@ -136,7 +136,7 @@ public class ComponentOutboundController {
|
|||
List<WmsComponentOutboundItem> outboundItems = new ArrayList<>();
|
||||
List<WmsComponentOutboundScanCodes> outboundScanCodes = new ArrayList<>();
|
||||
List<InventoryDTO> inventories = new ArrayList<>();
|
||||
|
||||
List<String> codeIds = new ArrayList<>();
|
||||
ZWM3A20DTO zwm3a20DTO = new ZWM3A20DTO()
|
||||
.setItSernrPatch(new ArrayList<>())
|
||||
.setItem(new ArrayList<>())
|
||||
|
|
@ -174,26 +174,20 @@ public class ComponentOutboundController {
|
|||
}
|
||||
}
|
||||
} else { // 多个批次号的 情况下处理方式
|
||||
Map<String, BigDecimal> batchNumberMap = item.getScanCodes().stream()
|
||||
.collect(Collectors.groupingBy(
|
||||
code -> StrUtil.isBlank(code.getBatchNumber()) ? "" : code.getBatchNumber(),
|
||||
Collectors.reducing(
|
||||
BigDecimal.ZERO,
|
||||
ScanCodeQO::getCodeNum,
|
||||
BigDecimal::add
|
||||
)
|
||||
));
|
||||
AtomicInteger index = new AtomicInteger(0);
|
||||
batchNumberMap.forEach((batchNumber, scanCodeList) -> {
|
||||
//进行处理
|
||||
afdasdfasdfasdfasdfasfasdfd
|
||||
|
||||
index.set(1);
|
||||
});
|
||||
//首先要组装物料详情信息,此时物料详情的批次号和数量是无效的,可以忽略不计
|
||||
set3A20Item(batchNumbers.get(0), outboundItem, outboundItem.getOutQty(), zwm3a20DTO);
|
||||
//接着处理序号和批次的关系列表
|
||||
for (ScanCodeQO code : item.getScanCodes()) {
|
||||
// 批次和序号的组装
|
||||
setItLipsItem(code, zwm3a20DTO, outboundItem);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (ScanCodeQO code : item.getScanCodes()) {
|
||||
|
||||
VUtil.trueThrowBusinessError(codeIds.contains(code.getCodeId())).throwMessage("物料[" + outboundItem.getIdnrk() + "]的条码[" + code.getCodeId() + "]被重复使用");
|
||||
codeIds.add(code.getCodeId());
|
||||
// 组装条码信息
|
||||
WmsComponentOutboundScanCodes scanCodes = new WmsComponentOutboundScanCodes();
|
||||
scanCodes.setOutboundItemId(outboundItem.getId())
|
||||
|
|
@ -215,8 +209,10 @@ public class ComponentOutboundController {
|
|||
}
|
||||
}
|
||||
// 判断下当前的条码是否有已经使用过得
|
||||
|
||||
componentOutboundControllerService.confirmPda(outbound, outboundItems, outboundScanCodes, zwm3a20DTO);
|
||||
List<WmsComponentOutboundScanCodes> existScanCodes = wmsComponentOutboundScanCodesService.findByCodeIdIn(codeIds);
|
||||
VUtil.trueThrowBusinessError(CollectionUtil.isNotEmpty(existScanCodes)).throwMessage("存在已经使用过的条码");
|
||||
componentOutboundControllerService.confirmPda(outbound, outboundItems, outboundScanCodes, zwm3a20DTO, inventories);
|
||||
return ApiResult.success();
|
||||
}
|
||||
|
||||
private WmsComponentOutbound setWmsComponentOutbound(WmsComponentPacking packing) {
|
||||
|
|
@ -349,4 +345,33 @@ public class ComponentOutboundController {
|
|||
itemDTO.setMenge(itemDTO.getMenge().add(outQty));
|
||||
}
|
||||
}
|
||||
|
||||
private void setItLipsItem(ScanCodeQO code, ZWM3A20DTO zwm3a20DTO, WmsComponentOutboundItem outboundItem) {
|
||||
ZWM3A20ITLIPSITEMDTO itLipsItemDTO = zwm3a20DTO.getItLipsItem().stream()
|
||||
.filter(it -> it.getCharg().equals(code.getBatchNumber())
|
||||
&& it.getLgort().equals(outboundItem.getLgort())
|
||||
&& it.getPosnr().equals(outboundItem.getPosnr())
|
||||
&& it.getMatnr().equals(outboundItem.getIdnrk())
|
||||
).findFirst().orElse(null);
|
||||
if (Objects.isNull(itLipsItemDTO)) {
|
||||
itLipsItemDTO = new ZWM3A20ITLIPSITEMDTO()
|
||||
.setCharg(code.getBatchNumber())
|
||||
.setLgort(outboundItem.getLgort())
|
||||
.setPosnr(outboundItem.getPosnr())
|
||||
.setMatnr(outboundItem.getIdnrk())
|
||||
.setLfimg(code.getCodeNum());
|
||||
zwm3a20DTO.getItLipsItem().add(itLipsItemDTO);
|
||||
} else {
|
||||
itLipsItemDTO.setLfimg(itLipsItemDTO.getLfimg().add(code.getCodeNum()));
|
||||
}
|
||||
//处理序列号的问题
|
||||
if (StrUtil.isNotBlank(code.getSerialNumber())) {
|
||||
zwm3a20DTO.getItSernrPatch().add(new ZWM3A20ITSERNRPATCHDTO()
|
||||
.setCharg(code.getBatchNumber())
|
||||
.setPosnr(outboundItem.getPosnr())
|
||||
.setSernr(code.getSerialNumber())
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,11 +15,6 @@ public class WmsComponentOutboundScanCodes {
|
|||
@Id
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 出库单的单号
|
||||
*/
|
||||
private String outboundNo;
|
||||
|
||||
/***
|
||||
* 出库单的单行ID号
|
||||
*
|
||||
|
|
|
|||
|
|
@ -12,4 +12,6 @@ import java.util.List;
|
|||
@Repository
|
||||
public interface WmsComponentOutboundScanCodesRepository extends MongoRepository<WmsComponentOutboundScanCodes, String> {
|
||||
List<WmsComponentOutboundScanCodes> findByOutboundItemId(Long outboundItemId);
|
||||
List<WmsComponentOutboundScanCodes> findByCodeIdIn(List<String> attr0);
|
||||
|
||||
}
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
package com.nflg.wms.admin.service;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.lang.Pair;
|
||||
import com.nflg.wms.admin.pojo.document.WmsComponentOutboundScanCodes;
|
||||
import com.nflg.wms.admin.repository.WmsComponentOutboundScanCodesRepository;
|
||||
import com.nflg.wms.common.pojo.PageData;
|
||||
import com.nflg.wms.common.pojo.dto.InventoryDTO;
|
||||
import com.nflg.wms.common.pojo.dto.ZWM3A20DTO;
|
||||
import com.nflg.wms.common.pojo.qo.ComponentOutboundInputQO;
|
||||
import com.nflg.wms.common.pojo.qo.ComponentOutboundItemInputQO;
|
||||
import com.nflg.wms.common.pojo.qo.ComponentOutboundQO;
|
||||
import com.nflg.wms.common.pojo.vo.ComponentOutboundVO;
|
||||
import com.nflg.wms.common.util.VUtil;
|
||||
import com.nflg.wms.repository.entity.WmsComponentOutbound;
|
||||
import com.nflg.wms.repository.entity.WmsComponentOutboundItem;
|
||||
import com.nflg.wms.repository.entity.WmsComponentPacking;
|
||||
import com.nflg.wms.repository.entity.WmsComponentPackingItem;
|
||||
import com.nflg.wms.repository.entity.*;
|
||||
import com.nflg.wms.repository.service.*;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.Valid;
|
||||
|
|
@ -43,8 +43,54 @@ public class ComponentOutboundControllerService {
|
|||
@Resource
|
||||
private IWmsInventoryService inventoryService;
|
||||
|
||||
@Transactional
|
||||
public void confirmPda(WmsComponentOutbound outbound, List<WmsComponentOutboundItem> outboundItems, List<WmsComponentOutboundScanCodes> outboundScanCodes, ZWM3A20DTO zwm3a20DTO) {
|
||||
@Resource
|
||||
private BasdeSerialNumberControllerService basdeSerialNumberService;
|
||||
|
||||
@Resource
|
||||
private WmsComponentOutboundScanCodesRepository wmsComponentOutboundScanCodesService;
|
||||
|
||||
@Transactional
|
||||
public void confirmPda(WmsComponentOutbound outbound, List<WmsComponentOutboundItem> outboundItems, List<WmsComponentOutboundScanCodes> outboundScanCodes, ZWM3A20DTO zwm3a20DTO, List<InventoryDTO> inventories) {
|
||||
|
||||
outbound.setOutboundNo(basdeSerialNumberService.generateSerialNumber(5));
|
||||
wmsComponentOutboundService.save(outbound);
|
||||
if (CollectionUtil.isNotEmpty(outboundItems)) {
|
||||
wmsComponentOutboundItemService.saveBatch(outboundItems);
|
||||
}
|
||||
|
||||
if (CollectionUtil.isNotEmpty(outboundScanCodes)) {
|
||||
wmsComponentOutboundScanCodesService.insert(outboundScanCodes);
|
||||
}
|
||||
|
||||
if (CollectionUtil.isNotEmpty(inventories)) {
|
||||
inventoryService.out(inventories);
|
||||
}
|
||||
//处理装箱单的货物详情的出库数量
|
||||
for (WmsComponentOutboundItem item : outboundItems) {
|
||||
wmsComponentPackingItemService.addOutQty(item.getPackingItemId(), item.getOutQty());
|
||||
}
|
||||
|
||||
Integer isCompleted = 1;
|
||||
List<WmsComponentPackingItem> packingItems = wmsComponentPackingItemService.lambdaQuery()
|
||||
.eq(WmsComponentPackingItem::getPackingId, outbound.getPackingId())
|
||||
.apply("menge>out_qty")
|
||||
.select(WmsComponentPackingItem::getId)
|
||||
.list();
|
||||
if (CollectionUtil.isNotEmpty(packingItems)) {
|
||||
isCompleted = 2;
|
||||
}
|
||||
|
||||
wmscomponentPackingService.lambdaUpdate()
|
||||
.set(WmsComponentPacking::getIsCompleted, isCompleted)
|
||||
.eq(WmsComponentPacking::getId, outbound.getPackingId())
|
||||
.update();
|
||||
|
||||
// 处理SAP的信息,并写入物料凭证和物料年度凭证信息到出口单中
|
||||
Pair<String, String> result = sapService.zwm3a20(zwm3a20DTO);
|
||||
wmsComponentOutboundService.lambdaUpdate()
|
||||
.set(WmsComponentOutbound::getMaterialDoc, result.getKey())
|
||||
.set(WmsComponentOutbound::getMaterialDocYear, result.getValue())
|
||||
.eq(WmsComponentOutbound::getId, outbound.getId())
|
||||
.update();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1169,7 +1169,7 @@ public class SapService {
|
|||
.throwMessage("SAP错误:" + structure.getString("E_MSG"));
|
||||
|
||||
JCoTable ot1 = function.getTableParameterList().getTable("HEAD");
|
||||
result.setHeadDTOList(JCoUtil.toBeanList(ot1, ZWM3A19HEADDTO.class));
|
||||
result.setHeadDTO(JCoUtil.toBean(ot1, ZWM3A19HEADDTO.class));
|
||||
|
||||
JCoTable ot2 = function.getTableParameterList().getTable("ITEM");
|
||||
result.setItemDTOList(JCoUtil.toBeanList(ot2, ZWM3A19ITEMDTO.class));
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import java.math.BigDecimal;
|
|||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ZWM3A20ITEMDTO {
|
||||
private String posnr;
|
||||
private Integer posnr;
|
||||
private Integer index;
|
||||
private String ztext;
|
||||
private BigDecimal pmenge;
|
||||
|
|
|
|||
|
|
@ -3,12 +3,14 @@ package com.nflg.wms.common.pojo.dto;
|
|||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ZWM3A20ITLIPSITEMDTO {
|
||||
private String charg;
|
||||
private String lgort;
|
||||
private String posnr;
|
||||
private String lfimg;
|
||||
private Integer posnr;
|
||||
private BigDecimal lfimg;
|
||||
private String matnr;
|
||||
}
|
||||
|
|
@ -7,5 +7,5 @@ import lombok.experimental.Accessors;
|
|||
@Accessors(chain = true)
|
||||
public class ZWM3A20ITSERNRDTO{
|
||||
private String sernr;
|
||||
private String posnr;
|
||||
private Integer posnr;
|
||||
}
|
||||
|
|
@ -8,5 +8,5 @@ import lombok.experimental.Accessors;
|
|||
public class ZWM3A20ITSERNRPATCHDTO{
|
||||
private String sernr;
|
||||
private String charg;
|
||||
private String posnr;
|
||||
private Integer posnr;
|
||||
}
|
||||
|
|
@ -141,7 +141,6 @@ public class WmsComponentOutbound implements Serializable {
|
|||
*/
|
||||
private String wbstk;
|
||||
|
||||
|
||||
private Long createId;
|
||||
|
||||
private String createName;
|
||||
|
|
@ -168,4 +167,14 @@ public class WmsComponentOutbound implements Serializable {
|
|||
* 所属工厂
|
||||
*/
|
||||
private String factoryNo;
|
||||
|
||||
/**
|
||||
* 物品凭证
|
||||
*/
|
||||
private String materialDoc;
|
||||
|
||||
/**
|
||||
* 物料年度凭证
|
||||
*/
|
||||
private String materialDocYear;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import java.math.BigDecimal;
|
|||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author 代码生成器生成
|
||||
|
|
@ -49,7 +49,7 @@ public class WmsComponentOutboundItem implements Serializable {
|
|||
/**
|
||||
* 交货单项目
|
||||
*/
|
||||
private String posnr;
|
||||
private Integer posnr;
|
||||
|
||||
/**
|
||||
* 物料号
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ package com.nflg.wms.repository.mapper;
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.nflg.wms.repository.entity.WmsComponentPackingItem;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
|
|
@ -13,4 +15,5 @@ import com.nflg.wms.repository.entity.WmsComponentPackingItem;
|
|||
*/
|
||||
public interface WmsComponentPackingItemMapper extends BaseMapper<WmsComponentPackingItem> {
|
||||
|
||||
void addOutQty(Long packingItemId, BigDecimal outQty);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ package com.nflg.wms.repository.service;
|
|||
import com.nflg.wms.repository.entity.WmsComponentPackingItem;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
|
|
@ -13,4 +15,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||
*/
|
||||
public interface IWmsComponentPackingItemService extends IService<WmsComponentPackingItem> {
|
||||
|
||||
void addOutQty(Long packingItemId, BigDecimal outQty);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ import com.nflg.wms.repository.service.IWmsComponentPackingItemService;
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
|
|
@ -17,4 +19,8 @@ import org.springframework.stereotype.Service;
|
|||
@Service
|
||||
public class WmsComponentPackingItemServiceImpl extends ServiceImpl<WmsComponentPackingItemMapper, WmsComponentPackingItem> implements IWmsComponentPackingItemService {
|
||||
|
||||
@Override
|
||||
public void addOutQty(Long packingItemId, BigDecimal outQty) {
|
||||
baseMapper.addOutQty(packingItemId, outQty);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,4 +2,7 @@
|
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.nflg.wms.repository.mapper.WmsComponentPackingItemMapper">
|
||||
|
||||
<update id="addOutQty">
|
||||
update wms_component_packing_item set out_qty=out_qty+#{outQty} where id=#{packingItemId}
|
||||
</update>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public class CodeGeneratorTest {
|
|||
)
|
||||
.strategyConfig(builder -> {
|
||||
builder
|
||||
.addInclude("wms_component_packing") //只生成指定表
|
||||
.addInclude("wms_component_outbound") //只生成指定表
|
||||
.entityBuilder().idType(IdType.ASSIGN_ID)
|
||||
.enableLombok()
|
||||
.enableChainModel()
|
||||
|
|
|
|||
Loading…
Reference in New Issue