add:倒冲领料定时回传定时器
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package org.nl.wms.ext_manage.controller;
|
package org.nl.wms.ext_manage.controller;
|
||||||
|
|
||||||
import cn.dev33.satoken.annotation.SaIgnore;
|
import cn.dev33.satoken.annotation.SaIgnore;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang.ArrayUtils;
|
import org.apache.commons.lang.ArrayUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@@ -12,7 +13,9 @@ import org.nl.wms.ext_manage.api.query.MesInventoryQuery;
|
|||||||
import org.nl.wms.ext_manage.mes.mq.producer.WorkReportProducer;
|
import org.nl.wms.ext_manage.mes.mq.producer.WorkReportProducer;
|
||||||
import org.nl.wms.ext_manage.mes.service.dto.WorkReportParam;
|
import org.nl.wms.ext_manage.mes.service.dto.WorkReportParam;
|
||||||
import org.nl.wms.ext_manage.service.MesToWmsService;
|
import org.nl.wms.ext_manage.service.MesToWmsService;
|
||||||
|
import org.nl.wms.ext_manage.service.WmsToZDWmdService;
|
||||||
import org.nl.wms.ext_manage.service.dto.MesTaskParams;
|
import org.nl.wms.ext_manage.service.dto.MesTaskParams;
|
||||||
|
import org.nl.wms.ext_manage.service.dto.ZDInventory;
|
||||||
import org.nl.wms.pm_manage.demand.service.IPmDemandService;
|
import org.nl.wms.pm_manage.demand.service.IPmDemandService;
|
||||||
import org.nl.wms.pm_manage.demand.service.dto.PmDemandParam;
|
import org.nl.wms.pm_manage.demand.service.dto.PmDemandParam;
|
||||||
import org.nl.wms.pm_manage.pmreturn.service.IPmReturnService;
|
import org.nl.wms.pm_manage.pmreturn.service.IPmReturnService;
|
||||||
@@ -31,9 +34,11 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@@ -58,6 +63,12 @@ public class MesToWmsController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private WorkReportProducer workReportProducer;
|
private WorkReportProducer workReportProducer;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private WmsToZDWmdService wmsToZDWmdService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IPmDemandService pmDemandService;
|
||||||
|
|
||||||
@PostMapping("api/mes/lineLackMat")
|
@PostMapping("api/mes/lineLackMat")
|
||||||
@SaIgnore
|
@SaIgnore
|
||||||
@Log("缺料请求")
|
@Log("缺料请求")
|
||||||
@@ -142,4 +153,41 @@ public class MesToWmsController {
|
|||||||
workReportProducer.send(workReportParam);
|
workReportProducer.send(workReportParam);
|
||||||
return ResponseData.build();
|
return ResponseData.build();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
|
* MES库存查询(外部调用)- 支持按仓库编码和物料编码查询,参数均为非必填
|
||||||
|
*/
|
||||||
|
@PostMapping("api/mes/queryInventory")
|
||||||
|
@SaIgnore
|
||||||
|
@Log("MES库存查询")
|
||||||
|
public ResponseEntity<Object> queryInventory(@RequestBody JSONObject param) {
|
||||||
|
|
||||||
|
|
||||||
|
String warehouseCode = param.getString("warehouseCode");
|
||||||
|
String materialCode = param.getString("materialCode");
|
||||||
|
|
||||||
|
List<ZDInventory> ZDInvList = new ArrayList<>();
|
||||||
|
// 中鼎立库仓库编码为6.002,调用中鼎库存查询接口
|
||||||
|
if ("6.002".equals(warehouseCode) || (StringUtils.isEmpty(materialCode) && StringUtils.isEmpty(warehouseCode)) || !StringUtils.isEmpty(materialCode)) {
|
||||||
|
ZDInvList = wmsToZDWmdService.queryInventory(materialCode).getBody();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询WMS本地库存
|
||||||
|
List<StInventoryDto> inventoryDtos = iStInventoryService.queryInventory(
|
||||||
|
StInventoryQuery.builder()
|
||||||
|
.materialCode(materialCode)
|
||||||
|
.storCode(warehouseCode)
|
||||||
|
.build());
|
||||||
|
|
||||||
|
List<Map<String, Object>> result = new ArrayList<>();
|
||||||
|
ZDInvList.forEach(item -> result.add(
|
||||||
|
MapOf.of("houseCode", item.getHouseCode(), "skuCode", item.getSkuCode(),
|
||||||
|
"qty", item.getQty(), "batchNo", item.getBatchNo())
|
||||||
|
));
|
||||||
|
inventoryDtos.forEach(item -> result.add(
|
||||||
|
MapOf.of("houseCode", item.getSectcode(), "skuCode", item.getMaterialCode(),
|
||||||
|
"qty", item.getQty(), "batchNo", item.getPcsn())
|
||||||
|
));
|
||||||
|
return ResponseData.build(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package org.nl.wms.ext_manage.service.impl;
|
package org.nl.wms.ext_manage.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.http.HttpRequest;
|
import cn.hutool.http.HttpRequest;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
@@ -103,8 +104,9 @@ public class WmsToZDWmdServiceImpl implements WmsToZDWmdService {
|
|||||||
}
|
}
|
||||||
String url = param.getValue();
|
String url = param.getValue();
|
||||||
JSONObject requestBody = new JSONObject();
|
JSONObject requestBody = new JSONObject();
|
||||||
requestBody.put("SkuCode", "");
|
if(!StrUtil.isEmptyIfStr(skuCode)){
|
||||||
requestBody.put("SkuCode", skuCode);
|
requestBody.put("SkuCode", skuCode);
|
||||||
|
}
|
||||||
requestBody.put("HouseCode", "6.002");
|
requestBody.put("HouseCode", "6.002");
|
||||||
requestBody.put("HouseCodeLis", new JSONArray());
|
requestBody.put("HouseCodeLis", new JSONArray());
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package org.nl.wms.sch_manage.service.core;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.wms.warehouse_manage.stockReturn.receiveOutRetur.dao.ReceiveOutReturn;
|
||||||
|
import org.nl.wms.warehouse_manage.stockReturn.receiveOutRetur.service.IReceiveOutReturnService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 倒冲领料定时回传,每次回传五条
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class ReceiveReturnAutoTask {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IReceiveOutReturnService receiveOutReturnService;
|
||||||
|
|
||||||
|
@SneakyThrows
|
||||||
|
public void run() {
|
||||||
|
log.info("========>倒冲领料定时回传任务");
|
||||||
|
List<ReceiveOutReturn> list = receiveOutReturnService.list(new LambdaQueryWrapper<ReceiveOutReturn>()
|
||||||
|
.eq(ReceiveOutReturn::getStatus, 0)
|
||||||
|
.or()
|
||||||
|
.eq(ReceiveOutReturn::getStatus, 2)
|
||||||
|
.last("limit 5"));
|
||||||
|
log.info("========>倒冲领料定时回传列表:{}", JSON.toJSONString(list));
|
||||||
|
for (ReceiveOutReturn item : list) {
|
||||||
|
receiveOutReturnService.uploadErp(item);
|
||||||
|
Thread.sleep(1000 * 5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user