Browse Source

opt: 分拣叫料规则、手持货架盘点、压机搬运

master
李永德 1 year ago
parent
commit
aca6a33ec3
  1. 11
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/impl/PdaServiceImpl.java
  2. 16
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/FJMKTask.java
  3. 86
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/FJRKTask.java
  4. 6
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/mapper/FJMapper.java
  5. 37
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/mapper/FJMapper.xml
  6. 4
      lms/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml
  7. 4
      lms/nladmin-ui/.env.development
  8. 1
      lms/nladmin-ui/src/views/wms/pdm/workerorder/index.vue

11
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/impl/PdaServiceImpl.java

@ -303,6 +303,7 @@ public class PdaServiceImpl implements PdaService {
param.put("vehicle_code", manualResidueInDto.getVehicle_code());
param.put("vehicle_qty", "1");
param.put("user_id", "1");
param.put("surplus_quantity", manualResidueInDto.getSurplus_quantity());
taskService.apply(param);
return PdaResponseVo.pdaResultOk("包装入库请求成功");
}
@ -359,9 +360,17 @@ public class PdaServiceImpl implements PdaService {
basePoint.setPoint_status(shelfSaveDto.getPoint_status());
PointUtils.setUpdateByPC(basePoint);
if (shelfSaveDto.getPoint_status().equals(PointStatusEnum.EMPTY_POINT.getCode())) {
// 如果有组盘信息,就把组盘信息解绑
if (ObjectUtil.isNotEmpty(basePoint.getVehicle_code())) {
SchBaseVehiclematerialgroup groupInfo = vehiclematerialgroupService.getGroupInfo(basePoint.getVehicle_code(),
GeneralDefinition.STEEL_TRAY, GroupBindMaterialStatusEnum.BOUND.getValue());
TaskUtils.setGroupUpdateByPC(groupInfo);
groupInfo.setGroup_bind_material_status(GroupBindMaterialStatusEnum.UNBOUND.getValue());
vehiclematerialgroupService.updateById(groupInfo);
}
// 空位
PointUtils.clearPoint(basePoint);
return PdaResponseVo.pdaResultOk("货位情况成功");
return PdaResponseVo.pdaResultOk("货位清空成功");
} else if (shelfSaveDto.getPoint_status().equals(PointStatusEnum.FULL_POINT.getCode())){
// 设置物料
toSaveGroupMaterial(shelfSaveDto);// 保存组盘

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

@ -82,6 +82,7 @@ public class FJMKTask extends AbstractTask {
String requestParam = task.getRequest_param();// 任务的其他数据
JSONObject jsonObject = JSONObject.parseObject(requestParam);
String workOrderCode = jsonObject.getString("workorder_code"); // 工单
PdmBdWorkorder workorder = workorderService.getByCode(workOrderCode);
String startPoint = task.getPoint_code1();
// 获取起点 回写载具编码
SchBasePoint startPointObj = pointService.getById(startPoint);
@ -98,7 +99,6 @@ public class FJMKTask extends AbstractTask {
continue;
}
task.setPoint_code2(packagePoint.getPoint_code()); // 包装线
// todo: 校验是否够码满一托
List<ApplyDeviceDto> list = JSONArray.parseArray(jsonObject.getString("list"), ApplyDeviceDto.class);
// 1 获取点位相应数量
int sum = 0;
@ -106,12 +106,10 @@ public class FJMKTask extends AbstractTask {
sum += Integer.parseInt(applyDeviceDto.getQty());
}
// 2 获取剩余量 surplusNumber
// 2.1 获取库存剩余数量 + 2.2 获取在搬运任务 ( 组盘绑定状态是带绑定状态、任务类型是创建完成、下发、执行中 )
int surplusNumber = fjMapper.getInventoryQuantity();
int surplusNumber = fjMapper.getInventoryQuantity(workorder.getMaterial_id());
// 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
@ -168,6 +166,7 @@ public class FJMKTask extends AbstractTask {
String requestParam = task.getRequest_param();// 任务的其他数据
JSONObject jsonObject = JSONObject.parseObject(requestParam);
String workOrderCode = jsonObject.getString("workorder_code"); // 工单
PdmBdWorkorder workorder = workorderService.getByCode(workOrderCode);
String startPoint = task.getPoint_code1();
// 获取起点 回写载具编码
SchBasePoint startPointObj = pointService.getById(startPoint);
@ -189,17 +188,12 @@ public class FJMKTask extends AbstractTask {
for (ApplyDeviceDto applyDeviceDto : list) {
sum += Integer.parseInt(applyDeviceDto.getQty());
}
// 2 获取剩余量 surplusNumber
// 2.1 获取库存剩余数量 + 2.2 获取在搬运任务 ( 组盘绑定状态是带绑定状态、任务类型是创建完成、下发、执行中 )
int surplusNumber = fjMapper.getInventoryQuantity();
// 2 获取库存量 surplusNumber
int surplusNumber = fjMapper.getInventoryQuantity(workorder.getMaterial_id());
// 3 现有总数 total
int total = sum + surplusNumber;
// 4 获取木托盘需要多少块 needFullNumber
PdmBdWorkorder workorder = workorderService.getByCode(workOrderCode);
String needFullNumberStr = fjMapper.getNeedFullNumber(workorder.getMaterial_id());
if (ObjectUtil.isEmpty(needFullNumberStr)) {
// todo: 同步物料数据
}
int needFullNumber = TaskUtils.convertMultiply(needFullNumberStr);
// todo: 大于两托正常,大于1托给1,小于1托给2
// 5 校验是否够码满一托/两托

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

@ -3,6 +3,7 @@ package org.nl.wms.sch.task_manage.task.tasks.fj;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.nl.common.exception.BadRequestException;
@ -22,6 +23,7 @@ import org.nl.wms.sch.task_manage.GeneralDefinition;
import org.nl.wms.sch.task_manage.enums.*;
import org.nl.wms.sch.task_manage.task.TaskType;
import org.nl.wms.sch.task_manage.task.core.TaskStatus;
import org.nl.wms.sch.task_manage.task.tasks.fj.mapper.FJMapper;
import org.nl.wms.util.PointUtils;
import org.nl.wms.util.TaskUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -53,6 +55,8 @@ public class FJRKTask extends AbstractTask {
private IPdmBdWorkorderService workorderService;
@Autowired
private ISchBaseVehiclematerialgroupService vehiclematerialgroupService;
@Autowired
private FJMapper fjMapper;
@Override
protected void create() throws BadRequestException {
// 最后一坨不需要呼叫空盘
@ -95,25 +99,91 @@ public class FJRKTask extends AbstractTask {
// 配置信息
SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>()
.eq(SchBaseTaskconfig::getConfig_code, TASK_CONFIG_CODE));
String requestParam = task.getRequest_param();// 任务的其他数据
JSONObject jsonObject = JSONObject.parseObject(requestParam);
String workOrderCode = jsonObject.getString("workorder_code"); // 工单
PdmBdWorkorder workorder = workorderService.getByCode(workOrderCode);
TaskUtils.setUpdateByAcs(task);
List<String> nextRegionStr = Arrays.stream(taskConfig.getNext_region_str().split(",")).collect(Collectors.toList());
List<String> startRegionStr = Arrays.stream(taskConfig.getStart_region_str().split(",")).collect(Collectors.toList());
// 找终点
SchBasePoint point = findNextPoint(nextRegionStr);
if (ObjectUtil.isEmpty(point)) {
SchBasePoint packagePoint = findNextPoint(nextRegionStr);
if (ObjectUtil.isEmpty(packagePoint)) {
// 消息通知
noticeService.createNotice("找不到可用的包装位!", TASK_CONFIG_CODE + task.getPoint_code1(),
NoticeTypeEnum.WARN.getCode());
throw new BadRequestException("找不到可用的包装位!");
}
// 设置终点并修改创建成功状态
task.setPoint_code2(point.getPoint_code());
task.setPoint_code2(packagePoint.getPoint_code());
// 1 剩余量
Integer surplusQuantity = jsonObject.getInteger("surplus_quantity"); // 码垛上剩余数量
// 2 获取库存量 surplusNumber
int surplusNumber = fjMapper.getInventoryQuantity(workorder.getMaterial_id());
// 3 现有总数 total
int total = surplusNumber + surplusQuantity;
// 4 获取木托盘需要多少块 needFullNumber
String needFullNumberStr = fjMapper.getNeedFullNumber(workorder.getMaterial_id());
int needFullNumber = TaskUtils.convertMultiply(needFullNumberStr);
// 5 校验是否够码满一托
// 大于等于1就可以码
if (total/needFullNumber >= 1) {
/** 覆膜机木托盘位 */
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(task.getPoint_code1());
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);
}
task.setTask_status(TaskStatus.CREATED.getCode());
task.setRemark("");
taskService.save(task);
// todo 判断是否够码满一垛,够就叫空盘,否则就是两点任务
point.setIng_task_code(task.getTask_code());
PointUtils.setUpdateByAcs(point);
pointService.updateById(point);
// 包装线上锁
packagePoint.setIng_task_code(task.getTask_code());
PointUtils.setUpdateByAcs(packagePoint);
pointService.updateById(packagePoint);
}
/**
* 从覆膜区找个空木托盘
* @param startRegionStr
* @param extData
* @return
*/
private SchBasePoint findStartPoint(List<String> startRegionStr, JSONObject extData) {
// 当前设备的工单
String workorderCode = extData.getString("workorder_code");
PdmBdWorkorder one = ObjectUtil.isNotEmpty(workorderCode)
? workorderService.getOne(new LambdaQueryWrapper<PdmBdWorkorder>()
.eq(PdmBdWorkorder::getWorkorder_code, workorderCode))
: null;
if (one == null) {
throw new BadRequestException("工单不能为空!");
}
String vehicleType = one.getVehicle_type();
// 向ACS请求所需木托盘在那个栈拆盘机?已经实时更新,故只需要自己查询即可
SchBasePoint endPointObj = fjMapper.findPointForFJQK(startRegionStr, new JSONObject()
.fluentPut("vehicleType", vehicleType).fluentPut("pointType", GeneralDefinition.DEVICE_POINT));
// 这个点的父点位为起点
return ObjectUtil.isNotEmpty(endPointObj) ? endPointObj : null;
}
/**

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

@ -17,7 +17,11 @@ public interface FJMapper {
SchBasePoint findPointForFJQK(List<String> regionCode, @Param("fluentPut") JSONObject fluentPut);
int getInventoryQuantity();
/**
* 获取库存剩余数量
* @return
*/
int getInventoryQuantity(String material_id);
/**
* 获取满托需要多少块

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

@ -46,20 +46,20 @@
#{code}
</foreach>
</select>
<select id="getInventoryQuantity" resultType="java.lang.Integer">
SELECT
IF(LENGTH(SUM(vg.material_qty)) > 0, SUM(vg.material_qty), 0) AS sum
FROM
`sch_base_vehiclematerialgroup` vg
WHERE (vg.point_code IN (
SELECT p.point_code FROM sch_base_point p WHERE p.region_code = 'GTPHC' AND p.point_status = '3' AND p.point_type = '2'
) AND vg.group_bind_material_status = '2')
OR (
vg.point_code IN (
SELECT t.point_code1 FROM sch_base_task t WHERE t.task_status IN (2,3,4) AND t.config_code = 'GZYMLTask'
) AND vg.group_bind_material_status = '1'
)
</select>
<!-- <select id="getInventoryQuantity" resultType="java.lang.Integer">-->
<!-- SELECT-->
<!-- IF(LENGTH(SUM(vg.material_qty)) > 0, SUM(vg.material_qty), 0) AS sum-->
<!-- FROM-->
<!-- `sch_base_vehiclematerialgroup` vg-->
<!-- WHERE (vg.point_code IN (-->
<!-- SELECT p.point_code FROM sch_base_point p WHERE p.region_code = 'GTPHC' AND p.point_status = '3' AND p.point_type = '2'-->
<!-- ) AND vg.group_bind_material_status = '2')-->
<!-- OR (-->
<!-- vg.point_code IN (-->
<!-- SELECT t.point_code1 FROM sch_base_task t WHERE t.task_status IN (2,3,4) AND t.config_code = 'GZYMLTask'-->
<!-- ) AND vg.group_bind_material_status = '1'-->
<!-- )-->
<!-- </select>-->
<select id="getNeedFullNumber" resultType="java.lang.String">
SELECT
pack_method
@ -67,4 +67,13 @@
`md_base_material`
WHERE material_id = #{materialId}
</select>
<select id="getInventoryQuantity" resultType="java.lang.Integer">
SELECT
IF(LENGTH(SUM(vg.material_qty)) > 0, SUM(vg.material_qty), 0) AS sum
FROM
`sch_base_point` p
LEFT JOIN sch_base_vehiclematerialgroup vg ON vg.vehicle_code = p.vehicle_code AND vg.vehicle_type = p.vehicle_type AND vg.group_bind_material_status = '2'
WHERE
region_code = 'GTPHC' AND material_id = #{materialId}
</select>
</mapper>

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

@ -1,5 +1,5 @@
server:
port: 8010
port: 8011
#配置数据源
spring:
autoconfigure:
@ -152,4 +152,4 @@ sa-token:
lucene:
index:
path: D:\lucene\index
path: C:\lucene\index

4
lms/nladmin-ui/.env.development

@ -1,8 +1,8 @@
ENV = 'development'
# 接口地址
VUE_APP_BASE_API = 'http://localhost:8010'
VUE_APP_WS_API = 'ws://localhost:8010'
VUE_APP_BASE_API = 'http://localhost:8011'
VUE_APP_WS_API = 'ws://localhost:8011'
# 是否启用 babel-plugin-dynamic-import-node插件
VUE_CLI_BABEL_TRANSPILE_MODULES = true

1
lms/nladmin-ui/src/views/wms/pdm/workerorder/index.vue

@ -304,6 +304,7 @@
{{ dict.label.vehicle_type[scope.row.vehicle_type] }}
</template>
</el-table-column>
<el-table-column prop="produce_date" label="生产日期" :min-width="flexWidth('produce_date',crud.data,'生产日期')"/>
<el-table-column
prop="planproducestart_date"
label="计划开始时间"

Loading…
Cancel
Save