Compare commits
3 Commits
3d5c33eb40
...
b5969c279c
| Author | SHA1 | Date |
|---|---|---|
|
|
b5969c279c | |
|
|
b2fe07fd4b | |
|
|
5f74d354ba |
|
|
@ -3,9 +3,11 @@ package com.nflg.wms.admin.config;
|
|||
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 tech.powerjob.client.PowerJobClient;
|
||||
|
||||
@Configuration
|
||||
@Lazy
|
||||
public class PowerJobClientConfig {
|
||||
|
||||
@Value("${powerjob.worker.server-address}")
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.nflg.wms.admin.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.idev.excel.EasyExcel;
|
||||
|
|
@ -8,29 +9,27 @@ import cn.idev.excel.metadata.data.ImageData;
|
|||
import cn.idev.excel.metadata.data.WriteCellData;
|
||||
import cn.idev.excel.write.metadata.WriteSheet;
|
||||
import cn.idev.excel.write.metadata.fill.FillConfig;
|
||||
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;
|
||||
import com.nflg.wms.admin.util.QRCodeUtil;
|
||||
import com.nflg.wms.admin.util.ThymeleafUtil;
|
||||
import com.nflg.wms.common.constant.Constant;
|
||||
import com.nflg.wms.common.pojo.ApiResult;
|
||||
import com.nflg.wms.common.pojo.PageData;
|
||||
import com.nflg.wms.common.pojo.dto.DeliverNormalOrderItemDTO;
|
||||
import com.nflg.wms.common.pojo.dto.InventoryDTO;
|
||||
import com.nflg.wms.common.pojo.dto.MaterialQRCodeContentDTO;
|
||||
import com.nflg.wms.common.pojo.dto.ZWM00MB007DTO;
|
||||
import com.nflg.wms.common.pojo.qo.InProduceOrderGenerateMaterialsQO;
|
||||
import com.nflg.wms.common.pojo.qo.InProduceOrderSaveQO;
|
||||
import com.nflg.wms.common.pojo.qo.InProduceOrderSearchQO;
|
||||
import com.nflg.wms.common.pojo.qo.*;
|
||||
import com.nflg.wms.common.pojo.vo.InProduceOrderMaterialVO;
|
||||
import com.nflg.wms.common.pojo.vo.WmsInProduceOrderItemVO;
|
||||
import com.nflg.wms.common.util.DateTimeUtil;
|
||||
import com.nflg.wms.common.util.UserUtil;
|
||||
import com.nflg.wms.common.util.VUtil;
|
||||
import com.nflg.wms.repository.entity.WmsBom;
|
||||
import com.nflg.wms.repository.entity.WmsInProduceOrder;
|
||||
import com.nflg.wms.repository.entity.WmsInProduceOrderItem;
|
||||
import com.nflg.wms.repository.service.IWmsBomService;
|
||||
import com.nflg.wms.repository.service.IWmsInProduceOrderItemService;
|
||||
import com.nflg.wms.repository.service.IWmsInProduceOrderService;
|
||||
import com.nflg.wms.repository.entity.*;
|
||||
import com.nflg.wms.repository.service.*;
|
||||
import com.nflg.wms.starter.BaseController;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
|
@ -62,15 +61,40 @@ import java.util.*;
|
|||
public class InProduceOrderController extends BaseController {
|
||||
|
||||
private static final DecimalFormat DF = new DecimalFormat("0.00");
|
||||
|
||||
@Resource
|
||||
private SapService sapService;
|
||||
|
||||
@Resource
|
||||
private IWmsInProduceOrderService produceOrderService;
|
||||
|
||||
@Resource
|
||||
private IWmsInProduceOrderItemService produceOrderItemService;
|
||||
|
||||
@Resource
|
||||
private IWmsBomService bomService;
|
||||
|
||||
@Resource
|
||||
private BinService binService;
|
||||
|
||||
@Resource
|
||||
private IWmsInventoryService inventoryService;
|
||||
|
||||
@Resource
|
||||
private IWmsStorageService storageService;
|
||||
|
||||
@Resource
|
||||
private IDictionaryService dictionaryService;
|
||||
|
||||
@Resource
|
||||
private IWmsWarehouseService warehouseService;
|
||||
|
||||
@Resource
|
||||
private IWmsStorageBinService storageBinService;
|
||||
|
||||
@Resource
|
||||
private IWmsBinService wmsBinService;
|
||||
|
||||
/**
|
||||
* 从SAP查询生产订单信息
|
||||
* @param no 生产订单号
|
||||
|
|
@ -324,4 +348,126 @@ public class InProduceOrderController extends BaseController {
|
|||
excelWriter.fill(info, writeSheet);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取订单信息(PDA使用)
|
||||
* @param no 报工单号
|
||||
*/
|
||||
@GetMapping("getOrderInfo")
|
||||
public ApiResult<List<WmsInProduceOrderItemVO>> getOrderInfo(@Valid @RequestParam @NotBlank String no) {
|
||||
WmsInProduceOrder order = produceOrderService.getByNo(no);
|
||||
VUtil.trueThrowBusinessError(Objects.isNull(order)).throwMessage("订单不存在");
|
||||
List<WmsInProduceOrderItemVO> list = produceOrderItemService.getVOByOrderId(order.getId());
|
||||
list.forEach(it -> {
|
||||
it.setBinNos(binService.getBinNos(it.getMaterialNo(), it.getFactoryNo(), it.getWarehouseNo()));
|
||||
});
|
||||
return ApiResult.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 收货(PDA使用)
|
||||
* @param request 请求参数
|
||||
*/
|
||||
@Transactional
|
||||
@PostMapping("receive")
|
||||
public ApiResult<Void> receive(@Valid @RequestBody InProduceOrderReceiveQO request){
|
||||
WmsInProduceOrder order = produceOrderService.getByNo(request.getNo());
|
||||
VUtil.trueThrowBusinessError(Objects.isNull(order)).throwMessage("订单不存在");
|
||||
VUtil.trueThrowBusinessError(!Objects.equals(order.getState(), (short)0))
|
||||
.throwMessage("该订单非待收货状态");
|
||||
List<WmsInProduceOrderItemVO> list = produceOrderItemService.getVOByOrderId(order.getId());
|
||||
List<String> materialNos = new ArrayList<>();
|
||||
list.forEach(it->{
|
||||
BigDecimal num = BigDecimal.ZERO;
|
||||
InProduceOrderReceiveMaterialQO materialQO = request.getItems().stream().filter(q -> StrUtil.equals(q.getMaterialNo(), it.getMaterialNo())).findFirst().orElse(null);
|
||||
if (Objects.isNull(materialQO)) {
|
||||
materialNos.add(it.getMaterialNo());
|
||||
} else {
|
||||
for (String qrCode : materialQO.getQrCodes()) {
|
||||
MaterialQRCodeContentDTO content = NoUtil.getMaterialQRCodeContent(qrCode);
|
||||
if (Objects.nonNull(content.getNum())) {
|
||||
num = num.add(content.getNum());
|
||||
}
|
||||
}
|
||||
if (num.compareTo(it.getNum()) != 0) {
|
||||
materialNos.add(it.getMaterialNo());
|
||||
}
|
||||
//是否更改了储位
|
||||
syncStorage(it,materialQO.getBinNos());
|
||||
}
|
||||
});
|
||||
VUtil.trueThrowBusinessError(CollectionUtil.isNotEmpty(materialNos))
|
||||
.throwMessage("以下物料的扫码数量与收货数量不一致:"+StrUtil.join(",", materialNos));
|
||||
//同步入库信息到SAP
|
||||
sapService.zwm00_mb107(order.getOrderNo(), UserUtil.getUserName(),list.stream().map(it-> new Zwm00Mb107QO()
|
||||
.setPWERK(it.getFactoryNo())
|
||||
.setPSMNG(it.getNum())
|
||||
.setAMEIN(it.getUnit())
|
||||
.setLGORT(it.getWarehouseNo())
|
||||
.setCHARG(it.getBatchNo())).toList(),null
|
||||
);
|
||||
|
||||
order.setState((short)1);
|
||||
order.setUpdateBy(UserUtil.getUserName());
|
||||
order.setUpdateTime(LocalDateTime.now());
|
||||
produceOrderService.updateById(order);
|
||||
inventoryService.in(list.stream().map(it-> new InventoryDTO()
|
||||
.setMaterialNo(it.getMaterialNo())
|
||||
.setNum(it.getNum())
|
||||
.setFactoryNo(it.getFactoryNo())
|
||||
.setWarehouseNo(it.getWarehouseNo())
|
||||
.setBatchNumber(it.getBatchNo())).toList()
|
||||
);
|
||||
return ApiResult.success();
|
||||
}
|
||||
|
||||
private void syncStorage(WmsInProduceOrderItemVO it,Set<String> binNos){
|
||||
Set<String> dbMapBins = storageService.getBinNos(it.getMaterialNo(), it.getFactoryNo(), it.getWarehouseNo());
|
||||
if (!binNos.equals(dbMapBins)) {
|
||||
//调用SAP接口保存库位信息
|
||||
sapService.zwm3A02(it.getFactoryNo(), it.getMaterialNo(), it.getWarehouseNo(), binNos);
|
||||
//保存库位信息到数据库
|
||||
DictionaryItem factory = dictionaryService.getItemByCode(Constant.DICTIONARY_FACTORY, it.getFactoryNo());
|
||||
VUtil.trueThrowBusinessError(Objects.isNull(factory)).throwMessage("工厂(" + it.getFactoryNo() + ")不存在");
|
||||
WmsWarehouse warehouse = warehouseService.lambdaQuery()
|
||||
.eq(WmsWarehouse::getFactoryId, factory.getId())
|
||||
.eq(WmsWarehouse::getNo, it.getWarehouseNo())
|
||||
.one();
|
||||
VUtil.trueThrowBusinessError(Objects.isNull(warehouse)).throwMessage("仓库(" + it.getWarehouseNo() + ")不存在");
|
||||
WmsStorage storage = storageService.lambdaQuery()
|
||||
.eq(WmsStorage::getMaterialNo, it.getMaterialNo())
|
||||
.eq(WmsStorage::getWarehouseId, warehouse.getId())
|
||||
.one();
|
||||
if (Objects.isNull(storage)) {
|
||||
storage = new WmsStorage()
|
||||
.setWarehouseId(warehouse.getId())
|
||||
.setMaterialNo(it.getMaterialNo())
|
||||
.setMaterialDesc(it.getMaterialDesc())
|
||||
.setCreateBy(UserUtil.getUserName())
|
||||
.setCreateTime(LocalDateTime.now());
|
||||
storageService.save(storage);
|
||||
} else {
|
||||
storageBinService.deleteByStorageId(storage.getId());
|
||||
}
|
||||
List<WmsBin> dbBins = wmsBinService.lambdaQuery().in(WmsBin::getNo, binNos).list();
|
||||
binNos.forEach(binNo -> {
|
||||
if (dbBins.stream().noneMatch(bin -> StrUtil.equals(bin.getNo(), binNo))) {
|
||||
WmsBin bin = new WmsBin()
|
||||
.setNo(binNo)
|
||||
.setName(binNo)
|
||||
.setWarehouseId(warehouse.getId())
|
||||
.setCreateBy(UserUtil.getUserName())
|
||||
.setCreateTime(LocalDateTime.now());
|
||||
wmsBinService.save(bin);
|
||||
dbBins.add(bin);
|
||||
}
|
||||
});
|
||||
WmsStorage finalStorage = storage;
|
||||
storageBinService.saveBatch(dbBins.stream().map(bin -> new WmsStorageBin()
|
||||
.setStorageId(finalStorage.getId())
|
||||
.setBinId(bin.getId()))
|
||||
.toList()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,20 +5,14 @@ import com.nflg.wms.admin.pojo.dto.LdapUserDTO;
|
|||
import com.nflg.wms.admin.service.BasdeSerialNumberControllerService;
|
||||
import com.nflg.wms.admin.service.SapService;
|
||||
import com.nflg.wms.common.pojo.ApiResult;
|
||||
import com.nflg.wms.common.pojo.qo.C_MaterialReturnItemQO;
|
||||
import com.nflg.wms.repository.service.ILanguageService;
|
||||
import com.nflg.wms.starter.BaseController;
|
||||
import com.sap.conn.jco.JCoException;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -82,14 +76,4 @@ public class TestController extends BaseController {
|
|||
String ids=basdeSerialNumberControllerService.generateSerialNumber(0);
|
||||
return ApiResult.success(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 打印SAP函数参数,需在控制台查看
|
||||
* @param functionName SAP函数名
|
||||
*/
|
||||
@GetMapping("/sap/function/params")
|
||||
public ApiResult<Void> printSAPFunctionParams(@Valid @RequestParam @NotBlank String functionName) throws JCoException {
|
||||
sapService.printMeta(functionName);
|
||||
return ApiResult.success();
|
||||
}
|
||||
}
|
||||
|
|
@ -85,11 +85,13 @@ public class SapService {
|
|||
});
|
||||
tables.put("T_LIST1", list1);
|
||||
|
||||
List<Map<String, Object>> list2 = new ArrayList<>();
|
||||
sernrs.forEach(item -> {
|
||||
list2.add(Map.of("SERNR", item));
|
||||
});
|
||||
tables.put("T_LIST2", list2);
|
||||
if (CollectionUtil.isNotEmpty(sernrs)) {
|
||||
List<Map<String, Object>> list2 = new ArrayList<>();
|
||||
sernrs.forEach(item -> {
|
||||
list2.add(Map.of("SERNR", item));
|
||||
});
|
||||
tables.put("T_LIST2", list2);
|
||||
}
|
||||
|
||||
JCoFunction function = exec("ZWM00_MB107", parameters, tables);
|
||||
|
||||
|
|
@ -582,64 +584,4 @@ public class SapService {
|
|||
throw new NflgException(STATE.BusinessError, "SAP调用异常:" + MDC.get(Constant.TRACE_ID));
|
||||
}
|
||||
}
|
||||
|
||||
public void printMeta(String functionName) {
|
||||
try {
|
||||
functionName=functionName.toUpperCase();
|
||||
JCoFunction function = repository.getFunction(functionName);
|
||||
VUtil.trueThrowBusinessError(Objects.isNull(function)).throwMessage("方法"+functionName+"不存在");
|
||||
printMeta(function);
|
||||
}catch (Exception e){
|
||||
log.error("打印方法参数信息异常", e);
|
||||
}
|
||||
}
|
||||
|
||||
private void printMeta(JCoFunction function){
|
||||
log.trace("-------------------------------------------------------");
|
||||
log.trace("SAP {} 方法参数信息", function.getName());
|
||||
log.trace("-- Import结构");
|
||||
printParameterField(function.getImportParameterList());
|
||||
log.trace("-- Changing结构");
|
||||
printParameterField(function.getChangingParameterList());
|
||||
log.trace("-- Export结构");
|
||||
printParameterField(function.getExportParameterList());
|
||||
log.trace("-- Table结构");
|
||||
printParameterField(function.getTableParameterList());
|
||||
log.trace("-------------------------------------------------------");
|
||||
}
|
||||
|
||||
private void printParameterField(JCoParameterList parameterList){
|
||||
if (Objects.nonNull(parameterList)) {
|
||||
JCoParameterFieldIterator iterator = parameterList.getParameterFieldIterator();
|
||||
if (Objects.nonNull(iterator)) {
|
||||
while (iterator.hasNextField()) {
|
||||
JCoParameterField field = iterator.nextParameterField();
|
||||
log.trace("名称:{},类型:{},描述:{}", field.getName(), field.getTypeAsString(),field.getDescription());
|
||||
if (field.isTable()){
|
||||
printJCoTable(field.getTable());
|
||||
}else if (field.isStructure()){
|
||||
printStructure(field.getStructure());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void printJCoTable(JCoTable table){
|
||||
log.trace("Table结构");
|
||||
JCoRecordFieldIterator iterator=table.getRecordFieldIterator();
|
||||
while (iterator.hasNextField()) {
|
||||
JCoRecordField field = iterator.nextRecordField();
|
||||
log.trace("名称:{},类型:{},描述:{}", field.getName(), field.getTypeAsString(),field.getDescription());
|
||||
}
|
||||
}
|
||||
|
||||
private void printStructure(JCoStructure structure){
|
||||
log.trace("Structure结构");
|
||||
JCoRecordFieldIterator iterator=structure.getRecordFieldIterator();
|
||||
while (iterator.hasNextField()) {
|
||||
JCoRecordField field = iterator.nextRecordField();
|
||||
log.trace("名称:{},类型:{},描述:{}", field.getName(), field.getTypeAsString(),field.getDescription());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,14 @@
|
|||
package com.nflg.wms.admin.util;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.nflg.wms.common.pojo.dto.MaterialQRCodeContentDTO;
|
||||
import com.nflg.wms.common.util.DateTimeUtil;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
public class NoUtil {
|
||||
|
||||
|
|
@ -40,4 +44,23 @@ public class NoUtil {
|
|||
public static String getInProduceNo(){
|
||||
return "IP"+DateTimeUtil.format(LocalDateTime.now(), "yyyyMMddHHmmss");
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析普通物料二维码内容
|
||||
* @param qrCode 二维码内容
|
||||
* @return 解析后的内容
|
||||
*/
|
||||
public static MaterialQRCodeContentDTO getMaterialQRCodeContent(String qrCode){
|
||||
List<String> contents=StrUtil.split(qrCode, "$");
|
||||
return new MaterialQRCodeContentDTO()
|
||||
.setUniqNo(CollectionUtil.get(contents, 0))
|
||||
.setOrderNo(CollectionUtil.get(contents, 1))
|
||||
.setOrderRowNo(CollectionUtil.get(contents, 2))
|
||||
.setMaterialNo(CollectionUtil.get(contents, 3))
|
||||
.setNum(new BigDecimal(CollectionUtil.get(contents, 4)))
|
||||
.setMaterialDesc(CollectionUtil.get(contents, 5))
|
||||
.setSupplierNo(CollectionUtil.get(contents, 6))
|
||||
.setBatchNo(CollectionUtil.get(contents, 7))
|
||||
.setSerialNo(CollectionUtil.get(contents, 8));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,23 +1,167 @@
|
|||
package com.nflg.wms.admin;
|
||||
|
||||
import com.nflg.wms.admin.service.SapService;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.sap.conn.jco.*;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@SpringBootTest
|
||||
public class SapMetaPrintTest {
|
||||
|
||||
@Resource
|
||||
private SapService sapService;
|
||||
private JCoRepository repository;
|
||||
|
||||
@Test
|
||||
public void ZWM00_MB007(){
|
||||
sapService.printMeta("ZWM00_MB007");
|
||||
public void ZWM00_MB007() throws JCoException {
|
||||
printMeta("ZWM00_MB007");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ZWM00_MB107(){
|
||||
sapService.printMeta("ZWM00_MB107");
|
||||
public void ZWM00_MB107() throws JCoException {
|
||||
printMeta("ZWM00_MB107");
|
||||
}
|
||||
|
||||
public void printMeta(String functionName) throws JCoException {
|
||||
functionName = functionName.toUpperCase();
|
||||
JCoFunction function = repository.getFunction(functionName);
|
||||
if (Objects.isNull(function)) {
|
||||
print("方法" + functionName + "不存在");
|
||||
} else {
|
||||
printMeta(function);
|
||||
}
|
||||
}
|
||||
|
||||
private void printMeta(JCoFunction function){
|
||||
print("SAP {} 方法参数信息", function.getName());
|
||||
printParameterField("Import",function.getImportParameterList());
|
||||
printParameterField("Changing",function.getChangingParameterList());
|
||||
printParameterField("Export",function.getExportParameterList());
|
||||
printParameterField("Table",function.getTableParameterList());
|
||||
}
|
||||
|
||||
private void printParameterField(String name, JCoParameterList parameterList){
|
||||
print("▶ "+name);
|
||||
if (Objects.nonNull(parameterList)) {
|
||||
JCoParameterFieldIterator iterator = parameterList.getParameterFieldIterator();
|
||||
if (Objects.nonNull(iterator)) {
|
||||
List<JCoParameterField> fields = new ArrayList<>();
|
||||
List<String[]> data = new ArrayList<>();
|
||||
while (iterator.hasNextField()) {
|
||||
JCoParameterField field = iterator.nextParameterField();
|
||||
data.add(new String[]{field.getName(), field.getTypeAsString(), field.getDescription()});
|
||||
if (field.isTable() || field.isStructure()){
|
||||
fields.add(field);
|
||||
}
|
||||
}
|
||||
printTable(data);
|
||||
fields.forEach(field->{
|
||||
if (field.isTable()){
|
||||
printJCoTable(field);
|
||||
}else if (field.isStructure()){
|
||||
printStructure(field);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void printJCoTable(JCoParameterField pfield){
|
||||
print("★★ {}({}) 参数", pfield.getName(),pfield.getDescription());
|
||||
print(pfield.getTable().getRecordFieldIterator());
|
||||
}
|
||||
|
||||
private void printStructure(JCoParameterField pfield){
|
||||
print("★★ {}({}) 参数", pfield.getName(),pfield.getDescription());
|
||||
print(pfield.getStructure().getRecordFieldIterator());
|
||||
}
|
||||
|
||||
private void print(JCoRecordFieldIterator iterator){
|
||||
List<String[]> data = new ArrayList<>();
|
||||
while (iterator.hasNextField()) {
|
||||
JCoRecordField field = iterator.nextRecordField();
|
||||
data.add(new String[]{field.getName(), field.getTypeAsString(), field.getDescription()});
|
||||
}
|
||||
printTable(data);
|
||||
}
|
||||
|
||||
private void printTable(List<String[]> datas){
|
||||
SimpleTable table = new SimpleTable();
|
||||
table.addHeader("序号","名称", "类型", "描述");
|
||||
for (int i = 0; i < datas.size(); i++){
|
||||
table.addRow(String.valueOf(i+1), datas.get(i)[0], datas.get(i)[1], datas.get(i)[2]);
|
||||
}
|
||||
table.print();
|
||||
}
|
||||
|
||||
private void print(String content){
|
||||
System.out.println(content);
|
||||
}
|
||||
|
||||
private void print(String template,Object... args){
|
||||
System.out.println(StrUtil.format(template,args));
|
||||
}
|
||||
|
||||
// 简单实现示例
|
||||
private static class SimpleTable {
|
||||
private final List<String[]> rows = new ArrayList<>();
|
||||
private final List<String> headers = new ArrayList<>();
|
||||
|
||||
public void addHeader(String... headers) {
|
||||
this.headers.addAll(Arrays.asList(headers));
|
||||
}
|
||||
|
||||
public void addRow(String... values) {
|
||||
rows.add(values);
|
||||
}
|
||||
|
||||
public void print() {
|
||||
// 计算每列最大宽度
|
||||
int[] maxWidths = new int[headers.size()];
|
||||
for (int i = 0; i < headers.size(); i++) {
|
||||
maxWidths[i] = headers.get(i).length();
|
||||
}
|
||||
|
||||
for (String[] row : rows) {
|
||||
for (int i = 0; i < row.length && i < maxWidths.length; i++) {
|
||||
maxWidths[i] = Math.max(maxWidths[i], row[i].length());
|
||||
}
|
||||
}
|
||||
|
||||
// 打印表格
|
||||
printLine(maxWidths);
|
||||
printRow(headers.toArray(new String[0]), maxWidths);
|
||||
printLine(maxWidths);
|
||||
|
||||
for (String[] row : rows) {
|
||||
printRow(row, maxWidths);
|
||||
}
|
||||
printLine(maxWidths);
|
||||
}
|
||||
|
||||
private void printLine(int[] widths) {
|
||||
System.out.print("+");
|
||||
for (int width : widths) {
|
||||
for (int i = 0; i < width + 2; i++) {
|
||||
System.out.print("-");
|
||||
}
|
||||
System.out.print("+");
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
private void printRow(String[] row, int[] widths) {
|
||||
System.out.print("|");
|
||||
for (int i = 0; i < widths.length; i++) {
|
||||
String value = i < row.length ? row[i] : "";
|
||||
System.out.printf(" %-" + widths[i] + "s |", value);
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,56 @@
|
|||
package com.nflg.wms.common.pojo.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class MaterialQRCodeContentDTO {
|
||||
|
||||
/**
|
||||
* 唯一编号
|
||||
*/
|
||||
private String uniqNo;
|
||||
|
||||
/**
|
||||
* 订单编号
|
||||
*/
|
||||
private String orderNo;
|
||||
|
||||
/**
|
||||
* 订单行号
|
||||
*/
|
||||
private String orderRowNo;
|
||||
|
||||
/**
|
||||
* 物料编号
|
||||
*/
|
||||
private String materialNo;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private BigDecimal num;
|
||||
|
||||
/**
|
||||
* 物料描述
|
||||
*/
|
||||
private String materialDesc;
|
||||
|
||||
/**
|
||||
* 供应商编号
|
||||
*/
|
||||
private String supplierNo;
|
||||
|
||||
/**
|
||||
* 批次号
|
||||
*/
|
||||
private String batchNo;
|
||||
|
||||
/**
|
||||
* 序列号
|
||||
*/
|
||||
private String serialNo;
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
package com.nflg.wms.common.pojo.qo;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Data
|
||||
public class InProduceOrderReceiveMaterialQO {
|
||||
|
||||
/**
|
||||
* 物料编号
|
||||
*/
|
||||
@NotBlank
|
||||
private String materialNo;
|
||||
|
||||
/**
|
||||
* 储位编号列表
|
||||
*/
|
||||
@NotEmpty
|
||||
private Set<String> binNos;
|
||||
|
||||
/**
|
||||
* 二维码列表
|
||||
*/
|
||||
@NotEmpty
|
||||
private List<String> qrCodes;
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.nflg.wms.common.pojo.qo;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class InProduceOrderReceiveQO {
|
||||
|
||||
/**
|
||||
* 报工单号
|
||||
*/
|
||||
@NotBlank
|
||||
private String no;
|
||||
|
||||
/**
|
||||
* 物料列表
|
||||
*/
|
||||
@NotEmpty
|
||||
private List<InProduceOrderReceiveMaterialQO> items;
|
||||
}
|
||||
|
|
@ -48,4 +48,14 @@ public class WmsInProduceOrderItemVO {
|
|||
* 仓库
|
||||
*/
|
||||
private String warehouseNo;
|
||||
|
||||
/**
|
||||
* 储位
|
||||
*/
|
||||
private String binNos;
|
||||
|
||||
/**
|
||||
* 批次号
|
||||
*/
|
||||
private String batchNo;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||
import com.nflg.wms.common.pojo.qo.InProduceOrderSearchQO;
|
||||
import com.nflg.wms.repository.entity.WmsInProduceOrder;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
|
@ -17,4 +18,6 @@ import jakarta.validation.Valid;
|
|||
public interface IWmsInProduceOrderService extends IService<WmsInProduceOrder> {
|
||||
|
||||
IPage<WmsInProduceOrder> search(@Valid InProduceOrderSearchQO request);
|
||||
|
||||
WmsInProduceOrder getByNo(@Valid @NotBlank String no);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,4 +35,9 @@ public class WmsInProduceOrderServiceImpl extends ServiceImpl<WmsInProduceOrderM
|
|||
.le(Objects.nonNull(request.getEndDate()), WmsInProduceOrder::getCreateTime, request.getEndDate())
|
||||
.page(new Page<>(request.getPage(), request.getPageSize()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public WmsInProduceOrder getByNo(String no) {
|
||||
return lambdaQuery().eq(WmsInProduceOrder::getNo, no).one();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue