From c65ab218b14e87489f1594b2d932f7bd54b3ba11 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期五, 17 十月 2025 13:34:19 +0800
Subject: [PATCH] 数采调整
---
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java | 403 +++++++++++++++++++++++++++++++++++++++++++++++----------
1 files changed, 333 insertions(+), 70 deletions(-)
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java
index e830686..a06a1c6 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java
@@ -13,15 +13,18 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.CollectionUtils;
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.mapper.StandardProductListMapper;
+import com.ruoyi.basic.mapper.StructureItemParameterMapper;
import com.ruoyi.basic.pojo.IfsInventoryQuantity;
import com.ruoyi.basic.pojo.StandardProductList;
+import com.ruoyi.basic.pojo.StructureItemParameter;
import com.ruoyi.basic.pojo.StructureTestObject;
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.numgen.NumberGenerator;
import com.ruoyi.common.utils.*;
@@ -34,14 +37,14 @@
import com.ruoyi.inspect.service.InsOrderStateService;
import com.ruoyi.inspect.service.InsProductService;
import com.ruoyi.inspect.service.InsSampleService;
+import com.ruoyi.inspect.vo.IfsOrderVO;
import com.ruoyi.inspect.vo.InsOrderPrintingVo;
-import com.ruoyi.performance.pojo.AuxiliaryOutputWorkingHoursTemporary;
-import com.ruoyi.performance.service.AuxiliaryOutputWorkingHoursTemporaryService;
import com.ruoyi.system.mapper.UserMapper;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse;
@@ -82,14 +85,13 @@
private IfsApiUtils ifsApiUtils;
private SpotCheckQuarterItemMapper spotCheckQuarterItemMapper;
private StandardProductListMapper standardProductListMapper;
- private AuxiliaryOutputWorkingHoursTemporaryService auxiliaryOutputWorkingHoursTemporaryService;
+ private StructureItemParameterMapper structureItemParameterMapper;
//鑾峰彇妫�楠屼笅鍗曟暟鎹�
@Override
public IPage<SampleOrderDto> selectInsOrderParameter(IPage<InsOrder> page, SampleOrderDto sampleOrderDto) {
- //todo: 鍙湅鎴戝垽鏂叏閮�,涓汉,缁勭粐鐨勬潈闄�
String laboratory = null;
// 鍒ゆ柇鏄惁鏄叏閮�
String isOrderAll = null;
@@ -155,53 +157,9 @@
spotCheckQuarterItemMapper.updateById(spotCheckQuarterItem);
}
- // 鍒涘缓宸ユ椂鏆傚瓨
- // 缂撳瓨鏍峰搧id, 缂栧彿map
-// addWorkingHoursTemporary(userId, insSamples, ids, order);
-
return 1;
}
- /**
- * 鍒涘缓宸ユ椂鏆傚瓨
- * @param userId
- * @param insSamples
- * @param ids
- * @param order
- */
- private void addWorkingHoursTemporary(Integer userId, List<InsSample> insSamples, List<Integer> ids, InsOrder order) {
- Map<Integer, String> sampleMap = insSamples.stream().collect(Collectors.toMap(InsSample::getId, InsSample::getSampleCode));
- List<InsProduct> insProductList = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery()
- .in(InsProduct::getInsSampleId, ids)
- .eq(InsProduct::getState, 1));
- List<AuxiliaryOutputWorkingHoursTemporary> outputWorkingHours = insProductList.stream().map(insProduct -> {
- AuxiliaryOutputWorkingHoursTemporary auxiliaryOutputWorkingHours = new AuxiliaryOutputWorkingHoursTemporary();
- auxiliaryOutputWorkingHours.setInspectionItemClass(insProduct.getInspectionItemClass());//妫�娴嬮」鍒嗙被
- auxiliaryOutputWorkingHours.setInspectionItem(insProduct.getInspectionItem());//妫�娴嬬埗椤�
- auxiliaryOutputWorkingHours.setInspectionItemSubclass(insProduct.getInspectionItemSubclass());//妫�娴嬪瓙椤�
- auxiliaryOutputWorkingHours.setSample(sampleMap.get(insProduct.getInsSampleId()));//鏍峰搧缂栧彿
- auxiliaryOutputWorkingHours.setOrderId(order.getId());//璁㈠崟id
- auxiliaryOutputWorkingHours.setOrderNo(order.getEntrustCode());//闈炲姞鐝鎵樺崟鍙�
- auxiliaryOutputWorkingHours.setWorkTime(insProduct.getManHour());//闈炲姞鐝伐鏃�
- auxiliaryOutputWorkingHours.setAmount(1);//闈炲姞鐝暟閲�
- auxiliaryOutputWorkingHours.setOutputWorkTime((ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getOvertimeWorkTime()) ? auxiliaryOutputWorkingHours.getOvertimeWorkTime() : BigDecimal.ZERO).add(ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getWorkTime()) ? auxiliaryOutputWorkingHours.getWorkTime() : BigDecimal.ZERO));//浜ч噺宸ユ椂
- auxiliaryOutputWorkingHours.setManHourGroup(insProduct.getManHourGroup());//宸ユ椂鍒嗙粍
- DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
- DateTimeFormatter formatters = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
- auxiliaryOutputWorkingHours.setDateTime(LocalDateTime.now().toLocalDate().atStartOfDay().format(formatters));//鏃ユ湡
- LocalDateTime localDateTime = LocalDateTime.now();
- 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(userId);//妫�娴嬩汉
- auxiliaryOutputWorkingHours.setPrice(insProduct.getPrice());//鍗曚环
- auxiliaryOutputWorkingHours.setSampleId(insProduct.getInsSampleId());//鏍峰搧id
- auxiliaryOutputWorkingHours.setInsProductId(insProduct.getId());//妫�楠岄」id
-
- return auxiliaryOutputWorkingHours;
- }).collect(Collectors.toList());
- auxiliaryOutputWorkingHoursTemporaryService.saveBatch(outputWorkingHours);
- }
public static String getWeek(String dayStr) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@@ -237,6 +195,19 @@
default:
return "鏈煡";
}
+ }
+
+
+ // 濡傛灉浣犱娇鐢� Java 8+锛屼篃鍙互鐢� Stream API 绠�鍖栦唬鐮侊細
+ public List<StandardProductList> findMissingItemsWithStream(List<StandardProductList> standardList,
+ List<InsProduct> insList) {
+ Set<Integer> insIds = insList.stream()
+ .map(InsProduct::getStructureItemParameterId)
+ .collect(Collectors.toSet());
+
+ return standardList.stream()
+ .filter(product -> !insIds.contains(product.getStructureItemParameterId()))
+ .collect(Collectors.toList());
}
@Override
@@ -501,7 +472,7 @@
}
// 鐢熸垚缂栧彿
String no = numberGenerator.generateNumberWithPrefix(3,
- "JCZX/ZB-" + code + LimsDateUtil.resetDate(LocalDateTime.now()),
+ "JCZX/NS-" + code + LimsDateUtil.resetDate(LocalDateTime.now()),
InsOrder::getEntrustCode);
// 鍒ゆ柇鏄惁鏄搴︽楠�, 鏄搴︽楠屽彇娑堝師鏉愭枡瀛e害妫�楠屼笅鍗�
if (InsOrderTypeConstants.QUARTERLY_TEST.equals(order.getOrderType())) {
@@ -544,9 +515,10 @@
@Override
public Map<String, Object> getInsOrderAndSample(Integer id, String laboratory) {
Map<String, Object> map = new HashMap<>();
- InsOrder insOrder = insOrderMapper.selectById(id);
+// InsOrder insOrder = insOrderMapper.selectById(id);
+ IfsOrderVO ifsOrderVO = insOrderMapper.selectOrderInfoById(id);
List<SampleProductDto> list = insSampleMapper.getInsOrderAndSample(id, laboratory);
- map.put("insOrder", insOrder);
+ map.put("insOrder", ifsOrderVO);
map.put("sampleProduct", list);
//鏌ヨ鎵�鏈夎褰曟ā鐗堝幓閲�
List<Map<Integer, Object>> list2 = insOrderMapper.selectReportModelByOrderId(id, laboratory);
@@ -578,12 +550,9 @@
* @return
*/
@Override
- public void getIfsOrder() {
- HashMap<String, Object> map = new HashMap<>();
- map.put("LOCATION_NO","1302");
- map.put("STATE_DB","To be Inspected");
+ public void getIfsOrder(Map<String, Object> map,Boolean isSplitOrder) {
List<Map<String, Object>> inventory = ifsApiUtils.getInventory(JSONUtil.toJsonStr(map));
- if(inventory.size() == 0) {
+ if(inventory.isEmpty()) {
return;
}
// 杩涜淇濆瓨
@@ -654,7 +623,7 @@
ifsInventoryQuantity.setIsSource(1);
ifsInventoryQuantity.setState(0);
- IfsInventoryQuantity one = ifsInventoryQuantityMapper.selectOne(new LambdaQueryWrapper<IfsInventoryQuantity>()
+ Long count = ifsInventoryQuantityMapper.selectCount(new LambdaQueryWrapper<IfsInventoryQuantity>()
.eq(IfsInventoryQuantity::getOrderNo, ifsInventoryQuantity.getOrderNo())
.eq(IfsInventoryQuantity::getLineNo, ifsInventoryQuantity.getLineNo())
.eq(IfsInventoryQuantity::getReleaseNo, ifsInventoryQuantity.getReleaseNo())
@@ -666,9 +635,11 @@
.eq(IfsInventoryQuantity::getWaivDevRejNo, ifsInventoryQuantity.getWaivDevRejNo())
.eq(IfsInventoryQuantity::getActivitySeq, ifsInventoryQuantity.getActivitySeq())
);
- if(Objects.isNull(one)) {
-
+ if(count == 0) {
ifsInventoryQuantity.setIsFirst(0);
+ if(isSplitOrder){
+ ifsInventoryQuantity.setIsSplitOrder(1);
+ }
// 鏌ヨ浜т笟閾炬娴嬫暟鎹�
String industryChainAttrFields = IndustryChainUtils.getIndustryChainAttrFields(ifsInventoryQuantity.getOrderNo(),
ifsInventoryQuantity.getLineNo(),
@@ -751,7 +722,7 @@
* @param id
*/
@Transactional
- public void updateIfsInventoryQuantity(Integer id) {
+ public void updateIfsInventoryQuantity(Long id) {
ifsInventoryQuantityMapper.update(null, Wrappers.<IfsInventoryQuantity>lambdaUpdate()
.set(IfsInventoryQuantity::getIsRegister, 1)
.eq(IfsInventoryQuantity::getId, id));
@@ -907,6 +878,10 @@
// 淇敼妫�楠岄」
for (SampleProductDto sampleProductDto : insOrderUpdateDto.getSampleProduct()) {
+ insSampleService.update(Wrappers.<InsSample>lambdaUpdate()
+ .eq(InsSample::getId, sampleProductDto.getId())
+ .set(InsSample::getSpecialStandardMethod, sampleProductDto.getSpecialStandardMethod()));
+
insProductService.updateBatchById(sampleProductDto.getInsProduct());
}
@@ -968,6 +943,7 @@
product.setCreateUser(null);
product.setUpdateTime(null);
product.setUpdateUser(null);
+ product.setSection(null);
product.setInsSampleId(omitOrderProductDto.getInsSampleId());
if (StringUtils.isBlank(product.getCableTag())) {
product.setCableTag(null);
@@ -992,16 +968,21 @@
*/
@Override
public void rawAllInsOrderExport(SampleOrderDto sampleOrderDto, HttpServletResponse response) {
- //鍒ゆ柇鍏ㄩ儴,涓汉,缁勭粐鐨勬潈闄�
- //todo:浠呯湅鎴戣幏鍙栧綋鍓嶄汉鎵�灞炲疄楠屽id
- String laboratory = null;
- // 鍒ゆ柇鏄惁鏄叏閮�
- String isOrderAll = null;
- if (sampleOrderDto.getState() != null && sampleOrderDto.getState() == -2) {
- isOrderAll = "1";
- sampleOrderDto.setState(null);
+ List<SampleOrderDto> sampleOrderDtoList = new ArrayList<>();
+ if (StringUtils.isNotBlank(sampleOrderDto.getIds())) {
+ List<String> orderIds = StrUtil.split(sampleOrderDto.getIds(), ",");
+ sampleOrderDtoList = insOrderMapper.getInsOrderExportByIds(orderIds);
+ } else {
+ String laboratory = null;
+ // 鍒ゆ柇鏄惁鏄叏閮�
+ String isOrderAll = null;
+ if (sampleOrderDto.getState() != null && sampleOrderDto.getState() == -2) {
+ isOrderAll = "1";
+ sampleOrderDto.setState(null);
+ }
+ sampleOrderDto.setIds(null);
+ sampleOrderDtoList = insOrderMapper.rawAllInsOrderExport(QueryWrappers.queryWrappers(sampleOrderDto), laboratory, isOrderAll);
}
- List<SampleOrderDto> sampleOrderDtoList = insOrderMapper.rawAllInsOrderExport(QueryWrappers.queryWrappers(sampleOrderDto), laboratory, isOrderAll);
// 鍒ゆ柇鏄惁鏄笉鍚堟牸, 涓嶅悎鏍兼煡璇笉鍚堟牸椤�
for (SampleOrderDto orderDto : sampleOrderDtoList) {
@@ -1052,6 +1033,288 @@
.set(InsSample::getModel, insSample.getModel()));
}
+ /**
+ * 鏌ヨ褰撳墠鏃堕棿鏄惁娌℃湁璇ユ娴嬮」鐨勬娊鏍疯鍒�
+ * @param sampleList
+ * @param insOrder
+ * @return
+ */
+ @Override
+ public Result judgeNotSpotCheckOrder(List<SampleProductDto> sampleList, InsOrder insOrder) {
+ // todo: 涓嬪崟鍒ゆ柇鎶芥牱璁″垝鐨勫敮涓�鎬�
+ if (insOrder.getQuarterItemId() != null) {
+ Long quarterItemCount = insOrderMapper.selectCount(Wrappers.<InsOrder>lambdaQuery()
+ .eq(InsOrder::getQuarterItemId, insOrder.getQuarterItemId())
+ .notIn(InsOrder::getState, -1 ,2 ,3));
+ if (quarterItemCount > 0) {
+ throw new ErrorException("璇ユ娊鏍疯鍒掑凡琚粦瀹氳繃");
+ }
+ }
+
+ // 鍒ゆ柇鏄惁鏄娊鏍锋娴�
+ if (insOrder.getOrderType().equals(InsOrderTypeConstants.SPOT_CHECK)) {
+ Set<String> monthMessageSet = new HashSet<>();
+ Set<String> quarterMessageSet = new HashSet<>();
+ Set<String> yearMessageSet = new HashSet<>();
+
+ String formatTime = "yyyy-MM-dd HH:mm:ss";
+ // 鏌ヨ褰撳墠鎵�鏈夋牱鍝佺殑妫�楠岄」
+ for (SampleProductDto sampleProductDto : sampleList) {
+ List<StandardProductList> standardProductList = getProductTreeBySampleId(sampleProductDto.getId());
+
+ Set<Integer> insIds = sampleProductDto.getInsProduct().stream()
+ .map(InsProduct::getStructureItemParameterId)
+ .collect(Collectors.toSet());
+
+ List<StandardProductList> productLists = standardProductList.stream()
+ .filter(product -> !insIds.contains(product.getStructureItemParameterId()))
+ .collect(Collectors.toList());
+
+ // 鏌ヨ妫�楠岄」鍩虹琛�, 鏌ヨ鏄惁鏈夋湀搴�, 瀛e害, 骞村害鐨勬楠岄」
+ List<StructureItemParameter> itemParameterList = structureItemParameterMapper.selectList(Wrappers.<StructureItemParameter>lambdaQuery()
+ .in(StructureItemParameter::getId, productLists.stream().map(StandardProductList::getStructureItemParameterId).collect(Collectors.toList())));
+
+ for (StructureItemParameter item : itemParameterList) {
+ if (StringUtils.isNotBlank(item.getSpotCheckType())) {
+ switch (item.getSpotCheckType()) {
+ case "1": // 鏈堝害
+ // 鏌ヨ褰撴湀鏄惁鏈夎妫�娴嬮」鐨勬娊鏍疯鍒�
+ // 褰撴湀寮�濮嬫椂闂�
+ DateTime monthStart = DateUtil.beginOfMonth(DateUtil.date());
+ String monthStartTime = monthStart.toString(formatTime);
+ // 褰撴湀缁撴潫鏃堕棿
+ DateTime monthEnd = DateUtil.endOfMonth(DateUtil.date());
+ String monthEndTime = monthEnd.toString(formatTime);
+ Integer count = insOrderMapper.selectNotSpotCheckOrder(item.getId(), monthStartTime, monthEndTime);
+ if (count == 0) {
+ String monthMessage = item.getInspectionItemClass() +
+ item.getInspectionItem() +
+ item.getInspectionItemSubclass();
+ monthMessageSet.add(monthMessage);
+ }
+ break;
+ case "2": // 瀛e害
+ DateTime quarterStart = DateUtil.beginOfQuarter(DateUtil.date());
+ String quarterStartTime = quarterStart.toString(formatTime);
+ // 褰撴湀缁撴潫鏃堕棿
+ DateTime quarterEnd = DateUtil.endOfQuarter(DateUtil.date());
+ String quarterEndTime = quarterEnd.toString(formatTime);
+ Integer quarterCount = insOrderMapper.selectNotSpotCheckOrder(item.getId(), quarterStartTime, quarterEndTime);
+ if (quarterCount == 0) {
+ String quarterMessage = item.getInspectionItemClass() +
+ item.getInspectionItem() +
+ item.getInspectionItemSubclass();
+ quarterMessageSet.add(quarterMessage);
+ }
+
+ break;
+ case "3": // 骞村害
+ DateTime yearStart = DateUtil.beginOfQuarter(DateUtil.date());
+ String yearStartTime = yearStart.toString(formatTime);
+ // 褰撴湀缁撴潫鏃堕棿
+ DateTime yearEnd = DateUtil.endOfQuarter(DateUtil.date());
+ String yearEndTime = yearEnd.toString(formatTime);
+ Integer yearCount = insOrderMapper.selectNotSpotCheckOrder(item.getId(), yearStartTime, yearEndTime);
+ if (yearCount == 0) {
+ String yearMessage = item.getInspectionItemClass() +
+ item.getInspectionItem() +
+ item.getInspectionItemSubclass();
+ yearMessageSet.add(yearMessage);
+ }
+
+ break;
+ }
+ }
+ }
+ }
+
+ String message = "";
+ if (CollectionUtils.isNotEmpty(monthMessageSet)) {
+ message += StrUtil.format("<p>妫�楠岄」<span style=\"color: red\">{}</span>褰撴湀杩樻湭杩涜鎶芥牱妫�娴�, 璇锋煡鐪嬫槸鍚﹂渶瑕佹坊鍔犲綋鍓嶆楠岄」</p>", CollUtil.join(monthMessageSet, ", "));
+ }
+
+ if (CollectionUtils.isNotEmpty(quarterMessageSet)) {
+ message += StrUtil.format("<p>妫�楠岄」<span style=\"color: red\">{}</span>褰撳墠瀛e害杩樻湭杩涜鎶芥牱妫�娴�, 璇风湅鏄惁闇�瑕佹坊鍔犲綋鍓嶆楠岄」</p>", CollUtil.join(quarterMessageSet, ", "));
+ }
+
+ if (CollectionUtils.isNotEmpty(yearMessageSet)) {
+ message += StrUtil.format("<p>妫�楠岄」<span style=\"color: red\">{}</span>浠婂勾杩樻湭杩涜鎶芥牱妫�娴�, 璇风湅鏄惁闇�瑕佹坊鍔犲綋鍓嶆楠岄」</p>", CollUtil.join(yearMessageSet, ", "));
+ }
+
+ if (StringUtils.isNotBlank(message)) {
+ return Result.success(false, message);
+ }
+ }
+ return Result.success(true);
+
+ }
+
+
+ /**
+ * ifs绉诲簱鎿嶄綔
+ * @param inventoryQuantity
+ * @return
+ */
+ @Override
+ @Transactional(rollbackFor = Exception.class,isolation = Isolation.READ_COMMITTED)
+ public String moveRawMaterial(IfsInventoryQuantity inventoryQuantity) {
+ //鏌ヨifs璁㈠崟璇︽儏
+ IfsInventoryQuantity one = ifsInventoryQuantityMapper.selectById(inventoryQuantity.getId());
+ String toLocation;
+ // 鐧昏閲囪喘妫�楠岀粨鏋淪TD
+ if (one.getIsRegister().equals(0)) {
+ Map<String, Object> resultMap = new HashMap<>();
+ List<Map<String, Object>> resultList = new ArrayList<>();
+ Map<String, Object> map = new HashMap<>();
+ map.put("ORDER_NO", one.getOrderNo()); // 閲囪喘璁㈠崟鍙�
+ map.put("LINE_NO", one.getLineNo()); // 琛屽彿
+ map.put("RELEASE_NO", one.getReleaseNo()); // 涓嬭揪鍙�
+ map.put("RECEIPT_NO", one.getReceiptNo()); // 鎺ユ敹鍙�
+ map.put("PURCH_QTY", one.getQtyToInspect()); // 瑕佹楠岀殑閲囪喘鏁伴噺
+ resultList.add(map);
+ resultMap.put("RECORD_ID", UUID.randomUUID().toString());
+ resultMap.put("SYSCODE", "LIMS");
+ resultMap.put("SYSMODEL", "鐧昏閲囪喘妫�楠岀粨鏋�");
+ resultMap.put("BATCH_INFO", resultList);
+ Result result = ifsApiUtils.getProcurementResults(JSONUtil.toJsonStr(resultMap));
+ if (result.getCode() != 200) {
+ throw new ErrorException("IFS鐧昏閲囪喘妫�楠岀粨鏋滃け璐�: " + result.getMessage());
+ }
+ //濡傛灉鏄媶鍒嗚鍗曪紝鍒欏皢鍚屼竴鎺ユ敹鍙风殑璁㈠崟鏍囪宸茬櫥璁版牎楠�
+ if(one.getIsSplitOrder()==1){
+ //鏌ヨ鍏朵綑鎷嗗垎鐨勮鍗�
+ List<IfsInventoryQuantity> quantityList = ifsInventoryQuantityMapper.selectList(Wrappers.<IfsInventoryQuantity>lambdaQuery()
+ .eq(IfsInventoryQuantity::getOrderNo, one.getOrderNo())
+ .eq(IfsInventoryQuantity::getPartNo, one.getPartNo())
+ .eq(IfsInventoryQuantity::getLineNo, one.getLineNo())
+ .eq(IfsInventoryQuantity::getReleaseNo, one.getReleaseNo())
+ .eq(IfsInventoryQuantity::getReceiptNo, one.getReceiptNo())
+ .eq(IfsInventoryQuantity::getIsSplitOrder, 1)
+ );
+ if(Objects.nonNull(quantityList) && !quantityList.isEmpty()){
+ //淇敼閲囪喘璁㈠崟鐧昏鐘舵��
+ List<Long> ids = quantityList.stream().map(IfsInventoryQuantity::getId).collect(Collectors.toList());
+ ifsInventoryQuantityMapper.update(null,Wrappers.<IfsInventoryQuantity>lambdaUpdate()
+ .set(IfsInventoryQuantity::getIsRegister,1)
+ .in(IfsInventoryQuantity::getId, ids)
+ );
+ }
+ }else{
+ this.updateIfsInventoryQuantity(one.getId());
+ }
+ }
+ /**
+ * TODO 鍚庣画闇�瑕佽皟鐢↖FS鐨勬帴鍙� 绉诲叆鐨勫簱浣嶅彿 toLocation
+ */
+ // 妫�楠屽悗绉诲簱
+ toLocation = "1301";
+ Map<String, Object> moveResultMap = new HashMap<>();
+ List<Map<String, Object>> moveResultList = new ArrayList<>();
+ Map<String, Object> moveMap = new HashMap<>();
+ moveMap.put("ORDER_NO", one.getOrderNo()); // 閲囪喘璁㈠崟鍙�
+ moveMap.put("LINE_NO", one.getLineNo());
+ moveMap.put("RELEASE_NO", one.getReleaseNo());
+ moveMap.put("RECEIPT_NO", one.getReceiptNo());
+ moveMap.put("PART_NO", one.getPartNo());
+ moveMap.put("QTY", one.getPurQtyInStore());
+ moveMap.put("LOCATION_NO", one.getLocationNo());
+ moveMap.put("TO_LOCATION_NO", toLocation);
+ moveMap.put("LOT_BATCH_NO", one.getLotBatchNo());
+ moveMap.put("SERIAL_NO", one.getSerialNo());
+ moveMap.put("WAIV_DEV_REJ_NO", one.getWaivDevRejNo());
+ moveMap.put("ENG_CHG_LEVEL", one.getEngChgLevel());
+ moveMap.put("ACTIVITY_SEQ", one.getActivitySeq());
+ moveResultList.add(moveMap);
+ moveResultMap.put("RECORD_ID", UUID.randomUUID().toString());
+ moveResultMap.put("SYSCODE", "LIMS");
+ moveResultMap.put("SYSMODEL", "妫�楠屽悗绉诲簱");
+ moveResultMap.put("BATCH_INFO", moveResultList);
+
+ Result result1 = ifsApiUtils.moveReceipt(JSONUtil.toJsonStr(moveResultMap));
+ // 濡傛灉鏈夊繀椤讳负闆朵欢鎸囧畾鎵瑰彿鎶ラ敊闇�瑕侀噸鏂版彁浜ょЩ搴撲俊鎭幓鎸囧畾鎵瑰彿
+ if (result1.getCode() != 200) {
+ String message = result1.getMessage();
+ if (message.contains("蹇呴』涓洪浂浠�") && message.contains("鎸囧畾鎵瑰彿")) {
+ updaeBatch(one, toLocation);
+ } else {
+ throw new ErrorException("IFS妫�楠屽悗绉诲簱澶辫触: " + result1.getMessage());
+ }
+ }
+ return toLocation;
+ }
+
+
+ /**
+ * 鍏堜慨鏀归噰璐鍗曟壒娆″彿, 鍚庤繘琛岀Щ搴撴搷浣�
+ * @param one
+ * @param toLocation
+ */
+ private void updaeBatch(IfsInventoryQuantity one, String toLocation) {
+ if (one.getIsUpdateBatch().equals(0)) {
+ // 鍏堜慨鏀规壒娆″彿鍚庤繘琛岀Щ搴�
+ Map<String, Object> resultMap = new HashMap<>();
+ List<Map<String, Object>> resultList = new ArrayList<>();
+ Map<String, Object> map = new HashMap<>();
+ map.put("ORDER_NO", one.getOrderNo()); // 閲囪喘璁㈠崟鍙�
+ map.put("LINE_NO", one.getLineNo()); // 琛屽彿
+ map.put("RELEASE_NO", one.getReleaseNo()); // 涓嬭揪鍙�
+ map.put("RECEIPT_NO", one.getReceiptNo()); // 鎺ユ敹鍙�
+ map.put("PART_NO", one.getPartNo()); //闆朵欢鍙�
+ map.put("CONFIGURATION_ID", one.getConfigurationId()); // 閰嶇疆鏍囪瘑
+ map.put("LOCATION_NO", one.getLocationNo()); // 搴撲綅鍙�
+ map.put("LOT_BATCH_NO", one.getLotBatchNo());// 鎵规鍙�
+ map.put("NEW_LOT_BATCH_NO", one.getUpdateBatchNo()); // 鐩爣鎵规鍙�
+ map.put("SERIAL_NO", one.getSerialNo()); // 搴忓垪鍙�
+ map.put("ENG_CHG_LEVEL", one.getEngChgLevel()); // 鐗堟湰鍙�
+ map.put("WAIV_DEV_REJ_NO", one.getWaivDevRejNo()); // wdr鍙�
+ map.put("ACTIVITY_SEQ", one.getActivitySeq()); // 娲诲姩搴忓彿
+ map.put("QTY_TO_CHANGE", one.getQtyArrived()); // 鍙樻洿鏁伴噺
+ resultList.add(map);
+ resultMap.put("RECORD_ID", UUID.randomUUID().toString());
+ resultMap.put("SYSCODE", "LIMS");
+ resultMap.put("SYSMODEL", "淇敼閲囪喘璁㈠崟鎵规鍙�");
+ resultMap.put("BATCH_INFO", resultList);
+
+ Result result = ifsApiUtils.updateMoveReceiptLot(JSONUtil.toJsonStr(resultMap));
+
+ if (result.getCode() != 200) {
+ throw new ErrorException("IFS淇敼鎵规鍙峰け璐�: " + result.getMessage());
+ }
+ ifsInventoryQuantityMapper.update(null, Wrappers.<IfsInventoryQuantity>lambdaUpdate()
+ .set(IfsInventoryQuantity::getIsUpdateBatch, 1)
+ .eq(IfsInventoryQuantity::getId, one.getId()));
+ }
+
+ Map<String, Object> moveResultMap = new HashMap<>();
+ List<Map<String, Object>> moveResultList = new ArrayList<>();
+ Map<String, Object> moveMap = new HashMap<>();
+ moveMap.put("ORDER_NO", one.getOrderNo()); // 閲囪喘璁㈠崟鍙�
+ moveMap.put("LINE_NO", one.getLineNo());
+ moveMap.put("RELEASE_NO", one.getReleaseNo());
+ moveMap.put("RECEIPT_NO", one.getReceiptNo());
+ moveMap.put("PART_NO", one.getPartNo());
+ moveMap.put("QTY", one.getQtyArrived());
+ moveMap.put("LOCATION_NO", one.getLocationNo());
+ moveMap.put("TO_LOCATION_NO", toLocation);
+ moveMap.put("LOT_BATCH_NO", one.getUpdateBatchNo());
+ moveMap.put("SERIAL_NO", one.getSerialNo());
+ moveMap.put("WAIV_DEV_REJ_NO", one.getWaivDevRejNo());
+ moveMap.put("ENG_CHG_LEVEL", one.getEngChgLevel());
+ moveMap.put("ACTIVITY_SEQ", one.getActivitySeq());
+ moveResultList.add(moveMap);
+ moveResultMap.put("RECORD_ID", UUID.randomUUID().toString());
+ moveResultMap.put("SYSCODE", "LIMS");
+ moveResultMap.put("SYSMODEL", "妫�楠屽悗绉诲簱");
+ moveResultMap.put("BATCH_INFO", moveResultList);
+
+ Result result1 = ifsApiUtils.moveReceipt(JSONUtil.toJsonStr(moveResultMap));
+ if (result1.getCode() != 200) {
+ throw new ErrorException("IFS妫�楠屽悗绉诲簱澶辫触: " + result1.getMessage());
+ }
+
+ }
+
+
}
--
Gitblit v1.9.3