|
@@ -1,12 +1,24 @@
|
|
package com.dayou.service.impl;
|
|
package com.dayou.service.impl;
|
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
|
+import com.dayou.common.BaseEntity;
|
|
import com.dayou.configuration.DfsConfig;
|
|
import com.dayou.configuration.DfsConfig;
|
|
|
|
+import com.dayou.dto.TaskRecordDTO;
|
|
|
|
+import com.dayou.dto.WareHouseDTO;
|
|
|
|
+import com.dayou.dto.WorkNodeCommit;
|
|
|
|
+import com.dayou.entity.MajorProduction;
|
|
|
|
+import com.dayou.entity.WorkTaskRecord;
|
|
import com.dayou.enums.MainBusinessEnum;
|
|
import com.dayou.enums.MainBusinessEnum;
|
|
|
|
+import com.dayou.enums.workflow.WorkflowNodeEnum;
|
|
import com.dayou.mapper.MajorProductionMapper;
|
|
import com.dayou.mapper.MajorProductionMapper;
|
|
import com.dayou.mapper.PersonalTargetMapper;
|
|
import com.dayou.mapper.PersonalTargetMapper;
|
|
-import com.dayou.service.IBusinessProductionService;
|
|
|
|
-import com.dayou.service.IPersonalTargetService;
|
|
|
|
|
|
+import com.dayou.mapper.WorkFlowNodeInstanceMapper;
|
|
|
|
+import com.dayou.service.*;
|
|
|
|
+import com.dayou.service.workflow.IWorkFlowNodeInstanceService;
|
|
|
|
+import com.dayou.service.workflow.IWorkFlowService;
|
|
|
|
+import com.dayou.service.workflow.IWorkTaskRecordService;
|
|
import com.dayou.utils.FileUploadUtils;
|
|
import com.dayou.utils.FileUploadUtils;
|
|
import com.dayou.utils.PersonalUtils;
|
|
import com.dayou.utils.PersonalUtils;
|
|
import com.dayou.utils.QRCodeUtil;
|
|
import com.dayou.utils.QRCodeUtil;
|
|
@@ -18,12 +30,16 @@ import org.springframework.context.ResourceLoaderAware;
|
|
import org.springframework.core.io.Resource;
|
|
import org.springframework.core.io.Resource;
|
|
import org.springframework.core.io.ResourceLoader;
|
|
import org.springframework.core.io.ResourceLoader;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.io.*;
|
|
import java.io.*;
|
|
|
|
+import java.time.LocalDateTime;
|
|
|
|
+import java.util.Map;
|
|
|
|
|
|
import static com.dayou.common.Constants.PNG;
|
|
import static com.dayou.common.Constants.PNG;
|
|
import static com.dayou.common.Constants.PROD_VALIDATE_URI;
|
|
import static com.dayou.common.Constants.PROD_VALIDATE_URI;
|
|
import static com.dayou.enums.MainBusinessEnum.PERSONAL_BUSINESS;
|
|
import static com.dayou.enums.MainBusinessEnum.PERSONAL_BUSINESS;
|
|
|
|
+import static com.dayou.enums.workflow.NodeLogEnum.PASS;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 类说明:
|
|
* 类说明:
|
|
@@ -46,6 +62,23 @@ public class BusinessProductionServiceImpl implements IBusinessProductionService
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private DfsConfig dfsConfig;
|
|
private DfsConfig dfsConfig;
|
|
|
|
+ @Autowired
|
|
|
|
+ private IMajorProductionService majorProductionService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private WorkFlowNodeInstanceMapper workFlowNodeInstanceMapper;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private IPersonalProductionService personalProductionService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private IAssetsProductionService assetsProductionService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private IWorkFlowService workFlowService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private IWorkTaskRecordService workTaskRecordService;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void setResourceLoader(ResourceLoader resourceLoader) {
|
|
public void setResourceLoader(ResourceLoader resourceLoader) {
|
|
@@ -116,4 +149,73 @@ public class BusinessProductionServiceImpl implements IBusinessProductionService
|
|
throw new RuntimeException(e);
|
|
throw new RuntimeException(e);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Transactional
|
|
|
|
+ @Override
|
|
|
|
+ public Boolean inOutWareHouse(String productionNo) {
|
|
|
|
+ if (StrUtil.isNotBlank(productionNo)){
|
|
|
|
+
|
|
|
|
+ Map<String,Object> nodeMap = workFlowNodeInstanceMapper.getInOutInstanceNode(productionNo);
|
|
|
|
+ MainBusinessEnum businessType = MainBusinessEnum.valueOf((String) nodeMap.get("businessType"));
|
|
|
|
+ Long businessId = (Long) nodeMap.get("businessId");
|
|
|
|
+ Long recodeId = (Long) nodeMap.get("id");
|
|
|
|
+ String code = (String) nodeMap.get("code");
|
|
|
|
+
|
|
|
|
+ //完成出库业务操作
|
|
|
|
+ Boolean doRet = doInOutWareHouse(businessType, businessId, recodeId, productionNo);
|
|
|
|
+
|
|
|
|
+ if (doRet){
|
|
|
|
+ //提交工作流节点
|
|
|
|
+ WorkNodeCommit workNodeCommit = new WorkNodeCommit();
|
|
|
|
+ workNodeCommit.setState(PASS);
|
|
|
|
+ workNodeCommit.setIfCheckTask(true);
|
|
|
|
+ workNodeCommit.setComments(code.contains("IN")?"入库":"出库");
|
|
|
|
+ workNodeCommit.setInstanceNodeId((Long) nodeMap.get("instanceId"));
|
|
|
|
+ workNodeCommit.setBusinessSubId((String) nodeMap.get("businessSubId"));
|
|
|
|
+ workNodeCommit.setBusinessMinId((String) nodeMap.get("businessMinId"));
|
|
|
|
+ return workFlowService.commit(workNodeCommit);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ return Boolean.FALSE;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private Boolean doInOutWareHouse(MainBusinessEnum businessEnum,Long businessId,Long recordId,String productionNo) {
|
|
|
|
+ TaskRecordDTO<WareHouseDTO> taskRecordDTO = new TaskRecordDTO<>();
|
|
|
|
+ taskRecordDTO.setRecordId(recordId);
|
|
|
|
+ Boolean doWareHouseRet = Boolean.FALSE;
|
|
|
|
+ switch (businessEnum){
|
|
|
|
+ case PERSONAL_BUSINESS:
|
|
|
|
+
|
|
|
|
+ break;
|
|
|
|
+ case MAJOR_BUSINESS:
|
|
|
|
+ MajorProduction mp = majorProductionService.getOne(new LambdaQueryWrapper<MajorProduction>()
|
|
|
|
+ .select(BaseEntity::getId,MajorProduction::getProduction,MajorProduction::getRepertoryState)
|
|
|
|
+ .eq(MajorProduction::getMajorId, businessId)
|
|
|
|
+ .eq(MajorProduction::getReportNo, productionNo));
|
|
|
|
+ Long productionId = mp.getId();
|
|
|
|
+ String productionType = mp.getProduction();
|
|
|
|
+ Boolean state = mp.getRepertoryState()==null?Boolean.FALSE:Boolean.TRUE;
|
|
|
|
+ WareHouseDTO wareHouseDTO = WareHouseDTO.builder()
|
|
|
|
+ .productionId(productionId)
|
|
|
|
+ .productionType(productionType)
|
|
|
|
+ .repertoryState(Boolean.FALSE)
|
|
|
|
+ .repertoryState(state)
|
|
|
|
+ .reportNo(productionNo).build();
|
|
|
|
+ taskRecordDTO.setTaskData(wareHouseDTO);
|
|
|
|
+ doWareHouseRet = majorProductionService.warehouse(taskRecordDTO);
|
|
|
|
+ break;
|
|
|
|
+ case ASSET_BUSINESS:
|
|
|
|
+ break;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ if (doWareHouseRet){
|
|
|
|
+ //完成任务
|
|
|
|
+ return workTaskRecordService.update(new LambdaUpdateWrapper<WorkTaskRecord>().set(WorkTaskRecord::getFinished, Boolean.TRUE)
|
|
|
|
+ .set(WorkTaskRecord::getFinishTime, LocalDateTime.now()).eq(BaseEntity::getId, recordId));
|
|
|
|
+ }
|
|
|
|
+ return doWareHouseRet;
|
|
|
|
+
|
|
|
|
+ }
|
|
}
|
|
}
|