fix(工序出站接口):增加接口
This commit is contained in:
parent
e339478d2e
commit
6e0b084c9c
@ -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;
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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,10 +7,14 @@ 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;
|
||||
@ -19,6 +23,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 进站接口
|
||||
@ -29,6 +34,8 @@ public class LotStart implements HandlerService {
|
||||
|
||||
private final RemoteWipService remoteWipService;
|
||||
|
||||
private final IntInDataMapper intInDataMapper;
|
||||
|
||||
@Override
|
||||
public InvokeResponse call(InvokeRequest invokeRequest) {
|
||||
String messageContent = invokeRequest.getMessageContent();
|
||||
@ -37,11 +44,30 @@ public class LotStart implements HandlerService {
|
||||
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);
|
||||
if (CollectionUtils.isNotEmpty(nlvStartResponse.getShopOrderReleaseItemInfoList())) {
|
||||
|
||||
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