74 Commits

Author SHA1 Message Date
64baad1a36 Merge pull request 'yanyang' (#27) from yanyang into master
Reviewed-on: #27
2023-03-23 17:17:53 +08:00
b6e61961f7 Merge branch 'master' of git.picaiba.com:CaiXiang/cigs4 into yanyang 2023-03-23 16:48:37 +08:00
42f4f2e741 包装箱名验证 2023-03-23 16:48:09 +08:00
caixiang
4e02f7e03a Merge branch 'master' of http://git.picaiba.com/CaiXiang/cigs4 2023-03-22 14:12:46 +08:00
caixiang
7789d2b1ab commit 2023-03-22 14:12:37 +08:00
d62c7bf447 Merge pull request 'yanyang' (#26) from yanyang into master
Reviewed-on: #26
2023-03-22 14:10:49 +08:00
7970efd5d0 Merge branch 'master' of git.picaiba.com:CaiXiang/cigs4 into yanyang 2023-03-22 14:10:19 +08:00
dde937a6cd 创建时间倒序 2023-03-22 14:10:00 +08:00
caixiang
2b3c4b5f03 Merge branch 'master' of http://git.picaiba.com/CaiXiang/cigs4 2023-03-21 16:47:42 +08:00
caixiang
1258751c10 commit for pull 2023-03-21 16:47:35 +08:00
a7ae47485c Merge pull request 'yanyang' (#25) from yanyang into master
Reviewed-on: #25
2023-03-21 15:12:14 +08:00
f07fbd89a9 Merge branch 'master' of git.picaiba.com:CaiXiang/cigs4 into yanyang 2023-03-21 15:10:49 +08:00
8d37c0ebf9 报表导出格式 2023-03-21 15:10:40 +08:00
51736166a4 Merge pull request 'm' (#24) from yanyang into master
Reviewed-on: #24
2023-03-21 08:52:30 +08:00
dcc726ad77 m 2023-03-21 08:51:28 +08:00
caixiang
6f50adc782 查询模组档位统计分布图 修改 2023-03-17 13:50:53 +08:00
caixiang
c37f25a874 Merge branch 'master' of http://git.picaiba.com/CaiXiang/cigs4
# Conflicts:
#	ym-packing/src/main/java/com/cnbm/packing/controller/WoPackagingBoxSubstrateController.java
#	ym-packing/src/main/java/com/cnbm/packing/mapper/WoPackagingBoxSubstrateMapper.java
2023-03-17 12:41:54 +08:00
caixiang
78c9cbd686 查询模组档位统计分布图 修改 2023-03-17 12:39:56 +08:00
eda15da1a9 Merge pull request 'yanyang' (#23) from yanyang into master
Reviewed-on: #23
2023-03-16 09:56:31 +08:00
02cecaed68 Merge branch 'master' of git.picaiba.com:CaiXiang/cigs4 into yanyang 2023-03-16 09:55:51 +08:00
ba30dfe7af 报表查询 2023-03-16 09:55:43 +08:00
caixiang
ee0bd67011 Merge branch 'master' of http://git.picaiba.com/CaiXiang/cigs4 2023-03-08 13:03:21 +08:00
caixiang
4d8f2bfe74 commit for pull 2023-03-08 13:03:13 +08:00
6b38aebb5b Merge pull request 'yanyang' (#22) from yanyang into master
Reviewed-on: #22
2023-03-08 11:55:50 +08:00
5f5a60eb29 打印模板isEnable 2023-03-08 11:30:02 +08:00
1684075a9c Merge branch 'master' of git.picaiba.com:CaiXiang/cigs4 into yanyang 2023-03-08 10:43:29 +08:00
4e932a09fd 手动装箱编辑判定 2023-03-08 10:42:33 +08:00
caixiang
fe10292885 mark 2023-03-08 09:39:36 +08:00
caixiang
c284a4b394 Merge branch 'master' of http://git.picaiba.com/CaiXiang/cigs4 2023-03-07 21:58:11 +08:00
caixiang
00c907ece0 commit for pull 2023-03-07 21:57:54 +08:00
3b7cc67690 Merge pull request 'yanyang' (#21) from yanyang into master
Reviewed-on: #21
2023-03-07 20:21:17 +08:00
10c2414204 Merge branch 'master' of git.picaiba.com:CaiXiang/cigs4 into yanyang 2023-03-07 20:20:46 +08:00
53a6f02212 手动装箱模组判空 时间倒序 2023-03-07 20:20:37 +08:00
caixiang
c588346c69 Merge branch 'master' of http://git.picaiba.com/CaiXiang/cigs4 2023-03-07 13:47:32 +08:00
caixiang
391b52b23a commit for pull 2023-03-07 13:47:24 +08:00
c9ddb770e1 Merge pull request 'm' (#20) from yanyang into master
Reviewed-on: #20
2023-03-07 12:12:58 +08:00
6fe5b71e49 m 2023-03-07 12:12:37 +08:00
e35c2f4c45 Merge pull request 'yanyang' (#19) from yanyang into master
Reviewed-on: #19
2023-03-07 10:31:42 +08:00
d8b1f7e3e4 Merge branch 'master' of git.picaiba.com:CaiXiang/cigs4 into yanyang 2023-03-07 10:27:33 +08:00
f3f08353ae 模组信息查询 2023-03-07 10:27:24 +08:00
caixiang
a16cd349cc Merge branch 'master' of http://git.picaiba.com/CaiXiang/cigs4 2023-03-07 09:45:01 +08:00
caixiang
867aef5f50 新增功率档位 统计报表 2023-03-07 09:44:47 +08:00
06364c973b Merge pull request 'yanyang' (#18) from yanyang into master
Reviewed-on: #18
2023-03-06 21:03:43 +08:00
7aa7e382a8 Merge branch 'master' of git.picaiba.com:CaiXiang/cigs4 into yanyang 2023-03-06 21:03:05 +08:00
ddc2343842 手动装箱更新 默认显示当天 2023-03-06 21:02:54 +08:00
e9e73df74d Merge pull request '模组查询包装箱 时间' (#17) from yanyang into master
Reviewed-on: #17
2023-03-06 17:04:06 +08:00
4fd5498f1e 模组查询包装箱 时间 2023-03-06 17:03:01 +08:00
5b3f6f6f5d Merge pull request 'yanyang' (#16) from yanyang into master
Reviewed-on: #16
2023-03-06 11:56:43 +08:00
cd1bfc3287 Merge branch 'master' of git.picaiba.com:CaiXiang/cigs4 into yanyang
 Conflicts:
	ym-packing/src/main/java/com/cnbm/packing/service/WoPackagingBoxServiceBiz.java
2023-03-06 11:55:29 +08:00
bf0d6108a1 导出 2023-03-06 11:50:59 +08:00
caixiang
05684b5d2a 新增功率档位 统计报表 2023-03-06 11:24:16 +08:00
caixiang
9ccc971a38 mark 2023-03-04 13:57:07 +08:00
caixiang
ec1e5097f7 Merge branch 'master' of http://git.picaiba.com/CaiXiang/cigs4 2023-03-03 15:04:06 +08:00
b80aaee82c Merge pull request 'yanyang' (#15) from yanyang into master
Reviewed-on: #15
2023-03-03 15:02:45 +08:00
b7a3548a47 Merge branch 'master' of git.picaiba.com:CaiXiang/cigs4 into yanyang 2023-03-03 15:02:19 +08:00
333d076f6e 实际功率字段 2023-03-03 15:02:10 +08:00
caixiang
e04a4d184e Merge branch 'master' of http://git.picaiba.com/CaiXiang/cigs4 2023-03-03 14:33:26 +08:00
caixiang
6d88aacee0 commit 2023-03-03 14:33:18 +08:00
f3b9c25a33 Merge pull request 'BaseSupportUtils' (#14) from yanyang into master
Reviewed-on: #14
2023-03-03 09:52:48 +08:00
2e72fb7df8 BaseSupportUtils 2023-03-03 09:51:54 +08:00
cf9614f857 Merge pull request 'm' (#13) from yanyang into master
Reviewed-on: #13
2023-03-03 08:16:20 +08:00
8fa7a486fd m 2023-03-02 20:05:41 +08:00
dd9cff155e Merge pull request 'yanyang' (#12) from yanyang into master
Reviewed-on: #12
2023-03-02 17:02:51 +08:00
101bc8359e Merge branch 'master' of git.picaiba.com:CaiXiang/cigs4 into yanyang 2023-03-02 17:02:21 +08:00
e405dcb06a commonfield 2023-03-02 17:02:10 +08:00
458cedb42f Merge pull request 'yanyang' (#11) from yanyang into master
Reviewed-on: #11
2023-03-02 15:14:45 +08:00
b0c884d210 Merge branch 'master' of git.picaiba.com:CaiXiang/cigs4 into yanyang 2023-03-02 15:13:15 +08:00
3f38072356 common 2023-03-02 15:12:54 +08:00
3167ad09c4 Merge pull request 'yanyang' (#10) from yanyang into master
Reviewed-on: #10
2023-03-02 13:24:06 +08:00
df44cf308f Merge branch 'master' of git.picaiba.com:CaiXiang/cigs4 into yanyang 2023-03-02 13:23:05 +08:00
57b79b4f0e f 2023-03-02 13:22:49 +08:00
caixiang
a8d3147ac9 Merge branch 'master' of http://git.picaiba.com/CaiXiang/cigs4 2023-03-01 17:06:42 +08:00
caixiang
550a2f796b commit 2023-03-01 17:06:24 +08:00
25d21ef884 Merge pull request 'feat: 🚀 添加部署master分支功能' (#9) from cicd into master
Reviewed-on: #9
2023-03-01 14:07:48 +08:00
81 changed files with 2224 additions and 457 deletions

View File

@@ -43,6 +43,11 @@
<artifactId>ym-common</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.75</version>
</dependency>
</dependencies>

View File

@@ -0,0 +1,167 @@
/*
* Copyright (c) 2018.
* http://www.ulabcare.com
*/
package com.cnbm.admin.base;
import com.alibaba.fastjson.JSON;
import com.cnbm.admin.entity.LoginUser;
import com.cnbm.admin.enums.WhetherEnum;
import lombok.Builder;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 接口支持基类
*
* @author jiff
* @date 2018/11/1
* @since 1.0
*/
@Service
public class BaseSupport {
protected LoginUser getLoginUser() {
// 后续完善拦截器再使用该方式
// LoginUser loginUser = loginUserHolder.get();
// if (loginUser != null) {
// return loginUser;
// }
HttpSession session = getHttpServletRequest().getSession(false);
LoginUser loginUser = null;
if (session != null) {
String loginUserJson = (String) session.getAttribute(LoginUser.HTTP_HEADER_NAME);
if (StringUtils.isNotBlank(loginUserJson)) {
loginUser = JSON.parseObject(loginUserJson, LoginUser.class);
return loginUser;
}
}
return null;
}
/**
* 获取当前http请求对象
*
* @return
*/
protected HttpServletRequest getHttpServletRequest() {
return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
}
/**
* 获取当前http响应对象
*
* @return
*/
protected HttpServletResponse getHttpServletResponse() {
return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getResponse();
}
/**
* 设置公共字段值,一般用于创建新记录,包含以下字段:
*
* <p>
* {@link CommonField#enabled}<br>
* {@link CommonField#valid}<br>
* {@link CommonField#creatorId}<br>
* {@link CommonField#creatorName}<br>
* {@link CommonField#createTime}<br>
* {@link CommonField#updaterId}<br>
* {@link CommonField#updaterName}<br>
* {@link CommonField#updateTime}<br>
* </p>
*
* @param t 需要设置的对象
* @param ignoreProperties 忽略的字段
* @param <T>
*/
public <T extends Serializable> T setCommonField(T t, String... ignoreProperties) {
CommonField commonField = CommonField.builder()
.enabled(WhetherEnum.YES.getValue())
.valid(WhetherEnum.YES.getValue())
.createTime(LocalDateTime.now())
.creatorId(getLoginUser().getSysUserEntity().getId())
.creatorName(getLoginUser().getUsername())
.updateTime(LocalDateTime.now())
.updaterId(getLoginUser().getSysUserEntity().getId())
.updaterName(getLoginUser().getUsername())
.build();
BeanUtils.copyProperties(commonField, t, ignoreProperties);
return t;
}
/**
* 设置更新的公共字段值,一般用于更新记录,包含以下字段:
*
* <p>
* {@link CommonField#updaterId}<br>
* {@link CommonField#updaterName}<br>
* {@link CommonField#updateTime}<br>
* </p>
*
* @param t 需要设置的对象
* @param <T>
*/
public <T extends Serializable> T setUpdateCommonField(T t) {
CommonField commonField = CommonField.builder()
.updaterId(getLoginUser().getSysUserEntity().getId())
.updaterName(getLoginUser().getUsername())
.updateTime(LocalDateTime.now())
.build();
BeanUtils.copyProperties(commonField, t, "enabled", "valid");
return t;
}
@Data
@Builder
private static class CommonField implements Serializable {
/**
* 启用状态:0 、停用1、启用
*/
private Integer enabled;
/**
* 删除标志,是否有效:1 可用 0不可用
*/
private Integer valid;
/**
* 创建人
*/
private Long creatorId;
/**
* 创建人
*/
private String creatorName;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 更新人
*/
private Long updaterId;
/**
* 更新人
*/
private String updaterName;
/**
* 更新时间
*/
private LocalDateTime updateTime;
}
}

View File

@@ -24,6 +24,8 @@ public class LoginUser implements UserDetails{
private static final long serialVersionUID = 1L;
public static final String HTTP_HEADER_NAME = "loginUser";
private SysUserEntity sysUserEntity;
private List<String> permissions;

View File

@@ -1,5 +1,6 @@
package com.cnbm.admin.service.impl;
import com.alibaba.fastjson.JSON;
import com.cnbm.admin.entity.LoginUser;
import com.cnbm.admin.entity.SysLogLoginEntity;
import com.cnbm.admin.enums.LoginOperationEnum;
@@ -9,7 +10,6 @@ import com.cnbm.admin.service.CaptchaService;
import com.cnbm.admin.service.SysLogLoginService;
import com.cnbm.admin.utils.JwtUtil;
import com.cnbm.admin.service.LoginService;
import com.cnbm.admin.utils.ResponseResult;
import com.cnbm.common.exception.ErrorCode;
import com.cnbm.common.utils.IpUtils;
import com.cnbm.common.utils.Result;
@@ -22,8 +22,11 @@ import org.springframework.security.authentication.UsernamePasswordAuthenticatio
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Service;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@@ -53,10 +56,10 @@ public class LoginServiceImpl implements LoginService {
@Override
public Result login(HttpServletRequest request, LoginParam loginParam) {
//验证码是否正确
boolean flag = captchaService.validate(loginParam.getUuid(), loginParam.getCaptcha());
if(!flag){
return new Result<>().error(ErrorCode.CAPTCHA_ERROR, "验证码错误");
}
// boolean flag = captchaService.validate(loginParam.getUuid(), loginParam.getCaptcha());
// if(!flag){
// return new Result<>().error(ErrorCode.CAPTCHA_ERROR, "验证码错误");
// }
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(loginParam.getUsername(),loginParam.getPassword());
Authentication authenticate = authenticationManager.authenticate(authenticationToken);
//登录日志
@@ -81,6 +84,11 @@ public class LoginServiceImpl implements LoginService {
map.put("token",jwt);
//把完整的用户信息存入redis userid作为key
redisTemplate.opsForValue().set("login:"+userid,loginUser,1, TimeUnit.DAYS);
//当前登录用户信息存入session中
HttpSession session = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest().getSession();
session.setAttribute(loginUser.HTTP_HEADER_NAME, JSON.toJSONString(loginUser));
//登录成功
log.setStatus(LoginStatusEnum.SUCCESS.value());
log.setCreator(loginUser.getSysUserEntity().getId());

View File

@@ -9,6 +9,7 @@ import com.cnbm.admin.entity.SysRoleEntity;
import com.cnbm.admin.entity.SysUserEntity;
import com.cnbm.admin.enums.SuperAdminEnum;
import com.cnbm.admin.service.*;
import com.cnbm.admin.utils.BaseSupportUtils;
import com.cnbm.common.constant.Constant;
import com.cnbm.common.page.PageData;
import com.cnbm.common.service.impl.BaseServiceImpl;
@@ -89,6 +90,7 @@ public class SysRoleServiceImpl extends BaseServiceImpl<SysRoleDao, SysRoleEntit
SysRoleEntity entity = ConvertUtils.sourceToTarget(dto, SysRoleEntity.class);
//保存角色
BaseSupportUtils.setCommonField(entity);
insert(entity);
//保存角色菜单关系
@@ -104,6 +106,7 @@ public class SysRoleServiceImpl extends BaseServiceImpl<SysRoleDao, SysRoleEntit
SysRoleEntity entity = ConvertUtils.sourceToTarget(dto, SysRoleEntity.class);
//更新角色
BaseSupportUtils.setUpdateCommonField(entity);
updateById(entity);
//更新角色菜单关系

View File

@@ -9,6 +9,7 @@ import com.cnbm.admin.enums.SuperAdminEnum;
import com.cnbm.admin.service.SysDeptService;
import com.cnbm.admin.service.SysRoleUserService;
import com.cnbm.admin.service.SysUserService;
import com.cnbm.admin.utils.BaseSupportUtils;
import com.cnbm.admin.utils.PasswordUtils;
import com.cnbm.common.constant.Constant;
import com.cnbm.common.page.PageData;
@@ -98,6 +99,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserDao, SysUserEntit
//保存用户
entity.setSuperAdmin(SuperAdminEnum.NO.value());
BaseSupportUtils.setCommonField(entity);
insert(entity);
//保存角色用户关系
@@ -118,6 +120,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserDao, SysUserEntit
}
//更新用户
BaseSupportUtils.setUpdateCommonField(entity);
updateById(entity);
//更新角色用户关系

View File

@@ -58,7 +58,7 @@ public abstract class BaseSupportUtils {
*/
public static <T extends Serializable> T setCommonField(T t, String... ignoreProperties) {
CommonField commonField = CommonField.builder()
.enabled(WhetherEnum.YES.getValue())
// .enabled(WhetherEnum.YES.getValue())
.valid(WhetherEnum.YES.getValue())
.createTime(LocalDateTime.now())
.creatorId(getLoginUser().getId())
@@ -89,7 +89,7 @@ public abstract class BaseSupportUtils {
.updaterName(getLoginUser().getUsername())
.updateTime(LocalDateTime.now())
.build();
BeanUtils.copyProperties(commonField, t, "enabled", "valid");
BeanUtils.copyProperties(commonField, t, "valid");
return t;
}

View File

@@ -82,9 +82,11 @@ public class JwtUtil {
public static void main(String[] args) throws Exception {
// String jwt = createJWT("123");
Claims claims = parseJWT("eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiI5OWNhNGJhMjg5ZjU0OTVjODE5YTM0N2ExZmNlZjc0YSIsInN1YiI6IjEyMyIsImlzcyI6IndoeSIsImlhdCI6MTY1NDc1OTg5NiwiZXhwIjoxNjU0NzYzNDk2fQ.CTgS6yQjfXSGPJUTu-_rqjkh_KB_F9SzPThFfnvB5yg");
Claims claims = parseJWT("eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJkNTQxODQ5NjNjMWM0NzgzOTA0ZDAwZGI1ZmNkNWU3NiIsInN1YiI6IjEwNjcyNDY4NzU4MDAwMDAwMDEiLCJpc3MiOiJ3aHkiLCJpYXQiOjE2Nzg5MzE1MjAsImV4cCI6MTY3ODkzNTEyMH0.2we9FhhFU2Qvx2fvywqmA8A1qs0mbdXvr8T2CjJUz7o");
String subject = claims.getSubject();
System.out.println(subject);
System.out.println(claims.toString());
// System.out.println(claims);
}

View File

@@ -23,7 +23,7 @@
</select>
<select id="getIdAndPidList" resultType="com.cnbm.admin.entity.SysDeptEntity">
select t1.id, t1.pid from sys_dept t1 AND t1.valid = 1
select t1.id, t1.pid from sys_dept t1 where t1.valid = 1
</select>
<select id="getSubDeptIdList" resultType="long">

View File

@@ -1,7 +1,12 @@
spring:
datasource:
#MySQL
driver-class-name: com.mysql.cj.jdbc.Driver
#MySQL-local
# url: jdbc:mysql://10.0.1.249:3306/mt_cigs4?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
# username: cigs4
# password: 1qazxsw2
#MySQL-remote
url: jdbc:mysql://mysql.picaiba.com:30307/mt_cigs4?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
username: root
password: 1qaz@WSX3edc$RFV
@@ -60,13 +65,14 @@ dynamic:
# url: jdbc:mysql://mysql.picaiba.com:30307/mt_cigs4?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
# username: root
# password: 1qaz@WSX3edc$RFV
## camline系统
## camline系统 - remote
camline:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://mysql.picaiba.com:30307/mt_cigs4?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
username: root
password: 1qaz@WSX3edc$RFV
#
#camline系统 - local
# camline:
# driver-class-name: com.mysql.cj.jdbc.Driver
# url: jdbc:mysql://10.0.1.23:3306/synapse?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true

View File

@@ -33,9 +33,11 @@ spring:
enabled: true
redis:
database: 6
host: 192.168.0.135
port: 6380
password: '@WSXcde3' # 密码(默认为空)
host: 127.0.0.1
#host: 10.0.1.249
#host: 192.168.0.102
port: 6379
password: '' # 密码(默认为空)
timeout: 6000ms # 连接超时时长(毫秒)
jedis:
pool:

View File

@@ -14,9 +14,9 @@
<!-- <property name="logging.pathmq" value="C:/qgs_logger/mq" />-->
<!-- <property name="logging.eqlog" value="C:/qgs_logger/s7" />-->
<property name="logging.eqlog" value="/usr/local/logger/EQCommunicationLog" />
<property name="logging.packing" value="/usr/local/logger/Packing" />
<property name="logging.eqlog" value="/var/log/logger/EQCommunicationLog" />
<property name="logging.packing" value="/var/log/logger/Packing" />
<property name="logging.pathwork" value="/var/log/logger/Working" />
<!--0. 日志格式和颜色渲染 -->
@@ -392,6 +392,12 @@
<!-- name就是包名这个包下的 所有logger 输出就以下配置这里的logger只会输出代码里 你指定打印的log -->
<!-- <logger name="com.cnbm.pathwork" additivity="false">-->
<!-- <appender-ref ref="WORKING_DEBUG_FILE" />-->
<!-- <appender-ref ref="WORKING_INFO_FILE" />-->
<!-- <appender-ref ref="WORKING_WARN_FILE" />-->
<!-- <appender-ref ref="WORKING_ERROR_FILE" />-->
<!-- </logger>-->
<logger name="com.cnbm.dispatch" additivity="false">
<appender-ref ref="EQ_COMM_LOG_DEBUG_FILE" />
<appender-ref ref="EQ_COMM_LOG_INFO_FILE" />

View File

@@ -31,7 +31,7 @@ import java.util.Map;
* 打印标签模板表 前端控制器
*
* @author codeGenerator
* @since 2023-02-20
* @since 2023-03-08
*/
@RestController
@RequestMapping("/code/printModel")

View File

@@ -31,7 +31,7 @@ import java.util.Map;
* 包装箱基板关联表 ( 基板表 ) 前端控制器
*
* @author codeGenerator
* @since 2023-02-23
* @since 2023-03-03
*/
@RestController
@RequestMapping("/code/woPackagingBoxSubstrate")

View File

@@ -14,7 +14,7 @@ import java.math.BigDecimal;
* 打印标签模板表
*
* @author codeGenerator
* @since 2023-02-20
* @since 2023-03-08
*/
@Data
@ApiModel(value = "打印标签模板表DTO对象")
@@ -77,4 +77,7 @@ public class PrintModelDTO implements Serializable {
@ApiModelProperty(value = "线体1=F ; 2=S (用于过程1比对和包装打印)(设备传给我们的)")
private Integer lineBody;
@ApiModelProperty(value = "是否启用0 停用1 启用")
private Integer isEnable;
}

View File

@@ -14,7 +14,7 @@ import java.math.BigDecimal;
* 包装箱基板关联表 ( 基板表 )
*
* @author codeGenerator
* @since 2023-02-23
* @since 2023-03-03
*/
@Data
@ApiModel(value = "包装箱基板关联表 ( 基板表 )DTO对象")
@@ -74,7 +74,7 @@ public class WoPackagingBoxSubstrateDTO implements Serializable {
@ApiModelProperty(value = "")
private LocalDateTime lastUpdateTime;
@ApiModelProperty(value = "补偿pmpp")
@ApiModelProperty(value = "补偿后的功率,pmpp")
private Float pmpp;
@ApiModelProperty(value = "订单名")
@@ -170,4 +170,7 @@ public class WoPackagingBoxSubstrateDTO implements Serializable {
@ApiModelProperty(value = "")
private Float uocFl2;
@ApiModelProperty(value = "真实PMPP")
private Float actualPmpp;
}

View File

@@ -14,7 +14,7 @@ import lombok.Data;
* </p>
*
* @author codeGenerator
* @since 2023-02-20
* @since 2023-03-08
*/
@Data
@TableName("t_print_model")
@@ -78,6 +78,9 @@ public class PrintModel implements Serializable {
@ApiModelProperty("线体1=F ; 2=S (用于过程1比对和包装打印)(设备传给我们的)")
private Integer lineBody;
@ApiModelProperty("是否启用0 停用1 启用")
private Integer isEnable;
public static final String ID = "ID";
@@ -115,4 +118,6 @@ public class PrintModel implements Serializable {
public static final String LINE_BODY = "line_body";
public static final String IS_ENABLE = "is_enable";
}

View File

@@ -14,7 +14,7 @@ import lombok.Data;
* </p>
*
* @author codeGenerator
* @since 2023-02-23
* @since 2023-03-03
*/
@Data
@TableName("t_wo_packaging_box_substrate")
@@ -74,7 +74,7 @@ public class WoPackagingBoxSubstrate implements Serializable {
private LocalDateTime lastUpdateTime;
@ApiModelProperty("补偿pmpp")
@ApiModelProperty("补偿后的功率,pmpp")
private Float pmpp;
@ApiModelProperty("订单名")
@@ -140,6 +140,9 @@ public class WoPackagingBoxSubstrate implements Serializable {
private Float uocFl2;
@ApiModelProperty("真实PMPP")
private Float actualPmpp;
public static final String ID = "ID";
@@ -239,4 +242,6 @@ public class WoPackagingBoxSubstrate implements Serializable {
public static final String UOC_FL2 = "UOC_FL2";
public static final String ACTUAL_PMPP = "ACTUAL_PMPP";
}

View File

@@ -12,7 +12,7 @@ import java.util.Date;
* 打印标签模板表
*
* @author codeGenerator
* @since 2023-02-20
* @since 2023-03-08
*/
@Data
public class PrintModelExcel {
@@ -52,5 +52,7 @@ public class PrintModelExcel {
private String content;
@Excel(name = "线体1=F ; 2=S (用于过程1比对和包装打印)(设备传给我们的)")
private Integer lineBody;
@Excel(name = "是否启用0 停用1 启用")
private Integer isEnable;
}

View File

@@ -12,7 +12,7 @@ import java.util.Date;
* 包装箱基板关联表 ( 基板表 )
*
* @author codeGenerator
* @since 2023-02-23
* @since 2023-03-03
*/
@Data
public class WoPackagingBoxSubstrateExcel {
@@ -50,7 +50,7 @@ public class WoPackagingBoxSubstrateExcel {
private String powerLevel;
@Excel(name = "")
private LocalDateTime lastUpdateTime;
@Excel(name = "补偿pmpp")
@Excel(name = "补偿后的功率,pmpp")
private Float pmpp;
@Excel(name = "订单名")
private String orderName;
@@ -114,5 +114,7 @@ public class WoPackagingBoxSubstrateExcel {
private Float uocFl1;
@Excel(name = "")
private Float uocFl2;
@Excel(name = "真实PMPP")
private Float actualPmpp;
}

View File

@@ -8,7 +8,7 @@ import org.apache.ibatis.annotations.Mapper;
* 打印标签模板表
*
* @author codeGenerator
* @since 2023-02-20
* @since 2023-03-08
*/
@Mapper
public interface PrintModelMapper extends BaseDao<PrintModel> {

View File

@@ -20,6 +20,7 @@
<id column="IS_PREVIEW" property="isPreview" />
<id column="CONTENT" property="content" />
<id column="line_body" property="lineBody" />
<id column="is_enable" property="isEnable" />
</resultMap>
</mapper>

View File

@@ -8,7 +8,7 @@ import org.apache.ibatis.annotations.Mapper;
* 包装箱基板关联表 ( 基板表 )
*
* @author codeGenerator
* @since 2023-02-23
* @since 2023-03-03
*/
@Mapper
public interface WoPackagingBoxSubstrateMapper extends BaseDao<WoPackagingBoxSubstrate> {

View File

@@ -51,6 +51,7 @@
<id column="UMPP_FL2" property="umppFl2" />
<id column="UOC_FL1" property="uocFl1" />
<id column="UOC_FL2" property="uocFl2" />
<id column="ACTUAL_PMPP" property="actualPmpp" />
</resultMap>
</mapper>

View File

@@ -1,7 +1,7 @@
-- 菜单初始SQL
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date)VALUES (1627506543435272194, 1067246875800000035, '打印标签模板表', 'packing/printModel', NULL, 0, 'icon-desktop', 0, 1067246875800000001, now(), 1067246875800000001, now());
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1627506543435272195, 1627506543435272194, '查看', NULL, 'packing:printModel:page,packing:printModel:info', 1, NULL, 0, 1067246875800000001, now(), 1067246875800000001, now());
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1627506543435272196, 1627506543435272194, '新增', NULL, 'packing:printModel:save', 1, NULL, 1, 1067246875800000001, now(), 1067246875800000001, now());
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1627506543435272197, 1627506543435272194, '修改', NULL, 'packing:printModel:update', 1, NULL, 2, 1067246875800000001, now(), 1067246875800000001, now());
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1627506543435272198, 1627506543435272194, '删除', NULL, 'packing:printModel:delete', 1, NULL, 3, 1067246875800000001, now(), 1067246875800000001, now());
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1627506543435272199, 1627506543435272194, '导出', NULL, 'packing:printModel:export', 1, NULL, 4, 1067246875800000001, now(), 1067246875800000001, now());
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date)VALUES (1633305189284167681, 1067246875800000035, '打印标签模板表', 'code/printModel', NULL, 0, 'icon-desktop', 0, 1067246875800000001, now(), 1067246875800000001, now());
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1633305189284167682, 1633305189284167681, '查看', NULL, 'code:printModel:page,code:printModel:info', 1, NULL, 0, 1067246875800000001, now(), 1067246875800000001, now());
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1633305189284167683, 1633305189284167681, '新增', NULL, 'code:printModel:save', 1, NULL, 1, 1067246875800000001, now(), 1067246875800000001, now());
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1633305189284167684, 1633305189284167681, '修改', NULL, 'code:printModel:update', 1, NULL, 2, 1067246875800000001, now(), 1067246875800000001, now());
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1633305189284167685, 1633305189284167681, '删除', NULL, 'code:printModel:delete', 1, NULL, 3, 1067246875800000001, now(), 1067246875800000001, now());
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1633305189284167686, 1633305189284167681, '导出', NULL, 'code:printModel:export', 1, NULL, 4, 1067246875800000001, now(), 1067246875800000001, now());

View File

@@ -1,7 +1,7 @@
-- 菜单初始SQL
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date)VALUES (1628638869145812994, 1067246875800000035, '包装箱基板关联表 ( 基板表 )', 'code/woPackagingBoxSubstrate', NULL, 0, 'icon-desktop', 0, 1067246875800000001, now(), 1067246875800000001, now());
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1628638869145812995, 1628638869145812994, '查看', NULL, 'code:woPackagingBoxSubstrate:page,code:woPackagingBoxSubstrate:info', 1, NULL, 0, 1067246875800000001, now(), 1067246875800000001, now());
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1628638869145812996, 1628638869145812994, '新增', NULL, 'code:woPackagingBoxSubstrate:save', 1, NULL, 1, 1067246875800000001, now(), 1067246875800000001, now());
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1628638869145812997, 1628638869145812994, '修改', NULL, 'code:woPackagingBoxSubstrate:update', 1, NULL, 2, 1067246875800000001, now(), 1067246875800000001, now());
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1628638869145812998, 1628638869145812994, '删除', NULL, 'code:woPackagingBoxSubstrate:delete', 1, NULL, 3, 1067246875800000001, now(), 1067246875800000001, now());
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1628638869145812999, 1628638869145812994, '导出', NULL, 'code:woPackagingBoxSubstrate:export', 1, NULL, 4, 1067246875800000001, now(), 1067246875800000001, now());
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date)VALUES (1631549072342364161, 1067246875800000035, '包装箱基板关联表 ( 基板表 )', 'code/woPackagingBoxSubstrate', NULL, 0, 'icon-desktop', 0, 1067246875800000001, now(), 1067246875800000001, now());
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1631549072342364162, 1631549072342364161, '查看', NULL, 'code:woPackagingBoxSubstrate:page,code:woPackagingBoxSubstrate:info', 1, NULL, 0, 1067246875800000001, now(), 1067246875800000001, now());
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1631549072342364163, 1631549072342364161, '新增', NULL, 'code:woPackagingBoxSubstrate:save', 1, NULL, 1, 1067246875800000001, now(), 1067246875800000001, now());
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1631549072342364164, 1631549072342364161, '修改', NULL, 'code:woPackagingBoxSubstrate:update', 1, NULL, 2, 1067246875800000001, now(), 1067246875800000001, now());
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1631549072342364165, 1631549072342364161, '删除', NULL, 'code:woPackagingBoxSubstrate:delete', 1, NULL, 3, 1067246875800000001, now(), 1067246875800000001, now());
INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1631549072342364166, 1631549072342364161, '导出', NULL, 'code:woPackagingBoxSubstrate:export', 1, NULL, 4, 1067246875800000001, now(), 1067246875800000001, now());

View File

@@ -8,7 +8,7 @@ import com.cnbm.generator.code.entity.PrintModel;
* 打印标签模板表
*
* @author codeGenerator
* @since 2023-02-20
* @since 2023-03-08
*/
public interface PrintModelServiceBiz extends CrudService<PrintModel, PrintModelDTO> {

View File

@@ -8,7 +8,7 @@ import com.cnbm.generator.code.entity.WoPackagingBoxSubstrate;
* 包装箱基板关联表 ( 基板表 )
*
* @author codeGenerator
* @since 2023-02-23
* @since 2023-03-03
*/
public interface WoPackagingBoxSubstrateServiceBiz extends CrudService<WoPackagingBoxSubstrate, WoPackagingBoxSubstrateDTO> {

View File

@@ -15,7 +15,7 @@ import java.util.Map;
* 打印标签模板表
*
* @author codeGenerator
* @since 2023-02-20
* @since 2023-03-08
*/
@Service
public class PrintModelServiceBizImpl extends CrudServiceImpl<PrintModelMapper, PrintModel, PrintModelDTO> implements PrintModelServiceBiz {

View File

@@ -15,7 +15,7 @@ import java.util.Map;
* 包装箱基板关联表 ( 基板表 )
*
* @author codeGenerator
* @since 2023-02-23
* @since 2023-03-03
*/
@Service
public class WoPackagingBoxSubstrateServiceBizImpl extends CrudServiceImpl<WoPackagingBoxSubstrateMapper, WoPackagingBoxSubstrate, WoPackagingBoxSubstrateDTO> implements WoPackagingBoxSubstrateServiceBiz {

View File

@@ -7,9 +7,15 @@ import com.cnbm.dispatch.enums.kuka.step2.Step2Mes2PlcVar;
import com.cnbm.dispatch.enums.kuka.step2.Step2Plc2MesVar;
import com.cnbm.dispatch.enums.kuka.step3.Step3Mes2PlcVar;
import com.cnbm.dispatch.enums.kuka.step3.Step3Plc2MesVar;
import com.cnbm.packing.dto.CamlineExtendArgDTO;
import com.cnbm.packing.dto.CamlineSubIdDTO;
import com.cnbm.packing.entity.WoPackagingBox;
import com.cnbm.packing.entity.WoPackagingBoxSubstrate;
import com.cnbm.packing.entity.WoPowerLevel;
import com.cnbm.packing.service.*;
import com.cnbm.s7.s7connector.enmuc.S7Client;
import com.cnbm.s7.s7connector.type.PlcVar;
import io.swagger.models.auth.In;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -18,6 +24,10 @@ import org.springframework.boot.ApplicationRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import java.text.DecimalFormat;
import java.text.Format;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.Date;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
@@ -59,6 +69,7 @@ public class KukaJoinThread implements ApplicationRunner {
/**
* return
* 成功: 返回相应的object对象
@@ -141,9 +152,54 @@ public class KukaJoinThread implements ApplicationRunner {
public String getBoxId(String sapMaterial){
Integer todayBoxNum = service.getTodayBoxNum();
Integer todayBoxNum = service.getTodayBoxNum()+1;
String nowTime = DateUtil.format(new Date(), "yyMMdd");
String res = "301"+sapMaterial+nowTime+todayBoxNum;
todayBoxNum+=500;
String res = "301"+sapMaterial+nowTime+formateString(todayBoxNum);
return res;
}
public String getErrorBoxId(String sapMaterial){
String nowTime = DateUtil.format(new Date(), "yyMMdd");
String mixBoxError = "001";
String res = "Err"+sapMaterial+nowTime+mixBoxError;
return res;
}
public String removeKG(String str){
return str.substring(0,17);
}
public static void main(String[] args) {
Integer a = 102;
Format f1 = new DecimalFormat("000");
System.out.println(f1.format(a));
}
public String formateString(Integer a){
Format f1 = new DecimalFormat("000");
return f1.format(a);
}
//return true 出现混档了return false 没有出现混档
private boolean isMixLevel(String[] subIds,Integer size){
String correctLevel = substrateServiceBiz.getBySubId(subIds[0]).getPowerLevel();
String errMsg = "以下基板ID出现混档";
boolean res = false;
for(int i=0;i<size;i++){
String powerLevel = substrateServiceBiz.getBySubId(subIds[i]).getPowerLevel();
if(!powerLevel.equals(correctLevel)){
errMsg+="基板ID:"+subIds[i]+" 档位:"+powerLevel+", ";
res = true;
}
}
if(res){
logger.error(errMsg);
}
return res;
}
@@ -153,194 +209,247 @@ public class KukaJoinThread implements ApplicationRunner {
// kukaStep1.scheduleAtFixedRate(new Runnable() {
// @Override
// public void run() {
// logger.info("================= 现在开始执行 过程一 任务 ==================");
// }
// },1,1, TimeUnit.SECONDS);
// kukaStep1.scheduleAtFixedRate(new Runnable() {
// @Override
// public void run() {
// //调度开始
// try {
//
// //调度开始
//// logger.info("");
//// logger.info("================= 现在开始执行 过程一 任务 ==================");
// Integer subArrived = waitingForTarget(Step1Plc2MesVar.SubArrivedToMes, true);
// if(subArrived != 1){
// logger.info("失败"+" --- "+" MES监听 Step1Plc2MesVar.SubArrivedToMes 是否 等于 1 失败");
// Integer subArrived = waitingForTarget(Step1Plc2MesVar.SubArrivedToMes, true);
// if(subArrived != 1){
// logger.info("标签打印Event--- 失败"+" --- "+" MES监听 Step1Plc2MesVar.SubArrivedToMes 是否 等于 1 失败");
// }
//
// //一. 从plc 中获取 subId 和 lineNum
// String subId = (String) read(S7Client.S7_KUKA,Step1Plc2MesVar.SubIdToMes);
// Integer lineNum = (Integer) read(S7Client.S7_KUKA,Step1Plc2MesVar.LineNum);
// //把基板ID字符串的空格去掉因为plc中设置的20位但实际基板ID就是17位因为带空格去数据库查询 有问题的。
// subId = removeKG(subId);
//
// //二. MES 业务
// //=============== MES 业务 开始 =================
// //1. 从comline数据库中获取 实际pmpp
// float pmppActual = service.getPMPPBySubId(subId);
// //2. 匹配和计算补偿功率
// float pmppCompensation = compensationPowerServiceBiz.calculCompensationPMPP(pmppActual,lineNum);
// //3. 依据补偿功率获取工艺参数并且把这些工艺参数传给kuka
// WoPowerLevel argByPMPP = levelServiceBiz.getArgByPMPP(pmppCompensation, lineNum);
// write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Pnom,Integer.valueOf(argByPMPP.getPowerClass()));
// write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Voc,argByPMPP.getLableVoc());
// write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Isc,argByPMPP.getLableIsc());
// write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Vmpp,argByPMPP.getLableVmpp());
// write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Impp,argByPMPP.getLableImpp());
// logger.info("标签打印Event--- 采集到 基板ID: "+subId+", 线边号:"+lineNum+"从camline 获取到实际pmpp"+pmppActual+",计算后 补偿功率:"+pmppCompensation+",dLable_Pnom: "+argByPMPP.getPowerClass() +",dLable_Voc: "+argByPMPP.getLableVoc()+",dLable_Isc: "+argByPMPP.getLableIsc()+",dLable_Vmpp: "+argByPMPP.getLableVmpp()+",dLable_Impp: "+argByPMPP.getLableImpp());
//
//
//
// //4. 把基板录到数据库
// WoPackagingBoxSubstrate woPackagingBoxSubstrate = new WoPackagingBoxSubstrate();
// woPackagingBoxSubstrate.setLineBody(lineNum);
// woPackagingBoxSubstrate.setPowerLevel(argByPMPP.getPowerClass());
// woPackagingBoxSubstrate.setSapMaterial(argByPMPP.getSapMaterialNum());
// woPackagingBoxSubstrate.setWoSubstrateId(subId);
// woPackagingBoxSubstrate.setActualPmpp(pmppActual);
// woPackagingBoxSubstrate.setCreateTime(LocalDateTime.now());
// woPackagingBoxSubstrate.setPmpp(pmppCompensation);
//
//
// //5. 从camline那里获取可变字段
// CamlineExtendArgDTO extendArgFromCamline = service.getExtendArgFromCamline(subId);
// logger.info("标签打印Event--- 基板ID: "+subId+", 从camline获取PID16~PID22 的实测数据 成功, 数据内容:"+extendArgFromCamline.toString());
// woPackagingBoxSubstrate.setLastUpdateTime(extendArgFromCamline.getLastUpdateTime());
//
// woPackagingBoxSubstrate.setOrderName(extendArgFromCamline.getOrderName());
// woPackagingBoxSubstrate.setBinclassFl1(extendArgFromCamline.getBinclassFl1());
// woPackagingBoxSubstrate.setBinclassFl2(extendArgFromCamline.getBinclassFl2());
// woPackagingBoxSubstrate.setEtaFl1(extendArgFromCamline.getEtaFl1());
// woPackagingBoxSubstrate.setEtaFl2(extendArgFromCamline.getEtaFl2());
// woPackagingBoxSubstrate.setFfFl1(extendArgFromCamline.getFfFl1());
// woPackagingBoxSubstrate.setFfFl2(extendArgFromCamline.getFfFl2());
// woPackagingBoxSubstrate.setImppFl1(extendArgFromCamline.getImppFl1());
// woPackagingBoxSubstrate.setImppFl2(extendArgFromCamline.getImppFl2());
// woPackagingBoxSubstrate.setInsolflashcontrolFl1(extendArgFromCamline.getInsolflashcontrolFl1());
// woPackagingBoxSubstrate.setInsolflashcontrolFl2(extendArgFromCamline.getInsolflashcontrolFl2());
// woPackagingBoxSubstrate.setInsolmppFl1(extendArgFromCamline.getInsolmppFl1());
// woPackagingBoxSubstrate.setInsolmppFl2(extendArgFromCamline.getInsolmppFl2());
// woPackagingBoxSubstrate.setInsolvocFl1(extendArgFromCamline.getInsolvocFl1());
// woPackagingBoxSubstrate.setInsolvocFl2(extendArgFromCamline.getInsolvocFl2());
// woPackagingBoxSubstrate.setInsolFl1(extendArgFromCamline.getInsolFl1());
// woPackagingBoxSubstrate.setInsolFl2(extendArgFromCamline.getInsolFl2());
// woPackagingBoxSubstrate.setIscFl1(extendArgFromCamline.getIscFl1());
// woPackagingBoxSubstrate.setIscFl2(extendArgFromCamline.getIscFl2());
// woPackagingBoxSubstrate.setMeasTimeFl1(extendArgFromCamline.getMeasTimeFl1());
// woPackagingBoxSubstrate.setMeasTimeFl2(extendArgFromCamline.getMeasTimeFl2());
// woPackagingBoxSubstrate.setPmppFl1(extendArgFromCamline.getPmppFl1());
// woPackagingBoxSubstrate.setPmppFl2(extendArgFromCamline.getPmppFl2());
// woPackagingBoxSubstrate.setTcellFl1(extendArgFromCamline.getTcellFl1());
// woPackagingBoxSubstrate.setTcellFl2(extendArgFromCamline.getTcellFl2());
// woPackagingBoxSubstrate.setTmonicellFl1(extendArgFromCamline.getTmonicellFl1());
// woPackagingBoxSubstrate.setTmonicellFl2(extendArgFromCamline.getTmonicellFl2());
// woPackagingBoxSubstrate.setUmppFl1(extendArgFromCamline.getUmppFl1());
// woPackagingBoxSubstrate.setUmppFl2(extendArgFromCamline.getUmppFl2());
// woPackagingBoxSubstrate.setUocFl1(extendArgFromCamline.getUocFl1());
// woPackagingBoxSubstrate.setUocFl1(extendArgFromCamline.getUocFl2());
//
// substrateServiceBiz.insert(woPackagingBoxSubstrate);
// logger.info("标签打印Event--- 基板ID: "+subId+", 录入数据库成功");
// //=============== MES 业务 结束 =================
//
// //三. 当MES完成任务后把MesToPlc.SubArrivedFinish变量置为true告诉plc我操作完成了
// write(S7Client.S7_KUKA,Step1Mes2PlcVar.SubArrivedFinish,true);
// logger.info("标签打印Event--- 基板ID: "+subId+", SubArrivedFinish置为true 成功");
// //四. mes 监控 到PlcToMes.SubArrived==false就把MesToPlc.SubArrivedFinish置为false
// Integer subArrived2 = waitingForTarget(Step1Plc2MesVar.SubArrivedToMes, false);
// if(subArrived2 != 1){
// logger.info("标签打印Event--- 失败"+" --- "+"MES监听 Step1Plc2MesVar.SubArrivedToMes 是否 等于 1 失败");
// }
//
// write(S7Client.S7_KUKA,Step1Mes2PlcVar.SubArrivedFinish,false);
// logger.info("标签打印Event--- 基板ID: "+subId+", SubArrivedFinish置为 false 成功, Event1 成功结束");
//
// }catch (Throwable e){
// e.printStackTrace();
// logger.info("标签打印Event--- 出现异常 :"+e.toString());
// }
//
// //一. 从plc 中获取 subId 和 lineNum
// String subId = (String) read(S7Client.S7_KUKA,Step1Plc2MesVar.SubIdToMes);
// Integer lineNum = (Integer) read(S7Client.S7_KUKA,Step1Plc2MesVar.LineNum);
// logger.info("采集到 基板ID: "+subId+", 线边号:"+lineNum);
//
// //二. MES 业务
// //=============== MES 业务 开始 =================
// //1. 从comline数据库中获取 实际pmpp
// float pmppBySubId = service.getPMPPBySubId(subId);
// //2. 匹配和计算补偿功率
// float actualPMPP = compensationPowerServiceBiz.calculCompensationPMPP(pmppBySubId,lineNum);
// //3. 依据补偿功率获取工艺参数并且把这些工艺参数传给kuka
// WoPowerLevel argByPMPP = levelServiceBiz.getArgByPMPP(actualPMPP, lineNum);
// write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Pnom,Integer.valueOf(argByPMPP.getPowerClass()));
// write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Voc,argByPMPP.getLableVoc());
// write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Isc,argByPMPP.getLableIsc());
// write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Vmpp,argByPMPP.getLableVmpp());
// write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Impp,argByPMPP.getLableImpp());
//
//
//
// //4. 把基板录到数据库
// WoPackagingBoxSubstrate woPackagingBoxSubstrate = new WoPackagingBoxSubstrate();
// woPackagingBoxSubstrate.setLineBody(lineNum);
// woPackagingBoxSubstrate.setPowerLevel(argByPMPP.getPowerClass());
// woPackagingBoxSubstrate.setSapMaterial(argByPMPP.getSapMaterialNum());
// woPackagingBoxSubstrate.setWoSubstrateId(subId);
//
// //5. 从camline那里获取可变字段
// CamlineExtendArgDTO extendArgFromCamline = service.getExtendArgFromCamline(subId);
// woPackagingBoxSubstrate.setLastUpdateTime(extendArgFromCamline.getLastUpdateTime());
// woPackagingBoxSubstrate.setPmpp(actualPMPP);
// woPackagingBoxSubstrate.setOrderName(extendArgFromCamline.getOrderName());
// woPackagingBoxSubstrate.setBinclassFl1(extendArgFromCamline.getBinclassFl1());
// woPackagingBoxSubstrate.setBinclassFl2(extendArgFromCamline.getBinclassFl2());
// woPackagingBoxSubstrate.setEtaFl1(extendArgFromCamline.getEtaFl1());
// woPackagingBoxSubstrate.setEtaFl2(extendArgFromCamline.getEtaFl2());
// woPackagingBoxSubstrate.setFfFl1(extendArgFromCamline.getFfFl1());
// woPackagingBoxSubstrate.setFfFl2(extendArgFromCamline.getFfFl2());
// woPackagingBoxSubstrate.setImppFl1(extendArgFromCamline.getImppFl1());
// woPackagingBoxSubstrate.setImppFl2(extendArgFromCamline.getImppFl2());
// woPackagingBoxSubstrate.setInsolflashcontrolFl1(extendArgFromCamline.getInsolflashcontrolFl1());
// woPackagingBoxSubstrate.setInsolflashcontrolFl2(extendArgFromCamline.getInsolflashcontrolFl2());
// woPackagingBoxSubstrate.setInsolmppFl1(extendArgFromCamline.getInsolmppFl1());
// woPackagingBoxSubstrate.setInsolmppFl2(extendArgFromCamline.getInsolmppFl2());
// woPackagingBoxSubstrate.setInsolvocFl1(extendArgFromCamline.getInsolvocFl1());
// woPackagingBoxSubstrate.setInsolvocFl2(extendArgFromCamline.getInsolvocFl2());
// woPackagingBoxSubstrate.setInsolFl1(extendArgFromCamline.getInsolFl1());
// woPackagingBoxSubstrate.setInsolFl2(extendArgFromCamline.getInsolFl2());
// woPackagingBoxSubstrate.setIscFl1(extendArgFromCamline.getIscFl1());
// woPackagingBoxSubstrate.setIscFl2(extendArgFromCamline.getIscFl2());
// woPackagingBoxSubstrate.setMeasTimeFl1(extendArgFromCamline.getMeasTimeFl1());
// woPackagingBoxSubstrate.setMeasTimeFl2(extendArgFromCamline.getMeasTimeFl2());
// woPackagingBoxSubstrate.setPmppFl1(extendArgFromCamline.getPmppFl1());
// woPackagingBoxSubstrate.setPmppFl2(extendArgFromCamline.getPmppFl2());
// woPackagingBoxSubstrate.setTcellFl1(extendArgFromCamline.getTcellFl1());
// woPackagingBoxSubstrate.setTcellFl2(extendArgFromCamline.getTcellFl2());
// woPackagingBoxSubstrate.setTmonicellFl1(extendArgFromCamline.getTmonicellFl1());
// woPackagingBoxSubstrate.setTmonicellFl2(extendArgFromCamline.getTmonicellFl2());
// woPackagingBoxSubstrate.setUmppFl1(extendArgFromCamline.getUmppFl1());
// woPackagingBoxSubstrate.setUmppFl2(extendArgFromCamline.getUmppFl2());
// woPackagingBoxSubstrate.setUocFl1(extendArgFromCamline.getUocFl1());
// woPackagingBoxSubstrate.setUocFl1(extendArgFromCamline.getUocFl2());
//
// substrateServiceBiz.insert(woPackagingBoxSubstrate);
// //=============== MES 业务 结束 =================
//
// //三. 当MES完成任务后把MesToPlc.SubArrivedFinish变量置为true告诉plc我操作完成了
// write(S7Client.S7_KUKA,Step1Mes2PlcVar.SubArrivedFinish,true);
//
// //四. mes 监控 到PlcToMes.SubArrived==false就把MesToPlc.SubArrivedFinish置为false
// Integer subArrived2 = waitingForTarget(Step1Plc2MesVar.SubArrivedToMes, false);
// if(subArrived2 != 1){
// logger.info("失败"+" --- "+"MES监听 Step1Plc2MesVar.SubArrivedToMes 是否 等于 1 失败");
// }
// write(S7Client.S7_KUKA,Step1Mes2PlcVar.SubArrivedFinish,false);
// }
// },1,1, TimeUnit.SECONDS);
//
//
// kukaStep2.scheduleAtFixedRate(new Runnable() {
// @Override
// public void run() {
// //调度开始
// try {
//
// Integer shelfIsFull = waitingForTarget(Step2Plc2MesVar.ShelfIsFull, true);
// if(shelfIsFull != 1){
// logger.info("失败"+" --- "+"MES监听 Step2Plc2MesVar.ShelfIsFull 是否 等于 1 失败");
// //调度开始
// Integer shelfIsFull = waitingForTarget(Step2Plc2MesVar.ShelfIsFull, true);
// if(shelfIsFull != 1){
// logger.info("BOXID生成Event-------失败"+" --- "+"MES监听 Step2Plc2MesVar.ShelfIsFull 是否 等于 1 失败");
// }
//
// //一. 从plc 中获取 subIdList 和 lineNum
// String[] subIdList = (String[])read(S7Client.S7_KUKA,Step2Plc2MesVar.SubIdList);
// Integer listSize = (Integer)read(S7Client.S7_KUKA,Step2Plc2MesVar.PackageNumberSet)-1;
//
//
// //二. MES 业务
// //=============== MES 业务 开始 =================
// //1.MES 生成BoxId
// if(subIdList.length<=0){
// logger.info("BOXID生成Event-------失败"+" --- "+"从plc里面获取到的基板列表 为空");
// throw new Exception("BOXID生成Event-------kuka机械手 取到了空箱");
// }
// //真实的基板ID 就是17位的plc读取过来有空格要把后面3位空格去掉就行了。
// for(int i=0;i<subIdList.length;i++){
// subIdList[i] = removeKG(subIdList[i]);
// }
// logger.info("BOXID生成Event-------获取到基板列表:"+ Arrays.toString(subIdList)+",基板数量:"+listSize);
//
// WoPackagingBoxSubstrate bySubId = substrateServiceBiz.getBySubId(subIdList[0]);
// logger.info("bySubId"+ bySubId.toString());
// //如果我们系统中找不到这块基板那么就去camline里面找
// if(bySubId == null){
//
// //todo
// CamlineSubIdDTO subIdByCamline = service.getSubIdByCamline(subIdList[0]);
// bySubId = new WoPackagingBoxSubstrate();
// bySubId.setPowerLevel(subIdByCamline.getPowerLevel());
// bySubId.setSapMaterial(subIdByCamline.getSapMaterial());
// bySubId.setLineBody(2);
// }
//
// //校验是否存在混档位情况
// String boxId = "";
// if(isMixLevel(subIdList,listSize)){
// //出现混档
// boxId = getErrorBoxId(bySubId.getSapMaterial());
// }else {
// //正常情况
// boxId = getBoxId(bySubId.getSapMaterial());
// }
//
// logger.info("BOXID生成Event-------mes 生成的boxId :"+ boxId);
// //2. 依次update 基板表把boxId 赋予这些基板
// for(int i=0;i<listSize;i++){
// substrateServiceBiz.updatePackagingBoxIdAndSlotByWoSubstrateId(boxId,(i+1),subIdList[i]);
// }
// //3.去camline数据库 查询此基板ID 对应的订单
// String orderNameBySubId = service.getOrderNameBySubId(subIdList[0]);
// //4. box信息录入到box表
// WoPackagingBox woPackagingBox = new WoPackagingBox();
// woPackagingBox.setBoxNo(boxId);
// woPackagingBox.setSubstrateQuantity(listSize);
// woPackagingBox.setPackagingTime(LocalDateTime.now());
// woPackagingBox.setPowerLevel(bySubId.getPowerLevel());
// woPackagingBox.setLineBody(bySubId.getLineBody());
// woPackagingBox.setSapMaterial(bySubId.getSapMaterial());
// woPackagingBox.setOrderNum(orderNameBySubId);
// //1-手动模式2-自动模式
// woPackagingBox.setModel(2);
// woPackagingBox.setCreateTime(LocalDateTime.now());
// woPackagingBox.setPackagingTime(LocalDateTime.now());
// boxServiceBiz.insert(woPackagingBox);
// logger.info("BOXID生成Event-------boxId :"+ boxId+"写入数据库成功");
// //=============== MES 业务 结束 =================
//
// //三. 把生成的BoxId 告诉kuka
// write(S7Client.S7_KUKA,Step2Mes2PlcVar.BoxId,boxId);
// logger.info("BOXID生成Event-------boxId :"+ boxId+"传给PLC 成功");
//
// //四. 当MES完成任务后把MesToPlc.ShelfIsFullFinish变量置为true告诉plc我操作完成了
// write(S7Client.S7_KUKA,Step2Mes2PlcVar.ShelfIsFullFinish,true);
// logger.info("BOXID生成Event-------boxId :"+ boxId+"ShelfIsFullFinish 置为true 成功");
// //四. mes 监控 到PlcToMes.SubArrived==false就把MesToPlc.SubArrivedFinish置为false
// Integer subArrived2 = waitingForTarget(Step2Plc2MesVar.ShelfIsFull, false);
// if(subArrived2 != 1){
// logger.info("BOXID生成Event-------失败"+" --- "+"步骤1. MES监听 Step1Plc2MesVar.SubArrivedToMes 是否 等于 1 失败");
// }
// write(S7Client.S7_KUKA,Step2Mes2PlcVar.ShelfIsFullFinish,false);
// logger.info("BOXID生成Event-------boxId :"+ boxId+"ShelfIsFullFinish 置为false 成功,Event2 成功结束");
// }catch (Throwable e){
// e.printStackTrace();
// logger.info("BOXID生成Event------- 出现异常:" + e.toString());
// }
//
// //一. 从plc 中获取 subIdList 和 lineNum
// String[] subIdList = (String[])read(S7Client.S7_KUKA,Step2Plc2MesVar.SubIdList);
//// Integer lineNum = (Integer) read(S7Client.S7_KUKA,Step2Plc2MesVar.LineNum);
// logger.info("获取到基板列表:"+ Arrays.toString(subIdList));
//
// //二. MES 业务
// //=============== MES 业务 开始 =================
// //1.MES 生成BoxId
// if(subIdList.length<=0){
// logger.info("失败"+" --- "+"从plc里面获取到的基板列表 为空");
// }
// WoPackagingBoxSubstrate bySubId = substrateServiceBiz.getBySubId(subIdList[0]);
// String boxId = getBoxId(bySubId.getSapMaterial());
// logger.info("mes 生成的boxId :"+ boxId);
// //2. 依次update 基板表把boxId 赋予这些基板
// for(int i=0;i<subIdList.length;i++){
// substrateServiceBiz.updatePackagingBoxIdByWoSubstrateId(boxId,subIdList[i]);
// }
// //3.去camline数据库 查询此基板ID 对应的订单
// String orderNameBySubId = service.getOrderNameBySubId(subIdList[0]);
// //4. box信息录入到box表
// WoPackagingBox woPackagingBox = new WoPackagingBox();
// woPackagingBox.setBoxNo(boxId);
// woPackagingBox.setPackagingTime(LocalDateTime.now());
// woPackagingBox.setPowerLevel(bySubId.getPowerLevel());
// woPackagingBox.setLineBody(bySubId.getLineBody());
// woPackagingBox.setSapMaterial(bySubId.getSapMaterial());
// woPackagingBox.setOrderNum(orderNameBySubId);
// //1-手动模式2-自动模式
// woPackagingBox.setModel(2);
// boxServiceBiz.insert(woPackagingBox);
// //=============== MES 业务 结束 =================
//
// //三. 把生成的BoxId 告诉kuka
// write(S7Client.S7_KUKA,Step2Mes2PlcVar.BoxId,boxId);
//
// //四. 当MES完成任务后把MesToPlc.ShelfIsFullFinish变量置为true告诉plc我操作完成了
// write(S7Client.S7_KUKA,Step2Mes2PlcVar.ShelfIsFullFinish,true);
//
// //四. mes 监控 到PlcToMes.SubArrived==false就把MesToPlc.SubArrivedFinish置为false
// Integer subArrived2 = waitingForTarget(Step2Plc2MesVar.ShelfIsFull, false);
// if(subArrived2 != 1){
// logger.info("失败"+" --- "+"步骤1. MES监听 Step1Plc2MesVar.SubArrivedToMes 是否 等于 1 失败");
// }
// write(S7Client.S7_KUKA,Step2Mes2PlcVar.ShelfIsFullFinish,false);
// }
// },1,1, TimeUnit.SECONDS);
//
//
// kukaStep3.scheduleAtFixedRate(new Runnable() {
// @Override
// public void run() {
// //调度开始
// Integer shelfIsFull = waitingForTarget(Step3Plc2MesVar.ShelfIsFullArrived, true);
// if(shelfIsFull != 1){
// logger.info("失败"+" --- "+"MES监听 Step3Plc2MesVar.ShelfIsFullArrived 是否 等于 1 失败");
// try {
//
// //调度开始
// Integer shelfIsFull = waitingForTarget(Step3Plc2MesVar.ShelfIsFullArrived, true);
// if(shelfIsFull != 1){
// logger.info("装箱单打印Event------失败"+" --- "+"MES监听 Step3Plc2MesVar.ShelfIsFullArrived 是否 等于 1 失败");
// }
//
// //一. 从plc 中获取 subIdList 和 lineNum
// String boxId = (String)read(S7Client.S7_KUKA,Step3Plc2MesVar.BoxId);
// Integer lineNum = (Integer) read(S7Client.S7_KUKA,Step3Plc2MesVar.LineNum);
// logger.info("装箱单打印Event------到达站台的boxId :"+boxId);
//
// //二. MES 业务
// //=============== MES 业务 开始 =================
// //1. box信息录入到box表
// boxServiceBiz.updateIsArrivedByBoxNo(1,boxId);
// logger.info("装箱单打印Event------boxId :"+boxId+"更新数据库成功");
// //=============== MES 业务 结束 =================
//
//
// //四. 当MES完成任务后把MesToPlc.ShelfIsFullArrivedFinish变量置为true告诉plc我操作完成了
// write(S7Client.S7_KUKA,Step3Mes2PlcVar.ShelfIsFullArrivedFinish,true);
// logger.info("装箱单打印Event------boxId :"+boxId+" ShelfIsFullArrivedFinish置为true 成功");
// //四. mes 监控 到PlcToMes.SubArrived==false就把MesToPlc.SubArrivedFinish置为false
// Integer subArrived2 = waitingForTarget(Step3Plc2MesVar.ShelfIsFullArrived, false);
// if(subArrived2 != 1){
// logger.info("装箱单打印Event------失败"+" --- "+"步骤1. MES监听 Step3Plc2MesVar.ShelfIsFullArrived 是否 等于 1 失败");
// }
// logger.info("装箱单打印Event------boxId :"+boxId+" 监听到subArrived=false 成功");
// write(S7Client.S7_KUKA,Step3Mes2PlcVar.ShelfIsFullArrivedFinish,false);
// logger.info("装箱单打印Event------boxId :"+boxId+" Even3 成功");
// }catch (Throwable e){
// e.printStackTrace();
// logger.info("装箱单打印Event 出现异常------"+e.toString());
// }
//
// //一. 从plc 中获取 subIdList 和 lineNum
// String boxId = (String)read(S7Client.S7_KUKA,Step3Plc2MesVar.BoxId);
// Integer lineNum = (Integer) read(S7Client.S7_KUKA,Step3Plc2MesVar.LineNum);
// logger.info("到达站台的boxId :"+boxId);
//
// //二. MES 业务
// //=============== MES 业务 开始 =================
// //1. box信息录入到box表
// boxServiceBiz.updateIsArrivedByBoxNo(1,boxId);
// //=============== MES 业务 结束 =================
//
//
// //四. 当MES完成任务后把MesToPlc.ShelfIsFullArrivedFinish变量置为true告诉plc我操作完成了
// write(S7Client.S7_KUKA,Step3Mes2PlcVar.ShelfIsFullArrivedFinish,true);
//
// //四. mes 监控 到PlcToMes.SubArrived==false就把MesToPlc.SubArrivedFinish置为false
// Integer subArrived2 = waitingForTarget(Step3Plc2MesVar.ShelfIsFullArrived, false);
// if(subArrived2 != 1){
// logger.info("失败"+" --- "+"步骤1. MES监听 Step3Plc2MesVar.ShelfIsFullArrived 是否 等于 1 失败");
// }
// write(S7Client.S7_KUKA,Step3Mes2PlcVar.ShelfIsFullArrivedFinish,false);
//
//
// }
// },1,1, TimeUnit.SECONDS);

View File

@@ -14,7 +14,9 @@ public enum Step2Plc2MesVar {
ShelfIsFull("ShelfIsFull", PlcVar.BOOL,1, DaveArea.DB,2000,48,0),
SubIdList("SubIdList",PlcVar.STRING_Array,30,DaveArea.DB,2000,50,0,20),
LineNum("LineNum", PlcVar.BOOL,1, DaveArea.DB,2000,710,0),
LineNum("LineNum", PlcVar.UINT,1, DaveArea.DB,2000,710,0),
PackageNumberSet("PackageNumberSet", PlcVar.UINT,1, DaveArea.DB,2000,764,0),
;
private String name;

View File

@@ -3,6 +3,7 @@ package com.cnbm.packing.controller;
import com.cnbm.admin.annotation.LogOperation;
import com.cnbm.common.constant.Constant;
import com.cnbm.common.page.PageData;
import com.cnbm.common.utils.ConvertUtils;
import com.cnbm.common.utils.ExcelUtils;
import com.cnbm.common.utils.Result;
import com.cnbm.common.validator.AssertUtils;
@@ -11,6 +12,7 @@ import com.cnbm.common.validator.group.AddGroup;
import com.cnbm.common.validator.group.DefaultGroup;
import com.cnbm.common.validator.group.UpdateGroup;
import com.cnbm.packing.dto.ChangePackagingBoxHistoryDTO;
import com.cnbm.packing.entity.ChangePackagingBoxHistory;
import com.cnbm.packing.excel.ChangePackagingBoxHistoryExcel;
import com.cnbm.packing.service.ChangePackagingBoxHistoryServiceBiz;
import io.swagger.annotations.Api;
@@ -24,6 +26,7 @@ import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Map;
@@ -110,11 +113,35 @@ public class ChangePackagingBoxHistoryController {
@GetMapping("export")
@ApiOperation("导出")
@LogOperation("导出")
@ApiImplicitParams({
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataTypeClass = LocalDateTime.class),
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataTypeClass = LocalDateTime.class),
@ApiImplicitParam(name = "type", value = "类型1=加入包装箱2=移除包装箱3=换箱", paramType = "query", dataTypeClass=Integer.class)
})
@PreAuthorize("@ex.hasAuthority('packing:changePackagingBoxHistory:export')")
public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<ChangePackagingBoxHistoryDTO> list = changePackagingBoxHistoryService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, ChangePackagingBoxHistoryExcel.class);
List<ChangePackagingBoxHistory> list = changePackagingBoxHistoryService.historyList(params);
List<ChangePackagingBoxHistoryDTO> dtoList = ConvertUtils.sourceToTarget(list, ChangePackagingBoxHistoryDTO.class);
if(list.size()>0) {
for(ChangePackagingBoxHistoryDTO dto:dtoList){
//操作时间 转化
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
if(dto.getCreateTime()!=null){
dto.setCreateTime1(df.format(dto.getCreateTime()));
}
//操作类型 1=模组加入包装箱2=模组移出包装箱3=模组换箱
if(dto.getType()==1){
dto.setType1("模组加入包装箱");
}
if(dto.getType()==2){
dto.setType1("模组移出包装箱");
}
if(dto.getType()==3){
dto.setType1("模组换箱");
}
}
ExcelUtils.exportExcelToTarget(response, "包装箱模组操作记录", dtoList, ChangePackagingBoxHistoryExcel.class);
}
}
}

View File

@@ -49,7 +49,8 @@ public class PrintModelController {
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataTypeClass=String.class),
@ApiImplicitParam(name = "name", value = "标签名称", paramType = "query", dataTypeClass = String.class),
@ApiImplicitParam(name = "type", value = "类型0模组标签1等级标签", paramType = "query", dataTypeClass = Integer.class),
@ApiImplicitParam(name = "lineBody", value = "线体1=F ; 2=S", paramType = "query", dataTypeClass = Integer.class)
@ApiImplicitParam(name = "lineBody", value = "线体1=F ; 2=S", paramType = "query", dataTypeClass = Integer.class),
@ApiImplicitParam(name = "isEnable", value = "启用状态:0 、停用1、启用", paramType = "query", dataTypeClass = Integer.class)
})
@PreAuthorize("@ex.hasAuthority('packing:printModel:page')")
public Result<PageData<PrintModelDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){

View File

@@ -1,26 +1,50 @@
package com.cnbm.packing.controller;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.cnbm.admin.annotation.LogOperation;
import com.cnbm.dispatch.enums.kuka.step1.Step1Mes2PlcVar;
import com.cnbm.dispatch.enums.kuka.step1.Step1Plc2MesVar;
import com.cnbm.dispatch.enums.kuka.step2.Step2Mes2PlcVar;
import com.cnbm.dispatch.enums.kuka.step2.Step2Plc2MesVar;
import com.cnbm.dispatch.enums.kuka.step3.Step3Mes2PlcVar;
import com.cnbm.dispatch.enums.kuka.step3.Step3Plc2MesVar;
import com.cnbm.packing.dto.CamlineSubIdDTO;
import com.cnbm.packing.dto.CamlineSubIdForImportDTO;
import com.cnbm.packing.dto.PowerReportDTO;
import com.cnbm.packing.entity.WoPackagingBoxSubstrate;
import com.cnbm.packing.mapper.WoPackagingBoxSubstrateMapper;
import com.cnbm.packing.param.PowerReportQueryParam;
import com.cnbm.packing.param.SubIdQueryParam;
import com.cnbm.packing.service.DynamicDataSourceService;
import com.cnbm.packing.service.WoPackagingBoxServiceBiz;
import com.cnbm.packing.service.WoPackagingBoxSubstrateServiceBiz;
import com.cnbm.packing.vo.PowerReportVo;
import com.cnbm.packing.vo.SubIdPageVo;
import com.cnbm.s7.entity.R;
import com.cnbm.s7.s7connector.enmuc.S7Client;
import com.cnbm.s7.s7connector.type.PlcVar;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import com.cnbm.common.utils.Result;
import springfox.documentation.annotations.ApiIgnore;
import javax.validation.groups.Default;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.Format;
import java.text.ParseException;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
@@ -37,6 +61,16 @@ public class TestController {
private static final Logger logger = LoggerFactory.getLogger(TestController.class);
@Autowired
DynamicDataSourceService service;
@Autowired
WoPackagingBoxSubstrateServiceBiz substrateServiceBiz;
@Autowired
WoPackagingBoxServiceBiz boxServiceBiz;
@Autowired
WoPackagingBoxSubstrateMapper subMapper;
private Object read(S7Client s7Client,Step1Plc2MesVar var) throws UnsupportedEncodingException, ParseException {
try {
return s7Client.read(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getLength(), var.getStrSize(), var.getType());
@@ -93,6 +127,106 @@ public class TestController {
return null;
}
}
@PostMapping("/forString")
public R forString() throws UnsupportedEncodingException, ParseException {
String[] s = (String[])read(S7Client.S7_KUKA,Step2Plc2MesVar.SubIdList);
System.out.println(Step2Plc2MesVar.SubIdList.getName()+" : "+Arrays.toString(s));
return R.ok();
}
@PostMapping("/subPageMapper")
@ApiOperation(value = "基板表 left join box表 分页查询")
public com.cnbm.packing.vo.R<IPage<SubIdPageVo>> subPageMapper(@Validated({Default.class}) @RequestBody SubIdQueryParam param) {
return boxServiceBiz.subIdPage(param);
}
@PostMapping("/forImport")
public R forImport() throws UnsupportedEncodingException, ParseException {
List<CamlineSubIdForImportDTO> alllCamlineSubForImp = service.getAlllCamlineSubForImp();
for(CamlineSubIdForImportDTO cam:alllCamlineSubForImp){
WoPackagingBoxSubstrate woPackagingBoxSubstrate = new WoPackagingBoxSubstrate();
woPackagingBoxSubstrate.setWoSubstrateId(cam.getSubId());
woPackagingBoxSubstrate.setLineBody(2);
woPackagingBoxSubstrate.setPowerLevel(cam.getPowerLevel());
woPackagingBoxSubstrate.setOrderName(cam.getOrderName());
woPackagingBoxSubstrate.setSapMaterial(cam.getSapMaterial());
substrateServiceBiz.insert(woPackagingBoxSubstrate);
}
return R.ok();
}
@PostMapping("/forTestMix")
public R forTestMix() throws UnsupportedEncodingException, ParseException {
String[] s = new String[20];
s[0]= "30110012303021614";
s[1]= "30110012303022415";
s[2]= "30110012303022801";
s[3]= "30110012303040003";
s[4]= "30110012303030488";
s[5]= "30110012303020247";
s[6]= "30110012303021008";
s[7]= "30110012303022434";
s[8]= "30110012303012878";
s[9]= "30110012302281212";
s[10]= "30110012302281213";
s[11]= "30110012302281215";
s[12]= "30110012302271160";
s[13]= "30110012302271154";
s[14]= "30110012303050321";
s[15]= "30110012303050331";
s[16]= "30110012303020036";
s[17]= "30110012303022606";
s[18]= "30110012303030009";
s[19]= "30110012303021795";
System.out.println(isMixLevel(s));;
WoPackagingBoxSubstrate bySubId = substrateServiceBiz.getBySubId(s[0]);
System.out.println(bySubId.getSapMaterial());
System.out.println(getErrorBoxId(bySubId.getSapMaterial()));
System.out.println(getBoxId(bySubId.getSapMaterial()));
return R.ok();
}
public String formateString(Integer a){
Format f1 = new DecimalFormat("000");
return f1.format(a);
}
public String getBoxId(String sapMaterial){
Integer todayBoxNum = service.getTodayBoxNum()+1;
String nowTime = DateUtil.format(new Date(), "yyMMdd");
todayBoxNum+=500;
String res = "301"+sapMaterial+nowTime+formateString(todayBoxNum);
return res;
}
public String getErrorBoxId(String sapMaterial){
String nowTime = DateUtil.format(new Date(), "yyMMdd");
String mixBoxError = "001";
String res = "Err"+sapMaterial+nowTime+mixBoxError;
return res;
}
private boolean isMixLevel(String[] subIds){
String correctLevel = substrateServiceBiz.getBySubId(subIds[0]).getPowerLevel();
String errMsg = "以下基板ID出现混档";
boolean res = false;
for(int i=1;i<subIds.length;i++){
String powerLevel = substrateServiceBiz.getBySubId(subIds[i]).getPowerLevel();
if(!powerLevel.equals(correctLevel)){
errMsg+="基板ID:"+subIds[i]+" 档位:"+powerLevel+", ";
res = true;
}
}
if(res){
logger.error(errMsg);
}
return res;
}
@PostMapping("/testReadAll")
public R testReadAll() throws UnsupportedEncodingException, ParseException {
@@ -124,14 +258,75 @@ public class TestController {
}
return R.ok();
}
public static void main(String[] args) {
BigDecimal voc = new BigDecimal(59.799);
System.out.println(Float.valueOf(voc.toString()));
}
@PostMapping("/testWrite")
public R testWrite() {
BigDecimal voc = new BigDecimal(59.799);
BigDecimal isc = new BigDecimal(3.799);
BigDecimal vmpp = new BigDecimal(46.799);
BigDecimal impp = new BigDecimal(3.0799);
write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Pnom,new Integer(1));
System.out.println(Step1Mes2PlcVar.dLable_Pnom.getName()+" : "+1);
write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Voc,voc);
System.out.println(Step1Mes2PlcVar.dLable_Voc.getName()+" : "+voc.toPlainString());
write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Isc,isc);
System.out.println(Step1Mes2PlcVar.dLable_Isc.getName()+" : "+isc.toPlainString());
write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Vmpp,vmpp);
System.out.println(Step1Mes2PlcVar.dLable_Vmpp.getName()+" : "+vmpp.toPlainString());
write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Impp,impp);
System.out.println(Step1Mes2PlcVar.dLable_Impp.getName()+" : "+impp.toPlainString());
write(S7Client.S7_KUKA,Step2Mes2PlcVar.BoxId,"12345678901111111111");
System.out.println(Step2Mes2PlcVar.BoxId.getName()+" : "+"12345678901111111111");
write(S7Client.S7_KUKA,Step1Mes2PlcVar.SubArrivedFinish,true);
System.out.println(Step1Mes2PlcVar.SubArrivedFinish.getName()+" : "+"true");
write(S7Client.S7_KUKA,Step2Mes2PlcVar.ShelfIsFullFinish,false);
System.out.println(Step2Mes2PlcVar.ShelfIsFullFinish.getName()+" : "+"false");
write(S7Client.S7_KUKA,Step3Mes2PlcVar.ShelfIsFullArrivedFinish,true);
System.out.println(Step3Mes2PlcVar.ShelfIsFullArrivedFinish.getName()+" : "+"true");
return R.ok();
}
@PostMapping("/testlogger")
public R testlogger() {
logger.info("test logger");
System.out.println("test logger");
// CamlineSubIdDTO subIdByCamline = service.getSubIdByCamline("30110012302220591");
// CamlineSubIdDTO subIdByCamline2 = service.getSubIdByCamline("30110012302220591 ");
// System.out.println("subIdByCamline: "+subIdByCamline.toString());
// System.out.println("subIdByCamline2: "+subIdByCamline2.toString());
// WoPackagingBoxSubstrate bySubId = substrateServiceBiz.getBySubId("30110012302220591 ");
// System.out.println("bySubId: "+bySubId.toString());
WoPackagingBoxSubstrate bySubId = substrateServiceBiz.getBySubId("30110012302210707 ");
if(bySubId == null){
//todo
CamlineSubIdDTO subIdByCamline = service.getSubIdByCamline("30110012302220591 ");
bySubId = new WoPackagingBoxSubstrate();
bySubId.setPowerLevel(subIdByCamline.getPowerLevel());
bySubId.setSapMaterial(subIdByCamline.getSapMaterial());
System.out.println("bySubId2 : "+bySubId.toString());
}
return R.ok();
}
@PostMapping("getPMPPBySubId")
@ApiImplicitParams({
@ApiImplicitParam(name = "subId", value = "基板ID", paramType = "query", required = true, dataTypeClass=Integer.class) ,
@@ -159,4 +354,51 @@ public class TestController {
return new Result<String>().ok(service.getExtendArgFromCamline(subId.toString()).toString());
}
private void write(S7Client s7Client, Step1Mes2PlcVar var, Object newValue) {
if(var.getType().equals(PlcVar.STRING_Array)){
String[] s = (String[])newValue;
String[] ss = (String[])newValue;
if(s.length > var.getLength() ){
ss = new String[var.getLength()];
for(int i=0;i< var.getLength();i++){
ss[i] = s[i];
}
}
s7Client.write(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getStrSize(), var.getType(),ss);
}else {
s7Client.write(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getStrSize(), var.getType(),newValue);
}
}
private void write(S7Client s7Client, Step2Mes2PlcVar var, Object newValue) {
if(var.getType().equals(PlcVar.STRING_Array)){
String[] s = (String[])newValue;
String[] ss = (String[])newValue;
if(s.length > var.getLength() ){
ss = new String[var.getLength()];
for(int i=0;i< var.getLength();i++){
ss[i] = s[i];
}
}
s7Client.write(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getStrSize(), var.getType(),ss);
}else {
s7Client.write(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getStrSize(), var.getType(),newValue);
}
}
private void write(S7Client s7Client, Step3Mes2PlcVar var, Object newValue) {
if(var.getType().equals(PlcVar.STRING_Array)){
String[] s = (String[])newValue;
String[] ss = (String[])newValue;
if(s.length > var.getLength() ){
ss = new String[var.getLength()];
for(int i=0;i< var.getLength();i++){
ss[i] = s[i];
}
}
s7Client.write(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getStrSize(), var.getType(),ss);
}else {
s7Client.write(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getStrSize(), var.getType(),newValue);
}
}
}

View File

@@ -1,5 +1,6 @@
package com.cnbm.packing.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.cnbm.admin.annotation.LogOperation;
import com.cnbm.common.constant.Constant;
import com.cnbm.common.page.PageData;
@@ -12,7 +13,11 @@ import com.cnbm.common.validator.group.DefaultGroup;
import com.cnbm.common.validator.group.UpdateGroup;
import com.cnbm.packing.dto.IdVo;
import com.cnbm.packing.dto.WoPackagingBoxDTO;
import com.cnbm.packing.entity.WoPackagingBox;
import com.cnbm.packing.entity.WoPackagingBoxSubstrate;
import com.cnbm.packing.excel.WoPackagingBoxExcel;
import com.cnbm.packing.excel.WoPackagingBoxSubstrateExcel;
import com.cnbm.packing.mapper.WoPackagingBoxMapper;
import com.cnbm.packing.service.WoPackagingBoxServiceBiz;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@@ -41,6 +46,8 @@ import java.util.Map;
public class WoPackagingBoxController {
@Autowired
private WoPackagingBoxServiceBiz woPackagingBoxService;
@Autowired
private WoPackagingBoxMapper woPackagingBoxMapper;
@GetMapping("page")
@ApiOperation("分页")
@@ -52,8 +59,8 @@ public class WoPackagingBoxController {
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataTypeClass = LocalDateTime.class),
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataTypeClass = LocalDateTime.class),
@ApiImplicitParam(name = "boxNo", value = "boxid", paramType = "query", dataTypeClass = String.class),
@ApiImplicitParam(name = "lineBody", value = "线体", paramType = "query", dataTypeClass = Integer.class),
@ApiImplicitParam(name = "printStatus", value = "打印状态0、未打印1、已打印", paramType = "query", dataTypeClass = Integer.class),
// @ApiImplicitParam(name = "lineBody", value = "线体", paramType = "query", dataTypeClass = Integer.class),
// @ApiImplicitParam(name = "printStatus", value = "打印状态0、未打印1、已打印", paramType = "query", dataTypeClass = Integer.class),
@ApiImplicitParam(name = "model", value = "模式1-手动模式2-自动模式", paramType = "query", dataTypeClass = Integer.class)
})
@PreAuthorize("@ex.hasAuthority('packing:woPackagingBox:page')")
@@ -132,4 +139,56 @@ public class WoPackagingBoxController {
return new Result<WoPackagingBoxDTO>().ok(data);
}
@GetMapping("exportSubstrateList")
@ApiOperation("箱单明细导出")
@LogOperation("箱单明细导出")
@ApiImplicitParams({
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataTypeClass = LocalDateTime.class),
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataTypeClass = LocalDateTime.class),
@ApiImplicitParam(name = "boxNo", value = "boxid", paramType = "query", dataTypeClass = String.class),
// @ApiImplicitParam(name = "lineBody", value = "线体", paramType = "query", dataTypeClass = Integer.class),
// @ApiImplicitParam(name = "printStatus", value = "打印状态0、未打印1、已打印", paramType = "query", dataTypeClass = Integer.class),
@ApiImplicitParam(name = "model", value = "模式1-手动模式2-自动模式", paramType = "query", dataTypeClass = Integer.class)
})
public void exportSubstrateList(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<WoPackagingBoxSubstrate> list = woPackagingBoxService.substrateList(params);
if (list.size() > 0) {
ExcelUtils.exportExcelToTarget(response, "箱单明细", list, WoPackagingBoxSubstrateExcel.class);
}
}
@GetMapping("boxList/{woSubstrateId}")
@ApiOperation("查询模组id所在包装箱")
public List<WoPackagingBox> boxList(@PathVariable("woSubstrateId") String woSubstrateId){
return woPackagingBoxService.boxList(woSubstrateId);
}
@PostMapping("insertSubstrateManual")
@ApiOperation("手动新增包装箱")
@LogOperation("手动新增包装箱")
public Result<IdVo> insertSubstrateManual(@RequestBody WoPackagingBoxDTO dto){
//验证包装箱是否重名
QueryWrapper<WoPackagingBox> wrapper = new QueryWrapper<>();
wrapper.eq(WoPackagingBox.BOX_NO, dto.getBoxNo());
if(woPackagingBoxMapper.selectCount(wrapper)!= 0){
return new Result().error(1,"BoxID已存在,请重新输入");
}
else {
return new Result<IdVo>().ok(woPackagingBoxService.insertSubstrateManual(dto));
}
}
@PostMapping("editSubstrateManual")
@ApiOperation("手动编辑包装箱")
@LogOperation("手动编辑包装箱")
public Result editSubstrateManual(@RequestBody WoPackagingBoxDTO dto){
woPackagingBoxService.editSubstrateManual(dto);
return new Result();
}
}

View File

@@ -13,13 +13,18 @@ import com.cnbm.common.validator.group.AddGroup;
import com.cnbm.common.validator.group.DefaultGroup;
import com.cnbm.common.validator.group.UpdateGroup;
import com.cnbm.packing.dto.ChangePackingBoxDTO;
import com.cnbm.packing.dto.PowerReportDTO;
import com.cnbm.packing.dto.WoPackagingBoxSubstrateDTO;
import com.cnbm.packing.entity.WoPackagingBox;
import com.cnbm.packing.entity.WoPackagingBoxSubstrate;
import com.cnbm.packing.excel.WoPackagingBoxSubstrateExcel;
import com.cnbm.packing.excel.WoPackagingBoxSubstrateManualExcel;
import com.cnbm.packing.mapper.WoPackagingBoxMapper;
import com.cnbm.packing.mapper.WoPackagingBoxSubstrateMapper;
import com.cnbm.packing.param.PowerReportQueryParam;
import com.cnbm.packing.service.WoPackagingBoxServiceBiz;
import com.cnbm.packing.service.WoPackagingBoxSubstrateServiceBiz;
import com.cnbm.packing.vo.PowerReportVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
@@ -31,8 +36,13 @@ import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse;
import java.text.DecimalFormat;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
import java.util.Objects;
/**
@@ -48,6 +58,9 @@ public class WoPackagingBoxSubstrateController {
@Autowired
private WoPackagingBoxSubstrateServiceBiz woPackagingBoxSubstrateService;
@Autowired
private WoPackagingBoxServiceBiz boxServiceBiz;
@Autowired
private WoPackagingBoxSubstrateMapper woPackagingBoxSubstrateMapper;
@@ -93,6 +106,16 @@ public class WoPackagingBoxSubstrateController {
return new Result<Long>().ok(dto.getId());
}
// @PostMapping
// @ApiOperation("功率报表")
// @LogOperation("功率报表查询")
// public Result<List<PowerReportDTO>> powerReport(@RequestBody PowerReportQueryParam queryParam){
//
//
// List<PowerReportDTO> powerReportDTOS = boxServiceBiz.powerReport(queryParam.getOrderName(), queryParam.getBegin(), queryParam.getEnd());
// return new Result<List<PowerReportDTO>>().ok(powerReportDTOS);
// }
@PutMapping
@ApiOperation("修改")
@LogOperation("修改")
@@ -106,6 +129,91 @@ public class WoPackagingBoxSubstrateController {
return new Result<Long>().ok(dto.getId());
}
@ApiOperation("查询模组档位统计分布图powerReportTY")
@LogOperation("查询模组档位统计分布图powerReportTY")
@PostMapping("/powerReportTY")
public Result<Boolean> powerReportTY(@RequestBody PowerReportQueryParam queryParam){
List<PowerReportDTO> powerReportDTOS = boxServiceBiz.powerReport(queryParam);
System.out.println(powerReportDTOS);
return new Result<Boolean>().ok(true);
}
@ApiOperation("查询模组档位统计分布图")
@LogOperation("查询模组档位统计分布图")
@PostMapping("/powerReport")
public Result<PowerReportVo> powerReport(@RequestBody PowerReportQueryParam queryParam){
List<PowerReportDTO> powerReportDTOS = boxServiceBiz.powerReport(queryParam);
System.out.println(powerReportDTOS.toString());
List<PowerReportDTO> powerReportList = new ArrayList<>();
powerReportList.add(new PowerReportDTO(0,"115",0f,"0%"));
powerReportList.add(new PowerReportDTO(0,"120",0f,"0%"));
powerReportList.add(new PowerReportDTO(0,"125",0f,"0%"));
powerReportList.add(new PowerReportDTO(0,"130",0f,"0%"));
powerReportList.add(new PowerReportDTO(0,"135",0f,"0%"));
powerReportList.add(new PowerReportDTO(0,"140",0f,"0%"));
powerReportList.add(new PowerReportDTO(0,"145",0f,"0%"));
powerReportList.add(new PowerReportDTO(0,"150",0f,"0%"));
powerReportList.add(new PowerReportDTO(0,"155",0f,"0%"));
powerReportList.add(new PowerReportDTO(0,"160",0f,"0%"));
for(PowerReportDTO power : powerReportList){
for(PowerReportDTO inner : powerReportDTOS){
if(Objects.equals(power.getSubLevel(), inner.getSubLevel())){
power.setProportion(inner.getProportion());
power.setSubNum(inner.getSubNum());
power.setSumPMPP(inner.getSumPMPP());
power.setSubLevel(inner.getSubLevel());
}
}
}
System.out.println(powerReportList.toString());
PowerReportVo powerReportVo = new PowerReportVo();
Float totalLevelPower = new Float(0);
Float totalCompensatePower = new Float(0);
Float diversePower = new Float(0);
Integer totalSubNum = 0;
for(PowerReportDTO power : powerReportList){
Integer subLevel = Integer.valueOf(power.getSubLevel());
Integer subNum = power.getSubNum();
if(power.getSumPMPP()==null){
return new Result<PowerReportVo>().error("基板等级:"+subLevel+",基板数量:"+subNum+", 的总和为null");
}
Float sumPMPP = power.getSumPMPP();
totalLevelPower += subLevel*subNum;
totalCompensatePower += sumPMPP*subNum;
totalSubNum+= subNum;
}
for(PowerReportDTO power : powerReportList){
if(power.getSubNum()==0 ||totalSubNum ==0 ){
power.setProportion("0%");
}else {
Float prop = (Float.valueOf(power.getSubNum())/Float.valueOf(totalSubNum))*100;
DecimalFormat df = new DecimalFormat("0.00");
String propS = df.format(prop)+"%";
power.setProportion(propS);
}
}
diversePower = totalCompensatePower - totalLevelPower;
powerReportVo.setPowerReports(powerReportList);
powerReportVo.setDiversePower(diversePower);
powerReportVo.setTotalCompensatePower(totalCompensatePower);
powerReportVo.setTotalLevelPower(totalLevelPower);
return new Result<PowerReportVo>().ok(powerReportVo);
}
@ApiOperation("查询模组档位统计分布图-获取ordername列表")
@LogOperation("查询模组档位统计分布图-获取ordername列表")
@PostMapping("/orderNameList")
public Result<List<String>> orderNameList(){
List<String> powerReportDTOS = boxServiceBiz.orderNameList();
return new Result<List<String>>().ok(powerReportDTOS);
}
@DeleteMapping
@ApiOperation("删除")
@LogOperation("删除")
@@ -144,10 +252,9 @@ public class WoPackagingBoxSubstrateController {
@LogOperation("合箱")
public Result insertSubstrate(@RequestBody ChangePackingBoxDTO dto){
String woSubstrateId = dto.getWoSubstrateId();
//验证模组是否存在
QueryWrapper<WoPackagingBoxSubstrate> substrateQueryWrapper1 = new QueryWrapper<>();
substrateQueryWrapper1.eq(StringUtils.isNotBlank(woSubstrateId), WoPackagingBoxSubstrate.WO_SUBSTRATE_ID, woSubstrateId);
substrateQueryWrapper1.eq(WoPackagingBoxSubstrate.WO_SUBSTRATE_ID, dto.getWoSubstrateId());
if(woPackagingBoxSubstrateMapper.selectCount(substrateQueryWrapper1 )== 0){
return new Result().error(1,"该模组不存在,请重新输入");
}
@@ -210,11 +317,67 @@ public class WoPackagingBoxSubstrateController {
@PostMapping("insertSubstrateManual")
@ApiOperation("手动装箱")
@LogOperation("手动装箱")
public Result insertSubstrateManual(@RequestBody ChangePackingBoxDTO dto){
public Result insertSubstrateManual(@RequestBody ChangePackingBoxDTO[] dtos){
woPackagingBoxSubstrateService.insertSubstrateManual(dto);
woPackagingBoxSubstrateService.insertSubstrateManual(dtos);
return new Result();
}
@PostMapping("updateSubstrateManual")
@ApiOperation("手动装箱编辑")
@LogOperation("手动装箱编辑")
public Result updateSubstrateManual(@RequestBody ChangePackingBoxDTO[] dtos){
woPackagingBoxSubstrateService.updateSubstrateManual(dtos);
return new Result();
}
@GetMapping("substrateList")
@ApiOperation("装箱单信息查询")
@ApiImplicitParams({
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataTypeClass = LocalDateTime.class),
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataTypeClass = LocalDateTime.class),
@ApiImplicitParam(name = "model", value = "模式1-手动模式2-自动模式", paramType = "query", dataTypeClass = Integer.class),
@ApiImplicitParam(name = "packagingBoxId", value = "包装箱IDBoxId", paramType = "query", dataTypeClass = String.class),
@ApiImplicitParam(name = "woSubstrateId", value = "基板ID关联T_SUBSTRATE表", paramType = "query", dataTypeClass = String.class)
})
public List<WoPackagingBoxSubstrateDTO> substrateList(@ApiIgnore @RequestParam Map<String, Object> params){
return woPackagingBoxSubstrateService.substrateList(params);
}
@GetMapping("exportPackingInfo")
@ApiOperation("装箱单信息导出")
@LogOperation("装箱单信息导出")
@ApiImplicitParams({
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataTypeClass = LocalDateTime.class),
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataTypeClass = LocalDateTime.class),
@ApiImplicitParam(name = "model", value = "模式1-手动模式2-自动模式", paramType = "query", dataTypeClass = Integer.class),
@ApiImplicitParam(name = "packagingBoxId", value = "包装箱IDBoxId", paramType = "query", dataTypeClass = String.class),
@ApiImplicitParam(name = "woSubstrateId", value = "基板ID关联T_SUBSTRATE表", paramType = "query", dataTypeClass = String.class)
})
public void exportPackingInfo(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<WoPackagingBoxSubstrateDTO> list = woPackagingBoxSubstrateService.substrateList(params);
if(list.size()>0) {
//包装箱创建时间 最近打印时间 转化
for(WoPackagingBoxSubstrateDTO dto:list){
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
if(dto.getBoxCreateTime()!=null){
dto.setBoxCreateTime1(df.format(dto.getBoxCreateTime()));
}
if(dto.getPrintTime()!=null){
dto.setPrintTime1(df.format(dto.getPrintTime()));
}
}
if(Integer.parseInt(params.get("model").toString())==1){
ExcelUtils.exportExcelToTarget(response, "手动装箱单信息", list, WoPackagingBoxSubstrateManualExcel.class);
}
else {
ExcelUtils.exportExcelToTarget(response, "自动装箱单信息", list, WoPackagingBoxSubstrateExcel.class);
}
}
}
}

View File

@@ -0,0 +1,30 @@
package com.cnbm.packing.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 打印标签模板表
*
* @author codeGenerator
* @since 2023-02-20
*/
@Data
@ApiModel(value = "camline 查询对象")
public class CamlineSubIdDTO implements Serializable {
private static final long serialVersionUID = 1L;
private String powerLevel;
private String sapMaterial;
}

View File

@@ -0,0 +1,28 @@
package com.cnbm.packing.dto;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import java.io.Serializable;
/**
* 打印标签模板表
*
* @author codeGenerator
* @since 2023-02-20
*/
@Data
@ApiModel(value = "camline 查询对象")
public class CamlineSubIdForImportDTO implements Serializable {
private static final long serialVersionUID = 1L;
private String subId;
private String powerLevel;
private String sapMaterial;
private String orderName;
}

View File

@@ -75,4 +75,10 @@ public class ChangePackagingBoxHistoryDTO implements Serializable {
@ApiModelProperty(value = "版本号")
private Integer version;
@ApiModelProperty(value = "操作时间(转)")
private String createTime1;
@ApiModelProperty(value = "操作类型(转)")
private String type1;
}

View File

@@ -0,0 +1,48 @@
package com.cnbm.packing.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 包装箱基板关联表 ( 基板表 )
*
* @author codeGenerator
* @since 2023-02-21
*/
@Data
@ApiModel(value = "包装箱基板关联表 ( 基板表 )DTO对象")
public class PowerReportDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "subNum")
private Integer subNum;
@ApiModelProperty(value = "subLevel")
private String subLevel;
@ApiModelProperty(value = "sumPMPP")
private Float sumPMPP;
@ApiModelProperty(value = "占比(百分比)")
private String proportion;
public PowerReportDTO() {
}
public PowerReportDTO(Integer subNum, String subLevel, Float sumPMPP, String proportion) {
this.subNum = subNum;
this.subLevel = subLevel;
this.sumPMPP = sumPMPP;
this.proportion = proportion;
}
public PowerReportDTO(Integer subNum, String subLevel, Float sumPMPP) {
this.subNum = subNum;
this.subLevel = subLevel;
this.sumPMPP = sumPMPP;
}
}

View File

@@ -77,4 +77,7 @@ public class PrintModelDTO implements Serializable {
@ApiModelProperty(value = "线体1=F ; 2=S (用于过程1比对和包装打印)(设备传给我们的)")
private Integer lineBody;
@ApiModelProperty(value = "是否启用0 停用1 启用")
private Integer isEnable;
}

View File

@@ -74,7 +74,7 @@ public class WoPackagingBoxSubstrateDTO implements Serializable {
@ApiModelProperty(value = "")
private LocalDateTime lastUpdateTime;
@ApiModelProperty(value = "补偿pmpp")
@ApiModelProperty(value = "补偿后的功率,pmpp")
private Float pmpp;
@ApiModelProperty(value = "订单名")
@@ -170,4 +170,19 @@ public class WoPackagingBoxSubstrateDTO implements Serializable {
@ApiModelProperty(value = "")
private Float uocFl2;
@ApiModelProperty(value = "真实PMPP")
private Float actualPmpp;
@ApiModelProperty(value = "包装箱创建时间")
private LocalDateTime boxCreateTime;
@ApiModelProperty(value = "打印时间(最近一次打印时间)")
private LocalDateTime printTime;
@ApiModelProperty(value = "包装箱创建时间(转)")
private String boxCreateTime1;
@ApiModelProperty(value = "最近打印时间(转)")
private String printTime1;
}

View File

@@ -78,6 +78,9 @@ public class PrintModel implements Serializable {
@ApiModelProperty("线体1=F ; 2=S (用于过程1比对和包装打印)(设备传给我们的)")
private Integer lineBody;
@ApiModelProperty("是否启用0 停用1 启用")
private Integer isEnable;
public static final String ID = "ID";
@@ -115,4 +118,6 @@ public class PrintModel implements Serializable {
public static final String LINE_BODY = "line_body";
public static final String IS_ENABLE = "is_enable";
}

View File

@@ -14,7 +14,7 @@ import lombok.Data;
* </p>
*
* @author codeGenerator
* @since 2023-02-21
* @since 2023-03-03
*/
@Data
@TableName("t_wo_packaging_box_substrate")
@@ -74,7 +74,7 @@ public class WoPackagingBoxSubstrate implements Serializable {
private LocalDateTime lastUpdateTime;
@ApiModelProperty("补偿pmpp")
@ApiModelProperty("补偿后的功率,pmpp")
private Float pmpp;
@ApiModelProperty("订单名")
@@ -140,6 +140,9 @@ public class WoPackagingBoxSubstrate implements Serializable {
private Float uocFl2;
@ApiModelProperty("真实PMPP")
private Float actualPmpp;
public static final String ID = "ID";
@@ -239,5 +242,6 @@ public class WoPackagingBoxSubstrate implements Serializable {
public static final String UOC_FL2 = "UOC_FL2";
public static final String ACTUAL_PMPP = "ACTUAL_PMPP";
}

View File

@@ -16,41 +16,20 @@ import java.util.Date;
*/
@Data
public class ChangePackagingBoxHistoryExcel {
@Excel(name = "ID")
private Long id;
@Excel(name = "基板ID或模组id")
@Excel(name = "基板ID")
private String substrateId;
@Excel(name = "源包装箱box no, 关联t_wo_packaging_box.box_no 字段")
@Excel(name = "源包装箱")
private String sourceBoxNo;
@Excel(name = "箱slot")
@Excel(name = "位置")
private Integer sourceSlot;
@Excel(name = "离开时间")
private LocalDateTime leaveTime;
@Excel(name = "目标箱box no, 关联t_wo_packaging_box.box_no 字段")
@Excel(name = "目的包装箱")
private String targetBoxNo;
@Excel(name = "标箱slot")
@Excel(name = "的位置")
private Integer targetSlot;
@Excel(name = "进入时间")
private LocalDateTime inputTime;
@Excel(name = "等级")
private String grade;
@Excel(name = "类型1=加入包装箱2=移除包装箱3=换箱")
private Integer type;
@Excel(name = "删除标志,是否有效:1 可用 0不可用")
private Integer valid;
@Excel(name = "创建人")
private Long creatorId;
@Excel(name = "创建人姓名")
private String creatorName;
@Excel(name = "创建时间")
private LocalDateTime createTime;
@Excel(name = "更新人")
private Long updaterId;
@Excel(name = "更新人姓名")
private String updaterName;
@Excel(name = "更新时间")
private LocalDateTime updateTime;
@Excel(name = "版本号")
private Integer version;
@Excel(name = "操作类型")
private String type1;
@Excel(name = "操作时间")
private String createTime1;
}

View File

@@ -52,5 +52,7 @@ public class PrintModelExcel {
private String content;
@Excel(name = "线体1=F ; 2=S (用于过程1比对和包装打印)(设备传给我们的)")
private Integer lineBody;
@Excel(name = "是否启用0 停用1 启用")
private Integer isEnable;
}

View File

@@ -1,6 +1,7 @@
package com.cnbm.packing.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDateTime;
@@ -16,104 +17,28 @@ import java.util.Date;
*/
@Data
public class WoPackagingBoxSubstrateExcel {
@Excel(name = "ID")
private Long id;
@Excel(name = "包装箱IDBoxId")
private String packagingBoxId;
@Excel(name = "基板ID")
private String woSubstrateId;
@Excel(name = "创建人")
private Long creatorId;
@Excel(name = "创建人姓名")
private String creatorName;
@Excel(name = "创建时间")
private LocalDateTime createTime;
@Excel(name = "更新人")
private Long updaterId;
@Excel(name = "更新人姓名")
private String updaterName;
@Excel(name = "更新时间")
private LocalDateTime updateTime;
@Excel(name = "版本号")
private Integer version;
@Excel(name = "箱中位置")
private Integer slot;
@Excel(name = "进入时间")
private LocalDateTime inputTime;
@Excel(name = "删除标志,是否有效:1 可用 0不可用")
private Integer valid;
@Excel(name = "SAP MATERIAL,从t_wo_power_level 对应过来的")
private String sapMaterial;
@Excel(name = "线体,从t_wo_power_level 对应过来的1=F ; 2=S")
private Integer lineBody;
@Excel(name = "功率等级")
private String powerLevel;
@Excel(name = "")
private LocalDateTime lastUpdateTime;
@Excel(name = "补偿pmpp")
private Float pmpp;
@Excel(name = "订单名")
private String orderName;
@Excel(name = "")
private Long binclassFl1;
@Excel(name = "")
private Long binclassFl2;
@Excel(name = "")
private Float etaFl1;
@Excel(name = "")
private Float etaFl2;
@Excel(name = "")
private Float ffFl1;
@Excel(name = "")
private Float ffFl2;
@Excel(name = "")
private Float imppFl1;
@Excel(name = "")
private Float imppFl2;
@Excel(name = "")
private Float insolflashcontrolFl1;
@Excel(name = "")
private Float insolflashcontrolFl2;
@Excel(name = "")
private Float insolmppFl1;
@Excel(name = "")
private Float insolmppFl2;
@Excel(name = "")
private Float insolvocFl1;
@Excel(name = "")
private Float insolvocFl2;
@Excel(name = "")
private Float insolFl1;
@Excel(name = "")
private Float insolFl2;
@Excel(name = "")
private Float iscFl1;
@Excel(name = "")
private Float iscFl2;
@Excel(name = "")
private LocalDateTime measTimeFl1;
@Excel(name = "")
private LocalDateTime measTimeFl2;
@Excel(name = "")
private Float pmppFl1;
@Excel(name = "")
private Float pmppFl2;
@Excel(name = "")
private Float tcellFl1;
@Excel(name = "")
private Float tcellFl2;
@Excel(name = "")
private Float tmonicellFl1;
@Excel(name = "")
private Float tmonicellFl2;
@Excel(name = "")
private Float umppFl1;
@Excel(name = "")
private Float umppFl2;
@Excel(name = "")
private Float uocFl1;
@Excel(name = "")
private Float uocFl2;
@Excel(name = "创建时间")
private String boxCreateTime1;
@Excel(name = "模组ID")
private String woSubstrateId;
@Excel(name = "BoxID")
private String packagingBoxId;
@Excel(name = "模组所在包装箱位置")
private Integer slot;
@Excel(name = "订单号")
private String orderName;
@Excel(name = "SAP物料号")
private String sapMaterial;
@Excel(name = "档位功率")
private String powerLevel;
@Excel(name = "补偿功率")
private Float pmpp;
@Excel(name = "实测功率")
private Float actualPmpp;
@Excel(name = "线体")
private Integer lineBody;
@Excel(name = "最近打印时间")
private String printTime1;
}

View File

@@ -0,0 +1,32 @@
package com.cnbm.packing.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
/**
* 包装箱基板关联表 ( 基板表 )
*
* @author codeGenerator
* @since 2023-02-21
*/
@Data
public class WoPackagingBoxSubstrateManualExcel {
@Excel(name = "创建时间")
private String boxCreateTime1;
@Excel(name = "模组ID")
private String woSubstrateId;
@Excel(name = "BoxID")
private String packagingBoxId;
@Excel(name = "模组所在包装箱位置")
private Integer slot;
@Excel(name = "SAP物料号")
private String sapMaterial;
@Excel(name = "功率等级")
private String powerLevel;
@Excel(name = "线体")
private Integer lineBody;
@Excel(name = "最近打印时间")
private String printTime1;
}

View File

@@ -1,6 +1,8 @@
package com.cnbm.packing.mapper;
import com.cnbm.packing.dto.CamlineExtendArgDTO;
import com.cnbm.packing.dto.CamlineSubIdDTO;
import com.cnbm.packing.dto.CamlineSubIdForImportDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@@ -26,4 +28,8 @@ public interface CamlineMapper {
CamlineExtendArgDTO getExtendArgFromCamline(@Param("subId") String subId);
Integer getTodayBoxNum();
CamlineSubIdDTO getSubIdByCamline(@Param("subId") String subId);
List<CamlineSubIdForImportDTO> getSubIdByCamlineForImpoet();
}

View File

@@ -6,6 +6,7 @@ import com.cnbm.packing.entity.ChangePackagingBoxHistory;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
/**
* 包装箱拆合箱历史表
@@ -16,6 +17,6 @@ import java.util.List;
@Mapper
public interface ChangePackagingBoxHistoryMapper extends BaseDao<ChangePackagingBoxHistory> {
List<ChangePackagingBoxHistoryDTO> list();
List<ChangePackagingBoxHistoryDTO> list(Map<String, Object> params);
}

View File

@@ -1,10 +1,21 @@
package com.cnbm.packing.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cnbm.packing.dto.PowerReportDTO;
import com.cnbm.packing.dto.WoPackagingBoxSubstrateDTO;
import com.cnbm.packing.param.PowerReportQueryParam;
import com.cnbm.packing.param.SubIdQueryParam;
import com.cnbm.packing.vo.SubIdPageVo;
import org.apache.ibatis.annotations.Param;
import com.cnbm.common.dao.BaseDao;
import com.cnbm.packing.entity.WoPackagingBoxSubstrate;
import org.apache.ibatis.annotations.Mapper;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
/**
* 包装箱基板关联表
*
@@ -15,5 +26,14 @@ import org.apache.ibatis.annotations.Mapper;
public interface WoPackagingBoxSubstrateMapper extends BaseDao<WoPackagingBoxSubstrate> {
WoPackagingBoxSubstrate getOneByWoSubstrateId(@Param("woSubstrateId") String woSubstrateId);
int updatePackagingBoxIdByWoSubstrateId(@Param("packagingBoxId") String packagingBoxId, @Param("woSubstrateId") String woSubstrateId);
}
int updatePackagingBoxIdAndSlotByWoSubstrateId(@Param("packagingBoxId") String packagingBoxId, @Param("slot") Integer slot, @Param("woSubstrateId") String woSubstrateId);
List<PowerReportDTO> powerReport(@Param("queryParam") PowerReportQueryParam queryParam);
List<String> orderNameList();
List<WoPackagingBoxSubstrateDTO> substrateList(Map<String, Object> params);
List<WoPackagingBoxSubstrateDTO> substrateList(@Param("woSubstrateId") String woSubstrateId);
IPage<SubIdPageVo> subIdPage(Page<?> page, @Param("param") SubIdQueryParam param);
}

View File

@@ -0,0 +1,22 @@
package com.cnbm.packing.param;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.time.LocalDateTime;
/**
* @Desc: ""
* @Author: caixiang
* @DATE: 2023/2/15 19:05
*/
@Data
public class PowerReportQueryParam {
//@JsonFormat(shape=JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime begin;
//@JsonFormat(shape= JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime end;
private String orderName;
private Integer model;
}

View File

@@ -0,0 +1,15 @@
package com.cnbm.packing.param;
import com.cnbm.packing.vo.BasePageParam;
import lombok.Data;
/**
* @Desc: ""
* @Author: caixiang
* @DATE: 2023/2/15 19:05
*/
@Data
public class SubIdQueryParam extends BasePageParam {
private String boxNo;
}

View File

@@ -3,9 +3,9 @@ package com.cnbm.packing.service;
import com.cnbm.common.page.PageData;
import com.cnbm.common.service.CrudService;
import com.cnbm.packing.dto.ChangePackagingBoxHistoryDTO;
import com.cnbm.packing.dto.ChangePackagingBoxHistoryDTO;
import com.cnbm.packing.entity.ChangePackagingBoxHistory;
import java.util.List;
import java.util.Map;
/**
@@ -25,5 +25,9 @@ public interface ChangePackagingBoxHistoryServiceBiz extends CrudService<ChangeP
void update(ChangePackagingBoxHistoryDTO dto);
void delete(Long[] ids);
List<ChangePackagingBoxHistoryDTO> list(Map<String, Object> params);
List<ChangePackagingBoxHistory> historyList(Map<String, Object> params);
}

View File

@@ -2,6 +2,8 @@ package com.cnbm.packing.service;
import com.cnbm.dynamic.datasource.annotation.DataSource;
import com.cnbm.packing.dto.CamlineExtendArgDTO;
import com.cnbm.packing.dto.CamlineSubIdDTO;
import com.cnbm.packing.dto.CamlineSubIdForImportDTO;
import com.cnbm.packing.dto.WoPowerLevelDTO;
import com.cnbm.packing.mapper.CamlineMapper;
@@ -41,10 +43,22 @@ public class DynamicDataSourceService {
return mapper.getOrderNameBySubId(subId);
}
@DataSource("camline")
@Transactional
public CamlineSubIdDTO getSubIdByCamline(String subId){
return mapper.getSubIdByCamline(subId);
}
@DataSource("camline")
@Transactional
public CamlineExtendArgDTO getExtendArgFromCamline(String subId){
return mapper.getExtendArgFromCamline(subId);
}
@DataSource("camline")
@Transactional
public List<CamlineSubIdForImportDTO> getAlllCamlineSubForImp(){
return mapper.getSubIdByCamlineForImpoet();
}
}

View File

@@ -3,7 +3,6 @@ package com.cnbm.packing.service;
import com.cnbm.common.page.PageData;
import com.cnbm.common.service.CrudService;
import com.cnbm.packing.dto.PrintModelDTO;
import com.cnbm.packing.dto.PrintModelDTO;
import com.cnbm.packing.entity.PrintModel;
import java.util.List;

View File

@@ -2,7 +2,6 @@ package com.cnbm.packing.service;
import com.cnbm.common.page.PageData;
import com.cnbm.common.service.CrudService;
import com.cnbm.packing.dto.CompensationPowerXSDTO;
import com.cnbm.packing.dto.WoCompensationPowerDTO;
import com.cnbm.packing.entity.WoCompensationPower;

View File

@@ -1,11 +1,21 @@
package com.cnbm.packing.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cnbm.common.page.PageData;
import com.cnbm.common.service.CrudService;
import com.cnbm.packing.dto.IdVo;
import com.cnbm.packing.dto.PowerReportDTO;
import com.cnbm.packing.dto.WoPackagingBoxDTO;
import com.cnbm.packing.entity.WoPackagingBox;
import com.cnbm.packing.entity.WoPackagingBoxSubstrate;
import com.cnbm.packing.param.PowerReportQueryParam;
import com.cnbm.packing.param.SubIdQueryParam;
import com.cnbm.packing.vo.R;
import com.cnbm.packing.vo.SubIdPageVo;
import org.apache.ibatis.annotations.Param;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
@@ -31,6 +41,19 @@ public interface WoPackagingBoxServiceBiz extends CrudService<WoPackagingBox, Wo
WoPackagingBoxDTO printList(Long id);
List<WoPackagingBoxSubstrate> substrateList (Map<String, Object> params);
List<WoPackagingBox> boxList (String woSubstrateId);
IdVo insertSubstrateManual(WoPackagingBoxDTO dto);
void editSubstrateManual(WoPackagingBoxDTO dto);
int updateIsArrivedByBoxNo(Integer isArrived, String boxNo);
List<PowerReportDTO> powerReport(PowerReportQueryParam queryParam);
List<String> orderNameList();
R<IPage<SubIdPageVo>> subIdPage(SubIdQueryParam param);
}

View File

@@ -6,6 +6,7 @@ import com.cnbm.packing.dto.ChangePackingBoxDTO;
import com.cnbm.packing.dto.WoPackagingBoxSubstrateDTO;
import com.cnbm.packing.entity.WoPackagingBoxSubstrate;
import java.util.List;
import java.util.Map;
/**
@@ -32,8 +33,14 @@ public interface WoPackagingBoxSubstrateServiceBiz extends CrudService<WoPackagi
void replaceSubstrate(ChangePackingBoxDTO[] dtos);
void insertSubstrateManual(ChangePackingBoxDTO dto);
void insertSubstrateManual(ChangePackingBoxDTO[] dtos);
void updateSubstrateManual(ChangePackingBoxDTO[] dtos);
WoPackagingBoxSubstrate getBySubId(String subId);
int updatePackagingBoxIdByWoSubstrateId(String packagingBoxId,String woSubstrateId);
List<WoPackagingBoxSubstrateDTO> substrateList (Map<String, Object> params);
int updatePackagingBoxIdAndSlotByWoSubstrateId(String packagingBoxId,Integer slot,String woSubstrateId);
}

View File

@@ -3,22 +3,22 @@ package com.cnbm.packing.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.cnbm.admin.utils.BaseSupportUtils;
import com.cnbm.common.page.PageData;
import com.cnbm.common.service.impl.CrudServiceImpl;
import com.cnbm.common.utils.ConvertUtils;
import com.cnbm.packing.dto.ChangePackagingBoxHistoryDTO;
import com.cnbm.packing.dto.ChangePackagingBoxHistoryDTO;
import com.cnbm.packing.entity.ChangePackagingBoxHistory;
import com.cnbm.packing.entity.ChangePackagingBoxHistory;
import com.cnbm.packing.entity.WoPowerLevel;
import com.cnbm.packing.mapper.ChangePackagingBoxHistoryMapper;
import com.cnbm.packing.service.ChangePackagingBoxHistoryServiceBiz;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
@@ -30,18 +30,28 @@ import java.util.Map;
@Service
public class ChangePackagingBoxHistoryServiceBizImpl extends CrudServiceImpl<ChangePackagingBoxHistoryMapper, ChangePackagingBoxHistory, ChangePackagingBoxHistoryDTO> implements ChangePackagingBoxHistoryServiceBiz {
@Autowired
private ChangePackagingBoxHistoryMapper mapper;
@Override
public QueryWrapper<ChangePackagingBoxHistory> getWrapper(Map<String, Object> params){
LocalDateTime startTime = (LocalDateTime) params.get("startTime");
LocalDateTime endTime = (LocalDateTime) params.get("endTime");
QueryWrapper<ChangePackagingBoxHistory> wrapper = new QueryWrapper<>();
wrapper.between(startTime!=null && endTime!=null,ChangePackagingBoxHistory.INPUT_TIME, startTime, endTime);
wrapper.between(startTime!=null && endTime!=null,ChangePackagingBoxHistory.LEAVE_TIME, startTime, endTime);
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
if(params.get("startTime")!=null && params.get("endTime")!=null){
LocalDateTime startTime = LocalDateTime.parse(params.get("startTime").toString(),df);
LocalDateTime endTime = LocalDateTime.parse(params.get("endTime").toString(),df);
wrapper.between(startTime!=null && endTime!=null,ChangePackagingBoxHistory.CREATE_TIME, startTime, endTime);
}
if(params.get("type")!=null) {
Integer type = Integer.parseInt( params.get("type").toString());
wrapper.eq(ObjectUtils.isNotNull(type), ChangePackagingBoxHistory.TYPE, type);
}
if(params.get("startTime")==null && params.get("endTime")==null && params.get("type")==null){
wrapper.apply(true, "TO_DAYS(NOW())-TO_DAYS(create_time) = 0");
}
wrapper.orderByDesc(ChangePackagingBoxHistory.CREATE_TIME);
return wrapper;
}
@@ -49,8 +59,8 @@ public class ChangePackagingBoxHistoryServiceBizImpl extends CrudServiceImpl<Cha
@Override
public PageData<ChangePackagingBoxHistoryDTO> page (Map<String, Object> params){
IPage<ChangePackagingBoxHistory> page = baseDao.selectPage(
getPage(params, ChangePackagingBoxHistory.CREATE_TIME, true),
getWrapper(params)
getPage(params, ChangePackagingBoxHistory.CREATE_TIME, false),
getWrapper(params)
);
return getPageData(page, ChangePackagingBoxHistoryDTO.class);
}
@@ -65,6 +75,7 @@ public class ChangePackagingBoxHistoryServiceBizImpl extends CrudServiceImpl<Cha
@Transactional(rollbackFor = Exception.class)
public void save(ChangePackagingBoxHistoryDTO dto) {
ChangePackagingBoxHistory entity = ConvertUtils.sourceToTarget(dto, ChangePackagingBoxHistory.class);
BaseSupportUtils.setCommonField(entity);
insert(entity);
}
@@ -72,6 +83,7 @@ public class ChangePackagingBoxHistoryServiceBizImpl extends CrudServiceImpl<Cha
@Transactional(rollbackFor = Exception.class)
public void update(ChangePackagingBoxHistoryDTO dto) {
ChangePackagingBoxHistory entity = ConvertUtils.sourceToTarget(dto, ChangePackagingBoxHistory.class);
BaseSupportUtils.setUpdateCommonField(entity);
updateById(entity);
}
@@ -82,4 +94,19 @@ public class ChangePackagingBoxHistoryServiceBizImpl extends CrudServiceImpl<Cha
deleteBatchIds(Arrays.asList(ids));
}
@Override
@Transactional(rollbackFor = Exception.class)
public List<ChangePackagingBoxHistoryDTO> list(Map<String, Object> params) {
List<ChangePackagingBoxHistoryDTO> list = mapper.list(params);
return list;
}
@Override
@Transactional(rollbackFor = Exception.class)
public List<ChangePackagingBoxHistory> historyList(Map<String, Object> params) {
QueryWrapper<ChangePackagingBoxHistory> wrapper = getWrapper(params);
List<ChangePackagingBoxHistory> historyList = mapper.selectList(wrapper);
return historyList;
}
}

View File

@@ -3,6 +3,7 @@ package com.cnbm.packing.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.cnbm.admin.utils.BaseSupportUtils;
import com.cnbm.admin.utils.CodeGeneratorHelper;
import com.cnbm.common.page.PageData;
import com.cnbm.common.service.impl.CrudServiceImpl;
@@ -46,6 +47,10 @@ public class PrintModelServiceBizImpl extends CrudServiceImpl<PrintModelMapper,
Integer lineBody = Integer.parseInt(params.get("lineBody").toString());
wrapper.eq(ObjectUtils.isNotNull(lineBody), PrintModel.LINE_BODY, lineBody);
}
if(params.get("isEnable")!=null) {
Integer isEnable = Integer.parseInt(params.get("isEnable").toString());
wrapper.eq(ObjectUtils.isNotNull(isEnable), PrintModel.IS_ENABLE, isEnable);
}
return wrapper;
}
@@ -53,7 +58,7 @@ public class PrintModelServiceBizImpl extends CrudServiceImpl<PrintModelMapper,
@Override
public PageData<PrintModelDTO> page (Map<String, Object> params){
IPage<PrintModel> page = baseDao.selectPage(
getPage(params, PrintModel.ID, true),
getPage(params, PrintModel.CREATE_TIME, false),
getWrapper(params)
);
return getPageData(page, PrintModelDTO.class);
@@ -69,6 +74,7 @@ public class PrintModelServiceBizImpl extends CrudServiceImpl<PrintModelMapper,
@Transactional(rollbackFor = Exception.class)
public void save(PrintModelDTO dto) {
PrintModel entity = ConvertUtils.sourceToTarget(dto, PrintModel.class);
BaseSupportUtils.setCommonField(entity);
insert(entity);
}
@@ -76,6 +82,7 @@ public class PrintModelServiceBizImpl extends CrudServiceImpl<PrintModelMapper,
@Transactional(rollbackFor = Exception.class)
public void update(PrintModelDTO dto) {
PrintModel entity = ConvertUtils.sourceToTarget(dto, PrintModel.class);
BaseSupportUtils.setUpdateCommonField(entity);
updateById(entity);
}

View File

@@ -3,18 +3,16 @@ package com.cnbm.packing.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.cnbm.admin.utils.BaseSupportUtils;
import com.cnbm.common.page.PageData;
import com.cnbm.common.service.impl.CrudServiceImpl;
import com.cnbm.common.utils.ConvertUtils;
import com.cnbm.packing.dto.CompensationPowerXSDTO;
import com.cnbm.packing.dto.WoCompensationPowerDTO;
import com.cnbm.packing.entity.WoCompensationPower;
import com.cnbm.packing.entity.WoPowerLevel;
import com.cnbm.packing.mapper.WoCompensationPowerMapper;
import com.cnbm.packing.param.CompensationQueryParam;
import com.cnbm.packing.service.WoCompensationPowerServiceBiz;
import lombok.var;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -50,7 +48,7 @@ public class WoCompensationPowerServiceBizImpl extends CrudServiceImpl<WoCompens
@Override
public PageData<WoCompensationPowerDTO> page (Map<String, Object> params){
IPage<WoCompensationPower> page = baseDao.selectPage(
getPage(params, WoCompensationPower.ID, true),
getPage(params, WoCompensationPower.CREATE_TIME, false),
getWrapper(params)
);
return getPageData(page, WoCompensationPowerDTO.class);
@@ -66,6 +64,7 @@ public class WoCompensationPowerServiceBizImpl extends CrudServiceImpl<WoCompens
@Transactional(rollbackFor = Exception.class)
public void save(WoCompensationPowerDTO dto) {
WoCompensationPower entity = ConvertUtils.sourceToTarget(dto, WoCompensationPower.class);
BaseSupportUtils.setCommonField(entity);
insert(entity);
}
@@ -73,6 +72,7 @@ public class WoCompensationPowerServiceBizImpl extends CrudServiceImpl<WoCompens
@Transactional(rollbackFor = Exception.class)
public void update(WoCompensationPowerDTO dto) {
WoCompensationPower entity = ConvertUtils.sourceToTarget(dto, WoCompensationPower.class);
BaseSupportUtils.setUpdateCommonField(entity);
updateById(entity);
}
@@ -98,8 +98,11 @@ public class WoCompensationPowerServiceBizImpl extends CrudServiceImpl<WoCompens
CompensationPowerXSDTO conffBySubIdAndLineBody = mapper.getConffBySubIdAndLineBody(compensationQueryParam);
float res = pmpp*conffBySubIdAndLineBody.getA()+conffBySubIdAndLineBody.getB();
return res;
if(conffBySubIdAndLineBody!=null){
return pmpp*conffBySubIdAndLineBody.getA()+conffBySubIdAndLineBody.getB();
}else {
return pmpp;
}
}

View File

@@ -3,22 +3,32 @@ package com.cnbm.packing.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cnbm.admin.utils.BaseSupportUtils;
import com.cnbm.common.page.PageData;
import com.cnbm.common.service.impl.CrudServiceImpl;
import com.cnbm.common.utils.ConvertUtils;
import com.cnbm.packing.dto.IdVo;
import com.cnbm.packing.dto.PowerReportDTO;
import com.cnbm.packing.dto.WoPackagingBoxDTO;
import com.cnbm.packing.entity.WoPackagingBox;
import com.cnbm.packing.entity.WoPackagingBoxSubstrate;
import com.cnbm.packing.mapper.WoPackagingBoxMapper;
import com.cnbm.packing.mapper.WoPackagingBoxSubstrateMapper;
import com.cnbm.packing.param.PowerReportQueryParam;
import com.cnbm.packing.param.SubIdQueryParam;
import com.cnbm.packing.service.WoPackagingBoxServiceBiz;
import com.cnbm.packing.service.WoPackagingBoxSubstrateServiceBiz;
import com.cnbm.packing.vo.R;
import com.cnbm.packing.vo.SubIdPageVo;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@@ -36,28 +46,44 @@ public class WoPackagingBoxServiceBizImpl extends CrudServiceImpl<WoPackagingBox
private WoPackagingBoxMapper mapper;
@Autowired
private WoPackagingBoxSubstrateMapper substrateMapper;
@Autowired
private WoPackagingBoxSubstrateServiceBiz woPackagingBoxSubstrateServiceBiz;
public static void main(String[] args) {
LocalDateTime localDate=LocalDateTime.parse("2023-03-23 09:00:00", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
System.out.println(localDate);
}
@Override
public QueryWrapper<WoPackagingBox> getWrapper(Map<String, Object> params){
LocalDateTime startTime = (LocalDateTime) params.get("startTime");
LocalDateTime endTime = (LocalDateTime) params.get("endTime");
String boxNo = (String) params.get("boxNo");
QueryWrapper<WoPackagingBox> wrapper = new QueryWrapper<>();
wrapper.between(startTime!=null && endTime!=null,WoPackagingBox.PACKAGING_TIME, startTime, endTime);
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
if(params.get("startTime")!=null && params.get("endTime")!=null){
LocalDateTime startTime = LocalDateTime.parse(params.get("startTime").toString(),df);
LocalDateTime endTime = LocalDateTime.parse(params.get("endTime").toString(),df);
wrapper.between(startTime!=null && endTime!=null, WoPackagingBox.CREATE_TIME, startTime, endTime);
}
String boxNo = (String) params.get("boxNo");
wrapper.like(StringUtils.isNotBlank(boxNo), WoPackagingBox.BOX_NO, boxNo);
if(params.get("lineBody")!=null) {
Integer lineBody = Integer.parseInt(params.get("lineBody").toString());
wrapper.eq(ObjectUtils.isNotNull(lineBody), WoPackagingBox.LINE_BODY, lineBody);
}
if(params.get("printStatus")!=null) {
Integer printStatus = Integer.parseInt(params.get("printStatus").toString());
wrapper.eq(ObjectUtils.isNotNull(printStatus), WoPackagingBox.PRINT_STATUS, printStatus);
}
// if(params.get("lineBody")!=null) {
// Integer lineBody = Integer.parseInt(params.get("lineBody").toString());
// wrapper.eq(ObjectUtils.isNotNull(lineBody), WoPackagingBox.LINE_BODY, lineBody);
// }
// if(params.get("printStatus")!=null) {
// Integer printStatus = Integer.parseInt(params.get("printStatus").toString());
// wrapper.eq(ObjectUtils.isNotNull(printStatus), WoPackagingBox.PRINT_STATUS, printStatus);
// }
if(params.get("model")!=null) {
Integer model = Integer.parseInt(params.get("model").toString());
wrapper.eq(ObjectUtils.isNotNull(model), WoPackagingBox.MODEL, model);
}
if(params.get("startTime")==null && params.get("endTime")==null && params.get("boxNo")==null){
wrapper.apply(true, "TO_DAYS(NOW())-TO_DAYS(create_time) = 0");
}
return wrapper;
}
@@ -82,6 +108,7 @@ public class WoPackagingBoxServiceBizImpl extends CrudServiceImpl<WoPackagingBox
@Transactional(rollbackFor = Exception.class)
public IdVo add(WoPackagingBoxDTO dto) {
WoPackagingBox entity = ConvertUtils.sourceToTarget(dto, WoPackagingBox.class);
BaseSupportUtils.setCommonField(entity);
insert(entity);
return IdVo.builder().id(entity.getId()).build();
}
@@ -90,6 +117,7 @@ public class WoPackagingBoxServiceBizImpl extends CrudServiceImpl<WoPackagingBox
@Transactional(rollbackFor = Exception.class)
public void update(WoPackagingBoxDTO dto) {
WoPackagingBox entity = ConvertUtils.sourceToTarget(dto, WoPackagingBox.class);
BaseSupportUtils.setUpdateCommonField(entity);
updateById(entity);
}
@@ -114,13 +142,111 @@ public class WoPackagingBoxServiceBizImpl extends CrudServiceImpl<WoPackagingBox
WoPackagingBoxDTO dto = ConvertUtils.sourceToTarget(entity, WoPackagingBoxDTO.class);
QueryWrapper<WoPackagingBoxSubstrate> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(entity.getBoxNo()), WoPackagingBoxSubstrate.PACKAGING_BOX_ID, entity.getBoxNo());
wrapper.orderByDesc(WoPackagingBoxSubstrate.CREATE_TIME);
List<WoPackagingBoxSubstrate> woPackagingBoxSubstrateList = substrateMapper.selectList(wrapper);
dto.setSubstrateList(woPackagingBoxSubstrateList);
return dto;
}
@Override
public List<WoPackagingBoxSubstrate> substrateList(Map<String, Object> params) {
QueryWrapper<WoPackagingBox> boxQueryWrapper = getWrapper(params);
List<WoPackagingBox> boxList = mapper.selectList(boxQueryWrapper);
List<WoPackagingBoxSubstrate> substrateList = new ArrayList<>();
for(WoPackagingBox box: boxList){
QueryWrapper<WoPackagingBoxSubstrate> substrateQueryWrapper = new QueryWrapper<>();
substrateQueryWrapper.eq(StringUtils.isNotBlank(box.getBoxNo()), WoPackagingBoxSubstrate.PACKAGING_BOX_ID, box.getBoxNo());
List<WoPackagingBoxSubstrate> woPackagingBoxSubstrateList = substrateMapper.selectList(substrateQueryWrapper);
substrateList.addAll(woPackagingBoxSubstrateList);
}
return substrateList;
}
@Override
public List<WoPackagingBox> boxList(String woSubstrateId) {
QueryWrapper<WoPackagingBoxSubstrate> substrateQueryWrapper = new QueryWrapper<>();
substrateQueryWrapper.eq(StringUtils.isNotBlank(woSubstrateId), WoPackagingBoxSubstrate.WO_SUBSTRATE_ID, woSubstrateId);
List<WoPackagingBoxSubstrate> substrateList = substrateMapper.selectList(substrateQueryWrapper);
List<WoPackagingBox> boxList = new ArrayList<>();
for(WoPackagingBoxSubstrate substrate: substrateList){
QueryWrapper<WoPackagingBox> boxQueryWrapper = new QueryWrapper<>();
boxQueryWrapper.like(StringUtils.isNotBlank(substrate.getPackagingBoxId()), WoPackagingBox.BOX_NO, substrate.getPackagingBoxId());
List<WoPackagingBox> woPackagingBoxList = mapper.selectList(boxQueryWrapper);
boxList.addAll(woPackagingBoxList);
}
return boxList;
}
@Override
@Transactional(rollbackFor = Exception.class)
public IdVo insertSubstrateManual(WoPackagingBoxDTO dto) {
//新增包装箱
WoPackagingBox box = ConvertUtils.sourceToTarget(dto, WoPackagingBox.class);
BaseSupportUtils.setCommonField(box);
insert(box);
//新增模组
List<WoPackagingBoxSubstrate> substrateList = dto.getSubstrateList();
for(WoPackagingBoxSubstrate substrate : substrateList){
//判断模组id是否非空
if(!StringUtils.isBlank(substrate.getWoSubstrateId())) {
substrate.setPackagingBoxId(box.getBoxNo());
substrate.setPowerLevel(box.getPowerLevel());
substrate.setSapMaterial(box.getSapMaterial());
substrate.setLineBody(box.getLineBody());
BaseSupportUtils.setCommonField(substrate);
woPackagingBoxSubstrateServiceBiz.insert(substrate);
}
}
return IdVo.builder().id(box.getId()).build();
}
@Override
@Transactional(rollbackFor = Exception.class)
public void editSubstrateManual(WoPackagingBoxDTO dto) {
//获取模组
List<WoPackagingBoxSubstrate> substrateList = dto.getSubstrateList();
for(WoPackagingBoxSubstrate substrate : substrateList){
//新增id为空 模组非空
if(ObjectUtils.isEmpty(substrate.getId()) && StringUtils.isNotBlank(substrate.getWoSubstrateId())) {
substrate.setPackagingBoxId(dto.getBoxNo());
substrate.setPowerLevel(dto.getPowerLevel());
substrate.setSapMaterial(dto.getSapMaterial());
substrate.setLineBody(dto.getLineBody());
BaseSupportUtils.setCommonField(substrate);
woPackagingBoxSubstrateServiceBiz.insert(substrate);
}
//编辑id非空 模组非空
if(ObjectUtils.isNotEmpty(substrate.getId()) && StringUtils.isNotBlank(substrate.getWoSubstrateId())) {
BaseSupportUtils.setUpdateCommonField(substrate);
woPackagingBoxSubstrateServiceBiz.updateById(substrate);
}
//删除id非空 模组为空
if(ObjectUtils.isNotEmpty(substrate.getId()) && StringUtils.isBlank(substrate.getWoSubstrateId())) {
woPackagingBoxSubstrateServiceBiz.deleteById(substrate.getId());
}
}
}
@Override
public int updateIsArrivedByBoxNo(Integer isArrived, String boxNo) {
return mapper.updateIsArrivedByBoxNo(isArrived,boxNo);
}
@Override
public List<PowerReportDTO> powerReport(PowerReportQueryParam queryParam) {
return substrateMapper.powerReport(queryParam);
}
@Override
public List<String> orderNameList() {
return substrateMapper.orderNameList();
}
@Override
public R<IPage<SubIdPageVo>> subIdPage(SubIdQueryParam param) {
IPage<SubIdPageVo> iPage = substrateMapper.subIdPage(
new Page<>(param.getCurrent(), param.getSize()),
param);
return R.ok(iPage);
}
}

View File

@@ -3,6 +3,7 @@ package com.cnbm.packing.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.cnbm.admin.utils.BaseSupportUtils;
import com.cnbm.common.page.PageData;
import com.cnbm.common.service.impl.CrudServiceImpl;
import com.cnbm.common.utils.ConvertUtils;
@@ -13,19 +14,17 @@ import com.cnbm.packing.dto.ChangePackingBoxDTO;
import com.cnbm.packing.dto.WoPackagingBoxSubstrateDTO;
import com.cnbm.packing.entity.ChangePackagingBoxHistory;
import com.cnbm.packing.entity.WoPackagingBoxSubstrate;
import com.cnbm.packing.mapper.WoPackagingBoxMapper;
import com.cnbm.packing.mapper.WoPackagingBoxSubstrateMapper;
import com.cnbm.packing.service.ChangePackagingBoxHistoryServiceBiz;
import com.cnbm.packing.service.WoPackagingBoxSubstrateServiceBiz;
import org.apache.commons.lang3.StringUtils;
import org.omg.CORBA.PRIVATE_MEMBER;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
@@ -59,7 +58,7 @@ public class WoPackagingBoxSubstrateServiceBizImpl extends CrudServiceImpl<WoPac
@Override
public PageData<WoPackagingBoxSubstrateDTO> page (Map<String, Object> params){
IPage<WoPackagingBoxSubstrate> page = baseDao.selectPage(
getPage(params, WoPackagingBoxSubstrate.SLOT, true),
getPage(params, WoPackagingBoxSubstrate.CREATE_TIME, false),
getWrapper(params)
);
return getPageData(page, WoPackagingBoxSubstrateDTO.class);
@@ -75,6 +74,7 @@ public class WoPackagingBoxSubstrateServiceBizImpl extends CrudServiceImpl<WoPac
@Transactional(rollbackFor = Exception.class)
public void save(WoPackagingBoxSubstrateDTO dto) {
WoPackagingBoxSubstrate entity = ConvertUtils.sourceToTarget(dto, WoPackagingBoxSubstrate.class);
BaseSupportUtils.setCommonField(entity);
insert(entity);
}
@@ -82,6 +82,7 @@ public class WoPackagingBoxSubstrateServiceBizImpl extends CrudServiceImpl<WoPac
@Transactional(rollbackFor = Exception.class)
public void update(WoPackagingBoxSubstrateDTO dto) {
WoPackagingBoxSubstrate entity = ConvertUtils.sourceToTarget(dto, WoPackagingBoxSubstrate.class);
BaseSupportUtils.setUpdateCommonField(entity);
updateById(entity);
}
@@ -103,6 +104,7 @@ public class WoPackagingBoxSubstrateServiceBizImpl extends CrudServiceImpl<WoPac
changePackagingBoxHistory.setSourceSlot(entity.getSlot());
changePackagingBoxHistory.setLeaveTime(LocalDateTime.now());
changePackagingBoxHistory.setType(2);
BaseSupportUtils.setCommonField(changePackagingBoxHistory);
changePackagingBoxHistoryService.insert(changePackagingBoxHistory);
//模组从该包装箱中移出该模组变为未绑定BoxID的模组
UpdateWrapper<WoPackagingBoxSubstrate> wrapper = new UpdateWrapper<>();
@@ -126,10 +128,12 @@ public class WoPackagingBoxSubstrateServiceBizImpl extends CrudServiceImpl<WoPac
changePackagingBoxHistory.setTargetSlot(dto.getSlot());
changePackagingBoxHistory.setInputTime(LocalDateTime.now());
changePackagingBoxHistory.setType(1);
BaseSupportUtils.setCommonField(changePackagingBoxHistory);
changePackagingBoxHistoryService.insert(changePackagingBoxHistory);
//更新
entity.setPackagingBoxId(dto.getPackagingBoxId());
entity.setSlot(dto.getSlot());
BaseSupportUtils.setUpdateCommonField(entity);
updateById(entity);
}
@@ -146,44 +150,74 @@ public class WoPackagingBoxSubstrateServiceBizImpl extends CrudServiceImpl<WoPac
changePackagingBoxHistory.setTargetBoxNo(dto.getPackagingBoxId());
changePackagingBoxHistory.setTargetSlot(dto.getSlot());
changePackagingBoxHistory.setType(3);
BaseSupportUtils.setCommonField(changePackagingBoxHistory);
changePackagingBoxHistoryService.insert(changePackagingBoxHistory);
//更新
entity.setPackagingBoxId(dto.getPackagingBoxId());
entity.setSlot(dto.getSlot());
BaseSupportUtils.setUpdateCommonField(entity);
updateById(entity);
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void insertSubstrateManual(ChangePackingBoxDTO dto) {
QueryWrapper<WoPackagingBoxSubstrate> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(dto.getWoSubstrateId()),WoPackagingBoxSubstrate.WO_SUBSTRATE_ID,dto.getWoSubstrateId());
if(mapper.selectCount(wrapper)>0 && StringUtils.isNotBlank(dto.getWoSubstrateId())) {
WoPackagingBoxSubstrate substrate = mapper.selectList(wrapper).get(0);
substrate.setPackagingBoxId(dto.getPackagingBoxId());
updateById(substrate);
}
else{
//模组ID有时为空用户会输入”无码“
if(dto.getWoSubstrateId()==null) {
dto.setWoSubstrateId("无码");
}
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
public void insertSubstrateManual(ChangePackingBoxDTO[] dtos) {
for(ChangePackingBoxDTO dto : dtos) {
// QueryWrapper<WoPackagingBoxSubstrate> wrapper = new QueryWrapper<>();
// wrapper.eq(StringUtils.isNotBlank(dto.getWoSubstrateId()), WoPackagingBoxSubstrate.WO_SUBSTRATE_ID, dto.getWoSubstrateId());
WoPackagingBoxSubstrate entity = ConvertUtils.sourceToTarget(dto, WoPackagingBoxSubstrate.class);
BaseSupportUtils.setCommonField(entity);
insert(entity);
/*
if (mapper.selectCount(wrapper) > 0 && StringUtils.isNotBlank(dto.getWoSubstrateId())) {
WoPackagingBoxSubstrate substrate = mapper.selectList(wrapper).get(0);
substrate.setPackagingBoxId(dto.getPackagingBoxId());
BaseSupportUtils.setUpdateCommonField(substrate);
updateById(substrate);
} else {
//模组ID有时为空用户会输入”无码“
if (dto.getWoSubstrateId() == null) {
dto.setWoSubstrateId("无码");
}
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
WoPackagingBoxSubstrate entity = ConvertUtils.sourceToTarget(dto, WoPackagingBoxSubstrate.class);
BaseSupportUtils.setCommonField(entity);
insert(entity);
}
*/
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void updateSubstrateManual(ChangePackingBoxDTO[] dtos) {
for(ChangePackingBoxDTO dto : dtos) {
//判断模组id是否非空
if(StringUtils.isBlank(dto.getWoSubstrateId())) {
deleteById(dto.getId());
}
else {
WoPackagingBoxSubstrate entity = ConvertUtils.sourceToTarget(dto, WoPackagingBoxSubstrate.class);
BaseSupportUtils.setUpdateCommonField(entity);
updateById(entity);
}
}
}
@Override
public List<WoPackagingBoxSubstrateDTO> substrateList(Map<String, Object> params) {
return mapper.substrateList(params);
}
@Override
public WoPackagingBoxSubstrate getBySubId(String subId) {
return mapper.getOneByWoSubstrateId(subId);
}
@Override
public int updatePackagingBoxIdByWoSubstrateId(String packagingBoxId, String woSubstrateId) {
return mapper.updatePackagingBoxIdByWoSubstrateId(packagingBoxId,woSubstrateId);
public int updatePackagingBoxIdAndSlotByWoSubstrateId(String packagingBoxId, Integer slot , String woSubstrateId) {
return mapper.updatePackagingBoxIdAndSlotByWoSubstrateId(packagingBoxId,slot,woSubstrateId);
}
}

View File

@@ -2,21 +2,13 @@ package com.cnbm.packing.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.cnbm.admin.enums.WhetherEnum;
import com.cnbm.admin.utils.BaseSupportUtils;
import com.cnbm.common.page.PageData;
import com.cnbm.common.service.impl.CrudServiceImpl;
import com.cnbm.common.utils.ConvertUtils;
import com.cnbm.common.validator.ValidatorUtils;
import com.cnbm.common.validator.group.AddGroup;
import com.cnbm.common.validator.group.DefaultGroup;
import com.cnbm.packing.dto.WoPackagingBoxDTO;
import com.cnbm.packing.dto.WoPackagingPrintHistoryDTO;
import com.cnbm.packing.dto.WoPackagingPrintHistoryDTO;
import com.cnbm.packing.entity.WoPackagingBox;
import com.cnbm.packing.entity.WoPackagingPrintHistory;
import com.cnbm.packing.entity.WoPackagingPrintHistory;
import com.cnbm.packing.mapper.WoPackagingPrintHistoryMapper;
import com.cnbm.packing.mapper.WoPackagingPrintHistoryMapper;
import com.cnbm.packing.service.WoPackagingBoxServiceBiz;
import com.cnbm.packing.service.WoPackagingPrintHistoryServiceBiz;
@@ -27,6 +19,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@@ -48,12 +41,16 @@ public class WoPackagingPrintHistoryServiceBizImpl extends CrudServiceImpl<WoPac
@Override
public QueryWrapper<WoPackagingPrintHistory> getWrapper(Map<String, Object> params){
LocalDateTime startTime = (LocalDateTime) params.get("startTime");
LocalDateTime endTime = (LocalDateTime) params.get("endTime");
String boxNo = (String) params.get("boxNo");
QueryWrapper<WoPackagingPrintHistory> wrapper = new QueryWrapper<>();
wrapper.between(startTime!=null && endTime!=null, WoPackagingPrintHistory.PRINT_TIME, startTime, endTime);
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
if(params.get("startTime")!=null && params.get("endTime")!=null){
LocalDateTime startTime = LocalDateTime.parse(params.get("startTime").toString(),df);
LocalDateTime endTime = LocalDateTime.parse(params.get("endTime").toString(),df);
wrapper.between(startTime!=null && endTime!=null, WoPackagingPrintHistory.PRINT_TIME, startTime, endTime);
}
String boxNo = (String) params.get("boxNo");
wrapper.like(StringUtils.isNotBlank(boxNo), WoPackagingPrintHistory.BOX_NO, boxNo);
return wrapper;
@@ -78,6 +75,7 @@ public class WoPackagingPrintHistoryServiceBizImpl extends CrudServiceImpl<WoPac
@Transactional(rollbackFor = Exception.class)
public void save(WoPackagingPrintHistoryDTO dto) {
WoPackagingPrintHistory entity = ConvertUtils.sourceToTarget(dto, WoPackagingPrintHistory.class);
BaseSupportUtils.setCommonField(entity);
insert(entity);
}
@@ -85,6 +83,7 @@ public class WoPackagingPrintHistoryServiceBizImpl extends CrudServiceImpl<WoPac
@Transactional(rollbackFor = Exception.class)
public void update(WoPackagingPrintHistoryDTO dto) {
WoPackagingPrintHistory entity = ConvertUtils.sourceToTarget(dto, WoPackagingPrintHistory.class);
BaseSupportUtils.setUpdateCommonField(entity);
updateById(entity);
}
@@ -107,14 +106,20 @@ public class WoPackagingPrintHistoryServiceBizImpl extends CrudServiceImpl<WoPac
public void print(Long id) {
WoPackagingBoxDTO woPackagingBox = woPackagingBoxServiceBiz.get(id);
//新增包装箱打印记录
WoPackagingPrintHistory woPackagingPrintHistory = new WoPackagingPrintHistory();
BeanUtils.copyProperties(woPackagingBox, woPackagingPrintHistory);
woPackagingPrintHistory.setId(null);
woPackagingPrintHistory.setPrintTime(LocalDateTime.now());
// BeanUtils.copyProperties(woPackagingBox, woPackagingPrintHistory);
// woPackagingPrintHistory.setId(null);
woPackagingPrintHistory.setBoxNo(woPackagingBox.getBoxNo());
woPackagingPrintHistory.setPrintStatus(1);
woPackagingPrintHistory.setPrintCount(1);
LocalDateTime printTime = LocalDateTime.now();
woPackagingPrintHistory.setPrintTime(printTime);
BaseSupportUtils.setCommonField(woPackagingPrintHistory);
insert(woPackagingPrintHistory);
//更新包装箱表中打印状态和时间
woPackagingBox.setPrintTime(woPackagingPrintHistory.getPrintTime());
woPackagingBox.setPrintTime(printTime);
if(woPackagingBox.getPrintStatus()==0){
woPackagingBox.setPrintCount(1);
woPackagingBox.setPrintStatus(1);
@@ -122,6 +127,7 @@ public class WoPackagingPrintHistoryServiceBizImpl extends CrudServiceImpl<WoPac
else{
woPackagingBox.setPrintCount(woPackagingBox.getPrintCount()+1);
}
BaseSupportUtils.setUpdateCommonField(woPackagingBox);
woPackagingBoxServiceBiz.update(woPackagingBox);
}

View File

@@ -3,6 +3,7 @@ package com.cnbm.packing.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.cnbm.admin.utils.BaseSupportUtils;
import com.cnbm.common.page.PageData;
import com.cnbm.common.service.impl.CrudServiceImpl;
import com.cnbm.common.utils.ConvertUtils;
@@ -11,7 +12,6 @@ import com.cnbm.packing.entity.WoPowerLevel;
import com.cnbm.packing.mapper.WoPowerLevelMapper;
import com.cnbm.packing.param.CompensationQueryParam;
import com.cnbm.packing.service.WoPowerLevelServiceBiz;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -48,7 +48,7 @@ public class WoPowerLevelServiceBizImpl extends CrudServiceImpl<WoPowerLevelMapp
@Override
public PageData<WoPowerLevelDTO> page (Map<String, Object> params){
IPage<WoPowerLevel> page = baseDao.selectPage(
getPage(params, WoPowerLevel.ID, true),
getPage(params, WoPowerLevel.CREATE_TIME, false),
getWrapper(params)
);
return getPageData(page, WoPowerLevelDTO.class);
@@ -64,6 +64,7 @@ public class WoPowerLevelServiceBizImpl extends CrudServiceImpl<WoPowerLevelMapp
@Transactional(rollbackFor = Exception.class)
public void save(WoPowerLevelDTO dto) {
WoPowerLevel entity = ConvertUtils.sourceToTarget(dto, WoPowerLevel.class);
BaseSupportUtils.setCommonField(entity);
insert(entity);
}
@@ -71,6 +72,7 @@ public class WoPowerLevelServiceBizImpl extends CrudServiceImpl<WoPowerLevelMapp
@Transactional(rollbackFor = Exception.class)
public void update(WoPowerLevelDTO dto) {
WoPowerLevel entity = ConvertUtils.sourceToTarget(dto, WoPowerLevel.class);
BaseSupportUtils.setUpdateCommonField(entity);
updateById(entity);
}

View File

@@ -0,0 +1,105 @@
/*
* Copyright (c) 2018.
* http://www.ulabcare.com
*/
package com.cnbm.packing.vo;
/**
* REST API 错误码
*
* @author jiff
* @date 2018/11/1
* @since 1.0
*/
public enum ApiErrorCode implements IErrorCode {
/**
* 成功
*/
SUCCESSFUL(CODE_SUCCESSFUL, "成功"),
/**
* 失败
*/
FAILED(CODE_FAILED, "失败"),
/**
* 无效的请求参数
*/
//INVALID_PARAMETER(CODE_INVALID_PARAMETER, "无效的请求参数"),
INVALID_PARAMETER(CODE_INVALID_PARAMETER, "Invalid request parameter"),
/**
* 数据未授权
*/
FORBIDDEN_DATA(CODE_FORBIDDEN_DATA, "数据未授权"),
/**
* 用户已存在
*/
USER_EXISTENT(CODE_USER_EXISTENT, "用户已存在"),
/**
* 用户不存在
*/
//USER_NON_EXISTENT(CODE_USER_NON_EXISTENT, "用户不存在"),
USER_NON_EXISTENT(CODE_USER_NON_EXISTENT, "User does not exist"),
/**
* 用户已停用
*/
USER_DISABLED(CODE_FAILED, "用户已停用"),
/**
* 用户不存在或密码错误
*/
USER_NON_EXISTENT_OR_INVALID_PASSWORD(CODE_FAILED, "The user does not exist or the password is wrong"),
//USER_NON_EXISTENT_OR_INVALID_PASSWORD(CODE_FAILED, "用户不存在或密码错误"),
/**
* 密码错误
*/
//INVALID_PASSWORD(CODE_FAILED, "密码错误"),
INVALID_PASSWORD(CODE_FAILED, "Wrong password"),
/**
* 电话号码不能为空
*/
MOBILE_IS_EMPTY(CODE_FAILED, "手机号码不能为空"),
/**
* 用户未登录
*/
UNAUTHORIZED(CODE_UNAUTHORIZED, "用户未登录"),
/**
* 用户未授权
*/
FORBIDDEN(CODE_FORBIDDEN, "用户未授权");
private final int code;
private final String msg;
ApiErrorCode(final int code, final String msg) {
this.code = code;
this.msg = msg;
}
public static ApiErrorCode fromCode(int code) {
ApiErrorCode[] apiErrorCodes = ApiErrorCode.values();
for (ApiErrorCode apiErrorCode : apiErrorCodes) {
if (apiErrorCode.getCode() == code) {
return apiErrorCode;
}
}
return SUCCESSFUL;
}
@Override
public int getCode() {
return code;
}
@Override
public String getMsg() {
return msg;
}
@Override
public String toString() {
return String.format(" ErrorCode:{code=%s, msg=%s} ", code, msg);
}
}

View File

@@ -0,0 +1,33 @@
package com.cnbm.packing.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Range;
import javax.validation.constraints.NotNull;
/**
* 分页入参基础类
*
* @author Mr.ZhangShi
* @date 2018/11/6 11:03
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class BasePageParam extends BaseParam {
@ApiModelProperty(value = "当前页", required = true, example = "1")
@NotNull(message = "页码不能为空")
@Range(min = 1, message = "页码必须大于等于1")
private Integer current;
@ApiModelProperty(value = "每页显示条数", required = true, example = "10")
@NotNull(message = "每页显示条数不能为空")
@Range(min = 1, max = 1000, message = "每页显示条数范围需在1-1000之间")
private Integer size;
@ApiModelProperty(value = "启用状态", notes = "0 、停用1、启用", example = "1")
@Range(min = 0, max = 1, message = "启用状态只能为0或1")
private Integer enabled;
}

View File

@@ -0,0 +1,19 @@
/*
* Copyright (c) 2018.
* http://www.ulabcare.com
*/
package com.cnbm.packing.vo;
import java.io.Serializable;
/**
* 接口请求参数基类
*
* @author jiff
* @date 2018/11/1
* @since 1.0
*/
public class BaseParam implements Serializable {
}

View File

@@ -0,0 +1,63 @@
/*
* Copyright (c) 2018.
* http://www.ulabcare.com
*/
package com.cnbm.packing.vo;
/**
* api错误码定义
*
* @author jiff
* @date 2018/11/1
* @since 1.0
*/
public interface IErrorCode {
/**
* 成功
*/
int CODE_SUCCESSFUL = 0;
/**
* 失败
*/
int CODE_FAILED = 1;
/**
* 无效的请求参数
*/
int CODE_INVALID_PARAMETER = 2;
/**
* 数据未授权
*/
int CODE_FORBIDDEN_DATA = 9;
/**
* 用户已存在
*/
int CODE_USER_EXISTENT = 10;
/**
* 用户不存在
*/
int CODE_USER_NON_EXISTENT = 11;
/**
* 用户未登录
*/
int CODE_UNAUTHORIZED = 401;
/**
* 用户未授权
*/
int CODE_FORBIDDEN = 403;
/**
* 错误编码0、成功 否则失败
*
* @return 错误码0、成功 否则失败
*/
int getCode();
/**
* 错误描述
*
* @return 错误描述
*/
String getMsg();
}

View File

@@ -0,0 +1,20 @@
package com.cnbm.packing.vo;
import com.cnbm.packing.dto.PowerReportDTO;
import lombok.Data;
import java.util.List;
/**
* @Desc: ""
* @Author: caixiang
* @DATE: 2023/3/6 9:34
*/
@Data
public class PowerReportVo {
private Float totalLevelPower; //档位功率汇总
private Float totalCompensatePower; //补偿功率汇总
private Float diversePower; //差异功率汇总
private List<PowerReportDTO> powerReports;
}

View File

@@ -0,0 +1,102 @@
/*
* Copyright (c) 2018.
* http://www.ulabcare.com
*/
package com.cnbm.packing.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* 处理结果类
*
* @param <T> 返回的数据类型
* @author jiff
* @date 2018/11/7
* @since 1.0
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
@ApiModel("处理结果类")
@Accessors
public class R<T> implements Serializable {
@NonNull
@ApiModelProperty(value = "结果码", example = "0")
private int code = IErrorCode.CODE_SUCCESSFUL;
@ApiModelProperty(value = "结果说明", example = "成功")
private String msg;
@ApiModelProperty(value = "业务数据")
private T data;
public R<T> code(int code) {
this.code = code;
return this;
}
public R<T> msg(String msg) {
this.msg = msg;
return this;
}
public R<T> data(T data) {
this.data = data;
return this;
}
public boolean ok() {
return code == IErrorCode.CODE_SUCCESSFUL;
}
public static <T> R<T> failed() {
return failed("系统错误!");
}
public static <T> R<T> failed(String msg) {
return failed(ApiErrorCode.FAILED.getCode(), msg);
}
public static <T> R<T> failed(int code, String msg) {
return failed(code, msg, null);
}
public static <T> R<T> failed(int code, String msg, T data) {
return r(code == ApiErrorCode.SUCCESSFUL.getCode() ? ApiErrorCode.FAILED.getCode() : code, msg, data);
}
public static <T> R<T> failed(IErrorCode errorCode) {
return r(errorCode, null);
}
public static <T> R<T> r(IErrorCode errorCode, T data) {
return r(errorCode.getCode(), errorCode.getMsg(), data);
}
public static <T> R<T> r(int code, String msg, T data) {
return new R<T>().code(code).msg(msg).data(data);
}
public static <T> R<T> unauthorized() {
return failed(ApiErrorCode.UNAUTHORIZED);
}
public static <T> R<T> forbidden() {
return failed(ApiErrorCode.FORBIDDEN);
}
public static <T> R<T> ok(T data) {
return new R<T>().data(data);
}
public static <T> R<T> ok(String msg, T data) {
return new R<T>().msg(msg).data(data);
}
}

View File

@@ -0,0 +1,19 @@
package com.cnbm.packing.vo;
import com.cnbm.packing.dto.PowerReportDTO;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.List;
/**
* @Desc: ""
* @Author: caixiang
* @DATE: 2023/3/6 9:34
*/
@Data
public class SubIdPageVo {
private LocalDateTime createTime;
private String subId;
private String boxNo;
}

View File

@@ -7,6 +7,17 @@
<result column="platform_id" property="platformId" />
<result column="create_time" property="createTime" />
</resultMap>
<resultMap id="ResultMapCam" type="com.cnbm.packing.dto.CamlineSubIdDTO">
<result column="power_level" property="powerLevel" />
<result column="sap_material" property="sapMaterial" />
</resultMap>
<resultMap id="ResultMapCamIm" type="com.cnbm.packing.dto.CamlineSubIdForImportDTO">
<result column="power_level" property="powerLevel" />
<result column="sap_material" property="sapMaterial" />
<result column="sub_id" property="subId" />
<result column="order_name" property="orderName" />
</resultMap>
<resultMap id="ResultAMap" type="com.cnbm.packing.dto.CamlineExtendArgDTO">
<result column="LAST_UPDATE_TIME" property="lastUpdateTime" />
<result column="PMPP" property="pmpp" />
@@ -53,16 +64,15 @@
<select id="getPMPPBySubId" resultType="float">
SELECT
flc.PMPP
flr.PMPP_FL2 as PMPP
FROM
ue_flasher_data_calc flc
LEFT JOIN e_tracking_unit tu ON flc.mainid = tu.id
ue_flasher_data_raw flr
LEFT JOIN e_tracking_unit tu ON flr.mainid = tu.id
WHERE
flc.PMPP != 0
and
tu.name=#{subId} -- 查特定基板功率
flr.PMPP_FL2 != 0
and tu.name=#{subId} -- 查特定基板功率
ORDER BY
flc.LAST_UPDATE_TIME DESC
flr.LAST_UPDATE_TIME DESC
LIMIT 1
</select>
@@ -118,6 +128,92 @@
LIMIT 1
</select>
<select id="getSubIdByCamline" resultMap="ResultMapCam">
SELECT
flc.SAP_Material as sap_material,
flc.Nenn_Leistung as power_level
FROM
ue_flasher_data_calc flc
LEFT JOIN e_tracking_unit tu ON flc.mainid = tu.id
WHERE
flc.PMPP != 0
and tu.name = #{subId}
</select>
<select id="getSubIdByCamlineForImpoet" resultMap="ResultMapCamIm">
SELECT
tu.`NAME` as sub_id,-- DMC
flc.SAP_Material as sap_material,
flc.Nenn_Leistung as power_level,
eo.`NAME` as order_name
FROM
ue_flasher_data_calc flc
LEFT JOIN e_tracking_unit tu ON flc.mainid = tu.id
LEFT JOIN er_order eo ON tu.ORDER_ID = eo.ID
WHERE
tu.NAME IN (
'30110012303050629',
'30110012302272118',
'30110012303050331',
'30110012303050321',
'30110012303030164',
'30110012303023000',
'30110012303011203',
'30110012303012089',
'30110012303011487',
'30110012302271154',
'30110012302283324',
'30110012303030787',
'30110012303050373',
'30110012303022841',
'30110012303021008',
'30110012303030325',
'30110012302283810',
'30110012303011490',
'30110012303022163',
'30110012303012695',
'30110012303010372',
'30110012303020247',
'30110012303022801',
'30110012303022407',
'30110012303012915',
'30110012303022996',
'30110012303022721',
'30110012303040003',
'30110012303023102',
'30110012302281213',
'30110012303022204',
'30110012302281212',
'30110012303022970',
'30110012303022415',
'30110012303050341',
'30110012303022434',
'30110012302271569',
'30110012303030505',
'30110012303021276',
'30110012302280295',
'30110012303022166',
'30110012303022299',
'30110012303020988',
'30110012302271160',
'30110012302281215',
'30110012303050537',
'30110012302272052',
'30110012303011213',
'30110012303030488',
'30110012303021614',
'30110012303012878',
'30110012302242962',
'30110012303030608',
'30110012303012697',
'30110012303020737'
)
and flc.PMPP != 0
GROUP BY tu.`NAME`
</select>
<select id="getOrderNameBySubId" resultType="string">
SELECT
eorder.name
@@ -134,7 +230,10 @@
<select id="getTodayBoxNum" resultType="java.lang.Integer">
select count(1)
from t_wo_packaging_box twpb
where twpb.CREATE_TIME BETWEEN DATE_FORMAT(NOW(),'%Y-%m-%d 00:00:00') AND DATE_FORMAT(NOW(),'%Y-%m-%d 23:59:59')
where
twpb.CREATE_TIME BETWEEN DATE_FORMAT(NOW(),'%Y-%m-%d 00:00:00') AND DATE_FORMAT(NOW(),'%Y-%m-%d 23:59:59')
and
twpb.model = 2
</select>

View File

@@ -24,7 +24,15 @@
<select id="list" resultType="com.cnbm.packing.dto.ChangePackagingBoxHistoryDTO">
select * from t_change_packaging_box_history
order by id asc
<where>
<if test="startTime != null and endTime != null">
and create_time BETWEEN #{startTime} AND #{endTime}
</if>
<if test="type != null">
and type = #{type}
</if>
</where>
order by CREATE_TIME desc
</select>
</mapper>

View File

@@ -21,6 +21,7 @@
<id column="IS_PREVIEW" property="isPreview" />
<id column="CONTENT" property="content" />
<id column="line_body" property="lineBody" />
<id column="is_enable" property="isEnable" />
</resultMap>
<select id="list" resultType="com.cnbm.packing.dto.PrintModelDTO">

View File

@@ -41,7 +41,7 @@
and twcp.line_body = #{param.lineBody}
</if>
<if test="param.pmpp != null">
and twcp.actl_pmpp_high <![CDATA[ >= ]]> #{param.pmpp} and twcp.actl_pmpp_low <![CDATA[ <= ]]> #{param.pmpp}
and twcp.actl_pmpp_high <![CDATA[ > ]]> #{param.pmpp} and twcp.actl_pmpp_low <![CDATA[ <= ]]> #{param.pmpp}
</if>
</select>

View File

@@ -53,6 +53,13 @@
<id column="UOC_FL2" property="uocFl2" />
</resultMap>
<resultMap id="ResultMapPowerRe" type="com.cnbm.packing.dto.PowerReportDTO">
<result column="sub_num" property="subNum" />
<result column="sub_level" property="subLevel" />
<result column="sum_pmpp" property="sumPMPP" />
</resultMap>
<select id="list" resultType="com.cnbm.packing.dto.WoPackagingBoxSubstrateDTO">
select * from t_wo_packaging_box_substrate
<where>
@@ -72,11 +79,81 @@
WO_SUBSTRATE_ID = #{woSubstrateId,jdbcType=VARCHAR}
limit 1
</select>
<update id="updatePackagingBoxIdByWoSubstrateId">
<resultMap id="ResultMap" type="com.cnbm.packing.vo.SubIdPageVo">
<result column="CREATE_TIME" property="createTime" />
<result column="SUB_ID" property="subId" />
<result column="BOX_NO" property="boxNo" />
</resultMap>
<update id="updatePackagingBoxIdAndSlotByWoSubstrateId">
update t_wo_packaging_box_substrate
set PACKAGING_BOX_ID = #{packagingBoxId,jdbcType=VARCHAR}
set PACKAGING_BOX_ID = #{packagingBoxId,jdbcType=VARCHAR},
SLOT = #{slot,jdbcType=NUMERIC}
where WO_SUBSTRATE_ID = #{woSubstrateId,jdbcType=VARCHAR}
</update>
<select id="powerReport" resultMap="ResultMapPowerRe">
select
COUNT(twpbs.WO_SUBSTRATE_ID) as sub_num,twpbs.POWER_LEVEL as sub_level,sum(twpbs.PMPP) as sum_pmpp
from t_wo_packaging_box_substrate twpbs
left join t_wo_packaging_box twpb on twpbs.PACKAGING_BOX_ID = twpb.BOX_NO
<where>
twpbs.PACKAGING_BOX_ID != '0'
<if test="queryParam.begin != null and queryParam.end != null">
and twpb.CREATE_TIME between #{queryParam.begin} AND #{queryParam.end}
</if>
<if test="queryParam.orderName != null">
and twpbs.ORDER_NAME = #{queryParam.orderName}
</if>
<if test="queryParam.model != null">
and twpb.model = #{queryParam.model}
</if>
</where>
group by twpbs.POWER_LEVEL
</select>
<select id="orderNameList" resultType="string">
select
twpbs.ORDER_NAME as orderName
from t_wo_packaging_box_substrate twpbs
where
twpbs.PACKAGING_BOX_ID != '0'
and twpbs.ORDER_NAME != ''
group by twpbs.ORDER_NAME
</select>
<select id="substrateList" resultType="com.cnbm.packing.dto.WoPackagingBoxSubstrateDTO">
select
twpb.CREATE_TIME as boxCreateTime,twpbs.*,twpb.PRINT_TIME as printTime
from t_wo_packaging_box_substrate twpbs
left join t_wo_packaging_box twpb on twpbs.PACKAGING_BOX_ID = twpb.BOX_NO
<where>
twpb.model = #{model}
<if test="woSubstrateId != null and woSubstrateId != ''">
and twpbs.WO_SUBSTRATE_ID like CONCAT(CONCAT('%',#{woSubstrateId}),'%')
</if>
<if test="packagingBoxId != null and packagingBoxId != ''">
and twpbs.PACKAGING_BOX_ID like CONCAT(CONCAT('%',#{packagingBoxId}),'%')
</if>
<if test="startTime != null and endTime != null">
and twpb.CREATE_TIME between #{startTime} AND #{endTime}
</if>
AND twpbs.valid = 1
</where>
order by twpb.CREATE_TIME desc
</select>
<select id="subIdPage" resultMap="ResultMap">
SELECT
twpb.BOX_NO ,twpbs.WO_SUBSTRATE_ID as SUB_ID ,twpb.CREATE_TIME
FROM T_WO_PACKAGING_BOX_SUBSTRATE twpbs
LEFT JOIN T_WO_PACKAGING_BOX twpb ON twpbs.PACKAGING_BOX_ID = twpb.BOX_NO
<where>
<if test="param.boxNo != null">
twpb.BOX_NO = #{param.boxNo}
</if>
</where>
</select>
</mapper>

View File

@@ -38,7 +38,7 @@
and twpl.line_body = #{param.lineBody}
</if>
<if test="param.pmpp != null">
and twpl.pmpp_high <![CDATA[ >= ]]> #{param.pmpp} and twpl.pmpp_low <![CDATA[ <= ]]> #{param.pmpp}
and twpl.pmpp_high <![CDATA[ > ]]> #{param.pmpp} and twpl.pmpp_low <![CDATA[ <= ]]> #{param.pmpp}
</if>
</select>

View File

@@ -27,7 +27,7 @@ public enum S7Client {
// S7_1200("192.168.0.52",0,1,1,PlcVarActual.HeartBeatFor1200),
// S7_15001("192.168.0.51",0,1,1),
// S7_1500("192.168.0.51",0,1,1),
S7_KUKA("10.10.3.158",0,1,1),
S7_KUKA("10.10.3.158",0,1,2),
//1500 机架-0 插槽-1
//后续 在这里扩展 多PLC应用。
;
@@ -178,7 +178,7 @@ public enum S7Client {
);
return type.toObject(read);
}
}catch (Exception e) {
}catch (Throwable e) {
throw new S7CheckResultException("read errMsg : "+e.getMessage());
}
@@ -293,7 +293,7 @@ public enum S7Client {
);
}
return null;
}catch (Exception e) {
}catch (Throwable e) {
throw new S7CheckResultException("write errMsg : "+e.getMessage());
}
},