Browse Source

fix: 物料字段追加、分拣判断是否能够继续码垛

master
李永德 1 year ago
parent
commit
6fb7a3677d
  1. 22
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/material/service/dao/MdBaseMaterial.java
  2. 24
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/dao/mapper/MesRequestMapper.xml
  3. 3
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pdm/workorder/service/dao/vo/AcsWorkOrderVo.java
  4. 15
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AbstractTask.java
  5. 152
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/FJMKTask.java
  6. 8
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/mapper/FJMapper.java
  7. 7
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/mapper/FJMapper.xml
  8. 1
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/hn/HNMLTask.java
  9. 7
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/yz/YZSLTask.java
  10. 17
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/util/TaskUtils.java
  11. 29
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/util/Tes.java
  12. 2
      lms/nladmin-system/nlsso-server/src/main/resources/config/application.yml

22
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/material/service/dao/MdBaseMaterial.java

@ -104,4 +104,26 @@ public class MdBaseMaterial implements Serializable {
@ApiModelProperty(value = "W")
private String w_thickness;
private String matsize;
private BigDecimal standing_time_lower;
private BigDecimal standing_time_upper;
private BigDecimal single_weight_upper;
private BigDecimal single_weight_lower;
private BigDecimal standard_size_height1;
private BigDecimal standard_size_height1_lower;
private BigDecimal standard_size_height1_upper;
private BigDecimal standard_size_height2;
private BigDecimal standard_size_height2_lower;
private BigDecimal standard_size_height2_upper;
private BigDecimal standard_size_height3;
private BigDecimal standard_size_height3_upper;
private BigDecimal standard_size_height3_lower;
private BigDecimal standard_size_height4;
private BigDecimal standard_size_height4_lower;
private BigDecimal standard_size_height4_upper;
private BigDecimal cooling_time_lower;
private String pack_palletspec;
private String pack_method;
private String pack_directsize;
private String draw_address;
}

24
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/dao/mapper/MesRequestMapper.xml

@ -112,6 +112,30 @@
FORMULA AS raw_material_code,
REC_TIM AS ext_time,
sysdate AS create_time,
MATSIZE AS matsize,
SLEEP_TIME_NORM AS standing_time,
SLEEP_TIME_LOWER AS standing_time_lower,
SLEEP_TIME_UPPER AS standing_time_upper,
MATCONVERTRATE_LOWER AS single_weight_lower,
MATCONVERTRATE_UPPER AS single_weight_upper,
MATSIZE1_NORM AS standard_size_height1,
MATSIZE1_LOWER AS standard_size_height1_lower,
MATSIZE1_UPPER AS standard_size_height1_upper,
MATSIZE2_NORM AS standard_size_height2,
MATSIZE2_LOWER AS standard_size_height2_lower,
MATSIZE2_UPPER AS standard_size_height2_upper,
MATSIZE3_NORM AS standard_size_height3,
MATSIZE3_LOWER AS standard_size_height3_lower,
MATSIZE3_UPPER AS standard_size_height3_upper,
MATSIZE4_NORM AS standard_size_height4,
MATSIZE4_LOWER AS standard_size_height4_lower,
MATSIZE4_UPPER AS standard_size_height4_upper,
COOL_TIME_NORM AS cooling_time,
COOL_TIME_LOWER AS cooling_time_lower,
PACK_PALLETSPEC AS pack_palletspec,
PACK_METHOD AS pack_method,
PACK_DIRECTSIZE AS pack_directsize,
DRAW_ADDRESS AS draw_address,
'3' AS create_id,
'MES系统' AS create_name
FROM

3
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pdm/workorder/service/dao/vo/AcsWorkOrderVo.java

@ -22,11 +22,12 @@ public class AcsWorkOrderVo {
private String w; // 宽度
private String size_error; // 尺寸允许误差
private String single_weight; // 单重允许误差
// private String drawing_address; // 图纸地址
// private String drawing_address; // 图纸地址
private String standard_size_height1; // 标准尺寸1
private String standard_size_height2; // 标准尺寸2
private String standard_size_height3; // 标准尺寸3
private String standard_size_height4; // 标准尺寸4
private String standard_weight; // 标准重量
private String detection_error; // 检测误差值 - 不用传
}

