| | |
| | | package com.ruoyi.inspect.service.impl; |
| | | |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.json.JSONArray; |
| | | import cn.hutool.json.JSONObject; |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.alibaba.fastjson2.TypeReference; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.basic.dto.IfsInventoryQuantityDto; |
| | |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Isolation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | |
| | | /** |
| | |
| | | |
| | | @Autowired |
| | | private IfsSplitOrderRecordMapper ifsSplitOrderRecordMapper; |
| | | |
| | | @Autowired |
| | | private IfsPartPropsRecordMapper ifsPartPropsRecordMapper; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class,isolation = Isolation.READ_COMMITTED) |
| | | public IfsPartPropsRecord getOneByIfsId(Long ifsId) { |
| | | //查询ifs订单信息 |
| | | IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(ifsId); |
| | |
| | | ifsPartPropsRecord.setLetteringInfo(splitRecord.getLetteringInfo()); |
| | | ifsPartPropsRecord.setInsulationColor(splitRecord.getInsulationColor()); |
| | | ifsPartPropsRecord.setOuterColor(splitRecord.getOuterColor()); |
| | | ifsPartPropsRecord.setDrumNo(splitRecord.getDrumNo()); |
| | | ifsPartPropsRecord.setDrumNo(splitRecord.getDrumNo()); |
| | | return ifsPartPropsRecord; |
| | | } |
| | | return this.getOne(Wrappers.<IfsPartPropsRecord>lambdaQuery().eq(IfsPartPropsRecord::getIfsInventoryId,ifsId).last("limit 1")); |
| | | //查询批次属性记录 |
| | | IfsPartPropsRecord propsRecord = this.getOne(Wrappers.<IfsPartPropsRecord>lambdaQuery().eq(IfsPartPropsRecord::getIfsInventoryId, ifsId).last("limit 1")); |
| | | if(ObjectUtil.isNotEmpty(propsRecord)){ |
| | | return propsRecord; |
| | | } |
| | | //查询ifs批次属性记录,有就先新增到数据库 |
| | | Map<String, Object> queryMap = new HashMap<>(); |
| | | queryMap.put("LOT_BATCH_NO",ifsInventoryQuantity.getUpdateBatchNo()); |
| | | queryMap.put("PART_NO",ifsInventoryQuantity.getPartNo()); |
| | | Result queryPartLotResult = ifsApiUtils.queryPartLotAttr(ifsInventoryQuantity.getContract(), JSONUtil.toJsonStr(queryMap)); |
| | | if(queryPartLotResult.getCode()==200){ |
| | | JSONObject entries = JSONUtil.parseObj(queryPartLotResult.getData()); |
| | | JSONArray listInfo = entries.getJSONArray("LIST_INFO"); |
| | | if(!listInfo.isEmpty()){ |
| | | Map<String,Object> parseObject = com.alibaba.fastjson2.JSONObject.parseObject(JSONUtil.toJsonStr(listInfo.get(0)), new TypeReference<Map<String, Object>>() {}.getType()); |
| | | IfsPartPropsRecord ifsPartPropsRecord = new IfsPartPropsRecord(); |
| | | ifsPartPropsRecord.setIfsInventoryId(ifsInventoryQuantity.getId());//ifs订单id |
| | | ifsPartPropsRecord.setDrumNo(parseObject.get("ATTR1").toString());//载具编号 |
| | | BigDecimal startMeterMark = new BigDecimal(parseObject.get("ATTR2").toString()); |
| | | BigDecimal endMeterMark = new BigDecimal(parseObject.get("ATTR3").toString()); |
| | | ifsPartPropsRecord.setStartMeterMark(startMeterMark);//起始米标 |
| | | ifsPartPropsRecord.setEndMeterMark(endMeterMark);//截止米标 |
| | | ifsPartPropsRecord.setOuterColor(parseObject.get("ATTR4").toString());//外护颜色 |
| | | ifsPartPropsRecord.setInsulationColor(parseObject.get("ATTR5").toString());//绝缘颜色 |
| | | ifsPartPropsRecord.setLetteringInfo(parseObject.get("ATTR8").toString());//印字信息 |
| | | ifsPartPropsRecordMapper.insert(ifsPartPropsRecord); |
| | | } |
| | | } |
| | | return this.getOne(Wrappers.<IfsPartPropsRecord>lambdaQuery().eq(IfsPartPropsRecord::getIfsInventoryId, ifsId).last("limit 1")); |
| | | } |
| | | |
| | | @Override |