From 9004d51f5b6096827b5c66b444729cb554997ec4 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期五, 26 九月 2025 14:32:30 +0800
Subject: [PATCH] 原材料订单拆分功能调整v2
---
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/RawMaterialOrderServiceImpl.java | 320 ++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 233 insertions(+), 87 deletions(-)
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/RawMaterialOrderServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/RawMaterialOrderServiceImpl.java
index 4c81840..dc0649a 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/RawMaterialOrderServiceImpl.java
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/RawMaterialOrderServiceImpl.java
@@ -1,47 +1,80 @@
package com.ruoyi.inspect.service.impl;
+import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.io.IoUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
+import com.alibaba.excel.support.ExcelTypeEnum;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
+import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.basic.dto.FactoryDto;
-import com.ruoyi.basic.dto.LaboratoryDto;
+import com.ruoyi.basic.dto.*;
+import com.ruoyi.basic.pojo.IfsInventoryQuantity;
+import com.ruoyi.common.constant.InsOrderTypeConstants;
+import com.ruoyi.common.core.domain.Result;
+import com.ruoyi.common.core.domain.entity.User;
+import com.ruoyi.common.config.WechatProperty;
+import com.ruoyi.common.utils.LimsDateUtil;
+import com.ruoyi.common.utils.QueryWrappers;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.common.utils.WxCpUtils;
+import com.ruoyi.common.utils.api.IfsApiUtils;
+import com.ruoyi.common.utils.api.MesApiUtils;
+import com.ruoyi.inspect.dto.CopperInsOrderDto;
+import com.ruoyi.inspect.dto.OrderSplitDTO;
import com.ruoyi.inspect.dto.RawMaterialStandardTreeDto;
-import com.ruoyi.basic.dto.SampleTypeDto;
import com.ruoyi.basic.mapper.IfsInventoryQuantityMapper;
import com.ruoyi.basic.mapper.StandardTreeMapper;
+import com.ruoyi.inspect.dto.SampleProductDto;
+import com.ruoyi.inspect.excel.OrderSplitExcelData;
+import com.ruoyi.inspect.excel.OrderSplitExcelListener;
+import com.ruoyi.inspect.mapper.InsOrderMapper;
+import com.ruoyi.inspect.mapper.InsProductMapper;
+import com.ruoyi.inspect.mapper.InsSampleMapper;
+import com.ruoyi.inspect.pojo.IfsSplitOrderRecord;
import com.ruoyi.inspect.pojo.InsOrder;
+import com.ruoyi.inspect.pojo.InsReport;
+import com.ruoyi.inspect.service.IfsSplitOrderRecordService;
import com.ruoyi.inspect.service.InsOrderService;
+import com.ruoyi.inspect.service.InsReportService;
import com.ruoyi.inspect.service.RawMaterialOrderService;
import com.ruoyi.common.numgen.NumberGenerator;
import com.ruoyi.framework.exception.ErrorException;
+import com.ruoyi.performance.mapper.AuxiliaryOutputWorkingHoursMapper;
+import com.ruoyi.performance.pojo.AuxiliaryOutputWorkingHours;
import com.ruoyi.system.mapper.UserMapper;
import lombok.AllArgsConstructor;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.multipart.MultipartFile;
+import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
+import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
+import java.util.stream.Collectors;
/**
* @Author zhuo
@@ -53,7 +86,6 @@
private StandardTreeMapper standardTreeMapper;
private IfsInventoryQuantityMapper ifsInventoryQuantityMapper;
- private GetLook getLook;
private UserMapper userMapper;
private InsOrderService insOrderService;
private InsOrderMapper insOrderMapper;
@@ -65,15 +97,16 @@
private InsProductMapper insProductMapper;
private AuxiliaryOutputWorkingHoursMapper auxiliaryOutputWorkingHoursMapper;
+ private IfsApiUtils ifsApiUtils;
+
+ private IfsSplitOrderRecordService ifsSplitOrderRecordService;
+
@Override
- public RawMaterialStandardTreeDto selectStandardTreeListByPartNo(String partNo) {
- if (StringUtils.isBlank(partNo)) {
- throw new ErrorException("闆朵欢鍙蜂涪澶�");
- }
+ public Result selectStandardTreeListByPartNo(String partNo) {
List<FactoryDto> factoryDtos = standardTreeMapper.selectStandardTreeListByPartNo(partNo);
if (CollectionUtil.isEmpty(factoryDtos)) {
- throw new ErrorException("闆朵欢鍙蜂负" + partNo + "鐨勫師鏉愭枡娌℃湁瀵瑰簲鐨勬爣鍑嗗簱閰嶇疆");
+ return Result.success(null, "闆朵欢鍙蜂负" + partNo + "鐨勫師鏉愭枡娌℃湁瀵瑰簲鐨勬爣鍑嗗簱閰嶇疆");
}
RawMaterialStandardTreeDto rawMaterialStandardTreeDto = new RawMaterialStandardTreeDto();
for (FactoryDto factoryDto : factoryDtos) {
@@ -85,8 +118,8 @@
// 鍒ゆ柇缁戝畾鐨勬槸鍚︽槸褰撳墠闆朵欢鍙�
if (sampleTypeDto.getPartNo() != null && sampleTypeDto.getPartNo().equals(partNo)) {
// 娣诲姞瀵硅薄
- rawMaterialStandardTreeDto.setTreeName(factoryDto.getValue() + "-"
- + laboratoryDto.getValue() + "-"
+ rawMaterialStandardTreeDto.setTreeName(factoryDto.getValue() + " - "
+ + laboratoryDto.getValue() + " - "
+ sampleTypeDto.getValue());
rawMaterialStandardTreeDto.setCode(sampleTypeDto.getCode());
rawMaterialStandardTreeDto.setLabel(sampleTypeDto.getLabel());
@@ -96,9 +129,9 @@
for (SampleDto sampleDto : sampleTypeDto.getChildren()) {
if (sampleDto.getPartNo() != null && sampleDto.getPartNo().equals(partNo)) {
// 娣诲姞瀵硅薄
- rawMaterialStandardTreeDto.setTreeName(factoryDto.getValue() + "-"
- + laboratoryDto.getValue() + "-"
- + sampleTypeDto.getValue() + "-"
+ rawMaterialStandardTreeDto.setTreeName(factoryDto.getValue() + " - "
+ + laboratoryDto.getValue() + " - "
+ + sampleTypeDto.getValue() + " - "
+ sampleDto.getValue());
rawMaterialStandardTreeDto.setCode(sampleDto.getCode());
rawMaterialStandardTreeDto.setLabel(sampleDto.getLabel());
@@ -110,29 +143,17 @@
}
}
}
- return rawMaterialStandardTreeDto;
+ return Result.success(rawMaterialStandardTreeDto);
}
@Override
- public Map<String, Object> getWarehouseSubmit(IPage<IfsInventoryQuantity> page, IfsInventoryQuantity ifsInventoryQuantity) {
- Map<String, Object> map = new HashMap<>();
- map.put("head", PrintChina.printChina(IfsInventoryQuantity.class));
- map.put("body", standardTreeMapper.selectIfsPage(page, QueryWrappers.queryWrappers(ifsInventoryQuantity)));
- return map;
+ public IPage<IfsInventoryQuantity> getWarehouseSubmit(IPage<IfsInventoryQuantity> page, IfsInventoryQuantity ifsInventoryQuantity) {
+ return standardTreeMapper.selectIfsPage(page, QueryWrappers.queryWrappers(ifsInventoryQuantity));
}
@Override
- public Map<String, Object> getIfsByStateOne(IPage<IfsInventoryQuantityDto> page, IfsInventoryQuantityDto ifsInventoryQuantityDto) {
- Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId("getIfsByStateOne");
- if (map1.get("look") == 1) {
- //涓汉
- ifsInventoryQuantityDto.setCreateUser(map1.get("userId"));
- }
- Map<String, Object> map = new HashMap<>();
-// ifsInventoryQuantityDto.setOrderState(null);
- map.put("head", PrintChina.printChina(IfsInventoryQuantityDto.class));
- map.put("body", standardTreeMapper.getIfsByStateOne(page, QueryWrappers.queryWrappers(ifsInventoryQuantityDto)));
- return map;
+ public IPage<IfsInventoryQuantityDto> getIfsByStateOne(IPage<IfsInventoryQuantityDto> page, IfsInventoryQuantityDto ifsInventoryQuantityDto) {
+ return standardTreeMapper.getIfsByStateOne(page, QueryWrappers.queryWrappers(ifsInventoryQuantityDto));
}
@@ -142,8 +163,8 @@
* @return
*/
@Override
- public int inspectionReport(List<Integer> ids) {
- Integer userId = getLook.selectPowerByMethodAndUserId(null).get("userId");
+ public int inspectionReport(List<Long> ids) {
+ Integer userId = SecurityUtils.getUserId().intValue();
ifsInventoryQuantityMapper.update(null, Wrappers.<IfsInventoryQuantity>lambdaUpdate()
.in(IfsInventoryQuantity::getId, ids)
.set(IfsInventoryQuantity::getDeclareUser, userMapper.selectById(userId).getName())
@@ -185,7 +206,7 @@
* @return
*/
@Override
- public int revokeInspectionReport(Integer id) {
+ public int revokeInspectionReport(Long id) {
return ifsInventoryQuantityMapper.update(null, Wrappers.<IfsInventoryQuantity>lambdaUpdate()
.eq(IfsInventoryQuantity::getId, id)
.set(IfsInventoryQuantity::getIsInspect, 0)
@@ -209,7 +230,7 @@
*/
@Override
public int inspectionReportOne(IfsInventoryQuantity ifsInventoryQuantity) {
- Integer userId = getLook.selectPowerByMethodAndUserId(null).get("userId");
+ Integer userId = SecurityUtils.getUserId().intValue();
ifsInventoryQuantityMapper.update(null, Wrappers.<IfsInventoryQuantity>lambdaUpdate()
.eq(IfsInventoryQuantity::getId, ifsInventoryQuantity.getId())
.set(IfsInventoryQuantity::getDeclareUser, userMapper.selectById(userId).getName())
@@ -248,7 +269,7 @@
* @return
*/
@Override
- public boolean repealRawOrder(Integer ifsInventoryId) {
+ public boolean repealRawOrder(Long ifsInventoryId) {
// 鏌ヨ鍒ゆ柇鏄惁鏄摐鍗曚笣
IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(ifsInventoryId);
if (ifsInventoryQuantity.getIsCopper() != null && ifsInventoryQuantity.getIsCopper().equals(1)) {
@@ -288,7 +309,7 @@
String code = "Y";
// 鐢熸垚缂栧彿
String no = numberGenerator.generateNumberWithPrefix(3,
- "JCZX/ZB-" + code + LimsDateUtil.resetDate(LocalDateTime.now()),
+ "JCZX/NS-" + code + LimsDateUtil.resetDate(LocalDateTime.now()),
InsOrder::getEntrustCode);
insOrderMapper.insert(insOrder); // 涓昏〃
@@ -338,7 +359,7 @@
addAuxiliary(insOrder, ifsInventoryQuantity);
// todo: ifs鐩存帴绉诲簱
- insReportService.isRawMaterial(insOrder);
+ insReportService.isRawMaterial(insOrder,true,true);
return insOrder.getId();
}
@@ -351,11 +372,8 @@
* @return
*/
@Override
- public Map<String, Object> selectIfsInventoryQuantity(Page<IfsInventoryQuantityCheckDto> page, IfsInventoryQuantityCheckDto ifsInventoryQuantity) {
- Map<String, Object> map = new HashMap<>();
- map.put("head", PrintChina.printChina(IfsInventoryQuantityCheckDto.class));
- map.put("body", standardTreeMapper.selectIfsInventoryQuantity(page, QueryWrappers.queryWrappers(ifsInventoryQuantity)));
- return map;
+ public IPage<IfsInventoryQuantityCheckDto> selectIfsInventoryQuantity(Page<IfsInventoryQuantityCheckDto> page, IfsInventoryQuantityCheckDto ifsInventoryQuantity) {
+ return standardTreeMapper.selectIfsInventoryQuantity(page, QueryWrappers.queryWrappers(ifsInventoryQuantity));
}
/**
@@ -365,21 +383,15 @@
* @return
*/
@Override
- public Map<String, Object> getIfsByOver(Page<IfsInventoryQuantitySupplierDto> page, IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto) {
- Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId("getIfsByStateOne");
- if (map1.get("look") == 1) {
- //涓汉
- ifsInventoryQuantityDto.setCreateUser(map1.get("userId"));
- }
+ public IPage<IfsInventoryQuantitySupplierDto> getIfsByOver(Page<IfsInventoryQuantitySupplierDto> page, IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto) {
+ // todo: 鍙湅鎴�
String beginDeclareDate = ifsInventoryQuantityDto.getBeginDeclareDate();
String endDeclareDate = ifsInventoryQuantityDto.getEndDeclareDate();
ifsInventoryQuantityDto.setBeginDeclareDate(null);
ifsInventoryQuantityDto.setEndDeclareDate(null);
- Map<String, Object> map = new HashMap<>();
- map.put("head", PrintChina.printChina(IfsInventoryQuantitySupplierDto.class));
- map.put("body", standardTreeMapper.getIfsByOver(page, QueryWrappers.queryWrappers(ifsInventoryQuantityDto), beginDeclareDate, endDeclareDate));
- return map;
+ IPage<IfsInventoryQuantitySupplierDto> ifsByOver = standardTreeMapper.getIfsByOver(page, QueryWrappers.queryWrappers(ifsInventoryQuantityDto), beginDeclareDate, endDeclareDate);
+ return ifsByOver;
}
/**
@@ -399,7 +411,7 @@
*/
@Override
@Transactional(rollbackFor = Exception.class)
- public boolean rawOrderRelease(Integer ifsInventoryId, String partDetail) {
+ public boolean rawOrderRelease(Long ifsInventoryId, String partDetail) {
// 淇敼鍘熸潗鏂欐暟鎹洿鎺ヤ负宸叉楠�
ifsInventoryQuantityMapper.update(null, new LambdaUpdateWrapper<IfsInventoryQuantity>()
.set(IfsInventoryQuantity::getState, 2)
@@ -418,7 +430,7 @@
String code = "Y";
// 鐢熸垚缂栧彿
String no = numberGenerator.generateNumberWithPrefix(3,
- "JCZX/ZB-" + code + LimsDateUtil.resetDate(LocalDateTime.now()),
+ "JCZX/NS-" + code + LimsDateUtil.resetDate(LocalDateTime.now()),
InsOrder::getEntrustCode);
insOrder.setExamineTime(LocalDateTime.now());
insOrder.setEntrustCode(no);
@@ -441,7 +453,7 @@
addAuxiliary(insOrder, ifsInventoryQuantity);
// todo: ifs鐩存帴绉诲簱
- insReportService.isRawMaterial(insOrder);
+ insReportService.isRawMaterial(insOrder,true,true);
return true;
}
@@ -453,7 +465,7 @@
* @return
*/
@Override
- public int notificationRawOrder(Integer ifsInventoryId) {
+ public int notificationRawOrder(Long ifsInventoryId) {
IfsInventoryQuantity ifsInventory = ifsInventoryQuantityMapper.selectById(ifsInventoryId);
// 鏌ヨ褰撳墠鎵规, 渚涘簲鍟�, 闆朵欢鍙风殑鍘熸潗鏂欐槸鍚﹁秴杩囦簡20鍚�, 瓒呰繃浜�20鍚ㄩ渶瑕佽繘琛屽娆℃楠屾彁閱�
List<IfsInventoryQuantity> quantityList = ifsInventoryQuantityMapper.selectList(Wrappers.<IfsInventoryQuantity>lambdaQuery()
@@ -498,14 +510,8 @@
ifsInventoryQuantityMapper.insert(ifsInventoryQuantity);
}
- @Override
- public void shiftingParking(List<Integer> ids) {
- for (Integer id : ids) {
- InsOrder order = insOrderService.getById(id);
- // todo: ifs鐩存帴绉诲簱
- insReportService.isRawMaterial(order);
- }
- }
+
+
/**
* 閾滃崟涓濅笅鍗曞厤妫�
@@ -526,7 +532,7 @@
String code = "Y";
// 鐢熸垚缂栧彿
String no = numberGenerator.generateNumberWithPrefix(3,
- "JCZX/ZB-" + code + LimsDateUtil.resetDate(LocalDateTime.now()),
+ "JCZX/NS-" + code + LimsDateUtil.resetDate(LocalDateTime.now()),
InsOrder::getEntrustCode);
insOrderMapper.insert(insOrder); // 涓昏〃
@@ -585,7 +591,7 @@
@Override
@Transactional(rollbackFor = Exception.class)
- public boolean concessionRelease(Integer ifsInventoryId) {
+ public boolean concessionRelease(Long ifsInventoryId) {
// 鏌ヨ鍘熸潗鏂欎俊鎭�
IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(ifsInventoryId);
if (!ifsInventoryQuantity.getInspectStatus().equals(2)) {
@@ -593,7 +599,7 @@
}
// todo:闇�瑕佸垽鏂璷a娴佺▼鏄惁鏄姝ユ斁琛�
- String toLocation = insReportService.moveRawMaterial(ifsInventoryQuantity);
+ String toLocation = insOrderService.moveRawMaterial(ifsInventoryQuantity);
ifsInventoryQuantityMapper.update(null, new LambdaUpdateWrapper<IfsInventoryQuantity>()
.set(IfsInventoryQuantity::getInspectStatus, 4)
@@ -688,12 +694,19 @@
*/
@Override
public void rawAllExport(IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto, HttpServletResponse response) throws UnsupportedEncodingException {
- //鏌ヨ瀵煎嚭鐨勮垂鐢ㄧ粺璁℃暟鎹�
- String beginDeclareDate = ifsInventoryQuantityDto.getBeginDeclareDate();
- String endDeclareDate = ifsInventoryQuantityDto.getEndDeclareDate();
- ifsInventoryQuantityDto.setBeginDeclareDate(null);
- ifsInventoryQuantityDto.setEndDeclareDate(null);
- List<IfsInventoryQuantitySupplierDto> ifsByOverList = standardTreeMapper.getIfsByOverList(QueryWrappers.queryWrappers(ifsInventoryQuantityDto), beginDeclareDate, endDeclareDate);
+ // 鍒ゆ柇鏄惁鏄牴鎹�夋嫨鐨勫鍑�
+ List<IfsInventoryQuantitySupplierDto> ifsByOverList = new ArrayList<>();
+ if (StringUtils.isNotBlank(ifsInventoryQuantityDto.getIds())) {
+ List<String> ifsIds = StrUtil.split(ifsInventoryQuantityDto.getIds(), ",");
+ ifsByOverList = standardTreeMapper.getIfsByIds(ifsIds);
+ } else {
+ String beginDeclareDate = ifsInventoryQuantityDto.getBeginDeclareDate();
+ String endDeclareDate = ifsInventoryQuantityDto.getEndDeclareDate();
+ ifsInventoryQuantityDto.setBeginDeclareDate(null);
+ ifsInventoryQuantityDto.setEndDeclareDate(null);
+ ifsInventoryQuantityDto.setIds(null);
+ ifsByOverList = standardTreeMapper.getIfsByOverList(QueryWrappers.queryWrappers(ifsInventoryQuantityDto), beginDeclareDate, endDeclareDate);
+ }
for (IfsInventoryQuantitySupplierDto dto : ifsByOverList) {
dto.setSendTimeString(dto.getSendTime() == null ? "" : dto.getSendTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
@@ -750,21 +763,15 @@
* @return
*/
@Override
- public Map<String, Object> getIfsByQuarter(Page page, IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto) {
- Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId("getIfsByStateOne");
- if (map1.get("look") == 1) {
- //涓汉
- ifsInventoryQuantityDto.setCreateUser(map1.get("userId"));
- }
+ public IPage<IfsInventoryQuantitySupplierDto> getIfsByQuarter(Page page, IfsInventoryQuantitySupplierDto ifsInventoryQuantityDto) {
+
+ // todo: 鍙湅鎴�
String beginDeclareDate = ifsInventoryQuantityDto.getBeginDeclareDate();
String endDeclareDate = ifsInventoryQuantityDto.getEndDeclareDate();
ifsInventoryQuantityDto.setBeginDeclareDate(null);
ifsInventoryQuantityDto.setEndDeclareDate(null);
- Map<String, Object> map = new HashMap<>();
- map.put("head", PrintChina.printChina(IfsInventoryQuantitySupplierDto.class));
- map.put("body", standardTreeMapper.getIfsByQuarter(page, QueryWrappers.queryWrappers(ifsInventoryQuantityDto), beginDeclareDate, endDeclareDate));
- return map;
+ return standardTreeMapper.getIfsByQuarter(page, QueryWrappers.queryWrappers(ifsInventoryQuantityDto), beginDeclareDate, endDeclareDate);
}
/**
@@ -773,7 +780,7 @@
* @return
*/
@Override
- public boolean advancedGodown(Integer ifsInventoryId) {
+ public boolean advancedGodown(Long ifsInventoryId) {
// 鏌ヨ鍘熸潗鏂欎俊鎭�
IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(ifsInventoryId);
if (!ifsInventoryQuantity.getInspectStatus().equals(0)
@@ -782,7 +789,7 @@
}
// todo:闇�瑕佸垽鏂璷a娴佺▼鏄惁鏄姝ユ斁琛�
- String toLocation = insReportService.moveRawMaterial(ifsInventoryQuantity);
+ String toLocation = insOrderService.moveRawMaterial(ifsInventoryQuantity);
ifsInventoryQuantityMapper.update(null, new LambdaUpdateWrapper<IfsInventoryQuantity>()
.set(IfsInventoryQuantity::getInspectStatus, 1)
@@ -793,6 +800,145 @@
return true;
}
+ @Override
+ public void downloadTemplate(HttpServletResponse response) {
+ response.reset();
+ try{
+ String fileName = "璁㈠崟鎷嗗垎瀵煎叆妯℃澘" + ExcelTypeEnum.XLSX.getValue();
+ fileName = URLEncoder.encode(fileName, StandardCharsets.UTF_8.toString());
+ response.setContentType("application/vnd.ms-excel");
+ response.setHeader("Cache-Control", "no-cache");
+ response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
+ response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
+ //璁㈠崟鎷嗗垎瀵煎叆妯℃澘鏂囦欢
+ InputStream inputStream = this.getClass().getResourceAsStream("/static/split_order_import_template.xlsx");
+ IoUtil.copy(inputStream,response.getOutputStream());
+ inputStream.close();
+ }catch (Exception e){
+ e.printStackTrace();
+ throw new RuntimeException("妯℃澘涓嬭浇澶辫触");
+ }
+ }
+
+ @Override
+ public Result importSplitOrderData(MultipartFile file,Long ifsId, HttpServletRequest request) {
+ try {
+ IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(ifsId);
+ OrderSplitExcelListener listener = new OrderSplitExcelListener(ifsInventoryQuantity);
+ EasyExcel.read(file.getInputStream(), listener).sheet().headRowNumber(2).doRead();
+ if(StringUtils.isNotBlank(listener.errorMsg)){
+ return Result.fail(201,listener.errorMsg);
+ }
+ return Result.success(listener.getDataList());
+ } catch (IOException e) {
+ e.printStackTrace();
+ throw new RuntimeException("瀵煎叆澶辫触:"+e.getMessage());
+ }
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class,isolation = Isolation.READ_COMMITTED)
+ public boolean confirmSplitOrder(OrderSplitDTO orderSplitDTO) {
+ //1.鏌ヨifs璁㈠崟淇℃伅
+ IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(orderSplitDTO.getIfsId());
+ if(Objects.isNull(ifsInventoryQuantity)){
+ throw new RuntimeException("鏈煡璇㈠埌璇FS璁㈠崟淇℃伅");
+ }
+ //2.瀵规帴ifs閲囪喘鎺ユ敹鏇存敼鎵瑰彿鎺ュ彛
+ //缁勮璇锋眰鍙傛暟inAttr
+ List<String> newLotBathNo = new ArrayList<>();//鏂版壒鍙峰垪琛�
+ Map<String,Object> inAttrMap = new HashMap<>();
+ inAttrMap.put("RECORD_ID",UUID.randomUUID().toString());
+ inAttrMap.put("SYSCODE","LIMS_NS");
+ inAttrMap.put("SYSMODEL","鑰愪笣LIMS璁㈠崟鎷嗗垎");
+ List<Map<String,Object>> batchInfoData = new ArrayList<>();
+ if(Objects.nonNull(orderSplitDTO.getSplitDetailList()) && !orderSplitDTO.getSplitDetailList().isEmpty()){
+ for (OrderSplitExcelData data : orderSplitDTO.getSplitDetailList()) {
+ Map<String, Object> infoMap = new HashMap<>();
+ infoMap.put("ORDER_NO",ifsInventoryQuantity.getOrderNo());
+ infoMap.put("LINE_NO",ifsInventoryQuantity.getLineNo());
+ infoMap.put("RELEASE_NO",ifsInventoryQuantity.getReleaseNo());
+ infoMap.put("RECEIPT_NO",ifsInventoryQuantity.getReceiptNo());
+ infoMap.put("PART_NO",ifsInventoryQuantity.getPartNo());
+ infoMap.put("CONFIGURATION_ID",ifsInventoryQuantity.getConfigurationId());
+ infoMap.put("LOCATION_NO",ifsInventoryQuantity.getLocationNo());
+ infoMap.put("LOT_BATCH_NO",ifsInventoryQuantity.getLotBatchNo());
+ infoMap.put("NEW_LOT_BATCH_NO",data.getLotBatchNo());
+ newLotBathNo.add(data.getLotBatchNo());
+ infoMap.put("SERIAL_NO",ifsInventoryQuantity.getSerialNo());
+ infoMap.put("ENG_CHG_LEVEL",ifsInventoryQuantity.getEngChgLevel());
+ infoMap.put("WAIV_DEV_REJ_NO",ifsInventoryQuantity.getWaivDevRejNo());
+ infoMap.put("ACTIVITY_SEQ",ifsInventoryQuantity.getActivitySeq());
+ infoMap.put("QTY_TO_CHANGE",data.getQtyStock());
+ batchInfoData.add(infoMap);
+ }
+ }
+ inAttrMap.put("BATCH_INFO", batchInfoData);
+ String inAttr = JSONObject.toJSONString(inAttrMap);
+ //璋冪敤ifs鎺ュ彛
+ Result result = ifsApiUtils.updateMoveReceiptLot(inAttr);
+ if(result.getCode()!=200){
+ throw new RuntimeException("IFS閲囪喘鎺ユ敹鏇存敼鎵瑰彿璇锋眰寮傚父锛�"+result.getMessage());
+ }
+ //鏇存柊涓昏鍗曠殑鎶佃揪閲囪喘鏁伴噺
+ BigDecimal purQtyInStore = orderSplitDTO.getSplitDetailList()
+ .stream()
+ .map(OrderSplitExcelData::getQtyStock)
+ .reduce(BigDecimal::add).orElse(BigDecimal.ZERO);
+ BigDecimal newPurQtyInStore = ifsInventoryQuantity.getPurQtyInStore().subtract(purQtyInStore);
+ //濡傛灉鎷嗗垎鍚庯紝鍓╀綑鐨勫簱瀛樻暟閲忎负0锛屽垯鍒犻櫎鎵瑰彿涓�*鐨勮鍗曚俊鎭�
+ if(newPurQtyInStore.compareTo(BigDecimal.ZERO)==0){
+ ifsInventoryQuantityMapper.deleteById(ifsInventoryQuantity.getId());
+ }else{
+ ifsInventoryQuantityMapper.update(null,Wrappers.<IfsInventoryQuantity>lambdaUpdate()
+ .set(IfsInventoryQuantity::getPurQtyInStore,newPurQtyInStore)
+ .set(IfsInventoryQuantity::getInvQtyInStore,newPurQtyInStore)
+ .eq(IfsInventoryQuantity::getId,ifsInventoryQuantity.getId())
+ );
+ }
+ //ifs鏇存敼鎵瑰彿鎺ュ彛璋冪敤鎴愬姛锛屾媺鍙栨柊鎷嗗垎鐨刬fs璁㈠崟骞舵姤妫�
+ Map<String, Object> map = new HashMap<>();
+ map.put("LOCATION_NO","1302");
+ map.put("STATE_DB","To be Inspected");
+ map.put("PART_NO",ifsInventoryQuantity.getPartNo());
+ map.put("ORDER_NO",ifsInventoryQuantity.getOrderNo());
+ map.put("LINE_NO",ifsInventoryQuantity.getLineNo());
+ map.put("RELEASE_NO",ifsInventoryQuantity.getReleaseNo());
+ map.put("RECEIPT_NO",ifsInventoryQuantity.getReceiptNo());
+ map.put("LOT_BATCH_NO",String.join(";",newLotBathNo));
+ insOrderService.getIfsOrder(map,true);
+ //鏌ヨ鏂版媶鍒嗙殑璁㈠崟淇℃伅
+ List<IfsInventoryQuantity> splitOrderList = ifsInventoryQuantityMapper.selectList(Wrappers.<IfsInventoryQuantity>lambdaQuery()
+ .eq(IfsInventoryQuantity::getLocationNo, "1302")
+ .eq(IfsInventoryQuantity::getStatusDb, "To be Inspected")
+ .eq(IfsInventoryQuantity::getPartNo, ifsInventoryQuantity.getPartNo())
+ .eq(IfsInventoryQuantity::getOrderNo, ifsInventoryQuantity.getOrderNo())
+ .eq(IfsInventoryQuantity::getLineNo, ifsInventoryQuantity.getLineNo())
+ .eq(IfsInventoryQuantity::getReleaseNo, ifsInventoryQuantity.getReleaseNo())
+ .eq(IfsInventoryQuantity::getReceiptNo, ifsInventoryQuantity.getReceiptNo())
+ .in(IfsInventoryQuantity::getLotBatchNo, newLotBathNo)
+ );
+ //鎵ц鎶ユ鎿嶄綔
+ if(Objects.nonNull(splitOrderList) && !splitOrderList.isEmpty()){
+ List<Long> ids = splitOrderList.stream().map(IfsInventoryQuantity::getId).collect(Collectors.toList());
+ ids.add(ifsInventoryQuantity.getId());
+ this.inspectionReport(ids);
+ }
+ //鍕鹃�夊悓姝ュ埌MES锛屼繚瀛樿鍗曟媶鍒嗚褰�
+ if(orderSplitDTO.getPushToMes()){
+ List<IfsSplitOrderRecord> collect = orderSplitDTO.getSplitDetailList().stream().map(m -> {
+ IfsSplitOrderRecord record = new IfsSplitOrderRecord();
+ BeanUtil.copyProperties(m, record);
+ record.setOrderNo(ifsInventoryQuantity.getOrderNo());
+ record.setLineNo(ifsInventoryQuantity.getLineNo());
+ record.setReleaseNo(ifsInventoryQuantity.getReleaseNo());
+ record.setReceiptNo(ifsInventoryQuantity.getReceiptNo());
+ return record;
+ }).collect(Collectors.toList());
+ return ifsSplitOrderRecordService.saveBatch(collect);
+ }
+ return false;
+ }
/**
* 娣诲姞宸ユ椂
@@ -817,7 +963,7 @@
DateTime parse = DateUtil.parse(localDateTime.format(formatter));
auxiliaryOutputWorkingHours.setWeekDay(getWeek(localDateTime.format(formatters)));//鏄熸湡
auxiliaryOutputWorkingHours.setWeek(String.valueOf(DateUtil.weekOfYear(DateUtil.offsetDay(parse, 1))));//鍛ㄦ
- auxiliaryOutputWorkingHours.setCheck(getLook.selectPowerByMethodAndUserId(null).get("userId"));//妫�娴嬩汉
+ auxiliaryOutputWorkingHours.setCheck(SecurityUtils.getUserId().intValue());//妫�娴嬩汉
auxiliaryOutputWorkingHours.setPrice(new BigDecimal("1"));//鍗曚环
auxiliaryOutputWorkingHoursMapper.insert(auxiliaryOutputWorkingHours);
--
Gitblit v1.9.3