15
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AbstractTask.java

@ -12,9 +12,7 @@ import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.nl.common.exception.BadRequestException;
import org.nl.wms.ext.acs.service.WmsToAcsService;
import org.nl.wms.ext.acs.service.dto.to.acs.IssueAcsRequest;
import org.nl.wms.ext.acs.service.dto.to.wms.AcsResponse;
import org.nl.wms.ext.record.service.ISysInteractRecordService;
import org.nl.wms.pdm.workorder.service.IPdmBdWorkorderService;
import org.nl.wms.pdm.workorder.service.dao.PdmBdWorkorder;
import org.nl.wms.sch.point.service.ISchBasePointService;
@ -25,18 +23,14 @@ 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.enums.TaskDirectionEnum;
import org.nl.wms.sch.task_manage.enums.WorkOrderStatusEnum;
import org.nl.wms.sch.task_manage.task.AcsUtil;
import org.nl.wms.sch.task_manage.task.core.TaskStatus;
import org.nl.wms.util.TaskUtils;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.TimeUnit;
/**
* @author ldjun
@ -56,11 +50,7 @@ public abstract class AbstractTask {
@Autowired
private IPdmBdWorkorderService workorderService;
@Autowired
private ISysInteractRecordService interactRecordService;
@Autowired
private WmsToAcsService wmsToAcsService;
@Autowired
private RedissonClient redissonClient;
/**
* 任务创建
@ -68,6 +58,11 @@ public abstract class AbstractTask {
*/
protected abstract void create() throws BadRequestException;
/**
* 任务创建
* 只会创建完整的任务创建失败则抛出异常
* @param task
*/
protected void createCompletion(SchBaseTask task){}

152
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/FJMKTask.java

