feat: 一些优化
This commit is contained in:
parent
41275bcb64
commit
118a14831d
|
|
@ -331,12 +331,6 @@ public class InCostCenterBackController extends BaseController {
|
|||
VUtil.trueThrowBusinessError(Objects.isNull(info)).throwMessage("退料单不存在");
|
||||
InCostcenterBackInfoVO order = Convert.convert(InCostcenterBackInfoVO.class, info);
|
||||
List<InCostcenterBackItemVO> list = Convert.toList(InCostcenterBackItemVO.class, inCostcenterBackItemService.getList(id));
|
||||
// InCostcenterBackInfoVO order = new InCostcenterBackInfoVO();
|
||||
// order.setNo(NoUtil.getOutCostcenterNo());
|
||||
// List<WmsInCostcenterBackItem> list = new ArrayList<>();
|
||||
// for (int i = 0, count = RandomUtil.randomInt(1, 100); i < count; i++) {
|
||||
// list.add(new WmsInCostcenterBackItem().setMatnr(RandomUtil.randomNumbers(11)).setMaktx("非金属联件和紧固件等 M6 DIN 982 不锈钢304"));
|
||||
// }
|
||||
list.forEach(item -> item.setLgort(order.getLgort()));
|
||||
Map<String, String> base = new HashMap<>();
|
||||
base.put("date", DateUtil.format(LocalDateTime.now(), "yyyy-MM-dd"));
|
||||
|
|
@ -356,14 +350,8 @@ public class InCostCenterBackController extends BaseController {
|
|||
public void exportTicket(HttpServletResponse response, @Valid @RequestParam @NotNull Long id) throws Exception {
|
||||
InCostcenterBackInfoVO order = inCostcenterBackTicketService.getInfo(id);
|
||||
VUtil.trueThrowBusinessError(Objects.isNull(order)).throwMessage("退料入库单不存在");
|
||||
order.setNo(order.getTicketNo());
|
||||
// order.setNo(order.getTicketNo());
|
||||
List<InCostcenterBackItemVO> list = Convert.toList(InCostcenterBackItemVO.class, inCostcenterBackTicketItemService.getList(id));
|
||||
// InCostcenterBackInfoVO order = new InCostcenterBackInfoVO();
|
||||
// order.setNo(NoUtil.getOutCostcenterNo());
|
||||
// List<WmsInCostcenterBackItem> list = new ArrayList<>();
|
||||
// for (int i = 0, count = RandomUtil.randomInt(1, 100); i < count; i++) {
|
||||
// list.add(new WmsInCostcenterBackItem().setMatnr(RandomUtil.randomNumbers(11)).setMaktx("非金属联件和紧固件等 M6 DIN 982 不锈钢304"));
|
||||
// }
|
||||
list.forEach(item -> item.setLgort(order.getLgort()));
|
||||
Map<String, String> base = new HashMap<>();
|
||||
base.put("date", DateUtil.format(LocalDateTime.now(), "yyyy-MM-dd"));
|
||||
|
|
|
|||
|
|
@ -82,42 +82,6 @@ public class InProduceBackController extends BaseController {
|
|||
@PostMapping("searchSAP")
|
||||
public ApiResult<List<Zwm3a09VO>> searchSAP(@Valid @RequestBody Zwm3a09QO request) {
|
||||
return ApiResult.success(sapService.zwm3a09(request));
|
||||
// List<Zwm3a09VO> vos = new ArrayList<>();
|
||||
// for (int i = 0, count = RandomUtil.randomInt(3, 30); i < count; i++) {
|
||||
// vos.add(new Zwm3a09VO()
|
||||
// .setBdter(DateUtil.format(RandomUtil.randomDate(DateUtil.date(), DateField.DAY_OF_YEAR, 1, 300), "yyyy-MM-dd"))
|
||||
// .setAufnr(RandomUtil.randomNumbers(10))
|
||||
// .setKtext(RandomUtil.randomString(10))
|
||||
// .setPlnbez(RandomUtil.randomString(10))
|
||||
// .setMaktx(RandomUtil.randomString(10))
|
||||
// .setLgpbe(RandomUtil.randomString(4))
|
||||
// .setMatnr(RandomUtil.randomString(11))
|
||||
// .setName(RandomUtil.randomString(10))
|
||||
// .setQlsl(RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("100")))
|
||||
// .setSqsl(RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("100")))
|
||||
// .setSqsl2(RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("100")))
|
||||
// .setSqsl3(RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("100")))
|
||||
// .setBdmng(RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("100")))
|
||||
// .setLabst(RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("100")))
|
||||
// .setKcqls(RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("100")))
|
||||
// .setLgort2(RandomUtil.randomString(4))
|
||||
// .setMeins(RandomUtil.randomString(4))
|
||||
// .setEkgrp(RandomUtil.randomString(4))
|
||||
// .setDispo(RandomUtil.randomString(4))
|
||||
// .setRsnum(RandomUtil.randomNumbers(10))
|
||||
// .setMaktx2(RandomUtil.randomString(10))
|
||||
// .setVornr(RandomUtil.randomNumbers(10))
|
||||
// .setSernr(RandomUtil.randomNumbers(10))
|
||||
// .setJtsn(RandomUtil.randomNumbers(10))
|
||||
// .setCusn(RandomUtil.randomNumbers(10))
|
||||
// .setDwerk(RandomUtil.randomString(4))
|
||||
// .setRsnum2(RandomUtil.randomNumbers(10))
|
||||
// .setRspos(RandomUtil.randomNumbers(10))
|
||||
// .setEnmng(RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("100")))
|
||||
// .setInsme(RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("100")))
|
||||
// );
|
||||
// }
|
||||
// return ApiResult.success(vos);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -218,6 +182,7 @@ public class InProduceBackController extends BaseController {
|
|||
.setItems(datas.stream()
|
||||
.filter(item -> item.getSqsl().compareTo(item.getNum()) > 0)
|
||||
.map(item -> new OutProduceItemVO()
|
||||
.setId(item.getId())
|
||||
.setLgort2(order.getLgort2())
|
||||
.setLgpbe(item.getLgpbe())
|
||||
.setMaktx2(item.getMaktx2())
|
||||
|
|
@ -373,12 +338,6 @@ public class InProduceBackController extends BaseController {
|
|||
WmsInProduceBack order = inProduceBackService.getById(id);
|
||||
VUtil.trueThrowBusinessError(Objects.isNull(order)).throwMessage("退料单不存在");
|
||||
List<WmsInProduceBackItem> list = inProduceBackItemService.getList(id);
|
||||
// WmsInProduceBack order = new WmsInProduceBack()
|
||||
// .setNo("IPB" + DateUtil.format(LocalDateTime.now(), "yyyyMMdd") + RandomUtil.randomNumbers(4));
|
||||
// List<WmsInProduceBackItem> list = new ArrayList<>();
|
||||
// for (int i = 0, count = RandomUtil.randomInt(1, 100); i < count; i++) {
|
||||
// list.add(new WmsInProduceBackItem().setMatnr(RandomUtil.randomNumbers(10)));
|
||||
// }
|
||||
list.forEach(it -> it.setNum(null));
|
||||
Map<String, String> base = new HashMap<>();
|
||||
base.put("date", DateUtil.format(LocalDateTime.now(), "yyyy-MM-dd"));
|
||||
|
|
@ -398,14 +357,8 @@ public class InProduceBackController extends BaseController {
|
|||
public void exportTicket(HttpServletResponse response, @Valid @RequestParam @NotNull Long id) throws Exception {
|
||||
InProduceBackTicketVO order = inProduceBackTicketService.getInfo(id);
|
||||
VUtil.trueThrowBusinessError(Objects.isNull(order)).throwMessage("退料出库单不存在");
|
||||
order.setNo(order.getTicketNo());
|
||||
// order.setNo(order.getTicketNo());
|
||||
List<InProduceBackTicketItemVO> list = inProduceBackTicketItemService.getList(id);
|
||||
// InProduceBackTicketVO order = new InProduceBackTicketVO();
|
||||
// order.setNo("IPB" + DateUtil.format(LocalDateTime.now(), "yyyyMMdd") + RandomUtil.randomNumbers(4));
|
||||
// List<InProduceBackTicketItemVO> list = new ArrayList<>();
|
||||
// for (int i = 0, count = RandomUtil.randomInt(1, 100); i < count; i++) {
|
||||
// list.add(new InProduceBackTicketItemVO().setMatnr(RandomUtil.randomNumbers(10)));
|
||||
// }
|
||||
Map<String, String> base = new HashMap<>();
|
||||
base.put("date", DateUtil.format(LocalDateTime.now(), "yyyy-MM-dd"));
|
||||
base.put("qrcode", QRCodeUtil.generateQRCodeBase64(order.getNo(), 100, 100));
|
||||
|
|
|
|||
|
|
@ -321,12 +321,6 @@ public class OutAssistanceController extends BaseController {
|
|||
WmsOutAssistance order = outAssistanceService.getById(id);
|
||||
VUtil.trueThrowBusinessError(Objects.isNull(order)).throwMessage("领料单不存在");
|
||||
List<OutAssistanceItemVO> list = Convert.toList(OutAssistanceItemVO.class, outAssistanceItemService.getList(id));
|
||||
// WmsOutAssistance order = new WmsOutAssistance();
|
||||
// order.setNo(NoUtil.getOutAssistanceNo());
|
||||
// List<OutAssistanceItemVO> list = new ArrayList<>();
|
||||
// for (int i = 0, count = RandomUtil.randomInt(1, 10); i < count; i++) {
|
||||
// list.add(new OutAssistanceItemVO().setMatnr(RandomUtil.randomNumbers(11)).setMaktx("非金属联件和紧固件等 M6 DIN 982 不锈钢304"));
|
||||
// }
|
||||
list.forEach(it -> {
|
||||
it.setEbeln(order.getEbeln());
|
||||
it.setLgort1(order.getLgort1());
|
||||
|
|
@ -355,12 +349,6 @@ public class OutAssistanceController extends BaseController {
|
|||
OutAssistanceInfoVO order = outAssistanceTicketService.getInfo(id);
|
||||
VUtil.trueThrowBusinessError(Objects.isNull(order)).throwMessage("领料出库单不存在");
|
||||
List<OutAssistanceItemVO> list = outAssistanceTicketItemService.getList(id);
|
||||
// OutAssistanceInfoVO order = new OutAssistanceInfoVO();
|
||||
// order.setNo(NoUtil.getOutAssistanceNo());
|
||||
// List<OutAssistanceItemVO> list = new ArrayList<>();
|
||||
// for (int i = 0, count = RandomUtil.randomInt(1, 50); i < count; i++) {
|
||||
// list.add(new OutAssistanceItemVO().setMatnr1(RandomUtil.randomNumbers(11)).setMaktx1("非金属联件和紧固件等 M6 DIN 982 不锈钢304"));
|
||||
// }
|
||||
list.forEach(it -> {
|
||||
it.setLgort1(order.getLgort1());
|
||||
});
|
||||
|
|
|
|||
|
|
@ -317,12 +317,6 @@ public class OutCostCenterController extends BaseController {
|
|||
VUtil.trueThrowBusinessError(Objects.isNull(info)).throwMessage("领料单不存在");
|
||||
OutCostcenterVO order = Convert.convert(OutCostcenterVO.class, info);
|
||||
List<WmsOutCostcenterItem> list = outCostcenterItemService.getList(id);
|
||||
// OutCostcenterVO order = new OutCostcenterVO();
|
||||
// order.setNo(NoUtil.getOutCostcenterNo());
|
||||
// List<WmsOutCostcenterItem> list = new ArrayList<>();
|
||||
// for (int i = 0, count = RandomUtil.randomInt(1, 100); i < count; i++) {
|
||||
// list.add(new WmsOutCostcenterItem().setMatnr(RandomUtil.randomNumbers(11)).setMaktx("非金属联件和紧固件等 M6 DIN 982 不锈钢304"));
|
||||
// }
|
||||
Map<String, String> base = new HashMap<>();
|
||||
base.put("date", DateUtil.format(LocalDateTime.now(), "yyyy-MM-dd"));
|
||||
base.put("qrcode", QRCodeUtil.generateQRCodeBase64(order.getNo(), 100, 100));
|
||||
|
|
@ -341,14 +335,8 @@ public class OutCostCenterController extends BaseController {
|
|||
public void exportTicket(HttpServletResponse response, @Valid @RequestParam @NotNull Long id) throws Exception {
|
||||
OutCostcenterInfoVO order = outCostcenterTicketService.getInfo(id);
|
||||
VUtil.trueThrowBusinessError(Objects.isNull(order)).throwMessage("领料出库单不存在");
|
||||
order.setNo(order.getTicketNo());
|
||||
// order.setNo(order.getTicketNo());
|
||||
List<OutCostcenterInfoItemVO> list = outCostcenterTicketItemService.getList(id);
|
||||
// OutCostcenterInfoVO order = new OutCostcenterInfoVO();
|
||||
// order.setNo(NoUtil.getOutCostcenterNo());
|
||||
// List<OutCostcenterInfoItemVO> list = new ArrayList<>();
|
||||
// for (int i = 0, count = RandomUtil.randomInt(1, 100); i < count; i++) {
|
||||
// list.add(new OutCostcenterInfoItemVO().setMatnr(RandomUtil.randomNumbers(11)).setMaktx("非金属联件和紧固件等 M6 DIN 982 不锈钢304"));
|
||||
// }
|
||||
list.forEach(it -> it.setLgort(order.getLgort()));
|
||||
Map<String, String> base = new HashMap<>();
|
||||
base.put("date", DateUtil.format(LocalDateTime.now(), "yyyy-MM-dd"));
|
||||
|
|
|
|||
|
|
@ -347,6 +347,8 @@ public class OutProduceController extends BaseController {
|
|||
.setUniqNo(qrCodeContent.getUniqNo())
|
||||
.setFactoryNo(order.getDwerk())
|
||||
.setWarehouseNo(request.getLgort())
|
||||
.setUnit(item.getMeins())
|
||||
.setRspos(item.getRspos())
|
||||
.setNum(qrNum)
|
||||
.setCreateBy(UserUtil.getUserName())
|
||||
.setCreateTime(Instant.now())
|
||||
|
|
@ -469,14 +471,8 @@ public class OutProduceController extends BaseController {
|
|||
public void exportTicket1(HttpServletResponse response, @Valid @RequestParam @NotNull Long id) throws Exception {
|
||||
OutProduceTicketVO order = outProduceTicketService.getInfo(id);
|
||||
VUtil.trueThrowBusinessError(Objects.isNull(order)).throwMessage("补料出库单不存在");
|
||||
order.setNo(order.getTicketNo());
|
||||
// order.setNo(order.getTicketNo());
|
||||
List<OutProduceInfoItemVO> list = outProduceTicketItemService.getList(id);
|
||||
// OutProduceTicketVO order = new OutProduceTicketVO();
|
||||
// order.setNo(RandomUtil.randomNumbers(5));
|
||||
// List<OutProduceInfoItemVO> list = new ArrayList<>();
|
||||
// for (int i = 0, count = 22; i < count; i++) {
|
||||
// list.add(new OutProduceInfoItemVO().setMatnr(RandomUtil.randomNumbers(10)));
|
||||
// }
|
||||
list.forEach(it -> it.setAufnr(order.getAufnr()));
|
||||
Map<String, String> base = new HashMap<>();
|
||||
base.put("date", DateUtil.format(LocalDateTime.now(), "yyyy-MM-dd"));
|
||||
|
|
@ -497,12 +493,6 @@ public class OutProduceController extends BaseController {
|
|||
OutProduceTicketVO order = outProduceTicketService.getInfo(id);
|
||||
VUtil.trueThrowBusinessError(Objects.isNull(order)).throwMessage("领料出库单不存在");
|
||||
List<OutProduceInfoItemVO> list = outProduceTicketItemService.getList(id);
|
||||
// OutProduceTicketVO order = new OutProduceTicketVO()
|
||||
// .setTicketNo(RandomUtil.randomNumbers(5));
|
||||
// List<OutProduceInfoItemVO> list = new ArrayList<>();
|
||||
// for (int i = 0, count = RandomUtil.randomInt(1, 100); i < count; i++) {
|
||||
// list.add(new OutProduceInfoItemVO().setMatnr(RandomUtil.randomNumbers(10)));
|
||||
// }
|
||||
list.forEach(it -> it.setAufnr(order.getAufnr()));
|
||||
Map<String, String> base = new HashMap<>();
|
||||
base.put("createDate", DateUtil.format(order.getCreateTime(), "yyyy-MM-dd"));
|
||||
|
|
|
|||
|
|
@ -492,12 +492,6 @@ public class TransferCompanyController extends BaseController {
|
|||
WmsTransferCompany order = transferCompanyService.getById(id);
|
||||
VUtil.trueThrowBusinessError(Objects.isNull(order)).throwMessage("转储单不存在");
|
||||
List<TransferCompanyItemVO> list = Convert.toList(TransferCompanyItemVO.class, transferCompanyItemService.getList(id));
|
||||
// WmsTransferCompany order = new WmsTransferCompany();
|
||||
// order.setNo(NoUtil.getTransferCompanyNo());
|
||||
// List<WmsTransferCompanyItem> list = new ArrayList<>();
|
||||
// for (int i = 0, count = RandomUtil.randomInt(1, 100); i < count; i++) {
|
||||
// list.add(new WmsTransferCompanyItem().setMatnr(RandomUtil.randomNumbers(11)).setMaktx("非金属联件和紧固件等 M6 DIN 982 不锈钢304"));
|
||||
// }
|
||||
list.forEach(it -> {
|
||||
it.setEbeln(order.getEbeln());
|
||||
});
|
||||
|
|
@ -520,19 +514,13 @@ public class TransferCompanyController extends BaseController {
|
|||
TransferCompanyTicketVO order = transferCompanyTicketService.getInfo(id);
|
||||
VUtil.trueThrowBusinessError(Objects.isNull(order)).throwMessage("转储单不存在");
|
||||
List<TransferCompanyItemVO> list = transferCompanyTicketItemService.getList(id);
|
||||
// TransferCompanyTicketVO order = new TransferCompanyTicketVO();
|
||||
// order.setNo(NoUtil.getTransferCompanyNo());
|
||||
// List<TransferCompanyItemVO> list = new ArrayList<>();
|
||||
// for (int i = 0, count = RandomUtil.randomInt(1, 100); i < count; i++) {
|
||||
// list.add(new TransferCompanyItemVO().setMatnr(RandomUtil.randomNumbers(11)).setMaktx("非金属联件和紧固件等 M6 DIN 982 不锈钢304"));
|
||||
// }
|
||||
list.forEach(it -> {
|
||||
it.setLgort(order.getLgort());
|
||||
it.setWerks(order.getWerks());
|
||||
});
|
||||
Map<String, String> base = new HashMap<>();
|
||||
base.put("date", DateUtil.format(LocalDateTime.now(), "yyyy-MM-dd"));
|
||||
base.put("qrcode", QRCodeUtil.generateQRCodeBase64(order.getTicketNo(), 100, 100));
|
||||
base.put("qrcode", QRCodeUtil.generateQRCodeBase64(order.getNo(), 100, 100));
|
||||
Map<String, Object> variables = new HashMap<>();
|
||||
variables.put("info", order);
|
||||
variables.put("base", base);
|
||||
|
|
|
|||
|
|
@ -454,12 +454,6 @@ public class TransferFactoryController extends BaseController {
|
|||
WmsTransferFactory order = transferFactoryService.getById(id);
|
||||
VUtil.trueThrowBusinessError(Objects.isNull(order)).throwMessage("调拨单不存在");
|
||||
List<TransferFactoryItemVO> list = Convert.toList(TransferFactoryItemVO.class, transferFactoryItemService.getList(id));
|
||||
// WmsTransferFactory order = new WmsTransferFactory();
|
||||
// order.setNo(NoUtil.getTransferFactoryNo());
|
||||
// List<WmsTransferFactoryItem> list = new ArrayList<>();
|
||||
// for (int i = 0, count = RandomUtil.randomInt(1, 100); i < count; i++) {
|
||||
// list.add(new WmsTransferFactoryItem().setMatnr(RandomUtil.randomNumbers(11)).setMaktx("非金属联件和紧固件等 M6 DIN 982 不锈钢304"));
|
||||
// }
|
||||
list.forEach(it -> {
|
||||
it.setLgort(order.getLgort());
|
||||
it.setUmlgo(order.getUmlgo());
|
||||
|
|
@ -483,19 +477,13 @@ public class TransferFactoryController extends BaseController {
|
|||
TransferFactoryTicketInfoVO order = transferFactoryTicketService.getInfo(id);
|
||||
VUtil.trueThrowBusinessError(Objects.isNull(order)).throwMessage("调拨单不存在");
|
||||
List<TransferFactoryItemVO> list = transferFactoryTicketItemService.getList(id);
|
||||
// TransferFactoryTicketInfoVO order = new TransferFactoryTicketInfoVO();
|
||||
// order.setNo(NoUtil.getTransferFactoryNo());
|
||||
// List<TransferFactoryItemVO> list = new ArrayList<>();
|
||||
// for (int i = 0, count = RandomUtil.randomInt(1, 100); i < count; i++) {
|
||||
// list.add(new TransferFactoryItemVO().setMatnr(RandomUtil.randomNumbers(11)).setMaktx("非金属联件和紧固件等 M6 DIN 982 不锈钢304"));
|
||||
// }
|
||||
list.forEach(it -> {
|
||||
it.setLgort(order.getLgort());
|
||||
it.setUmlgo(order.getUmlgo());
|
||||
});
|
||||
Map<String, String> base = new HashMap<>();
|
||||
base.put("date", DateUtil.format(LocalDateTime.now(), "yyyy-MM-dd"));
|
||||
base.put("qrcode", QRCodeUtil.generateQRCodeBase64(order.getTicketNo(), 100, 100));
|
||||
base.put("qrcode", QRCodeUtil.generateQRCodeBase64(order.getNo(), 100, 100));
|
||||
Map<String, Object> variables = new HashMap<>();
|
||||
variables.put("info", order);
|
||||
variables.put("base", base);
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||
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.constant.STATE;
|
||||
import com.nflg.wms.common.pojo.ApiResult;
|
||||
import com.nflg.wms.common.pojo.dto.BinExcelExportDTO;
|
||||
|
|
@ -22,8 +23,10 @@ import com.nflg.wms.common.util.DateTimeUtil;
|
|||
import com.nflg.wms.common.util.EecExcelUtil;
|
||||
import com.nflg.wms.common.util.UserUtil;
|
||||
import com.nflg.wms.common.util.VUtil;
|
||||
import com.nflg.wms.repository.entity.DictionaryItem;
|
||||
import com.nflg.wms.repository.entity.WmsBin;
|
||||
import com.nflg.wms.repository.entity.WmsWarehouse;
|
||||
import com.nflg.wms.repository.service.IDictionaryItemService;
|
||||
import com.nflg.wms.repository.service.IWmsBinService;
|
||||
import com.nflg.wms.repository.service.IWmsWarehouseService;
|
||||
import com.nflg.wms.starter.service.FileUploadService;
|
||||
|
|
@ -62,6 +65,9 @@ public class BinControllerService {
|
|||
@Resource
|
||||
private FileUploadService fileUploadService;
|
||||
|
||||
@Resource
|
||||
private IDictionaryItemService dictionaryItemService;
|
||||
|
||||
public void add(@Valid BinAddQO request) {
|
||||
WmsBin bin = Convert.convert(WmsBin.class, request);
|
||||
bin.setCreateBy(UserUtil.getUserName());
|
||||
|
|
@ -114,16 +120,27 @@ public class BinControllerService {
|
|||
for (BinExcelImportDTO dto : data) {
|
||||
WmsBin bin = new WmsBin();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (StrUtil.isBlank(dto.getWarehouseNo())) {
|
||||
sb.append("仓库编号不能为空;");
|
||||
}else if(StrUtil.isBlank(dto.getNo())){
|
||||
sb.append("储位编号不能为空;");
|
||||
}
|
||||
else {
|
||||
WmsWarehouse warehouse=wmsWarehouseService.lambdaQuery().eq(WmsWarehouse::getNo, dto.getWarehouseNo()).one();
|
||||
if (Objects.isNull(warehouse)){
|
||||
sb.append("仓库编号无效;");
|
||||
String factoryNo = StrUtil.trim(dto.getFactoryNo());
|
||||
DictionaryItem factory = null;
|
||||
if (StrUtil.isBlank(dto.getFactoryNo())) {
|
||||
sb.append("工厂编号不能为空;");
|
||||
} else {
|
||||
factory = dictionaryItemService.getByCode(Constant.DICTIONARY_FACTORY, factoryNo);
|
||||
if (Objects.isNull(factory)) {
|
||||
sb.append("工厂编号无效;");
|
||||
}
|
||||
}
|
||||
String warehouseNo = StrUtil.trim(dto.getWarehouseNo());
|
||||
WmsWarehouse warehouse = null;
|
||||
if (StrUtil.isBlank(warehouseNo)) {
|
||||
sb.append("仓库编号不能为空;");
|
||||
} else if (Objects.nonNull(factory)) {
|
||||
warehouse = wmsWarehouseService.lambdaQuery().eq(WmsWarehouse::getFactoryId, factory.getId()).eq(WmsWarehouse::getNo, warehouseNo).one();
|
||||
}
|
||||
String binNos = StrUtil.trim(dto.getNo());
|
||||
if (StrUtil.isBlank(binNos)) {
|
||||
sb.append("储位编号不能为空;");
|
||||
} else if (Objects.nonNull(warehouse)) {
|
||||
bin = wmsBinService.lambdaQuery().eq(WmsBin::getNo, dto.getNo()).eq(WmsBin::getWarehouseId, warehouse.getId()).one();
|
||||
if (Objects.isNull(bin)) {
|
||||
bin = new WmsBin()
|
||||
|
|
@ -137,7 +154,6 @@ public class BinControllerService {
|
|||
bin.setUpdateTime(LocalDateTime.now());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (StrUtil.isBlank(dto.getName())){
|
||||
sb.append("仓库名称不能为空;");
|
||||
}else {
|
||||
|
|
@ -161,8 +177,10 @@ public class BinControllerService {
|
|||
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + URLEncoder.encode("储位导出.xlsx", StandardCharsets.UTF_8));
|
||||
if (CollectionUtil.isEmpty(datas)) {
|
||||
datas.add(new BinExcelExportDTO()
|
||||
.setNo("(必填)储位编号")
|
||||
.setName("(必填)储位名称")
|
||||
.setFactoryNo("(必填)工厂编号")
|
||||
.setWarehouseNo("(必填)库位编号")
|
||||
.setNo("(必填)仓位编号")
|
||||
.setName("(必填)仓位名称")
|
||||
.setRemark("备注信息,此行为提示信息,导入时请删除"));
|
||||
}
|
||||
new Workbook()
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ public class BomControllerService {
|
|||
sb.append("父级物料编号无效");
|
||||
} else {
|
||||
WmsBom pb = bomForSave.stream()
|
||||
.filter(it -> Objects.equals(it.getId(), 0L) && StrUtil.equals(it.getNo(), dto.getParentNo()))
|
||||
.filter(it -> Objects.equals(it.getParentId(), 0L) && StrUtil.equals(it.getNo(), dto.getParentNo()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (Objects.isNull(pb)) {
|
||||
|
|
@ -150,6 +150,7 @@ public class BomControllerService {
|
|||
if (Objects.isNull(pb)) {
|
||||
pb = new WmsBom()
|
||||
.setId(IdUtil.getSnowflakeNextId())
|
||||
.setParentId(0L)
|
||||
.setNo(dto.getParentNo())
|
||||
.setDrawingNo(pm.getDrawingNo())
|
||||
.setDescribe(pm.getMaterialDesc())
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import cn.hutool.core.util.IdUtil;
|
|||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.nflg.wms.common.constant.Constant;
|
||||
import com.nflg.wms.common.constant.STATE;
|
||||
import com.nflg.wms.common.pojo.ApiResult;
|
||||
import com.nflg.wms.common.pojo.dto.BomMaterialDTO;
|
||||
|
|
@ -20,12 +21,8 @@ import com.nflg.wms.common.util.DateTimeUtil;
|
|||
import com.nflg.wms.common.util.EecExcelUtil;
|
||||
import com.nflg.wms.common.util.UserUtil;
|
||||
import com.nflg.wms.common.util.VUtil;
|
||||
import com.nflg.wms.repository.entity.WmsBin;
|
||||
import com.nflg.wms.repository.entity.WmsStorage;
|
||||
import com.nflg.wms.repository.entity.WmsStorageBin;
|
||||
import com.nflg.wms.repository.service.IWmsBinService;
|
||||
import com.nflg.wms.repository.service.IWmsStorageBinService;
|
||||
import com.nflg.wms.repository.service.IWmsStorageService;
|
||||
import com.nflg.wms.repository.entity.*;
|
||||
import com.nflg.wms.repository.service.*;
|
||||
import com.nflg.wms.starter.service.BomMaterialService;
|
||||
import com.nflg.wms.starter.service.FileUploadService;
|
||||
import jakarta.annotation.Resource;
|
||||
|
|
@ -70,6 +67,12 @@ public class StorageControllerService {
|
|||
@Resource
|
||||
private IWmsBinService wmsBinService;
|
||||
|
||||
@Resource
|
||||
private IDictionaryItemService dictionaryItemService;
|
||||
|
||||
@Resource
|
||||
private IWmsWarehouseService warehouseService;
|
||||
|
||||
@Transactional
|
||||
public void add(@Valid StorageAddQO request) {
|
||||
WmsStorage storage = Convert.convert(WmsStorage.class, request);
|
||||
|
|
@ -116,7 +119,7 @@ public class StorageControllerService {
|
|||
|
||||
@Transactional
|
||||
public ApiResult importFromExcel(HttpServletResponse response, MultipartFile file) throws IOException {
|
||||
List<StorageExcelImportDTO> data = EecExcelUtil.getExcelContext(file.getInputStream(), StorageExcelImportDTO.class);
|
||||
List<StorageExcelExportDTO> data = EecExcelUtil.getExcelContext(file.getInputStream(), StorageExcelExportDTO.class);
|
||||
VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(data)).throwMessage("导入文件内容为空");
|
||||
if (updateCheckAndImport(data)) {
|
||||
return ApiResult.success();
|
||||
|
|
@ -135,10 +138,10 @@ public class StorageControllerService {
|
|||
}
|
||||
|
||||
@Transactional
|
||||
public boolean updateCheckAndImport(List<StorageExcelImportDTO> data) {
|
||||
public boolean updateCheckAndImport(List<StorageExcelExportDTO> data) {
|
||||
List<WmsStorage> storages = new ArrayList<>();
|
||||
List<WmsStorageBin> storageBinAll = new ArrayList<>();
|
||||
for (StorageExcelImportDTO dto : data) {
|
||||
for (StorageExcelExportDTO dto : data) {
|
||||
WmsStorage storage = new WmsStorage();
|
||||
List<WmsStorageBin> storageBins=new ArrayList<>();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
|
@ -164,15 +167,37 @@ public class StorageControllerService {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (StrUtil.isBlank(dto.getBinNos())) {
|
||||
sb.append("储位编号不能为空;");
|
||||
String factoryNo = StrUtil.trim(dto.getFactoryNo());
|
||||
DictionaryItem item = null;
|
||||
if (StrUtil.isBlank(factoryNo)) {
|
||||
sb.append("工厂编号不能为空;");
|
||||
} else {
|
||||
List<String> binNos = StrUtil.split(dto.getBinNos(), ",");
|
||||
List<WmsBin> bins = wmsBinService.lambdaQuery().in(WmsBin::getNo, binNos).list();
|
||||
item = dictionaryItemService.getByCode(Constant.DICTIONARY_FACTORY, factoryNo);
|
||||
if (Objects.isNull(item)) {
|
||||
sb.append("工厂编号无效;");
|
||||
}
|
||||
}
|
||||
String warehouseNo = StrUtil.trim(dto.getWarehouseNo());
|
||||
WmsWarehouse warehouse = null;
|
||||
if (StrUtil.isBlank(warehouseNo)) {
|
||||
sb.append("库位编号不能为空;");
|
||||
} else if (Objects.nonNull(item)) {
|
||||
warehouse = warehouseService.lambdaQuery().eq(WmsWarehouse::getFactoryId, item.getId()).eq(WmsWarehouse::getNo, warehouseNo).one();
|
||||
if (Objects.isNull(warehouse)) {
|
||||
sb.append("库位编号无效;");
|
||||
} else {
|
||||
storage.setWarehouseId(warehouse.getId());
|
||||
}
|
||||
}
|
||||
if (StrUtil.isBlank(dto.getBinNos())) {
|
||||
sb.append("仓位编号不能为空;");
|
||||
} else if (Objects.nonNull(warehouse)) {
|
||||
List<String> binNos = StrUtil.split(dto.getBinNos(), "/");
|
||||
List<WmsBin> bins = wmsBinService.lambdaQuery().eq(WmsBin::getWarehouseId, warehouse.getId()).in(WmsBin::getNo, binNos).list();
|
||||
List<String> bs = bins.stream().map(WmsBin::getNo).toList();
|
||||
binNos.removeAll(bs);
|
||||
if (CollectionUtil.isNotEmpty(binNos)) {
|
||||
sb.append(StrUtil.join(";", binNos));
|
||||
sb.append("仓位编号无效:").append(StrUtil.join("/", binNos)).append(";");
|
||||
}else {
|
||||
WmsStorage finalStorage = storage;
|
||||
storageBins = bins.stream().map(bin -> new WmsStorageBin()
|
||||
|
|
@ -197,12 +222,13 @@ public class StorageControllerService {
|
|||
|
||||
public void exportSelect(HttpServletResponse response, List<Long> ids) throws IOException {
|
||||
List<StorageVO> storageVOS = CollectionUtil.isNotEmpty(ids) ? storageService.getList(ids) : new ArrayList<>();
|
||||
List<StorageExcelExportDTO> datas = storageVOS.stream().map(bin -> Convert.convert(StorageExcelExportDTO.class, bin)).collect(Collectors.toList());
|
||||
List<StorageExcelImportDTO> datas = storageVOS.stream().map(bin -> Convert.convert(StorageExcelImportDTO.class, bin)).collect(Collectors.toList());
|
||||
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
||||
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + URLEncoder.encode("物料存储导出.xlsx", StandardCharsets.UTF_8));
|
||||
if (CollectionUtil.isEmpty(datas)) {
|
||||
datas.add(new StorageExcelExportDTO()
|
||||
datas.add(new StorageExcelImportDTO()
|
||||
.setMaterialNo("(必填)物料编号")
|
||||
.setFactoryNo("(必填)工厂编号")
|
||||
.setWarehouseNo("(必填)库位编号")
|
||||
.setBinNos("(必填)储位编号")
|
||||
.setRemark("备注信息,此行为提示信息,导入时请删除"));
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ public enum STATE {
|
|||
PassportErr(105, "用户校验失败"),
|
||||
LoginError(106, "请重新登录"),
|
||||
UploadError(107, "上传失败"),
|
||||
DataNoCheckPass(108, "数据不完整无法提交提交或审核,需显示问题数据"),
|
||||
DataNoCheckPass(108, "数据不完整无法提交或审核,需显示问题数据"),
|
||||
ServiceConnectRefused(109, "服务连接异常,请稍后重试"),
|
||||
AddressNotFound(110, "访问地址不存在,请稍后重试"),
|
||||
RouteServiceError(111, "请求服务异常,请稍后重试"),
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ import cn.hutool.core.util.StrUtil;
|
|||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.nflg.wms.common.util.BomUtil;
|
||||
import com.nflg.wms.common.util.DateTimeUtil;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Positive;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
|
|
@ -160,8 +162,10 @@ public class AllocationOrderDTO{
|
|||
private String ekgrp;
|
||||
|
||||
/**
|
||||
* 转储数量
|
||||
* 申请数量
|
||||
*/
|
||||
@NotNull
|
||||
@Positive(message = "申请数量必须大于0")
|
||||
private BigDecimal num;
|
||||
|
||||
public BigDecimal getNum() {
|
||||
|
|
|
|||
|
|
@ -9,21 +9,28 @@ import org.ttzero.excel.annotation.ExcelColumn;
|
|||
public class BinExcelExportDTO {
|
||||
|
||||
/**
|
||||
* 仓库编码
|
||||
* *工厂编号
|
||||
*/
|
||||
@ExcelColumn("*仓库编码")
|
||||
@ExcelColumn("*工厂编号")
|
||||
private String factoryNo;
|
||||
|
||||
|
||||
/**
|
||||
* *库位编号
|
||||
*/
|
||||
@ExcelColumn("*库位编号")
|
||||
private String warehouseNo;
|
||||
|
||||
/**
|
||||
* 储位编码
|
||||
* *仓位编号
|
||||
*/
|
||||
@ExcelColumn("*储位编码")
|
||||
@ExcelColumn("*仓位编号")
|
||||
private String no;
|
||||
|
||||
/**
|
||||
* 储位名称
|
||||
* 仓位名称
|
||||
*/
|
||||
@ExcelColumn("*储位名称")
|
||||
@ExcelColumn("*仓位名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -4,35 +4,11 @@ import lombok.Data;
|
|||
import org.ttzero.excel.annotation.ExcelColumn;
|
||||
|
||||
@Data
|
||||
public class BinExcelImportDTO {
|
||||
|
||||
/**
|
||||
* 仓库编码
|
||||
*/
|
||||
@ExcelColumn("*仓库编码")
|
||||
private String warehouseNo;
|
||||
|
||||
/**
|
||||
* 储位编码
|
||||
*/
|
||||
@ExcelColumn("*储位编码")
|
||||
private String no;
|
||||
|
||||
/**
|
||||
* 储位名称
|
||||
*/
|
||||
@ExcelColumn("*储位名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelColumn("备注")
|
||||
private String remark;
|
||||
public class BinExcelImportDTO extends BinExcelExportDTO {
|
||||
|
||||
/**
|
||||
* 错误信息
|
||||
*/
|
||||
@ExcelColumn("错误信息")
|
||||
@ExcelColumn(value = "错误信息", colIndex = 5)
|
||||
private String error;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ package com.nflg.wms.common.pojo.dto;
|
|||
import cn.hutool.core.util.StrUtil;
|
||||
import com.nflg.wms.common.util.BomUtil;
|
||||
import com.nflg.wms.common.util.DateTimeUtil;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Positive;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
|
|
@ -142,6 +144,8 @@ public class DepartmentMaterialRequisitionDTO {
|
|||
/**
|
||||
* 领料数量
|
||||
*/
|
||||
@NotNull
|
||||
@Positive(message = "领料数量必须大于0")
|
||||
private BigDecimal num;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ import cn.hutool.core.util.StrUtil;
|
|||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.nflg.wms.common.util.BomUtil;
|
||||
import com.nflg.wms.common.util.DateTimeUtil;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Positive;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
|
|
@ -104,6 +106,8 @@ public class DepartmentMaterialReturnSlipDTO {
|
|||
/**
|
||||
* 退料数量
|
||||
*/
|
||||
@NotNull
|
||||
@Positive(message = "退料数量必须大于0")
|
||||
private BigDecimal num;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -6,29 +6,11 @@ import org.ttzero.excel.annotation.ExcelColumn;
|
|||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class StorageExcelExportDTO {
|
||||
public class StorageExcelExportDTO extends StorageExcelImportDTO {
|
||||
|
||||
/**
|
||||
* 物料编号
|
||||
* 错误信息
|
||||
*/
|
||||
@ExcelColumn("物料编号")
|
||||
private String materialNo;
|
||||
|
||||
/**
|
||||
* 库位编号
|
||||
*/
|
||||
@ExcelColumn("库位编号")
|
||||
private String warehouseNo;
|
||||
|
||||
/**
|
||||
* 储位编号
|
||||
*/
|
||||
@ExcelColumn("储位编号")
|
||||
private String binNos;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelColumn("备注")
|
||||
private String remark;
|
||||
@ExcelColumn(value = "错误信息", colIndex = 5)
|
||||
private String error;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
package com.nflg.wms.common.pojo.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.ttzero.excel.annotation.ExcelColumn;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class StorageExcelImportDTO {
|
||||
|
||||
/**
|
||||
|
|
@ -13,9 +15,21 @@ public class StorageExcelImportDTO {
|
|||
private String materialNo;
|
||||
|
||||
/**
|
||||
* 储位编号
|
||||
* 工厂编号
|
||||
*/
|
||||
@ExcelColumn("*储位编号")
|
||||
@ExcelColumn("*工厂编号")
|
||||
private String factoryNo;
|
||||
|
||||
/**
|
||||
* 库位编号
|
||||
*/
|
||||
@ExcelColumn("*库位编号")
|
||||
private String warehouseNo;
|
||||
|
||||
/**
|
||||
* 仓位编号
|
||||
*/
|
||||
@ExcelColumn("*仓位编号")
|
||||
private String binNos;
|
||||
|
||||
/**
|
||||
|
|
@ -23,10 +37,4 @@ public class StorageExcelImportDTO {
|
|||
*/
|
||||
@ExcelColumn("备注")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 错误信息
|
||||
*/
|
||||
@ExcelColumn("错误信息")
|
||||
private String error;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ package com.nflg.wms.common.pojo.dto;
|
|||
|
||||
import com.nflg.wms.common.util.BomUtil;
|
||||
import com.nflg.wms.common.util.DateTimeUtil;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Positive;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
|
|
@ -147,6 +149,8 @@ public class SubcontractedOrderDTO {
|
|||
/**
|
||||
* 领料数量
|
||||
*/
|
||||
@NotNull
|
||||
@Positive(message = "领料数量必须大于0")
|
||||
private BigDecimal num;
|
||||
|
||||
private String key;
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ import cn.hutool.core.util.StrUtil;
|
|||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.nflg.wms.common.util.BomUtil;
|
||||
import com.nflg.wms.common.util.DateTimeUtil;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Positive;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
|
|
@ -151,6 +153,8 @@ public class TransferOrderDTO {
|
|||
/**
|
||||
* 调库数量
|
||||
*/
|
||||
@NotNull
|
||||
@Positive(message = "调库数量必须大于0")
|
||||
private BigDecimal num;
|
||||
|
||||
@JsonIgnore
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
package com.nflg.wms.common.pojo.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ZWM3A02QO {
|
||||
|
||||
/**
|
||||
* 工厂
|
||||
*/
|
||||
private String werks;
|
||||
|
||||
/**
|
||||
* 物料号
|
||||
*/
|
||||
private String matnr;
|
||||
|
||||
/**
|
||||
* 库存地点
|
||||
*/
|
||||
private String lgort;
|
||||
|
||||
/**
|
||||
* 库存仓位
|
||||
*/
|
||||
private String lgpbe;
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ package com.nflg.wms.common.pojo.qo;
|
|||
|
||||
import com.nflg.wms.common.pojo.dto.ZWM00MB007DTO;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Positive;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
|
|
@ -21,5 +22,6 @@ public class InProduceOrderGenerateMaterialsQO extends ZWM00MB007DTO {
|
|||
* 收货数量
|
||||
*/
|
||||
@NotNull
|
||||
@Positive(message = "收货数量必须大于0")
|
||||
private BigDecimal num;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.nflg.wms.common.pojo.qo;
|
|||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Positive;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
|
@ -19,5 +20,6 @@ public class QRCodeQO1 {
|
|||
* 数量
|
||||
*/
|
||||
@NotNull
|
||||
@Positive(message = "数量必须大于0")
|
||||
private BigDecimal num;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.nflg.wms.common.pojo.qo;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
|
@ -11,11 +12,22 @@ import java.util.List;
|
|||
@Accessors(chain = true)
|
||||
public class StorageAddQO {
|
||||
|
||||
// /**
|
||||
// * 物料id
|
||||
// */
|
||||
// @NotNull
|
||||
// private Long materialId;
|
||||
|
||||
/**
|
||||
* 物料id
|
||||
* 物料编号
|
||||
*/
|
||||
@NotNull
|
||||
private Long materialId;
|
||||
@NotBlank
|
||||
private String materialNo;
|
||||
|
||||
/**
|
||||
* 物料描述
|
||||
*/
|
||||
private String materialDesc;
|
||||
|
||||
/**
|
||||
* 仓库ID
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import cn.hutool.core.util.StrUtil;
|
|||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.nflg.wms.common.pojo.qo.QRCodeQO1;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Positive;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
|
@ -62,6 +63,7 @@ public class ZWM3A05ItemVO {
|
|||
* 退货数量
|
||||
*/
|
||||
@NotNull
|
||||
@Positive(message = "退货数量必须大于0")
|
||||
private BigDecimal temng;
|
||||
|
||||
/**
|
||||
|
|
@ -73,7 +75,6 @@ public class ZWM3A05ItemVO {
|
|||
* 基本计量单位
|
||||
*/
|
||||
private String meins;
|
||||
|
||||
/**
|
||||
* 库存地点
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
package com.nflg.wms.common.pojo.vo;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
|
|
@ -24,8 +26,10 @@ public class ZWM3A05VO {
|
|||
/**
|
||||
* 工厂
|
||||
*/
|
||||
@NotBlank
|
||||
private String werks;
|
||||
|
||||
@Valid
|
||||
@NotEmpty
|
||||
private List<ZWM3A05ItemVO> items = new ArrayList<>();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ import cn.hutool.core.util.StrUtil;
|
|||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.nflg.wms.common.util.BomUtil;
|
||||
import com.nflg.wms.common.util.DateTimeUtil;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Positive;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
|
|
@ -56,6 +58,8 @@ public class Zwm3a07VO {
|
|||
private BigDecimal qlsl;
|
||||
|
||||
//申请数量
|
||||
@NotNull
|
||||
@Positive(message = "申请数量必须大于0")
|
||||
private BigDecimal sqsl;
|
||||
|
||||
//领料物料号
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ package com.nflg.wms.common.pojo.vo;
|
|||
import cn.hutool.core.util.StrUtil;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.nflg.wms.common.util.BomUtil;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Positive;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
|
|
@ -56,6 +58,8 @@ public class Zwm3a09VO {
|
|||
private BigDecimal qlsl;
|
||||
|
||||
//申请数量
|
||||
@NotNull
|
||||
@Positive(message = "申请数量必须大于0")
|
||||
private BigDecimal sqsl;
|
||||
|
||||
//领料物料号
|
||||
|
|
|
|||
|
|
@ -93,7 +93,6 @@ public class WmsBomServiceImpl extends ServiceImpl<WmsBomMapper, WmsBom> impleme
|
|||
List<WmsBom> boms = lambdaQuery()
|
||||
.like(StrUtil.isNotBlank(request.getNo()), WmsBom::getNo, request.getNo())
|
||||
.like(StrUtil.isNotBlank(request.getDescribe()), WmsBom::getDescribe, request.getDescribe())
|
||||
.orderByDesc(WmsBom::getId)
|
||||
.list();
|
||||
Set<Long> parentIds = boms.stream().map(WmsBom::getParentId).filter(parentId -> !Objects.equals(parentId, 0L)).collect(Collectors.toSet());
|
||||
if (CollectionUtil.isNotEmpty(parentIds)) {
|
||||
|
|
@ -125,6 +124,7 @@ public class WmsBomServiceImpl extends ServiceImpl<WmsBomMapper, WmsBom> impleme
|
|||
.toList()
|
||||
)
|
||||
)
|
||||
.sorted(Comparator.comparing(BomMaterialVO::getId).reversed())
|
||||
.toList();
|
||||
all.forEach(it -> {
|
||||
if (CollectionUtil.isEmpty(it.getChildren())) {
|
||||
|
|
|
|||
|
|
@ -3,8 +3,9 @@
|
|||
<mapper namespace="com.nflg.wms.repository.mapper.WmsOutProduceTicketItemMapper">
|
||||
|
||||
<select id="getList" resultType="com.nflg.wms.common.pojo.vo.OutProduceInfoItemVO">
|
||||
SELECT opti.id,opti.num AS "out_num",opi.*
|
||||
SELECT opti.id,opti.num,opt.lgort as "lgort2",opi.*
|
||||
FROM wms_out_produce_ticket_item opti
|
||||
inner join wms_out_produce_ticket opt ON opti.ticket_id=opt."id"
|
||||
INNER JOIN wms_out_produce_item opi ON opti.produce_item_id=opi."id"
|
||||
WHERE opti.ticket_id=#{id}
|
||||
order by opti.id desc
|
||||
|
|
|
|||
|
|
@ -177,6 +177,7 @@ public class SyncStorageFromSAPProcessor implements BasicProcessor {
|
|||
.setMaterialNo(dto.getMaterialNo())
|
||||
.setWarehouseId(dbWarehouse.getId())
|
||||
.setMaterialDesc(dto.getMaterialDesc())
|
||||
.setSapState((short) 1)
|
||||
.setRemark("从SAP同步")
|
||||
.setCreateBy("SAP同步")
|
||||
.setCreateTime(LocalDateTime.now());
|
||||
|
|
|
|||
|
|
@ -4,7 +4,9 @@ import cn.hutool.core.collection.CollectionUtil;
|
|||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.nflg.wms.common.pojo.dto.SAPSyncFromDTO;
|
||||
import com.nflg.wms.common.pojo.dto.ZWM3A02QO;
|
||||
import com.nflg.wms.common.util.VUtil;
|
||||
import com.nflg.wms.scheduled.util.JCoUtil;
|
||||
import com.sap.conn.jco.*;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
|
@ -30,13 +32,18 @@ public class SapService {
|
|||
* @param binNos 储位编号列表
|
||||
*/
|
||||
public void saveStorage(String factory,String materialNo,String warehouseNo,List<String> binNos) throws JCoException {
|
||||
Map<String, Object> parameters = new HashMap<>();
|
||||
parameters.put("WERKS", factory);
|
||||
parameters.put("MATNR", materialNo);
|
||||
parameters.put("LGORT", warehouseNo);
|
||||
parameters.put("LGPBE", StrUtil.join("/",binNos));
|
||||
List<ZWM3A02QO> qos = new ArrayList<>();
|
||||
qos.add(new ZWM3A02QO()
|
||||
.setWerks(factory)
|
||||
.setMatnr(materialNo)
|
||||
.setLgort(warehouseNo)
|
||||
.setLgpbe(StrUtil.join("/", binNos))
|
||||
);
|
||||
|
||||
JCoTable tOut = exec("ZWM3A02", parameters);
|
||||
Map<String, List<Map<String, Object>>> tables = new HashMap<>();
|
||||
tables.put("T_OUT", JCoUtil.toMapList(qos));
|
||||
|
||||
JCoTable tOut = exec1("ZWM3A02", tables);
|
||||
|
||||
if (tOut.getNumRows() > 0){
|
||||
tOut.setRow(0);
|
||||
|
|
@ -95,6 +102,10 @@ public class SapService {
|
|||
return exec(functionName, parameters, null);
|
||||
}
|
||||
|
||||
private JCoTable exec1(String functionName, Map<String, List<Map<String, Object>>> tables) throws JCoException {
|
||||
return exec(functionName, null, tables);
|
||||
}
|
||||
|
||||
private JCoTable exec(String functionName, Map<String, Object> parameters, Map<String, List<Map<String, Object>>> tables) throws JCoException {
|
||||
JCoFunction function = repository.getFunction(functionName);
|
||||
log.info("SAP ImportParameter:{}", JSONUtil.toJsonStr(parameters));
|
||||
|
|
@ -114,7 +125,7 @@ public class SapService {
|
|||
}
|
||||
function.execute(destination);
|
||||
JCoTable out = function.getTableParameterList().getTable("T_OUT");
|
||||
log.trace("SAP返回: {}", out);
|
||||
log.info("SAP返回: {}", out);
|
||||
return out;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,103 @@
|
|||
package com.nflg.wms.scheduled.util;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.MapperFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.json.JsonMapper;
|
||||
import com.nflg.wms.common.util.BeanUtil;
|
||||
import com.sap.conn.jco.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class JCoUtil {
|
||||
|
||||
private static final ObjectMapper MAPPER = JsonMapper.builder()
|
||||
.enable(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES)
|
||||
.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
|
||||
.build();
|
||||
|
||||
/**
|
||||
* 将 JCoTable 转换为 Java Bean 列表
|
||||
* @param table JCoTable 对象
|
||||
* @param clazz 目标实体类
|
||||
* @param <T> 泛型
|
||||
* @return List<T> 列表
|
||||
*/
|
||||
public static <T> List<T> toBeanList(JCoTable table, Class<T> clazz) {
|
||||
List<Map<String, Object>> mapList = toMapList(table);
|
||||
List<T> resultList = new ArrayList<>(mapList.size());
|
||||
for (Map<String, Object> map : mapList) {
|
||||
resultList.add(MAPPER.convertValue(map, clazz));
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
public static List<Map<String, Object>> toMapList(JCoTable table) {
|
||||
if (CollectionUtil.isEmpty(table) || table.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<Map<String, Object>> mapList = new ArrayList<>();
|
||||
JCoRecordMetaData meta = table.getRecordMetaData();
|
||||
table.firstRow();
|
||||
do {
|
||||
Map<String, Object> rowMap = new HashMap<>();
|
||||
for (int i = 0; i < meta.getFieldCount(); i++) {
|
||||
rowMap.put(meta.getName(i), table.getField(i).getValue());
|
||||
}
|
||||
mapList.add(rowMap);
|
||||
} while (table.nextRow());
|
||||
return mapList;
|
||||
}
|
||||
|
||||
public static <T> List<Map<String, Object>> toMapList(List<T> datas) {
|
||||
return datas.stream().map(BeanUtil::toMap)
|
||||
.map(list -> list.entrySet().stream()
|
||||
.collect(Collectors.toMap(entry -> entry.getKey().toUpperCase(),
|
||||
Map.Entry::getValue)))
|
||||
.toList();
|
||||
}
|
||||
|
||||
public static <T> List<Map<String, Object>> toMapList(T data) {
|
||||
return Collections.singletonList(BeanUtil.toMap(data));
|
||||
}
|
||||
|
||||
/**
|
||||
* 将 JCoStructure 转换为 Java Bean
|
||||
* @param structure JCoStructure 对象
|
||||
* @param clazz 目标实体类
|
||||
* @param <T> 泛型
|
||||
* @return T 实体对象
|
||||
*/
|
||||
public static <T> T toBean(JCoStructure structure, Class<T> clazz) {
|
||||
if (Objects.isNull(structure)) {
|
||||
return null;
|
||||
}
|
||||
JCoRecordMetaData meta = structure.getRecordMetaData();
|
||||
Map<String, Object> rowMap = new HashMap<>();
|
||||
for (int i = 0; i < meta.getFieldCount(); i++) {
|
||||
rowMap.put(meta.getName(i), structure.getField(i).getValue());
|
||||
}
|
||||
return MAPPER.convertValue(rowMap, clazz);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将 JCoParameterList 转换为 Java Bean
|
||||
* @param parameters JCoParameterList 对象
|
||||
* @param clazz 目标实体类
|
||||
* @param <T> 泛型
|
||||
* @return T 实体对象
|
||||
*/
|
||||
public static <T> T toBean(JCoParameterList parameters, Class<T> clazz) {
|
||||
if (Objects.isNull(parameters)) {
|
||||
return null;
|
||||
}
|
||||
JCoListMetaData meta = parameters.getListMetaData();
|
||||
Map<String, Object> rowMap = new HashMap<>();
|
||||
for (int i = 0; i < meta.getFieldCount(); i++) {
|
||||
rowMap.put(meta.getName(i), parameters.getField(i).getValue());
|
||||
}
|
||||
return MAPPER.convertValue(rowMap, clazz);
|
||||
}
|
||||
}
|
||||
|
|
@ -35,8 +35,8 @@ public class DeployTest {
|
|||
sshUtil.connect("192.168.163.84", 22, "root", "CMP2025nf");
|
||||
//处理主jar包
|
||||
handleFile(sshUtil, localPath + jarName, remotePath + jarName);
|
||||
//处理lib目录
|
||||
handleDir(sshUtil, localPath, remotePath, "lib");
|
||||
// //处理lib目录
|
||||
// handleDir(sshUtil, localPath, remotePath, "lib");
|
||||
//执行脚本启动服务
|
||||
sshUtil.exec("cd " + remotePath + " && ./restart.sh");
|
||||
sshUtil.disconnect();
|
||||
|
|
|
|||
Loading…
Reference in New Issue