Compare commits
No commits in common. "1207038de8a8a8f5b89380dea413a84f226d1f0f" and "39a8bbac58281053a8134b4474436b642b45f2e7" have entirely different histories.
1207038de8
...
39a8bbac58
|
|
@ -1,6 +1,5 @@
|
||||||
package com.nflg.wms.admin;
|
package com.nflg.wms.admin;
|
||||||
|
|
||||||
import cn.dev33.satoken.sso.SaSsoManager;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
@ -20,8 +19,15 @@ public class AdminApplication {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(AdminApplication.class, args);
|
SpringApplication.run(AdminApplication.class, args);
|
||||||
log.info("服务已启动");
|
log.info("服务已启动");
|
||||||
log.info("---------------------- Sa-Token SSO 模式二 Client 端启动成功 ----------------------");
|
// log.info("---------------------- Sa-Token SSO 模式二 Client 端启动成功 ----------------------");
|
||||||
log.info("配置信息:" + SaSsoManager.getClientConfig());
|
// 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")));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,13 +1,10 @@
|
||||||
package com.nflg.wms.admin.controller;
|
package com.nflg.wms.admin.controller;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import com.nflg.wms.admin.service.BinService;
|
import com.nflg.wms.admin.service.BinService;
|
||||||
import com.nflg.wms.admin.service.SapService;
|
import com.nflg.wms.admin.service.SapService;
|
||||||
import com.nflg.wms.admin.util.NoUtil;
|
import com.nflg.wms.admin.util.NoUtil;
|
||||||
import com.nflg.wms.common.pojo.ApiResult;
|
import com.nflg.wms.common.pojo.ApiResult;
|
||||||
import com.nflg.wms.common.pojo.PageData;
|
import com.nflg.wms.common.pojo.PageData;
|
||||||
import com.nflg.wms.common.pojo.dto.InventoryDTO;
|
|
||||||
import com.nflg.wms.common.pojo.dto.Zim001QueryResultDTO;
|
import com.nflg.wms.common.pojo.dto.Zim001QueryResultDTO;
|
||||||
import com.nflg.wms.common.pojo.dto.Zim001QueryResultItem1DTO;
|
import com.nflg.wms.common.pojo.dto.Zim001QueryResultItem1DTO;
|
||||||
import com.nflg.wms.common.pojo.qo.OutPurchaseSearchQO;
|
import com.nflg.wms.common.pojo.qo.OutPurchaseSearchQO;
|
||||||
|
|
@ -16,7 +13,6 @@ import com.nflg.wms.common.util.UserUtil;
|
||||||
import com.nflg.wms.common.util.VUtil;
|
import com.nflg.wms.common.util.VUtil;
|
||||||
import com.nflg.wms.repository.entity.WmsOutPurchase;
|
import com.nflg.wms.repository.entity.WmsOutPurchase;
|
||||||
import com.nflg.wms.repository.entity.WmsOutPurchaseItem;
|
import com.nflg.wms.repository.entity.WmsOutPurchaseItem;
|
||||||
import com.nflg.wms.repository.service.IWmsInventoryService;
|
|
||||||
import com.nflg.wms.repository.service.IWmsOutPurchaseItemService;
|
import com.nflg.wms.repository.service.IWmsOutPurchaseItemService;
|
||||||
import com.nflg.wms.repository.service.IWmsOutPurchaseService;
|
import com.nflg.wms.repository.service.IWmsOutPurchaseService;
|
||||||
import com.nflg.wms.starter.BaseController;
|
import com.nflg.wms.starter.BaseController;
|
||||||
|
|
@ -27,7 +23,6 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
@ -50,9 +45,6 @@ public class OutPurchaseController extends BaseController {
|
||||||
@Resource
|
@Resource
|
||||||
private BinService binService;
|
private BinService binService;
|
||||||
|
|
||||||
@Resource
|
|
||||||
IWmsInventoryService inventoryService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取采购退库信息
|
* 获取采购退库信息
|
||||||
* @param orderNo 采购单号
|
* @param orderNo 采购单号
|
||||||
|
|
@ -86,14 +78,7 @@ public class OutPurchaseController extends BaseController {
|
||||||
.setCreateTime(LocalDateTime.now());
|
.setCreateTime(LocalDateTime.now());
|
||||||
//TODO 设置供应商信息
|
//TODO 设置供应商信息
|
||||||
outPurchaseService.save(purchase);
|
outPurchaseService.save(purchase);
|
||||||
List<InventoryDTO> inventories = new ArrayList<>();
|
outPurchaseItemService.saveBatch(request.getItem1().parallelStream().map(it -> new WmsOutPurchaseItem()
|
||||||
List<String> errors = new ArrayList<>();
|
|
||||||
outPurchaseItemService.saveBatch(request.getItem1().parallelStream().map(it -> {
|
|
||||||
String batchNo = CollectionUtil.get(StrUtil.split(it.getQrCode(), ","), 7);
|
|
||||||
if (StrUtil.isBlank(batchNo) || !StrUtil.equals(batchNo, it.getCHARG())) {
|
|
||||||
errors.add(it.getMATNR());
|
|
||||||
}
|
|
||||||
WmsOutPurchaseItem purchaseItem = new WmsOutPurchaseItem()
|
|
||||||
.setPurchaseId(purchase.getId())
|
.setPurchaseId(purchase.getId())
|
||||||
.setRowNo(it.getEBELP())
|
.setRowNo(it.getEBELP())
|
||||||
.setMaterialNo(it.getMATNR())
|
.setMaterialNo(it.getMATNR())
|
||||||
|
|
@ -105,20 +90,7 @@ public class OutPurchaseController extends BaseController {
|
||||||
.setWarehouseNo(it.getLGORT())
|
.setWarehouseNo(it.getLGORT())
|
||||||
.set_101Year(it.getLFBJA())
|
.set_101Year(it.getLFBJA())
|
||||||
.set_101No(it.getLFBNR())
|
.set_101No(it.getLFBNR())
|
||||||
.set_101Project(it.getLFPOS());
|
.set_101Project(it.getLFPOS())).toList());
|
||||||
inventories.add(new InventoryDTO()
|
|
||||||
.setMaterialNo(it.getMATNR())
|
|
||||||
.setFactoryNo(it.getWERKS())
|
|
||||||
.setWarehouseNo(it.getLGORT())
|
|
||||||
.setBatchNumber(it.getCHARG())
|
|
||||||
.setNum(it.getERFMG().negate())
|
|
||||||
);
|
|
||||||
return purchaseItem;
|
|
||||||
}).toList()
|
|
||||||
);
|
|
||||||
VUtil.trueThrowBusinessError(CollectionUtil.isNotEmpty(errors)).throwMessage("以下物料的批次号不符合要求:"+StrUtil.join(",",errors));
|
|
||||||
//扣减库存
|
|
||||||
inventoryService.out(inventories);
|
|
||||||
sapService.zim001(request);
|
sapService.zim001(request);
|
||||||
return ApiResult.success();
|
return ApiResult.success();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,10 @@ import com.nflg.wms.common.constant.Constant;
|
||||||
import com.nflg.wms.common.constant.STATE;
|
import com.nflg.wms.common.constant.STATE;
|
||||||
import com.nflg.wms.common.exception.NflgException;
|
import com.nflg.wms.common.exception.NflgException;
|
||||||
import com.nflg.wms.common.pojo.dto.*;
|
import com.nflg.wms.common.pojo.dto.*;
|
||||||
import com.nflg.wms.common.pojo.qo.*;
|
import com.nflg.wms.common.pojo.qo.C_MaterialOutboundQO;
|
||||||
|
import com.nflg.wms.common.pojo.qo.C_MaterialReturnItemQO;
|
||||||
|
import com.nflg.wms.common.pojo.qo.C_MaterialReturnQO;
|
||||||
|
import com.nflg.wms.common.pojo.qo.ScanCodeQO;
|
||||||
import com.nflg.wms.common.util.UserUtil;
|
import com.nflg.wms.common.util.UserUtil;
|
||||||
import com.nflg.wms.common.util.VUtil;
|
import com.nflg.wms.common.util.VUtil;
|
||||||
import com.sap.conn.jco.*;
|
import com.sap.conn.jco.*;
|
||||||
|
|
@ -33,75 +36,6 @@ public class SapService {
|
||||||
@Resource
|
@Resource
|
||||||
private JCoRepository repository;
|
private JCoRepository repository;
|
||||||
|
|
||||||
/**
|
|
||||||
* 生产订单查询
|
|
||||||
* @param no 生产订单号
|
|
||||||
*/
|
|
||||||
public ZWM00MB007DTO zwm00Mb007(String no){
|
|
||||||
Map<String, Object> parameters = new HashMap<>();
|
|
||||||
parameters.put("I_AUFNR", no);
|
|
||||||
|
|
||||||
JCoFunction function = exec("ZWM00_MB007", parameters);
|
|
||||||
|
|
||||||
JCoStructure sreturn = function.getExportParameterList().getStructure("E_RETURN");
|
|
||||||
VUtil.trueThrowBusinessError(!StrUtil.equals(sreturn.getString("TYPE"), "S"))
|
|
||||||
.throwMessage("SAP错误:" + sreturn.getString("MSG"));
|
|
||||||
|
|
||||||
JCoStructure data = function.getExportParameterList().getStructure("E_OUTPUT");
|
|
||||||
return new ZWM00MB007DTO()
|
|
||||||
.setAUFNR(data.getString("AUFNR"))
|
|
||||||
.setPSMNG(data.getBigDecimal("PSMNG"))
|
|
||||||
.setPWERK(data.getString("PWERK"))
|
|
||||||
.setWEMNG(data.getBigDecimal("WEMNG"))
|
|
||||||
.setMATNR(data.getString("MATNR"))
|
|
||||||
.setWSHSL(data.getBigDecimal("WSHSL"))
|
|
||||||
.setLGORT(data.getString("LGORT"))
|
|
||||||
.setMEINS(data.getString("MEINS"))
|
|
||||||
.setMAKTX(data.getString("MAKTX"));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 生产订单收货
|
|
||||||
* @param no 生产订单号
|
|
||||||
* @param userName 用户名
|
|
||||||
* @param materials 入库物料列表
|
|
||||||
* @param sernrs 序列号列表
|
|
||||||
*/
|
|
||||||
public Zwm00Mb107DTO zwm00_mb107(String no, String userName, List<Zwm00Mb107QO> materials, List<String> sernrs){
|
|
||||||
Map<String, Object> parameters = new HashMap<>();
|
|
||||||
parameters.put("I_AUFNR", no);
|
|
||||||
parameters.put("I_USNAM", userName);
|
|
||||||
|
|
||||||
Map<String, List<Map<String, Object>>> tables = new HashMap<>();
|
|
||||||
List<Map<String, Object>> list1 = new ArrayList<>();
|
|
||||||
materials.forEach(item -> {
|
|
||||||
Map<String, Object> map=new HashMap<>();
|
|
||||||
map.put("PWERK", item.getPWERK());
|
|
||||||
map.put("LGORT", item.getLGORT());
|
|
||||||
map.put("PSMNG", item.getPSMNG());
|
|
||||||
map.put("AMEIN", item.getAMEIN());
|
|
||||||
map.put("CHARG", item.getCHARG());
|
|
||||||
list1.add(map);
|
|
||||||
});
|
|
||||||
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);
|
|
||||||
|
|
||||||
JCoFunction function = exec("ZWM00_MB107", parameters, tables);
|
|
||||||
|
|
||||||
JCoStructure sreturn = function.getExportParameterList().getStructure("E_RETURN");
|
|
||||||
VUtil.trueThrowBusinessError(!StrUtil.equals(sreturn.getString("TYPE"), "S"))
|
|
||||||
.throwMessage("SAP错误:" + sreturn.getString("MSG"));
|
|
||||||
|
|
||||||
return new Zwm00Mb107DTO()
|
|
||||||
.setE_MBLNR(function.getExportParameterList().getString("E_MBLNR"))
|
|
||||||
.setE_MJAHR(function.getExportParameterList().getString("E_MJAHR"));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询采购单退库信息
|
* 查询采购单退库信息
|
||||||
* @param orderNo 采购单号
|
* @param orderNo 采购单号
|
||||||
|
|
@ -544,10 +478,6 @@ public class SapService {
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
private JCoFunction exec(String functionName, Map<String, Object> parameters) {
|
|
||||||
return exec(functionName, parameters, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
private JCoFunction exec(String functionName, Map<String, Object> parameters, Map<String, List<Map<String, Object>>> tables) {
|
private JCoFunction exec(String functionName, Map<String, Object> parameters, Map<String, List<Map<String, Object>>> tables) {
|
||||||
try {
|
try {
|
||||||
functionName=functionName.toUpperCase();
|
functionName=functionName.toUpperCase();
|
||||||
|
|
@ -579,15 +509,11 @@ public class SapService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void printMeta(String functionName) {
|
public void printMeta(String functionName) throws JCoException {
|
||||||
try {
|
|
||||||
functionName=functionName.toUpperCase();
|
functionName=functionName.toUpperCase();
|
||||||
JCoFunction function = repository.getFunction(functionName);
|
JCoFunction function = repository.getFunction(functionName);
|
||||||
VUtil.trueThrowBusinessError(Objects.isNull(function)).throwMessage("方法"+functionName+"不存在");
|
VUtil.trueThrowBusinessError(Objects.isNull(function)).throwMessage("方法"+functionName+"不存在");
|
||||||
printMeta(function);
|
printMeta(function);
|
||||||
}catch (Exception e){
|
|
||||||
log.error("打印方法参数信息异常", e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void printMeta(JCoFunction function){
|
private void printMeta(JCoFunction function){
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,9 @@ logging:
|
||||||
nflg: debug
|
nflg: debug
|
||||||
alibaba:
|
alibaba:
|
||||||
cloud:
|
cloud:
|
||||||
nacos: info
|
nacos: debug
|
||||||
org:
|
org:
|
||||||
springframework: info
|
springframework: debug
|
||||||
# sa-token配置
|
# sa-token配置
|
||||||
sa-token:
|
sa-token:
|
||||||
# SSO-相关配置
|
# SSO-相关配置
|
||||||
|
|
@ -73,33 +73,22 @@
|
||||||
<message>
|
<message>
|
||||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId}] %-5level %logger{50} - %msg %ex</pattern>
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId}] %-5level %logger{50} - %msg %ex</pattern>
|
||||||
</message>
|
</message>
|
||||||
<verbose>false</verbose>
|
|
||||||
</appender>
|
|
||||||
<appender name="ASYNC_LOKI" class="ch.qos.logback.classic.AsyncAppender">
|
|
||||||
<appender-ref ref="LOKI" />
|
|
||||||
<!-- 队列大小 -->
|
|
||||||
<queueSize>1024</queueSize>
|
|
||||||
<!-- 丢弃策略 -->
|
|
||||||
<discardingThreshold>0</discardingThreshold>
|
|
||||||
<!-- 关键:即使队列满也不阻塞 -->
|
|
||||||
<neverBlock>true</neverBlock>
|
|
||||||
<includeCallerData>false</includeCallerData>
|
|
||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
<logger name="com.alibaba.nacos" level="warn" additivity="false">
|
<logger name="com.alibaba.nacos" level="warn" additivity="false">
|
||||||
<!-- <appender-ref ref="FILE"/>-->
|
<!-- <appender-ref ref="FILE"/>-->
|
||||||
<appender-ref ref="ASYNC_LOKI"/>
|
<appender-ref ref="LOKI"/>
|
||||||
</logger>
|
</logger>
|
||||||
|
|
||||||
<logger name="tech.powerjob" level="INFO" additivity="false">
|
<logger name="tech.powerjob" level="INFO" additivity="false">
|
||||||
<!-- <appender-ref ref="POWERJOB_WORKER_APPENDER" />-->
|
<!-- <appender-ref ref="POWERJOB_WORKER_APPENDER" />-->
|
||||||
<appender-ref ref="ASYNC_LOKI"/>
|
<appender-ref ref="LOKI"/>
|
||||||
</logger>
|
</logger>
|
||||||
|
|
||||||
<!-- 默认配置 -->
|
<!-- 默认配置 -->
|
||||||
<root level="DEBUG">
|
<root level="DEBUG">
|
||||||
<appender-ref ref="CONSOLE"/>
|
<appender-ref ref="CONSOLE"/>
|
||||||
<!-- <appender-ref ref="FILE"/>-->
|
<!-- <appender-ref ref="FILE"/>-->
|
||||||
<appender-ref ref="ASYNC_LOKI"/>
|
<appender-ref ref="LOKI"/>
|
||||||
</root>
|
</root>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
package com.nflg.wms.admin;
|
|
||||||
|
|
||||||
import com.nflg.wms.admin.service.SapService;
|
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
|
|
||||||
@SpringBootTest
|
|
||||||
public class SapMetaPrintTest {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private SapService sapService;
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void ZWM00_MB007(){
|
|
||||||
sapService.printMeta("ZWM00_MB007");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void ZWM00_MB107(){
|
|
||||||
sapService.printMeta("ZWM00_MB107");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,36 +0,0 @@
|
||||||
package com.nflg.wms.common.pojo.dto;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.experimental.Accessors;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@Accessors(chain = true)
|
|
||||||
public class InventoryDTO {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 物料编号
|
|
||||||
*/
|
|
||||||
private String materialNo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 工厂
|
|
||||||
*/
|
|
||||||
private String factoryNo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 库位
|
|
||||||
*/
|
|
||||||
private String warehouseNo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批次号
|
|
||||||
*/
|
|
||||||
private String batchNumber;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 数量
|
|
||||||
*/
|
|
||||||
private BigDecimal num;
|
|
||||||
}
|
|
||||||
|
|
@ -1,56 +0,0 @@
|
||||||
package com.nflg.wms.common.pojo.dto;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.experimental.Accessors;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@Accessors(chain = true)
|
|
||||||
public class ZWM00MB007DTO {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 订单号
|
|
||||||
*/
|
|
||||||
private String AUFNR;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 物料号
|
|
||||||
*/
|
|
||||||
private String MATNR;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 物料描述
|
|
||||||
*/
|
|
||||||
private String MAKTX;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 工厂
|
|
||||||
*/
|
|
||||||
private String PWERK;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 仓库
|
|
||||||
*/
|
|
||||||
private String LGORT;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 订单数量
|
|
||||||
*/
|
|
||||||
private BigDecimal PSMNG;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 已收货数量
|
|
||||||
*/
|
|
||||||
private BigDecimal WEMNG;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 未收货数量
|
|
||||||
*/
|
|
||||||
private BigDecimal WSHSL;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 单位
|
|
||||||
*/
|
|
||||||
private String MEINS;
|
|
||||||
}
|
|
||||||
|
|
@ -78,7 +78,6 @@ public class Zim001QueryResultItem1DTO {
|
||||||
/**
|
/**
|
||||||
* 二维码内容
|
* 二维码内容
|
||||||
*/
|
*/
|
||||||
@NotBlank
|
|
||||||
private String qrCode;
|
private String qrCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
package com.nflg.wms.common.pojo.dto;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.experimental.Accessors;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@Accessors(chain = true)
|
|
||||||
public class Zwm00Mb107DTO {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 物料凭证编号
|
|
||||||
*/
|
|
||||||
private String E_MBLNR;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 物料凭证年度
|
|
||||||
*/
|
|
||||||
private String E_MJAHR;
|
|
||||||
}
|
|
||||||
|
|
@ -1,36 +0,0 @@
|
||||||
package com.nflg.wms.common.pojo.qo;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.experimental.Accessors;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@Accessors(chain = true)
|
|
||||||
public class Zwm00Mb107QO {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 工厂
|
|
||||||
*/
|
|
||||||
private String PWERK;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 仓库
|
|
||||||
*/
|
|
||||||
private String LGORT;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 数量
|
|
||||||
*/
|
|
||||||
private BigDecimal PSMNG;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 单位
|
|
||||||
*/
|
|
||||||
private String AMEIN;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批次
|
|
||||||
*/
|
|
||||||
private String CHARG;
|
|
||||||
}
|
|
||||||
|
|
@ -43,10 +43,7 @@
|
||||||
<artifactId>freemarker</artifactId>
|
<artifactId>freemarker</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.retry</groupId>
|
|
||||||
<artifactId>spring-retry</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,8 @@
|
||||||
package com.nflg.wms.repository.service;
|
package com.nflg.wms.repository.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.nflg.wms.common.pojo.dto.InventoryDTO;
|
|
||||||
import com.nflg.wms.repository.entity.WmsInventory;
|
import com.nflg.wms.repository.entity.WmsInventory;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 服务类
|
* 服务类
|
||||||
|
|
@ -16,7 +13,4 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
public interface IWmsInventoryService extends IService<WmsInventory> {
|
public interface IWmsInventoryService extends IService<WmsInventory> {
|
||||||
|
|
||||||
void out(List<InventoryDTO> inventories);
|
|
||||||
|
|
||||||
void in(List<InventoryDTO> inventories);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,106 +1,20 @@
|
||||||
package com.nflg.wms.repository.service.impl;
|
package com.nflg.wms.repository.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.nflg.wms.common.exception.NflgException;
|
|
||||||
import com.nflg.wms.common.pojo.dto.InventoryDTO;
|
|
||||||
import com.nflg.wms.common.util.UserUtil;
|
|
||||||
import com.nflg.wms.common.util.VUtil;
|
|
||||||
import com.nflg.wms.repository.entity.WmsInventory;
|
import com.nflg.wms.repository.entity.WmsInventory;
|
||||||
import com.nflg.wms.repository.mapper.WmsInventoryMapper;
|
import com.nflg.wms.repository.mapper.WmsInventoryMapper;
|
||||||
import com.nflg.wms.repository.service.IWmsInventoryService;
|
import com.nflg.wms.repository.service.IWmsInventoryService;
|
||||||
import org.springframework.retry.annotation.Backoff;
|
|
||||||
import org.springframework.retry.annotation.Retryable;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 服务实现类
|
* 服务实现类
|
||||||
* </p>
|
* </p>
|
||||||
|
*
|
||||||
* @author 代码生成器生成
|
* @author 代码生成器生成
|
||||||
* @since 2025
|
* @since 2025
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class WmsInventoryServiceImpl extends ServiceImpl<WmsInventoryMapper, WmsInventory> implements IWmsInventoryService {
|
public class WmsInventoryServiceImpl extends ServiceImpl<WmsInventoryMapper, WmsInventory> implements IWmsInventoryService {
|
||||||
|
|
||||||
@Transactional
|
|
||||||
@Retryable(
|
|
||||||
noRetryFor = NflgException.class,
|
|
||||||
maxAttempts = 10, // 最大重试次数(包括第一次调用)
|
|
||||||
backoff = @Backoff(delay = 500)
|
|
||||||
)
|
|
||||||
@Override
|
|
||||||
public void out(List<InventoryDTO> inventories) {
|
|
||||||
List<String> errorMaterialNos = new ArrayList<>();
|
|
||||||
List<WmsInventory> dbInventories = inventories.stream().map(inventory -> {
|
|
||||||
WmsInventory info = lambdaQuery()
|
|
||||||
.eq(WmsInventory::getMaterialNo, inventory.getMaterialNo())
|
|
||||||
.eq(WmsInventory::getBatchNumber, inventory.getBatchNumber())
|
|
||||||
.eq(WmsInventory::getFactoryNo, inventory.getFactoryNo())
|
|
||||||
.eq(WmsInventory::getWarehouseNo, inventory.getWarehouseNo())
|
|
||||||
.one();
|
|
||||||
if (Objects.isNull(info) || info.getNum().compareTo(inventory.getNum()) < 0) {
|
|
||||||
errorMaterialNos.add(inventory.getMaterialNo());
|
|
||||||
} else {
|
|
||||||
info.setNum(info.getNum().subtract(inventory.getNum()));
|
|
||||||
info.setUpdateBy(UserUtil.getUserName());
|
|
||||||
info.setUpdateTime(LocalDateTime.now());
|
|
||||||
}
|
|
||||||
return info;
|
|
||||||
}
|
|
||||||
).toList();
|
|
||||||
VUtil.trueThrowBusinessError(CollectionUtil.isNotEmpty(errorMaterialNos))
|
|
||||||
.throwMessage("以下物料库存不足:"+StrUtil.join(",", errorMaterialNos));
|
|
||||||
updateBatchById(dbInventories);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional
|
|
||||||
@Retryable(
|
|
||||||
noRetryFor = NflgException.class,
|
|
||||||
maxAttempts = 10, // 最大重试次数(包括第一次调用)
|
|
||||||
backoff = @Backoff(delay = 500)
|
|
||||||
)
|
|
||||||
@Override
|
|
||||||
public void in(List<InventoryDTO> inventories) {
|
|
||||||
List<WmsInventory> forAdd = new ArrayList<>();
|
|
||||||
List<WmsInventory> forUpdate = new ArrayList<>();
|
|
||||||
inventories.forEach(inventory -> {
|
|
||||||
WmsInventory info = lambdaQuery()
|
|
||||||
.eq(WmsInventory::getMaterialNo, inventory.getMaterialNo())
|
|
||||||
.eq(WmsInventory::getBatchNumber, inventory.getBatchNumber())
|
|
||||||
.eq(WmsInventory::getFactoryNo, inventory.getFactoryNo())
|
|
||||||
.eq(WmsInventory::getWarehouseNo, inventory.getWarehouseNo())
|
|
||||||
.one();
|
|
||||||
if (Objects.isNull(info)) {
|
|
||||||
info = new WmsInventory()
|
|
||||||
.setMaterialNo(inventory.getMaterialNo())
|
|
||||||
.setBatchNumber(inventory.getBatchNumber())
|
|
||||||
.setFactoryNo(inventory.getFactoryNo())
|
|
||||||
.setWarehouseNo(inventory.getWarehouseNo())
|
|
||||||
.setNum(inventory.getNum())
|
|
||||||
.setCreateBy(UserUtil.getUserName())
|
|
||||||
.setCreateTime(LocalDateTime.now());
|
|
||||||
forAdd.add(info);
|
|
||||||
} else {
|
|
||||||
info.setNum(info.getNum().add(inventory.getNum()));
|
|
||||||
info.setUpdateBy(UserUtil.getUserName());
|
|
||||||
info.setUpdateTime(LocalDateTime.now());
|
|
||||||
forUpdate.add(info);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
if (CollectionUtil.isNotEmpty(forAdd)) {
|
|
||||||
saveBatch(forAdd);
|
|
||||||
}
|
|
||||||
if (CollectionUtil.isNotEmpty(forUpdate)) {
|
|
||||||
updateBatchById(forUpdate);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,8 @@
|
||||||
package com.nflg.wms.scheduled;
|
package com.nflg.wms.scheduled;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.boot.WebApplicationType;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
|
||||||
import org.springframework.context.annotation.ComponentScan;
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
|
@ -12,9 +11,7 @@ import org.springframework.context.annotation.ComponentScan;
|
||||||
public class ScheduledApplication {
|
public class ScheduledApplication {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
new SpringApplicationBuilder(ScheduledApplication.class)
|
SpringApplication.run(ScheduledApplication.class, args);
|
||||||
.web(WebApplicationType.NONE)
|
|
||||||
.run(args);
|
|
||||||
log.info("服务已启动");
|
log.info("服务已启动");
|
||||||
|
|
||||||
// SapService sapService=SpringUtil.getBean(SapService.class);
|
// SapService sapService=SpringUtil.getBean(SapService.class);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue