|
|
|
@ -11,7 +11,6 @@ import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
|
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.desk.common.feign.IMesApprovalRecordClient; |
|
|
|
import org.springblade.desk.common.feign.IMesApprovalRecordClient; |
|
|
|
import org.springblade.desk.common.pojo.entity.MesApprovalRecordEntity; |
|
|
|
import org.springblade.desk.common.pojo.entity.MesApprovalRecordEntity; |
|
|
|
import org.springblade.system.feign.ISysClient; |
|
|
|
import org.springblade.system.feign.ISysClient; |
|
|
|
@ -26,7 +25,10 @@ import org.springblade.wms.service.*; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.*; |
|
|
|
import java.util.Collections; |
|
|
|
|
|
|
|
import java.util.Date; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
import java.util.Optional; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @version 1.0 |
|
|
|
* @version 1.0 |
|
|
|
@ -91,21 +93,27 @@ public class StClassRequestServiceImpl extends BaseServiceImpl<StClassRequestMap |
|
|
|
// 特殊物料:进入审批流程,状态设为【审批中】
|
|
|
|
// 特殊物料:进入审批流程,状态设为【审批中】
|
|
|
|
ccr.setApprovalStatus(StClassRequest.APPROVAL_STATUS_CHECKING); |
|
|
|
ccr.setApprovalStatus(StClassRequest.APPROVAL_STATUS_CHECKING); |
|
|
|
ccr.setCurStatus(StClassRequest.CURSTATUS_NEW); // 待审批
|
|
|
|
ccr.setCurStatus(StClassRequest.CURSTATUS_NEW); // 待审批
|
|
|
|
|
|
|
|
ccr.setApprover(ccr.getApprover()); |
|
|
|
|
|
|
|
|
|
|
|
MesApprovalRecordEntity approvalRecord = new MesApprovalRecordEntity(); |
|
|
|
MesApprovalRecordEntity approvalRecord = new MesApprovalRecordEntity(); |
|
|
|
approvalRecord.setBizId(ccr.getId()); |
|
|
|
approvalRecord.setBizId(ccr.getId()); |
|
|
|
approvalRecord.setBizType("班组提请审批"); |
|
|
|
approvalRecord.setBizType("班组提请审批"); |
|
|
|
approvalRecord.setContent("班组提请审批"); |
|
|
|
approvalRecord.setContent("班组提请审批"); |
|
|
|
R<User> ruser = userClient.userInfoById(ccr.getCrMan()); |
|
|
|
// R<User> ruser = userClient.userInfoById(ccr.getCrMan());
|
|
|
|
User user1 = ruser.getData(); |
|
|
|
// User user1 = ruser.getData();
|
|
|
|
approvalRecord.setCurrentRoleId(Long.valueOf(user1.getRoleId().split(",")[0])); |
|
|
|
// approvalRecord.setCurrentRoleId(Long.valueOf(user1.getRoleId().split(",")[0]));
|
|
|
|
R<String> roleName = sysClient.getRoleName(approvalRecord.getCurrentRoleId()); |
|
|
|
// R<String> roleName = sysClient.getRoleName(approvalRecord.getCurrentRoleId());
|
|
|
|
String roleNameData = roleName.getData(); |
|
|
|
// String roleNameData = roleName.getData();
|
|
|
|
approvalRecord.setCurrentRoleName(roleNameData); |
|
|
|
// approvalRecord.setCurrentRoleName(roleNameData);
|
|
|
|
approvalRecord.setNextRoleName("热表-工艺员"); |
|
|
|
// approvalRecord.setNextRoleName("热表-工艺员");
|
|
|
|
R<String> roleIdResp = sysClient.getRoleIds("000000", approvalRecord.getNextRoleName()); |
|
|
|
// R<String> roleIdResp = sysClient.getRoleIds("000000", approvalRecord.getNextRoleName());
|
|
|
|
String roleId = roleIdResp.getData(); |
|
|
|
// String roleId = roleIdResp.getData();
|
|
|
|
approvalRecord.setNextRoleId(Long.valueOf(roleId)); |
|
|
|
// approvalRecord.setNextRoleId(Long.valueOf(roleId));
|
|
|
|
|
|
|
|
approvalRecord.setCurrentUserId(user.getUserId()); |
|
|
|
|
|
|
|
approvalRecord.setCurrentUserName(user.getNickName()); |
|
|
|
|
|
|
|
User ruser = userClient.userInfoById(ccr.getApprover()).getData(); |
|
|
|
|
|
|
|
approvalRecord.setNextUserId(ccr.getApprover()); |
|
|
|
|
|
|
|
approvalRecord.setNextUserName(ruser.getRealName()); |
|
|
|
|
|
|
|
|
|
|
|
mesApprovalRecordClient.save(approvalRecord); |
|
|
|
mesApprovalRecordClient.save(approvalRecord); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
@ -165,9 +173,11 @@ public class StClassRequestServiceImpl extends BaseServiceImpl<StClassRequestMap |
|
|
|
public void approvalRequest(Long id, Short approvalResult, BladeUser approver) { |
|
|
|
public void approvalRequest(Long id, Short approvalResult, BladeUser approver) { |
|
|
|
// 1. 校验工艺员权限
|
|
|
|
// 1. 校验工艺员权限
|
|
|
|
// String roleName = approver.getRoleName();
|
|
|
|
// String roleName = approver.getRoleName();
|
|
|
|
if (Objects.equals(approver.getRoleName(), "rb_craft")){ |
|
|
|
// if (Objects.equals(approver.getRoleName(), "rb_craft")){
|
|
|
|
|
|
|
|
StClassRequest ccr = this.getById(id); |
|
|
|
|
|
|
|
if (ccr.getApprover().equals(approver.getUserId())){ |
|
|
|
// 2. 查询数据
|
|
|
|
// 2. 查询数据
|
|
|
|
StClassRequest ccr = this.getById(id); |
|
|
|
// StClassRequest ccr = this.getById(id);
|
|
|
|
if (ccr == null) { |
|
|
|
if (ccr == null) { |
|
|
|
throw new RuntimeException("数据不存在!"); |
|
|
|
throw new RuntimeException("数据不存在!"); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -187,14 +197,12 @@ public class StClassRequestServiceImpl extends BaseServiceImpl<StClassRequestMap |
|
|
|
? StClassRequest.CURSTATUS_RELEASED : StClassRequest.CURSTATUS_NEW); |
|
|
|
? StClassRequest.CURSTATUS_RELEASED : StClassRequest.CURSTATUS_NEW); |
|
|
|
this.updateById(ccr); |
|
|
|
this.updateById(ccr); |
|
|
|
|
|
|
|
|
|
|
|
R<String> roleIdResp = sysClient.getRoleIds("000000", "热表-工艺员"); |
|
|
|
|
|
|
|
String roleId = roleIdResp.getData(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MesApprovalRecordEntity updateRecord = new MesApprovalRecordEntity(); |
|
|
|
MesApprovalRecordEntity updateRecord = new MesApprovalRecordEntity(); |
|
|
|
updateRecord.setBizId(id); |
|
|
|
updateRecord.setBizId(id); |
|
|
|
updateRecord.setBizType("班组提请审批"); |
|
|
|
updateRecord.setBizType("班组提请审批"); |
|
|
|
updateRecord.setOpinion(""); |
|
|
|
updateRecord.setOpinion(""); |
|
|
|
updateRecord.setNextRoleId(Long.valueOf(roleId)); |
|
|
|
// updateRecord.setNextRoleId(Long.valueOf(roleId));
|
|
|
|
|
|
|
|
updateRecord.setNextUserId(ccr.getApprover()); |
|
|
|
updateRecord.setStatus(Integer.valueOf(approvalResult)); |
|
|
|
updateRecord.setStatus(Integer.valueOf(approvalResult)); |
|
|
|
mesApprovalRecordClient.update(updateRecord); |
|
|
|
mesApprovalRecordClient.update(updateRecord); |
|
|
|
|
|
|
|
|
|
|
|
@ -262,7 +270,7 @@ public class StClassRequestServiceImpl extends BaseServiceImpl<StClassRequestMap |
|
|
|
item.setCurrentOutQty(cr.getCurrentOutQty()); |
|
|
|
item.setCurrentOutQty(cr.getCurrentOutQty()); |
|
|
|
Double applyQty = ObjectUtil.defaultIfNull(item.getQuantity(), 0.0); |
|
|
|
Double applyQty = ObjectUtil.defaultIfNull(item.getQuantity(), 0.0); |
|
|
|
|
|
|
|
|
|
|
|
item.setPicker(user.getUserId()); |
|
|
|
item.setPicker(cr.getPicker()); |
|
|
|
this.updateById(item); |
|
|
|
this.updateById(item); |
|
|
|
|
|
|
|
|
|
|
|
// 2. 直接 get 字段
|
|
|
|
// 2. 直接 get 字段
|
|
|
|
@ -272,6 +280,7 @@ public class StClassRequestServiceImpl extends BaseServiceImpl<StClassRequestMap |
|
|
|
Long rlsId = item.getRlsId(); |
|
|
|
Long rlsId = item.getRlsId(); |
|
|
|
Long goodsId = item.getGoodsId(); |
|
|
|
Long goodsId = item.getGoodsId(); |
|
|
|
Long crMan = item.getCrMan(); |
|
|
|
Long crMan = item.getCrMan(); |
|
|
|
|
|
|
|
Long picker = item.getPicker(); |
|
|
|
// Double applyQty = ObjectUtil.defaultIfNull(item.getQuantity(), 0.0); // 总申请数
|
|
|
|
// Double applyQty = ObjectUtil.defaultIfNull(item.getQuantity(), 0.0); // 总申请数
|
|
|
|
Double currentOutQty = item.getCurrentOutQty(); |
|
|
|
Double currentOutQty = item.getCurrentOutQty(); |
|
|
|
Double totalOutQty = historyOutQty + currentOutQty; |
|
|
|
Double totalOutQty = historyOutQty + currentOutQty; |
|
|
|
@ -304,11 +313,11 @@ public class StClassRequestServiceImpl extends BaseServiceImpl<StClassRequestMap |
|
|
|
|
|
|
|
|
|
|
|
// 4. 写入库记录
|
|
|
|
// 4. 写入库记录
|
|
|
|
String goodsCode = stGoodsService.getById(goodsId).getGoodsCode(); |
|
|
|
String goodsCode = stGoodsService.getById(goodsId).getGoodsCode(); |
|
|
|
sendStClassRequest(woCode, crCode, goodsCode, user, crMan, currentOutQty, rlsId); |
|
|
|
sendStClassRequest(woCode, crCode, goodsCode, user, crMan, currentOutQty, rlsId ,picker); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public String sendStClassRequest(String woCode, String crCode,String goodsCode, BladeUser user, Long crMan, Double quantity, Long rlsId) { |
|
|
|
public String sendStClassRequest(String woCode, String crCode,String goodsCode, BladeUser user, Long crMan, Double quantity, Long rlsId, Long picker) { |
|
|
|
|
|
|
|
|
|
|
|
/* 1. 库存校验【优化:补充真实库存数量校验,原逻辑只判null不判数量】 */ |
|
|
|
/* 1. 库存校验【优化:补充真实库存数量校验,原逻辑只判null不判数量】 */ |
|
|
|
// BladeUser loginUser = AuthUtil.getUser();
|
|
|
|
// BladeUser loginUser = AuthUtil.getUser();
|
|
|
|
@ -341,6 +350,7 @@ public class StClassRequestServiceImpl extends BaseServiceImpl<StClassRequestMap |
|
|
|
record.setSirCode(sirCode); |
|
|
|
record.setSirCode(sirCode); |
|
|
|
record.setInOutDate(new Date()); |
|
|
|
record.setInOutDate(new Date()); |
|
|
|
record.setInOutSource(StStockInoutRecord.INOUT_SOURCE_OTHER_OUT); |
|
|
|
record.setInOutSource(StStockInoutRecord.INOUT_SOURCE_OTHER_OUT); |
|
|
|
|
|
|
|
record.setUserId(picker); |
|
|
|
record.setDeptId(user.getDeptId()); |
|
|
|
record.setDeptId(user.getDeptId()); |
|
|
|
record.setCreateUser(user.getUserId()); |
|
|
|
record.setCreateUser(user.getUserId()); |
|
|
|
record.setUserId(crMan); |
|
|
|
record.setUserId(crMan); |
|
|
|
@ -375,7 +385,7 @@ public class StClassRequestServiceImpl extends BaseServiceImpl<StClassRequestMap |
|
|
|
stOtherOutRecord.setCrCode(crCode); |
|
|
|
stOtherOutRecord.setCrCode(crCode); |
|
|
|
stOtherOutRecord.setShId(stock.getShId()); |
|
|
|
stOtherOutRecord.setShId(stock.getShId()); |
|
|
|
stOtherOutRecord.setWoCode(woCode); |
|
|
|
stOtherOutRecord.setWoCode(woCode); |
|
|
|
stOtherOutRecord.setPicker(user.getUserId()); |
|
|
|
stOtherOutRecord.setPicker(picker); |
|
|
|
stOtherOutRecordService.save(stOtherOutRecord); |
|
|
|
stOtherOutRecordService.save(stOtherOutRecord); |
|
|
|
|
|
|
|
|
|
|
|
return sirCode; |
|
|
|
return sirCode; |
|
|
|
|