Compare commits
3 Commits
7309136378
...
376f3c5323
| Author | SHA1 | Date |
|---|---|---|
|
|
376f3c5323 | |
|
|
268fbc3220 | |
|
|
172ddbc444 |
|
|
@ -12,7 +12,6 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
|
@ -92,13 +91,11 @@ public class SAPConfig {
|
|||
}
|
||||
|
||||
@Bean(destroyMethod = "")
|
||||
@Lazy
|
||||
public JCoDestination jcoDestination() throws JCoException {
|
||||
return JCoDestinationManager.getDestination(ABAP_AS_POOLED);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@Lazy
|
||||
public JCoRepository getJCoRepository() throws JCoException {
|
||||
return jcoDestination().getRepository();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -172,12 +172,12 @@ public class ComponentOutboundController extends BaseController {
|
|||
.eq(WmsComponentPackingItem::getPackingId, packing.getId())
|
||||
.list();
|
||||
VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(packingItems)).throwMessage("无法找到有效的装箱单详情");
|
||||
//判断是否存在了相同的交货单了
|
||||
WmsComponentOutbound outboundSelect = wmsComponentOutboundService.lambdaQuery()
|
||||
.eq(WmsComponentOutbound::getVbelv, packing.getVbelv())
|
||||
.eq(WmsComponentOutbound::getIsReverse, false)
|
||||
.one();
|
||||
VUtil.trueThrowBusinessError(Objects.nonNull(outboundSelect), () -> "交货单已出库,单号为【" + outboundSelect.getOutboundNo() + "】");
|
||||
// //判断是否存在了相同的交货单了
|
||||
// WmsComponentOutbound outboundSelect = wmsComponentOutboundService.lambdaQuery()
|
||||
// .eq(WmsComponentOutbound::getVbelv, packing.getVbelv())
|
||||
// .eq(WmsComponentOutbound::getIsReverse, false)
|
||||
// .one();
|
||||
// VUtil.trueThrowBusinessError(Objects.nonNull(outboundSelect), () -> "交货单已出库,单号为【" + outboundSelect.getOutboundNo() + "】");
|
||||
//判断数量是否一致,且已经存在了相同的收货单了
|
||||
// for (WmsComponentPackingItem item : packingItems) {
|
||||
// List<ComponentOutboundItemInputQO> items = request.getItems()
|
||||
|
|
@ -240,7 +240,7 @@ public class ComponentOutboundController extends BaseController {
|
|||
);
|
||||
});
|
||||
VUtil.trueThrowBusinessError(outboundItem.getOutQty()
|
||||
.compareTo(records.stream().map(OutMaterialScanRecord::getNum).reduce(BigDecimal.ZERO, BigDecimal::add)) < 0)
|
||||
.compareTo(records.stream().map(OutMaterialScanRecord::getNum).reduce(BigDecimal.ZERO, BigDecimal::add)) != 0)
|
||||
.throwMessage("物料" + outboundItem.getIdnrk() + "的领取数量不等于装箱数量");
|
||||
} else {
|
||||
VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(item.getScanCodes()))
|
||||
|
|
@ -261,7 +261,8 @@ public class ComponentOutboundController extends BaseController {
|
|||
|
||||
//判断扫码数量是否等于了出货数量
|
||||
BigDecimal qty = scanCodesGroup.stream().map(ScanCodeQO::getCodeNum).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
VUtil.trueThrowBusinessError(outboundItem.getOutQty().equals(qty)).throwMessage("物料[" + outboundItem.getIdnrk() + "]的出库数量[" + qty + "]不等于装箱数量[" + outboundItem.getOutQty() + "]");
|
||||
VUtil.trueThrowBusinessError(outboundItem.getOutQty().compareTo(qty) != 0)
|
||||
.throwMessage("物料[" + outboundItem.getIdnrk() + "]的出库数量[" + qty + "]不等于装箱数量[" + outboundItem.getOutQty() + "]");
|
||||
|
||||
buildZwm3a20DTO(zwm3a20DTO, scanCodesGroup, outboundItem);
|
||||
|
||||
|
|
|
|||
|
|
@ -417,13 +417,15 @@ public class InProduceOrderController extends BaseController {
|
|||
.map(InMaterialScanRecord::getSerialNo)
|
||||
.toList();
|
||||
}
|
||||
inventoryService.in(input1.stream().map(it -> new InventoryDTO()
|
||||
.setMaterialNo(request.getItems().get(0).getMaterialNo())
|
||||
.setNum(it.getPSMNG())
|
||||
.setFactoryNo(it.getPWERK())
|
||||
.setWarehouseNo(it.getLGORT())
|
||||
.setBatchNo(it.getCHARG())
|
||||
.setSerialNo("") //TODO 如何设置序列号
|
||||
inventoryService.in(list.stream()
|
||||
.filter(it -> Objects.equals(it.getParentId(), 0L))
|
||||
.map(it -> new InventoryDTO()
|
||||
.setMaterialNo(it.getMaterialNo())
|
||||
.setNum(it.getNum())
|
||||
.setFactoryNo(it.getFactoryNo())
|
||||
.setWarehouseNo(it.getWarehouseNo())
|
||||
.setBatchNo(it.getBatchNo())
|
||||
.setSerialNo(it.getSernr())
|
||||
).toList()
|
||||
);
|
||||
inMaterialScanRecordRespository.saveAll(records);
|
||||
|
|
|
|||
|
|
@ -301,11 +301,11 @@ public class OutAssistanceController extends BaseController {
|
|||
});
|
||||
outAssistanceItemService.updateBatchById(datas);
|
||||
outAssistanceTicketItemService.saveBatch(ticketItems);
|
||||
outAssistanceTicketService.save(ticket);
|
||||
if (!request.getNeedAudit()) {
|
||||
//不需要审核
|
||||
submitSap(order, ticket, records, datas);
|
||||
} else {
|
||||
outAssistanceTicketService.save(ticket);
|
||||
inventoryForOutRepository.saveAll(request.getRecommendBatch()
|
||||
.stream()
|
||||
.map(item -> {
|
||||
|
|
@ -360,9 +360,11 @@ public class OutAssistanceController extends BaseController {
|
|||
}).toList()
|
||||
)
|
||||
);
|
||||
ticket.setMatDoc(dto.getMatDoc());
|
||||
ticket.setDocYear(dto.getDocYear());
|
||||
outAssistanceTicketService.save(ticket);
|
||||
outAssistanceTicketService.lambdaUpdate()
|
||||
.set(WmsOutAssistanceTicket::getMatDoc, dto.getMatDoc())
|
||||
.set(WmsOutAssistanceTicket::getDocYear, dto.getDocYear())
|
||||
.eq(WmsOutAssistanceTicket::getId, ticket.getId())
|
||||
.update();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -289,11 +289,11 @@ public class OutCostCenterController extends BaseController {
|
|||
});
|
||||
outCostcenterItemService.updateBatchById(datas);
|
||||
outCostcenterTicketItemService.saveBatch(ticketItems);
|
||||
outCostcenterTicketService.save(ticket);
|
||||
if (!request.getNeedAudit()) {
|
||||
//不需要审核
|
||||
submitSap(order, ticket, records, datas);
|
||||
} else {
|
||||
outCostcenterTicketService.save(ticket);
|
||||
inventoryForOutRepository.saveAll(request.getRecommendBatch()
|
||||
.stream()
|
||||
.map(item -> {
|
||||
|
|
@ -347,9 +347,11 @@ public class OutCostCenterController extends BaseController {
|
|||
}).toList()
|
||||
)
|
||||
);
|
||||
ticket.setMatDoc(vo.getEMblnr());
|
||||
ticket.setDocYear(vo.getEMJahr());
|
||||
outCostcenterTicketService.save(ticket);
|
||||
outCostcenterTicketService.lambdaUpdate()
|
||||
.set(WmsOutCostcenterTicket::getMatDoc, vo.getEMblnr())
|
||||
.set(WmsOutCostcenterTicket::getDocYear, vo.getEMJahr())
|
||||
.eq(WmsOutCostcenterTicket::getId, ticket.getId())
|
||||
.update();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -346,7 +346,6 @@ public class OutProduceController extends BaseController {
|
|||
ticketItems.add(ti);
|
||||
return ti;
|
||||
});
|
||||
BigDecimal num = Objects.equals(order.getType(), 0) ? item.getLockNum() : item.getSqsl().subtract(item.getNum());
|
||||
if (qitem.isQiTao()) {
|
||||
VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(qitem.getBatchs()))
|
||||
.throwMessage("齐套物料需要提供批次信息");
|
||||
|
|
@ -377,8 +376,7 @@ public class OutProduceController extends BaseController {
|
|||
item.setNum(item.getNum().add(it.getNum()));
|
||||
pti.setNum(pti.getNum().add(it.getNum()));
|
||||
});
|
||||
VUtil.trueThrowBusinessError(num.subtract(records.stream().map(OutMaterialScanRecord::getNum).reduce(BigDecimal.ZERO, BigDecimal::add))
|
||||
.compareTo(BigDecimal.ZERO) < 0)
|
||||
VUtil.trueThrowBusinessError(item.getNum().compareTo(item.getSqsl()) > 0)
|
||||
.throwMessage("物料" + item.getMatnr() + "的领取数量超出申请限制");
|
||||
} else {
|
||||
VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(qitem.getQrCodes()))
|
||||
|
|
@ -392,7 +390,7 @@ public class OutProduceController extends BaseController {
|
|||
}
|
||||
item.setNum(item.getNum().add(qrCodeContent.getNum()));
|
||||
pti.setNum(pti.getNum().add(qrCodeContent.getNum()));
|
||||
VUtil.trueThrowBusinessError(num.compareTo(pti.getNum()) < 0)
|
||||
VUtil.trueThrowBusinessError(item.getNum().compareTo(item.getSqsl()) > 0)
|
||||
.throwMessage("物料" + materialNo + "的领取数量超出申请限制");
|
||||
records.add(new OutMaterialScanRecord()
|
||||
.setSource(1)
|
||||
|
|
@ -418,11 +416,11 @@ public class OutProduceController extends BaseController {
|
|||
});
|
||||
outProduceItemService.updateBatchById(datas);
|
||||
outProduceTicketItemService.saveBatch(ticketItems);
|
||||
outProduceTicketService.save(ticket);
|
||||
if (!request.getNeedAudit()) {
|
||||
//不需要审核
|
||||
submitSap(order, ticket, records, datas);
|
||||
} else {
|
||||
outProduceTicketService.save(ticket);
|
||||
inventoryForOutRepository.saveAll(request.getRecommendBatch()
|
||||
.stream()
|
||||
.map(ifo -> {
|
||||
|
|
@ -472,17 +470,18 @@ public class OutProduceController extends BaseController {
|
|||
}).toList()
|
||||
)
|
||||
);
|
||||
ticket.setMatDoc(vo.getMat_doc());
|
||||
ticket.setDocYear(vo.getDocYear());
|
||||
outProduceTicketService.save(ticket);
|
||||
outProduceTicketService.lambdaUpdate()
|
||||
.set(WmsOutProduceTicket::getMatDoc, vo.getMat_doc())
|
||||
.set(WmsOutProduceTicket::getDocYear, vo.getDocYear())
|
||||
.eq(WmsOutProduceTicket::getId, ticket.getId())
|
||||
.update();
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索出库单
|
||||
*/
|
||||
@PostMapping("searchTicket")
|
||||
public ApiResult<PageData<OutProduceTicketVO>> searchTicket(@Valid @RequestBody OutProduceTicketSearchQO
|
||||
request) {
|
||||
public ApiResult<PageData<OutProduceTicketVO>> searchTicket(@Valid @RequestBody OutProduceTicketSearchQO request) {
|
||||
return ApiResult.success(outProduceTicketService.search(request));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -102,13 +102,16 @@ public class ScanRecordController extends BaseController {
|
|||
dto.getItems().forEach(item -> {
|
||||
OutDifferenceItemVO itemVO = new OutDifferenceItemVO()
|
||||
.setRecommendbatchNo(item.getBatchNo())
|
||||
.setRecommendSerialNo(item.getSerialNo())
|
||||
.setRecommendNum(item.getNum());
|
||||
List<OutMaterialScanRecord> mrecords = records.stream()
|
||||
.filter(r -> StrUtil.equals(r.getMaterialNo(), dto.getMaterialNo())
|
||||
&& StrUtil.equals(r.getBatchNo(), item.getBatchNo()))
|
||||
&& StrUtil.equals(r.getBatchNo(), item.getBatchNo())
|
||||
&& StrUtil.equals(r.getSerialNo(), item.getSerialNo()))
|
||||
.toList();
|
||||
if (CollectionUtil.isNotEmpty(mrecords)) {
|
||||
itemVO.setScanBatchNo(item.getBatchNo());
|
||||
itemVO.setScanSerialNo(item.getSerialNo());
|
||||
itemVO.setScanNum(mrecords.stream().map(OutMaterialScanRecord::getNum).reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||
records.removeAll(mrecords);
|
||||
}
|
||||
|
|
@ -120,18 +123,18 @@ public class ScanRecordController extends BaseController {
|
|||
records.stream()
|
||||
.collect(Collectors.groupingBy(OutMaterialScanRecord::getMaterialNo))
|
||||
.forEach((k, v) -> {
|
||||
OutDifferenceVO vo = new OutDifferenceVO()
|
||||
.setMaterialNo(k);
|
||||
OutDifferenceVO vo = vos.stream().filter(it -> StrUtil.equals(it.getMaterialNo(), k)).findFirst().get();
|
||||
v.stream()
|
||||
.collect(Collectors.groupingBy(OutMaterialScanRecord::getBatchNo))
|
||||
.forEach((batchNo, vv) -> {
|
||||
.collect(Collectors.groupingBy(OutMaterialScanRecord::getKey8))
|
||||
.forEach((key, vv) -> {
|
||||
vo.getItems().add(new OutDifferenceItemVO()
|
||||
.setRecommendbatchNo("")
|
||||
.setRecommendSerialNo("")
|
||||
.setRecommendNum(BigDecimal.ZERO)
|
||||
.setScanBatchNo(batchNo)
|
||||
.setScanBatchNo(StrUtil.split(key, "|").get(1))
|
||||
.setScanSerialNo(StrUtil.split(key, "|").get(2))
|
||||
.setScanNum(vv.stream().map(OutMaterialScanRecord::getNum).reduce(BigDecimal.ZERO, BigDecimal::add)));
|
||||
});
|
||||
vos.add(vo);
|
||||
});
|
||||
}
|
||||
return ApiResult.success(vos);
|
||||
|
|
|
|||
|
|
@ -339,11 +339,11 @@ public class TransferCompanyController extends BaseController {
|
|||
.eq(WmsTransferCompany::getId, order.getId())
|
||||
.update();
|
||||
transferCompanyTicketItemService.saveBatch(ticketItems);
|
||||
transferCompanyTicketService.save(ticket);
|
||||
if (!request.getNeedAudit()) {
|
||||
//不需要审核
|
||||
submitSap(order, ticket, records, datas, ticketItems);
|
||||
} else {
|
||||
transferCompanyTicketService.save(ticket);
|
||||
inventoryForOutRepository.saveAll(request.getRecommendBatch()
|
||||
.stream()
|
||||
.map(item -> {
|
||||
|
|
@ -399,9 +399,11 @@ public class TransferCompanyController extends BaseController {
|
|||
).toList()
|
||||
)
|
||||
);
|
||||
ticket.setDocYear(vo.getMjahr());
|
||||
ticket.setMatDoc(vo.getMblnr());
|
||||
transferCompanyTicketService.save(ticket);
|
||||
transferCompanyTicketService.lambdaUpdate()
|
||||
.set(WmsTransferCompanyTicket::getMatDoc, vo.getMblnr())
|
||||
.set(WmsTransferCompanyTicket::getDocYear, vo.getMjahr())
|
||||
.eq(WmsTransferCompanyTicket::getId, ticket.getId())
|
||||
.update();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ import com.nflg.wms.common.util.VUtil;
|
|||
import com.sap.conn.jco.*;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
|
@ -33,11 +32,9 @@ import java.util.stream.Collectors;
|
|||
public class SapService {
|
||||
|
||||
@Resource
|
||||
@Lazy
|
||||
private JCoDestination destination;
|
||||
|
||||
@Resource
|
||||
@Lazy
|
||||
private JCoRepository repository;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -164,4 +164,11 @@ public class OutMaterialScanRecord {
|
|||
public String getKey7() {
|
||||
return materialNo + "|" + batchNo;
|
||||
}
|
||||
|
||||
@Transient
|
||||
private String key8;
|
||||
|
||||
public String getKey8() {
|
||||
return materialNo + "|" + batchNo + "|" + this.serialNo;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,11 @@ public class OutDifferenceItemVO {
|
|||
*/
|
||||
private String recommendbatchNo;
|
||||
|
||||
/**
|
||||
* 推荐序列号
|
||||
*/
|
||||
private String recommendSerialNo;
|
||||
|
||||
/**
|
||||
* 推荐数量
|
||||
*/
|
||||
|
|
@ -24,6 +29,11 @@ public class OutDifferenceItemVO {
|
|||
*/
|
||||
private String scanBatchNo;
|
||||
|
||||
/**
|
||||
* 扫码序列号
|
||||
*/
|
||||
private String scanSerialNo;
|
||||
|
||||
/**
|
||||
* 扫码数量
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -60,14 +60,14 @@ public class WmsInventoryServiceImpl extends ServiceImpl<WmsInventoryMapper, Wms
|
|||
} else {
|
||||
BigDecimal left = inventory.getNum();
|
||||
for (WmsInventory info : list) {
|
||||
if (left.compareTo(info.getNum()) <= 0) {
|
||||
break;
|
||||
}
|
||||
BigDecimal sub = NumberUtil.min(info.getNum(), left);
|
||||
left = left.subtract(sub);
|
||||
info.setNum(info.getNum().subtract(sub));
|
||||
info.setUpdateBy(UserUtil.getUserName());
|
||||
info.setUpdateTime(LocalDateTime.now());
|
||||
if (left.compareTo(BigDecimal.ZERO) <= 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (left.compareTo(BigDecimal.ZERO) > 0) {
|
||||
errorMaterialNos.add(inventory.getMaterialNo());
|
||||
|
|
|
|||
Loading…
Reference in New Issue