Browse Source

Merge remote-tracking branch 'origin/dev' into dev

dev
zhangsiqi 4 months ago
parent
commit
4e2984bed4
  1. 11
      ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeOrderController.java
  2. 2
      ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysMakeorderDeptService.java
  3. 39
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeorderDeptServiceImpl.java
  4. 28
      ruoyi-admin/src/main/resources/templates/system/makeorder/bmzgqr.html

11
ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysMakeOrderController.java

@ -10,6 +10,7 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.exception.BusinessException;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
@ -273,10 +274,10 @@ public class SysMakeOrderController extends BaseController
public AjaxResult deptReview(SysMakeorderDeptDto makeorderDeptDto){
List<SysMakeorderDept> makeorderDeptList = makeorderDeptDto.getOrderDepts();
if(CollectionUtil.isEmpty(makeorderDeptList)){
AjaxResult.error("部门评审数据不能为空!");
throw new BusinessException("部门评审数据不能为空!");
}
makeorderDeptService.deptReview(makeorderDeptDto);
return AjaxResult.success("部门评审成功!");
return toAjax(makeorderDeptService.deptReview(makeorderDeptDto));
}
/**
@ -289,10 +290,10 @@ public class SysMakeOrderController extends BaseController
public AjaxResult deptLeaderConfirm(SysMakeorderDeptDto makeorderDeptDto){
List<SysMakeorderDept> makeorderDeptList = makeorderDeptDto.getOrderDepts();
if(CollectionUtil.isEmpty(makeorderDeptList)){
AjaxResult.error("部门主管确认数据不能为空!");
return AjaxResult.error("部门主管确认数据不能为空");
}
makeorderDeptService.deptLeaderConfirm(makeorderDeptDto);
return AjaxResult.success("部门评审成功!");
return AjaxResult.success("部门评审成功");
}
/**

2
ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysMakeorderDeptService.java

@ -83,7 +83,7 @@ public interface ISysMakeorderDeptService
* 部门评审
* @param makeorderDeptDto
*/
void deptReview(SysMakeorderDeptDto makeorderDeptDto);
public int deptReview(SysMakeorderDeptDto makeorderDeptDto);
/**
* 部门主管确认

39
ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeorderDeptServiceImpl.java

@ -3,6 +3,7 @@ package com.ruoyi.system.service.impl;
import java.util.List;
import cn.hutool.core.collection.CollectionUtil;
import com.ruoyi.common.exception.BusinessException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils;
@ -136,7 +137,7 @@ public class SysMakeorderDeptServiceImpl implements ISysMakeorderDeptService
@Override
@Transactional(rollbackFor = Exception.class)
public void deptReview(SysMakeorderDeptDto makeorderDeptDto) {
public int deptReview(SysMakeorderDeptDto makeorderDeptDto) {
String makeNo = makeorderDeptDto.getMakeNo();
List<SysMakeorderDept> makeorderDeptList = makeorderDeptDto.getOrderDepts();
// 部门预审数据是一起录入
@ -158,7 +159,8 @@ public class SysMakeorderDeptServiceImpl implements ISysMakeorderDeptService
makeOrder.setMakeNo(makeNo);
// 待部门主管确认
makeOrder.setMakeStatus("1");
makeOrderService.updateByMakeNo(makeOrder);
makeorderDeptList.forEach(dept->{
// 业务部门 无需部门领导确认
if("GMD".equals(dept.getDeptNumber())){
@ -170,28 +172,45 @@ public class SysMakeorderDeptServiceImpl implements ISysMakeorderDeptService
}
sysMakeorderDeptMapper.updateSysMakeorderDept(dept);
});
return makeOrderService.updateByMakeNo(makeOrder);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void deptLeaderConfirm(SysMakeorderDeptDto makeorderDeptDto) {
public void deptLeaderConfirm(SysMakeorderDeptDto makeorderDeptDto){
String makeNo = makeorderDeptDto.getMakeNo();
List<SysMakeorderDept> makeorderDeptList = makeorderDeptDto.getOrderDepts();
String deptNumber = ShiroUtils.getSysUser().getDept().getDeptNumber();
boolean hasUnconfirmedData = false; // 标记是否有未确认的数据
// 遍历所有部门数据
for (SysMakeorderDept dept : makeorderDeptList) {
// 检查当前部门数据的deptNumber是否与给定的deptNumber匹配
if (deptNumber.equals(dept.getDeptNumber())) {
// 检查deptLeaderConfirmStatus是否为空
if (dept.getDeptLeaderConfirmStatus().equals("0")) {
hasUnconfirmedData = true;
break; // 如果发现未确认的数据,可以直接退出循环
} else {
sysMakeorderDeptMapper.updateSysMakeorderDept(dept);
}
}
}
// 如果有未确认的数据,抛出异常或给出提示
if (hasUnconfirmedData) {
throw new BusinessException("有数据未被确认,请进行部门主管确认!");
}
// 工程部门领导确认完,生产状态更新为待工程审核
if("END".equals(deptNumber)){
if ("END".equals(deptNumber)) {
SysMakeOrder makeOrder = new SysMakeOrder();
makeOrder.setMakeNo(makeNo);
// 待工程审核
makeOrder.setMakeStatus("2");
makeOrderService.updateByMakeNo(makeOrder);
}
makeorderDeptList.forEach(dept->{
String deptLeaderConfirmStatus = dept.getDeptLeaderConfirmStatus();
if(StringUtils.isNotBlank(deptLeaderConfirmStatus)){
sysMakeorderDeptMapper.updateSysMakeorderDept(dept);
}
});
}
@Override

28
ruoyi-admin/src/main/resources/templates/system/makeorder/bmzgqr.html

@ -494,20 +494,20 @@
// alert(JSON.stringify(data));
// saveModal 保存不关闭
$.operate.save(prefix + "/deptLeaderConfirm", data);
var data = $('#bootstrap-sub-table-1').bootstrapTable('getData');
var count = data.length;
var allFormData;
for (let i = 0; i < count; i++) {
var childTableFormId = 'child_table_form_'+i;
if($("#"+childTableFormId).length>0){
if(i==0){
allFormData = $("#"+childTableFormId).serialize();
}else{
allFormData = allFormData +'&'+ $("#"+childTableFormId).serialize();
}
}
}
$.operate.save(prefix + "/deptReview", allFormData);
// var data = $('#bootstrap-sub-table-1').bootstrapTable('getData');
// var count = data.length;
// var allFormData;
// for (let i = 0; i < count; i++) {
// var childTableFormId = 'child_table_form_'+i;
// if($("#"+childTableFormId).length>0){
// if(i==0){
// allFormData = $("#"+childTableFormId).serialize();
// }else{
// allFormData = allFormData +'&'+ $("#"+childTableFormId).serialize();
// }
// }
// }
// $.operate.save(prefix + "/deptReview", allFormData);
}
</script>

Loading…
Cancel
Save