From d425460023114e81caedc7a0430f9246ed3bb839 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期四, 23 十月 2025 17:04:07 +0800
Subject: [PATCH] 报检:批次号字母转大写

---
 inspect-server/src/main/java/com/ruoyi/inspect/service/impl/IfsPartPropsRecordServiceImpl.java |  111 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 111 insertions(+), 0 deletions(-)

diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/IfsPartPropsRecordServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/IfsPartPropsRecordServiceImpl.java
new file mode 100644
index 0000000..bc4f41f
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/IfsPartPropsRecordServiceImpl.java
@@ -0,0 +1,111 @@
+package com.ruoyi.inspect.service.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.json.JSONUtil;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.basic.mapper.IfsInventoryQuantityMapper;
+import com.ruoyi.basic.pojo.IfsInventoryQuantity;
+import com.ruoyi.common.core.domain.Result;
+import com.ruoyi.common.utils.api.IfsApiUtils;
+import com.ruoyi.inspect.dto.IfsPartPropsRecordDTO;
+import com.ruoyi.inspect.mapper.IfsSplitOrderRecordMapper;
+import com.ruoyi.inspect.pojo.IfsPartPropsRecord;
+import com.ruoyi.inspect.pojo.IfsSplitOrderRecord;
+import com.ruoyi.inspect.service.IfsPartPropsRecordService;
+import com.ruoyi.inspect.mapper.IfsPartPropsRecordMapper;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.*;
+
+/**
+* @author 27233
+* @description 閽堝琛ㄣ�恑fs_part_props_record(ifs璁㈠崟闆朵欢灞炴�ц褰曡〃)銆戠殑鏁版嵁搴撴搷浣淪ervice瀹炵幇
+* @createDate 2025-10-23 15:00:34
+*/
+@Slf4j
+@Service
+public class IfsPartPropsRecordServiceImpl extends ServiceImpl<IfsPartPropsRecordMapper, IfsPartPropsRecord>
+    implements IfsPartPropsRecordService{
+
+    @Autowired
+    private IfsApiUtils ifsApiUtils;
+
+    @Autowired
+    private IfsInventoryQuantityMapper ifsInventoryQuantityMapper;
+
+    @Autowired
+    private IfsSplitOrderRecordMapper ifsSplitOrderRecordMapper;
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public boolean saveOrUpdateProps(IfsPartPropsRecordDTO ifsPartPropsRecord) {
+        if(Objects.isNull(ifsPartPropsRecord)){
+            throw new RuntimeException("鍙傛暟涓嶈兘涓虹┖");
+        }
+        //鍒ゆ柇鏄柊澧炶繕鏄洿鏂�
+        String actionType = Objects.isNull(ifsPartPropsRecord.getId())?"New":"Modify";
+        Map<String, Object> inAttrMap = new HashMap<>();
+        inAttrMap.put("RECORD_ID", UUID.randomUUID().toString());
+        inAttrMap.put("SYSCODE", "LIMS");
+        inAttrMap.put("SYSMODEL", "搴撳瓨鐗╂枡鎵规灞炴�т慨鏀�");
+        HashMap<String, Object> batchInfoMap = new HashMap<>();
+        batchInfoMap.put("CONTRACT","ZTNS");//鍩�
+        batchInfoMap.put("PART_NO",ifsPartPropsRecord.getPartNo());//闆朵欢鍙�
+        batchInfoMap.put("LOT_BATCH_NO",ifsPartPropsRecord.getLotBatchNo());//鎵规鍙�
+        batchInfoMap.put("ATTR1",ifsPartPropsRecord.getDrumNo());//杞藉叿缂栧彿
+        batchInfoMap.put("ATTR2",ifsPartPropsRecord.getStartMeterMark());//璧峰绫虫爣
+        batchInfoMap.put("ATTR3",ifsPartPropsRecord.getEndMeterMark());//鎴绫虫爣
+        batchInfoMap.put("ATTR4", ifsPartPropsRecord.getInsulationColor());//缁濈紭棰滆壊
+        batchInfoMap.put("ATTR5",ifsPartPropsRecord.getOuterColor());//澶栨姢棰滆壊
+        batchInfoMap.put("ATTR8",ifsPartPropsRecord.getLetteringInfo());//鍗板瓧淇℃伅
+        batchInfoMap.put("ACTION_TYPE",actionType);//鎿嶄綔绫诲瀷
+        inAttrMap.put("BATCH_INFO", Collections.singletonList(batchInfoMap));
+        Result result = ifsApiUtils.importPartLotAttr(JSONUtil.toJsonStr(inAttrMap));
+        if(result.getCode()!=200){
+            throw new RuntimeException("搴撳瓨鐗╂枡鎵规灞炴�ф洿鏂板け璐ワ細"+result.getMessage());
+        }
+        return this.saveOrUpdate(ifsPartPropsRecord);
+    }
+
+    @Override
+    public IfsPartPropsRecord getOneByIfsId(Long ifsId) {
+        //鏌ヨifs璁㈠崟淇℃伅
+        IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(ifsId);
+        if(Objects.isNull(ifsInventoryQuantity)){
+            throw new RuntimeException("鏈壘鍒板搴旂殑IFS璁㈠崟淇℃伅");
+        }
+        //鍒ゆ柇鏄惁鏄媶鍒嗚鍗�
+        if(ifsInventoryQuantity.getIsSplitOrder().equals(1)){
+            //鏌ヨ鎷嗗垎璁板綍
+            IfsSplitOrderRecord splitRecord = ifsSplitOrderRecordMapper.selectOne(Wrappers.<IfsSplitOrderRecord>lambdaQuery()
+                    .eq(IfsSplitOrderRecord::getOrderNo, ifsInventoryQuantity.getOrderNo())
+                    .eq(IfsSplitOrderRecord::getPartNo, ifsInventoryQuantity.getPartNo())
+                    .eq(IfsSplitOrderRecord::getReleaseNo, ifsInventoryQuantity.getReleaseNo())
+                    .eq(IfsSplitOrderRecord::getLineNo, ifsInventoryQuantity.getLineNo())
+                    .eq(IfsSplitOrderRecord::getReceiptNo, ifsInventoryQuantity.getReceiptNo())
+                    .eq(IfsSplitOrderRecord::getLotBatchNo, ifsInventoryQuantity.getUpdateBatchNo())
+                    .eq(IfsSplitOrderRecord::getOrderNo, ifsInventoryQuantity.getOrderNo())
+            );
+            if(Objects.isNull(splitRecord)){
+                throw new RuntimeException("鏈壘鍒伴浂浠剁殑鎷嗗垎淇℃伅");
+            }
+            IfsPartPropsRecord ifsPartPropsRecord = new IfsPartPropsRecord();
+            ifsPartPropsRecord.setDrumNo(splitRecord.getDrumNo());
+            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"));
+    }
+}
+
+
+
+

--
Gitblit v1.9.3