生产计划-功能优化 5.13

master
zhc077 2 years ago
parent 09beabd5a2
commit 7e6f937c9a
  1. 40
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/JeecgSystemApplication.java
  2. 8
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/controller/ZyProductPlanController.java
  3. 28
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/impl/IZyProductPlanAutoServiceImpl.java
  4. 65
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/impl/ZyPlanProcessServiceImpl.java
  5. 4
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/impl/ZyProductPlanServiceImpl.java
  6. 100
      jeecg-boot/jeecg-boot-module-system/src/main/resources/application-prod.yml

@ -77,24 +77,24 @@ public class JeecgSystemApplication extends SpringBootServletInitializer {
}
@Autowired
private Environment environment;
//创建队列
@Bean
public Queue queue() {
return new Queue(environment.getProperty("mq.pay.queue.order"));
}
//创建交换机
@Bean
public DirectExchange directExchange() {
return new DirectExchange(environment.getProperty("mq.pay.exchange.order"));
}
//将队列与交换机进行绑定
@Bean
public Binding binding() {
return BindingBuilder.bind(queue()).to(directExchange()).with(environment.getProperty("mq.pay.routing.order"));
}
// @Autowired
// private Environment environment;
//
// //创建队列
// @Bean
// public Queue queue() {
// return new Queue(environment.getProperty("mq.pay.queue.order"));
// }
//
// //创建交换机
// @Bean
// public DirectExchange directExchange() {
// return new DirectExchange(environment.getProperty("mq.pay.exchange.order"));
// }
//
// //将队列与交换机进行绑定
// @Bean
// public Binding binding() {
// return BindingBuilder.bind(queue()).to(directExchange()).with(environment.getProperty("mq.pay.routing.order"));
// }
}

@ -117,8 +117,12 @@ public class ZyProductPlanController extends JeecgController<ZyProductPlan, IZyP
@ApiOperation(value = "生产计划-编辑", notes = "生产计划-编辑")
@PutMapping(value = "/edit")
public Result<?> edit(@RequestBody ZyProductPlan zyProductPlan) {
SysUser sysUser = iSysUserService.getOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getRealname, zyProductPlan.getTeamLeader()));
zyProductPlan.setTeamLeader(sysUser.getUsername());
// SysUser sysUser = iSysUserService.getOne(new LambdaQueryWrapper<SysUser>()
// .eq(SysUser::getRealname, zyProductPlan.getTeamLeader())
// .orderByDesc(SysUser::getCreateTime)
// .last("limit 1")
// );
// zyProductPlan.setTeamLeader(sysUser.getUsername());
zyProductPlanService.updateById(zyProductPlan);
return Result.OK("编辑成功!");
}

