Compare commits
2 Commits
ac108a570e
...
708ad618b3
Author | SHA1 | Date |
---|---|---|
|
708ad618b3 | 2 weeks ago |
|
a891c3b201 | 2 weeks ago |
23 changed files with 551 additions and 23 deletions
@ -0,0 +1,48 @@ |
|||
package org.nl.wms.ext.controller; |
|||
|
|||
|
|||
import cn.dev33.satoken.annotation.SaIgnore; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.common.logging.annotation.Log; |
|||
import org.nl.wms.ext.service.ErpToWmsService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
/** |
|||
* <p> |
|||
* ERP调用WMS 控制层 |
|||
* </p> |
|||
* |
|||
* @author Liuxy |
|||
* @since 2025-06-04 |
|||
*/ |
|||
@RestController |
|||
@RequiredArgsConstructor |
|||
@RequestMapping("/api/lms") |
|||
@Slf4j |
|||
public class ErpToWmsController { |
|||
|
|||
@Autowired |
|||
private ErpToWmsService erpToWmsService; |
|||
|
|||
@PostMapping("/inventory") |
|||
@Log("erp查询库存") |
|||
@SaIgnore |
|||
public ResponseEntity<Object> confirm(@RequestBody JSONObject whereJson) { |
|||
return new ResponseEntity<>(erpToWmsService.erpQueryIvt(whereJson),HttpStatus.OK); |
|||
} |
|||
|
|||
@PostMapping("/task") |
|||
@Log("下发出库单据") |
|||
@SaIgnore |
|||
public ResponseEntity<Object> sendTask(@RequestBody JSONObject whereJson) { |
|||
return new ResponseEntity<>(erpToWmsService.sendTask(whereJson),HttpStatus.OK); |
|||
} |
|||
} |
@ -0,0 +1,19 @@ |
|||
package org.nl.wms.ext.enuums; |
|||
|
|||
/** |
|||
* @author Liuyx |
|||
* @date 2025年06月03日 |
|||
* @desc 外部系统常量 |
|||
*/ |
|||
public class EXTConstant { |
|||
|
|||
/** |
|||
* 回传ERP接口地址 |
|||
*/ |
|||
public final static String UPLOAD_ERP_API = "CamstarApi/MomRollBakeInBound"; |
|||
|
|||
/** |
|||
* 物料同步ERP接口地址 |
|||
*/ |
|||
public final static String MATERIAL_SYNC_ERP_API = "CamstarApi/MomRollBakeInBound"; |
|||
} |
@ -0,0 +1,42 @@ |
|||
package org.nl.wms.ext.service; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import org.nl.wms.ext.service.util.ErpResponse; |
|||
|
|||
/** |
|||
* <p> |
|||
* ERP调用WMS 服务类 |
|||
* </p> |
|||
* |
|||
* @author Liuxy |
|||
* @since 2025-06-04 |
|||
*/ |
|||
public interface ErpToWmsService { |
|||
|
|||
/** |
|||
* erp查询库存 |
|||
* @param whereJson { |
|||
* mater_code: 物料编码(可为空) |
|||
* stor_code: 仓库编码(可为空) |
|||
* point_code: 货位编码(可为空) |
|||
* } |
|||
* @return ErpResponse |
|||
*/ |
|||
ErpResponse erpQueryIvt(JSONObject whereJson); |
|||
|
|||
/** |
|||
* 下发出库单据 |
|||
* @param whereJson: { |
|||
* stor_code:仓库编码 |
|||
* mater_code:物料编码 |
|||
* batch_no:批次号(可为空) |
|||
* quantity:数量 |
|||
* unit_code:计量单位 |
|||
* unit_name:计量单位名称 |
|||
* inv_code:单据号(可为空) |
|||
* task_type :业务类型(可为空) |
|||
* } |
|||
* @return ErpResponse |
|||
*/ |
|||
ErpResponse sendTask(JSONObject whereJson); |
|||
} |
@ -0,0 +1,45 @@ |
|||
package org.nl.wms.ext.service.impl; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.wms.basedata_manage.service.dao.mapper.MdPbStoragevehicleextMapper; |
|||
import org.nl.wms.ext.service.ErpToWmsService; |
|||
import org.nl.wms.ext.service.util.ErpResponse; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
/** |
|||
* <p> |
|||
* ERP调用WMS 实现类 |
|||
* </p> |
|||
* |
|||
* @author Liuxy |
|||
* @since 2025-06-04 |
|||
*/ |
|||
@Service |
|||
@Slf4j |
|||
public class ErpToWmsServiceImpl implements ErpToWmsService { |
|||
|
|||
/** |
|||
* 载具扩展属性mapper |
|||
*/ |
|||
@Autowired |
|||
private MdPbStoragevehicleextMapper mdPbStoragevehicleextMapper; |
|||
|
|||
@Override |
|||
public ErpResponse erpQueryIvt(JSONObject whereJson) { |
|||
log.info("erpQueryIvt查询物料接口输入参数为:-------------------" + whereJson.toString()); |
|||
ErpResponse erpResponse = ErpResponse.requestParamOk(mdPbStoragevehicleextMapper.erpQueryIvt(whereJson)); |
|||
log.info("erpQueryIvt查询物料接口输出参数为:-------------------" + erpResponse.toString()); |
|||
return erpResponse; |
|||
} |
|||
|
|||
@Override |
|||
public ErpResponse sendTask(JSONObject whereJson) { |
|||
log.info("sendTask下发出库任务接口输入参数为:-------------------" + whereJson.toString()); |
|||
|
|||
|
|||
log.info("sendTask下发出库任务接口输出参数为:-------------------" + ErpResponse.requestOk().toString()); |
|||
return ErpResponse.requestOk(); |
|||
} |
|||
} |
@ -0,0 +1,72 @@ |
|||
package org.nl.wms.ext.service.util; |
|||
|
|||
import cn.hutool.http.HttpStatus; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import lombok.Builder; |
|||
import lombok.Data; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* <p> |
|||
* ERP调用WMS 返回结果 |
|||
* </p> |
|||
* |
|||
* @author Liuxy |
|||
* @since 2025-06-04 |
|||
*/ |
|||
@Data |
|||
@Builder |
|||
public class ErpResponse { |
|||
|
|||
/** |
|||
* 状态码 |
|||
*/ |
|||
private Integer status; |
|||
|
|||
/** |
|||
* 信息 |
|||
*/ |
|||
private String message; |
|||
|
|||
/** |
|||
* 返回数据 |
|||
*/ |
|||
private List<JSONObject> data; |
|||
|
|||
/** |
|||
* 不带数据反馈 |
|||
* @return ErpResponse |
|||
*/ |
|||
public static ErpResponse requestOk() { |
|||
return ErpResponse.builder() |
|||
.status(HttpStatus.HTTP_OK) |
|||
.message("请求成功!") |
|||
.build(); |
|||
} |
|||
|
|||
/** |
|||
* 带数据反馈 |
|||
* @return ErpResponse |
|||
*/ |
|||
public static ErpResponse requestParamOk(List<JSONObject> list) { |
|||
return ErpResponse.builder() |
|||
.status(HttpStatus.HTTP_OK) |
|||
.message("请求成功!") |
|||
.data(list) |
|||
.build(); |
|||
} |
|||
|
|||
/** |
|||
* 报错信息反馈 |
|||
* @return ErpResponse |
|||
*/ |
|||
public static ErpResponse requestError(String message) { |
|||
return ErpResponse.builder() |
|||
.status(HttpStatus.HTTP_BAD_REQUEST) |
|||
.message(message) |
|||
.build(); |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,28 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<included> |
|||
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/> |
|||
<property name="LOG_HOME" value="${logPath}"/> |
|||
<!-- 按照每天生成日志文件 --> |
|||
<appender name="FILE_ERPTOWMS" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
|||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> |
|||
<!--日志文件输出的文件名--> |
|||
<FileNamePattern>${LOG_HOME}/ErpToWms/%d{yyyy-MM-dd}.%i.log</FileNamePattern> |
|||
<!--日志文件保留天数--> |
|||
<maxHistory>15</maxHistory> |
|||
<!--单个日志最大容量 至少10MB才能看得出来--> |
|||
<maxFileSize>200MB</maxFileSize> |
|||
<!--所有日志最多占多大容量--> |
|||
<totalSizeCap>2GB</totalSizeCap> |
|||
</rollingPolicy> |
|||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> |
|||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符--> |
|||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
|||
<charset>${log.charset}</charset> |
|||
</encoder> |
|||
|
|||
</appender> |
|||
<!-- 打印sql --> |
|||
<logger name="org.nl.wms.ext.service.impl.ErpToWmsServiceImpl" level="info" additivity="false"> |
|||
<appender-ref ref="FILE_ERPTOWMS"/> |
|||
</logger> |
|||
</included> |
Loading…
Reference in new issue