fix: mes接口修改
This commit is contained in:
@@ -42,5 +42,5 @@ public class LogMessageConstant {
|
||||
public final static String BACKGROUND_YELLOW = "\u001B[43m";
|
||||
|
||||
/** 索引路径 */
|
||||
public final static String INDEX_DIR = "E:\\lucene\\index";
|
||||
public final static String INDEX_DIR = "D:\\lucene\\index";
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package org.nl.wms.cockpit.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.cockpit.service.CockpitService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 看板
|
||||
* @Date: 2023/9/25
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "看板接口")
|
||||
@RequestMapping("/api/cockpit")
|
||||
@SaIgnore
|
||||
public class CockPitController {
|
||||
|
||||
@Autowired
|
||||
private CockpitService cockpitService;
|
||||
|
||||
@PostMapping("/press")
|
||||
@Log("压制看板")
|
||||
@ApiOperation("压制看板")
|
||||
public ResponseEntity<Object> PressedMonitor(){
|
||||
return new ResponseEntity<>(cockpitService.PressedMonitor(), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.nl.wms.cockpit.service;
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 看板
|
||||
* @Date: 2023/9/25
|
||||
*/
|
||||
public interface CockpitService {
|
||||
/**
|
||||
* 压制看板
|
||||
* @return
|
||||
*/
|
||||
ConcurrentHashMap<String,Object> PressedMonitor();
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package org.nl.wms.cockpit.service.dao;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 月生产总值
|
||||
* @Date: 2023/9/25
|
||||
*/
|
||||
@Data
|
||||
public class PersonnelMonthlyProductionVo {
|
||||
private String operator;
|
||||
private String real_qty;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.nl.wms.cockpit.service.dao;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 当前班次、计划生产、已生产、不合格产品数
|
||||
* @Date: 2023/9/25
|
||||
*/
|
||||
@Data
|
||||
public class PressProductHeaderVo {
|
||||
private String plan_qty;
|
||||
private String real_qty;
|
||||
private String unqualified_qty;
|
||||
private String qualified_qty;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package org.nl.wms.cockpit.service.dao;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 生产任务
|
||||
* @Date: 2023/9/25
|
||||
*/
|
||||
@Data
|
||||
public class ProductTaskVo {
|
||||
private String device;
|
||||
private String workorder_code;
|
||||
private String team;
|
||||
private String material_name;
|
||||
private String planproducestart_date;
|
||||
private String plan_qty;
|
||||
private String real_qty;
|
||||
private String unqualified_qty;
|
||||
private String qualified_rate;
|
||||
private String workorder_status;
|
||||
private String operator;
|
||||
private String realproducestart_date;
|
||||
private String realproduceend_date;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.nl.wms.cockpit.service.dao;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 当班生产VO
|
||||
* @Date: 2023/9/25
|
||||
*/
|
||||
@Data
|
||||
public class ShiftProductionVo {
|
||||
private String column_name;
|
||||
private String qualified_qty;
|
||||
private String unqualified_qty;
|
||||
private String total_difference;
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package org.nl.wms.cockpit.service.impl;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.config.thread.ThreadPoolExecutorUtil;
|
||||
import org.nl.wms.cockpit.service.CockpitService;
|
||||
import org.nl.wms.cockpit.service.dao.PersonnelMonthlyProductionVo;
|
||||
import org.nl.wms.cockpit.service.dao.PressProductHeaderVo;
|
||||
import org.nl.wms.cockpit.service.dao.ProductTaskVo;
|
||||
import org.nl.wms.cockpit.service.dao.ShiftProductionVo;
|
||||
import org.nl.wms.cockpit.service.mapper.CockPitMapper;
|
||||
import org.nl.wms.util.CommonUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description:
|
||||
* @Date: 2023/9/25
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class CockpitServiceImpl implements CockpitService {
|
||||
@Autowired
|
||||
private CockPitMapper cockPitMapper;
|
||||
@Override
|
||||
public ConcurrentHashMap<String, Object> PressedMonitor() {
|
||||
ThreadPoolExecutor pool = ThreadPoolExecutorUtil.getPoll();
|
||||
ConcurrentHashMap<String, Object> map = new ConcurrentHashMap<>();
|
||||
// 1、当前班次、计划生产、已生产、不合格产品数
|
||||
String dayShift = CommonUtils.getDayShift(); // 白班、晚班
|
||||
map.put("DayShift", dayShift);
|
||||
CompletableFuture<List<PressProductHeaderVo>> listCompletableFuture = CompletableFuture.supplyAsync(
|
||||
() -> cockPitMapper.getPressProductHeaderList(dayShift), pool);
|
||||
listCompletableFuture.thenAccept(result -> {
|
||||
map.put("DayShiftList", result);
|
||||
}).exceptionally((e) -> {
|
||||
log.error("获取当班信息: {}", e.getMessage(), e);
|
||||
map.put("DayShiftList", null);
|
||||
return null;
|
||||
});
|
||||
// 2、当班生产
|
||||
CompletableFuture<List<ShiftProductionVo>> listShiftProductionFuture = CompletableFuture.supplyAsync(
|
||||
() -> cockPitMapper.getShiftProductionList(dayShift), pool);
|
||||
listShiftProductionFuture.thenAccept(result -> {
|
||||
map.put("ShiftProductionList", result);
|
||||
}).exceptionally((e) -> {
|
||||
log.error("当班生产: {}", e.getMessage(), e);
|
||||
map.put("ShiftProductionList", null);
|
||||
return null;
|
||||
});
|
||||
// 3、人员月生产
|
||||
CompletableFuture<List<PersonnelMonthlyProductionVo>> listPersonnelMonthlyProductionFuture = CompletableFuture.supplyAsync(
|
||||
() -> cockPitMapper.getPersonnelMonthlyProductionList(dayShift), pool);
|
||||
listPersonnelMonthlyProductionFuture.thenAccept(result -> {
|
||||
map.put("PersonnelMonthlyProduction", result);
|
||||
}).exceptionally((e) -> {
|
||||
log.error("人员月生产: {}", e.getMessage(), e);
|
||||
map.put("PersonnelMonthlyProduction", null);
|
||||
return null;
|
||||
});
|
||||
// 4、生产任务
|
||||
CompletableFuture<List<ProductTaskVo>> listProductionTaskFuture = CompletableFuture.supplyAsync(
|
||||
() -> cockPitMapper.getProductionTaskList(), pool);
|
||||
listProductionTaskFuture.thenAccept(result -> {
|
||||
map.put("ProductionTask", result);
|
||||
}).exceptionally((e) -> {
|
||||
log.error("生产任务: {}", e.getMessage(), e);
|
||||
map.put("ProductionTask", null);
|
||||
return null;
|
||||
});
|
||||
// 提交
|
||||
CompletableFuture<Void> allQuery = CompletableFuture.allOf(
|
||||
listCompletableFuture,
|
||||
listShiftProductionFuture,
|
||||
listPersonnelMonthlyProductionFuture,
|
||||
listProductionTaskFuture);
|
||||
CompletableFuture<ConcurrentHashMap<String, Object>> future
|
||||
= allQuery.thenApply((result) -> map).exceptionally((e) -> {
|
||||
log.error(e.getMessage(), e);
|
||||
return null;
|
||||
});
|
||||
future.join();
|
||||
return map;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package org.nl.wms.cockpit.service.mapper;
|
||||
|
||||
import org.nl.wms.cockpit.service.dao.PersonnelMonthlyProductionVo;
|
||||
import org.nl.wms.cockpit.service.dao.PressProductHeaderVo;
|
||||
import org.nl.wms.cockpit.service.dao.ProductTaskVo;
|
||||
import org.nl.wms.cockpit.service.dao.ShiftProductionVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description:
|
||||
* @Date: 2023/9/25
|
||||
*/
|
||||
public interface CockPitMapper {
|
||||
List<PressProductHeaderVo> getPressProductHeaderList(String dayShift);
|
||||
|
||||
List<ShiftProductionVo> getShiftProductionList(String dayShift);
|
||||
|
||||
List<PersonnelMonthlyProductionVo> getPersonnelMonthlyProductionList(String dayShift);
|
||||
|
||||
List<ProductTaskVo> getProductionTaskList();
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
<?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.cockpit.service.mapper.CockPitMapper">
|
||||
<select id="getPressProductHeaderList" resultType="org.nl.wms.cockpit.service.dao.PressProductHeaderVo">
|
||||
SELECT
|
||||
SUM(w.plan_qty) AS plan_qty,
|
||||
SUM(w.real_qty) AS real_qty,
|
||||
SUM(w.qualified_qty) AS qualified_qty,
|
||||
SUM(w.unqualified_qty) AS unqualified_qty
|
||||
FROM
|
||||
pdm_bd_workorder w
|
||||
WHERE
|
||||
DATE( w.produce_date ) = CURDATE() AND w.team = #{dayShift};
|
||||
</select>
|
||||
<select id="getShiftProductionList" resultType="org.nl.wms.cockpit.service.dao.ShiftProductionVo">
|
||||
SELECT
|
||||
w.point_name AS column_name,
|
||||
SUM(w.qualified_qty) AS qualified_qty,
|
||||
SUM(w.unqualified_qty) AS unqualified_qty,
|
||||
SUM(w.plan_qty - w.qualified_qty - w.unqualified_qty) AS total_difference
|
||||
FROM
|
||||
`pdm_bd_workorder` w
|
||||
WHERE
|
||||
DATE( w.produce_date ) = CURDATE()
|
||||
AND w.team = #{dayShift}
|
||||
GROUP BY w.point_name
|
||||
</select>
|
||||
<select id="getPersonnelMonthlyProductionList"
|
||||
resultType="org.nl.wms.cockpit.service.dao.PersonnelMonthlyProductionVo">
|
||||
SELECT
|
||||
w.operator,
|
||||
SUM(w.real_qty) AS real_qty
|
||||
FROM
|
||||
`pdm_bd_workorder` w
|
||||
WHERE DATE_FORMAT(w.produce_date, '%Y-%m') = DATE_FORMAT(CURDATE(), '%Y-%m') AND w.team = '白班'
|
||||
GROUP BY w.operator
|
||||
</select>
|
||||
<select id="getProductionTaskList" resultType="org.nl.wms.cockpit.service.dao.ProductTaskVo">
|
||||
SELECT
|
||||
w.point_name AS device,
|
||||
w.workorder_code,
|
||||
w.team,
|
||||
m.material_name,
|
||||
w.planproducestart_date,
|
||||
w.plan_qty,
|
||||
w.real_qty,
|
||||
w.unqualified_qty,
|
||||
((w.qualified_qty / w.plan_qty) * 100) AS qualified_rate,
|
||||
CASE w.workorder_status
|
||||
WHEN '1' THEN '未生产'
|
||||
WHEN '2' THEN '已下发'
|
||||
WHEN '3' THEN '生产中'
|
||||
WHEN '4' THEN '暂停'
|
||||
WHEN '5' THEN '完成'
|
||||
ELSE ''
|
||||
END AS workorder_status,
|
||||
w.operator,
|
||||
IF(LENGTH(w.realproducestart_date)>0,w.realproducestart_date,'-') AS realproducestart_date,
|
||||
IF(LENGTH(w.realproduceend_date)>0,w.realproduceend_date,'-') AS realproduceend_date
|
||||
FROM
|
||||
`pdm_bd_workorder` w
|
||||
LEFT JOIN md_base_material m ON m.material_id = w.material_id
|
||||
ORDER BY w.team DESC, w.workorder_status
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -53,4 +53,18 @@ public interface IMdBaseBrickInfoService extends IService<MdBaseBrickInfo> {
|
||||
* @param deviceCode : 放砖位置-压制对接位
|
||||
*/
|
||||
void setGroupByCurrentAllBrick(String deviceCode, String groupId);
|
||||
|
||||
/**
|
||||
* 工单合格数量
|
||||
* @param workorderCode
|
||||
* @return
|
||||
*/
|
||||
int getCountQualifiedQty(String workorderCode);
|
||||
|
||||
/**
|
||||
* 工单不合格数量
|
||||
* @param workorderCode
|
||||
* @return
|
||||
*/
|
||||
int getCountUnqualifiedQty(String workorderCode);
|
||||
}
|
||||
|
||||
@@ -9,4 +9,12 @@ import org.nl.wms.database.brick.service.dao.MdBaseBrickInfo;
|
||||
**/
|
||||
public interface MdBaseBrickInfoMapper extends BaseMapper<MdBaseBrickInfo> {
|
||||
|
||||
/**
|
||||
* 合格数
|
||||
* @param workorderCode
|
||||
* @return
|
||||
*/
|
||||
int getCountQualifiedQty(String workorderCode);
|
||||
|
||||
int getCountUnqualifiedQty(String workorderCode);
|
||||
}
|
||||
|
||||
@@ -2,4 +2,18 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.nl.wms.database.brick.service.dao.mapper.MdBaseBrickInfoMapper">
|
||||
|
||||
<select id="getCountQualifiedQty" resultType="java.lang.Integer">
|
||||
SELECT
|
||||
COUNT(*)
|
||||
FROM
|
||||
`md_base_brick_info` mi
|
||||
WHERE mi.workorder_code = #{workorderCode} AND mi.put_station LIKE CONCAT(mi.get_station, '%')
|
||||
</select>
|
||||
<select id="getCountUnqualifiedQty" resultType="java.lang.Integer">
|
||||
SELECT
|
||||
COUNT(*)
|
||||
FROM
|
||||
`md_base_brick_info` mi
|
||||
WHERE mi.workorder_code = #{workorderCode} AND mi.put_station LIKE 'YZBHGW%'
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -78,6 +78,16 @@ public class MdBaseBrickInfoServiceImpl extends ServiceImpl<MdBaseBrickInfoMappe
|
||||
.eq(MdBaseBrickInfo::getIs_group, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCountQualifiedQty(String workorderCode) {
|
||||
return mdBaseBrickInfoMapper.getCountQualifiedQty(workorderCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCountUnqualifiedQty(String workorderCode) {
|
||||
return mdBaseBrickInfoMapper.getCountUnqualifiedQty(workorderCode);
|
||||
}
|
||||
|
||||
private MdBaseBrickInfo toBrickInfoMapper(BrickInfoDto dto) {
|
||||
// 获取压机工单
|
||||
PdmBdWorkorder productionTask = workorderService.getDeviceProductionTask(dto.getGet_station());
|
||||
|
||||
@@ -495,6 +495,11 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
bdWorkorder.setWorkorder_status(WorkOrderStatusEnum.COMPLETE.getCode());
|
||||
bdWorkorder.setRealproduceend_date(DateUtil.now());
|
||||
TaskUtils.setWorkOrderUpdateByAcs(bdWorkorder);
|
||||
// 统计合不合格数量到工单字段中
|
||||
int qualified_qty = baseBrickInfoService.getCountQualifiedQty(bdWorkorder.getWorkorder_code());
|
||||
int unqualified_qty = baseBrickInfoService.getCountUnqualifiedQty(bdWorkorder.getWorkorder_code());
|
||||
bdWorkorder.setQualified_qty(qualified_qty);
|
||||
bdWorkorder.setUnqualified_qty(unqualified_qty);
|
||||
workorderService.updateById(bdWorkorder);
|
||||
// todo: 统计当前设备的不合格位置的数量作为不合格数,并上报给mes
|
||||
wmsToMesService.reportPressUnusedMaterial(bdWorkorder);
|
||||
@@ -504,23 +509,34 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
/**
|
||||
* 扫码成功申请 - 判断是否静置完成
|
||||
*/
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public ApplyTaskResponse barcodeSuccessApply(JSONObject param) {
|
||||
ApplyTaskRequest baseRequest = param.toJavaObject(ApplyTaskRequest.class);
|
||||
ApplyTaskResponse taskResponse = ApplyTaskResponse.responseOk(baseRequest.getRequestNo());
|
||||
String deviceCode = baseRequest.getDevice_code();
|
||||
SchBasePoint basePoint = pointService.getById(deviceCode); // 获取点位实体
|
||||
switch (basePoint.getRegion_code()) {
|
||||
case GeneralDefinition.LZKLX: // 如果是困料线位置就是判断是否静置完成
|
||||
return this.isStandingFinish(baseRequest); // 直接返回
|
||||
case GeneralDefinition.GZY: // 如果是入窑口就是记录数据
|
||||
return this.recordKilnTime(baseRequest); // 直接返回
|
||||
default:
|
||||
taskResponse.setMessage("参数错误!");
|
||||
taskResponse.setCode(HttpStatus.HTTP_BAD_REQUEST);
|
||||
return taskResponse;
|
||||
RLock lock = redissonClient.getLock(deviceCode);
|
||||
boolean tryLock = lock.tryLock(5, TimeUnit.SECONDS);
|
||||
try {
|
||||
if (tryLock) {
|
||||
SchBasePoint basePoint = pointService.getById(deviceCode); // 获取点位实体
|
||||
switch (basePoint.getRegion_code()) {
|
||||
case GeneralDefinition.LZKLX: // 如果是困料线位置就是判断是否静置完成
|
||||
return this.isStandingFinish(baseRequest); // 直接返回
|
||||
case GeneralDefinition.GZY: // 如果是入窑口就是记录数据
|
||||
return this.recordKilnTime(baseRequest); // 直接返回
|
||||
default:
|
||||
taskResponse.setMessage("参数错误!");
|
||||
taskResponse.setCode(HttpStatus.HTTP_BAD_REQUEST);
|
||||
return taskResponse;
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
if (tryLock) {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -802,45 +818,58 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
/**
|
||||
* 实时修改点位状态
|
||||
*/
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public BaseResponse realTimeSetPoint(JSONObject param) {
|
||||
log.info("ACS修改点位状态:{}", param);
|
||||
ApplySignalStatusRequest actionRequest = param.toJavaObject(ApplySignalStatusRequest.class);
|
||||
String deviceCode = actionRequest.getDevice_code();
|
||||
String move = null;
|
||||
if (ObjectUtil.isNotEmpty(actionRequest.getMove())) {
|
||||
move = (Integer.parseInt(actionRequest.getMove()) + 1) + "";
|
||||
RLock lock = redissonClient.getLock(deviceCode);
|
||||
boolean tryLock = lock.tryLock(3, TimeUnit.SECONDS);
|
||||
try {
|
||||
if (tryLock) {
|
||||
String move = null;
|
||||
if (ObjectUtil.isNotEmpty(actionRequest.getMove())) {
|
||||
move = (Integer.parseInt(actionRequest.getMove()) + 1) + "";
|
||||
}
|
||||
String action = actionRequest.getAction();
|
||||
String vehicleType = actionRequest.getVehicle_type();
|
||||
if (deviceCode == null) {
|
||||
return BaseResponse.responseError(actionRequest.getRequestNo(), "设备编码不能为空");
|
||||
}
|
||||
// 找到点位
|
||||
SchBasePoint schBasePoint = pointService.getById(deviceCode);
|
||||
if (ObjectUtil.isEmpty(schBasePoint)) {
|
||||
return BaseResponse.responseError(actionRequest.getRequestNo(), "设备: [" + deviceCode + "]未找到");
|
||||
}
|
||||
// 点位的状态如果是null,就默认是空位置
|
||||
String pointStatus = ObjectUtil.isNotEmpty(schBasePoint.getPoint_status())
|
||||
? schBasePoint.getPoint_status()
|
||||
: PointStatusEnum.EMPTY_POINT.getCode();
|
||||
if ((pointStatus.equals(PointStatusEnum.FULL_POINT.getCode())
|
||||
&& move.equals(PointStatusEnum.EMPTY_VEHICLE.getCode())) || (pointStatus.equals(move))) { // 不做操作
|
||||
return BaseResponse.responseOk(actionRequest.getRequestNo());
|
||||
}
|
||||
// 载具类型不为空,并且不是0的情况,lmsVehicleTypeShift:转成lms的载具类型
|
||||
if (ObjectUtil.isNotEmpty(vehicleType) && !vehicleType.equals(GeneralDefinition.NO)) {
|
||||
schBasePoint.setVehicle_type(vehicleType);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(action)) {
|
||||
schBasePoint.setIs_used(!action.equals(GeneralDefinition.NO));
|
||||
}
|
||||
// move为空则不修改
|
||||
if (ObjectUtil.isNotEmpty(move)) {
|
||||
schBasePoint.setPoint_status(move);
|
||||
}
|
||||
PointUtils.setUpdateByAcs(schBasePoint);
|
||||
pointService.updateById(schBasePoint);
|
||||
log.info("点位" + schBasePoint.getPoint_code() + "更新之后:{}", schBasePoint);
|
||||
}
|
||||
} finally {
|
||||
if (tryLock) {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
String action = actionRequest.getAction();
|
||||
String vehicleType = actionRequest.getVehicle_type();
|
||||
if (deviceCode == null) {
|
||||
return BaseResponse.responseError(actionRequest.getRequestNo(), "设备编码不能为空");
|
||||
}
|
||||
// 找到点位
|
||||
SchBasePoint schBasePoint = pointService.getById(deviceCode);
|
||||
if (ObjectUtil.isEmpty(schBasePoint)) {
|
||||
return BaseResponse.responseError(actionRequest.getRequestNo(), "设备: [" + deviceCode + "]未找到");
|
||||
}
|
||||
// 点位的状态如果是null,就默认是空位置
|
||||
String pointStatus = ObjectUtil.isNotEmpty(schBasePoint.getPoint_status())
|
||||
? schBasePoint.getPoint_status()
|
||||
: PointStatusEnum.EMPTY_POINT.getCode();
|
||||
if ((pointStatus.equals(PointStatusEnum.FULL_POINT.getCode())
|
||||
&& move.equals(PointStatusEnum.EMPTY_VEHICLE.getCode())) || (pointStatus.equals(move))) { // 不做操作
|
||||
return BaseResponse.responseOk(actionRequest.getRequestNo());
|
||||
}
|
||||
// 载具类型不为空,并且不是0的情况,lmsVehicleTypeShift:转成lms的载具类型
|
||||
if (ObjectUtil.isNotEmpty(vehicleType) && !vehicleType.equals(GeneralDefinition.NO)) {
|
||||
schBasePoint.setVehicle_type(vehicleType);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(action)) {
|
||||
schBasePoint.setIs_used(!action.equals(GeneralDefinition.NO));
|
||||
}
|
||||
// move为空则表示无货
|
||||
schBasePoint.setPoint_status(move == null ? PointStatusEnum.EMPTY_POINT.getCode() : move);
|
||||
PointUtils.setUpdateByAcs(schBasePoint);
|
||||
pointService.updateById(schBasePoint);
|
||||
log.info("点位" + schBasePoint.getPoint_code() + "更新之后:{}", schBasePoint);
|
||||
return BaseResponse.responseOk(actionRequest.getRequestNo());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
package org.nl.wms.ext.mes.autotask;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.system.service.notice.ISysNoticeService;
|
||||
import org.nl.wms.ext.mes.service.WmsToMesService;
|
||||
import org.nl.wms.ext.mes.service.dao.mapper.MesRequestMapper;
|
||||
import org.nl.wms.ext.mes.service.dto.MesGdyInfoWaitDto;
|
||||
import org.nl.wms.sch.task_manage.GeneralDefinition;
|
||||
import org.nl.wms.sch.task_manage.enums.NoticeTypeEnum;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 定时保存待入窑
|
||||
* @Date: 2023/9/22
|
||||
*/
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@Order(value = 1)
|
||||
public class AutoSaveWaitGdyInfo {
|
||||
@Autowired
|
||||
private WmsToMesService wmsToMesService;
|
||||
@Autowired
|
||||
private MesRequestMapper mesRequestMapper;
|
||||
@Autowired
|
||||
private ISysNoticeService noticeService;
|
||||
@SneakyThrows
|
||||
public void run() {
|
||||
// 获取滚筒线内数据
|
||||
List<MesGdyInfoWaitDto> list = wmsToMesService.getAllWaitIntoGdyInfos();
|
||||
AtomicInteger successNum = new AtomicInteger();
|
||||
long startTime = System.currentTimeMillis();
|
||||
// 存入表中
|
||||
list.forEach(mesGdyInfoWaitDto -> {
|
||||
mesGdyInfoWaitDto.setMSGID(IdUtil.getSnowflake(1,1).nextIdStr());
|
||||
mesGdyInfoWaitDto.setSEND_TM(DateUtil.now());
|
||||
mesGdyInfoWaitDto.setPRO_SUBUNIT("块");
|
||||
mesGdyInfoWaitDto.setCREATE_TM(DateUtil.now());
|
||||
mesGdyInfoWaitDto.setOP_FLAG(GeneralDefinition.NO);
|
||||
// 插入
|
||||
try {
|
||||
mesRequestMapper.insertGdyMaterialWait(mesGdyInfoWaitDto);
|
||||
successNum.incrementAndGet();
|
||||
} catch (Exception e) {
|
||||
log.error("插入窑前失败的数据: {}", mesGdyInfoWaitDto);
|
||||
log.error("插入窑前失败的信息:{}", e.getMessage());
|
||||
// notice通知
|
||||
noticeService.createNotice(e.getMessage(), "窑前数据同步失败" + mesGdyInfoWaitDto.getMSGID(), NoticeTypeEnum.NOTIFICATION.getCode());
|
||||
}
|
||||
});
|
||||
long endTime = System.currentTimeMillis();
|
||||
log.info("窑前数据有" + list.size() + "条,成功" + successNum.get() + "条, 消耗时长:" + (endTime - startTime) + "ms");
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
package org.nl.wms.ext.mes.service;
|
||||
|
||||
import org.nl.wms.ext.mes.autotask.AutoSaveWaitGdyInfo;
|
||||
import org.nl.wms.ext.mes.service.dto.MesGdyInfoDto;
|
||||
import org.nl.wms.ext.mes.service.dto.MesGdyInfoWaitDto;
|
||||
import org.nl.wms.ext.mes.service.dto.MesMudConsumptionDto;
|
||||
import org.nl.wms.ext.mes.service.dto.MesSemiProductionInfo;
|
||||
import org.nl.wms.pdm.workorder.service.dao.PdmBdWorkorder;
|
||||
@@ -67,4 +69,10 @@ public interface WmsToMesService {
|
||||
* @param workorderCode
|
||||
*/
|
||||
void reportPressUnusedMaterial(PdmBdWorkorder workorderCode);
|
||||
|
||||
/**
|
||||
* 获取所有待入窑数据
|
||||
* @return
|
||||
*/
|
||||
List<MesGdyInfoWaitDto> getAllWaitIntoGdyInfos();
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ 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.mes.autotask.AutoSaveWaitGdyInfo;
|
||||
import org.nl.wms.ext.mes.service.dto.*;
|
||||
|
||||
import java.util.List;
|
||||
@@ -48,4 +49,8 @@ public interface MesRequestMapper {
|
||||
int countFPNumber(String workorderCode, String pointCode);
|
||||
@DS("oracle")
|
||||
void insertMesUnusedInfo(MesUnusedDto mesUnusedDto);
|
||||
@DS("mysql")
|
||||
List<MesGdyInfoWaitDto> getAllWaitIntoGdyInfos();
|
||||
@DS("oracle")
|
||||
void insertGdyMaterialWait(MesGdyInfoWaitDto mesGdyInfoWaitDto);
|
||||
}
|
||||
|
||||
@@ -64,6 +64,12 @@
|
||||
VALUES (#{MSGID}, #{FORDER_NO}, #{PWORKSCHE_ID}, #{FPRODUCT_MATERIAL_ID}, #{FPRODUCT_MATERIAL_NAME}, #{FMATSPEC}
|
||||
, #{FMATMODEL}, #{BATCHNO}, #{PRESSUNIT}, #{FTEAM}, #{FPSUBNUM}, #{FP_SUBUNIT}, #{PRODATE}, #{CREATE_TM}, #{OP_FLAG})
|
||||
</insert>
|
||||
<insert id="insertGdyMaterialWait" parameterType="org.nl.wms.ext.mes.service.dto.MesGdyInfoWaitDto">
|
||||
INSERT INTO "LMSTELCOM"."RECEIVE_GDY_MATWAIT"(MSGID, SEND_TM, TRAY_NO, FPRODUCT_MATERIAL_ID, FPRODUCT_MATERIAL_NAME
|
||||
, FMATSPEC, FMATMODEL, BATCHNO, PRESSUNIT, PRO_SUBNUM, PRO_SUBUNIT, CREATE_TM, OP_FLAG)
|
||||
VALUES (#{MSGID}, #{SEND_TM}, #{TRAY_NO}, #{FPRODUCT_MATERIAL_ID}, #{FPRODUCT_MATERIAL_NAME}, #{FMATSPEC}
|
||||
, #{FMATMODEL}, #{BATCHNO}, #{PRESSUNIT}, #{PRO_SUBNUM}, #{PRO_SUBUNIT}, #{CREATE_TM}, #{OP_FLAG})
|
||||
</insert>
|
||||
<update id="updateWorkOrderRead" parameterType="java.util.List">
|
||||
UPDATE "LMSTELCOM"."SEND_POP_SCHEDULE_PRESS"
|
||||
SET OP_FLAG = '1'
|
||||
@@ -177,4 +183,24 @@
|
||||
`md_base_brick_info` mi
|
||||
WHERE mi.workorder_code = #{workorderCode} AND mi.get_station = #{pointCode} AND mi.put_station LIKE 'YZBHGW%'
|
||||
</select>
|
||||
<select id="getAllWaitIntoGdyInfos" resultType="org.nl.wms.ext.mes.service.dto.MesGdyInfoWaitDto">
|
||||
SELECT
|
||||
vg.vehicle_code AS TRAY_NO,
|
||||
mm.material_code AS FPRODUCT_MATERIAL_ID,
|
||||
mm.material_name AS FPRODUCT_MATERIAL_NAME,
|
||||
mm.material_spec AS FMATSPEC,
|
||||
mm.material_model AS FMATMODEL,
|
||||
pw.batch_no AS BATCHNO,
|
||||
p2.ext_point_code AS PRESSUNIT,
|
||||
vg.material_qty AS PRO_SUBNUM
|
||||
FROM
|
||||
`sch_base_vehiclematerialgroup` vg
|
||||
LEFT JOIN pdm_bd_workorder pw ON pw.workorder_code = vg.workorder_code
|
||||
LEFT JOIN md_base_material mm ON mm.material_id = vg.material_id
|
||||
LEFT JOIN sch_base_point p ON p.point_code = vg.source_vehicle_code
|
||||
LEFT JOIN sch_base_point p2 ON p.parent_point_code = p2.point_code
|
||||
WHERE
|
||||
vg.point_code IN ( 'HCSSX01', 'HCSSX63' )
|
||||
AND pw.workorder_code IS NOT NULL
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package org.nl.wms.ext.mes.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 带入窑实体
|
||||
* @Date: 2023/9/22
|
||||
* 二维码
|
||||
* 发送时间
|
||||
* 托盘编号
|
||||
* 物料编码
|
||||
* 物料名称
|
||||
* 规格
|
||||
* 型号
|
||||
* 批次号
|
||||
* 压机号
|
||||
* 重量
|
||||
* 重量单位
|
||||
* 数量
|
||||
* 数量单位
|
||||
* 单位转换率
|
||||
* 写入时间
|
||||
* 读取标志,0未读取,1已读取
|
||||
* 读取时间
|
||||
*/
|
||||
@Data
|
||||
public class MesGdyInfoWaitDto {
|
||||
private String MSGID;
|
||||
private String SEND_TM;
|
||||
private String TRAY_NO;
|
||||
private String FPRODUCT_MATERIAL_ID;
|
||||
private String FPRODUCT_MATERIAL_NAME;
|
||||
private String FMATSPEC;
|
||||
private String FMATMODEL;
|
||||
private String BATCHNO;
|
||||
private String PRESSUNIT;
|
||||
private String PRO_NUM;
|
||||
private String PRO_UNIT;
|
||||
private String PRO_SUBNUM;
|
||||
private String PRO_SUBUNIT;
|
||||
private String FCONVERTRATE;
|
||||
private String CREATE_TM;
|
||||
private String OP_FLAG;
|
||||
private String OP_TM;
|
||||
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.system.service.notice.ISysNoticeService;
|
||||
import org.nl.wms.database.material.service.IMdBaseMaterialService;
|
||||
import org.nl.wms.database.material.service.dao.MdBaseMaterial;
|
||||
import org.nl.wms.ext.mes.autotask.AutoSaveWaitGdyInfo;
|
||||
import org.nl.wms.ext.mes.service.WmsToMesService;
|
||||
import org.nl.wms.ext.mes.service.dao.mapper.MesRequestMapper;
|
||||
import org.nl.wms.ext.mes.service.dto.*;
|
||||
@@ -147,7 +148,7 @@ public class WmsToMesServiceImpl implements WmsToMesService {
|
||||
|
||||
@Override
|
||||
public void reportSemiProductionInfoIn(String groupId) {
|
||||
log.info("物料入滚筒线");
|
||||
log.info("半成品入库");
|
||||
// 获取组盘信息
|
||||
SchBaseVehiclematerialgroup vehiclematerialgroup = vehiclematerialgroupService.getById(groupId);
|
||||
String workorderCode = vehiclematerialgroup.getWorkorder_code();
|
||||
@@ -175,21 +176,21 @@ public class WmsToMesServiceImpl implements WmsToMesService {
|
||||
semiProductionInfoInDto.setPRODATE(workorder.getProduce_date());
|
||||
semiProductionInfoInDto.setCREATE_TM(DateUtil.now());
|
||||
semiProductionInfoInDto.setOP_FLAG(GeneralDefinition.NO);
|
||||
log.info("入滚筒线返给MES的数据:{}", semiProductionInfoInDto);
|
||||
log.info("半成品入库返给MES的数据:{}", semiProductionInfoInDto);
|
||||
// 插入mes数据库
|
||||
try {
|
||||
mesRequestMapper.insertSemiProductInfo(semiProductionInfoInDto);
|
||||
} catch (Exception e) {
|
||||
log.error("入滚筒线插入mes数据库失败:{}", e.getMessage());
|
||||
log.error("半成品入库插入mes数据库失败:{}", e.getMessage());
|
||||
// todo:发送通知
|
||||
noticeService.createNotice("入滚筒线插入mes数据库失败", "入滚筒线" + semiProductionInfoInDto.getMSGID(),
|
||||
noticeService.createNotice("半成品入库插入mes数据库失败", "半成品入库" + semiProductionInfoInDto.getMSGID(),
|
||||
NoticeTypeEnum.EXCEPTION.getCode());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reportSemiProductionInfoOut(String groupId) {
|
||||
log.info("物料出滚筒线");
|
||||
log.info("半成品出库");
|
||||
// 获取组盘信息
|
||||
SchBaseVehiclematerialgroup vehiclematerialgroup = vehiclematerialgroupService.getById(groupId);
|
||||
String workorderCode = vehiclematerialgroup.getWorkorder_code();
|
||||
@@ -214,14 +215,14 @@ public class WmsToMesServiceImpl implements WmsToMesService {
|
||||
semiProductionInfoOutDto.setOUTTYPE("成品出库");
|
||||
semiProductionInfoOutDto.setCREATE_TM(DateUtil.now());
|
||||
semiProductionInfoOutDto.setOP_FLAG(GeneralDefinition.NO);
|
||||
log.info("出滚筒线返给MES的数据:{}", semiProductionInfoOutDto);
|
||||
log.info("半成品出库返给MES的数据:{}", semiProductionInfoOutDto);
|
||||
// 插入mes数据库
|
||||
try {
|
||||
mesRequestMapper.insertSemiProductOutInfo(semiProductionInfoOutDto);
|
||||
} catch (Exception e) {
|
||||
log.error("出滚筒线插入mes数据库失败:{}", e.getMessage());
|
||||
log.error("半成品出库插入mes数据库失败:{}", e.getMessage());
|
||||
// todo:发送通知
|
||||
noticeService.createNotice("入滚筒线插入mes数据库失败", "入滚筒线" + semiProductionInfoOutDto.getMSGID(),
|
||||
noticeService.createNotice("半成品出库插入mes数据库失败", "半成品出库" + semiProductionInfoOutDto.getMSGID(),
|
||||
NoticeTypeEnum.EXCEPTION.getCode());
|
||||
}
|
||||
}
|
||||
@@ -354,6 +355,11 @@ public class WmsToMesServiceImpl implements WmsToMesService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MesGdyInfoWaitDto> getAllWaitIntoGdyInfos() {
|
||||
return mesRequestMapper.getAllWaitIntoGdyInfos();
|
||||
}
|
||||
|
||||
public List<PdmBdWorkorder> toWorkOrderList(List<MesWorkOrderDto> mesWorkOrderInfos) {
|
||||
List<PdmBdWorkorder> list = new CopyOnWriteArrayList<>();
|
||||
mesWorkOrderInfos.forEach(mesWorkOrderDto -> {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.wms.pda.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@@ -10,6 +11,8 @@ import org.nl.wms.das.device.check.service.dao.DasDeviceCheckRecord;
|
||||
import org.nl.wms.das.device.operation.service.IDasDeviceOperationRecordService;
|
||||
import org.nl.wms.das.device.operation.service.dao.DasDeviceOperationRecord;
|
||||
import org.nl.wms.pda.service.PdaService;
|
||||
import org.nl.wms.pda.service.dao.dto.BlendingMoveDto;
|
||||
import org.nl.wms.pda.service.dao.dto.ForcedRestingDto;
|
||||
import org.nl.wms.pda.service.dao.dto.ManualGroupDto;
|
||||
import org.nl.wms.pda.service.dao.vo.PdaResponseVo;
|
||||
import org.nl.wms.pdm.workorder.service.IPdmBdWorkorderService;
|
||||
@@ -32,6 +35,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@RestController
|
||||
@Api(tags = "手持接口")
|
||||
@RequestMapping("/api/pda")
|
||||
@SaIgnore
|
||||
public class PdaController {
|
||||
@Autowired
|
||||
private IDasDeviceCheckRecordService deviceCheckRecordService;
|
||||
@@ -85,10 +89,18 @@ public class PdaController {
|
||||
return new ResponseEntity<>(pdaService.getDeviceInfo(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/group/getVehicleType")
|
||||
@Log("获取载具类型")
|
||||
@ApiOperation("获取载具类型")
|
||||
public ResponseEntity<Object> getVehicleType(){
|
||||
return new ResponseEntity<>(pdaService.getVehicleType(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/group/getPressWorkOrder")
|
||||
@Log("获取压机编码")
|
||||
@ApiOperation("获取压机编码")
|
||||
public ResponseEntity<Object> getPressWorkOrder(JSONObject param){
|
||||
@Log("获取工单编码")
|
||||
@ApiOperation("获取工单编码")
|
||||
@Deprecated
|
||||
public ResponseEntity<Object> getPressWorkOrder(@RequestBody JSONObject param){
|
||||
return new ResponseEntity<>(workorderService.getDeviceProductionTask(param.getString("point_code")), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -96,6 +108,35 @@ public class PdaController {
|
||||
@Log("人工组盘")
|
||||
@ApiOperation("人工组盘")
|
||||
public ResponseEntity<PdaResponseVo> manualDiskAssembly(@Validated @RequestBody ManualGroupDto entity){
|
||||
return new ResponseEntity<>(vehiclematerialgroupService.manualCreateByPda(entity), HttpStatus.OK);
|
||||
return new ResponseEntity<>(pdaService.manualCreateByPda(entity), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/move/getBlendingCode")
|
||||
@Log("获取混碾机编码")
|
||||
@ApiOperation("获取混碾机编码")
|
||||
public ResponseEntity<Object> getBlendingCode(){
|
||||
return new ResponseEntity<>(pdaService.getBlendingCode(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/move/sendTask")
|
||||
@Log("生成混碾->压机任务")
|
||||
@ApiOperation("生成混碾->压机任务")
|
||||
public ResponseEntity<PdaResponseVo> sendTask(@Validated @RequestBody BlendingMoveDto blendingMoveDto){
|
||||
return new ResponseEntity<>(pdaService.sendTask(blendingMoveDto), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/forcedResting/show")
|
||||
@Log("显示静置时长")
|
||||
@ApiOperation("显示静置时长")
|
||||
public ResponseEntity<Object> forcedRestingShow(){
|
||||
return new ResponseEntity<>(pdaService.forcedRestingShow(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/forcedResting/submit")
|
||||
@Log("强制静置")
|
||||
@ApiOperation("强制静置")
|
||||
public ResponseEntity<PdaResponseVo> forcedResting(@Validated @RequestBody ForcedRestingDto forcedRestingDto){
|
||||
return new ResponseEntity<>(pdaService.forcedResting(forcedRestingDto), HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
package org.nl.wms.pda.service;
|
||||
|
||||
import org.nl.wms.pda.service.dao.dto.BlendingMoveDto;
|
||||
import org.nl.wms.pda.service.dao.dto.ForcedRestingDto;
|
||||
import org.nl.wms.pda.service.dao.dto.ManualGroupDto;
|
||||
import org.nl.wms.pda.service.dao.vo.DropdownListVo;
|
||||
import org.nl.wms.pda.service.dao.vo.PdaResponseVo;
|
||||
import org.nl.wms.pda.service.dao.vo.StandTimeShowVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -15,4 +20,17 @@ public interface PdaService {
|
||||
List<DropdownListVo> getDeviceStatus();
|
||||
|
||||
List<DropdownListVo> deviceAction();
|
||||
|
||||
PdaResponseVo manualCreateByPda(ManualGroupDto entity);
|
||||
|
||||
List<DropdownListVo> getBlendingCode();
|
||||
|
||||
PdaResponseVo sendTask(BlendingMoveDto blendingMoveDto);
|
||||
|
||||
PdaResponseVo forcedResting(ForcedRestingDto forcedRestingDto);
|
||||
|
||||
|
||||
List<StandTimeShowVo> forcedRestingShow();
|
||||
|
||||
List<DropdownListVo> getVehicleType();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package org.nl.wms.pda.service.dao.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 混碾搬运参数
|
||||
* @Date: 2023/9/21
|
||||
*/
|
||||
@Data
|
||||
public class BlendingMoveDto {
|
||||
private String vehicle_code;
|
||||
private String start_point_code;
|
||||
private String end_point_code;
|
||||
private BigDecimal material_weight;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package org.nl.wms.pda.service.dao.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 强制静置实体
|
||||
* @Date: 2023/9/25
|
||||
*/
|
||||
@Data
|
||||
public class ForcedRestingDto {
|
||||
private Integer stand_time; // 静置时间
|
||||
private String group_id; // 组盘标识
|
||||
}
|
||||
@@ -14,6 +14,6 @@ public class ManualGroupDto {
|
||||
private String vehicle_code;
|
||||
private String vehicle_type;
|
||||
private String point_code;
|
||||
private String order_code;
|
||||
private String order_code; // 不需要
|
||||
private BigDecimal material_weight;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package org.nl.wms.pda.service.dao.mapper;
|
||||
|
||||
import org.nl.wms.pda.service.dao.vo.DropdownListVo;
|
||||
import org.nl.wms.pda.service.dao.vo.StandTimeShowVo;
|
||||
import org.nl.wms.sch.point.service.dao.SchBasePoint;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -13,4 +15,21 @@ public interface PdaMapper {
|
||||
List<DropdownListVo> getDeviceInfo();
|
||||
|
||||
List<DropdownListVo> getDictByCode(String code);
|
||||
|
||||
/**
|
||||
* 根据区域编码和点位名称获取信息
|
||||
* @param device
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
List<DropdownListVo> getDeviceInfos(String device, String type);
|
||||
|
||||
/**
|
||||
* 获取压机对应可用的满盅位
|
||||
* @param endPointCode
|
||||
* @return
|
||||
*/
|
||||
SchBasePoint findKLXPoint(String endPointCode);
|
||||
|
||||
List<StandTimeShowVo> forcedRestingShow();
|
||||
}
|
||||
|
||||
@@ -18,4 +18,38 @@
|
||||
`sys_dict`
|
||||
WHERE `code` = #{code}
|
||||
</select>
|
||||
<select id="getDeviceInfos" resultType="org.nl.wms.pda.service.dao.vo.DropdownListVo">
|
||||
SELECT
|
||||
p.point_code AS `value`,
|
||||
p.point_name AS text
|
||||
FROM
|
||||
`sch_base_point` p
|
||||
WHERE p.region_code = #{device} AND p.point_type = #{type} AND is_used = TRUE
|
||||
</select>
|
||||
<select id="findKLXPoint" resultType="org.nl.wms.sch.point.service.dao.SchBasePoint">
|
||||
SELECT
|
||||
p.*
|
||||
FROM
|
||||
`sch_base_point` p
|
||||
LEFT JOIN sch_base_task t ON t.point_code2 = p.point_code AND t.task_status IN ('2','3','4')
|
||||
WHERE p.region_code = 'LZKLX' AND p.parent_point_code LIKE CONCAT('%', #{endPointCode}, '%') AND p.point_type = '5'
|
||||
AND t.task_code IS NULL
|
||||
</select>
|
||||
<select id="forcedRestingShow" resultType="org.nl.wms.pda.service.dao.vo.StandTimeShowVo">
|
||||
SELECT
|
||||
vg.group_id,
|
||||
vg.point_code,
|
||||
p2.point_name AS device_code,
|
||||
vg.standing_time,
|
||||
TIMESTAMPDIFF(MINUTE, NOW(), DATE_ADD(vg.instorage_time, INTERVAL vg.standing_time MINUTE)) AS timeDifferenceMinutes,
|
||||
DATE_FORMAT(DATE_ADD(vg.instorage_time, INTERVAL vg.standing_time MINUTE), '%Y-%m-%d %H:%i:%s') AS estimatedCompletionTimeString
|
||||
FROM
|
||||
`sch_base_vehiclematerialgroup` vg
|
||||
LEFT JOIN sch_base_point p1 ON p1.point_code = vg.point_code
|
||||
LEFT JOIN sch_base_point p2 ON p2.point_code = p1.parent_point_code
|
||||
WHERE vg.point_code IN (
|
||||
SELECT p.point_code FROM sch_base_point p WHERE p.region_code = 'LZKLX' AND p.point_type = '3'
|
||||
)
|
||||
AND vg.group_bind_material_status = '2'
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.nl.wms.pda.service.dao.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 显示静置时间
|
||||
* @Date: 2023/9/25
|
||||
*/
|
||||
@Data
|
||||
public class StandTimeShowVo {
|
||||
private String group_id;
|
||||
private String point_code;
|
||||
private String device_code;
|
||||
private Integer standing_time;
|
||||
private double timeDifferenceMinutes; // 剩余时间
|
||||
// 格式化预计完成时间为字符串
|
||||
private String estimatedCompletionTimeString;
|
||||
}
|
||||
@@ -1,9 +1,31 @@
|
||||
package org.nl.wms.pda.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.wms.database.material.service.IMdBaseMaterialService;
|
||||
import org.nl.wms.database.material.service.dao.MdBaseMaterial;
|
||||
import org.nl.wms.pda.service.PdaService;
|
||||
import org.nl.wms.pda.service.dao.dto.BlendingMoveDto;
|
||||
import org.nl.wms.pda.service.dao.dto.ForcedRestingDto;
|
||||
import org.nl.wms.pda.service.dao.dto.ManualGroupDto;
|
||||
import org.nl.wms.pda.service.dao.mapper.PdaMapper;
|
||||
import org.nl.wms.pda.service.dao.vo.DropdownListVo;
|
||||
import org.nl.wms.pda.service.dao.vo.PdaResponseVo;
|
||||
import org.nl.wms.pda.service.dao.vo.StandTimeShowVo;
|
||||
import org.nl.wms.pdm.workorder.service.IPdmBdWorkorderService;
|
||||
import org.nl.wms.pdm.workorder.service.dao.PdmBdWorkorder;
|
||||
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.dao.SchBaseTask;
|
||||
import org.nl.wms.sch.task_manage.GeneralDefinition;
|
||||
import org.nl.wms.sch.task_manage.enums.GroupBindMaterialStatusEnum;
|
||||
import org.nl.wms.sch.task_manage.enums.GroupStatusEnum;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -19,6 +41,14 @@ import java.util.List;
|
||||
public class PdaServiceImpl implements PdaService {
|
||||
@Autowired
|
||||
private PdaMapper pdaMapper;
|
||||
@Autowired
|
||||
private IPdmBdWorkorderService workorderService;
|
||||
@Autowired
|
||||
private ISchBasePointService pointService;
|
||||
@Autowired
|
||||
private IMdBaseMaterialService materialService;
|
||||
@Autowired
|
||||
private ISchBaseVehiclematerialgroupService vehiclematerialgroupService;
|
||||
@Override
|
||||
public List<DropdownListVo> getDeviceInfo() {
|
||||
// 暂定压机区域
|
||||
@@ -34,4 +64,94 @@ public class PdaServiceImpl implements PdaService {
|
||||
public List<DropdownListVo> deviceAction() {
|
||||
return pdaMapper.getDictByCode("device_action");
|
||||
}
|
||||
|
||||
@Override
|
||||
public PdaResponseVo manualCreateByPda(ManualGroupDto entity) {
|
||||
if (ObjectUtil.isEmpty(entity)) {
|
||||
throw new BadRequestException("组盘不能为空");
|
||||
}
|
||||
SchBaseVehiclematerialgroup groupInfo = vehiclematerialgroupService.getGroupInfo(entity.getVehicle_code(),
|
||||
entity.getVehicle_type(), GroupBindMaterialStatusEnum.BOUND.getValue());
|
||||
if (ObjectUtil.isNotEmpty(groupInfo)) {
|
||||
throw new BadRequestException("组盘信息已存在");
|
||||
}
|
||||
// 获取压机工单
|
||||
PdmBdWorkorder bdWorkorder = workorderService.getDeviceProductionTask(entity.getPoint_code());
|
||||
// PdmBdWorkorder bdWorkorder = workorderService.getByCode(entity.getOrder_code());
|
||||
// 获取点位
|
||||
SchBasePoint basePoint = pointService.getById(entity.getPoint_code());
|
||||
// 获取物料
|
||||
MdBaseMaterial material = materialService.getById(bdWorkorder.getMaterial_id());
|
||||
SchBaseVehiclematerialgroup group = new SchBaseVehiclematerialgroup();
|
||||
group.setGroup_id(IdUtil.getSnowflake(1,1).nextIdStr());
|
||||
group.setVehicle_type(entity.getVehicle_type());
|
||||
group.setVehicle_code(entity.getVehicle_code());
|
||||
group.setMaterial_id(bdWorkorder.getMaterial_id());
|
||||
group.setRedundance_material_code(bdWorkorder.getRaw_material_code());
|
||||
group.setSource_vehicle_code(entity.getPoint_code());
|
||||
group.setPoint_code(entity.getPoint_code());
|
||||
group.setPoint_name(basePoint.getPoint_name());
|
||||
group.setInstorage_time(DateUtil.now());
|
||||
group.setStanding_time(material.getStanding_time());
|
||||
group.setMaterial_weight(entity.getMaterial_weight());
|
||||
group.setWorkorder_code(bdWorkorder.getWorkorder_code());
|
||||
group.setGroup_status(GroupStatusEnum.IN_STORAGE.getType());
|
||||
group.setMove_way(basePoint.getPoint_code());
|
||||
group.setBuss_move_id(IdUtil.getSnowflake(1,1).nextIdStr());
|
||||
group.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||
group.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||
group.setCreate_time(DateUtil.now());
|
||||
vehiclematerialgroupService.save(group);
|
||||
return PdaResponseVo.pdaResultOk("组盘成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DropdownListVo> getBlendingCode() {
|
||||
return pdaMapper.getDeviceInfos("HL", GeneralDefinition.DOCKING_POINT);
|
||||
}
|
||||
|
||||
@Override
|
||||
// todo
|
||||
public PdaResponseVo sendTask(BlendingMoveDto blendingMoveDto) {
|
||||
if (ObjectUtil.isEmpty(blendingMoveDto.getStart_point_code())) {
|
||||
throw new BadRequestException("混碾位不能为空");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(blendingMoveDto.getEnd_point_code())) {
|
||||
throw new BadRequestException("目标压机位不能为空");
|
||||
}
|
||||
// 获取压机对应的困料线、空位、无任务
|
||||
SchBasePoint point = pdaMapper.findKLXPoint(blendingMoveDto.getEnd_point_code());
|
||||
if (ObjectUtil.isEmpty(point)) {
|
||||
throw new BadRequestException("创建失败,已有搬运到【" + blendingMoveDto.getEnd_point_code() + "】的任务, 请稍后在试!");
|
||||
}
|
||||
// 获取压机当前工单
|
||||
PdmBdWorkorder workorder = workorderService.getDeviceProductionTask(blendingMoveDto.getEnd_point_code());
|
||||
// 组盘
|
||||
|
||||
// 创建任务
|
||||
SchBaseTask task = new SchBaseTask(); // 任务实体
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PdaResponseVo forcedResting(ForcedRestingDto forcedRestingDto) {
|
||||
if (ObjectUtil.isEmpty(forcedRestingDto.getGroup_id())) {
|
||||
throw new BadRequestException("请选择需要设置静置的料盅!");
|
||||
}
|
||||
SchBaseVehiclematerialgroup vehiclematerialgroup = vehiclematerialgroupService.getById(forcedRestingDto.getGroup_id());
|
||||
vehiclematerialgroup.setStanding_time(forcedRestingDto.getStand_time());
|
||||
vehiclematerialgroupService.updateById(vehiclematerialgroup);
|
||||
return PdaResponseVo.pdaResultOk("设置静置时长完成");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StandTimeShowVo> forcedRestingShow() {
|
||||
return pdaMapper.forcedRestingShow();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DropdownListVo> getVehicleType() {
|
||||
return pdaMapper.getDictByCode("vehicle_type");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,6 +128,12 @@ public class PdmBdWorkorder implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "是否加急")
|
||||
private Boolean is_urgent;
|
||||
@ApiModelProperty(value = "开工人")
|
||||
private String operator;
|
||||
@ApiModelProperty(value = "合格数")
|
||||
private Integer qualified_qty;
|
||||
@ApiModelProperty(value = "不合格数")
|
||||
private Integer unqualified_qty;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String material_name;
|
||||
|
||||
@@ -137,9 +137,8 @@ public class PdmBdWorkorderServiceImpl extends ServiceImpl<PdmBdWorkorderMapper,
|
||||
if (ObjectUtil.isNotEmpty(bdWorkorder)) {
|
||||
throw new BadRequestException("该设备已有生产工单,不能重复下发");
|
||||
}
|
||||
/**
|
||||
* todo: 待优化-虽然一次性下发一个工单,为了方便后续多个一起下发,此处接口设置为list形式
|
||||
*/
|
||||
// 设置开工人
|
||||
pdmBdWorkorder.setOperator(SecurityUtils.getCurrentNickName());
|
||||
List<AcsWorkOrderVo> list = new CopyOnWriteArrayList<>();
|
||||
// 重装数据回ACS,重新根据id找一遍,省的改动以上代码
|
||||
AcsWorkOrderVo acsWorkOrderVo = pdmBdWorkorderMapper.toAcsWorkOrderById(pdmBdWorkorder.getWorkorder_id());
|
||||
|
||||
@@ -79,6 +79,4 @@ public interface ISchBaseVehiclematerialgroupService extends IService<SchBaseVeh
|
||||
* @return
|
||||
*/
|
||||
SchBaseVehiclematerialgroup getGroupInfo(String vehicleCode, String value);
|
||||
|
||||
PdaResponseVo manualCreateByPda(ManualGroupDto entity);
|
||||
}
|
||||
|
||||
@@ -129,38 +129,4 @@ public class SchBaseVehiclematerialgroupServiceImpl extends ServiceImpl<SchBaseV
|
||||
return selectOne;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PdaResponseVo manualCreateByPda(ManualGroupDto entity) {
|
||||
if (ObjectUtil.isEmpty(entity)) {
|
||||
throw new BadRequestException("组盘不能为空");
|
||||
}
|
||||
// 获取压机工单
|
||||
PdmBdWorkorder bdWorkorder = workorderService.getByCode(entity.getOrder_code());
|
||||
// 获取点位
|
||||
SchBasePoint basePoint = pointService.getById(entity.getPoint_code());
|
||||
// 获取物料
|
||||
MdBaseMaterial material = materialService.getById(bdWorkorder.getWorkorder_id());
|
||||
SchBaseVehiclematerialgroup group = new SchBaseVehiclematerialgroup();
|
||||
group.setGroup_id(IdUtil.getSnowflake(1,1).nextIdStr());
|
||||
group.setVehicle_type(entity.getVehicle_type());
|
||||
group.setVehicle_code(entity.getVehicle_code());
|
||||
group.setMaterial_id(bdWorkorder.getMaterial_id());
|
||||
group.setRedundance_material_code(bdWorkorder.getRaw_material_code());
|
||||
group.setSource_vehicle_code(entity.getPoint_code());
|
||||
group.setPoint_code(entity.getPoint_code());
|
||||
group.setPoint_name(basePoint.getPoint_name());
|
||||
group.setInstorage_time(DateUtil.now());
|
||||
group.setStanding_time(material.getStanding_time());
|
||||
group.setMaterial_weight(entity.getMaterial_weight());
|
||||
group.setWorkorder_code(bdWorkorder.getWorkorder_code());
|
||||
group.setGroup_status(GroupStatusEnum.IN_STORAGE.getType());
|
||||
group.setMove_way(basePoint.getPoint_code());
|
||||
group.setBuss_move_id(IdUtil.getSnowflake(1,1).nextIdStr());
|
||||
group.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||
group.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||
group.setCreate_time(DateUtil.now());
|
||||
vehiclematerialgroupMapper.insert(group);
|
||||
return PdaResponseVo.pdaResultOk("组盘成功");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.system.service.notice.ISysNoticeService;
|
||||
import org.nl.wms.ext.mes.service.WmsToMesService;
|
||||
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;
|
||||
@@ -49,6 +50,8 @@ public class FJSKTask extends AbstractTask {
|
||||
private ISchBaseTaskconfigService taskConfigService;
|
||||
@Autowired
|
||||
private FJMapper fjMapper;
|
||||
@Autowired
|
||||
private WmsToMesService wmsToMesService;
|
||||
|
||||
@Autowired
|
||||
private ISysNoticeService noticeService;
|
||||
@@ -197,6 +200,14 @@ public class FJSKTask extends AbstractTask {
|
||||
endPointObj.setPoint_status(PointStatusEnum.EMPTY_VEHICLE.getCode());
|
||||
PointUtils.setUpdateByType(endPointObj, taskFinishedType);
|
||||
pointService.updateById(endPointObj);
|
||||
// 组盘状态改变
|
||||
SchBaseVehiclematerialgroup vehicleMaterialGroupObj =
|
||||
vehiclematerialgroupService.getById(taskObj.getGroup_id());
|
||||
vehicleMaterialGroupObj.setGroup_bind_material_status(GroupBindMaterialStatusEnum.UNBOUND.getValue());
|
||||
TaskUtils.setGroupUpdateByType(vehicleMaterialGroupObj, taskFinishedType);
|
||||
vehiclematerialgroupService.updateById(vehicleMaterialGroupObj);
|
||||
// todo: 上报mes, 物料出库
|
||||
wmsToMesService.reportSemiProductionInfoOut(taskObj.getGroup_id());
|
||||
}
|
||||
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||
taskObj.setRemark(GeneralDefinition.TASK_FINISH);
|
||||
|
||||
@@ -311,9 +311,9 @@ public class HNMLTask extends AbstractTask {
|
||||
String vehicleType = param.getString("vehicle_type");
|
||||
// 泥料物料对应不出物料标识
|
||||
// todo: 暂未处理
|
||||
String materialCode = param.getString("material_code"); // 泥料编码: 吨袋号,泥料前
|
||||
// String materialCode = packNo.substring(0, 12);
|
||||
// String mixTimes = param.getString("mix_number"); // 碾次
|
||||
String packNo = param.getString("material_code"); // 泥料编码: 吨袋号,泥料前
|
||||
String materialCode = packNo.substring(0, 12);
|
||||
String mixTimes = packNo.substring(18, packNo.length()); // 碾次
|
||||
// 载具类型默认料盅
|
||||
if (vehicleType == null || vehicleType.equals(GeneralDefinition.NO)) {
|
||||
vehicleType = GeneralDefinition.MATERIAL_CUP;
|
||||
@@ -349,7 +349,7 @@ public class HNMLTask extends AbstractTask {
|
||||
groupEntity.setPoint_code(basePoint.getPoint_code()); // 当前位置
|
||||
groupEntity.setPoint_name(basePoint.getPoint_name());
|
||||
groupEntity.setMove_way(basePoint.getPoint_code()); // 头次
|
||||
// groupEntity.setMix_times(mixTimes); // 碾次
|
||||
groupEntity.setMix_times(mixTimes); // 碾次
|
||||
groupEntity.setInstorage_time(DateUtil.now());
|
||||
groupEntity.setMaterial_weight(ObjectUtil.isNotEmpty(weight)// 重量
|
||||
? weight
|
||||
@@ -357,7 +357,7 @@ public class HNMLTask extends AbstractTask {
|
||||
groupEntity.setGroup_bind_material_status(GroupBindMaterialStatusEnum.BOUND.getValue()); // 绑定
|
||||
groupEntity.setGroup_status(GroupStatusEnum.IN_STORAGE.getType()); // 暂时不维护。
|
||||
groupEntity.setIs_delete(false);
|
||||
// groupEntity.setExt_data(packNo);// todo: 对于混碾的组盘 暂时存吨袋号
|
||||
groupEntity.setExt_data(packNo);// todo: 对于混碾的组盘 暂时存吨袋号
|
||||
vehiclematerialgroupService.saveOrUpdate(groupEntity);
|
||||
return groupEntity.getGroup_id();
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
</foreach>
|
||||
ORDER BY r.create_time
|
||||
</select>
|
||||
<select id="findPointForHNMLAndWorkOrder" resultType="org.nl.wms.sch.point.service.dao.SchBasePoint">
|
||||
<select id="findPointForHNMLAndWorkOrder" resultType="org.nl.wms.sch.point.service.dao.SchBasePoint">
|
||||
SELECT
|
||||
p.*,
|
||||
p2.point_code AS device_code
|
||||
|
||||
@@ -171,8 +171,6 @@ public class GZYQLTask extends AbstractTask {
|
||||
}
|
||||
if (status.equals(TaskStatus.FINISHED)) { // 完成
|
||||
this.finishTask(taskObj, TaskFinishedTypeEnum.AUTO_ACS);
|
||||
// todo 上传mes出滚筒线
|
||||
wmsToMesService.reportSemiProductionInfoOut(taskObj.getGroup_id());
|
||||
// todo 记录入窑数据
|
||||
wmsToMesService.reportGdyMaterialInfoIn(taskObj.getGroup_id());
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.nl.wms.sch.task_manage.task.tasks.yz;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.system.service.notice.ISysNoticeService;
|
||||
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService;
|
||||
@@ -36,6 +37,7 @@ import java.util.stream.Collectors;
|
||||
* @Description: 压制送空盅任务
|
||||
* @Date: 2023/5/25
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@TaskType("LZKLXSKTask")
|
||||
public class YZSKTask extends AbstractTask {
|
||||
@@ -69,6 +71,7 @@ public class YZSKTask extends AbstractTask {
|
||||
NoticeTypeEnum.WARN.getCode());
|
||||
throw new BadRequestException("送空盅任务未找到混料机空位!");
|
||||
}
|
||||
log.warn("送空盅找到点位的信息:{}", point);
|
||||
// 设置终点并修改创建成功状态
|
||||
task.setPoint_code2(point.getPoint_code());
|
||||
task.setTask_status(TaskStatus.CREATED.getCode());
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
@@ -53,19 +54,42 @@ public class CommonUtils {
|
||||
// 计算距离静置完成还有多少毫秒
|
||||
long timeDifferenceMillis = inputDate.getTime() + (staticDurationMinutes * 60 * 1000) - currentDate.getTime();
|
||||
// 将毫秒转换为分钟
|
||||
long timeDifferenceMinutes = timeDifferenceMillis / (60 * 1000);
|
||||
double timeDifferenceMinutes = (double) timeDifferenceMillis / (60 * 1000);
|
||||
// System.out.println("距离静置完成还有 " + timeDifferenceMinutes + " 分钟");
|
||||
// 计算预计完成时间
|
||||
Date estimatedCompletionTime = new Date(currentDate.getTime() + timeDifferenceMillis);
|
||||
// 格式化预计完成时间为字符串
|
||||
String estimatedCompletionTimeString = dateFormat.format(estimatedCompletionTime);
|
||||
return "距离静置完成还有 " + timeDifferenceMinutes + " 分钟" + ", 预计完成时间为:" + estimatedCompletionTimeString;
|
||||
return "距离静置完成还有 " + String.format("%.2f", timeDifferenceMinutes) + " 分钟" + ", 预计完成时间为:" + estimatedCompletionTimeString;
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前时间是白晚班
|
||||
* @return
|
||||
*/
|
||||
public static String getDayShift() {
|
||||
// 获取当前时间
|
||||
LocalTime currentTime = LocalTime.now();
|
||||
// 设置白班和晚班的时间范围
|
||||
LocalTime dayShiftStart = LocalTime.of(8, 0); // 白班开始时间:8:00 AM
|
||||
LocalTime dayShiftEnd = LocalTime.of(17, 0); // 白班结束时间:5:00 PM
|
||||
LocalTime nightShiftStart = LocalTime.of(17, 0); // 晚班开始时间:5:00 PM
|
||||
LocalTime nightShiftEnd = LocalTime.of(23, 59); // 晚班结束时间:11:59 PM
|
||||
|
||||
// 检查当前时间属于哪个班次
|
||||
if (currentTime.isAfter(dayShiftStart) && currentTime.isBefore(dayShiftEnd)) {
|
||||
return "白班";
|
||||
} else if (currentTime.isAfter(nightShiftStart) || currentTime.isBefore(dayShiftStart)) {
|
||||
return "晚班";
|
||||
} else {
|
||||
return "白班";
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> T toJavaObject(String objectString, Class<T> clazz) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(objectString);
|
||||
return jsonObject.toJavaObject(clazz);
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
package org.nl.wms.util;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 备份数据库
|
||||
* @Date: 2023/9/25
|
||||
*/
|
||||
public class DatabaseBackup {
|
||||
public static void main(String[] args) {
|
||||
String jdbcUrl = "jdbc:mysql://localhost:3306/rtmg_lms";
|
||||
String username = "root";
|
||||
String password = "12356";
|
||||
|
||||
try {
|
||||
Connection connection = DriverManager.getConnection(jdbcUrl, username, password);
|
||||
// 在这里执行备份操作
|
||||
String backupPath = "D:\\backup.sql"; // 备份文件保存的路径
|
||||
// 构建备份命令
|
||||
List<String> command = Arrays.asList(
|
||||
"mysqldump",
|
||||
"--host=localhost",
|
||||
"--port=3306",
|
||||
"--user=" + username,
|
||||
"--password=" + password,
|
||||
"--result-file=" + backupPath,
|
||||
"--databases", "rtmg_lms",
|
||||
"--force"
|
||||
);
|
||||
// 执行备份命令
|
||||
ProcessBuilder processBuilder = new ProcessBuilder(command);
|
||||
Process process = processBuilder.start();
|
||||
int exitCode = process.waitFor();
|
||||
|
||||
if (exitCode == 0) {
|
||||
System.out.println("备份成功!");
|
||||
} else {
|
||||
System.out.println("备份失败!");
|
||||
}
|
||||
connection.close();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ spring:
|
||||
freemarker:
|
||||
check-template-location: false
|
||||
profiles:
|
||||
active: prod
|
||||
active: dev
|
||||
jackson:
|
||||
time-zone: GMT+8
|
||||
data:
|
||||
|
||||
@@ -112,4 +112,10 @@ public class test {
|
||||
System.out.println("2");
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String f = "14070300003423092216085408190002";
|
||||
System.out.println(f.substring(0, 12));
|
||||
System.out.println(f.substring(18, f.length()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user