feat(接口): EDC电量采集
This commit is contained in:
parent
5ce1e1038f
commit
2a406e0929
@ -0,0 +1,33 @@
|
||||
package com.foreverwin.iep.eap.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class EapEnergyDataProcessRequest {
|
||||
|
||||
private String site;
|
||||
|
||||
/**
|
||||
* 车间
|
||||
*/
|
||||
private String factory;
|
||||
|
||||
/**
|
||||
* 产线
|
||||
*/
|
||||
private String lineId;
|
||||
|
||||
/**
|
||||
* 工序
|
||||
*/
|
||||
private String operation;
|
||||
|
||||
/**
|
||||
* 资源设备
|
||||
*/
|
||||
private String resource;
|
||||
|
||||
private List<EapPdcBasis> pdcBasis;
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
package com.foreverwin.iep.eap.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class EapPdcBasis {
|
||||
|
||||
private String parameter;
|
||||
|
||||
private String parameterValue;
|
||||
}
|
||||
@ -13,10 +13,16 @@ public class LotPdcRequest {
|
||||
private String site;
|
||||
@JSONField(name = "LOT_NO")
|
||||
private String lotNo;
|
||||
@JSONField(name = "FAB_NO")
|
||||
private String fabNo;
|
||||
@JSONField(name = "WORK_CENTER")
|
||||
private String workCenter;
|
||||
@JSONField(name = "OPERATION")
|
||||
private String operation;
|
||||
@JSONField(name = "RESOURCE")
|
||||
private String resource;
|
||||
@JSONField(name = "SHOP_ORDER")
|
||||
private String shopOrder;
|
||||
@JSONField(name = "TYPE")
|
||||
private String type;
|
||||
@JSONField(name = "STEP")
|
||||
|
||||
@ -91,6 +91,24 @@ public class ZLotPdc extends Model<ZLotPdc> {
|
||||
@ApiModelProperty(value="PDC参数主键")
|
||||
private String pdcParameterBo;
|
||||
|
||||
/**
|
||||
* 车间
|
||||
*/
|
||||
@ApiModelProperty(value="车间")
|
||||
private String fabNo;
|
||||
|
||||
/**
|
||||
* 工作中心
|
||||
*/
|
||||
@ApiModelProperty(value="工作中心")
|
||||
private String workCenter;
|
||||
|
||||
/**
|
||||
* 工单
|
||||
*/
|
||||
@ApiModelProperty(value="工单")
|
||||
private String shopOrder;
|
||||
|
||||
/**
|
||||
* 产品配置作业-顺序
|
||||
*/
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.foreverwin.iep.wip.feign;
|
||||
|
||||
import com.foreverwin.iep.eap.domain.EapBaseFilmWindingCollectionRequest;
|
||||
import com.foreverwin.iep.eap.domain.EapEnergyDataProcessRequest;
|
||||
import com.foreverwin.iep.eap.domain.EapProtectiveFilmUnwindingCollectionRequest;
|
||||
import com.foreverwin.mom.common.core.util.R;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
@ -25,4 +26,12 @@ public interface RemoteEdcRecordService {
|
||||
*/
|
||||
@PostMapping("/edc-record/base-film-winding-collection")
|
||||
R<String> baseFilmWindingCollection(@RequestBody EapBaseFilmWindingCollectionRequest request);
|
||||
|
||||
/**
|
||||
* 收集PDC资料
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/z-lot-pdc/energy-data")
|
||||
R<String> energyDataProcess(@RequestBody EapEnergyDataProcessRequest request);
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.foreverwin.iep.wip.controller;
|
||||
|
||||
import com.foreverwin.iep.eap.domain.EapEnergyDataProcessRequest;
|
||||
import com.foreverwin.iep.wip.domain.LotPdcRequest;
|
||||
import com.foreverwin.iep.wip.service.ZLotPdcService;
|
||||
import com.foreverwin.mom.common.core.util.R;
|
||||
@ -42,4 +43,12 @@ public class ZLotPdcController {
|
||||
request.setSite (TenantContextHolder.getTenantId());
|
||||
return R.ok(lotPdcService.saveLotPdc(request));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "电量采集", notes = "电量采集")
|
||||
@SysLog("电量采集")
|
||||
@PostMapping("/energy-data")
|
||||
public R saveEnergyData(@RequestBody EapEnergyDataProcessRequest request) {
|
||||
request.setSite (TenantContextHolder.getTenantId());
|
||||
return R.ok(lotPdcService.saveEnergyData(request));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,11 +1,12 @@
|
||||
package com.foreverwin.iep.wip.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.foreverwin.iep.prd.dto.ParameterBasisDTO;
|
||||
import com.foreverwin.iep.eap.domain.EapEnergyDataProcessRequest;
|
||||
import com.foreverwin.iep.wip.domain.LotPdcInfo;
|
||||
import com.foreverwin.iep.wip.domain.LotPdcRequest;
|
||||
import com.foreverwin.iep.wip.dto.ZLotPdcDTO;
|
||||
import com.foreverwin.iep.wip.entity.ZLotPdc;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -19,7 +20,11 @@ public interface ZLotPdcService extends IService<ZLotPdc> {
|
||||
|
||||
List<ZLotPdcDTO> getParameterListByItemAndOperation(String itemBo, String operationBo, String eqpTypeBo);
|
||||
|
||||
List<ZLotPdcDTO> getParameterListByPdcCode(String site, String pdcNo);
|
||||
|
||||
List<ZLotPdc> saveLotPdc(LotPdcRequest request);
|
||||
|
||||
LotPdcInfo getPdcList(String site, String lotNo, String operation, String resrce);
|
||||
|
||||
String saveEnergyData(EapEnergyDataProcessRequest request);
|
||||
}
|
||||
|
||||
@ -3,25 +3,34 @@ package com.foreverwin.iep.wip.service.impl;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.foreverwin.iep.common.constant.BaseConstants;
|
||||
import com.foreverwin.iep.common.utils.HandleBoProcessor;
|
||||
import com.foreverwin.iep.common.utils.SidUtils;
|
||||
import com.foreverwin.iep.eap.domain.EapEnergyDataProcessRequest;
|
||||
import com.foreverwin.iep.eap.domain.EapPdcBasis;
|
||||
import com.foreverwin.iep.prd.constant.ResourceCustomFieldsConstants;
|
||||
import com.foreverwin.iep.prd.dto.ParameterBasisDTO;
|
||||
import com.foreverwin.iep.prd.entity.CustomFields;
|
||||
import com.foreverwin.iep.prd.entity.Item;
|
||||
import com.foreverwin.iep.prd.entity.Operation;
|
||||
import com.foreverwin.iep.prd.entity.ShopOrder;
|
||||
import com.foreverwin.iep.prd.entity.ZPdcBasisAttached;
|
||||
import com.foreverwin.iep.prd.service.CustomFieldsService;
|
||||
import com.foreverwin.iep.prd.service.ItemService;
|
||||
import com.foreverwin.iep.prd.service.ZPdcBasisAttachedService;
|
||||
import com.foreverwin.iep.smd.entity.Resrce;
|
||||
import com.foreverwin.iep.smd.service.ResrceService;
|
||||
import com.foreverwin.iep.sys.constant.HandleEnum;
|
||||
import com.foreverwin.iep.wip.domain.JmAutoReelingRunningLotInfo;
|
||||
import com.foreverwin.iep.wip.domain.LotPdcInfo;
|
||||
import com.foreverwin.iep.wip.domain.LotPdcRequest;
|
||||
import com.foreverwin.iep.wip.dto.ZLotPdcDTO;
|
||||
import com.foreverwin.iep.wip.entity.LotBasis;
|
||||
import com.foreverwin.iep.wip.entity.LotState;
|
||||
import com.foreverwin.iep.wip.entity.ZLotPdc;
|
||||
import com.foreverwin.iep.wip.mapper.JmAutoReelingMapper;
|
||||
import com.foreverwin.iep.wip.mapper.ZLotPdcMapper;
|
||||
import com.foreverwin.iep.wip.service.LotBasisService;
|
||||
import com.foreverwin.iep.wip.service.ProcessService;
|
||||
@ -66,6 +75,12 @@ public class ZLotPdcServiceImpl extends ServiceImpl<ZLotPdcMapper, ZLotPdc> impl
|
||||
@Autowired
|
||||
private ItemService itemService;
|
||||
|
||||
@Autowired
|
||||
private CustomFieldsService customFieldsService;
|
||||
|
||||
@Autowired
|
||||
private JmAutoReelingMapper jmAutoReelingMapper;
|
||||
|
||||
/**
|
||||
* 参数收集来自EAP
|
||||
*/
|
||||
@ -85,6 +100,11 @@ public class ZLotPdcServiceImpl extends ServiceImpl<ZLotPdcMapper, ZLotPdc> impl
|
||||
return super.baseMapper.getParameterListByItemAndOperation(pdcBasisAttached);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ZLotPdcDTO> getParameterListByPdcCode(String site, String pdcNo) {
|
||||
return super.baseMapper.getParameterListByPdcCode(site, pdcNo);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public List<ZLotPdc> saveLotPdc(LotPdcRequest request) {
|
||||
@ -177,6 +197,93 @@ public class ZLotPdcServiceImpl extends ServiceImpl<ZLotPdcMapper, ZLotPdc> impl
|
||||
return lotPdcInfo;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public String saveEnergyData(EapEnergyDataProcessRequest request) {
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
String site = request.getSite();
|
||||
String resource = request.getResource();
|
||||
String operation = request.getOperation();
|
||||
String resourceBo = Resrce.genHandle(request.getSite(), resource);
|
||||
String operationBo = Operation.genHandle(site, operation, BaseConstants.CURRENT_REVISION);
|
||||
String shopOrderBo = null;
|
||||
String shopOrder = null;
|
||||
if(StrUtil.isBlank(resource)) {
|
||||
return "设备编号不能为空";
|
||||
}
|
||||
List<EapPdcBasis> pdcBasisList = request.getPdcBasis();
|
||||
if(pdcBasisList == null || pdcBasisList.size() == 0) {
|
||||
return "PDC参数不能为空";
|
||||
}
|
||||
|
||||
LotPdcRequest lotPdcRequest = new LotPdcRequest();
|
||||
CustomFields resourceCustomFields = customFieldsService.getOne(
|
||||
Wrappers.<CustomFields>lambdaQuery().eq(CustomFields::getHandle, resourceBo).eq(CustomFields::getFieldName, ResourceCustomFieldsConstants.SHOP_ORDER), false);
|
||||
if (resourceCustomFields != null) {
|
||||
lotPdcRequest.setShopOrder(resourceCustomFields.getFieldValue());
|
||||
shopOrder = resourceCustomFields.getFieldValue();
|
||||
shopOrderBo = ShopOrder.genHandle(site, shopOrder);
|
||||
JmAutoReelingRunningLotInfo jmAutoReelingRunningLotInfo = jmAutoReelingMapper.getRunningLot(site, operationBo, resourceBo, shopOrderBo);
|
||||
if(jmAutoReelingRunningLotInfo != null) {
|
||||
lotPdcRequest.setLotNo(jmAutoReelingRunningLotInfo.getLotNo());
|
||||
}
|
||||
}
|
||||
lotPdcRequest.setSite(site);
|
||||
lotPdcRequest.setFabNo(request.getFactory());
|
||||
lotPdcRequest.setWorkCenter(request.getLineId());
|
||||
lotPdcRequest.setOperation(operation);
|
||||
lotPdcRequest.setResource(resource);
|
||||
lotPdcRequest.setType(LOT_PDC_FROM_EAP);
|
||||
List<ZLotPdcDTO> lotPdcList = new ArrayList<>();
|
||||
for (EapPdcBasis pdcBasis : pdcBasisList) {
|
||||
ZLotPdcDTO zLotPdc = new ZLotPdcDTO();
|
||||
zLotPdc.setHandle(SidUtils.genSid());
|
||||
zLotPdc.setSite(site);
|
||||
zLotPdc.setOperationBo(operationBo);
|
||||
zLotPdc.setResourceBo(resourceBo);
|
||||
zLotPdc.setParameterNo(pdcBasis.getParameter());
|
||||
zLotPdc.setParameterValue(pdcBasis.getParameterValue());
|
||||
zLotPdc.setFabNo(request.getFactory());
|
||||
zLotPdc.setWorkCenter(request.getLineId());
|
||||
zLotPdc.setShopOrder(shopOrder);
|
||||
zLotPdc.setDateCreate(now);
|
||||
zLotPdc.setDateUpdate(now);
|
||||
zLotPdc.setCreator(SecurityUtils.getUserName());
|
||||
zLotPdc.setUpdater(zLotPdc.getCreator());
|
||||
lotPdcList.add(zLotPdc);
|
||||
}
|
||||
lotPdcRequest.setLotPdcList(lotPdcList);
|
||||
this.saveEdcEnergyPdc(lotPdcRequest);
|
||||
return "S";
|
||||
}
|
||||
|
||||
public List<ZLotPdc> saveEdcEnergyPdc(LotPdcRequest request) {
|
||||
String site = StrUtil.isBlank(request.getSite()) ? TenantContextHolder.getTenantId() : request.getSite();
|
||||
String lotNo = request.getLotNo();
|
||||
String resource = request.getResource();
|
||||
|
||||
String lotBasisBo = LotBasis.genHandle(site, lotNo);
|
||||
LotState lotState = processService.getLotState(lotBasisBo);
|
||||
|
||||
String resourceBo = Resrce.genHandle(site, resource);
|
||||
Resrce resrce = resrceService.getById(resourceBo);
|
||||
if (resrce == null) {
|
||||
throw BusinessException.build(String.format("无效的设备编号【%s】", resource));
|
||||
}
|
||||
if (lotState == null) {
|
||||
throw BusinessException.build(String.format("无效的条码编号【%s】", lotNo));
|
||||
}
|
||||
//PDC收集处理
|
||||
boolean hold = false;
|
||||
List<ZLotPdcDTO> productParameterList = getParameterListByPdcCode(site, "EAP_ENERGY_DATA");
|
||||
if(CollectionUtil.isEmpty(productParameterList)) {
|
||||
throw BusinessException.build("未找EAP_ENERGY_DATA对应的pdc参数");
|
||||
}
|
||||
List<ZLotPdc> lotPdcList = generateAndSave(request, productParameterList, lotState);
|
||||
|
||||
return lotPdcList;
|
||||
}
|
||||
|
||||
public List<ParameterBasisDTO> analyzeMsg(List<ParameterBasisDTO> parameterBasis) {
|
||||
for (ParameterBasisDTO dto : parameterBasis) {
|
||||
String dataType = dto.getDataType();
|
||||
@ -242,10 +349,18 @@ public class ZLotPdcServiceImpl extends ServiceImpl<ZLotPdcMapper, ZLotPdc> impl
|
||||
ZLotPdc zLotPdc = new ZLotPdc();
|
||||
BeanUtils.copyProperties(lotPdc, zLotPdc);
|
||||
zLotPdc.setHandle(SidUtils.genSid());
|
||||
zLotPdc.setPdcMode(LOT_PDC_FROM_MES);
|
||||
if(parameter.getSeq() != null) {
|
||||
zLotPdc.setSeq(parameter.getSeq());
|
||||
}
|
||||
zLotPdc.setPdcMode(StrUtil.isBlank(request.getType()) ? LOT_PDC_FROM_MES : request.getType());
|
||||
zLotPdc.setLotBasisBo(lotState.getLotBasisBo());
|
||||
zLotPdc.setLotNo(lotState.getLotNo());
|
||||
zLotPdc.setLotSerial(lotState.getLotSerial());
|
||||
zLotPdc.setFabNo(request.getFabNo());
|
||||
zLotPdc.setWorkCenter(request.getWorkCenter());
|
||||
if(StrUtil.isNotBlank(request.getShopOrder())) {
|
||||
zLotPdc.setShopOrder(request.getShopOrder());
|
||||
}
|
||||
zLotPdc.setOperationBo(Operation.genHandle(site, operation, BaseConstants.CURRENT_REVISION));
|
||||
zLotPdc.setPdcData(parameterValue);
|
||||
zLotPdc.setResourceBo(resourceBo);
|
||||
|
||||
@ -20,6 +20,8 @@ import java.util.List;
|
||||
public interface ZLotPdcMapper extends BaseMapper<ZLotPdc> {
|
||||
|
||||
List<ZLotPdcDTO> getParameterListByItemAndOperation(@Param("dto") ZPdcBasisAttached dto);
|
||||
|
||||
List<ZLotPdcDTO> getParameterListByPdcCode(@Param("site") String site, @Param("pdcNo") String pdcNo);
|
||||
|
||||
List<ZLotPdc> selectPdcDataByLotNoAndOperation(@Param("operationBo") String operationBo, @Param("step") String step, @Param("lotNoList") List<String> lotNoList);
|
||||
|
||||
|
||||
@ -15,6 +15,9 @@
|
||||
<result property="resourceBo" column="RESOURCE_BO"/>
|
||||
<result property="pdcBasisBo" column="PDC_BASIS_BO"/>
|
||||
<result property="pdcParameterBo" column="PDC_PARAMETER_BO"/>
|
||||
<result property="fabNo" column="FAB_NO"/>
|
||||
<result property="workCenter" column="WORK_CENTER"/>
|
||||
<result property="shopOrder" column="SHOP_ORDER"/>
|
||||
<result property="seq" column="SEQ"/>
|
||||
<result property="pdcMode" column="PDC_MODE"/>
|
||||
<result property="pdcData" column="PDC_DATA"/>
|
||||
@ -39,6 +42,16 @@
|
||||
<result property="maxValue" column="MAX_VALUE"/>
|
||||
<result property="parameterValue" column="PARAMETER_VALUE"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="getParameterListByPdcCode" resultMap="fullMap">
|
||||
select distinct PPC.HANDLE, PPC.`SEQUENCE` AS SEQ, PPC.PDC_BASIS_BO, PB.PARAMETER_NO , PB.DATA_TYPE, PPC.MIN_VALUE , PPC.MAX_VALUE , PPC.PARAMETER_VALUE , PPC.PARAMETER_BASIS_BO ,PBA.OPERATION_BO
|
||||
from z_pdc_parameter ppc
|
||||
inner join parameter_basis PB on PB.HANDLE = PPC.PARAMETER_BASIS_BO
|
||||
inner join z_pdc_basis pbc on pbc.HANDLE = ppc.PDC_BASIS_BO and pbc.CURRENT_REVISION ='Y'
|
||||
inner join z_pdc_basis_attached pba on PBA.PDC_BASIS_BO = PBC.HANDLE
|
||||
WHERE pbc.site = #{site}
|
||||
AND pbc.PDC_NO = #{pdcNo}
|
||||
</select>
|
||||
|
||||
<select id="getParameterListByItemAndOperation" resultMap="fullMap">
|
||||
select distinct PPC.HANDLE, PPC.PDC_BASIS_BO, PB.PARAMETER_NO , PB.DATA_TYPE, PPC.MIN_VALUE , PPC.MAX_VALUE , PPC.PARAMETER_VALUE , PPC.PARAMETER_BASIS_BO ,PBA.OPERATION_BO
|
||||
|
||||
Loading…
Reference in New Issue
Block a user