rev:点位锁
This commit is contained in:
@@ -54,6 +54,11 @@
|
|||||||
<version>${hutool.version}</version>
|
<version>${hutool.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.baomidou</groupId>
|
||||||
|
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
|
||||||
|
<version>4.1.3</version>
|
||||||
|
</dependency>
|
||||||
<!-- 日志链路追踪 https://tlog.yomahub.com/pages/f62a84/#%E5%90%8C%E6%AD%A5%E6%97%A5%E5%BF%97-->
|
<!-- 日志链路追踪 https://tlog.yomahub.com/pages/f62a84/#%E5%90%8C%E6%AD%A5%E6%97%A5%E5%BF%97-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.yomahub</groupId>
|
<groupId>com.yomahub</groupId>
|
||||||
|
|||||||
@@ -1,206 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2019-2020 Zheng Jie
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package org.nl.common.mnt.util;
|
|
||||||
|
|
||||||
import com.alibaba.druid.pool.DruidDataSource;
|
|
||||||
import com.alibaba.druid.util.StringUtils;
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.sql.*;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author /
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
public class SqlUtils {
|
|
||||||
|
|
||||||
public static final String COLON = ":";
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取数据源
|
|
||||||
*
|
|
||||||
* @param jdbcUrl /
|
|
||||||
* @param userName /
|
|
||||||
* @param password /
|
|
||||||
* @return DataSource
|
|
||||||
*/
|
|
||||||
private static DataSource getDataSource(String jdbcUrl, String userName, String password) {
|
|
||||||
DruidDataSource druidDataSource = new DruidDataSource();
|
|
||||||
String className;
|
|
||||||
try {
|
|
||||||
className = DriverManager.getDriver(jdbcUrl.trim()).getClass().getName();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
throw new RuntimeException("Get class name error: =" + jdbcUrl);
|
|
||||||
}
|
|
||||||
if (StringUtils.isEmpty(className)) {
|
|
||||||
DataTypeEnum dataTypeEnum = DataTypeEnum.urlOf(jdbcUrl);
|
|
||||||
if (null == dataTypeEnum) {
|
|
||||||
throw new RuntimeException("Not supported data type: jdbcUrl=" + jdbcUrl);
|
|
||||||
}
|
|
||||||
druidDataSource.setDriverClassName(dataTypeEnum.getDriver());
|
|
||||||
} else {
|
|
||||||
druidDataSource.setDriverClassName(className);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
druidDataSource.setUrl(jdbcUrl);
|
|
||||||
druidDataSource.setUsername(userName);
|
|
||||||
druidDataSource.setPassword(password);
|
|
||||||
// 配置获取连接等待超时的时间
|
|
||||||
druidDataSource.setMaxWait(3000);
|
|
||||||
// 配置初始化大小、最小、最大
|
|
||||||
druidDataSource.setInitialSize(1);
|
|
||||||
druidDataSource.setMinIdle(1);
|
|
||||||
druidDataSource.setMaxActive(1);
|
|
||||||
|
|
||||||
// 如果链接出现异常则直接判定为失败而不是一直重试
|
|
||||||
druidDataSource.setBreakAfterAcquireFailure(true);
|
|
||||||
try {
|
|
||||||
druidDataSource.init();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
log.error("Exception during pool initialization", e);
|
|
||||||
throw new RuntimeException(e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
return druidDataSource;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Connection getConnection(String jdbcUrl, String userName, String password) {
|
|
||||||
DataSource dataSource = getDataSource(jdbcUrl, userName, password);
|
|
||||||
Connection connection = null;
|
|
||||||
try {
|
|
||||||
connection = dataSource.getConnection();
|
|
||||||
} catch (Exception ignored) {}
|
|
||||||
try {
|
|
||||||
int timeOut = 5;
|
|
||||||
if (null == connection || connection.isClosed() || !connection.isValid(timeOut)) {
|
|
||||||
log.info("connection is closed or invalid, retry get connection!");
|
|
||||||
connection = dataSource.getConnection();
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("create connection error, jdbcUrl: {}", jdbcUrl);
|
|
||||||
throw new RuntimeException("create connection error, jdbcUrl: " + jdbcUrl);
|
|
||||||
}
|
|
||||||
return connection;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void releaseConnection(Connection connection) {
|
|
||||||
if (null != connection) {
|
|
||||||
try {
|
|
||||||
connection.close();
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(e.getMessage(),e);
|
|
||||||
log.error("connection close error:" + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static void closeResult(ResultSet rs) {
|
|
||||||
if (rs != null) {
|
|
||||||
try {
|
|
||||||
rs.close();
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(e.getMessage(),e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean testConnection(String jdbcUrl, String userName, String password) {
|
|
||||||
Connection connection = null;
|
|
||||||
try {
|
|
||||||
connection = getConnection(jdbcUrl, userName, password);
|
|
||||||
if (null != connection) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.info("Get connection failed:" + e.getMessage());
|
|
||||||
} finally {
|
|
||||||
releaseConnection(connection);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String executeFile(String jdbcUrl, String userName, String password, File sqlFile) {
|
|
||||||
Connection connection = getConnection(jdbcUrl, userName, password);
|
|
||||||
try {
|
|
||||||
batchExecute(connection, readSqlList(sqlFile));
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("sql脚本执行发生异常:{}",e.getMessage());
|
|
||||||
return e.getMessage();
|
|
||||||
}finally {
|
|
||||||
releaseConnection(connection);
|
|
||||||
}
|
|
||||||
return "success";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量执行sql
|
|
||||||
* @param connection /
|
|
||||||
* @param sqlList /
|
|
||||||
*/
|
|
||||||
public static void batchExecute(Connection connection, List<String> sqlList) throws SQLException {
|
|
||||||
Statement st = connection.createStatement();
|
|
||||||
for (String sql : sqlList) {
|
|
||||||
if (sql.endsWith(";")) {
|
|
||||||
sql = sql.substring(0, sql.length() - 1);
|
|
||||||
}
|
|
||||||
st.addBatch(sql);
|
|
||||||
}
|
|
||||||
st.executeBatch();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 将文件中的sql语句以;为单位读取到列表中
|
|
||||||
* @param sqlFile /
|
|
||||||
* @return /
|
|
||||||
* @throws Exception e
|
|
||||||
*/
|
|
||||||
private static List<String> readSqlList(File sqlFile) throws Exception {
|
|
||||||
List<String> sqlList = Lists.newArrayList();
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(
|
|
||||||
new FileInputStream(sqlFile), StandardCharsets.UTF_8))) {
|
|
||||||
String tmp;
|
|
||||||
while ((tmp = reader.readLine()) != null) {
|
|
||||||
log.info("line:{}", tmp);
|
|
||||||
if (tmp.endsWith(";")) {
|
|
||||||
sb.append(tmp);
|
|
||||||
sqlList.add(sb.toString());
|
|
||||||
sb.delete(0, sb.length());
|
|
||||||
} else {
|
|
||||||
sb.append(tmp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!"".endsWith(sb.toString().trim())) {
|
|
||||||
sqlList.add(sb.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return sqlList;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
package org.nl.config;
|
|
||||||
|
|
||||||
import com.alibaba.druid.pool.DruidDataSource;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.context.annotation.Primary;
|
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
@Slf4j
|
|
||||||
public class DataBaseConfig {
|
|
||||||
|
|
||||||
@Primary
|
|
||||||
@Bean(name = "dataSource")
|
|
||||||
@ConfigurationProperties(prefix = "spring.datasource.druid")
|
|
||||||
public DataSource dataSource() {
|
|
||||||
return new DruidDataSource();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -12,6 +12,8 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
|
|||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
|
||||||
@EnableTransactionManagement
|
@EnableTransactionManagement
|
||||||
@Configuration
|
@Configuration
|
||||||
@@ -36,9 +38,9 @@ public class MybatisPlusConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void datainnit() {
|
public void datainnit() throws SQLException {
|
||||||
String url = ((DruidDataSource) dataSource).getUrl();
|
Connection connection = dataSource.getConnection();
|
||||||
System.out.println("项目数据库地址:" + url);
|
System.out.println("项目数据库地址:" + connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,167 @@
|
|||||||
|
package org.nl.wms.ext.fab.controller;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.annotation.SaIgnore;
|
||||||
|
import cn.hutool.core.lang.Assert;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.common.base.TableDataInfo;
|
||||||
|
import org.nl.common.enums.VehicleTypeEnum;
|
||||||
|
import org.nl.common.logging.annotation.Log;
|
||||||
|
import org.nl.config.MapOf;
|
||||||
|
import org.nl.wms.ext.fab.service.dto.*;
|
||||||
|
import org.nl.wms.ext.fab.service.impl.FabServiceImpl;
|
||||||
|
import org.nl.wms.sch.point.service.ISchBasePointService;
|
||||||
|
import org.nl.wms.sch.point.service.dto.PointMaterialInfo;
|
||||||
|
import org.nl.wms.sch.region.service.ISchBaseRegionService;
|
||||||
|
import org.nl.wms.sch.region.service.dao.SchBaseRegion;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@Api(tags = "fab相关接口")
|
||||||
|
@RequestMapping("/api/fab")
|
||||||
|
@Slf4j
|
||||||
|
@SaIgnore
|
||||||
|
public class FabController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISchBaseRegionService iSchBaseRegionService;
|
||||||
|
@Autowired
|
||||||
|
private ISchBasePointService iSchBasePointService;
|
||||||
|
@Autowired
|
||||||
|
private FabServiceImpl fabService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备工序列表
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Log("设备工序列表")
|
||||||
|
@GetMapping("/regionList")
|
||||||
|
public ResponseEntity<TableDataInfo<List<LB>>> regionList(){
|
||||||
|
List<SchBaseRegion> regionList = iSchBaseRegionService.getRegionList(new SchBaseRegion());
|
||||||
|
List result = new ArrayList<>();
|
||||||
|
for (SchBaseRegion schBaseRegion : regionList) {
|
||||||
|
result.add(MapOf.of("label",schBaseRegion.getRegion_name(),"value",schBaseRegion.getRegion_code()));
|
||||||
|
}
|
||||||
|
return new ResponseEntity(TableDataInfo.build(result), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据工序获取设备点位信息
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Log("根据工序获取设备点位信息")
|
||||||
|
@GetMapping("/regionPoints")
|
||||||
|
public ResponseEntity<Map> regionPoints(String regionCode){
|
||||||
|
Assert.notBlank(regionCode,"请求参数不能为空");
|
||||||
|
SchBaseRegion baseRegion = iSchBaseRegionService.getOne(new QueryWrapper<SchBaseRegion>().eq("region_code", regionCode));
|
||||||
|
String regionPoints = baseRegion.getRegion_points();
|
||||||
|
JSONObject pointConfig = JSON.parseObject(regionPoints);
|
||||||
|
return new ResponseEntity(pointConfig, HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据工序查询订单
|
||||||
|
* @param regionCode
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Log("根据工序查询工单")
|
||||||
|
@GetMapping("/regionOrder")
|
||||||
|
public ResponseEntity<TableDataInfo<OrderMater>> regionOrder(String regionCode){
|
||||||
|
List<OrderMater> orderMaters = fabService.getOrderBycode(regionCode);
|
||||||
|
return new ResponseEntity(TableDataInfo.build(orderMaters), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据工单查询匹配库存
|
||||||
|
* @param order
|
||||||
|
* @param regionCode
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Log("根据工单查询匹配库存")
|
||||||
|
@GetMapping("/getMaterListByOrder")
|
||||||
|
public ResponseEntity<TableDataInfo<List<PointMaterialInfo>>> getMaterListByOrder(String order,String regionCode){
|
||||||
|
List<PointMaterialInfo> structList = iSchBasePointService.getStructList(regionCode, null);
|
||||||
|
return new ResponseEntity(TableDataInfo.build(structList), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 呼叫库存物料
|
||||||
|
* @param MaterInfo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Log("呼叫库存物料")
|
||||||
|
@PostMapping("/callMater")
|
||||||
|
public ResponseEntity<TableDataInfo> callMater(@RequestBody CallMaterVo MaterInfo){
|
||||||
|
JSONObject toJSON = (JSONObject)JSON.toJSON(MaterInfo);
|
||||||
|
fabService.createAgvTask(toJSON,"cmt");
|
||||||
|
return new ResponseEntity(TableDataInfo.build(), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 呼叫空料框
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Log("呼叫空料框")
|
||||||
|
@PostMapping("/callEmp")
|
||||||
|
public ResponseEntity<TableDataInfo> callEmp(@RequestBody CallEmpVo callEmpVo){
|
||||||
|
JSONObject toJSON = (JSONObject)JSON.toJSON(callEmpVo);
|
||||||
|
fabService.createAgvTask(toJSON,"cnt");
|
||||||
|
return new ResponseEntity(TableDataInfo.build(), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 叫料点回库
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Log("叫料点回库")
|
||||||
|
@PostMapping("/sendVehicle")
|
||||||
|
public ResponseEntity<TableDataInfo> sendVehicle(@RequestBody SendVehicleVo sendVehicleVo){
|
||||||
|
JSONObject toJSON = (JSONObject)JSON.toJSON(sendVehicleVo);
|
||||||
|
Integer qty = sendVehicleVo.getMaterial_qty();
|
||||||
|
if (qty.intValue()==0){
|
||||||
|
fabService.createAgvTask(toJSON,"snt");
|
||||||
|
}else {
|
||||||
|
fabService.createAgvTask(toJSON,"smt");
|
||||||
|
}
|
||||||
|
return new ResponseEntity(TableDataInfo.build(), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 载具类型列表
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Log("载具类型列表")
|
||||||
|
@PostMapping("/vehicleType")
|
||||||
|
public ResponseEntity<TableDataInfo<List<LB>>> vehicleType(){
|
||||||
|
List<LB> result = new ArrayList<>();
|
||||||
|
for (VehicleTypeEnum value : VehicleTypeEnum.values()) {
|
||||||
|
result.add(LB.builder().label(value.getVehicleName()).value(value.getVehicleCode()).build());
|
||||||
|
}
|
||||||
|
return new ResponseEntity(TableDataInfo.build(result), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工序下料
|
||||||
|
* @param MaterInfo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Log("工序下料")
|
||||||
|
@PostMapping("/sendMater")
|
||||||
|
public ResponseEntity<TableDataInfo> sendMater(@RequestBody SendMaterVo MaterInfo){
|
||||||
|
JSONObject toJSON = (JSONObject)JSON.toJSON(MaterInfo);
|
||||||
|
fabService.createAgvTask(toJSON,"smt");
|
||||||
|
return new ResponseEntity(TableDataInfo.build(), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package org.nl.wms.ext.fab.controller;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.annotation.SaIgnore;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.common.base.TableDataInfo;
|
||||||
|
import org.nl.common.logging.annotation.Log;
|
||||||
|
import org.nl.wms.ext.fab.service.dto.*;
|
||||||
|
import org.nl.wms.ext.fab.service.impl.FabServiceImpl;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@Api(tags = "fab同步接口")
|
||||||
|
@RequestMapping("/api/fabSync")
|
||||||
|
@Slf4j
|
||||||
|
@SaIgnore
|
||||||
|
public class FabSycnController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FabServiceImpl fabService;
|
||||||
|
/**
|
||||||
|
* 手动同步fab物料状态
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Log("手动同步fab")
|
||||||
|
@GetMapping("/sync")
|
||||||
|
public ResponseEntity<LB> regionList(List<String> orders){
|
||||||
|
fabService.syncFab(orders);
|
||||||
|
return new ResponseEntity(TableDataInfo.build(), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package org.nl.wms.ext.fab.service.dao;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class FabConsumptionDo implements Serializable {
|
||||||
|
// 唯一标识
|
||||||
|
private String MSGID;
|
||||||
|
/**
|
||||||
|
* 压机作业计划号
|
||||||
|
*/
|
||||||
|
private String PWORKSCHE_ID;
|
||||||
|
/**
|
||||||
|
* 配料作业计划号
|
||||||
|
*/
|
||||||
|
private String FWORKSCHE_ID;
|
||||||
|
/**
|
||||||
|
* 配料批次号
|
||||||
|
*/
|
||||||
|
private String FPROBATCH;
|
||||||
|
/**
|
||||||
|
* 配料吨袋号
|
||||||
|
*/
|
||||||
|
private String FBAGCODE;
|
||||||
|
/**
|
||||||
|
* 泥料仓库编号
|
||||||
|
*/
|
||||||
|
private String LOGT;
|
||||||
|
/**
|
||||||
|
* 出库数量
|
||||||
|
*/
|
||||||
|
private BigDecimal OUT_NUMBER;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package org.nl.wms.ext.fab.service.dao.mapper;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.nl.wms.database.material.service.dao.MdBaseMaterial;
|
||||||
|
import org.nl.wms.ext.fab.service.dao.FabConsumptionDo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
public interface FabRequestMapper {
|
||||||
|
|
||||||
|
@DS("sqlserver")
|
||||||
|
List<MdBaseMaterial> getMesMaterialInfos(@Param("time") String time);
|
||||||
|
|
||||||
|
@DS("sqlserver")
|
||||||
|
List<JSONObject> getMesMaterialInfos2();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据工序查看FAb的订单列表
|
||||||
|
* @param regionCode
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@DS("sqlserver")
|
||||||
|
List<FabConsumptionDo> getMWorkOrderInfos(@Param("regionCode") String regionCode);
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="org.nl.wms.ext.fab.service.dao.mapper.FabRequestMapper">
|
||||||
|
<insert id="getMesMaterialInfos" parameterType="org.nl.wms.ext.fab.service.dao.FabConsumptionDo">
|
||||||
|
INSERT INTO "LMSTELCOM"."RECEIVE_MUDMATERIEL_OUT"( MSGID, PWORKSCHE_ID, OUT_FINNUM, PRESSUNIT, FBAGCODE, LOGT
|
||||||
|
, SENDTIM
|
||||||
|
, CREATE_TM, OP_FLAG, SLEEP_TIME)
|
||||||
|
VALUES ( #{MSGID}, #{PWORKSCHE_ID}, #{OUT_FINNUM}, #{PRESSUNIT}, #{FBAGCODE}, #{LOGT}
|
||||||
|
, #{SENDTIM}, #{CREATE_TM}, #{OP_FLAG}, #{SLEEP_TIME})
|
||||||
|
</insert>
|
||||||
|
<insert id="getMesMaterialInfos2" parameterType="org.nl.wms.ext.fab.service.dao.FabConsumptionDo">
|
||||||
|
INSERT INTO "LMSTELCOM"."RECEIVE_R_SEMIPRODUCT"( MSGID, FORDER_NO, PWORKSCHE_ID, FPRODUCT_MATERIAL_ID
|
||||||
|
, FPRODUCT_MATERIAL_NAME, FMATSPEC, FMATMODEL, BATCHNO, PRESSUNIT
|
||||||
|
, FTEAM, TRAY_NO, PRO_SUBNUM
|
||||||
|
, PRO_SUBUNIT, CHECKERIN_TIM, PRODATE, CREATE_TM, OP_FLAG)
|
||||||
|
VALUES ( #{MSGID}, #{FORDER_NO}, #{PWORKSCHE_ID}
|
||||||
|
, #{FPRODUCT_MATERIAL_ID}, #{FPRODUCT_MATERIAL_NAME}, #{FMATSPEC}, #{FMATMODEL}, #{BATCHNO}, #{PRESSUNIT}
|
||||||
|
, #{FTEAM}, #{TRAY_NO}, #{PRO_SUBNUM}, #{PRO_SUBUNIT}, #{CHECKERIN_TIM}, #{PRODATE}, #{CREATE_TM}
|
||||||
|
, #{OP_FLAG})
|
||||||
|
</insert>
|
||||||
|
<insert id="getMWorkOrderInfos" parameterType="org.nl.wms.ext.fab.service.dao.FabConsumptionDo">
|
||||||
|
INSERT INTO "LMSTELCOM"."RECEIVE_CS_SEMIPROINFO_IN"( MSGID, FORDER_NO, PWORKSCHE_ID, PRESSUNIT, FSCHEDULE_ID
|
||||||
|
, FPRODUCT_MATERIAL_ID, FPRODUCT_MATERIAL_NAME, FMATSPEC
|
||||||
|
, FMATMODEL, BATCHNO, FTEAM, TRAY_NO, PRO_SUBNUM
|
||||||
|
, PRO_SUBUNIT, CHECKERIN_TIM, PRODATE, CREATE_TM, OP_FLAG)
|
||||||
|
VALUES ( #{MSGID}, #{FORDER_NO}, #{PWORKSCHE_ID}
|
||||||
|
, #{PRESSUNIT}, #{FSCHEDULE_ID}, #{FPRODUCT_MATERIAL_ID}, #{FPRODUCT_MATERIAL_NAME}, #{FMATSPEC}
|
||||||
|
, #{FMATMODEL}
|
||||||
|
, #{BATCHNO}, #{FTEAM}, #{TRAY_NO}, #{PRO_SUBNUM}, #{PRO_SUBUNIT}, #{CHECKERIN_TIM}, #{PRODATE}
|
||||||
|
, #{CREATE_TM}
|
||||||
|
, #{OP_FLAG})
|
||||||
|
</insert>
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package org.nl.wms.ext.fab.service.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class CallEmpVo {
|
||||||
|
/**
|
||||||
|
* 呼叫点位(...OUT1)
|
||||||
|
*/
|
||||||
|
private String device_code;
|
||||||
|
/**
|
||||||
|
* 托盘类型
|
||||||
|
*/
|
||||||
|
private String vehicle_type;
|
||||||
|
/**
|
||||||
|
* 设备工序
|
||||||
|
*/
|
||||||
|
private String regin_code;
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package org.nl.wms.ext.fab.service.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class CallMaterVo {
|
||||||
|
/**
|
||||||
|
* 货位
|
||||||
|
*/
|
||||||
|
public String point_code;
|
||||||
|
/**
|
||||||
|
* 载具编码
|
||||||
|
*/
|
||||||
|
public String vehicle_code;
|
||||||
|
/**
|
||||||
|
* 物料id
|
||||||
|
*/
|
||||||
|
public String material_id;
|
||||||
|
/**
|
||||||
|
* 订单号
|
||||||
|
*/
|
||||||
|
public String order_code;
|
||||||
|
/**
|
||||||
|
* 物料数量
|
||||||
|
*/
|
||||||
|
public String material_qty;
|
||||||
|
/**
|
||||||
|
* 呼叫点位(IN1,IN2)
|
||||||
|
*/
|
||||||
|
public String device_code;
|
||||||
|
/**
|
||||||
|
* 设备工序
|
||||||
|
*/
|
||||||
|
public String region_code;
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package org.nl.wms.ext.fab.service.dto;
|
||||||
|
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
public class LB {
|
||||||
|
/**
|
||||||
|
* 标签
|
||||||
|
*/
|
||||||
|
private String label;
|
||||||
|
/**
|
||||||
|
* 值
|
||||||
|
*/
|
||||||
|
private String value;
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package org.nl.wms.ext.fab.service.dto;
|
||||||
|
|
||||||
|
public class OrderMater {
|
||||||
|
/**
|
||||||
|
* 物料号
|
||||||
|
*/
|
||||||
|
public String material_id;
|
||||||
|
/**
|
||||||
|
* 物料类型
|
||||||
|
*/
|
||||||
|
public String material_type;
|
||||||
|
/**
|
||||||
|
* 订单号
|
||||||
|
*/
|
||||||
|
public String order_code;
|
||||||
|
/**
|
||||||
|
* 工序
|
||||||
|
*/
|
||||||
|
public String region_code;
|
||||||
|
/**
|
||||||
|
* 物料数量
|
||||||
|
*/
|
||||||
|
public String material_qty;
|
||||||
|
/**
|
||||||
|
* 交期时间
|
||||||
|
*/
|
||||||
|
public String dua_date;
|
||||||
|
/**
|
||||||
|
* 客户编码
|
||||||
|
*/
|
||||||
|
public String custom;
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package org.nl.wms.ext.fab.service.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class SendMaterVo {
|
||||||
|
/**
|
||||||
|
* 载具编码
|
||||||
|
*/
|
||||||
|
public String vehicle_code;
|
||||||
|
/**
|
||||||
|
* 物料id
|
||||||
|
*/
|
||||||
|
public String material_id;
|
||||||
|
/**
|
||||||
|
* 订单号
|
||||||
|
*/
|
||||||
|
public String order_code;
|
||||||
|
/**
|
||||||
|
* 合格数量
|
||||||
|
*/
|
||||||
|
public Integer material_qty;
|
||||||
|
/**
|
||||||
|
* 地面点位(IN1,IN2)
|
||||||
|
*/
|
||||||
|
public String device_code;
|
||||||
|
/**
|
||||||
|
* 设备工序
|
||||||
|
*/
|
||||||
|
public String region_code;
|
||||||
|
/**
|
||||||
|
* 指定区域
|
||||||
|
*/
|
||||||
|
public String target_region_code;
|
||||||
|
/**
|
||||||
|
* 是否报功
|
||||||
|
*/
|
||||||
|
public Boolean has_report;
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package org.nl.wms.ext.fab.service.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class SendVehicleVo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物料数量
|
||||||
|
*/
|
||||||
|
public Integer material_qty;
|
||||||
|
/**
|
||||||
|
* 地面点位(IN1,IN2)
|
||||||
|
*/
|
||||||
|
public String device_code;
|
||||||
|
/**
|
||||||
|
* 设备工序
|
||||||
|
*/
|
||||||
|
public String region_code;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
package org.nl.wms.ext.fab.service.impl;
|
||||||
|
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import org.nl.wms.ext.acs.service.dto.to.BaseResponse;
|
||||||
|
import org.nl.wms.ext.fab.service.dao.FabConsumptionDo;
|
||||||
|
import org.nl.wms.ext.fab.service.dao.mapper.FabRequestMapper;
|
||||||
|
import org.nl.wms.ext.fab.service.dto.*;
|
||||||
|
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService;
|
||||||
|
import org.nl.wms.sch.group.service.dao.SchBaseVehiclematerialgroup;
|
||||||
|
import org.nl.wms.sch.task_manage.task.tasks.handheld.CallEmptyTask;
|
||||||
|
import org.nl.wms.sch.task_manage.task.tasks.pcoperation.PcOperationCMTask;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class FabServiceImpl {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private FabRequestMapper fabRequestMapper;
|
||||||
|
@Autowired
|
||||||
|
private ISchBaseVehiclematerialgroupService iSchBaseVehiclematerialgroupService;
|
||||||
|
/**
|
||||||
|
* pc呼叫满料
|
||||||
|
*/
|
||||||
|
@Autowired
|
||||||
|
private PcOperationCMTask pcOperationCMTask;
|
||||||
|
/**
|
||||||
|
* 呼叫空料笼
|
||||||
|
*/
|
||||||
|
@Autowired
|
||||||
|
private CallEmptyTask callEmptyTask;
|
||||||
|
|
||||||
|
|
||||||
|
public void syncFab(List<String> orders) {
|
||||||
|
if (CollectionUtils.isEmpty(orders)){
|
||||||
|
//查询所有组盘表800号
|
||||||
|
// List<SchBaseVehiclematerialgroup> list = iSchBaseVehiclematerialgroupService.groupOrderCode();
|
||||||
|
// for (SchBaseVehiclematerialgroup schBaseVehiclematerialgroup : list) {
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<OrderMater> getOrderBycode(String regionCode) {
|
||||||
|
List<OrderMater> result = new ArrayList<>();
|
||||||
|
List<FabConsumptionDo> mWorkOrderInfos = fabRequestMapper.getMWorkOrderInfos(regionCode);
|
||||||
|
for (FabConsumptionDo mWorkOrderInfo : mWorkOrderInfos) {
|
||||||
|
OrderMater orderMater = new OrderMater();
|
||||||
|
result.add(orderMater);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void createAgvTask(JSONObject form,String type) {
|
||||||
|
JSONObject param = new JSONObject();
|
||||||
|
|
||||||
|
switch (type){
|
||||||
|
case "cmt":
|
||||||
|
CallMaterVo callMaterVo = form.toJavaObject(CallMaterVo.class);
|
||||||
|
param.put("device_code",callMaterVo.getDevice_code());
|
||||||
|
param.put("config_code","PcOperationCMTask");
|
||||||
|
param.put("vehicle_code",callMaterVo.getVehicle_code());
|
||||||
|
param.put("ext_data",callMaterVo);
|
||||||
|
pcOperationCMTask.apply(param);
|
||||||
|
break;
|
||||||
|
case "cnt":
|
||||||
|
CallEmpVo callEmpVo = form.toJavaObject(CallEmpVo.class);
|
||||||
|
param.put("device_code",callEmpVo.getDevice_code());
|
||||||
|
param.put("config_code","PcOperationCNTask");
|
||||||
|
param.put("ext_data",callEmpVo);
|
||||||
|
callEmptyTask.apply(param);
|
||||||
|
break;
|
||||||
|
case "smt":
|
||||||
|
SendMaterVo sendMaterVo = form.toJavaObject(SendMaterVo.class);
|
||||||
|
break;
|
||||||
|
case "snt":
|
||||||
|
SendVehicleVo sendVehicleVo = form.toJavaObject(SendVehicleVo.class);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -86,6 +86,11 @@ public class SchBaseVehiclematerialgroup implements Serializable {
|
|||||||
@ApiModelProperty(value = "额外信息")
|
@ApiModelProperty(value = "额外信息")
|
||||||
private String ext_data;
|
private String ext_data;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否已加工")
|
||||||
|
private Boolean has_work;
|
||||||
|
@ApiModelProperty(value = "交期时间")
|
||||||
|
private String dua_date;
|
||||||
|
|
||||||
@ApiModelProperty(value = "车间编码")
|
@ApiModelProperty(value = "车间编码")
|
||||||
private String workshop_code;
|
private String workshop_code;
|
||||||
|
|
||||||
|
|||||||
@@ -64,4 +64,7 @@ public class SchBaseRegion implements Serializable {
|
|||||||
@ApiModelProperty(value = "顺和号")
|
@ApiModelProperty(value = "顺和号")
|
||||||
private Integer order_seq;
|
private Integer order_seq;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "工序点位信息")
|
||||||
|
private String region_points;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,165 @@
|
|||||||
|
package org.nl.wms.sch.task_manage.task.tasks.pcoperation;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.common.enums.GoodsEnum;
|
||||||
|
import org.nl.common.exception.BadRequestException;
|
||||||
|
import org.nl.system.service.notice.ISysNoticeService;
|
||||||
|
import org.nl.wms.database.vehicle.service.IMdBaseVehicleService;
|
||||||
|
import org.nl.wms.database.vehicle.service.dao.MdBaseVehicle;
|
||||||
|
import org.nl.wms.ext.acs.service.dto.to.BaseResponse;
|
||||||
|
import org.nl.wms.ext.fab.service.dto.CallMaterVo;
|
||||||
|
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService;
|
||||||
|
import org.nl.wms.sch.point.service.ISchBasePointService;
|
||||||
|
import org.nl.wms.sch.point.service.dao.SchBasePoint;
|
||||||
|
import org.nl.wms.sch.task.service.ISchBaseTaskService;
|
||||||
|
import org.nl.wms.sch.task.service.ISchBaseTaskconfigService;
|
||||||
|
import org.nl.wms.sch.task.service.dao.SchBaseTask;
|
||||||
|
import org.nl.wms.sch.task_manage.AbstractTask;
|
||||||
|
import org.nl.wms.sch.task_manage.GeneralDefinition;
|
||||||
|
import org.nl.wms.sch.task_manage.enums.NoticeTypeEnum;
|
||||||
|
import org.nl.wms.sch.task_manage.enums.TaskFinishedTypeEnum;
|
||||||
|
import org.nl.wms.sch.task_manage.task.core.TaskStatus;
|
||||||
|
import org.nl.wms.util.PointUtils;
|
||||||
|
import org.nl.wms.util.TaskUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sorting呼叫满料
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component(value = "PcOperationCMTask")
|
||||||
|
public class PcOperationCMTask extends AbstractTask {
|
||||||
|
|
||||||
|
|
||||||
|
private static final String TASK_CONFIG_CODE = "PcOperationCMTask";
|
||||||
|
@Autowired
|
||||||
|
private ISchBasePointService pointService;
|
||||||
|
@Autowired
|
||||||
|
private ISchBaseTaskService taskService;
|
||||||
|
@Autowired
|
||||||
|
private ISysNoticeService noticeService;
|
||||||
|
@Autowired
|
||||||
|
private ISchBasePointService schBasePointService;
|
||||||
|
@Autowired
|
||||||
|
private IMdBaseVehicleService iMdBaseVehicleService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void create() throws BadRequestException {
|
||||||
|
// 获取任务:叫满眶时候已经确认物料
|
||||||
|
List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY);
|
||||||
|
for (SchBaseTask task : tasks) {
|
||||||
|
TaskUtils.setUpdateByAcs(task);
|
||||||
|
// 找起点
|
||||||
|
CallMaterVo callMaterVo = JSONObject.parseObject(task.getRequest_param(), CallMaterVo.class);
|
||||||
|
MdBaseVehicle vehicle = iMdBaseVehicleService.getOne(new QueryWrapper<MdBaseVehicle>().eq("vehicle_code", callMaterVo.getVehicle_code()));
|
||||||
|
if(ObjectUtil.isEmpty(vehicle)) throw new BadRequestException("载具不存在");
|
||||||
|
SchBasePoint structPoint = schBasePointService.getOne(new QueryWrapper<SchBasePoint>()
|
||||||
|
.eq("vehicle_code", vehicle)
|
||||||
|
.eq("is_lock",false));
|
||||||
|
if (ObjectUtil.isEmpty(structPoint)) {
|
||||||
|
task.setRemark("未找到所需点位!");
|
||||||
|
taskService.updateById(task);
|
||||||
|
// 消息通知
|
||||||
|
noticeService.createNotice("未找到所需点位!", TASK_CONFIG_CODE + task.getTask_code(),
|
||||||
|
NoticeTypeEnum.WARN.getCode());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
taskService.update(new UpdateWrapper<SchBaseTask>()
|
||||||
|
.set("task_status",TaskStatus.CREATED.getCode())
|
||||||
|
.set("point_code1",structPoint.getPoint_code())
|
||||||
|
.eq("task_id",task.getTask_id()));
|
||||||
|
pointService.update(new UpdateWrapper<SchBasePoint>()
|
||||||
|
.set("ing_task_code",task.getTask_code())
|
||||||
|
.set("is_lock",true)
|
||||||
|
.set("point_status", GoodsEnum.OUT_OF_STOCK.getValue())
|
||||||
|
.eq("point_code",structPoint.getPoint_code()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void updateStatus(String task_code, TaskStatus status) {
|
||||||
|
//TODO:完成任务的时候将int_task_code的清除
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void forceFinish(String task_code) {
|
||||||
|
SchBaseTask taskObj = taskService.getByCode(task_code);
|
||||||
|
if (ObjectUtil.isEmpty(taskObj)) {
|
||||||
|
throw new BadRequestException("该任务不存在");
|
||||||
|
}
|
||||||
|
this.finishTask(taskObj, TaskFinishedTypeEnum.MANUAL_CONNECTOR);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void cancel(String task_code) {
|
||||||
|
//TODO:取消任务的时候将int_task_code的清除
|
||||||
|
SchBaseTask taskObj = taskService.getByCode(task_code);
|
||||||
|
if (ObjectUtil.isEmpty(taskObj)) {
|
||||||
|
throw new BadRequestException("该任务不存在");
|
||||||
|
}
|
||||||
|
this.cancelTask(taskObj, TaskFinishedTypeEnum.MANUAL_CONNECTOR);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void feedbackTaskState(JSONObject param, SchBaseTask schBaseTask, BaseResponse result) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||||
|
// 获取参数
|
||||||
|
String startPoint = taskObj.getPoint_code1();
|
||||||
|
SchBasePoint schBasePoint = pointService.selectByPointCode(startPoint);
|
||||||
|
// 起点清空
|
||||||
|
if (ObjectUtil.isNotEmpty(schBasePoint)) {
|
||||||
|
PointUtils.updateByIngTaskCode(schBasePoint);
|
||||||
|
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, startPoint)
|
||||||
|
.set(SchBasePoint::getIs_lock, false).set(SchBasePoint::getVehicle_code,null));
|
||||||
|
}
|
||||||
|
String point_code2 = taskObj.getPoint_code2();
|
||||||
|
SchBasePoint schBasePoint2 = pointService.selectByPointCode(point_code2);
|
||||||
|
if (ObjectUtil.isNotEmpty(schBasePoint2)) {
|
||||||
|
PointUtils.updateByIngTaskCode(schBasePoint2);
|
||||||
|
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, point_code2)
|
||||||
|
.set(SchBasePoint::getIs_lock, false));
|
||||||
|
}
|
||||||
|
// 任务完成
|
||||||
|
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||||
|
taskObj.setRemark(GeneralDefinition.TASK_FINISH);
|
||||||
|
taskObj.setFinished_type(taskFinishedType.getCode());
|
||||||
|
TaskUtils.setUpdateByType(taskObj, taskFinishedType);
|
||||||
|
taskService.updateById(taskObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||||
|
// 获取参数
|
||||||
|
String startPoint = taskObj.getPoint_code1();
|
||||||
|
SchBasePoint schBasePoint = pointService.selectByPointCode(startPoint);
|
||||||
|
// 起点清空
|
||||||
|
if (ObjectUtil.isNotEmpty(schBasePoint)) {
|
||||||
|
PointUtils.updateByIngTaskCode(schBasePoint);
|
||||||
|
pointService.updateById(schBasePoint);
|
||||||
|
}
|
||||||
|
String point_code2 = taskObj.getPoint_code2();
|
||||||
|
SchBasePoint schBasePoint2 = pointService.selectByPointCode(point_code2);
|
||||||
|
if (ObjectUtil.isNotEmpty(schBasePoint2)) {
|
||||||
|
PointUtils.updateByIngTaskCode(schBasePoint2);
|
||||||
|
pointService.updateById(schBasePoint2);
|
||||||
|
}
|
||||||
|
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||||
|
taskObj.setRemark(GeneralDefinition.TASK_CANCEL);
|
||||||
|
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||||
|
taskObj.setFinished_type(taskFinishedType.getCode());
|
||||||
|
TaskUtils.setUpdateByType(taskObj, taskFinishedType);
|
||||||
|
taskService.updateById(taskObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,162 @@
|
|||||||
|
package org.nl.wms.sch.task_manage.task.tasks.pcoperation;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.common.enums.GoodsEnum;
|
||||||
|
import org.nl.common.enums.VehicleEnum;
|
||||||
|
import org.nl.common.enums.VehicleTypeEnum;
|
||||||
|
import org.nl.common.enums.region.RegionEnum;
|
||||||
|
import org.nl.common.exception.BadRequestException;
|
||||||
|
import org.nl.system.service.notice.ISysNoticeService;
|
||||||
|
import org.nl.wms.ext.acs.service.dto.to.BaseResponse;
|
||||||
|
import org.nl.wms.ext.fab.service.dto.CallEmpVo;
|
||||||
|
import org.nl.wms.ext.fab.service.dto.CallMaterVo;
|
||||||
|
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService;
|
||||||
|
import org.nl.wms.sch.point.service.ISchBasePointService;
|
||||||
|
import org.nl.wms.sch.point.service.dao.SchBasePoint;
|
||||||
|
import org.nl.wms.sch.task.service.ISchBaseTaskService;
|
||||||
|
import org.nl.wms.sch.task.service.ISchBaseTaskconfigService;
|
||||||
|
import org.nl.wms.sch.task.service.dao.SchBaseTask;
|
||||||
|
import org.nl.wms.sch.task_manage.AbstractTask;
|
||||||
|
import org.nl.wms.sch.task_manage.GeneralDefinition;
|
||||||
|
import org.nl.wms.sch.task_manage.enums.TaskFinishedTypeEnum;
|
||||||
|
import org.nl.wms.sch.task_manage.task.core.TaskStatus;
|
||||||
|
import org.nl.wms.util.PointUtils;
|
||||||
|
import org.nl.wms.util.TaskUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sorting呼叫空托
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component(value = "PcOperationCNTask")
|
||||||
|
public class PcOperationCNTask extends AbstractTask {
|
||||||
|
|
||||||
|
private static String Vehicle_Type = VehicleEnum.XL.getCode();
|
||||||
|
|
||||||
|
private static final String TASK_CONFIG_CODE = "PcOperationCNTask";
|
||||||
|
@Autowired
|
||||||
|
private ISchBasePointService pointService;
|
||||||
|
@Autowired
|
||||||
|
private ISchBaseTaskService taskService;
|
||||||
|
@Autowired
|
||||||
|
private ISchBaseTaskconfigService taskConfigService;
|
||||||
|
@Autowired
|
||||||
|
private ISysNoticeService noticeService;
|
||||||
|
@Autowired
|
||||||
|
private ISchBasePointService schBasePointService;
|
||||||
|
@Autowired
|
||||||
|
private ISchBaseVehiclematerialgroupService schBaseVehiclematerialgroupService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void create() throws BadRequestException {
|
||||||
|
// 获取任务
|
||||||
|
List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY);
|
||||||
|
for (SchBaseTask task : tasks) {
|
||||||
|
TaskUtils.setUpdateByAcs(task);
|
||||||
|
// 找起点
|
||||||
|
CallEmpVo callMaterVo = JSONObject.parseObject(task.getRequest_param(), CallEmpVo.class);
|
||||||
|
|
||||||
|
SchBasePoint basePoint = schBasePointService.selectByEmptyCage(RegionEnum.DDLK.getRegion_code(),
|
||||||
|
callMaterVo.getVehicle_type(),GoodsEnum.EMPTY_PALLETS.getValue(),false,task);
|
||||||
|
if (basePoint==null){
|
||||||
|
task.setRemark("未找到所需空料笼");
|
||||||
|
taskService.updateById(task);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
taskService.update(new UpdateWrapper<SchBaseTask>()
|
||||||
|
.set("task_status",TaskStatus.CREATED.getCode())
|
||||||
|
.set("point_code1",basePoint.getPoint_code()).eq("task_id",task.getTask_id()));
|
||||||
|
pointService.update(new UpdateWrapper<SchBasePoint>()
|
||||||
|
.set("ing_task_code",task.getTask_code())
|
||||||
|
.set("is_lock",true)
|
||||||
|
.set("point_status", GoodsEnum.OUT_OF_STOCK.getValue())
|
||||||
|
.eq("point_code",basePoint.getPoint_code()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void updateStatus(String task_code, TaskStatus status) {
|
||||||
|
//TODO:完成任务的时候将int_task_code的清除
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void forceFinish(String task_code) {
|
||||||
|
SchBaseTask taskObj = taskService.getByCode(task_code);
|
||||||
|
if (ObjectUtil.isEmpty(taskObj)) {
|
||||||
|
throw new BadRequestException("该任务不存在");
|
||||||
|
}
|
||||||
|
this.finishTask(taskObj, TaskFinishedTypeEnum.MANUAL_CONNECTOR);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void cancel(String task_code) {
|
||||||
|
//TODO:取消任务的时候将int_task_code的清除
|
||||||
|
SchBaseTask taskObj = taskService.getByCode(task_code);
|
||||||
|
if (ObjectUtil.isEmpty(taskObj)) {
|
||||||
|
throw new BadRequestException("该任务不存在");
|
||||||
|
}
|
||||||
|
this.cancelTask(taskObj, TaskFinishedTypeEnum.MANUAL_CONNECTOR);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void feedbackTaskState(JSONObject param, SchBaseTask schBaseTask, BaseResponse result) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||||
|
// 获取参数
|
||||||
|
String startPoint = taskObj.getPoint_code1();
|
||||||
|
SchBasePoint schBasePoint = pointService.selectByPointCode(startPoint);
|
||||||
|
// 起点清空
|
||||||
|
if (ObjectUtil.isNotEmpty(schBasePoint)) {
|
||||||
|
PointUtils.updateByIngTaskCode(schBasePoint);
|
||||||
|
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, startPoint)
|
||||||
|
.set(SchBasePoint::getIs_lock, false).set(SchBasePoint::getVehicle_code,null));
|
||||||
|
}
|
||||||
|
String point_code2 = taskObj.getPoint_code2();
|
||||||
|
SchBasePoint schBasePoint2 = pointService.selectByPointCode(point_code2);
|
||||||
|
if (ObjectUtil.isNotEmpty(schBasePoint2)) {
|
||||||
|
PointUtils.updateByIngTaskCode(schBasePoint2);
|
||||||
|
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, point_code2)
|
||||||
|
.set(SchBasePoint::getIs_lock, false));
|
||||||
|
}
|
||||||
|
// 任务完成
|
||||||
|
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||||
|
taskObj.setRemark(GeneralDefinition.TASK_FINISH);
|
||||||
|
taskObj.setFinished_type(taskFinishedType.getCode());
|
||||||
|
TaskUtils.setUpdateByType(taskObj, taskFinishedType);
|
||||||
|
taskService.updateById(taskObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||||
|
// 获取参数
|
||||||
|
String startPoint = taskObj.getPoint_code1();
|
||||||
|
SchBasePoint schBasePoint = pointService.selectByPointCode(startPoint);
|
||||||
|
// 起点清空
|
||||||
|
if (ObjectUtil.isNotEmpty(schBasePoint)) {
|
||||||
|
PointUtils.updateByIngTaskCode(schBasePoint);
|
||||||
|
pointService.updateById(schBasePoint);
|
||||||
|
}
|
||||||
|
String point_code2 = taskObj.getPoint_code2();
|
||||||
|
SchBasePoint schBasePoint2 = pointService.selectByPointCode(point_code2);
|
||||||
|
if (ObjectUtil.isNotEmpty(schBasePoint2)) {
|
||||||
|
PointUtils.updateByIngTaskCode(schBasePoint2);
|
||||||
|
pointService.updateById(schBasePoint2);
|
||||||
|
}
|
||||||
|
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||||
|
taskObj.setRemark(GeneralDefinition.TASK_CANCEL);
|
||||||
|
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||||
|
taskObj.setFinished_type(taskFinishedType.getCode());
|
||||||
|
TaskUtils.setUpdateByType(taskObj, taskFinishedType);
|
||||||
|
taskService.updateById(taskObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,190 @@
|
|||||||
|
package org.nl.wms.sch.task_manage.task.tasks.pcoperation;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.nl.common.enums.GoodsEnum;
|
||||||
|
import org.nl.common.enums.region.RegionEnum;
|
||||||
|
import org.nl.common.exception.BadRequestException;
|
||||||
|
import org.nl.system.service.notice.ISysNoticeService;
|
||||||
|
import org.nl.wms.ext.acs.service.dto.to.BaseResponse;
|
||||||
|
import org.nl.wms.ext.fab.service.dto.CallEmpVo;
|
||||||
|
import org.nl.wms.ext.fab.service.dto.SendMaterVo;
|
||||||
|
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService;
|
||||||
|
import org.nl.wms.sch.group.service.dao.SchBaseVehiclematerialgroup;
|
||||||
|
import org.nl.wms.sch.point.service.ISchBasePointService;
|
||||||
|
import org.nl.wms.sch.point.service.dao.SchBasePoint;
|
||||||
|
import org.nl.wms.sch.task.service.ISchBaseTaskService;
|
||||||
|
import org.nl.wms.sch.task.service.ISchBaseTaskconfigService;
|
||||||
|
import org.nl.wms.sch.task.service.dao.SchBaseTask;
|
||||||
|
import org.nl.wms.sch.task.service.dao.SchBaseTaskconfig;
|
||||||
|
import org.nl.wms.sch.task_manage.AbstractTask;
|
||||||
|
import org.nl.wms.sch.task_manage.GeneralDefinition;
|
||||||
|
import org.nl.wms.sch.task_manage.enums.NoticeTypeEnum;
|
||||||
|
import org.nl.wms.sch.task_manage.enums.TaskFinishedTypeEnum;
|
||||||
|
import org.nl.wms.sch.task_manage.task.core.TaskStatus;
|
||||||
|
import org.nl.wms.util.PointUtils;
|
||||||
|
import org.nl.wms.util.TaskUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sorting将满料放到线边库
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component(value = "PcOperationSMTTask")
|
||||||
|
public class PcOperationSMTTask extends AbstractTask {
|
||||||
|
|
||||||
|
|
||||||
|
private static final String TASK_CONFIG_CODE = "PcOperationSMTTask";
|
||||||
|
@Autowired
|
||||||
|
private ISchBasePointService pointService;
|
||||||
|
@Autowired
|
||||||
|
private ISchBaseTaskService taskService;
|
||||||
|
@Autowired
|
||||||
|
private ISchBaseTaskconfigService taskConfigService;
|
||||||
|
@Autowired
|
||||||
|
private ISysNoticeService noticeService;
|
||||||
|
@Autowired
|
||||||
|
private ISchBasePointService schBasePointService;
|
||||||
|
@Autowired
|
||||||
|
private ISchBaseVehiclematerialgroupService schBaseVehiclematerialgroupService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void create() throws BadRequestException {
|
||||||
|
// 获取任务
|
||||||
|
List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY);
|
||||||
|
|
||||||
|
for (SchBaseTask task : tasks) {
|
||||||
|
TaskUtils.setUpdateByAcs(task);
|
||||||
|
// 找起点
|
||||||
|
SendMaterVo sendMaterVo = JSONObject.parseObject(task.getRequest_param(), SendMaterVo.class);
|
||||||
|
//判断是否指定到外协区
|
||||||
|
String targetRegionCode = sendMaterVo.getTarget_region_code();
|
||||||
|
SchBasePoint schBasePoint = null;
|
||||||
|
if (!StringUtils.isEmpty(targetRegionCode)){
|
||||||
|
|
||||||
|
}else {
|
||||||
|
// 根据对接位查找对应的载具类型
|
||||||
|
schBasePoint = schBasePointService.selectByRegionCode(task.getRegion_code(),task.getVehicle_code(),"1");
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isEmpty(schBasePoint)) {
|
||||||
|
task.setRemark("未找到所需点位!");
|
||||||
|
taskService.updateById(task);
|
||||||
|
// 消息通知
|
||||||
|
noticeService.createNotice("未找到所需点位!", TASK_CONFIG_CODE + task.getTask_code(),
|
||||||
|
NoticeTypeEnum.WARN.getCode());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//删除组盘记录生成新的
|
||||||
|
schBaseVehiclematerialgroupService.remove(new QueryWrapper<SchBaseVehiclematerialgroup>().eq("vehicle_code",sendMaterVo.getVehicle_code()));
|
||||||
|
SchBaseVehiclematerialgroup schBaseVehiclematerialgroup = new SchBaseVehiclematerialgroup();
|
||||||
|
schBaseVehiclematerialgroup.setVehicle_code(sendMaterVo.getVehicle_code());
|
||||||
|
schBaseVehiclematerialgroup.setPoint_code(schBasePoint.getPoint_code());
|
||||||
|
schBaseVehiclematerialgroup.setMaterial_id(sendMaterVo.getMaterial_id());
|
||||||
|
schBaseVehiclematerialgroup.setMaterial_qty(sendMaterVo.getMaterial_qty());
|
||||||
|
schBaseVehiclematerialgroup.setRegion_code(sendMaterVo.getRegion_code());
|
||||||
|
schBaseVehiclematerialgroup.setOrder_code(sendMaterVo.getOrder_code());
|
||||||
|
schBaseVehiclematerialgroup.setHas_work(true);
|
||||||
|
schBaseVehiclematerialgroupService.create(schBaseVehiclematerialgroup);
|
||||||
|
// 设置终点并修改创建成功状态
|
||||||
|
task.setPoint_code2(schBasePoint.getPoint_code());
|
||||||
|
task.setVehicle_type(schBasePoint.getCan_vehicle_type());
|
||||||
|
task.setRemark("");
|
||||||
|
task.setTask_status(TaskStatus.CREATED.getCode());
|
||||||
|
taskService.updateById(task);
|
||||||
|
|
||||||
|
//更新点位
|
||||||
|
schBasePoint.setPoint_status(GoodsEnum.IN_STOCK.getValue());
|
||||||
|
schBasePoint.setIng_task_code(task.getTask_code());
|
||||||
|
PointUtils.setUpdateByAcs(schBasePoint);
|
||||||
|
pointService.updateById(schBasePoint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void updateStatus(String task_code, TaskStatus status) {
|
||||||
|
//TODO:完成任务的时候将int_task_code的清除
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void forceFinish(String task_code) {
|
||||||
|
SchBaseTask taskObj = taskService.getByCode(task_code);
|
||||||
|
if (ObjectUtil.isEmpty(taskObj)) {
|
||||||
|
throw new BadRequestException("该任务不存在");
|
||||||
|
}
|
||||||
|
this.finishTask(taskObj, TaskFinishedTypeEnum.MANUAL_CONNECTOR);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void cancel(String task_code) {
|
||||||
|
//TODO:取消任务的时候将int_task_code的清除
|
||||||
|
SchBaseTask taskObj = taskService.getByCode(task_code);
|
||||||
|
if (ObjectUtil.isEmpty(taskObj)) {
|
||||||
|
throw new BadRequestException("该任务不存在");
|
||||||
|
}
|
||||||
|
this.cancelTask(taskObj, TaskFinishedTypeEnum.MANUAL_CONNECTOR);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void feedbackTaskState(JSONObject param, SchBaseTask schBaseTask, BaseResponse result) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||||
|
// 获取参数
|
||||||
|
String startPoint = taskObj.getPoint_code1();
|
||||||
|
SchBasePoint schBasePoint = pointService.selectByPointCode(startPoint);
|
||||||
|
// 起点清空
|
||||||
|
if (ObjectUtil.isNotEmpty(schBasePoint)) {
|
||||||
|
PointUtils.updateByIngTaskCode(schBasePoint);
|
||||||
|
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, startPoint)
|
||||||
|
.set(SchBasePoint::getIs_lock, false));
|
||||||
|
}
|
||||||
|
String point_code2 = taskObj.getPoint_code2();
|
||||||
|
SchBasePoint schBasePoint2 = pointService.selectByPointCode(point_code2);
|
||||||
|
if (ObjectUtil.isNotEmpty(schBasePoint2)) {
|
||||||
|
PointUtils.updateByIngTaskCode(schBasePoint2);
|
||||||
|
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, point_code2)
|
||||||
|
.set(SchBasePoint::getIs_lock, false));
|
||||||
|
}
|
||||||
|
// 任务完成
|
||||||
|
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||||
|
taskObj.setRemark(GeneralDefinition.TASK_FINISH);
|
||||||
|
taskObj.setFinished_type(taskFinishedType.getCode());
|
||||||
|
TaskUtils.setUpdateByType(taskObj, taskFinishedType);
|
||||||
|
taskService.updateById(taskObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||||
|
// 获取参数
|
||||||
|
String startPoint = taskObj.getPoint_code1();
|
||||||
|
SchBasePoint schBasePoint = pointService.selectByPointCode(startPoint);
|
||||||
|
// 起点清空
|
||||||
|
if (ObjectUtil.isNotEmpty(schBasePoint)) {
|
||||||
|
PointUtils.updateByIngTaskCode(schBasePoint);
|
||||||
|
pointService.updateById(schBasePoint);
|
||||||
|
}
|
||||||
|
String point_code2 = taskObj.getPoint_code2();
|
||||||
|
SchBasePoint schBasePoint2 = pointService.selectByPointCode(point_code2);
|
||||||
|
if (ObjectUtil.isNotEmpty(schBasePoint2)) {
|
||||||
|
PointUtils.updateByIngTaskCode(schBasePoint2);
|
||||||
|
pointService.updateById(schBasePoint2);
|
||||||
|
}
|
||||||
|
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||||
|
taskObj.setRemark(GeneralDefinition.TASK_CANCEL);
|
||||||
|
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||||
|
taskObj.setFinished_type(taskFinishedType.getCode());
|
||||||
|
TaskUtils.setUpdateByType(taskObj, taskFinishedType);
|
||||||
|
taskService.updateById(taskObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -2,48 +2,43 @@ server:
|
|||||||
port: 8010
|
port: 8010
|
||||||
#配置数据源
|
#配置数据源
|
||||||
spring:
|
spring:
|
||||||
|
autoconfigure:
|
||||||
|
exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
|
||||||
datasource:
|
datasource:
|
||||||
druid:
|
dynamic:
|
||||||
db-type: com.alibaba.druid.pool.DruidDataSource
|
primary: mysql
|
||||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
datasource:
|
||||||
url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.251}:${DB_PORT:3306}/${DB_NAME:ximenzi_lms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
mysql:
|
||||||
# url: jdbc:log4jdbc:mysql://${DB_HOST:47.111.78.178}:${DB_PORT:3306}/${DB_NAME:stand_lms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||||
username: ${DB_USER:root}
|
url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.251}:${DB_PORT:3306}/${DB_NAME:ximenzi_lms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||||
password: ${DB_PWD:123456}
|
username: ${DB_USER:root}
|
||||||
# password: ${DB_PWD:P@ssw0rd}
|
password: ${DB_PWD:123456}
|
||||||
# 初始连接数
|
type: com.alibaba.druid.pool.DruidDataSource
|
||||||
initial-size: 5
|
# sqlserver:
|
||||||
# 最小连接数
|
# driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
|
||||||
min-idle: 15
|
# url: jdbc:sqlserver://10.93.41.2\WINCC;DatabaseName=马钢_RH
|
||||||
# 最大连接数
|
# username: ${DB_USER:sa}
|
||||||
max-active: 30
|
# password: ${DB_PWD:123}
|
||||||
# 超时时间(以秒数为单位)
|
# type: com.alibaba.druid.pool.DruidDataSource
|
||||||
remove-abandoned-timeout: 180
|
druid:
|
||||||
# 获取连接超时时间
|
filters:
|
||||||
max-wait: 9000
|
DruidFilter,stat
|
||||||
# 连接有效性检测时间
|
initial-size: 5 #初始化时建立物理连接的个数
|
||||||
time-between-eviction-runs-millis: 60000
|
min-idle: 15 #最小连接池数量
|
||||||
# 连接在池中最小生存的时间
|
maxActive: 30 #最大连接池数量
|
||||||
min-evictable-idle-time-millis: 300000
|
maxWait: 3000 #获取连接时最大等待时间,单位毫秒
|
||||||
# 连接在池中最大生存的时间
|
#申请连接的时候检测,如果空闲时间大于timeBetweenEvictionRunsMillis,执行validationQuery检测连接是否有效。
|
||||||
max-evictable-idle-time-millis: 900000
|
test-while-idle: true
|
||||||
# 指明连接是否被空闲连接回收器(如果有)进行检验.如果检测失败,则连接将被从池中去除
|
time-between-eviction-runs-millis: 300000 #既作为检测的间隔时间又作为test-while-idle执行的依据
|
||||||
test-while-idle: true
|
min-evictable-idle-time-millis: 900000 #销毁线程时检测当前连接的最后活动时间和当前时间差大于该值时,关闭当前连接
|
||||||
# 指明是否在从池中取出连接前进行检验,如果检验失败, 则从池中去除连接并尝试取出另一个
|
#用来检测连接是否有效的sql
|
||||||
test-on-borrow: true
|
#mysql中为 select 'x'
|
||||||
# 是否在归还到池中前进行检验
|
#oracle中为 select 1 from dual
|
||||||
test-on-return: false
|
validation-query: SELECT 'x' FROM DUAL
|
||||||
# 检测连接是否有效
|
test-on-borrow: true #申请连接时会执行validationQuery检测连接是否有效,开启会降低性能,默认为true
|
||||||
validation-query: select 1
|
test-on-return: false #归还连接时会执行validationQuery检测连接是否有效,开启会降低性能,默认为true
|
||||||
# 配置监控统计
|
pool-prepared-statements: true #是否缓存preparedStatement,mysql5.5+建议开启
|
||||||
webStatFilter:
|
max-pool-prepared-statement-per-connection-size: 20 #当值大于20时poolPreparedStatements会自动修改为true
|
||||||
enabled: true
|
|
||||||
stat-view-servlet:
|
|
||||||
enabled: true
|
|
||||||
url-pattern: /druid/*
|
|
||||||
reset-enable: fapi/esLog/labelsalse
|
|
||||||
filters:
|
|
||||||
DruidFilter,stat
|
|
||||||
redis:
|
redis:
|
||||||
#数据库索引
|
#数据库索引
|
||||||
database: ${REDIS_DB:2}
|
database: ${REDIS_DB:2}
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
ALTER TABLE sch_base_vehiclematerialgroup
|
||||||
|
ADD COLUMN `due_date` varchar(63) DEFAULT null COMMENT '交期';
|
||||||
|
ADD COLUMN `has_work` tinyint(1) DEFAULT 0 COMMENT '当前工序已加工判断防止重复生产';
|
||||||
Reference in New Issue
Block a user