生产计划自动化-返回计划工序列表 3.15

zhc4dev
zhc077 2 years ago
parent 695dc61bd6
commit 34d830c335
  1. 32
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/controller/ZyProductPlanAutoController.java
  2. 4
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/IZyProductPlanAutoService.java
  3. 21
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/impl/IZyProductPlanAutoServiceImpl.java

@ -1,36 +1,22 @@
package org.jeecg.modules.productplan.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.modules.productplan.entity.ZyPlanProcess;
import org.jeecg.modules.productplan.entity.ZyProductPlan;
import org.jeecg.modules.productplan.entity.vo.PaiWeiTuVo;
import org.jeecg.modules.productplan.service.IZyProductPlanAutoService;
import org.jeecg.modules.productplan.service.IZyProductPlanService;
import org.jeecg.modules.system.entity.SysDepart;
import org.jeecg.modules.system.entity.SysUser;
import org.jeecg.modules.system.service.ISysDepartService;
import org.jeecg.modules.system.service.ISysUserService;
import org.jeecg.modules.workproduct.entity.ZyProduct;
import org.jeecg.modules.workproduct.service.IZyProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* @Description: 生产计划自动化
@ -50,15 +36,15 @@ public class ZyProductPlanAutoController extends JeecgController<ZyProductPlan,
@ApiOperation(value = "生产计划自动化-模拟测试", notes = "生产计划自动化-模拟测试")
@GetMapping(value = "/productPlanAuto4Mock")
public Result<?> productPlanAuto4Mock(List<String> workOrderIds) {
iZyProductPlanAutoService.doAuto(workOrderIds);
return Result.OK();
List<Map<String, List<ZyPlanProcess>>> list = iZyProductPlanAutoService.doAuto(workOrderIds);
return Result.OK(list);
}
@ApiOperation(value = "生产计划自动化", notes = "生产计划自动化")
@GetMapping(value = "/productPlanAuto")
public Result<?> productPlanAuto() {
iZyProductPlanAutoService.doAuto(null);
return Result.OK();
List<Map<String, List<ZyPlanProcess>>> list = iZyProductPlanAutoService.doAuto(null);
return Result.OK(list);
}
}

@ -1,12 +1,14 @@
package org.jeecg.modules.productplan.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.productplan.entity.ZyPlanProcess;
import org.jeecg.modules.productplan.entity.ZyProductPlan;
import org.jeecg.modules.productplan.entity.vo.PaiWeiTuVo;
import org.jeecg.modules.workorder.entity.WorkOrder;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
/**
* @Description: 生产计划
@ -16,7 +18,7 @@ import java.util.List;
*/
public interface IZyProductPlanAutoService extends IService<ZyProductPlan> {
void doAuto(List<String> workOrderList);
List<Map<String, List<ZyPlanProcess>>> doAuto(List<String> workOrderList);
boolean filling4Auto(String planId);
}

@ -13,13 +13,8 @@ import org.jeecg.modules.productplan.entity.ZyPlanProcessAccessories;
import org.jeecg.modules.productplan.entity.ZyPlanProcessFabric;
import org.jeecg.modules.productplan.entity.ZyProductPlan;
import org.jeecg.modules.productplan.enums.ProductPlanStatusEnum;
import org.jeecg.modules.productplan.mapper.ZyPlanProcessAccessoriesMapper;
import org.jeecg.modules.productplan.mapper.ZyPlanProcessFabricMapper;
import org.jeecg.modules.productplan.mapper.ZyProductPlanMapper;
import org.jeecg.modules.productplan.service.*;
import org.jeecg.modules.productprocessaccessories.service.IProductProcessAccessoriesService;
import org.jeecg.modules.productprocessfabric.entity.ProductProcessFabric;
import org.jeecg.modules.productprocessfabric.service.IProductProcessFabricService;
import org.jeecg.modules.system.entity.SysDepart;
import org.jeecg.modules.system.entity.SysUser;
import org.jeecg.modules.system.service.ISysDepartService;
@ -36,8 +31,6 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import javax.servlet.http.HttpServletRequest;
import java.time.LocalDateTime;
import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
@ -259,7 +252,7 @@ public class IZyProductPlanAutoServiceImpl extends ServiceImpl<ZyProductPlanMapp
@Override
@Transactional(rollbackFor = Exception.class, readOnly = false)
public void doAuto(List<String> workOrderList4Mock) {
public List<Map<String, List<ZyPlanProcess>>> doAuto(List<String> workOrderList4Mock) {
//1,获取未排产工单
List<WorkOrder> workOrderList;
@ -274,12 +267,12 @@ public class IZyProductPlanAutoServiceImpl extends ServiceImpl<ZyProductPlanMapp
// List<WorkOrder> workOrderList = iWorkOrderService.list(new LambdaQueryWrapper<WorkOrder>()
// .eq(WorkOrder::getWorkOrderStatus, WorkOrderStatusEnum.UNAUDITED.getCode()));
if (ObjectUtils.isEmpty(workOrderList)) return;
if (ObjectUtils.isEmpty(workOrderList)) return Collections.EMPTY_LIST;
//2,保存生产计划
// List<ZyProductPlan> productPlanList = this.saveProductPlan(workOrderList);
List<ZyProductPlan> productPlanList = this.saveProductPlan4Mock(workOrderList);
if (ObjectUtils.isEmpty(productPlanList)) return;
if (ObjectUtils.isEmpty(productPlanList)) return Collections.EMPTY_LIST;
//3,同步计划生产工序、同步生产计划工序面料、同步生产计划辅料
productPlanList.stream().forEach(f -> {
@ -291,6 +284,7 @@ public class IZyProductPlanAutoServiceImpl extends ServiceImpl<ZyProductPlanMapp
//4,自动排位(匹配工序设备、工序工具、工人)
// 匹配工序设备、工序工具有一个工序失败,则工单作为异常处理,删除生产计划及相关子表
//只有一个生产计划的设备、工具都匹配成功才进行一下操作(生成物料单、发送到仓库)
List<Map<String, List<ZyPlanProcess>>> returnList = new LinkedList<>();
productPlanList.stream().forEach(k -> {
//TODO 数据不完整,测试时注释
// boolean b = this.filling4Auto(k.getId());
@ -304,14 +298,19 @@ public class IZyProductPlanAutoServiceImpl extends ServiceImpl<ZyProductPlanMapp
});
// }
Map<String, List<ZyPlanProcess>> map = new HashMap<>();
map.put(k.getProductCode(), planProcessList);
//测试需要返回生产计划工序
returnList.add(map);
});
return returnList;
}
/**
* 匹配设备&工具&工人
* <p>
* 匹配车间工位设备与工序设备工位设备包含工序设备即匹配成功匹配失败做异常处理
* 匹配车间工位工具与工序设备工位设备包含工序设备即匹配成功匹配失败做异常处理
* 匹配车间工位工具与工序工具工位设备包含工序设备即匹配成功匹配失败做异常处理
*
* @param planId
*/

Loading…
Cancel
Save