|
@@ -21,6 +21,8 @@ import com.platform.dao.entity.sb.SbInfo;
|
|
|
import com.platform.dao.entity.sb.SbModelSpareBom;
|
|
|
import com.platform.dao.entity.sb.SbOil;
|
|
|
import com.platform.dao.entity.store.*;
|
|
|
+import com.platform.dao.entity.upms.SysConfig;
|
|
|
+import com.platform.dao.entity.upms.SysUserDept;
|
|
|
import com.platform.dao.enums.*;
|
|
|
import com.platform.dao.mapper.project.ProjectMapper;
|
|
|
import com.platform.dao.mapper.repair.RepairApplicationFormMapper;
|
|
@@ -37,7 +39,11 @@ import com.platform.service.event.WorkplaceBacklogEvent;
|
|
|
import com.platform.service.store.OutStoreDetailService;
|
|
|
import com.platform.service.store.OutStoreFormService;
|
|
|
import com.platform.service.store.StoreService;
|
|
|
+import com.platform.service.upms.SysConfigService;
|
|
|
+import com.platform.service.upms.SysUserDeptService;
|
|
|
import com.platform.service.upms.SysUserRoleService;
|
|
|
+import com.platform.service.yongyou.YongyouService;
|
|
|
+import handler.yongyou.response.OtherOutAddResponse;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -60,13 +66,9 @@ import java.util.stream.Collectors;
|
|
|
@Service("outStoreFormService")
|
|
|
public class OutStoreFormServiceImpl extends BaseServiceImpl<OutStoreFormMapper, OutStoreForm, OutStoreFormDTO> implements OutStoreFormService {
|
|
|
private OutStoreDetailMapper detailMapper;
|
|
|
-
|
|
|
private StoreService storeService;
|
|
|
-
|
|
|
private SpareStoreMapper spareStoreMapper;
|
|
|
-
|
|
|
private SpareStoreSecondMapper spareStoreSecondMapper;
|
|
|
-
|
|
|
private SparePickFormMapper sparePickFormMapper;
|
|
|
private SparePickDetailMapper sparePickDetailMapper;
|
|
|
private InStoreFormServiceImpl inStoreFormServiceImpl;
|
|
@@ -77,6 +79,9 @@ public class OutStoreFormServiceImpl extends BaseServiceImpl<OutStoreFormMapper,
|
|
|
private OutStoreDetailService outStoreDetailService;
|
|
|
private ProjectMapper projectMapper;
|
|
|
private SbModelSpareBomMapper sbModelSpareBomMapper;
|
|
|
+ private SysConfigService sysConfigService;
|
|
|
+ private SysUserDeptService sysUserDeptService;
|
|
|
+ private YongyouService yongyouService;
|
|
|
|
|
|
@Override
|
|
|
public List<OutStoreFormVO> selectbyRepairForm(String id) {
|
|
@@ -292,22 +297,34 @@ public class OutStoreFormServiceImpl extends BaseServiceImpl<OutStoreFormMapper,
|
|
|
*/
|
|
|
@Override
|
|
|
public OutStoreForm saveModelByDTOYY(OutStoreFormDTO model) {
|
|
|
- ProjectVO project = projectMapper.selectById(model.getProjectId());
|
|
|
+ boolean verifyFlag = Boolean.TRUE; // 是否审核标识,默认审核
|
|
|
UserInfo userInfo = SecurityUtils.getUserInfo();
|
|
|
+ // 获取申请人部门
|
|
|
+ List<SysUserDept> depts = sysUserDeptService.selectByUserId(userInfo.getUserId());
|
|
|
+ if(depts == null || depts.size() == 0){
|
|
|
+ throw new DeniedException("申请人账号归属部门为空,不能领料");
|
|
|
+ }
|
|
|
+ // 获取超级部门ID,即可以随意领料部门
|
|
|
+ SysConfig config = sysConfigService.getByCode(SysConfigEnum.SUPER_OUT_STORE_DEPT_IDS.name());
|
|
|
+ String deptIds = config.getContent();
|
|
|
+ if(!deptIds.contains(depts.get(0).getDeptId())){
|
|
|
+ // 非工艺部做判断
|
|
|
+ validateStore(model.getDetailList());
|
|
|
+ }else{
|
|
|
+ // 工艺部的,加个标识,不审核,直接推送
|
|
|
+ verifyFlag = Boolean.FALSE;
|
|
|
+ }
|
|
|
+ ProjectVO project = projectMapper.selectById(model.getProjectId());
|
|
|
// selectCount会有分页参数,偶尔会出现bug,修复
|
|
|
BigDecimal countNum = mapper.getOutStoreFormCount1(new OutStoreFormDTO());
|
|
|
Integer count = 0;
|
|
|
if (countNum != null) {
|
|
|
count = countNum.intValue();
|
|
|
}
|
|
|
- /*Weekend<OutStoreForm> weekend = new Weekend<>(OutStoreForm.class);
|
|
|
- weekend.weekendCriteria().andIsNotNull(OutStoreForm::getId);
|
|
|
- Integer count = mapper.selectCountByExample(weekend);*/
|
|
|
model.setOutNo(IdGeneratorUtils.getOutStoreNo(++count));
|
|
|
model.setDelFlag(false);
|
|
|
model.setUserInfo(userInfo);
|
|
|
- model.setStatus(OutStoreStatusEnum.CREATED.getValue());
|
|
|
- // model.setType(OutStoreTypeEnum.CHUKU_LINGYONG.getValue());
|
|
|
+ model.setStatus(verifyFlag ? OutStoreStatusEnum.CREATED.getValue() : OutStoreStatusEnum.EXECUTING.getValue());
|
|
|
model.setUserInfo(userInfo);
|
|
|
// 出库单详情
|
|
|
List<OutStoreDetailDTO> detailList = model.getDetailList();
|
|
@@ -389,9 +406,25 @@ public class OutStoreFormServiceImpl extends BaseServiceImpl<OutStoreFormMapper,
|
|
|
throw new BusinessException("系统出错,请联系管理员!");
|
|
|
}
|
|
|
}
|
|
|
+ // 工艺部直接走推送接口
|
|
|
+ if(!verifyFlag){
|
|
|
+ yongyouService.addOutForm(outStoreForm.getId(), false);
|
|
|
+ }
|
|
|
return outStoreForm;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 校验仓库
|
|
|
+ * @param detailList
|
|
|
+ */
|
|
|
+ private void validateStore(List<OutStoreDetailDTO> detailList){
|
|
|
+ for(OutStoreDetailDTO detailDTO : detailList){
|
|
|
+ if(detailDTO.getStoreName().equals("备件辅材-工艺部")){
|
|
|
+ throw new DeniedException("非工艺部不能领取【备件辅材-工艺部】仓库材料");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
private void packageBom(List<SbModelSpareBom> boms,OutStoreDetailDTO detailDTO,String sbId){
|
|
|
SbModelSpareBom sbModelSpareBom = new SbModelSpareBom();
|