Browse Source

opt: 人工分拣与自动分拣一样的功能

master
李永德 1 year ago
parent
commit
8249664844
  1. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/LogMessageConstant.java
  2. 3
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/material/service/dao/MdBaseMaterial.java
  3. 41
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/material/service/dao/mapper/MdBaseMaterialMapper.xml
  4. 4
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/FJMKTask.java
  5. 48
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/FJRKTask.java
  6. 15
      lms/nladmin-system/nlsso-server/src/test/java/org/nl/point/test.java
  7. 1
      lms/nladmin-ui/src/views/wms/sch/group/MaterialDialog.vue

2
lms/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/LogMessageConstant.java

@ -41,6 +41,6 @@ public class LogMessageConstant {
/** 背景颜色:黄色 */
public final static String BACKGROUND_YELLOW = "\u001B[43m";
/** 索引路径 */
public final static String INDEX_DIR = "D:\\lucene\\index";
public final static String INDEX_DIR = "E:\\lucene\\index";
}

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

@ -1,6 +1,7 @@
package org.nl.wms.database.material.service.dao;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
@ -126,4 +127,6 @@ public class MdBaseMaterial implements Serializable {
private String pack_method;
private String pack_directsize;
private String draw_address;
@TableField(exist = false)
private String total_material_qty;
}

41
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/material/service/dao/mapper/MdBaseMaterialMapper.xml

@ -9,28 +9,31 @@
vg.group_bind_material_status,
p.region_code,
p.point_status,
ROW_NUMBER() OVER (PARTITION BY mm.material_id ORDER BY mm.material_id) AS row_num
SUM(vg.material_qty) OVER (PARTITION BY mm.material_code) AS total_material_qty,
ROW_NUMBER() OVER ( PARTITION BY mm.material_id ORDER BY mm.material_id ) AS row_num
FROM
`md_base_material` mm
LEFT JOIN sch_base_vehiclematerialgroup vg ON vg.material_id = mm.material_id
LEFT JOIN sch_base_point p ON p.vehicle_code = vg.vehicle_code AND p.vehicle_type = vg.vehicle_type
LEFT JOIN pdm_bd_workorder wo ON wo.region_code = 'FJ' AND wo.material_id = mm.material_id AND wo.workorder_status = '3'
WHERE vg.group_bind_material_status = '2' AND p.region_code = 'GTPHC' AND p.point_status = '3' AND wo.workorder_code IS NOT NULL
<if test="query.blurry != null">
AND (mm.material_code LIKE '%${query.blurry}%' OR mm.material_name LIKE '%${query.blurry}%')
</if>
)
SELECT
CTE.material_id,
CTE.material_code,
CTE.material_name,
CTE.material_spec,
CTE.half_material_code,
CTE.raw_material_code,
CTE.standing_time,
CTE.update_name,
CTE.update_time
FROM CTE
WHERE row_num = 1
WHERE
vg.group_bind_material_status = '2'
AND p.region_code = 'GTPHC'
AND p.point_status = '3'
) SELECT
CTE.material_id,
CTE.material_code,
CTE.material_name,
CTE.material_spec,
CTE.total_material_qty,
CTE.half_material_code,
CTE.raw_material_code,
CTE.standing_time,
CTE.update_name,
CTE.update_time
FROM
CTE
WHERE
row_num = 1
ORDER BY CTE.total_material_qty DESC
</select>
</mapper>

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

