feat: 添加功能:采购单退库
This commit is contained in:
parent
06ecce096b
commit
89b997364f
|
|
@ -1,6 +1,5 @@
|
|||
package com.nflg.wms.admin;
|
||||
|
||||
import com.sap.conn.jco.JCoException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
|
@ -17,13 +16,15 @@ import org.springframework.scheduling.annotation.EnableScheduling;
|
|||
@EnableRetry
|
||||
public class AdminApplication {
|
||||
|
||||
public static void main(String[] args) throws JCoException {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(AdminApplication.class, args);
|
||||
log.info("服务已启动");
|
||||
// log.info("---------------------- Sa-Token SSO 模式二 Client 端启动成功 ----------------------");
|
||||
// log.info("配置信息:" + SaSsoManager.getClientConfig());
|
||||
|
||||
// SapService sapService= SpringUtil.getBean(SapService.class);
|
||||
// sapService.printMeta("ZIM_001");
|
||||
// sapService.zim001query("cdsfds");
|
||||
// sapService.zwm00_MB017("1309976");
|
||||
// log.info(JSONUtil.toJsonStr(sapService.searchOrder("0000101808")));
|
||||
// log.info(JSONUtil.toJsonStr(sapService.getMaterialInfoInOrder("7500188009","0000101808","2100053760")));
|
||||
|
|
|
|||
|
|
@ -0,0 +1,114 @@
|
|||
package com.nflg.wms.admin.controller;
|
||||
|
||||
import com.nflg.wms.admin.service.BinService;
|
||||
import com.nflg.wms.admin.service.SapService;
|
||||
import com.nflg.wms.admin.util.NoUtil;
|
||||
import com.nflg.wms.common.pojo.ApiResult;
|
||||
import com.nflg.wms.common.pojo.PageData;
|
||||
import com.nflg.wms.common.pojo.dto.Zim001QueryResultDTO;
|
||||
import com.nflg.wms.common.pojo.dto.Zim001QueryResultItem1DTO;
|
||||
import com.nflg.wms.common.pojo.qo.OutPurchaseSearchQO;
|
||||
import com.nflg.wms.common.pojo.vo.WmsOutPurchaseItemVO;
|
||||
import com.nflg.wms.common.util.UserUtil;
|
||||
import com.nflg.wms.common.util.VUtil;
|
||||
import com.nflg.wms.repository.entity.WmsOutPurchase;
|
||||
import com.nflg.wms.repository.entity.WmsOutPurchaseItem;
|
||||
import com.nflg.wms.repository.service.IWmsOutPurchaseItemService;
|
||||
import com.nflg.wms.repository.service.IWmsOutPurchaseService;
|
||||
import com.nflg.wms.starter.BaseController;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 采购退库管理
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/out/purchase")
|
||||
public class OutPurchaseController extends BaseController {
|
||||
|
||||
@Resource
|
||||
private SapService sapService;
|
||||
|
||||
@Resource
|
||||
private IWmsOutPurchaseService outPurchaseService;
|
||||
|
||||
@Resource
|
||||
private IWmsOutPurchaseItemService outPurchaseItemService;
|
||||
|
||||
@Resource
|
||||
private BinService binService;
|
||||
|
||||
/**
|
||||
* 获取采购退库信息
|
||||
* @param orderNo 采购单号
|
||||
* @return 要退库的物料信息列表
|
||||
*/
|
||||
@GetMapping("getForOut")
|
||||
public ApiResult<Zim001QueryResultDTO> getForOut(String orderNo){
|
||||
Zim001QueryResultDTO result = sapService.zim001query(orderNo);
|
||||
result.getItem1().parallelStream().forEach(it->{
|
||||
it.setBinNos(binService.getBinNos(it.getMATNR(),it.getWERKS(),it.getLGORT()));
|
||||
});
|
||||
return ApiResult.success(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存采购退库信息
|
||||
* @param request 采购退库信息
|
||||
*/
|
||||
@Transactional
|
||||
@PostMapping("save")
|
||||
public ApiResult<Void> save(@Valid @RequestBody Zim001QueryResultDTO request){
|
||||
VUtil.trueThrowBusinessError(request.getItem1().stream().map(Zim001QueryResultItem1DTO::getEBELN).collect(Collectors.toSet()).size()>1)
|
||||
.throwMessage("采购单号不唯一");
|
||||
Zim001QueryResultItem1DTO item=request.getItem1().get(0);
|
||||
WmsOutPurchase purchase=new WmsOutPurchase()
|
||||
.setNo(NoUtil.getOutPurchaseNo())
|
||||
.setExternalOrderNo(item.getEBELN())
|
||||
.setSupplierNo("")
|
||||
.setSupplierName("")
|
||||
.setCreateBy(UserUtil.getUserName())
|
||||
.setCreateTime(LocalDateTime.now());
|
||||
//TODO 设置供应商信息
|
||||
outPurchaseService.save(purchase);
|
||||
outPurchaseItemService.saveBatch(request.getItem1().parallelStream().map(it -> new WmsOutPurchaseItem()
|
||||
.setPurchaseId(purchase.getId())
|
||||
.setRowNo(it.getEBELP())
|
||||
.setMaterialNo(it.getMATNR())
|
||||
.setMaterialDesc(it.getMAKTX())
|
||||
.setNum(it.getERFMG())
|
||||
.setUnit(it.getMEINS())
|
||||
.setBatchNo(it.getCHARG())
|
||||
.setFactoryNo(it.getWERKS())
|
||||
.setWarehouseNo(it.getLGORT())
|
||||
.set_101Year(it.getLFBJA())
|
||||
.set_101No(it.getLFBNR())
|
||||
.set_101Project(it.getLFPOS())).toList());
|
||||
sapService.zim001(request);
|
||||
return ApiResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索列表
|
||||
*/
|
||||
@PostMapping("search")
|
||||
public ApiResult<PageData<WmsOutPurchase>> search(@Valid @RequestBody OutPurchaseSearchQO request){
|
||||
return ApiResult.success(outPurchaseService.search(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取详情
|
||||
* @param id 退库单id
|
||||
*/
|
||||
@GetMapping("getInfo")
|
||||
public ApiResult<List<WmsOutPurchaseItemVO>> getInfo(@Valid @RequestParam @NotNull Long id){
|
||||
return outPurchaseItemService.getListByPurchaseId(id);
|
||||
}
|
||||
}
|
||||
|
|
@ -17,6 +17,7 @@ import cn.idev.excel.write.metadata.fill.FillConfig;
|
|||
import com.nflg.wms.admin.pojo.document.PackageMaterialScanRecord;
|
||||
import com.nflg.wms.admin.pojo.dto.*;
|
||||
import com.nflg.wms.admin.repository.PackageMaterialScanRecordRepository;
|
||||
import com.nflg.wms.admin.service.BinService;
|
||||
import com.nflg.wms.admin.service.SapService;
|
||||
import com.nflg.wms.admin.util.NoUtil;
|
||||
import com.nflg.wms.admin.util.PdfGeneratorUtil;
|
||||
|
|
@ -129,11 +130,14 @@ public class StructuralPackageOrderController extends BaseController {
|
|||
private IWmsStorageBinService storageBinService;
|
||||
|
||||
@Resource
|
||||
private IWmsBinService binService;
|
||||
private IWmsBinService wmsBinService;
|
||||
|
||||
@Resource
|
||||
private IWmsSrmQualityInspectionService srmQualityInspectionService;
|
||||
|
||||
@Resource
|
||||
private BinService binService;
|
||||
|
||||
/**
|
||||
* 搜索SAP订单
|
||||
* @param request 请求参数
|
||||
|
|
@ -707,17 +711,7 @@ public class StructuralPackageOrderController extends BaseController {
|
|||
log.error("{},{},{}未从SAP的ZIM_004接口查询仓库为空", it.getExternalOrderNo(), it.getSupplierCode(), it.getPackageNo());
|
||||
} else {
|
||||
it.setWarehouseNo(dto.getWarehouseNo());
|
||||
Set<String> dbMapBins=storageService.getBinNos(it.getPackageNo(), dto.getWerks(), dto.getWarehouseNo());
|
||||
if (CollectionUtil.isEmpty(dbMapBins)){
|
||||
List<SAPSyncFromDTO> dtos = sapService.zwm3a01(dto.getWerks(), List.of(dto.getWarehouseNo()), List.of(it.getPackageNo()), null, null);
|
||||
if (CollectionUtil.isEmpty(dtos)) {
|
||||
log.error("{},{},{}未从SAP的ZWM3A01接口查询到数据", dto.getWerks(), dto.getWarehouseNo(), it.getPackageNo());
|
||||
} else {
|
||||
it.setBinNos(dtos.get(0).getBinNos());
|
||||
}
|
||||
}else {
|
||||
it.setBinNos(String.join("/", dbMapBins));
|
||||
}
|
||||
it.setBinNos(binService.getBinNos(it.getPackageNo(),dto.getWerks(),dto.getWarehouseNo()));
|
||||
}
|
||||
});
|
||||
DeliverStructuralPackageOrderForPackageVO vo = new DeliverStructuralPackageOrderForPackageVO();
|
||||
|
|
@ -798,7 +792,7 @@ public class StructuralPackageOrderController extends BaseController {
|
|||
List<WmsInTaskItem> list = inTaskItemService.getListForStorage(taskNo);
|
||||
List<InTaskInfoVO> datas = Convert.toList(InTaskInfoVO.class, list);
|
||||
for (InTaskInfoVO item : datas) {
|
||||
SAPSyncFromDTO dto = sapService.zwm3a01(item.getFactory(), item.getReceivedWarehouse(), item.getItemCode());
|
||||
SAPSyncFromDTO dto = sapService.zwm3A01(item.getFactory(), item.getReceivedWarehouse(), item.getItemCode());
|
||||
if (Objects.nonNull(dto)) {
|
||||
item.setBinNos(dto.getBinNos());
|
||||
}
|
||||
|
|
@ -948,7 +942,7 @@ public class StructuralPackageOrderController extends BaseController {
|
|||
Set<String> dbMapBins = storageService.getBinNos(qo.getMaterialNo(), qo.getFactory(), qo.getReceivedWarehouse());
|
||||
if (!qo.getBinNos().equals(dbMapBins)) {
|
||||
//调用SAP接口保存库位信息
|
||||
sapService.ZWM3A02(qo.getFactory(), qo.getMaterialNo(), qo.getReceivedWarehouse(), qo.getBinNos());
|
||||
sapService.zwm3A02(qo.getFactory(), qo.getMaterialNo(), qo.getReceivedWarehouse(), qo.getBinNos());
|
||||
//保存库位信息到数据库
|
||||
DictionaryItem factory = dictionaryService.getItemByCode(Constant.DICTIONARY_FACTORY, qo.getFactory());
|
||||
VUtil.trueThrowBusinessError(Objects.isNull(factory)).throwMessage("工厂(" + qo.getFactory() + ")不存在");
|
||||
|
|
@ -972,7 +966,7 @@ public class StructuralPackageOrderController extends BaseController {
|
|||
}else {
|
||||
storageBinService.deleteByStorageId(storage.getId());
|
||||
}
|
||||
List<WmsBin> dbBins=binService.lambdaQuery().in(WmsBin::getNo, qo.getBinNos()).list();
|
||||
List<WmsBin> dbBins=wmsBinService.lambdaQuery().in(WmsBin::getNo, qo.getBinNos()).list();
|
||||
qo.getBinNos().forEach(binNo->{
|
||||
if (dbBins.stream().noneMatch(it -> StrUtil.equals(it.getNo(), binNo))){
|
||||
WmsBin bin=new WmsBin()
|
||||
|
|
@ -981,7 +975,7 @@ public class StructuralPackageOrderController extends BaseController {
|
|||
.setWarehouseId(warehouse.getId())
|
||||
.setCreateBy(UserUtil.getUserName())
|
||||
.setCreateTime(LocalDateTime.now());
|
||||
binService.save(bin);
|
||||
wmsBinService.save(bin);
|
||||
dbBins.add(bin);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -0,0 +1,37 @@
|
|||
package com.nflg.wms.admin.service;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.nflg.wms.common.pojo.dto.SAPSyncFromDTO;
|
||||
import com.nflg.wms.repository.service.IWmsStorageService;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class BinService {
|
||||
|
||||
@Resource
|
||||
private IWmsStorageService storageService;
|
||||
|
||||
@Resource
|
||||
private SapService sapService;
|
||||
|
||||
public String getBinNos(String materialNo,String factory,String warehouseNo) {
|
||||
Set<String> bins =storageService.getBinNos(materialNo,factory, warehouseNo);
|
||||
if (CollectionUtil.isNotEmpty(bins)){
|
||||
return String.join("/",bins);
|
||||
}else {
|
||||
List<SAPSyncFromDTO> dtos = sapService.zwm3A01(factory, List.of(warehouseNo), List.of(materialNo), null, null);
|
||||
if (CollectionUtil.isEmpty(dtos)){
|
||||
log.error("{},{},{}未从SAP的ZWM3A01接口查询到数据", factory, warehouseNo, materialNo);
|
||||
return null;
|
||||
}else {
|
||||
return dtos.get(0).getBinNos();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -45,7 +45,7 @@ public class SAPCommonService {
|
|||
warehouseNos.add(materialInfoInOrder.getWarehouseNo());
|
||||
List<String> materialNos=new ArrayList<>();
|
||||
materialNos.add(materialInfoInOrder.getMatnr());
|
||||
List<SAPSyncFromDTO> list = sapService.zwm3a01(materialInfoInOrder.getWerks(), warehouseNos, materialNos, null, null);
|
||||
List<SAPSyncFromDTO> list = sapService.zwm3A01(materialInfoInOrder.getWerks(), warehouseNos, materialNos, null, null);
|
||||
if (!CollectionUtil.isEmpty(list)) {
|
||||
//同步仓库信息
|
||||
SAPSyncFromDTO dbWarehouse = list.get(0);
|
||||
|
|
|
|||
|
|
@ -8,10 +8,7 @@ import com.nflg.wms.admin.pojo.dto.ZIM003105DTO;
|
|||
import com.nflg.wms.admin.pojo.dto.ZIM003DTO;
|
||||
import com.nflg.wms.common.constant.STATE;
|
||||
import com.nflg.wms.common.exception.NflgException;
|
||||
import com.nflg.wms.common.pojo.dto.C_MaterialReturnDTO;
|
||||
import com.nflg.wms.common.pojo.dto.C_MaterialReturnQueryDTO;
|
||||
import com.nflg.wms.common.pojo.dto.SAPOrderDTO;
|
||||
import com.nflg.wms.common.pojo.dto.SAPSyncFromDTO;
|
||||
import com.nflg.wms.common.pojo.dto.*;
|
||||
import com.nflg.wms.common.pojo.qo.C_MaterialReturnItemQO;
|
||||
import com.nflg.wms.common.pojo.qo.C_MaterialReturnQO;
|
||||
import com.nflg.wms.common.util.VUtil;
|
||||
|
|
@ -32,6 +29,103 @@ public class SapService {
|
|||
@Resource
|
||||
private JCoRepository repository;
|
||||
|
||||
/**
|
||||
* 查询采购单退库信息
|
||||
* @param orderNo 采购单号
|
||||
*/
|
||||
public Zim001QueryResultDTO zim001query(String orderNo) {
|
||||
Map<String, Object> parameters = new HashMap<>();
|
||||
parameters.put("EBELN", orderNo);
|
||||
|
||||
Zim001QueryResultDTO result=new Zim001QueryResultDTO();
|
||||
try {
|
||||
JCoFunction function = exec("ZIM_001_QUERY", parameters, null);
|
||||
|
||||
JCoStructure structure = function.getExportParameterList().getStructure("OUTPUT");
|
||||
VUtil.trueThrowBusinessError(!StrUtil.equals(structure.getString("TYPE"), "S"))
|
||||
.throwMessage("SAP错误:" + structure.getString("MSG"));
|
||||
|
||||
JCoTable ot1 = function.getTableParameterList().getTable("OUTPUT1");
|
||||
List<Zim001QueryResultItem1DTO> items1 = new ArrayList<>();
|
||||
for (int i = 0; i < ot1.getNumRows(); i++) {
|
||||
ot1.setRow(i);
|
||||
items1.add(new Zim001QueryResultItem1DTO()
|
||||
.setEBELN(ot1.getString("EBELN"))
|
||||
.setEBELP(ot1.getString("EBELP"))
|
||||
.setMATNR(ot1.getString("MATNR"))
|
||||
.setMAKTX(ot1.getString("MAKTX"))
|
||||
.setMEINS(ot1.getString("MEINS"))
|
||||
.setCHARG(ot1.getString("CHARG"))
|
||||
.setWERKS(ot1.getString("WERKS"))
|
||||
.setLGORT(ot1.getString("LGORT"))
|
||||
.setLFBJA(ot1.getString("LFBJA"))
|
||||
.setLFBNR(ot1.getString("LFBNR"))
|
||||
.setLFPOS(ot1.getString("LFPOS"))
|
||||
);
|
||||
}
|
||||
result.setItem1(items1);
|
||||
|
||||
JCoTable ot2 = function.getTableParameterList().getTable("OUTPUT2");
|
||||
List<Zim001QueryResultItem2DTO> items2 = new ArrayList<>();
|
||||
for (int i = 0; i < ot2.getNumRows(); i++) {
|
||||
ot2.setRow(i);
|
||||
items2.add(new Zim001QueryResultItem2DTO()
|
||||
.setEBELN(ot2.getString("EBELN"))
|
||||
.setEBELP(ot2.getString("EBELP"))
|
||||
.setSERNR(ot2.getString("SERNR"))
|
||||
.setLFBJA(ot2.getString("LFBJA"))
|
||||
.setLFBNR(ot2.getString("LFBNR"))
|
||||
.setLFPOS(ot2.getString("LFPOS"))
|
||||
);
|
||||
}
|
||||
result.setItem2(items2);
|
||||
|
||||
log.debug("数据:{}", JSONUtil.toJsonStr(result));
|
||||
} catch (JCoException e) {
|
||||
log.error("SAP错误", e);
|
||||
VUtil.trueThrowBusinessError(true).throwMessage("SAP错误:" + e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public void zim001(Zim001QueryResultDTO dto){
|
||||
Map<String, List<Map<String, Object>>> tables = new HashMap<>();
|
||||
List<Map<String, Object>> list1 = new ArrayList<>();
|
||||
dto.getItem1().forEach(item -> {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("EBELN", item.getEBELN());
|
||||
map.put("EBELP", item.getEBELP());
|
||||
map.put("MATNR", item.getMATNR());
|
||||
map.put("MAKTX", item.getMAKTX());
|
||||
map.put("MEINS", item.getMEINS());
|
||||
map.put("CHARG", item.getCHARG());
|
||||
map.put("WERKS", item.getWERKS());
|
||||
map.put("LGORT", item.getLGORT());
|
||||
map.put("LFBJA", item.getLFBJA());
|
||||
map.put("LFBNR", item.getLFBNR());
|
||||
map.put("LFPOS", item.getLFPOS());
|
||||
list1.add(map);
|
||||
});
|
||||
tables.put("INPUT1", list1);
|
||||
List<Map<String, Object>> list2 = new ArrayList<>();
|
||||
dto.getItem2().forEach(item -> {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("EBELN", item.getEBELN());
|
||||
map.put("EBELP", item.getEBELP());
|
||||
map.put("SERNR", item.getSERNR());
|
||||
map.put("LFBJA", item.getLFBJA());
|
||||
map.put("LFBNR", item.getLFBNR());
|
||||
map.put("LFPOS", item.getLFPOS());
|
||||
list2.add(map);
|
||||
});
|
||||
tables.put("INPUT2", list2);
|
||||
|
||||
JCoParameterList jparameters = execReturnParameter("ZIM_001", null, tables);
|
||||
JCoStructure structure=jparameters.getStructure("OUTPUT");
|
||||
VUtil.trueThrowBusinessError(!StrUtil.equals(structure.getString("TYPE"), "S"))
|
||||
.throwMessage("SAP错误:" + structure.getString("MSG"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 扫码质检入库
|
||||
*
|
||||
|
|
@ -120,7 +214,7 @@ public class SapService {
|
|||
* @param warehouseNo 仓库编号
|
||||
* @param binNos 储位编号列表
|
||||
*/
|
||||
public void ZWM3A02(String factory, String materialNo, String warehouseNo, Collection<String> binNos) {
|
||||
public void zwm3A02(String factory, String materialNo, String warehouseNo, Collection<String> binNos) {
|
||||
Map<String, Object> parameters = new HashMap<>();
|
||||
parameters.put("WERKS", factory);
|
||||
parameters.put("MATNR", materialNo);
|
||||
|
|
@ -141,13 +235,12 @@ public class SapService {
|
|||
|
||||
/**
|
||||
* 获取库存信息
|
||||
*
|
||||
* @param factory 工厂编号
|
||||
* @param warehouseNo 仓库编号
|
||||
* @param materialNo 物料编号
|
||||
*/
|
||||
public SAPSyncFromDTO zwm3a01(String factory, String warehouseNo, String materialNo) {
|
||||
return zwm3a01(factory, Collections.singletonList(warehouseNo), Collections.singletonList(materialNo), null, null)
|
||||
public SAPSyncFromDTO zwm3A01(String factory, String warehouseNo, String materialNo) {
|
||||
return zwm3A01(factory, Collections.singletonList(warehouseNo), Collections.singletonList(materialNo), null, null)
|
||||
.stream().findFirst().orElse(null);
|
||||
}
|
||||
|
||||
|
|
@ -159,7 +252,7 @@ public class SapService {
|
|||
* @param beginTime 开始时间,格式yyyyMMdd
|
||||
* @param endTime 结束时间,格式yyyyMMdd
|
||||
*/
|
||||
public List<SAPSyncFromDTO> zwm3a01(String factory, List<String> warehouseNos, List<String> materialNos, String beginTime, String endTime) {
|
||||
public List<SAPSyncFromDTO> zwm3A01(String factory, List<String> warehouseNos, List<String> materialNos, String beginTime, String endTime) {
|
||||
Map<String, Object> parameters = new HashMap<>();
|
||||
parameters.put("I_WERKS", factory);
|
||||
parameters.put("I_TYPE", Objects.nonNull(beginTime) || Objects.nonNull(endTime) ? "I" : "A");
|
||||
|
|
@ -351,9 +444,9 @@ public class SapService {
|
|||
}
|
||||
|
||||
private JCoFunction exec(String functionName, Map<String, Object> parameters, Map<String, List<Map<String, Object>>> tables) throws JCoException {
|
||||
functionName=functionName.toUpperCase();
|
||||
log.info("SAP functionName:{}", functionName);
|
||||
JCoFunction function = repository.getFunction(functionName);
|
||||
printMeta(function);
|
||||
|
||||
log.info("SAP ImportParameter:{}", JSONUtil.toJsonStr(parameters));
|
||||
log.info("---{}", function.getImportParameterList().getListMetaData());
|
||||
|
|
@ -377,7 +470,9 @@ public class SapService {
|
|||
}
|
||||
|
||||
public void printMeta(String functionName) throws JCoException {
|
||||
functionName=functionName.toUpperCase();
|
||||
JCoFunction function = repository.getFunction(functionName);
|
||||
VUtil.trueThrowBusinessError(Objects.isNull(function)).throwMessage("方法"+functionName+"不存在");
|
||||
printMeta(function);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,4 +24,12 @@ public class NoUtil {
|
|||
return StrUtil.format("{}{}", StrUtil.subSufByLength(supplierNo, 4)
|
||||
, DateTimeUtil.format(LocalDateTime.now(), "yyMMdd"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成采购单退库单号
|
||||
* @return 采购单退库单号
|
||||
*/
|
||||
public static String getOutPurchaseNo(){
|
||||
return "OP"+DateTimeUtil.format(LocalDateTime.now(), "yyyyMMddHHmmss");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
package com.nflg.wms.common.pojo.dto;
|
||||
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class Zim001QueryResultDTO {
|
||||
|
||||
@NotEmpty
|
||||
private List<Zim001QueryResultItem1DTO> item1;
|
||||
|
||||
@NotEmpty
|
||||
private List<Zim001QueryResultItem2DTO> item2;
|
||||
}
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
package com.nflg.wms.common.pojo.dto;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class Zim001QueryResultItem1DTO {
|
||||
|
||||
/**
|
||||
* 采购单号
|
||||
*/
|
||||
@NotBlank
|
||||
private String EBELN;
|
||||
|
||||
/**
|
||||
* 采购单行号
|
||||
*/
|
||||
@NotBlank
|
||||
private String EBELP;
|
||||
|
||||
/**
|
||||
* 物料编号
|
||||
*/
|
||||
@NotBlank
|
||||
private String MATNR;
|
||||
|
||||
/**
|
||||
* 物料描述
|
||||
*/
|
||||
private String MAKTX;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
@NotNull
|
||||
private BigDecimal ERFMG;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
private String MEINS;
|
||||
|
||||
/**
|
||||
* 批次号
|
||||
*/
|
||||
private String CHARG;
|
||||
|
||||
/**
|
||||
* 工厂
|
||||
*/
|
||||
private String WERKS;
|
||||
|
||||
/**
|
||||
* 仓库
|
||||
*/
|
||||
private String LGORT;
|
||||
|
||||
/**
|
||||
* 101入库凭证年度
|
||||
*/
|
||||
private String LFBJA;
|
||||
|
||||
/**
|
||||
* 101入库凭证
|
||||
*/
|
||||
private String LFBNR;
|
||||
|
||||
/**
|
||||
* 101入库凭证项目
|
||||
*/
|
||||
private String LFPOS;
|
||||
|
||||
/**
|
||||
* 二维码内容
|
||||
*/
|
||||
private String qrCode;
|
||||
|
||||
/**
|
||||
* 储位
|
||||
*/
|
||||
private String binNos;
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
package com.nflg.wms.common.pojo.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class Zim001QueryResultItem2DTO {
|
||||
|
||||
/**
|
||||
* 采购单号
|
||||
*/
|
||||
private String EBELN;
|
||||
|
||||
/**
|
||||
* 采购单行号
|
||||
*/
|
||||
private String EBELP;
|
||||
|
||||
/**
|
||||
* 101入库凭证年度
|
||||
*/
|
||||
private String LFBJA;
|
||||
|
||||
/**
|
||||
* 101入库凭证
|
||||
*/
|
||||
private String LFBNR;
|
||||
|
||||
/**
|
||||
* 101入库凭证项目
|
||||
*/
|
||||
private String LFPOS;
|
||||
|
||||
/**
|
||||
* 序列号
|
||||
*/
|
||||
private String SERNR;
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.nflg.wms.common.pojo.qo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class OutPurchaseSearchQO extends SearchBaseQO{
|
||||
|
||||
/**
|
||||
* 退库单号
|
||||
*/
|
||||
private String no;
|
||||
|
||||
/**
|
||||
* 采购订单号
|
||||
*/
|
||||
private String externalOrderNo;
|
||||
|
||||
/**
|
||||
* 供应商编号
|
||||
*/
|
||||
private String supplierNo;
|
||||
}
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
package com.nflg.wms.common.pojo.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class WmsOutPurchaseItemVO{
|
||||
|
||||
/**
|
||||
* 采购单订单号
|
||||
*/
|
||||
private String externalOrderNo;
|
||||
|
||||
/**
|
||||
* 采购单行号
|
||||
*/
|
||||
private String rowNo;
|
||||
|
||||
/**
|
||||
* 物料编号
|
||||
*/
|
||||
private String materialNo;
|
||||
|
||||
/**
|
||||
* 物料描述
|
||||
*/
|
||||
private String materialDesc;
|
||||
|
||||
/**
|
||||
* 退库数量
|
||||
*/
|
||||
private BigDecimal num;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
private String unit;
|
||||
|
||||
/**
|
||||
* 批次号
|
||||
*/
|
||||
private String batchNo;
|
||||
|
||||
/**
|
||||
* 工厂
|
||||
*/
|
||||
private String factoryNo;
|
||||
|
||||
/**
|
||||
* 库位
|
||||
*/
|
||||
private String warehouseNo;
|
||||
|
||||
/**
|
||||
* 101入库凭证年度
|
||||
*/
|
||||
@TableField("101_year")
|
||||
private String _101Year;
|
||||
|
||||
/**
|
||||
* 101入库凭证
|
||||
*/
|
||||
@TableField("101No")
|
||||
private String _101No;
|
||||
|
||||
/**
|
||||
* 101入库凭证项目
|
||||
*/
|
||||
@TableField("101Project")
|
||||
private String _101Project;
|
||||
|
||||
/**
|
||||
* 二维码内容
|
||||
*/
|
||||
private String qrCode;
|
||||
}
|
||||
|
|
@ -1,11 +1,17 @@
|
|||
package com.nflg.wms.common.util;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
public class BeanUtil {
|
||||
|
||||
private final static ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
public static <T> T copy(Object source, Class<T> clazz) {
|
||||
String data= JSONUtil.toJsonStr(source);
|
||||
return JSONUtil.toBean(data, clazz);
|
||||
return JSONUtil.toBean(toJson(source), clazz);
|
||||
}
|
||||
|
||||
public static String toJson(Object source) {
|
||||
return JSONUtil.toJsonStr(source);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,73 @@
|
|||
package com.nflg.wms.repository.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 退库-采购中心退库
|
||||
* </p>
|
||||
*
|
||||
* @author 代码生成器生成
|
||||
* @since 2025
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Accessors(chain = true)
|
||||
@TableName("wms_out_purchase")
|
||||
public class WmsOutPurchase implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 退库单号
|
||||
*/
|
||||
private String no;
|
||||
|
||||
/**
|
||||
* 采购单订单号
|
||||
*/
|
||||
private String externalOrderNo;
|
||||
|
||||
/**
|
||||
* 供应商编码
|
||||
*/
|
||||
private String supplierNo;
|
||||
|
||||
/**
|
||||
* 供应商名称
|
||||
*/
|
||||
private String supplierName;
|
||||
|
||||
/**
|
||||
* SAP 同步成功或失败
|
||||
*/
|
||||
private Boolean sapStatus;
|
||||
|
||||
/**
|
||||
* SAP同步失败原因
|
||||
*/
|
||||
private String sapError;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
}
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
package com.nflg.wms.repository.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author 代码生成器生成
|
||||
* @since 2025
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Accessors(chain = true)
|
||||
@TableName("wms_out_purchase_item")
|
||||
public class WmsOutPurchaseItem implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 采购出库id
|
||||
*/
|
||||
private Long purchaseId;
|
||||
|
||||
/**
|
||||
* 采购单行号
|
||||
*/
|
||||
private String rowNo;
|
||||
|
||||
/**
|
||||
* 物料编号
|
||||
*/
|
||||
private String materialNo;
|
||||
|
||||
/**
|
||||
* 物料描述
|
||||
*/
|
||||
private String materialDesc;
|
||||
|
||||
/**
|
||||
* 退库数量
|
||||
*/
|
||||
private BigDecimal num;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
private String unit;
|
||||
|
||||
/**
|
||||
* 批次号
|
||||
*/
|
||||
private String batchNo;
|
||||
|
||||
/**
|
||||
* 工厂
|
||||
*/
|
||||
private String factoryNo;
|
||||
|
||||
/**
|
||||
* 库位
|
||||
*/
|
||||
private String warehouseNo;
|
||||
|
||||
/**
|
||||
* 101入库凭证年度
|
||||
*/
|
||||
@TableField("101_year")
|
||||
private String _101Year;
|
||||
|
||||
/**
|
||||
* 101入库凭证
|
||||
*/
|
||||
@TableField("101No")
|
||||
private String _101No;
|
||||
|
||||
/**
|
||||
* 101入库凭证项目
|
||||
*/
|
||||
@TableField("101Project")
|
||||
private String _101Project;
|
||||
|
||||
/**
|
||||
* 二维码内容
|
||||
*/
|
||||
private String qrCode;
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package com.nflg.wms.repository.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.nflg.wms.common.pojo.ApiResult;
|
||||
import com.nflg.wms.common.pojo.vo.WmsOutPurchaseItemVO;
|
||||
import com.nflg.wms.repository.entity.WmsOutPurchaseItem;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 代码生成器生成
|
||||
* @since 2025
|
||||
*/
|
||||
public interface WmsOutPurchaseItemMapper extends BaseMapper<WmsOutPurchaseItem> {
|
||||
|
||||
ApiResult<List<WmsOutPurchaseItemVO>> getListByPurchaseId(Long id);
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.nflg.wms.repository.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.nflg.wms.repository.entity.WmsOutPurchase;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 退库-采购中心退库 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 代码生成器生成
|
||||
* @since 2025
|
||||
*/
|
||||
public interface WmsOutPurchaseMapper extends BaseMapper<WmsOutPurchase> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.nflg.wms.repository.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.nflg.wms.common.pojo.ApiResult;
|
||||
import com.nflg.wms.common.pojo.vo.WmsOutPurchaseItemVO;
|
||||
import com.nflg.wms.repository.entity.WmsOutPurchaseItem;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author 代码生成器生成
|
||||
* @since 2025
|
||||
*/
|
||||
public interface IWmsOutPurchaseItemService extends IService<WmsOutPurchaseItem> {
|
||||
|
||||
ApiResult<List<WmsOutPurchaseItemVO>> getListByPurchaseId(@Valid @NotNull Long id);
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package com.nflg.wms.repository.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.nflg.wms.common.pojo.qo.OutPurchaseSearchQO;
|
||||
import com.nflg.wms.repository.entity.WmsOutPurchase;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 退库-采购中心退库 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author 代码生成器生成
|
||||
* @since 2025
|
||||
*/
|
||||
public interface IWmsOutPurchaseService extends IService<WmsOutPurchase> {
|
||||
|
||||
IPage<WmsOutPurchase> search(@Valid OutPurchaseSearchQO request);
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.nflg.wms.repository.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.nflg.wms.common.pojo.ApiResult;
|
||||
import com.nflg.wms.common.pojo.vo.WmsOutPurchaseItemVO;
|
||||
import com.nflg.wms.repository.entity.WmsOutPurchaseItem;
|
||||
import com.nflg.wms.repository.mapper.WmsOutPurchaseItemMapper;
|
||||
import com.nflg.wms.repository.service.IWmsOutPurchaseItemService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 代码生成器生成
|
||||
* @since 2025
|
||||
*/
|
||||
@Service
|
||||
public class WmsOutPurchaseItemServiceImpl extends ServiceImpl<WmsOutPurchaseItemMapper, WmsOutPurchaseItem> implements IWmsOutPurchaseItemService {
|
||||
|
||||
@Override
|
||||
public ApiResult<List<WmsOutPurchaseItemVO>> getListByPurchaseId(Long id) {
|
||||
return baseMapper.getListByPurchaseId(id);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
package com.nflg.wms.repository.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.nflg.wms.common.pojo.qo.OutPurchaseSearchQO;
|
||||
import com.nflg.wms.repository.entity.WmsOutPurchase;
|
||||
import com.nflg.wms.repository.mapper.WmsOutPurchaseMapper;
|
||||
import com.nflg.wms.repository.service.IWmsOutPurchaseService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 退库-采购中心退库 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 代码生成器生成
|
||||
* @since 2025
|
||||
*/
|
||||
@Service
|
||||
public class WmsOutPurchaseServiceImpl extends ServiceImpl<WmsOutPurchaseMapper, WmsOutPurchase> implements IWmsOutPurchaseService {
|
||||
|
||||
@Override
|
||||
public IPage<WmsOutPurchase> search(OutPurchaseSearchQO request) {
|
||||
return lambdaQuery()
|
||||
.eq(StrUtil.isNotBlank(request.getNo()),WmsOutPurchase::getNo, request.getNo())
|
||||
.eq(StrUtil.isNotBlank(request.getExternalOrderNo()),WmsOutPurchase::getExternalOrderNo, request.getExternalOrderNo())
|
||||
.eq(StrUtil.isNotBlank(request.getSupplierNo()),WmsOutPurchase::getSupplierNo, request.getSupplierNo())
|
||||
.ge(Objects.nonNull(request.getStartDate()),WmsOutPurchase::getCreateTime, request.getStartDate())
|
||||
.le(Objects.nonNull(request.getEndDate()),WmsOutPurchase::getCreateTime, request.getEndDate())
|
||||
.page(new Page<>(request.getPage(), request.getPageSize()));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!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.WmsOutPurchaseItemMapper">
|
||||
|
||||
<select id="getListByPurchaseId" resultType="java.util.List">
|
||||
SELECT opi.*,op.external_order_no
|
||||
FROM wms_out_purchase op
|
||||
INNER JOIN wms_out_purchase_item opi ON op."id"=opi.purchase_id
|
||||
WHERE op."id"=#{id}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!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.WmsOutPurchaseMapper">
|
||||
|
||||
</mapper>
|
||||
|
|
@ -33,7 +33,7 @@ public class CodeGeneratorTest {
|
|||
)
|
||||
.strategyConfig(builder -> {
|
||||
builder
|
||||
.addInclude("wms_tool_material_maintain") //只生成指定表
|
||||
.addInclude("wms_out_purchase_item") //只生成指定表
|
||||
.entityBuilder().idType(IdType.ASSIGN_ID)
|
||||
.enableLombok()
|
||||
.enableChainModel()
|
||||
|
|
|
|||
Loading…
Reference in New Issue