@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.sun.org.apache.regexp.internal.RE;
import org.nl.common.exception.BadRequestException;
import org.nl.common.utils.CodeUtil;
import org.nl.config.MapOf;
@ -80,6 +81,7 @@ public class FJMKTask extends AbstractTask {
.collect(Collectors.toList());
String requestParam = task.getRequest_param();// 任务的其他数据
JSONObject jsonObject = JSONObject.parseObject(requestParam);
String workOrderCode = jsonObject.getString("workorder_code"); // 工单
String startPoint = task.getPoint_code1();
// 获取起点 回写载具编码
SchBasePoint startPointObj = pointService.getById(startPoint);
@ -103,51 +105,52 @@ public class FJMKTask extends AbstractTask {
for (ApplyDeviceDto applyDeviceDto : list) {
sum += Integer.parseInt(applyDeviceDto.getQty());
}
// todo: 需要提供两个托盘上的数量
// 2.1 获取库存剩余数量 + 2.2 获取在搬运任务 - 组盘绑定状态是带绑定状态、任务类型是创建完成、下发、执行中
// 2 获取剩余量 surplusNumber
// 2.1 获取库存剩余数量 + 2.2 获取在搬运任务 ( 组盘绑定状态是带绑定状态、任务类型是创建完成、下发、执行中 )
int surplusNumber = fjMapper.getInventoryQuantity();
int total = sum + surplusNumber; // 现有总数
// 3 获取木托盘需要多少块
int needFullNumber = 255; // todo: 具体未知如何获取
JSONObject response = new JSONObject();
String responseParam = task.getResponse_param();
if (ObjectUtil.isNotEmpty(responseParam)) {
response = JSON.parseObject(responseParam);
}
// 3 现有总数 total
int total = sum + surplusNumber;
// 4 获取木托盘需要多少块 needFullNumber
PdmBdWorkorder workorder = workorderService.getByCode(workOrderCode);
String needFullNumberStr = fjMapper.getNeedFullNumber(workorder.getMaterial_id());
int needFullNumber = TaskUtils.convertMultiply(needFullNumberStr);
// 大于两托正常,大于1托给1,小于1托给2
// 4 校验是否够码满一托/两托
// 5 校验是否够码满一托/两托
// 大于等于2就可以码
/** 覆膜机木托盘位 */
SchBasePoint LaminatePoint = findStartPoint(startRegionStr, jsonObject);
if (ObjectUtil.isEmpty(LaminatePoint)) {
task.setRemark("覆膜区不可用!");
noticeService.createNotice(task.getRemark(), TASK_CONFIG_CODE + task.getTask_code(),
NoticeTypeEnum.WARN.getCode());
taskService.updateById(task);
// 消息通知
continue;
if (total/needFullNumber >= 2) {
/** 覆膜机木托盘位 */
SchBasePoint LaminatePoint = findStartPoint(startRegionStr, jsonObject);
if (ObjectUtil.isEmpty(LaminatePoint)) {
noticeService.createNotice("覆膜区不可用!", TASK_CONFIG_CODE + task.getPoint_code1(),
NoticeTypeEnum.WARN.getCode());
// 消息通知
throw new BadRequestException("覆膜区不可用!");
}
// 把这个设备位放到任务中
JSONObject response = new JSONObject();
String responseParam = task.getResponse_param();
if (ObjectUtil.isNotEmpty(responseParam)) {
response = JSON.parseObject(responseParam);
}
response.put("fmj_device", LaminatePoint.getPoint_code());
// 生产木托盘编码
// 设置终点并修改创建成功状态
task.setPoint_code3(LaminatePoint.getParent_point_code());
task.setPoint_code4(startPoint);
task.setResponse_param(response.toJSONString());
// 覆膜机对接位上锁
SchBasePoint basePoint = pointService.getById(LaminatePoint.getParent_point_code());
basePoint.setIng_task_code(task.getTask_code());
PointUtils.setUpdateByAcs(basePoint);
pointService.updateById(basePoint);
}
// 把这个设备位放到任务中
response.put("fmj_device", LaminatePoint.getPoint_code());
// 生产木托盘编码
// 设置终点并修改创建成功状态
task.setPoint_code3(LaminatePoint.getParent_point_code());
task.setPoint_code4(startPoint);
task.setTask_status(TaskStatus.CREATED.getCode());
task.setRemark("");
taskService.updateById(task);
taskService.save(task);
// 包装线上锁
packagePoint.setIng_task_code(task.getTask_code());
PointUtils.setUpdateByAcs(packagePoint);
pointService.updateById(packagePoint);
// 覆膜机对接位
SchBasePoint basePoint = pointService.getById(LaminatePoint.getParent_point_code());
basePoint.setIng_task_code(task.getTask_code());
PointUtils.setUpdateByAcs(basePoint);
pointService.updateById(basePoint);
//下发
//this.renotifyAcs(task);
}
}
@ -164,6 +167,7 @@ public class FJMKTask extends AbstractTask {
.collect(Collectors.toList());
String requestParam = task.getRequest_param();// 任务的其他数据
JSONObject jsonObject = JSONObject.parseObject(requestParam);
String workOrderCode = jsonObject.getString("workorder_code"); // 工单
String startPoint = task.getPoint_code1();
// 获取起点 回写载具编码
SchBasePoint startPointObj = pointService.getById(startPoint);
@ -185,51 +189,53 @@ public class FJMKTask extends AbstractTask {
for (ApplyDeviceDto applyDeviceDto : list) {
sum += Integer.parseInt(applyDeviceDto.getQty());
}
// 2.1 获取库存剩余数量 + 2.2 获取在搬运任务 - 组盘绑定状态是带绑定状态、任务类型是创建完成、下发、执行中
// 2 获取剩余量 surplusNumber
// 2.1 获取库存剩余数量 + 2.2 获取在搬运任务 ( 组盘绑定状态是带绑定状态、任务类型是创建完成、下发、执行中 )
int surplusNumber = fjMapper.getInventoryQuantity();
int total = sum + surplusNumber; // 现有总数
// 3 获取木托盘需要多少块
int needFullNumber = 255; // todo: 具体未知如何获取
JSONObject response = new JSONObject();
String responseParam = task.getResponse_param();
if (ObjectUtil.isNotEmpty(responseParam)) {
response = JSON.parseObject(responseParam);
}
// 大于两托正常,大于1托给个1,小于1托给2
// 4 校验是否够码满一托/两托
if ((total % needFullNumber) == 0) {
// 不可以叫空木托盘
// response.put("")
} else if ((total % needFullNumber) < 2) {
// 不可以叫空木托盘
}
// 大于2就可以码
/** 覆膜机木托盘位 */
SchBasePoint LaminatePoint = findStartPoint(startRegionStr, jsonObject);
if (ObjectUtil.isEmpty(LaminatePoint)) {
noticeService.createNotice("覆膜区不可用!", TASK_CONFIG_CODE + task.getPoint_code1(),
NoticeTypeEnum.WARN.getCode());
// 消息通知
throw new BadRequestException("覆膜区不可用!");
// 3 现有总数 total
int total = sum + surplusNumber;
// 4 获取木托盘需要多少块 needFullNumber
PdmBdWorkorder workorder = workorderService.getByCode(workOrderCode);
String needFullNumberStr = fjMapper.getNeedFullNumber(workorder.getMaterial_id());
int needFullNumber = TaskUtils.convertMultiply(needFullNumberStr);
// 大于两托正常,大于1托给1,小于1托给2
// 5 校验是否够码满一托/两托
// 大于等于2就可以码
if (total/needFullNumber >= 2) {
/** 覆膜机木托盘位 */
SchBasePoint LaminatePoint = findStartPoint(startRegionStr, jsonObject);
if (ObjectUtil.isEmpty(LaminatePoint)) {
noticeService.createNotice("覆膜区不可用!", TASK_CONFIG_CODE + task.getPoint_code1(),
NoticeTypeEnum.WARN.getCode());
// 消息通知
throw new BadRequestException("覆膜区不可用!");
}
// 把这个设备位放到任务中
JSONObject response = new JSONObject();
String responseParam = task.getResponse_param();
if (ObjectUtil.isNotEmpty(responseParam)) {
response = JSON.parseObject(responseParam);
}
response.put("fmj_device", LaminatePoint.getPoint_code());
// 生产木托盘编码
// 设置终点并修改创建成功状态
task.setPoint_code3(LaminatePoint.getParent_point_code());
task.setPoint_code4(startPoint);
task.setResponse_param(response.toJSONString());
// 覆膜机对接位上锁
SchBasePoint basePoint = pointService.getById(LaminatePoint.getParent_point_code());
basePoint.setIng_task_code(task.getTask_code());
PointUtils.setUpdateByAcs(basePoint);
pointService.updateById(basePoint);
}
// 把这个设备位放到任务中
response.put("fmj_device", LaminatePoint.getPoint_code());
// 生产木托盘编码
// 设置终点并修改创建成功状态
task.setPoint_code3(LaminatePoint.getParent_point_code());
task.setPoint_code4(startPoint);
task.setTask_status(TaskStatus.CREATED.getCode());
task.setRemark("");
taskService.save(task);
// 包装线上锁
packagePoint.setIng_task_code(task.getTask_code());
PointUtils.setUpdateByAcs(packagePoint);
pointService.updateById(packagePoint);
// 覆膜机对接位
SchBasePoint basePoint = pointService.getById(LaminatePoint.getParent_point_code());
basePoint.setIng_task_code(task.getTask_code());
PointUtils.setUpdateByAcs(basePoint);
pointService.updateById(basePoint);
}
@Override

8
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/mapper/FJMapper.java

@ -18,4 +18,12 @@ public interface FJMapper {
SchBasePoint findPointForFJQK(List<String> regionCode, @Param("fluentPut") JSONObject fluentPut);
int getInventoryQuantity();
/**
* 获取满托需要多少块
* eg: 2*7*6
* @param materialId
* @return
*/
String getNeedFullNumber(String materialId);
}

7
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/mapper/FJMapper.xml

@ -60,4 +60,11 @@
) AND vg.group_bind_material_status = '1'
)
</select>
<select id="getNeedFullNumber" resultType="java.lang.String">
SELECT
pack_method
FROM
`md_base_material`
WHERE material_id = #{materialId}
</select>
</mapper>

1
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/hn/HNMLTask.java

@ -310,7 +310,6 @@ public class HNMLTask extends AbstractTask {
String vehicleCode = TaskUtils.defaultVehicleCode(param.getString("vehicle_code"));
String vehicleType = param.getString("vehicle_type");
// 泥料物料对应不出物料标识
// todo: 暂未处理
String packNo = param.getString("material_code"); // 泥料编码: 吨袋号,泥料前
String materialCode = packNo.substring(0, 12);
String mixTimes = packNo.substring(18, packNo.length()); // 碾次

7
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/yz/YZSLTask.java

@ -308,14 +308,14 @@ public class YZSLTask extends AbstractTask {
}
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
String startPoint = taskObj.getPoint_code1(); // 获取起点
String endPoint = taskObj.getPoint_code2(); // 获取终点
SchBasePoint startPointObj = pointService.getById(startPoint);
SchBasePoint endPointObj = pointService.getById(endPoint);
if (ObjectUtil.isNotEmpty(endPointObj)) {
// 终点解锁
endPointObj.setIng_task_code("");
// 终点清空
PointUtils.setUpdateByType(endPointObj, taskFinishedType);
PointUtils.clearPointAndRetainNum(endPointObj);
pointService.updateById(endPointObj);
// 组盘表数据改成已绑定
SchBaseVehiclematerialgroup vehiclematerialgroup = vehiclematerialgroupService.getById(taskObj.getGroup_id());
@ -342,9 +342,6 @@ public class YZSLTask extends AbstractTask {
TaskUtils.setWorkOrderUpdateByType(bdWorkorder, taskFinishedType);
workorderService.updateById(bdWorkorder);
}
// 起点清空
PointUtils.setUpdateByType(startPointObj, taskFinishedType);
PointUtils.clearPointAndRetainNum(startPointObj);
// 任务完成
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
taskObj.setRemark(GeneralDefinition.TASK_FINISH);

17
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/util/TaskUtils.java

@ -175,4 +175,21 @@ public class TaskUtils {
}
return String.format("%04d", Integer.parseInt(acsVehicleCode));
}
/**
* 将输入的字符串相乘得出值
* eg: 2*7*6
* return: 84
* @param needFullNumberStr
* @return
*/
public static int convertMultiply(String needFullNumberStr) {
String[] parts = needFullNumberStr.split("\\*"); // 使用 "*" 来分割字符串
int result = 1; // 初始化结果为1
for (String part : parts) {
int number = Integer.parseInt(part); // 将字符串部分解析为整数
result *= number; // 将解析的整数与结果相乘
}
return result;
}
}

29
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/util/Tes.java

@ -0,0 +1,29 @@
package org.nl.wms.util;
import java.io.IOException;
/**
* @Author: lyd
* @Description:
* @Date: 2023/10/8
*/
public class Tes {
public static void main(String[] args) {
String videoFilePath = "video.mp4";
String audioFilePath = "audio.wav";
String ffmpegCommand = "ffmpeg -i " + videoFilePath + " -vn -acodec pcm_s16le -ar 44100 -ac 2 " + audioFilePath;
try {
Process process = Runtime.getRuntime().exec(ffmpegCommand);
int exitCode = process.waitFor();
if (exitCode == 0) {
System.out.println("音频提取完成");
} else {
System.err.println("音频提取失败");
}
} catch (IOException | InterruptedException e) {
e.printStackTrace();
}
}
}

2
lms/nladmin-system/nlsso-server/src/main/resources/config/application.yml

@ -42,7 +42,7 @@ spring:
freemarker:
check-template-location: false
profiles:
active: dev
active: prod
jackson:
time-zone: GMT+8
data:

Loading…
Cancel
Save