fix:样品库接口调整

This commit is contained in:
FCL
2025-11-25 18:21:59 +08:00
parent baa7884fd7
commit a3a31d8600
3 changed files with 28 additions and 7 deletions

View File

@@ -184,4 +184,11 @@ 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";
}

View File

@@ -137,8 +137,11 @@ public class BusinessSampleDispatchServiceImpl implements BusinessSampleDispatch
@Transactional(rollbackFor = Exception.class)
public CommonResult<String> 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);

View File

@@ -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<Long> dictionaryBusinessIdList = waitingList.stream().map(m -> m.getDictionaryBusinessId()).distinct().collect(Collectors.toList());
List<DictionaryBusinessDO> dictionaryBusinessList = dictionaryBusinessMapper.selectByIds(dictionaryBusinessIdList);
//更新下架状态
List<BusinessHandoverRecordSubDO> recordList = new ArrayList<>();
List<BusinessSampleHandoverDetailDO> 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);