@ -457,20 +457,22 @@ public class IZyProductPlanAutoServiceImpl extends ServiceImpl<ZyProductPlanMapp
if (!ObjectUtils.isEmpty(zyProcessCodes) && !ObjectUtils.isEmpty(zyProcessMachineIds)) {
for (int j = 0; j < stationList.size(); j++) {
Station station = stationList.get(j);
List<StationMachine> stationMachineList = iStationMachineService.list(new LambdaQueryWrapper<StationMachine>().eq(StationMachine::getStationId, station.getId()));
//工位设备ids
List<String> stationMachineIds = Optional.ofNullable(stationMachineList).orElse(new ArrayList<>()).stream().map(StationMachine::getMachineId).collect(Collectors.toList());
List<ZyDevice> zyDeviceList = iZyDeviceService.list(new LambdaQueryWrapper<ZyDevice>().in(ZyDevice::getId, stationMachineIds));
List<String> zyDevice_typeCodes = Optional.ofNullable(zyDeviceList).orElse(new ArrayList<>()).stream().map(ZyDevice::getTypeCode).collect(Collectors.toList());
// 工位设备包含工序设备即匹配成功
if (zyDevice_typeCodes.containsAll(zyProcessCodes)) {
String machineIds = zyProcessMachineIds.stream().collect(Collectors.joining(","));
zyPlanProcess.setMachineIds(machineIds);
zyPlanProcess.setMachineNames(iStationMachineService.convertByMachineIds(zyProcessMachineIds));
zyPlanProcess.setStationId(station.getId());
zyPlanProcess.setStationName(station.getStationName());
zyPlanProcess.setStationNum(station.getStationNum());
return zyPlanProcess;
List<StationMachine> stationMachineList = iStationMachineService.list(new LambdaQueryWrapper<StationMachine>().eq(StationMachine::getStationId, station.getId()));
if (!ObjectUtils.isEmpty(stationMachineList)) {
List<String> stationMachineIds = Optional.ofNullable(stationMachineList).orElse(new ArrayList<>()).stream().map(StationMachine::getMachineId).collect(Collectors.toList());
List<ZyDevice> zyDeviceList = iZyDeviceService.list(new LambdaQueryWrapper<ZyDevice>().in(ZyDevice::getId, stationMachineIds));
List<String> zyDevice_typeCodes = Optional.ofNullable(zyDeviceList).orElse(new ArrayList<>()).stream().map(ZyDevice::getTypeCode).collect(Collectors.toList());
// 工位设备包含工序设备即匹配成功
if (zyDevice_typeCodes.containsAll(zyProcessCodes)) {
String machineIds = zyProcessMachineIds.stream().collect(Collectors.joining(","));
zyPlanProcess.setMachineIds(machineIds);
zyPlanProcess.setMachineNames(iStationMachineService.convertByMachineIds(zyProcessMachineIds));
zyPlanProcess.setStationId(station.getId());
zyPlanProcess.setStationName(station.getStationName());
zyPlanProcess.setStationNum(station.getStationNum());
return zyPlanProcess;
}
}
}
}

@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.modules.demo.accessories.entity.ZyAccessories;
@ -77,6 +78,7 @@ import java.util.stream.Collectors;
* @Version: V1.0
*/
@Service
@Slf4j
public class ZyPlanProcessServiceImpl extends ServiceImpl<ZyPlanProcessMapper, ZyPlanProcess> implements IZyPlanProcessService {
@Autowired
@ -260,7 +262,7 @@ public class ZyPlanProcessServiceImpl extends ServiceImpl<ZyPlanProcessMapper, Z
public void createMaterialBill(ZyPlanProcess zyPlanProcess) {
ZyProductPlan zyProductPlan = iZyProductPlanService.getById(zyPlanProcess.getPlanId());
if (ObjectUtils.isEmpty(zyProductPlan)) {
throw new JeecgBootException("生产计划不存在!");
throw new JeecgBootException(zyPlanProcess.getPlanId() + ":生产计划不存在!");
}
List<ZyPlanProcess> planProcessList = this.list(new LambdaQueryWrapper<ZyPlanProcess>().eq(ZyPlanProcess::getPlanId, zyPlanProcess.getPlanId()));
if (ObjectUtils.isEmpty(planProcessList)) return;
@ -304,33 +306,36 @@ public class ZyPlanProcessServiceImpl extends ServiceImpl<ZyPlanProcessMapper, Z
/**
* @param zyPlanProcess 生产计划工序
* @param stationList 车间工位
* @param zyProcessMachineList 工序设备列表
* @param zyProcessMachineList 工序设备列表(一个工序对应多个工序设备)
*/
void diffMachine(ZyPlanProcess zyPlanProcess, List<Station> stationList, List<ZyProcessMachine> zyProcessMachineList) {
if (!ObjectUtils.isEmpty(zyProcessMachineList)) {
if (!ObjectUtils.isEmpty(stationList) && !ObjectUtils.isEmpty(zyProcessMachineList)) {
//工序设备类型列表
List<String> zyDevicetype_codes = zyProcessMachineList.stream().map(ZyProcessMachine::getCode).collect(Collectors.toList());
Optional.ofNullable(stationList).orElse(new ArrayList<>()).forEach(e -> {
List<StationMachine> stationMachineList = iStationMachineService.list(new LambdaQueryWrapper<StationMachine>().eq(StationMachine::getStationId, e.getId()));
//工位设备ids
List<String> stationMachineIds = Optional.ofNullable(stationMachineList).orElse(new ArrayList<>()).stream().map(StationMachine::getMachineId).collect(Collectors.toList());
List<ZyDevice> zyDeviceList = iZyDeviceService.list(new LambdaQueryWrapper<ZyDevice>().in(ZyDevice::getId, stationMachineIds));
List<String> zyDevice_typeCodes = Optional.ofNullable(zyDeviceList).orElse(new ArrayList<>()).stream().map(ZyDevice::getTypeCode).collect(Collectors.toList());
/**
* 工位设备包含工序设备即匹配成功
*/
if (zyDevice_typeCodes.containsAll(zyDevicetype_codes)) {
String collect = zyProcessMachineList.stream().map(ZyProcessMachine::getMachineId).collect(Collectors.joining(","));
zyPlanProcess.setMachineIds(collect);
zyPlanProcess.setMachineNames(iStationMachineService.convertByMachineIds(stationMachineIds));
zyPlanProcess.setStationId(e.getId());
zyPlanProcess.setStationName(e.getStationName());
zyPlanProcess.setStationNum(e.getStationNum());
this.updateById(zyPlanProcess);
return;
for (int j = 0; j < stationList.size(); j++) {
Station station = stationList.get(j);
List<StationMachine> stationMachineList = iStationMachineService.list(new LambdaQueryWrapper<StationMachine>().eq(StationMachine::getStationId, station.getId()));
if (!ObjectUtils.isEmpty(stationMachineList)) {
//工位设备ids
List<String> stationMachineIds = Optional.ofNullable(stationMachineList).orElse(new ArrayList<>()).stream().map(StationMachine::getMachineId).collect(Collectors.toList());
List<ZyDevice> zyDeviceList = iZyDeviceService.list(new LambdaQueryWrapper<ZyDevice>().in(ZyDevice::getId, stationMachineIds));
List<String> zyDevice_typeCodes = Optional.ofNullable(zyDeviceList).orElse(new ArrayList<>()).stream().map(ZyDevice::getTypeCode).collect(Collectors.toList());
/**
* 工位设备包含工序设备即匹配成功
*/
if (zyDevice_typeCodes.containsAll(zyDevicetype_codes)) {
String collect = zyProcessMachineList.stream().map(ZyProcessMachine::getMachineId).collect(Collectors.joining(","));
zyPlanProcess.setMachineIds(collect);
zyPlanProcess.setMachineNames(iStationMachineService.convertByMachineIds(stationMachineIds));
zyPlanProcess.setStationId(station.getId());
zyPlanProcess.setStationName(station.getStationName());
zyPlanProcess.setStationNum(station.getStationNum());
this.updateById(zyPlanProcess);
return;
}
}
});
}
}
}
@ -467,7 +472,11 @@ public class ZyPlanProcessServiceImpl extends ServiceImpl<ZyPlanProcessMapper, Z
ZyPlanProcessAccessories en = new ZyPlanProcessAccessories();
en.setPlanProcessId(e.getId());
en.setPlanId(e.getPlanId());
en.setAmount(new BigDecimal(obj.getAmount()));
if (!ObjectUtils.isEmpty(obj.getAmount())) {
en.setAmount(new BigDecimal(obj.getAmount()));
} else {
en.setAmount(new BigDecimal(0));
}
en.setAccessoriesId(obj.getAccessoriesId());
ZyAccessories zyAccessories = iZyAccessoriesService.getById(obj.getAccessoriesId());
en.setAccessoriesName(StringUtils.isNotBlank(zyAccessories.getContents()) ? zyAccessories.getContents() : "");
@ -492,7 +501,11 @@ public class ZyPlanProcessServiceImpl extends ServiceImpl<ZyPlanProcessMapper, Z
en.setPlanProcessId(e.getId());
en.setPlanId(e.getPlanId());
en.setFabricId(obj.getFabricId());
en.setAmount(new BigDecimal(obj.getAmount()));
if (!ObjectUtils.isEmpty(obj.getAmount())) {
en.setAmount(new BigDecimal(obj.getAmount()));
} else {
en.setAmount(new BigDecimal(0));
}
ZyFabric zyFabric = iZyFabricService.getById(obj.getFabricId());
en.setFabricName(StringUtils.isNotBlank(zyFabric.getName()) ? zyFabric.getName() : "");
list.add(en);
@ -590,6 +603,8 @@ public class ZyPlanProcessServiceImpl extends ServiceImpl<ZyPlanProcessMapper, Z
.stream().map(ZyPlanProcess::getId).collect(Collectors.toList());
Map<String, Object> result = new HashMap<>();
if (ObjectUtils.isEmpty(ids)) return result;
List<ZyPlanFabric> fabricList = iZyPlanFabricService.list(new LambdaQueryWrapper<ZyPlanFabric>()
.eq(ZyPlanFabric::getPlanId, zyPlanProcess.getPlanId()));
result.put("fabricList", fabricList);

@ -91,7 +91,7 @@ public class ZyProductPlanServiceImpl extends ServiceImpl<ZyProductPlanMapper, Z
String ordersId = workOrder.getOrdersId();
OrderGoods orderGoods = iOrderGoodsService.getOne(new LambdaQueryWrapper<OrderGoods>().eq(OrderGoods::getOrdersId, ordersId));
if (ObjectUtils.isEmpty(orderGoods)) throw new JeecgBootException(ordersId + "订单商品信息不存在");
if (ObjectUtils.isEmpty(orderGoods)) throw new JeecgBootException(ordersId + ":订单商品信息不存在");
ZyOrders zyOrders = iZyOrdersService.getOne(new LambdaQueryWrapper<ZyOrders>().eq(ZyOrders::getId, ordersId));
if (ObjectUtils.isEmpty(zyOrders)) throw new JeecgBootException(ordersId + "订单信息不存在");
@ -137,7 +137,7 @@ public class ZyProductPlanServiceImpl extends ServiceImpl<ZyProductPlanMapper, Z
SysDepart sysDepart = iSysDepartService.getById(zyProduct.getEnterprisesId());
zyProductPlan.setProductOrg(StringUtils.isNotBlank(sysDepart.getDepartName()) ? sysDepart.getDepartName() : "");
}
SysUser sysUser = iSysUserService.getOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getUsername, zyProductPlan.getTeamLeader()));
SysUser sysUser = iSysUserService.getOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getRealname, zyProductPlan.getTeamLeader()));
zyProductPlan.setTeamLeader(sysUser.getUsername());
zyProductPlan.setStatus(new Integer(ProductPlanStatusEnum.UNAUDITED.getCode()));
this.save(zyProductPlan);

