|
@@ -66,7 +66,6 @@ public class BizProductionPlanDetailSubDetailController extends BaseController {
|
|
HttpServletRequest request;
|
|
HttpServletRequest request;
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* 查询生产子计划明细列表
|
|
* 查询生产子计划明细列表
|
|
*/
|
|
*/
|
|
@@ -79,6 +78,7 @@ public class BizProductionPlanDetailSubDetailController extends BaseController {
|
|
List<BizProductionPlanDetailSubDetail> list = bizProductionPlanDetailSubDetailService.getList(bizProductionPlanDetailSubDetail);
|
|
List<BizProductionPlanDetailSubDetail> list = bizProductionPlanDetailSubDetailService.getList(bizProductionPlanDetailSubDetail);
|
|
return getDataTable(list);
|
|
return getDataTable(list);
|
|
}
|
|
}
|
|
|
|
+
|
|
@GetMapping("/getDept")
|
|
@GetMapping("/getDept")
|
|
public AjaxResult getDept() throws NoSuchFieldException, IllegalAccessException {
|
|
public AjaxResult getDept() throws NoSuchFieldException, IllegalAccessException {
|
|
Long userId = SecurityUtils.getLoginUser().getUser().getUserId();
|
|
Long userId = SecurityUtils.getLoginUser().getUser().getUserId();
|
|
@@ -86,8 +86,8 @@ public class BizProductionPlanDetailSubDetailController extends BaseController {
|
|
|
|
|
|
QueryWrapper<SysDeptUser> queryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<SysDeptUser> queryWrapper = new QueryWrapper<>();
|
|
queryWrapper.eq("user_id", userId);
|
|
queryWrapper.eq("user_id", userId);
|
|
- queryWrapper.eq("deleted",0);
|
|
|
|
- queryWrapper.eq("is_formman",1);
|
|
|
|
|
|
+ queryWrapper.eq("deleted", 0);
|
|
|
|
+ queryWrapper.eq("is_formman", 1);
|
|
// if (!"0".equals(tenantId)) {
|
|
// if (!"0".equals(tenantId)) {
|
|
// queryWrapper.eq("tenant_id", Long.valueOf(tenantId));
|
|
// queryWrapper.eq("tenant_id", Long.valueOf(tenantId));
|
|
// }
|
|
// }
|
|
@@ -105,8 +105,6 @@ public class BizProductionPlanDetailSubDetailController extends BaseController {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* 查询当前工段
|
|
* 查询当前工段
|
|
*/
|
|
*/
|
|
@@ -115,33 +113,32 @@ public class BizProductionPlanDetailSubDetailController extends BaseController {
|
|
public AjaxResult specialGetDeptList() throws NoSuchFieldException, IllegalAccessException {
|
|
public AjaxResult specialGetDeptList() throws NoSuchFieldException, IllegalAccessException {
|
|
Long userId = SecurityUtils.getLoginUser().getUser().getUserId();
|
|
Long userId = SecurityUtils.getLoginUser().getUser().getUserId();
|
|
List<Long> ids = new ArrayList<>();
|
|
List<Long> ids = new ArrayList<>();
|
|
- boolean isDispatch = false;
|
|
|
|
- if (userId != 1) {
|
|
|
|
- QueryWrapper<SysDeptUser> queryWrapper = new QueryWrapper<>();
|
|
|
|
- queryWrapper.eq("user_id", userId);
|
|
|
|
- queryWrapper.eq("deleted", 0);
|
|
|
|
- List<SysDeptUser> deptUserList = deptUserService.list(queryWrapper);
|
|
|
|
- if (deptUserList.size() > 0) {
|
|
|
|
- for (SysDeptUser item : deptUserList) {
|
|
|
|
- ids.add(item.getDeptId());
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- userId = 1L;
|
|
|
|
|
|
+ //先查询登陆人员的部门信息
|
|
|
|
+ QueryWrapper<SysDeptUser> queryWrapper = new QueryWrapper<>();
|
|
|
|
+ queryWrapper.eq("user_id", userId);
|
|
|
|
+ queryWrapper.eq("deleted", 0);
|
|
|
|
+ List<SysDeptUser> deptUserList = deptUserService.list(queryWrapper);
|
|
|
|
+ if (deptUserList.size() > 0) {
|
|
|
|
+ for (SysDeptUser item : deptUserList) {
|
|
|
|
+ ids.add(item.getDeptId());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- //管理员能看到所有工段
|
|
|
|
- if(userId == 1L) {
|
|
|
|
- isDispatch = true;
|
|
|
|
|
|
+
|
|
|
|
+ List<SysDept> deptOptions = new ArrayList<>();
|
|
|
|
+ if(!ids.isEmpty()){
|
|
|
|
+ deptOptions = deptService.getDeptOptions(ids);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (deptOptions.isEmpty()) {
|
|
SysDept sysDept = new SysDept();
|
|
SysDept sysDept = new SysDept();
|
|
sysDept.setType("0");
|
|
sysDept.setType("0");
|
|
sysDept.setIsWorkSection(1);
|
|
sysDept.setIsWorkSection(1);
|
|
List<SysDept> deptList = deptService.selectDeptList(sysDept);
|
|
List<SysDept> deptList = deptService.selectDeptList(sysDept);
|
|
ids = deptList.stream().map(SysDept::getDeptId).collect(Collectors.toList());
|
|
ids = deptList.stream().map(SysDept::getDeptId).collect(Collectors.toList());
|
|
- }
|
|
|
|
- List<SysDept> deptOptions = new ArrayList<>();
|
|
|
|
- if (ids.size() > 0) {
|
|
|
|
deptOptions = deptService.getDeptOptions(ids);
|
|
deptOptions = deptService.getDeptOptions(ids);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
return success(deptOptions);
|
|
return success(deptOptions);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -169,7 +166,7 @@ public class BizProductionPlanDetailSubDetailController extends BaseController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//管理员能看到所有工段
|
|
//管理员能看到所有工段
|
|
- if(userId == 1L) {
|
|
|
|
|
|
+ if (userId == 1L) {
|
|
isDispatch = true;
|
|
isDispatch = true;
|
|
SysDept sysDept = new SysDept();
|
|
SysDept sysDept = new SysDept();
|
|
sysDept.setType("0");
|
|
sysDept.setType("0");
|
|
@@ -184,10 +181,11 @@ public class BizProductionPlanDetailSubDetailController extends BaseController {
|
|
TableDataInfo info = getDataTable(deptOptions);
|
|
TableDataInfo info = getDataTable(deptOptions);
|
|
Map<String, Object> map = new HashMap<>();
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
|
- map.put("isDispatch",isDispatch);
|
|
|
|
|
|
+ map.put("isDispatch", isDispatch);
|
|
info.setOthers(map);
|
|
info.setOthers(map);
|
|
return success(info);
|
|
return success(info);
|
|
}
|
|
}
|
|
|
|
+
|
|
//在这个工段下的人
|
|
//在这个工段下的人
|
|
@GetMapping("/getDeptListByUserId")
|
|
@GetMapping("/getDeptListByUserId")
|
|
public AjaxResult getDeptListByUserId() throws NoSuchFieldException, IllegalAccessException {
|
|
public AjaxResult getDeptListByUserId() throws NoSuchFieldException, IllegalAccessException {
|
|
@@ -208,7 +206,7 @@ public class BizProductionPlanDetailSubDetailController extends BaseController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//管理员能看到所有工段
|
|
//管理员能看到所有工段
|
|
- if(userId == 1L) {
|
|
|
|
|
|
+ if (userId == 1L) {
|
|
isDispatch = true;
|
|
isDispatch = true;
|
|
SysDept sysDept = new SysDept();
|
|
SysDept sysDept = new SysDept();
|
|
sysDept.setType("0");
|
|
sysDept.setType("0");
|
|
@@ -223,7 +221,7 @@ public class BizProductionPlanDetailSubDetailController extends BaseController {
|
|
TableDataInfo info = getDataTable(deptOptions);
|
|
TableDataInfo info = getDataTable(deptOptions);
|
|
Map<String, Object> map = new HashMap<>();
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
|
- map.put("isDispatch",isDispatch);
|
|
|
|
|
|
+ map.put("isDispatch", isDispatch);
|
|
info.setOthers(map);
|
|
info.setOthers(map);
|
|
return success(info);
|
|
return success(info);
|
|
}
|
|
}
|
|
@@ -263,10 +261,10 @@ public class BizProductionPlanDetailSubDetailController extends BaseController {
|
|
@GetMapping(value = "/getLastLotStatus/{id}")
|
|
@GetMapping(value = "/getLastLotStatus/{id}")
|
|
public AjaxResult getLastLotStatus(@PathVariable("id") Long id) {
|
|
public AjaxResult getLastLotStatus(@PathVariable("id") Long id) {
|
|
QueryWrapper<BizProductionPlanDetailSubDetail> queryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<BizProductionPlanDetailSubDetail> queryWrapper = new QueryWrapper<>();
|
|
- queryWrapper.eq("production_plan_detail_id", id)
|
|
|
|
|
|
+ queryWrapper.eq("production_plan_detail_id", id)
|
|
.eq("deleted", 0)
|
|
.eq("deleted", 0)
|
|
.eq("last_lot_status", 1);
|
|
.eq("last_lot_status", 1);
|
|
- Boolean lastLotStat = bizProductionPlanDetailSubDetailService.list(queryWrapper).size()>0?true:false;
|
|
|
|
|
|
+ Boolean lastLotStat = bizProductionPlanDetailSubDetailService.list(queryWrapper).size() > 0 ? true : false;
|
|
return success(lastLotStat);
|
|
return success(lastLotStat);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -330,6 +328,9 @@ public class BizProductionPlanDetailSubDetailController extends BaseController {
|
|
*/
|
|
*/
|
|
// 20240703 生产批次工艺版本变更 当前工艺版本需要查询最新的工艺版本保存。
|
|
// 20240703 生产批次工艺版本变更 当前工艺版本需要查询最新的工艺版本保存。
|
|
BizTechnologicalProcess bizTechnologicalProcess = bizTechnologicalProcessService.query().eq("product_id", bizProductionPlanDetailSubDetail.getProductId()).eq("technology_version", bizProductionPlanDetailSubDetail.getTechnologyVersion()).eq("is_history", 0).one();
|
|
BizTechnologicalProcess bizTechnologicalProcess = bizTechnologicalProcessService.query().eq("product_id", bizProductionPlanDetailSubDetail.getProductId()).eq("technology_version", bizProductionPlanDetailSubDetail.getTechnologyVersion()).eq("is_history", 0).one();
|
|
|
|
+ if (bizTechnologicalProcess == null) {
|
|
|
|
+ return error("该产品下没有工序信息,请同步产品信息或检查产品数据");
|
|
|
|
+ }
|
|
bizProductionPlanDetailSubDetail.setTechnologicalProcessId(bizTechnologicalProcess.getId());
|
|
bizProductionPlanDetailSubDetail.setTechnologicalProcessId(bizTechnologicalProcess.getId());
|
|
|
|
|
|
/* 获取生成计划明细 */
|
|
/* 获取生成计划明细 */
|
|
@@ -339,8 +340,8 @@ public class BizProductionPlanDetailSubDetailController extends BaseController {
|
|
final int lastLotQuantity = planDetail.getLastLotQuantity();
|
|
final int lastLotQuantity = planDetail.getLastLotQuantity();
|
|
final String baseCode = planDetail.getProductionPlanNo().substring(0, 4);
|
|
final String baseCode = planDetail.getProductionPlanNo().substring(0, 4);
|
|
final String baseCodeSeq = planDetail.getProductionPlanNo().substring(4, 7) + planDetail.getLineNumber().toString();
|
|
final String baseCodeSeq = planDetail.getProductionPlanNo().substring(4, 7) + planDetail.getLineNumber().toString();
|
|
- List<BizLot> productionPlanDetailId = bizLotService.query().eq("production_plan_detail_id", planDetail.getId()).eq("deleted",0).list();
|
|
|
|
- if (productionPlanDetailId.size()==0){
|
|
|
|
|
|
+ List<BizLot> productionPlanDetailId = bizLotService.query().eq("production_plan_detail_id", planDetail.getId()).eq("deleted", 0).list();
|
|
|
|
+ if (productionPlanDetailId.size() == 0) {
|
|
List<BizLot> bizLotList = new ArrayList<>();
|
|
List<BizLot> bizLotList = new ArrayList<>();
|
|
for (int i = 0; i < lotNumber; ++i) {
|
|
for (int i = 0; i < lotNumber; ++i) {
|
|
BizLot bizLot = new BizLot();
|
|
BizLot bizLot = new BizLot();
|
|
@@ -372,27 +373,27 @@ public class BizProductionPlanDetailSubDetailController extends BaseController {
|
|
bizLotService.saveOrUpdateBatch(bizLotList);
|
|
bizLotService.saveOrUpdateBatch(bizLotList);
|
|
}
|
|
}
|
|
|
|
|
|
- SysDept dept =deptService.selectDeptById(bizProductionPlanDetailSubDetail.getDeptId());
|
|
|
|
|
|
+ SysDept dept = deptService.selectDeptById(bizProductionPlanDetailSubDetail.getDeptId());
|
|
//判断是否自动分配
|
|
//判断是否自动分配
|
|
- if(dept.getAutoAllocation()==1){
|
|
|
|
|
|
+ if (dept.getAutoAllocation() == 1) {
|
|
|
|
|
|
//查询资源组数据
|
|
//查询资源组数据
|
|
- BizProductionResourceGroup group=new BizProductionResourceGroup();
|
|
|
|
|
|
+ BizProductionResourceGroup group = new BizProductionResourceGroup();
|
|
group.setDeptId(dept.getDeptId());
|
|
group.setDeptId(dept.getDeptId());
|
|
group.setIsDeactivate(0);
|
|
group.setIsDeactivate(0);
|
|
- List<BizProductionResourceGroup> groupList =bizProductionResourceGroupService.getList(group);
|
|
|
|
|
|
+ List<BizProductionResourceGroup> groupList = bizProductionResourceGroupService.getList(group);
|
|
|
|
|
|
//查询是否分配过
|
|
//查询是否分配过
|
|
- BizProductionResourceGroupSubPlan subPlan=new BizProductionResourceGroupSubPlan();
|
|
|
|
|
|
+ BizProductionResourceGroupSubPlan subPlan = new BizProductionResourceGroupSubPlan();
|
|
subPlan.setProductionPlanDetailId(bizProductionPlanDetailSubDetail.getProductionPlanDetailId());
|
|
subPlan.setProductionPlanDetailId(bizProductionPlanDetailSubDetail.getProductionPlanDetailId());
|
|
subPlan.setDeptId(dept.getDeptId());
|
|
subPlan.setDeptId(dept.getDeptId());
|
|
- List<BizProductionResourceGroupSubPlan> list= bizProductionResourceGroupSubPlanService.getAotList(subPlan);
|
|
|
|
|
|
+ List<BizProductionResourceGroupSubPlan> list = bizProductionResourceGroupSubPlanService.getAotList(subPlan);
|
|
//如果有数据代表分配过
|
|
//如果有数据代表分配过
|
|
- if(list.size()==0){
|
|
|
|
|
|
+ if (list.size() == 0) {
|
|
//当没有分配过时,分配给所有资源组
|
|
//当没有分配过时,分配给所有资源组
|
|
- List<BizProductionResourceGroupSubPlan> planList=new ArrayList<>();
|
|
|
|
- for (BizProductionResourceGroup item: groupList) {
|
|
|
|
- BizProductionResourceGroupSubPlan plan=new BizProductionResourceGroupSubPlan();
|
|
|
|
|
|
+ List<BizProductionResourceGroupSubPlan> planList = new ArrayList<>();
|
|
|
|
+ for (BizProductionResourceGroup item : groupList) {
|
|
|
|
+ BizProductionResourceGroupSubPlan plan = new BizProductionResourceGroupSubPlan();
|
|
plan.setProductionPlanDetailId(bizProductionPlanDetailSubDetail.getProductionPlanDetailId());
|
|
plan.setProductionPlanDetailId(bizProductionPlanDetailSubDetail.getProductionPlanDetailId());
|
|
plan.setProductId(bizProductionPlanDetailSubDetail.getProductId());
|
|
plan.setProductId(bizProductionPlanDetailSubDetail.getProductId());
|
|
plan.setTechnologicalProcessId(bizProductionPlanDetailSubDetail.getTechnologicalProcessId());
|
|
plan.setTechnologicalProcessId(bizProductionPlanDetailSubDetail.getTechnologicalProcessId());
|
|
@@ -431,14 +432,14 @@ public class BizProductionPlanDetailSubDetailController extends BaseController {
|
|
public AjaxResult remove(@PathVariable List<Long> ids) {
|
|
public AjaxResult remove(@PathVariable List<Long> ids) {
|
|
//如果已经投产的生产子计划已经生成批次,则不能删除
|
|
//如果已经投产的生产子计划已经生成批次,则不能删除
|
|
QueryWrapper<BizProductionPlanDetailSubDetail> queryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<BizProductionPlanDetailSubDetail> queryWrapper = new QueryWrapper<>();
|
|
- queryWrapper.eq("id",ids.get(0));
|
|
|
|
|
|
+ queryWrapper.eq("id", ids.get(0));
|
|
BizProductionPlanDetailSubDetail bizProductionPlanDetailSubDetail = bizProductionPlanDetailSubDetailService.list(queryWrapper).get(0);
|
|
BizProductionPlanDetailSubDetail bizProductionPlanDetailSubDetail = bizProductionPlanDetailSubDetailService.list(queryWrapper).get(0);
|
|
QueryWrapper<BizDaywork> query = new QueryWrapper<>();
|
|
QueryWrapper<BizDaywork> query = new QueryWrapper<>();
|
|
- query.eq("production_plan_detail_id",bizProductionPlanDetailSubDetail.getProductionPlanDetailId());
|
|
|
|
- query.eq("deleted",0);
|
|
|
|
|
|
+ query.eq("production_plan_detail_id", bizProductionPlanDetailSubDetail.getProductionPlanDetailId());
|
|
|
|
+ query.eq("deleted", 0);
|
|
List<BizDaywork> list = dayworkService.list(query);
|
|
List<BizDaywork> list = dayworkService.list(query);
|
|
- if(list.size()>0) {
|
|
|
|
- return error("该批次已经生成就不能删除子计划");
|
|
|
|
|
|
+ if (list.size() > 0) {
|
|
|
|
+ return error("该批次已经生成就不能删除子计划");
|
|
}
|
|
}
|
|
return toAjax(bizProductionPlanDetailSubDetailService.removeBatchByIds(ids));
|
|
return toAjax(bizProductionPlanDetailSubDetailService.removeBatchByIds(ids));
|
|
}
|
|
}
|