@ -375,9 +375,7 @@ public class FJMKTask extends AbstractTask {
workorderService.updateById(workorder);
}
// 分拣机械手: 清空
PointUtils.setUpdateByType(fjcPointObj, taskFinishedType);
PointUtils.clearPoint(fjcPointObj);
if (ObjectUtil.isNotEmpty(fmPointObj)) {
if (ObjectUtil.isNotEmpty(fjcPointObj)) {
// 机械手对接位: 赋值
fjcPointObj.setPoint_status(PointStatusEnum.EMPTY_VEHICLE.getCode());
fjcPointObj.setVehicle_qty(1);

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

@ -30,6 +30,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@ -101,8 +102,6 @@ public class FJRKTask extends AbstractTask {
.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());
@ -115,18 +114,9 @@ public class FJRKTask extends AbstractTask {
throw new BadRequestException("找不到可用的包装位!");
}
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) {
boolean enoughCallEmpty = workorderService.isEnoughCallEmpty(task.getPoint_code1());
if (enoughCallEmpty) {
/** 覆膜机木托盘位 */
SchBasePoint LaminatePoint = findStartPoint(startRegionStr, jsonObject);
if (ObjectUtil.isEmpty(LaminatePoint)) {
@ -301,17 +291,22 @@ public class FJRKTask extends AbstractTask {
}
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
String requestParam = taskObj.getRequest_param();
JSONObject jsonObject = JSONObject.parseObject(requestParam);
String workorderCode = jsonObject.getString("workorder_code");
PdmBdWorkorder workorder = workorderService.getByCode(workorderCode);
// 获取参数
String endPoint = taskObj.getPoint_code2(); // 获取终点
String startPoint = taskObj.getPoint_code1(); // 获取终点
SchBasePoint startPointObj = pointService.getById(startPoint);
String fjcPoint = taskObj.getPoint_code4(); // 获取起点
String fmPoint = taskObj.getPoint_code3(); // 获取覆膜机
SchBasePoint fjcPointObj = pointService.getById(fjcPoint);
SchBasePoint endPointObj = pointService.getById(endPoint);
SchBasePoint fmPointObj = pointService.getById(fmPoint);
// 设置载具类型、点位状态、释放点位
if (ObjectUtil.isNotEmpty(endPoint)) {
endPointObj.setIng_task_code("");
PointUtils.setUpdateByType(endPointObj, taskFinishedType);
pointService.updateById(endPointObj);
// 组盘设置已经解绑
SchBaseVehiclematerialgroup vehicleMaterialGroupObj =
vehiclematerialgroupService.getById(taskObj.getGroup_id());
@ -322,8 +317,25 @@ public class FJRKTask extends AbstractTask {
TaskUtils.setGroupUpdateByType(vehicleMaterialGroupObj, taskFinishedType);
vehiclematerialgroupService.updateById(vehicleMaterialGroupObj);
}
PointUtils.setUpdateByType(startPointObj, taskFinishedType);
PointUtils.clearPoint(startPointObj);
if (ObjectUtil.isNotEmpty(fmPointObj)) {
// 覆膜位: 解锁 . 清空
PointUtils.setUpdateByType(fmPointObj, taskFinishedType);
PointUtils.clearPoint(fmPointObj);
// 工单的真实数+1
workorder.setReal_qty(workorder.getReal_qty().add(BigDecimal.ONE));
TaskUtils.setWorkOrderUpdateByType(workorder, taskFinishedType);
workorderService.updateById(workorder);
}
// 分拣机械手: 清空
if (ObjectUtil.isNotEmpty(fjcPointObj)) {
// 机械手对接位: 赋值
fjcPointObj.setPoint_status(PointStatusEnum.EMPTY_VEHICLE.getCode());
fjcPointObj.setVehicle_qty(1);
fjcPointObj.setVehicle_type(taskObj.getVehicle_type());
fjcPointObj.setVehicle_code(taskObj.getVehicle_code2()); // 拿过来的载具编码
PointUtils.setUpdateByType(fjcPointObj, taskFinishedType);
pointService.updateById(fjcPointObj);
}
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
taskObj.setRemark(GeneralDefinition.TASK_FINISH);
taskObj.setFinished_type(taskFinishedType.getCode());

15
lms/nladmin-system/nlsso-server/src/test/java/org/nl/point/test.java

@ -72,16 +72,13 @@ public class test {
@Test
void test03() {
try {
for (int i = 0; i < 5; i++) {
System.out.println(i);
if (i==3) {
throw new RuntimeException("1");
}
}
} catch (Exception e) {
System.out.println(e.getMessage());
String[] parts = "168".split("\\*"); // 使用 "*" 来分割字符串
int result = 1; // 初始化结果为1
for (String part : parts) {
int number = Integer.parseInt(part); // 将字符串部分解析为整数
result *= number; // 将解析的整数与结果相乘
}
System.out.println(result);
}
@Test

1
lms/nladmin-ui/src/views/wms/sch/group/MaterialDialog.vue

@ -54,6 +54,7 @@
<el-table-column prop="raw_material_code" label="泥料编码" width="160" />
<el-table-column prop="material_name" label="物料名称" width="180" show-overflow-tooltip />
<el-table-column prop="material_spec" label="物料规格" width="140" />
<el-table-column v-if="queryInfo === '库存顺序'" prop="total_material_qty" label="物料总数/块" width="140" />
<el-table-column prop="standing_time" label="静置时间(分钟)" width="130px" />
<el-table-column prop="update_name" label="修改人" />
<el-table-column prop="update_time" label="修改时间" width="135" />

Loading…
Cancel
Save