@ -13,7 +13,6 @@ server:
enabled: true
min-response-size: 1024
mime-types: application/javascript,application/json,application/xml,text/html,text/xml,text/plain,text/css,image/*
management:
endpoints:
web:
@ -37,31 +36,31 @@ spring:
enable: true
required: true
## quartz定时任务,采用数据库方式
quartz:
job-store-type: jdbc
initialize-schema: embedded
#设置自动启动,默认为 true
auto-startup: true
#启动时更新己存在的Job
overwrite-existing-jobs: true
properties:
org:
quartz:
scheduler:
instanceName: MyScheduler
instanceId: AUTO
jobStore:
class: org.quartz.impl.jdbcjobstore.JobStoreTX
driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate
tablePrefix: QRTZ_
isClustered: true
misfireThreshold: 60000
clusterCheckinInterval: 10000
threadPool:
class: org.quartz.simpl.SimpleThreadPool
threadCount: 10
threadPriority: 5
threadsInheritContextClassLoaderOfInitializingThread: true
# quartz:
# job-store-type: jdbc
# initialize-schema: embedded
# #设置自动启动,默认为 true
# auto-startup: true
# #启动时更新己存在的Job
# overwrite-existing-jobs: true
# properties:
# org:
# quartz:
# scheduler:
# instanceName: MyScheduler
# instanceId: AUTO
# jobStore:
# class: org.quartz.impl.jdbcjobstore.JobStoreTX
# driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate
# tablePrefix: QRTZ_
# isClustered: true
# misfireThreshold: 60000
# clusterCheckinInterval: 10000
# threadPool:
# class: org.quartz.simpl.SimpleThreadPool
# threadCount: 10
# threadPriority: 5
# threadsInheritContextClassLoaderOfInitializingThread: true
#json 时间戳统一转换
jackson:
date-format: yyyy-MM-dd HH:mm:ss
@ -112,7 +111,7 @@ spring:
# 初始化大小,最小,最大
initial-size: 5
min-idle: 5
maxActive: 1000
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
@ -132,16 +131,16 @@ spring:
connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
datasource:
master:
url: jdbc:mysql://127.0.0.1:3306/CostumingPlatform?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
username: root
password: root
driver-class-name: com.mysql.cj.jdbc.Driver
# url: jdbc:mysql://mysql-lee.mysql.rds.aliyuncs.com:3306/zy?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
# username: root1
# password: zxcvbnm023@lee
# driver-class-name: com.mysql.cj.jdbc.Driver
# 多数据源配置
#multi-datasource1:
#url: jdbc:mysql://localhost:3306/jeecg-boot2?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
#username: root
#password: root
#driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://182.92.169.222:3306/costumingplat?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
username: root
password: ycwl2022.
driver-class-name: com.mysql.cj.jdbc.Driver
#redis 配置
redis:
database: 0
@ -155,6 +154,8 @@ spring:
shutdown-timeout: 100ms
password: 'redis@ycwl2022.'
port: 6379
# password: 'zy2021zy'
# port: 7480
#mybatis plus 设置
mybatis-plus:
mapper-locations: classpath*:org/jeecg/modules/**/xml/*Mapper.xml
@ -168,37 +169,36 @@ mybatis-plus:
table-underline: true
configuration:
# 这个配置会将执行的sql打印出来,在开发或测试的时候可以用
#log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
# 返回类型为Map,显示null对应的字段
call-setters-on-nulls: true
#jeecg专用配置
minidao :
minidao:
base-package: org.jeecg.modules.jmreport.*
#DB类型(mysql | postgresql | oracle | sqlserver| other)
db-type: mysql
jeecg :
jeecg:
wordPath: /opt/word
# 本地:local\Minio:minio\阿里云:alioss
uploadType: alioss
path :
uploadType: local
path:
#文件上传根目录 设置
upload: /opt/upFiles
#webapp文件路径
webapp: /opt/webapp
shiro:
excludeUrls: /VideoRecorder/jeecgDemo/demo3,/VideoRecorder/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/**,/api/getUserInfo
excludeUrls: /VideoRecorder/jeecgDemo/demo3,/VideoRecorder/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/**
#阿里云oss存储和大鱼短信秘钥配置
oss:
accessKey: ??
secretKey: ??
endpoint: oss-cn-beijing.aliyuncs.com
bucketName: ??
staticDomain: https://static.jeecg.com
# ElasticSearch 设置
# ElasticSearch 6设置
elasticsearch:
cluster-name: jeecg-ES
cluster-nodes: ??
check-enabled: true
cluster-nodes: 127.0.0.1:9200
check-enabled: false
# 表单设计器配置
desform:
# 主题颜色(仅支持 16进制颜色代码)
@ -209,16 +209,16 @@ jeecg :
# 配置百度地图的AK,申请地址:https://lbs.baidu.com/apiconsole/key?application=key#/home
baidu: ??
# 在线预览文件服务器地址配置
file-view-domain: http://fileview.jeecg.com
file-view-domain: 127.0.0.1:8012
# minio文件上传
minio:
minio_url: http://minio.jeecg.com
minio_name: ??
minio_pass: ??
bucketName: ??
bucketName: otatest
#大屏报表参数设置
jmreport:
mode: prod
mode: dev
#数据字典是否进行saas数据隔离,自己看自己的字典
saas: false
#是否需要校验token
@ -241,7 +241,7 @@ jeecg :
port: 30007
logPath: logs/jeecg/job/jobhandler/
logRetentionDays: 30
#自定义路由配置 yml nacos database
#自定义路由配置 yml nacos database
route:
config:
data-id: jeecg-gateway-router
@ -259,7 +259,7 @@ cas:
#Mybatis输出sql日志
logging:
level:
org.jeecg.modules.system.mapper : info
org.jeecg.modules.system.mapper: info
#swagger
knife4j:
production: false

Loading…
Cancel
Save