Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
bd4d6f0854
@ -1,5 +1,6 @@
|
||||
package com.foreverwin.iep.integration.domain;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Data;
|
||||
|
||||
@ -10,4 +11,6 @@ import lombok.Data;
|
||||
public class CustomizeResponse {
|
||||
|
||||
private JSONObject objectResponse;
|
||||
|
||||
private JSONArray arrayResponse;
|
||||
}
|
||||
|
||||
@ -1,151 +0,0 @@
|
||||
package com.foreverwin.iep.integration.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 工序出站接口请求DTO
|
||||
*
|
||||
* @author hechuan.liao
|
||||
* @date 2024-07-31 09:47:44
|
||||
*/
|
||||
@Data
|
||||
public class OperationOutRequestDTO {
|
||||
|
||||
/**
|
||||
* 站点
|
||||
*/
|
||||
private String site;
|
||||
|
||||
/**
|
||||
* 自定义字段名
|
||||
*/
|
||||
private String fieldName;
|
||||
|
||||
/**
|
||||
* 资源
|
||||
*/
|
||||
private String resrce;
|
||||
|
||||
/**
|
||||
* 工序
|
||||
*/
|
||||
private String operation;
|
||||
|
||||
/**
|
||||
* 工序描述
|
||||
*/
|
||||
private String operationDescription;
|
||||
|
||||
/**
|
||||
* 工单
|
||||
*/
|
||||
private String shopOrder;
|
||||
|
||||
/**
|
||||
* 工单
|
||||
*/
|
||||
private List<String> shopOrderList;
|
||||
|
||||
/**
|
||||
* 工单数量
|
||||
*/
|
||||
private BigDecimal qty;
|
||||
|
||||
/**
|
||||
* 计划物料
|
||||
*/
|
||||
private String item;
|
||||
|
||||
/**
|
||||
* 计划物料描述
|
||||
*/
|
||||
private String itemDescription;
|
||||
|
||||
/**
|
||||
* 生产订单剩余数量
|
||||
*/
|
||||
private BigDecimal remainQty;
|
||||
|
||||
/**
|
||||
* 班制
|
||||
*/
|
||||
private String userWorkShift;
|
||||
|
||||
/**
|
||||
* 原膜条码
|
||||
*/
|
||||
private String membraneCode;
|
||||
|
||||
/**
|
||||
* 原膜米数
|
||||
*/
|
||||
private BigDecimal membraneMeter;
|
||||
|
||||
/**
|
||||
* 原膜剩余米数
|
||||
*/
|
||||
private BigDecimal membraneRemainMeter;
|
||||
|
||||
/**
|
||||
* 原膜等级
|
||||
*/
|
||||
private String membraneLevel;
|
||||
|
||||
/**
|
||||
* 原膜宽度
|
||||
*/
|
||||
private String membraneWidth;
|
||||
|
||||
/**
|
||||
* 原膜类型
|
||||
*/
|
||||
private String membraneType;
|
||||
|
||||
/**
|
||||
* 扫描条码号
|
||||
*/
|
||||
private String barCode;
|
||||
|
||||
/**
|
||||
* 条码数
|
||||
*/
|
||||
private int barCodeNum;
|
||||
|
||||
/**
|
||||
* 膜卷类型
|
||||
*/
|
||||
private String rollType;
|
||||
|
||||
/**
|
||||
* 作业规则工序列表
|
||||
*/
|
||||
private List<String> operationList;
|
||||
|
||||
/**
|
||||
* 作业规则自动出站工序列表
|
||||
*/
|
||||
private List<String> autoOperationList;
|
||||
|
||||
/**
|
||||
* 作业规则自动出站设备
|
||||
*/
|
||||
private String autoResource;
|
||||
|
||||
/**
|
||||
* 工序出站列表
|
||||
*/
|
||||
private List<OperationOutListRequestDTO> operationOutListRequestDTOList;
|
||||
|
||||
/**
|
||||
* 作业规则扣料判断是否附属设备
|
||||
*/
|
||||
private String eqpCombineFeeding;
|
||||
|
||||
/**
|
||||
* 创建人员(接口用)
|
||||
*/
|
||||
private String creator;
|
||||
}
|
||||
@ -176,6 +176,12 @@ public class SapWmsDispatchNoteDTO {
|
||||
@SerializedName("ZZOAST")
|
||||
private String zzoast;
|
||||
|
||||
/**
|
||||
* 库存地点地址
|
||||
*/
|
||||
@SerializedName("Z_KCDDDZ")
|
||||
private String zKcdddz;
|
||||
|
||||
/**
|
||||
* 客户要货附件地址
|
||||
*/
|
||||
|
||||
@ -2,6 +2,7 @@ package com.foreverwin.iep.integration.controller;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.foreverwin.iep.common.utils.DateUtils;
|
||||
@ -19,20 +20,15 @@ import com.foreverwin.mom.common.data.tenant.TenantContextHolder;
|
||||
import com.foreverwin.mom.common.log.annotation.SysLog;
|
||||
import com.foreverwin.mom.common.security.annotation.Inner;
|
||||
import com.foreverwin.mom.common.security.util.SecurityUtils;
|
||||
import io.seata.common.util.CollectionUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.UUID;
|
||||
|
||||
import static jdk.nashorn.internal.runtime.regexp.joni.Config.log;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(value = "invoke", tags = "整合服務接口")
|
||||
@ -304,4 +300,36 @@ public class InvokeController {
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/*
|
||||
SH 呼叫地址
|
||||
*/
|
||||
@PostMapping(value = {"/shInvoke", "/{service}/shInvoke"})
|
||||
public JSONObject shInvoke(@PathVariable(value = "service", required = false) String service,@RequestBody JSONObject jsonBody) {
|
||||
String requestText = jsonBody.toJSONString();
|
||||
SecurityUtils.setUserName(Msg.USER);
|
||||
InvokeRequest request = JSONObject.parseObject(requestText, InvokeRequest.class);
|
||||
request.setMessageContent(requestText);
|
||||
request.setSrcRequestBody(requestText);
|
||||
|
||||
InvokeResponse invokeResponse = invoke.execute(service, request);
|
||||
|
||||
JSONObject response = new JSONObject();
|
||||
response.put("REQ_ID", invokeResponse.getTransSid());
|
||||
response.put("RESULT", invokeResponse.getResult());
|
||||
response.put("MESSAGE", invokeResponse.getMessageContent());
|
||||
|
||||
JSONObject objectResponse = invokeResponse.getObjectResponse();
|
||||
if (ObjectUtil.isNotNull(objectResponse)) {
|
||||
for (String key : objectResponse.keySet()) {
|
||||
response.put(key, objectResponse.getString(key));
|
||||
}
|
||||
}
|
||||
|
||||
JSONArray arrayResponse = invokeResponse.getArrayResponse();
|
||||
if (CollectionUtils.isNotEmpty(arrayResponse)) {
|
||||
response.put("DETAILS", arrayResponse);
|
||||
}
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,7 +35,6 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
@ -353,7 +352,6 @@ public class ShopOrderStatisticTransController {
|
||||
zLotMaterialConsumptionTransactionMapper.updateById(targetObj);
|
||||
LotMaterial lotMaterial = lotMaterialMapper.selectById(targetObj.getLotMaterialSid());
|
||||
if (lotMaterial != null) {
|
||||
lotMaterial.setQty(BigDecimal.ZERO);
|
||||
lotMaterial.setErpFlag("N");
|
||||
lotMaterialMapper.updateById(lotMaterial);
|
||||
}
|
||||
|
||||
@ -0,0 +1,77 @@
|
||||
package com.foreverwin.iep.integration.handler.def.job;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.foreverwin.iep.integration.component.Invoke;
|
||||
import com.foreverwin.iep.integration.constant.Msg;
|
||||
import com.foreverwin.iep.integration.domain.InvokeRequest;
|
||||
import com.foreverwin.iep.integration.utils.JS;
|
||||
import com.foreverwin.mom.common.data.tenant.TenantContextHolder;
|
||||
import com.xxl.job.core.biz.model.ReturnT;
|
||||
import com.xxl.job.core.context.XxlJobHelper;
|
||||
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 发送库存数据到sapJOB
|
||||
*/
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class SapSendInventoryForWorkJob {
|
||||
|
||||
private final Invoke invoke;
|
||||
|
||||
@XxlJob("sapSendInventoryForWorkJobHandler")
|
||||
public ReturnT<String> sapSendInventoryForWorkJobHandler() {
|
||||
// 传参对象
|
||||
JSONObject jsonBody = new JSONObject();
|
||||
try {
|
||||
String site = null;
|
||||
|
||||
String jobParam = XxlJobHelper.getJobParam();
|
||||
if (StrUtil.isNotBlank(jobParam)) {
|
||||
Map<String, String> paramMap = JS.parseMap(jobParam, "=", ";");
|
||||
site = paramMap.get("site");
|
||||
}
|
||||
if (StrUtil.isBlank(site)) {
|
||||
XxlJobHelper.log("******未维护站点[site]参数******");
|
||||
return ReturnT.FAIL;
|
||||
} else {
|
||||
LocalDateTime nowLocalDateTime = LocalDateTime.now();
|
||||
String nowTime = nowLocalDateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
String uuid = StrUtil.uuid();
|
||||
jsonBody.put("SITE", site);
|
||||
jsonBody.put("REQ_ID", uuid);
|
||||
jsonBody.put("KEY_VALUE", "SendInventory");
|
||||
jsonBody.put("SEND_TIME", nowTime);
|
||||
jsonBody.put("SENDER", Msg.IEP);
|
||||
jsonBody.put("START", nowTime);
|
||||
jsonBody.put("MESSAGE_ID", "SAP_SEND_INVENTORY");
|
||||
jsonBody.put("RECEIVER", Msg.ERP);
|
||||
jsonBody.put("RETRY", false);
|
||||
// messageContent内容
|
||||
JSONObject messageContentJson = new JSONObject();
|
||||
jsonBody.put("MESSAGE_CONTENT", messageContentJson);
|
||||
}
|
||||
TenantContextHolder.setTenantId(site);
|
||||
|
||||
String requestText = jsonBody.toJSONString();
|
||||
InvokeRequest request = JSONObject.parseObject(requestText, InvokeRequest.class);
|
||||
request.setMessageContent(requestText);
|
||||
request.setSrcRequestBody(requestText);
|
||||
invoke.execute(null, request);
|
||||
} catch (Exception e) {
|
||||
XxlJobHelper.handleFail("发送库存数据到sap失败:" + e);
|
||||
return ReturnT.FAIL;
|
||||
}
|
||||
|
||||
XxlJobHelper.log("发送库存数据到sap成功:" + DateUtil.now());
|
||||
return ReturnT.SUCCESS;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,77 @@
|
||||
package com.foreverwin.iep.integration.handler.def.job;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.foreverwin.iep.integration.component.Invoke;
|
||||
import com.foreverwin.iep.integration.constant.Msg;
|
||||
import com.foreverwin.iep.integration.domain.InvokeRequest;
|
||||
import com.foreverwin.iep.integration.utils.JS;
|
||||
import com.foreverwin.mom.common.data.tenant.TenantContextHolder;
|
||||
import com.xxl.job.core.biz.model.ReturnT;
|
||||
import com.xxl.job.core.context.XxlJobHelper;
|
||||
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 发送库存数据到sap存表JOB
|
||||
*/
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class SapSendInventoryStabForWorkJob {
|
||||
|
||||
private final Invoke invoke;
|
||||
|
||||
@XxlJob("sapSendInventoryStabForWorkJobHandler")
|
||||
public ReturnT<String> sapSendInventoryStabForWorkJobHandler() {
|
||||
// 传参对象
|
||||
JSONObject jsonBody = new JSONObject();
|
||||
try {
|
||||
String site = null;
|
||||
|
||||
String jobParam = XxlJobHelper.getJobParam();
|
||||
if (StrUtil.isNotBlank(jobParam)) {
|
||||
Map<String, String> paramMap = JS.parseMap(jobParam, "=", ";");
|
||||
site = paramMap.get("site");
|
||||
}
|
||||
if (StrUtil.isBlank(site)) {
|
||||
XxlJobHelper.log("******未维护站点[site]参数******");
|
||||
return ReturnT.FAIL;
|
||||
} else {
|
||||
LocalDateTime nowLocalDateTime = LocalDateTime.now();
|
||||
String nowTime = nowLocalDateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
String uuid = StrUtil.uuid();
|
||||
jsonBody.put("SITE", site);
|
||||
jsonBody.put("REQ_ID", uuid);
|
||||
jsonBody.put("KEY_VALUE", "SendInventoryStab");
|
||||
jsonBody.put("SEND_TIME", nowTime);
|
||||
jsonBody.put("SENDER", Msg.IEP);
|
||||
jsonBody.put("START", nowTime);
|
||||
jsonBody.put("MESSAGE_ID", "SAP_SEND_INVENTORY_STAB");
|
||||
jsonBody.put("RECEIVER", Msg.ERP);
|
||||
jsonBody.put("RETRY", false);
|
||||
// messageContent内容
|
||||
JSONObject messageContentJson = new JSONObject();
|
||||
jsonBody.put("MESSAGE_CONTENT", messageContentJson);
|
||||
}
|
||||
TenantContextHolder.setTenantId(site);
|
||||
|
||||
String requestText = jsonBody.toJSONString();
|
||||
InvokeRequest request = JSONObject.parseObject(requestText, InvokeRequest.class);
|
||||
request.setMessageContent(requestText);
|
||||
request.setSrcRequestBody(requestText);
|
||||
invoke.execute(null, request);
|
||||
} catch (Exception e) {
|
||||
XxlJobHelper.handleFail("发送库存数据到sap存表失败:" + e);
|
||||
return ReturnT.FAIL;
|
||||
}
|
||||
|
||||
XxlJobHelper.log("发送库存数据到sap存表成功:" + DateUtil.now());
|
||||
return ReturnT.SUCCESS;
|
||||
}
|
||||
}
|
||||
@ -93,6 +93,7 @@ public class SapMaterielReceive implements HandlerService {
|
||||
erpMaterielReceive.setNormt(etMaraObj.getString("NORMT"));
|
||||
erpMaterielReceive.setFormt(etMaraObj.getString("FORMT"));
|
||||
erpMaterielReceive.setWrkst(etMaraObj.getString("WRKST"));
|
||||
erpMaterielReceive.setGroes(etMaraObj.getString("GROES"));
|
||||
erpMaterielReceive.setCreator(Msg.ERP);
|
||||
erpMaterielReceive.setDateCreate(nowLocalDateTime);
|
||||
|
||||
|
||||
@ -0,0 +1,98 @@
|
||||
package com.foreverwin.iep.integration.handler.def.sap;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.foreverwin.iep.integration.constant.Msg;
|
||||
import com.foreverwin.iep.integration.domain.InvokeRequest;
|
||||
import com.foreverwin.iep.integration.domain.InvokeResponse;
|
||||
import com.foreverwin.iep.integration.service.HandlerService;
|
||||
import com.foreverwin.iep.integration.utils.JS;
|
||||
import com.foreverwin.mom.common.core.constant.SecurityConstants;
|
||||
import com.foreverwin.mom.wms.api.feign.RemoteWmsInventoryService;
|
||||
import com.foreverwin.mom.wms.entity.ZWmsInventoryStockHisItf;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 发送库存数据到sap
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Service("SAP_SEND_INVENTORY")
|
||||
public class SapSendInventory implements HandlerService {
|
||||
|
||||
private final RemoteWmsInventoryService remoteWmsInventoryService;
|
||||
|
||||
@Override
|
||||
public InvokeResponse call(InvokeRequest invokeRequest) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("RFC_FUNCTION", "ZMM_MES_GET_STOCK_HIS");
|
||||
JSONObject conTextJsonObject = new JSONObject();
|
||||
conTextJsonObject.put("EXCHANGE_SYSTEM", "MES");
|
||||
conTextJsonObject.put("EXCHANGE_ID", invokeRequest.getTransSid());
|
||||
conTextJsonObject.put("EXCHANGE_DOC", "");
|
||||
jsonObject.put("REQUEST_CONTEXT", conTextJsonObject);
|
||||
JSONObject bodyJsonObject = new JSONObject();
|
||||
JSONArray inputJsonArray = new JSONArray();
|
||||
List<ZWmsInventoryStockHisItf> zWmsInventoryStockHisItfList = remoteWmsInventoryService.readZWmsInventoryStockHisItfList(invokeRequest.getSite(), SecurityConstants.FROM_IN).getData();
|
||||
if (CollectionUtils.isNotEmpty(zWmsInventoryStockHisItfList)) {
|
||||
for (ZWmsInventoryStockHisItf zWmsInventoryStockHisItf : zWmsInventoryStockHisItfList) {
|
||||
JSONObject inputJsonObject = new JSONObject();
|
||||
inputJsonObject.put("ZUUID", "");
|
||||
inputJsonObject.put("Z_TM", zWmsInventoryStockHisItf.getZTm());
|
||||
inputJsonObject.put("ZDATE", zWmsInventoryStockHisItf.getZdate());
|
||||
inputJsonObject.put("ZTIME", zWmsInventoryStockHisItf.getZtime());
|
||||
inputJsonObject.put("MATNR", zWmsInventoryStockHisItf.getMatnr());
|
||||
inputJsonObject.put("WERKS", zWmsInventoryStockHisItf.getWerks());
|
||||
inputJsonObject.put("LGORT", zWmsInventoryStockHisItf.getLgort());
|
||||
inputJsonObject.put("CHARG", zWmsInventoryStockHisItf.getCharg());
|
||||
inputJsonObject.put("SOBKZ", zWmsInventoryStockHisItf.getSobkz());
|
||||
inputJsonObject.put("VBELN", zWmsInventoryStockHisItf.getVbeln());
|
||||
inputJsonObject.put("POSNR", zWmsInventoryStockHisItf.getPosnr());
|
||||
inputJsonObject.put("KUNNR", zWmsInventoryStockHisItf.getKunnr());
|
||||
inputJsonObject.put("LIFNR", zWmsInventoryStockHisItf.getLifnr());
|
||||
inputJsonObject.put("Z_TP", zWmsInventoryStockHisItf.getZTp());
|
||||
inputJsonObject.put("Z_KC", zWmsInventoryStockHisItf.getZKc());
|
||||
inputJsonArray.add(inputJsonObject);
|
||||
}
|
||||
}
|
||||
bodyJsonObject.put("IT_INPUT", inputJsonArray);
|
||||
jsonObject.put("REQUEST_BODY", bodyJsonObject);
|
||||
|
||||
// messageContent内容
|
||||
JSONObject messageContentJson = SapUtil.appendHead(jsonObject);
|
||||
String jsonInputString = messageContentJson.toString(); // JSON 格式的请求数据
|
||||
|
||||
try {
|
||||
// 统一调用 SAP 接口
|
||||
InvokeResponse invokeResponse = SapUtil.sendSap(jsonInputString);
|
||||
if(!Msg.E.equals(invokeResponse.getResult())){
|
||||
// 请求处理成功
|
||||
JSONObject reJsonObject = JS.parseObject(invokeResponse.getMessageContent());
|
||||
invokeResponse = new InvokeResponse();
|
||||
invokeResponse.setTransSid(invokeRequest.getTransSid());
|
||||
invokeResponse.setResult(Msg.S);
|
||||
invokeResponse.setMessageContent(Msg.SUCCESS);
|
||||
JSONObject responseContextJson = reJsonObject.getJSONObject("RESPONSE_CONTEXT");
|
||||
if (ObjectUtil.isNotEmpty(responseContextJson)) {
|
||||
if (StrUtil.isNotBlank(responseContextJson.getString("RFC_CODE")) && !"200".equals(responseContextJson.getString("RFC_CODE"))) {
|
||||
invokeResponse.setResult(Msg.E);
|
||||
invokeResponse.setMessageContent(responseContextJson.getString("RFC_REASON"));
|
||||
}
|
||||
}
|
||||
}
|
||||
return invokeResponse;
|
||||
} catch (Exception e) {
|
||||
return getDefaultInvoke().fail(invokeRequest.getTransSid(), e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String validation(InvokeRequest invokeRequest) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
package com.foreverwin.iep.integration.handler.def.sap;
|
||||
|
||||
import com.foreverwin.iep.integration.constant.Msg;
|
||||
import com.foreverwin.iep.integration.domain.InvokeRequest;
|
||||
import com.foreverwin.iep.integration.domain.InvokeResponse;
|
||||
import com.foreverwin.iep.integration.service.HandlerService;
|
||||
import com.foreverwin.mom.common.core.constant.SecurityConstants;
|
||||
import com.foreverwin.mom.wms.api.feign.RemoteWmsInventoryService;
|
||||
import com.foreverwin.mom.wms.entity.ZWmsInventoryStockHisItf;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 发送库存数据到sap存表
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Service("SAP_SEND_INVENTORY_STAB")
|
||||
public class SapSendInventoryStab implements HandlerService {
|
||||
|
||||
private final RemoteWmsInventoryService remoteWmsInventoryService;
|
||||
|
||||
@Override
|
||||
public InvokeResponse call(InvokeRequest invokeRequest) {
|
||||
ZWmsInventoryStockHisItf zWmsInventoryStockHisItf = new ZWmsInventoryStockHisItf();
|
||||
zWmsInventoryStockHisItf.setWerks(invokeRequest.getSite());
|
||||
remoteWmsInventoryService.saveZWmsInventoryStockHisItf(zWmsInventoryStockHisItf, SecurityConstants.FROM_IN);
|
||||
InvokeResponse invokeResponse = new InvokeResponse();
|
||||
invokeResponse.setTransSid(invokeRequest.getTransSid());
|
||||
invokeResponse.setResult(Msg.S);
|
||||
invokeResponse.setMessageContent(Msg.SUCCESS);
|
||||
return invokeResponse;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String validation(InvokeRequest invokeRequest) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -42,7 +42,7 @@ import java.net.UnknownHostException;
|
||||
|
||||
public class SapUtil {
|
||||
|
||||
private static final String sapUrl = "/sap/bc/center/tbus?sap-client=110";
|
||||
private static final String sapUrl = "/sap/bc/center/tbus?sap-client=200";
|
||||
|
||||
private static final String WbpUrl = "http://47.103.63.63/sap/pip";
|
||||
private static final String sapUser = "RFC";
|
||||
|
||||
@ -2,19 +2,28 @@ package com.foreverwin.iep.integration.handler.def.sh;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.foreverwin.iep.integration.constant.Msg;
|
||||
import com.foreverwin.iep.integration.domain.InvokeRequest;
|
||||
import com.foreverwin.iep.integration.domain.InvokeResponse;
|
||||
import com.foreverwin.iep.integration.dto.OperationOutListRequestDTO;
|
||||
import com.foreverwin.iep.integration.mapper.IntInDataMapper;
|
||||
import com.foreverwin.iep.integration.service.HandlerService;
|
||||
import com.foreverwin.iep.integration.utils.JS;
|
||||
import com.foreverwin.iep.wip.dto.OperationOutDTO;
|
||||
import com.foreverwin.iep.wip.dto.OperationOutListDTO;
|
||||
import com.foreverwin.iep.wip.feign.RemoteWipService;
|
||||
import com.foreverwin.mom.common.core.util.I18nUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 出站接口
|
||||
@ -25,15 +34,41 @@ public class LotOut implements HandlerService {
|
||||
|
||||
private final RemoteWipService remoteWipService;
|
||||
|
||||
private final IntInDataMapper intInDataMapper;
|
||||
|
||||
@Override
|
||||
public InvokeResponse call(InvokeRequest invokeRequest) {
|
||||
// String messageContent = invokeRequest.getMessageContent();
|
||||
// // 将json对象jsonObject转成EapExtrudeRecordRequest对象
|
||||
// NlvStartRequest startRequest = JSONObject.parseObject(messageContent, NlvStartRequest.class);
|
||||
// remoteWipService.lotStart(startRequest).getData();
|
||||
String messageContent = invokeRequest.getMessageContent();
|
||||
JSONObject jsonObject = JS.parseObject(messageContent);
|
||||
OperationOutDTO operationOutDTO = new OperationOutDTO();
|
||||
operationOutDTO.setSite(invokeRequest.getSite());
|
||||
operationOutDTO.setCreator(invokeRequest.getFromSystem());
|
||||
operationOutDTO.setResrce(jsonObject.getString("RESOURCE"));
|
||||
operationOutDTO.setOperation(jsonObject.getString("OPERATION"));
|
||||
JSONArray details = jsonObject.getJSONArray("DETAILS");
|
||||
List<String> shopOrderList = new ArrayList<>();
|
||||
shopOrderList.add(details.getJSONObject(0).getString("SHOP_ORDER"));
|
||||
operationOutDTO.setShopOrderList(shopOrderList);
|
||||
List<OperationOutListDTO> operationOutListDTOList = new ArrayList<>();
|
||||
// 获取LOT信息
|
||||
OperationOutListRequestDTO operationOutListRequestDTO = intInDataMapper.readLotInfo(invokeRequest.getSite(), details.getJSONObject(0).getString("LOT_NO"));
|
||||
if (operationOutListRequestDTO != null) {
|
||||
// 属性copy
|
||||
OperationOutListDTO operationOutListDTO = new OperationOutListDTO();
|
||||
BeanUtils.copyProperties(operationOutListRequestDTO, operationOutListDTO);
|
||||
if (StrUtil.isNotBlank(details.getJSONObject(0).getString("SUB_QTY"))) {
|
||||
operationOutListDTO.setOutWeight(new BigDecimal(details.getJSONObject(0).getString("SUB_QTY")));
|
||||
}
|
||||
if (StrUtil.isNotBlank(details.getJSONObject(0).getString("METER_COUNT"))) {
|
||||
operationOutListDTO.setOutMeter(new BigDecimal(details.getJSONObject(0).getString("METER_COUNT")));
|
||||
}
|
||||
operationOutListDTOList.add(operationOutListDTO);
|
||||
}
|
||||
operationOutDTO.setOperationOutListDTOList(operationOutListDTOList);
|
||||
remoteWipService.operationOut(operationOutDTO).getData();
|
||||
InvokeResponse response = new InvokeResponse(invokeRequest);
|
||||
response.setTransTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||
response.setResult("S");
|
||||
response.setResult(Msg.S);
|
||||
response.setMessageContent(Msg.SUCCESS);
|
||||
return response;
|
||||
}
|
||||
@ -46,10 +81,21 @@ public class LotOut implements HandlerService {
|
||||
return I18nUtil.getI18nText("int.invoke.iMES.in.error1");
|
||||
}
|
||||
// 校验
|
||||
StringBuilder msg = new StringBuilder();
|
||||
if (StrUtil.isBlank(jsonObject.getString("SITE"))) {
|
||||
msg.append("SITE不能为空!");
|
||||
JSONArray details = jsonObject.getJSONArray("DETAILS");
|
||||
if(details == null || details.size() == 0) {
|
||||
return "DETAILS不能为空";
|
||||
}
|
||||
return msg.toString();
|
||||
jsonObject.put("SITE", invokeRequest.getSite());
|
||||
if (StrUtil.isBlank(jsonObject.getString("SITE"))) {
|
||||
return "SITE不能为空";
|
||||
}
|
||||
if(StrUtil.isBlank(jsonObject.getString("OPERATION"))) {
|
||||
return "OPERATION不能为空";
|
||||
}
|
||||
if(StrUtil.isBlank(jsonObject.getString("RESOURCE"))) {
|
||||
return "RESOURCE不能为空";
|
||||
}
|
||||
invokeRequest.setKeyValue(details.getJSONObject(0).getString("LOT_NO"));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,16 +7,23 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.foreverwin.iep.integration.constant.Msg;
|
||||
import com.foreverwin.iep.integration.domain.InvokeRequest;
|
||||
import com.foreverwin.iep.integration.domain.InvokeResponse;
|
||||
import com.foreverwin.iep.integration.dto.OperationOutListRequestDTO;
|
||||
import com.foreverwin.iep.integration.mapper.IntInDataMapper;
|
||||
import com.foreverwin.iep.integration.service.HandlerService;
|
||||
import com.foreverwin.iep.integration.utils.JS;
|
||||
import com.foreverwin.iep.wip.domain.NlvStartRequest;
|
||||
import com.foreverwin.iep.wip.domain.NlvStartResponse;
|
||||
import com.foreverwin.iep.wip.domain.StartResponse;
|
||||
import com.foreverwin.iep.wip.entity.LotState;
|
||||
import com.foreverwin.iep.wip.feign.RemoteWipService;
|
||||
import com.foreverwin.mom.common.core.util.I18nUtil;
|
||||
import io.seata.common.util.CollectionUtils;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 进站接口
|
||||
@ -27,16 +34,40 @@ public class LotStart implements HandlerService {
|
||||
|
||||
private final RemoteWipService remoteWipService;
|
||||
|
||||
private final IntInDataMapper intInDataMapper;
|
||||
|
||||
@Override
|
||||
public InvokeResponse call(InvokeRequest invokeRequest) {
|
||||
String messageContent = invokeRequest.getMessageContent();
|
||||
// 将json对象jsonObject转成EapExtrudeRecordRequest对象
|
||||
NlvStartRequest startRequest = JSONObject.parseObject(messageContent, NlvStartRequest.class);
|
||||
remoteWipService.lotStart(startRequest).getData();
|
||||
NlvStartResponse nlvStartResponse = remoteWipService.lotStart(startRequest).getData();
|
||||
InvokeResponse response = new InvokeResponse(invokeRequest);
|
||||
response.setTransTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||
response.setResult("S");
|
||||
response.setResult(Msg.S);
|
||||
response.setMessageContent(Msg.SUCCESS);
|
||||
JSONArray arrayResponse = new JSONArray();
|
||||
StartResponse startResponse = nlvStartResponse.getStartResponse();
|
||||
if (startResponse != null) {
|
||||
List<LotState> lotStateList = startResponse.getLotStateList();
|
||||
if (CollectionUtils.isNotEmpty(lotStateList)) {
|
||||
for (LotState lotState : lotStateList) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("LOT_NO", lotState.getLotNo());
|
||||
jsonObject.put("SUB_QTY", lotState.getWeightQty());
|
||||
jsonObject.put("METER_COUNT", lotState.getQty());
|
||||
// 获取条码的工单或物料信息
|
||||
OperationOutListRequestDTO operationOutListRequestDTO = intInDataMapper.readLotInfo(invokeRequest.getSite(), lotState.getLotNo());
|
||||
if (operationOutListRequestDTO != null) {
|
||||
jsonObject.put("ITEM_NAME", operationOutListRequestDTO.getItem());
|
||||
jsonObject.put("ITEM_DESCRIPTION", operationOutListRequestDTO.getItemDescription());
|
||||
jsonObject.put("SHOP_ORDER", operationOutListRequestDTO.getShopOrder());
|
||||
}
|
||||
arrayResponse.add(jsonObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
response.setArrayResponse(arrayResponse);
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.foreverwin.iep.common.base.FrontPage;
|
||||
import com.foreverwin.iep.integration.dto.IntInDataDTO;
|
||||
import com.foreverwin.iep.integration.dto.OperationOutListRequestDTO;
|
||||
import com.foreverwin.iep.integration.entity.IntInData;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@ -26,4 +27,6 @@ public interface IntInDataMapper extends BaseMapper<IntInData> {
|
||||
List<IntInDataDTO> distinctFromSystem(@Param("dto") IntInDataDTO dto);
|
||||
|
||||
List<IntInDataDTO> distinctToSystem(@Param("dto") IntInDataDTO dto);
|
||||
|
||||
OperationOutListRequestDTO readLotInfo(@Param("site") String site, @Param("lotNo") String lotNo);
|
||||
}
|
||||
|
||||
@ -86,4 +86,74 @@
|
||||
</if>
|
||||
order by a.TO_SYSTEM
|
||||
</select>
|
||||
|
||||
<!--获取出站条码信息-->
|
||||
<select id="readLotInfo"
|
||||
resultType="com.foreverwin.iep.integration.dto.OperationOutListRequestDTO">
|
||||
select
|
||||
lb.LOT_NO,
|
||||
lb.SHOP_ORDER_BO,
|
||||
so.SHOP_ORDER,
|
||||
lb.ITEM_BO,
|
||||
i.ITEM,
|
||||
i.DESCRIPTION as ITEM_DESCRIPTION,
|
||||
i.UNIT_OF_MEASURE,
|
||||
cf1.FIELD_VALUE as UNIT_AUXILIARY,
|
||||
cf2.FIELD_VALUE as SALE_ORDER,
|
||||
cf3.FIELD_VALUE as SALE_ORDER_LINE,
|
||||
ls.ROUTER_STEP_BO,
|
||||
rs.OPERATION_BO,
|
||||
o.OPERATION,
|
||||
ls.STATUS as BAR_CODE_STATUS,
|
||||
ls.INSPECTION_LEVEL,
|
||||
ls.WIDTH,
|
||||
ls.`LENGTH`,
|
||||
ls.HANDLE as LOT_STATE_BO,
|
||||
ls.LOT_SERIAL,
|
||||
ls.REMARK,
|
||||
ls.QTY as OUT_METER,
|
||||
ls.WEIGHT_QTY as OUT_WEIGHT,
|
||||
ls.ROLL_TYPE,
|
||||
ls.SOURCE_MASTER_LOT,
|
||||
ls.THICKNESS,
|
||||
ls.TEAM_GROUP,
|
||||
ls.TREADE_SIDE,
|
||||
ls.VLT,
|
||||
ls.IRR,
|
||||
ls.UVR,
|
||||
(case
|
||||
when so.PLANNED_ITEM_BO = i.HANDLE then '101'
|
||||
else '531'
|
||||
end) as PRODUCT_TYPE
|
||||
from
|
||||
wip.lot_basis lb
|
||||
inner join wip.lot_state ls on
|
||||
ls.LOT_BASIS_BO = lb.HANDLE
|
||||
left join wip.shop_order so on
|
||||
so.HANDLE = lb.SHOP_ORDER_BO
|
||||
left join wip.item i on
|
||||
i.HANDLE = lb.ITEM_BO
|
||||
left join wip.router_step rs on
|
||||
rs.HANDLE = ls.ROUTER_STEP_BO
|
||||
left join wip.operation o on
|
||||
o.HANDLE = rs.OPERATION_BO
|
||||
left join wip.custom_fields cf1 on
|
||||
cf1.SITE = i.SITE
|
||||
and cf1.HANDLE = i.HANDLE
|
||||
and cf1.TABLE_NAME = 'ITEM'
|
||||
and cf1.FIELD_NAME = 'UNIT_AUXILIARY'
|
||||
left join wip.custom_fields cf2 on
|
||||
cf2.SITE = so.SITE
|
||||
and cf2.HANDLE = so.HANDLE
|
||||
and cf2.TABLE_NAME = 'SHOP_ORDER'
|
||||
and cf2.FIELD_NAME = 'SALE_ORDER'
|
||||
left join wip.custom_fields cf3 on
|
||||
cf3.SITE = so.SITE
|
||||
and cf3.HANDLE = so.HANDLE
|
||||
and cf3.TABLE_NAME = 'SHOP_ORDER'
|
||||
and cf3.FIELD_NAME = 'SALE_ORDER_LINE'
|
||||
where
|
||||
lb.SITE = #{site}
|
||||
and lb.LOT_NO = #{lotNo}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user