|
|
|
@ -9,7 +9,10 @@ import org.springblade.common.exception.BusinessException; |
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
import org.springblade.core.secure.BladeUser; |
|
|
|
import org.springblade.core.secure.BladeUser; |
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
|
|
|
|
import org.springblade.desk.common.feign.IMesApprovalRecordClient; |
|
|
|
|
|
|
|
import org.springblade.desk.common.pojo.entity.MesApprovalRecordEntity; |
|
|
|
import org.springblade.erpdata.feign.IErpDataWmsClient; |
|
|
|
import org.springblade.erpdata.feign.IErpDataWmsClient; |
|
|
|
|
|
|
|
import org.springblade.system.feign.ISysClient; |
|
|
|
import org.springblade.system.feign.IUserClient; |
|
|
|
import org.springblade.system.feign.IUserClient; |
|
|
|
import org.springblade.system.pojo.entity.User; |
|
|
|
import org.springblade.system.pojo.entity.User; |
|
|
|
import org.springblade.wms.excel.StMoldApplyForExcel; |
|
|
|
import org.springblade.wms.excel.StMoldApplyForExcel; |
|
|
|
@ -37,7 +40,11 @@ public class StMoldApplyForServiceImpl extends BaseServiceImpl<StMoldApplyForMap |
|
|
|
@Resource |
|
|
|
@Resource |
|
|
|
IUserClient userClient; |
|
|
|
IUserClient userClient; |
|
|
|
@Resource |
|
|
|
@Resource |
|
|
|
|
|
|
|
ISysClient sysClient; |
|
|
|
|
|
|
|
@Resource |
|
|
|
IErpDataWmsClient erpDataWmsClient; |
|
|
|
IErpDataWmsClient erpDataWmsClient; |
|
|
|
|
|
|
|
@Resource |
|
|
|
|
|
|
|
IMesApprovalRecordClient mesApprovalRecordClient; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public IPage<StMoldApplyForVO> selectStMoldApplyForPage(IPage<StMoldApplyForVO> page, StMoldApplyForVO stMoldApplyFor) { |
|
|
|
public IPage<StMoldApplyForVO> selectStMoldApplyForPage(IPage<StMoldApplyForVO> page, StMoldApplyForVO stMoldApplyFor) { |
|
|
|
@ -55,29 +62,14 @@ public class StMoldApplyForServiceImpl extends BaseServiceImpl<StMoldApplyForMap |
|
|
|
plan.setCreateUser(user.getUserId()); |
|
|
|
plan.setCreateUser(user.getUserId()); |
|
|
|
plan.setCreateTime(new Date()); |
|
|
|
plan.setCreateTime(new Date()); |
|
|
|
|
|
|
|
|
|
|
|
R<User> ruser = userClient.userInfoById(plan.getKeeper()); |
|
|
|
|
|
|
|
User keeper = ruser.getData(); |
|
|
|
|
|
|
|
String erpWoCode = null; |
|
|
|
|
|
|
|
// 1. 调 ERP
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
erpWoCode = erpDataWmsClient.createMoldPlan( |
|
|
|
|
|
|
|
plan.getPartCode(), plan.getMoCode(), plan.getPlanType(), |
|
|
|
|
|
|
|
plan.getQuantity(), plan.getNeedDate(), plan.getQuaLevel(), |
|
|
|
|
|
|
|
keeper.getAccount(), user.getAccount(), |
|
|
|
|
|
|
|
StrUtil.blankToDefault(plan.getMemo(), ""), |
|
|
|
|
|
|
|
plan.getUrgentType(), StrUtil.nullToEmpty(plan.getErpWoCode())).getData(); |
|
|
|
|
|
|
|
} catch (BusinessException e) { |
|
|
|
|
|
|
|
throw new RuntimeException("创建模具计划失败:" + e.getMessage()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 2. 本地落库
|
|
|
|
// 2. 本地落库
|
|
|
|
if (plan.getId() != null) { // 修改
|
|
|
|
if (plan.getId() != null) { // 修改
|
|
|
|
plan.setErpWoCode(erpWoCode); |
|
|
|
// plan.setErpWoCode(erpWoCode);
|
|
|
|
this.updateById(plan); |
|
|
|
this.updateById(plan); |
|
|
|
} else { // 新增
|
|
|
|
} else { // 新增
|
|
|
|
plan.setErpWoCode(erpWoCode); |
|
|
|
// plan.setErpWoCode(erpWoCode);
|
|
|
|
plan.setMafType((short) 2); |
|
|
|
plan.setMafType((short) 2); |
|
|
|
plan.setMafStatus(StMoldApplyFor.MAF_STATUS_HAVE); |
|
|
|
plan.setMafStatus(StMoldApplyFor.MAF_STATUS_NEW); |
|
|
|
this.save(plan); |
|
|
|
this.save(plan); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -107,6 +99,7 @@ public class StMoldApplyForServiceImpl extends BaseServiceImpl<StMoldApplyForMap |
|
|
|
if (CollUtil.isNotEmpty(deleteIds)) { |
|
|
|
if (CollUtil.isNotEmpty(deleteIds)) { |
|
|
|
for (Long id : deleteIds) { |
|
|
|
for (Long id : deleteIds) { |
|
|
|
StMoldApplyFor plan = this.getById(id); |
|
|
|
StMoldApplyFor plan = this.getById(id); |
|
|
|
|
|
|
|
if (plan.getMafStatus() == 2) { |
|
|
|
if (plan == null) continue; |
|
|
|
if (plan == null) continue; |
|
|
|
if (!StMoldApplyFor.MAF_STATUS_OK.equals(plan.getMafStatus())) { |
|
|
|
if (!StMoldApplyFor.MAF_STATUS_OK.equals(plan.getMafStatus())) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
@ -120,9 +113,78 @@ public class StMoldApplyForServiceImpl extends BaseServiceImpl<StMoldApplyForMap |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
return this.deleteLogic(deleteIds); |
|
|
|
return this.deleteLogic(deleteIds); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public boolean renderApproval(List<StMoldApplyFor> list){ |
|
|
|
|
|
|
|
for (StMoldApplyFor plan : list){ |
|
|
|
|
|
|
|
plan.setMafStatus(StMoldApplyFor.MAF_STATUS_CONFIRMED); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MesApprovalRecordEntity approvalRecord = new MesApprovalRecordEntity(); |
|
|
|
|
|
|
|
approvalRecord.setBizId(plan.getId()); |
|
|
|
|
|
|
|
approvalRecord.setBizType("工装计划申报审批"); |
|
|
|
|
|
|
|
approvalRecord.setContent("工装计划申报审批"); |
|
|
|
|
|
|
|
R<User> ruse = userClient.userInfoById(plan.getCreateUser()); |
|
|
|
|
|
|
|
User user1 = ruse.getData(); |
|
|
|
|
|
|
|
approvalRecord.setCurrentRoleId(Long.valueOf(user1.getRoleId().split(",")[0])); |
|
|
|
|
|
|
|
R<String> roleName = sysClient.getRoleName(approvalRecord.getCurrentRoleId()); |
|
|
|
|
|
|
|
String roleNameData = roleName.getData(); |
|
|
|
|
|
|
|
approvalRecord.setCurrentRoleName(roleNameData); |
|
|
|
|
|
|
|
approvalRecord.setNextRoleName("厂长,副厂长"); |
|
|
|
|
|
|
|
//租户ID 000000
|
|
|
|
|
|
|
|
R<String> roleIdResp = sysClient.getRoleIds("000000", approvalRecord.getNextRoleName()); |
|
|
|
|
|
|
|
String roleId = roleIdResp.getData(); |
|
|
|
|
|
|
|
approvalRecord.setNextRoleId(Long.valueOf(roleId)); |
|
|
|
|
|
|
|
mesApprovalRecordClient.save(approvalRecord); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return this.updateBatchById(list); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
|
|
|
public void approvalOrder(Long orderId, Short approvalResult, BladeUser approver) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
StMoldApplyFor plan = baseMapper.selectById(orderId); |
|
|
|
|
|
|
|
if (plan == null) { |
|
|
|
|
|
|
|
throw new RuntimeException("工装申报不存在!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (StMoldApplyFor.APPROVAL_STATUS_CHECKED == plan.getApprovalStatus()) { |
|
|
|
|
|
|
|
throw new RuntimeException("该工装申报单已审批通过,无需重复审批!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plan.setApprovalStatus(approvalResult); |
|
|
|
|
|
|
|
plan.setApprovalMan(approver.getUserId()); |
|
|
|
|
|
|
|
plan.setApprovalTime(new Date()); |
|
|
|
|
|
|
|
baseMapper.updateById(plan); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (plan.getApprovalStatus() == 1) { |
|
|
|
|
|
|
|
R<User> ruser = userClient.userInfoById(plan.getKeeper()); |
|
|
|
|
|
|
|
User keeper = ruser.getData(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
R<User> ruse = userClient.userInfoById(plan.getCreateUser()); |
|
|
|
|
|
|
|
User user = ruse.getData(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String erpWoCode = null; |
|
|
|
|
|
|
|
// 调 ERP
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
erpWoCode = erpDataWmsClient.createMoldPlan( |
|
|
|
|
|
|
|
plan.getPartCode(), plan.getMoCode(), plan.getPlanType(), |
|
|
|
|
|
|
|
plan.getQuantity(), plan.getNeedDate(), plan.getQuaLevel(), |
|
|
|
|
|
|
|
keeper.getAccount(), user.getAccount(), |
|
|
|
|
|
|
|
StrUtil.blankToDefault(plan.getMemo(), ""), |
|
|
|
|
|
|
|
plan.getUrgentType(), StrUtil.nullToEmpty(plan.getErpWoCode())).getData(); |
|
|
|
|
|
|
|
} catch (BusinessException e) { |
|
|
|
|
|
|
|
throw new RuntimeException("创建模具计划失败:" + e.getMessage()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
plan.setErpWoCode(erpWoCode); |
|
|
|
|
|
|
|
plan.setMafStatus(StMoldApplyFor.MAF_STATUS_HAVE); |
|
|
|
|
|
|
|
baseMapper.updateById(plan); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public List<StMoldApplyForExcel> exportStMoldApplyFor(Wrapper<StMoldApplyFor> queryWrapper) { |
|
|
|
public List<StMoldApplyForExcel> exportStMoldApplyFor(Wrapper<StMoldApplyFor> queryWrapper) { |
|
|
|
List<StMoldApplyForExcel> stMoldApplyForList = baseMapper.exportStMoldApplyFor(queryWrapper); |
|
|
|
List<StMoldApplyForExcel> stMoldApplyForList = baseMapper.exportStMoldApplyFor(queryWrapper); |
|
|
|
|