Commit 9004b583 authored by 李驰骋's avatar 李驰骋

ERP工单同步添加关联生产版本逻辑

parent f08dc569
# 项目相关配置
ximai-mes:
# 名称
name: ximai
# 版本
version: 1.0
# 版权年份
copyrightYear: 2022
# 实例演示开关
demoEnabled: true
# 文件路径 示例( Windows配置D:/ximai/uploadPath,Linux配置 /home/ximai/uploadPath)
profile: D:/code/upload
# 获取ip地址开关
addressEnabled: false
# 验证码类型 math 数组计算 char 字符验证
captchaType: math
# 开发环境配置
server:
# 服务器的HTTP端口,默认为8081
port: 8088
servlet:
# 应用的访问路径
context-path: /
tomcat:
# tomcat的URI编码
uri-encoding: UTF-8
# 连接数满后的排队数,默认为100
accept-count: 1000
threads:
# tomcat最大线程数,默认为200
max: 800
# Tomcat启动初始化的线程数,默认值10
min-spare: 100
# 日志配置
logging:
level:
com.ximai: info
org.springframework: warn
druid:
sql:
Statement: debug
file:
name: ximai-mes.log
# Spring配置
spring:
# 资源信息
messages:
# 国际化资源文件路径
basename: i18n/messages
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
druid:
# 主库数据源
master:
url: jdbc:mysql://192.168.1.128:3306/xm_mes_dev?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: t0psunit
# 从库数据源
slave:
# 从数据源开关/默认关闭
enabled: false
url:
username:
password:
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
webStatFilter:
enabled: true
statViewServlet:
enabled: true
# 设置白名单,不填则允许所有访问
allow:
url-pattern: /druid/*
# 控制台管理用户名和密码
login-username: ruoyi
login-password: 123456
filter:
slf4j:
enabled: true
statement-log-enabled: true
statement-create-after-log-enabled: false
statement-close-after-log-enabled: false
statement-executable-sql-log-enable: true
statement-prepare-after-log-enabled: false
statement-parameter-set-log-enabled: false
statement-execute-after-log-enabled: false
statement-execute-query-after-log-enabled: false
statement-execute-update-after-log-enabled: false
statement-execute-batch-after-log-enabled: false
statement-sql-pretty-format: false
stat:
enabled: true
# 慢SQL记录
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true
# 文件上传
servlet:
multipart:
# 单个文件大小
max-file-size: 100MB
# 设置总上传的文件大小
max-request-size: 200MB
# 服务模块
devtools:
restart:
# 热部署开关
enabled: true
# redis 配置
redis:
# 地址
#host: localhost
host: localhost
# 端口,默认为6379
port: 6379
# 数据库索引
database: 6
# 密码
password:
# 连接超时时间
timeout: 10s
lettuce:
pool:
# 连接池中的最小空闲连接
min-idle: 0
# 连接池中的最大空闲连接
max-idle: 8
# 连接池的最大数据库连接数
max-active: 8
# #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms
# token配置
token:
# 令牌自定义标识
header: Authorization
# 令牌密钥
secret: abcdefghijklmnopqrstuvwxyz
# 令牌有效期(默认30分钟)
expireTime: 1440
# MyBatis配置
#mybatis:
# # 搜索指定包别名
# typeAliasesPackage: com.ximai.**.domain
# # 配置mapper的扫描,找到所有的mapper.xml映射文件
# mapperLocations: classpath*:mapper/**/*Mapper.xml
# # 加载全局的配置文件
# configLocation: classpath:mybatis/mybatis-config.xml
# MyBatis配置
mybatis-plus:
global-config:
db-config:
update-strategy: IGNORED
mapper-locations: classpath*:/mapper/**/*.xml
#config-location: classpath:mybatis/mybatis-config.xml
configuration:
cache-enabled: true
use-generated-keys: true
default-executor-type: simple
log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl
type-aliases-package: "com.ximai.**.domain"
# PageHelper分页插件
pagehelper:
helperDialect: mysql
supportMethodsArguments: true
params: count=countSql
# Swagger配置
swagger:
# 是否开启swagger
enabled: true
# 请求前缀
#pathMapping: /prod-api
pathMapping: /dev-api
# 防止XSS攻击
xss:
# 过滤开关
enabled: true
# 排除链接(多个用逗号分隔)
excludes: /system/notice
# 匹配链接
urlPatterns: /system/*,/monitor/*,/tool/*
#Mino配置
minio:
url: http://192.168.3.91:9000
accessKey: minioadmin
secretKey: minioadmin
bucketName: mes
#远程连接SAP
remote:
erp:
url: http://localhost:20091
username: rest_user
password: ximai123456
#fiegn配置连接池
feign:
okhttp:
enabled: true
#http basic验证账号、密码配置
api:
basicauth:
username: mes
password: t0psunit
......@@ -60,8 +60,8 @@ public interface MdItemMapper extends BaseMapper<MdItem> {
@Select(value = "select max(erp_update_time) from md_item")
Date maxErpUpdateTime();
@Select(value = "select item_id, item_code, sap_item_code, item_name from md_item where sap_item_code=#{sapItemCode}")
MdItem selectMdItemByCodes(@Param("sapItemCode") String sapItemCode);
@Select(value = "select item_id, item_code, sap_item_code, item_name from md_item where item_code=#{itemCode}")
MdItem selectMdItemByCodes(@Param("itemCode") String itemCode);
/**
......
......@@ -140,9 +140,6 @@ public class ProWorkOrderBom extends BaseEntity {
@ApiModelProperty("工序名")
private String opName;
@ApiModelProperty("工单单别")
private String orderSource;
@ApiModelProperty("erp创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date erpCreateTime;
......
package com.ximai.mes.pro.domain.proWorkOrder;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.ximai.common.annotation.Excel;
import com.ximai.common.core.domain.BaseEntity;
import com.ximai.mes.pro.domain.productionSolution.ProProductionSolutionProcess;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
......@@ -152,5 +154,9 @@ public class ProWorkOrderProcess extends BaseEntity {
@TableField(exist = false)
private int isExistTool;
public void init(ProProductionSolutionProcess solutionProcess){
BeanUtil.copyProperties(solutionProcess, this);
}
}
package com.ximai.mes.pro.mapper.productionSolution;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ximai.mes.md.domain.MdItem;
import com.ximai.mes.pro.domain.productionSolution.ProProductionSolution;
import com.ximai.mes.pro.domain.productionSolution.ProProductionSolutionSpecificationSheet;
import org.apache.ibatis.annotations.Param;
......@@ -13,7 +15,7 @@ import java.util.List;
* @author zht
* @date 2024-01-23
*/
public interface ProProductionSolutionMapper {
public interface ProProductionSolutionMapper extends BaseMapper<ProProductionSolution> {
/**
* 查询生产版本
*
......
......@@ -10,6 +10,7 @@ import cn.hutool.poi.excel.ExcelReader;
import cn.hutool.poi.excel.ExcelUtil;
import cn.hutool.poi.excel.ExcelWriter;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.ximai.common.constant.UserConstants;
import com.ximai.common.core.domain.entity.SysUser;
import com.ximai.common.exception.ServiceException;
......@@ -1070,9 +1071,36 @@ public class ProWorkorderServiceImpl implements IProWorkorderService {
proWorkorder.setAncestors(parent.getAncestors() + "," + parent.getParentId());
}
}
proWorkorder.setStatus(WorkorderStatusEnum.PUBLISHED.getValue());
proWorkorder.createAction();
return proWorkorderMapper.insertProWorkorder(proWorkorder);
int r = proWorkorderMapper.insertProWorkorder(proWorkorder);
//未设置生产版本时自动根据产品编号匹配最新生产版本
if(ObjectUtil.isEmpty(proWorkorder.getProductionSolutionId())){
ProProductionSolution proProductionSolutionQuery = new ProProductionSolution();
proProductionSolutionQuery.setItemId(proWorkorder.getProductId());
PageHelper.startPage(1, 1);
PageHelper.orderBy("production_solution_code desc");
List<ProProductionSolution> solutionList = proProductionSolutionService.selectProProductionSolutionList(proProductionSolutionQuery);
if(solutionList.size()==1){
QueryWrapper<ProProductionSolutionProcess> solutionProcessQuery = new QueryWrapper<>();
solutionProcessQuery.eq("production_solution_id", solutionList.get(0).getProductionSolutionId());
List<ProProductionSolutionProcess> processList = proProductionSolutionProcessService.selectProProductionSolutionProcessList(solutionProcessQuery);
int i = 1;
for(ProProductionSolutionProcess solutionProcess : processList){
ProWorkOrderProcess proWorkOrderProcess = new ProWorkOrderProcess();
proWorkOrderProcess.init(solutionProcess);
proWorkOrderProcess.setWorkorderId(proWorkorder.getWorkorderId());
proWorkOrderProcess.setWorkorderCode(proWorkorder.getWorkorderCode());
proWorkOrderProcess.setIdx(i + "");
proWorkOrderProcessService.insertProWorkOrderProcess(proWorkOrderProcess);
i++;
}
proWorkorder.setProductionSolutionId(solutionList.get(0).getProductionSolutionId());
proWorkorder.setProductionSolutionCode(solutionList.get(0).getProductionSolutionCode());
this.updateProWorkorder(proWorkorder);
}
}
return r;
}
/**
......
......@@ -189,7 +189,7 @@ public class ProProductionSolutionServiceImpl implements IProProductionSolutionS
BeanUtils.copyProperties(proProductionSolutionVo, proProductionSolution);
// 数据转换
String itemCode = proProductionSolutionVo.getSapItemCode();
String itemCode = proProductionSolutionVo.getItemCode();
if (StringUtils.isNotNull(itemCode)) {
MdItem mdItem = mdItemMapper.selectMdItemByCodes(itemCode);
ExceptionUtil.checkTrueThrowException(ObjectUtil.isEmpty(mdItem), MessageUtils.message("pro.material.error.not.exist"));
......
package com.ximai.mes.pro.service.productionSolution;
import com.github.pagehelper.Page;
import com.ximai.mes.pro.domain.productionSolution.ProProductionSolution;
import com.ximai.mes.pro.domain.vo.ProProductionSolutionVo;
......
package com.ximai.mes.remote;
import com.ximai.common.annotation.Log;
import com.ximai.common.enums.BusinessType;
import com.ximai.mes.remote.dto.*;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
......@@ -12,47 +15,60 @@ import java.util.List;
@FeignClient(value = "erp-service", url = "${remote.erp.url}")
public interface ErpService {
/**
* 查询供应商
*/
@Log(businessType = BusinessType.QUERY)
@ApiOperation(value = "查询ERP供应商")
@PostMapping(value = "/purma/getPurmaList")
ErpResponseResult<List<MdVendorErpDto>> getVendorList(MdVendorErpQuery vendorErpQuery);
/**
* 查询客户
*/
@Log(businessType = BusinessType.QUERY)
@ApiOperation(value = "查询ERP客户")
@PostMapping(value = "/copma/getCopmaList")
ErpResponseResult<List<MdClientErpDto>> getClientList(MdClientErpQuery clientErpQuery);
/**
* 查询仓库
*/
@Log(businessType = BusinessType.QUERY)
@ApiOperation(value = "查询ERP仓库")
@PostMapping(value = "/cmsmc/getCmsmcList")
ErpResponseResult<List<WmWarehouseErpDto>> getWarehouseList(WmWarehouseErpQuery warehouseErpQuery);
/**
* 查询物料基础数据
*/
@Log(businessType = BusinessType.QUERY)
@ApiOperation(value = "查询ERP物料")
@PostMapping(value = "/invmb/getInvmbList")
ErpResponseResult<List<MdItemErpDto>> getItemList(MdItemErpQuery itemErpQuery);
/**
* 查询工单
*/
@Log(businessType = BusinessType.QUERY)
@ApiOperation(value = "查询工单")
@PostMapping(value = "/mocta/getMoctaList")
ErpResponseResult<List<ProWorkorderErpDto>> getWorkorderList(ProWorkorderErpQuery workorderErpQuery);
/**
* 工单更新状态标识
*/
@Log(businessType = BusinessType.UPDATE)
@ApiOperation(value = "工单同步标识")
@PostMapping(value = "/mocta/syncMark")
ErpResponseResult<Object> workorderSyncMark(ProWorkorderSyncMarkUpdate syncMarkUpdate);
/**
* 物料更新状态标识
*/
@Log(businessType = BusinessType.UPDATE)
@ApiOperation(value = "物料同步标识")
@PostMapping(value = "/invmb/syncMark")
ErpResponseResult<Object> materialSyncMark(MdItemSyncMarkUpdate syncMarkUpdate);
@Log(businessType = BusinessType.UPDATE)
@ApiOperation(value = "工单状态更新")
@PostMapping(value = "/mocta/updateState")
ErpResponseResult<Object> updateState(ProWorkorderSyncMarkUpdate syncMarkUpdate);
@Log(businessType = BusinessType.UPDATE)
@ApiOperation(value = "请购单创建")
@PostMapping(value = "/purta/create")
ErpResponseResult<Object> purchasingRequisitionCreate(ProWorkorderSyncMarkUpdate syncMarkUpdate);
@Log(businessType = BusinessType.UPDATE)
@ApiOperation(value = "完工入库创建")
@PostMapping(value = "/moctf/create")
ErpResponseResult<Object> finishStockInCreate(ProWorkorderSyncMarkUpdate syncMarkUpdate);
}
......@@ -108,7 +108,6 @@
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="opName != null">op_name,</if>
<if test="orderSource != null">order_source,</if>
<if test="erpCreateTime !=null">erp_create_time,</if>
<if test="erpUpdateTime !=null">erp_update_time,</if>
</trim>
......@@ -137,7 +136,6 @@
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="opName != null">#{opName},</if>
<if test="orderSource != null">#{orderSource},</if>
<if test="erpCreateTime != null">#{erpCreateTime},</if>
<if test="erpUpdateTime != null">#{erpUpdateTime},</if>
</trim>
......@@ -169,7 +167,6 @@
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="opName != null">op_name = #{opName},</if>
<if test="orderSource != null">order_source = #{orderSource},</if>
<if test="erpUpdateTime != null">erp_update_time = #{erpUpdateTime},</if>
</trim>
where bom_item_id = #{bomItemId}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment