diff --git a/zt-module-qms/zt-module-qms-api/src/main/java/com/zt/plat/module/qms/enums/QmsCommonConstant.java b/zt-module-qms/zt-module-qms-api/src/main/java/com/zt/plat/module/qms/enums/QmsCommonConstant.java index 12f108e..19a8a8e 100644 --- a/zt-module-qms/zt-module-qms-api/src/main/java/com/zt/plat/module/qms/enums/QmsCommonConstant.java +++ b/zt-module-qms/zt-module-qms-api/src/main/java/com/zt/plat/module/qms/enums/QmsCommonConstant.java @@ -184,7 +184,14 @@ public interface QmsCommonConstant { /** 手动 **/ String MANUAL = "manual"; - + + + /** 样品库操作类型: 归库、调拨、下架 **/ + String SAMPLE_STORAGE_OPERATION_TYPE_STORAGE = "storage"; + String SAMPLE_STORAGE_OPERATION_TYPE_TRANSFER = "dispatch"; + String SAMPLE_STORAGE_OPERATION_TYPE_TAKEN_OFF = "take_off"; + + /** 允许提交 **/ String ALLOW_SUBMIT = "allow_submit"; } diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/BusinessSampleDispatchServiceImpl.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/BusinessSampleDispatchServiceImpl.java index 9cc8ac8..d69109b 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/BusinessSampleDispatchServiceImpl.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/BusinessSampleDispatchServiceImpl.java @@ -137,8 +137,11 @@ public class BusinessSampleDispatchServiceImpl implements BusinessSampleDispatch @Transactional(rollbackFor = Exception.class) public CommonResult execDispatch(BusinessSampleDispatchSaveReqVO paramVo) { Long id = paramVo.getId(); - String warehouseUser = paramVo.getWarehouseUser(); //库管员 - Long warehouseUserId = paramVo.getWarehouseUserId(); + + LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); + String nickName = SecurityFrameworkUtils.getLoginUserNickname(); + String warehouseUser = nickName; //库管员 + Long warehouseUserId = loginUser.getId(); BusinessSampleDispatchDO entity = getBusinessSampleDispatch( id); BusinessSampleDispatchDetailPageReqVO pageReqVO = new BusinessSampleDispatchDetailPageReqVO(); pageReqVO.setParentId(id); @@ -152,6 +155,7 @@ public class BusinessSampleDispatchServiceImpl implements BusinessSampleDispatch BusinessSampleDispatchDetailDO u = new BusinessSampleDispatchDetailDO(); u.setUseStatus("1"); u.setBorrowStatus("1"); + u.setGivebackStatus("0"); u.setBorrowUser(entity.getApplyUser()); u.setBorrowUserId(entity.getApplyUserId()); u.setBorrowTime(borrowTime); @@ -222,6 +226,7 @@ public class BusinessSampleDispatchServiceImpl implements BusinessSampleDispatch handoverRecord.setOperatorId(givebackUserId); handoverRecord.setSendSampleOperator(givebackUser); //送样人 handoverRecord.setReceiveSampleOperator(warehouseUser); //收样人 + handoverRecord.setSampleFlowNodeKey(QmsCommonConstant.FLOW_SAMPLE_STORAGE); handoverRecordList.add(handoverRecord); } businessSampleDispatchDetailService.updateBatch(detailUpdateList); diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/BusinessSubSampleServiceImpl.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/BusinessSubSampleServiceImpl.java index 4daa516..5bce1cb 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/BusinessSubSampleServiceImpl.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/bus/service/BusinessSubSampleServiceImpl.java @@ -15,6 +15,8 @@ import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigSubSampleDO; import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigWarehouseLocationDO; import com.zt.plat.module.qms.business.config.service.ConfigSubSampleService; import com.zt.plat.module.qms.business.config.service.ConfigWarehouseLocationService; +import com.zt.plat.module.qms.common.dic.dal.dataobject.DictionaryBusinessDO; +import com.zt.plat.module.qms.common.dic.dal.mapper.DictionaryBusinessMapper; import com.zt.plat.module.qms.common.dic.service.DictionaryBusinessService; import com.zt.plat.module.qms.core.code.SequenceUtil; import com.zt.plat.module.qms.enums.QmsCommonConstant; @@ -43,6 +45,7 @@ import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.e import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception0; import static com.zt.plat.framework.common.util.collection.CollectionUtils.convertList; import static com.zt.plat.module.qms.enums.ErrorCodeConstants.*; +import static com.zt.plat.module.qms.enums.QmsCommonConstant.SAMPLE_STORAGE_OPERATION_TYPE_TAKEN_OFF; /** * 子样业务 Service 实现类 @@ -66,6 +69,8 @@ public class BusinessSubSampleServiceImpl implements BusinessSubSampleService { @Resource private DictionaryBusinessService dictionaryBusinessService; @Resource private ConfigSubSampleService configSubSampleService; @Resource private SequenceUtil sequenceUtil; + @Resource + private DictionaryBusinessMapper dictionaryBusinessMapper; @Override @Transactional(rollbackFor = Exception.class) @@ -325,18 +330,17 @@ public class BusinessSubSampleServiceImpl implements BusinessSubSampleService { //创建交接抬头 BusinessSampleHandoverSaveReqVO handoverVO = new BusinessSampleHandoverSaveReqVO(); - String codeTemplate = dictionaryBusinessService.getValueByDataKey("sample_take_off_serial"); - if(ObjectUtils.isEmpty(codeTemplate)) - throw exception0(BUSINESS_SUB_SAMPLE_NOT_EXISTS.getCode(), "缺少“样品下架记录编号规则”的配置,请在业务参数字典增加此配置!"); - String code = sequenceUtil.genCode(codeTemplate); + String code = sequenceUtil.genCode("QMS_SAMPLE_TAKE_OFF_SERIAL"); handoverVO.setCode(code); handoverVO.setName("样品下架记录"); handoverVO.setSampleFlowNodeKey(QmsCommonConstant.FLOW_SAMPLE_STORAGE); handoverVO.setOperationTime(LocalDateTime.now()); handoverVO.setOperator(loginUserName); handoverVO.setOperatorId(loginUser.getId()); + handoverVO.setOperationType(SAMPLE_STORAGE_OPERATION_TYPE_TAKEN_OFF); BusinessSampleHandoverRespVO handoverRespVO = businessSampleHandoverService.createBusinessSampleHandover(handoverVO); - + List dictionaryBusinessIdList = waitingList.stream().map(m -> m.getDictionaryBusinessId()).distinct().collect(Collectors.toList()); + List dictionaryBusinessList = dictionaryBusinessMapper.selectByIds(dictionaryBusinessIdList); //更新下架状态 List recordList = new ArrayList<>(); List detailList = new ArrayList<>(); //通过样品交接明细记录下架记录 @@ -361,6 +365,11 @@ public class BusinessSubSampleServiceImpl implements BusinessSubSampleService { detailDO.setBusinessSubSampleId(businessSubSampleDO.getId()); detailDO.setSampleName(businessSubSampleDO.getSampleName()); detailDO.setSampleCode(businessSubSampleDO.getSampleReturnCode()); + detailDO.setDictionaryBusinessId(businessSubSampleDO.getDictionaryBusinessId()); + DictionaryBusinessDO dictionaryBusiness = dictionaryBusinessList.stream().filter(f -> f.getId().equals(businessSubSampleDO.getDictionaryBusinessId())).findFirst().orElse(null); + detailDO.setDictionaryBusinessName(""); + if(dictionaryBusiness != null) + detailDO.setDictionaryBusinessName(dictionaryBusiness.getName()); detailList.add(detailDO); } businessHandoverRecordSubService.insertBatch(recordList); diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/reportdoc/service/ReportDocumentDataServiceImpl.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/reportdoc/service/ReportDocumentDataServiceImpl.java index 40b2521..e185723 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/reportdoc/service/ReportDocumentDataServiceImpl.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/reportdoc/service/ReportDocumentDataServiceImpl.java @@ -21,8 +21,6 @@ import org.springframework.util.ObjectUtils; import org.springframework.validation.annotation.Validated; import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; import java.util.List; import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception; @@ -113,12 +111,14 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService return new ArrayList<>(); JSONObject jsonObject = JSONObject.parseObject(customConfig); Integer dynamicColCount = 3; - Integer fixedColCount = 3; + Integer fixedColCount = 0; Integer maxRowCount = 3; String dynamicColCountStr = jsonObject.getString("dynamicColCount"); //动态列(检测项)数量 - String fixedColCountStr = jsonObject.getString("fixedColCount"); //固定列(样品名称、样品编号等)数量 +// String fixedColCountStr = jsonObject.getString("fixedColCount"); //固定列(样品名称、样品编号等)数量 + JSONArray fixedCol = jsonObject.getJSONArray("fixedCol"); //固定列,举例:["sampleName", "sampleCode"] + JSONArray fixedColShow = jsonObject.getJSONArray("fixedColShow"); //固定列,举例:["产品名称", "编 号"] String maxRowCountStr = jsonObject.getString("maxRowCount"); //最大行数 - String nameCodeType = jsonObject.getString("nameCodeType"); //名称、编号处理方式:merge-合并, name-只显示名称, code-只显示编号, split-2列分开显示 +// String nameCodeType = jsonObject.getString("nameCodeType"); //名称、编号处理方式:merge-合并, name-只显示名称, code-只显示编号, split-2列分开显示 String hasRemark = jsonObject.getString("hasRemark"); //是否有备注 String hasRange = jsonObject.getString("hasRange"); //是否有检出限 String verticalFlag = jsonObject.getString("verticalFlag"); //vertical-纵表, 否则为横表 @@ -130,7 +130,7 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService return assembleFixedFieldsData(fieldList, dataList, customConfig); } if(!ObjectUtils.isEmpty(dynamicColCountStr)) dynamicColCount = Integer.parseInt(dynamicColCountStr); - if(!ObjectUtils.isEmpty(fixedColCountStr)) fixedColCount = Integer.parseInt(fixedColCountStr); + if(fixedCol != null) fixedColCount = fixedCol.size(); if(!ObjectUtils.isEmpty(maxRowCountStr)) maxRowCount = Integer.parseInt(maxRowCountStr); Integer eleCount = 0; //元素数量,即元素列总数 @@ -144,14 +144,14 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService Integer colCountOneSample = fixedColCount + dynamicColCount; //每个样品要占的列数 Integer dataLength = dataList.size(); Integer emptyRowCount = dataLength < maxRowCount ? 1 : 0; //空行数 - Integer allRowCount = 1 + dataLength + emptyRowCount + 1; //标题 + 样品数 + 空行 +// Integer allRowCount = 1 + dataLength + emptyRowCount + 1; //标题 + 样品数 + 空行 if("1".equals(hasRange)) emptyRowCount ++; - if(rowCountOneSample > 1){ - allRowCount = (1 + dataLength + emptyRowCount + 9) * rowCountOneSample + emptyRowCount; //(标题 + 样品数 + 空行) * 但样品行数 + 末尾行 - } +// if(rowCountOneSample > 1){ +// allRowCount = (1 + dataLength + emptyRowCount + 9) * rowCountOneSample + emptyRowCount; //(标题 + 样品数 + 空行) * 但样品行数 + 末尾行 +// } List rowList = new ArrayList<>(); for(int i = 0; i < maxRowCount; i++){ JSONObject row = new JSONObject(); @@ -193,7 +193,7 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService r.put(colPrefix + "01", "方法检出限"); lastObjFlag = true; if(colIndex % colCountOneSample == 0){ - addTitleToRowList(nameCodeType, rowAssist, t, dataLength, emptyRowCount, rowList, fieldList); + addTitleToRowList(rowAssist, t, dataLength, emptyRowCount, rowList, fieldList); if("1".equals(hasRange)) addRangeToRowList(rowAssist, r, dataLength, emptyRowCount, rowList); t = new JSONObject(); @@ -211,7 +211,7 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService colIndex++; } if(lastObjFlag){ - addTitleToRowList(nameCodeType, rowAssist, t, dataLength, emptyRowCount, rowList, fieldList); + addTitleToRowList(rowAssist, t, dataLength, emptyRowCount, rowList, fieldList); if("1".equals(hasRange)) addRangeToRowList(rowAssist, r, dataLength, emptyRowCount, rowList); } @@ -252,7 +252,7 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService t.put(colPrefix + colKey, fieldValue); lastObjFlag = true; if(colIndex % colCountOneSample == 0){ - addDataToRowList(nameCodeType, dataDO, rowAssist, t, dataLength, emptyRowCount, dataIndex, rowList, fieldList); + addFixedDataToRowList(fixedCol, dataDO, rowAssist, t, dataLength, emptyRowCount, dataIndex, rowList, fieldList); t = new JSONObject(); if("1".equals(hasRemark)){ t.put(colPrefix + parseNumToString(colCountOneSample + 1, 2), remark); @@ -265,7 +265,7 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService colIndex++; } if(lastObjFlag){ - addDataToRowList(nameCodeType, dataDO, rowAssist, t, dataLength, emptyRowCount, dataIndex, rowList, fieldList); + addFixedDataToRowList(fixedCol, dataDO, rowAssist, t, dataLength, emptyRowCount, dataIndex, rowList, fieldList); } dataIndex ++; } @@ -290,30 +290,15 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService } /** - * @param nameCodeType: merge-合并, name-只显示名称, code-只显示编号, split-2列分开显示 + * @param * * */ - private void addTitleToRowList(String nameCodeType, Integer rowAssist, JSONObject t, Integer dataLength, Integer emptyRowCount, + private void addTitleToRowList(Integer rowAssist, JSONObject t, Integer dataLength, Integer emptyRowCount, List rowList, List fieldList){ int rowIndex = (1 + dataLength + emptyRowCount) * (rowAssist - 1) + 1; //(标题 + 数据行 + 空行) //处理固定列 int index = 1; - String colKey = parseNumToString(index, 2); - if(name_code_merge.equals(nameCodeType)){ - t.put(colPrefix + colKey, "样品名称及编号"); - rowList.set(rowIndex, t.clone()); - return; - } - if(name_code_name.equals(nameCodeType)){ - t.put(colPrefix + colKey, "样品名称"); - rowList.set(rowIndex, t.clone()); - return; - } - if(name_code_code.equals(nameCodeType)){ - t.put(colPrefix + colKey, "样品编号"); - rowList.set(rowIndex, t.clone()); - return; - } + String colKey = ""; for(ConfigReportFieldDO fieldDO : fieldList){ String fieldName = fieldDO.getFieldName(); String fieldType = fieldDO.getFieldType(); @@ -336,44 +321,63 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService } - private void addDataToRowList(String nameCodeType, ReportDocumentDataDO dataDO, Integer rowAssist, JSONObject t, Integer dataLength, Integer emptyRowCount, Integer dataIndex, List rowList, List fieldList){ + /** + * 添加固定列的数据 + * */ + private void addFixedDataToRowList(JSONArray fixedCol, ReportDocumentDataDO dataDO, Integer rowAssist, JSONObject t, Integer dataLength, Integer emptyRowCount, Integer dataIndex, List rowList, List fieldList){ int rowIndex = (1 + dataLength + emptyRowCount) * (rowAssist - 1) + dataIndex + 1; //(标题 + 数据行 + 空行) t.put("id", dataDO.getId()); //处理固定列 int index = 1; //处理固定列 - String colKey = parseNumToString(index, 2); - if(name_code_merge.equals(nameCodeType)){ - String merge = dataDO.getSampleName() + " " + dataDO.getSampleCode(); - t.put(colPrefix + colKey, merge); - rowList.set(rowIndex, t.clone()); - return; - } - if(name_code_name.equals(nameCodeType)){ - t.put(colPrefix + colKey, dataDO.getSampleName()); - rowList.set(rowIndex, t.clone()); - return; - } - if(name_code_code.equals(nameCodeType)){ - t.put(colPrefix + colKey, dataDO.getSampleCode()); - rowList.set(rowIndex, t.clone()); - return; - } - for(ConfigReportFieldDO fieldDO : fieldList){ - String fieldName = fieldDO.getFieldName(); - String fieldType = fieldDO.getFieldType(); - String field = fieldDO.getField(); - if(FIELD_FIXED.equals(fieldType)){ + String colKey = ""; + if(fixedCol != null && !fixedCol.isEmpty()){ + for(int i=0;i and wrh.CD = #{param.warehouseCode} - + and not exists( select 1 from T_BSN_SMP_DST_DTL d left join T_BSN_SMP_DST m on d.PRN_ID = m.ID where d.BSN_SB_SMP_ID = smp.ID