Browse Source

fix: 手持:压机搬运、货架盘点、出窑取双层输送线逻辑

master
李永德 1 year ago
parent
commit
0e9840310f
  1. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/LogMessageConstant.java
  2. 29
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/controller/PdaController.java
  3. 8
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/PdaService.java
  4. 13
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/dao/dto/CommonQueryDto.java
  5. 4
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/dao/dto/ManualResidueInDto.java
  6. 25
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/dao/dto/PressMoveDto.java
  7. 17
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/dao/dto/ShelfSaveDto.java
  8. 25
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/dao/mapper/PdaMapper.java
  9. 31
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/dao/mapper/PdaMapper.xml
  10. 17
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/dao/vo/MaterialInfoVo.java
  11. 85
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/impl/PdaServiceImpl.java
  12. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AbstractTask.java
  13. 9
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/yao/GZYQLTask.java
  14. 14
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/util/TaskUtils.java
  15. 2
      lms/nladmin-system/nlsso-server/src/main/resources/config/application.yml

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

@ -42,6 +42,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";
}

29
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/controller/PdaController.java

@ -232,4 +232,33 @@ public class PdaController {
public ResponseEntity<PdaResponseVo> bindingVehicle(@Validated @RequestBody VehicleBindingDto vehicleBindingDto){
return new ResponseEntity<>(pdaService.bindingVehicle(vehicleBindingDto), HttpStatus.OK);
}
@PostMapping("/pressSendMaterial/pressTask")
@Log("压机送料-动作")
@ApiOperation("压机送料-动作")
public ResponseEntity<PdaResponseVo>pressTask(@Validated @RequestBody PressMoveDto pressMoveDto){
return new ResponseEntity<>(pdaService.pressTask(pressMoveDto), HttpStatus.OK);
}
@PostMapping("/pressSendMaterial/pressPointList")
@Log("压机送料-下拉框")
@ApiOperation("压机送料-下拉框")
public ResponseEntity<Object>pressPointList(){
return new ResponseEntity<>(pdaService.pressPointList(), HttpStatus.OK);
}
@PostMapping("/shelf/materialQuery")
@Log("货架盘点-物料查询")
@ApiOperation("货架盘点-物料查询")
public ResponseEntity<Object>materialQuery(@Validated @RequestBody CommonQueryDto commonQueryDto){
return new ResponseEntity<>(pdaService.materialQuery(commonQueryDto), HttpStatus.OK);
}
@PostMapping("/shelf/updateData")
@Log("货架盘点-物料查询")
@ApiOperation("货架盘点-物料查询")
public ResponseEntity<Object>updateData(@Validated @RequestBody ShelfSaveDto shelfSaveDto){
return new ResponseEntity<>(pdaService.updateData(shelfSaveDto), HttpStatus.OK);
}
}

8
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/PdaService.java

@ -57,4 +57,12 @@ public interface PdaService {
List<TaskShowVo> packingTaskShow();
PdaResponseVo bindingVehicle(VehicleBindingDto vehicleBindingDto);
PdaResponseVo pressTask(PressMoveDto pressMoveDto);
List<MaterialInfoVo> materialQuery(CommonQueryDto commonQueryDto);
PdaResponseVo updateData(ShelfSaveDto shelfSaveDto);
List<DropdownListVo> pressPointList();
}

13
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/dao/dto/CommonQueryDto.java

@ -0,0 +1,13 @@
package org.nl.wms.pda.service.dao.dto;
import lombok.Data;
/**
* @Author: lyd
* @Description: 通用实体
* @Date: 2023/10/16
*/
@Data
public class CommonQueryDto {
private String material_code;
}

4
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/dao/dto/ManualResidueInDto.java

@ -11,4 +11,8 @@ import lombok.Data;
public class ManualResidueInDto {
private String vehicle_code;
private String qty;
/**
* 剩余数量
*/
private String surplus_quantity;
}

25
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/dao/dto/PressMoveDto.java

@ -0,0 +1,25 @@
package org.nl.wms.pda.service.dao.dto;
import lombok.Data;
/**
* @Author: lyd
* @Description: 压机搬运dto
* @Date: 2023/10/16
*/
@Data
public class PressMoveDto {
/**
* 设备编码对接位
*/
private String device_code;
/**
* 载具编码
*/
private String vehicle_code;
/**
* 数量
*/
private String qty;
}

17
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/dao/dto/ShelfSaveDto.java

@ -0,0 +1,17 @@
package org.nl.wms.pda.service.dao.dto;
import lombok.Data;
/**
* @Author: lyd
* @Description: 货架组盘信息dto
* @Date: 2023/10/16
*/
@Data
public class ShelfSaveDto {
private String point_code;
private String point_status;
private String vehicle_code;
private String material_qty;
private String material_id;
}

25
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/dao/mapper/PdaMapper.java

@ -1,9 +1,7 @@
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.ManualWorkOrderVo;
import org.nl.wms.pda.service.dao.vo.StandTimeShowVo;
import org.nl.wms.pda.service.dao.vo.TaskShowVo;
import org.nl.wms.pda.service.dao.dto.CommonQueryDto;
import org.nl.wms.pda.service.dao.vo.*;
import org.nl.wms.sch.point.service.dao.SchBasePoint;
import java.util.List;
@ -54,4 +52,23 @@ public interface PdaMapper {
* @return
*/
List<TaskShowVo> getRunningTaskByEnd(String point_code, String task_config);
/**
* 获取所有点位
* @return
*/
List<DropdownListVo> getAllPoint();
/**
* 查询物料
* @param commonQueryDto
* @return
*/
List<MaterialInfoVo> materialQuery(CommonQueryDto commonQueryDto);
/**
* 压机对接为
* @return
*/
List<DropdownListVo> getAllPressPoint();
}

31
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/dao/mapper/PdaMapper.xml

@ -118,4 +118,35 @@
LEFT JOIN sch_base_point p4 ON p4.point_code = t.point_code4
WHERE task_status IN ('1','2','3','4') AND t.point_code2 = #{point_code} AND t.config_code = #{task_config}
</select>
<select id="getAllPoint" 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.is_used = TRUE
ORDER BY p.point_code
</select>
<select id="materialQuery" resultType="org.nl.wms.pda.service.dao.vo.MaterialInfoVo">
SELECT
mm.material_id,
mm.material_code,
mm.material_name,
mm.material_spec,
mm.material_model
FROM
`md_base_material` mm
WHERE mm.material_code LIKE '%${material_code}%' OR mm.material_name LIKE '%ss%'
</select>
<select id="getAllPressPoint" 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 = 'YZ'
AND p.point_type = '2'
</select>
</mapper>

17
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/dao/vo/MaterialInfoVo.java

@ -0,0 +1,17 @@
package org.nl.wms.pda.service.dao.vo;
import lombok.Data;
/**
* @Author: lyd
* @Description: 物料信息VO
* @Date: 2023/10/16
*/
@Data
public class MaterialInfoVo {
private String material_id;
private String material_code;
private String material_name;
private String material_spec;
private String material_model;
}

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

@ -29,10 +29,13 @@ import org.nl.wms.sch.task.service.ISchBaseTaskService;
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.nl.wms.sch.task_manage.enums.PointStatusEnum;
import org.nl.wms.sch.task_manage.enums.WorkOrderStatusEnum;
import org.nl.wms.util.PointUtils;
import org.nl.wms.util.TaskUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
@ -64,7 +67,7 @@ public class PdaServiceImpl implements PdaService {
@Override
public List<DropdownListVo> getDeviceInfo() {
// 暂定压机区域
return pdaMapper.getDeviceInfo();
return pdaMapper.getAllPoint();
}
@Override
@ -225,6 +228,7 @@ public class PdaServiceImpl implements PdaService {
SchBasePoint rgcdw01 = pointService.getById("RGCDW01");
param.put("vehicle_code", rgcdw01.getVehicle_code());
param.put("vehicle_type", GeneralDefinition.STEEL_TRAY);
param.put("user_id", "1");
taskService.apply(param);
return PdaResponseVo.pdaResultOk("空盘入库请求成功");
}
@ -241,6 +245,7 @@ public class PdaServiceImpl implements PdaService {
JSONObject param = new JSONObject();
param.put("device_code", "RGMDW01");
param.put("config_code", "FJQKTask");
param.put("user_id", "1");
taskService.apply(param);
return PdaResponseVo.pdaResultOk("呼叫木托盘请求成功");
}
@ -257,6 +262,7 @@ public class PdaServiceImpl implements PdaService {
JSONObject param = new JSONObject();
param.put("device_code", "RGCDW01");
param.put("config_code", "FJQLTask");
param.put("user_id", "1");
taskService.apply(param);
return PdaResponseVo.pdaResultOk("呼叫物料请求成功");
}
@ -276,6 +282,7 @@ public class PdaServiceImpl implements PdaService {
param.put("qty", manualResidueInDto.getQty());
param.put("vehicle_code", manualResidueInDto.getVehicle_code());
param.put("vehicle_qty", "1");
param.put("user_id", "1");
taskService.apply(param);
return PdaResponseVo.pdaResultOk("剩料入库请求成功");
}
@ -295,6 +302,7 @@ public class PdaServiceImpl implements PdaService {
param.put("qty", manualResidueInDto.getQty());
param.put("vehicle_code", manualResidueInDto.getVehicle_code());
param.put("vehicle_qty", "1");
param.put("user_id", "1");
taskService.apply(param);
return PdaResponseVo.pdaResultOk("包装入库请求成功");
}
@ -325,4 +333,79 @@ public class PdaServiceImpl implements PdaService {
vehicleBindingService.save(vehicleBinding);
return PdaResponseVo.pdaResultOk("载具绑定成功!");
}
@Override
public PdaResponseVo pressTask(PressMoveDto pressMoveDto) {
JSONObject param = (JSONObject) JSONObject.toJSON(pressMoveDto);
param.put("user_id", "1");
param.put("config_code", "YZMLTask");
taskService.apply(param);
return PdaResponseVo.pdaResultOk("压机入库请求成功");
}
@Override
public List<MaterialInfoVo> materialQuery(CommonQueryDto commonQueryDto) {
return pdaMapper.materialQuery(commonQueryDto);
}
@Override
@Transactional(rollbackFor = Exception.class)
public PdaResponseVo updateData(ShelfSaveDto shelfSaveDto) {
// 货位号填充HCHJ+***
String pointCode = "HCHJ" + String.format("%03d", Integer.parseInt(shelfSaveDto.getPoint_code()));
// 获取点位
shelfSaveDto.setPoint_code(pointCode);
SchBasePoint basePoint = pointService.getById(shelfSaveDto.getPoint_code());
basePoint.setPoint_status(shelfSaveDto.getPoint_status());
PointUtils.setUpdateByPC(basePoint);
if (shelfSaveDto.getPoint_status().equals(PointStatusEnum.EMPTY_POINT.getCode())) {
// 空位
PointUtils.clearPoint(basePoint);
return PdaResponseVo.pdaResultOk("货位情况成功");
} else if (shelfSaveDto.getPoint_status().equals(PointStatusEnum.FULL_POINT.getCode())){
// 设置物料
toSaveGroupMaterial(shelfSaveDto);// 保存组盘
basePoint.setVehicle_code(shelfSaveDto.getVehicle_code());
basePoint.setVehicle_type(GeneralDefinition.STEEL_TRAY);
basePoint.setVehicle_qty(1);
}
pointService.updateById(basePoint);
return PdaResponseVo.pdaResultOk("组盘成功");
}
@Override
public List<DropdownListVo> pressPointList() {
return pdaMapper.getAllPressPoint();
}
/**
* 保存组盘信息
* @param shelfSaveDto
*/
private void toSaveGroupMaterial(ShelfSaveDto shelfSaveDto) {
MdBaseMaterial material = materialService.getById(shelfSaveDto.getMaterial_id());
SchBasePoint basePoint = pointService.getById(shelfSaveDto.getPoint_code());
if (ObjectUtil.isEmpty(material)) {
throw new BadRequestException("物料信息不存在");
}
SchBaseVehiclematerialgroup group = new SchBaseVehiclematerialgroup();
group.setGroup_id(IdUtil.getSnowflake(1,1).nextIdStr());
group.setMaterial_qty(Integer.valueOf(shelfSaveDto.getMaterial_qty()));
group.setMaterial_id(shelfSaveDto.getMaterial_id());
group.setGroup_bind_material_status(GroupBindMaterialStatusEnum.BOUND.getValue());
group.setVehicle_code(shelfSaveDto.getVehicle_code());
group.setVehicle_type(GeneralDefinition.STEEL_TRAY);
group.setPoint_code(basePoint.getPoint_code()); // 对接位
group.setPoint_name(basePoint.getPoint_name());
group.setSource_vehicle_code(basePoint.getPoint_code());
group.setMove_way(basePoint.getPoint_code());
group.setPcsn(DateUtil.format(DateUtil.date(), "yyyyMMdd"));
group.setGroup_status(GroupStatusEnum.IN_STORAGE.getType()); // 暂时不维护。
group.setIs_delete(false);
group.setIs_full(true);
group.setCreate_id(SecurityUtils.getCurrentUserId());
group.setCreate_name(SecurityUtils.getCurrentNickName());
group.setCreate_time(DateUtil.now());
vehiclematerialgroupService.save(group);
}
}

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

@ -297,7 +297,7 @@ public abstract class AbstractTask {
// 设置组盘 - 需要的话由子类自行实现
task.setGroup_id(this.setGroupPlate(param));
task.setRequest_param(JSONObject.toJSONString(param));
TaskUtils.setCreateByAcs(task); // 设置创建人信息
TaskUtils.setCreateByAcsOrPda(task, param); // 设置创建人信息
// 3、判断是否直接找点下发
if (taskConfig.getIs_immediate_create()) {
this.createCompletion(task);

9
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/yao/GZYQLTask.java

@ -132,11 +132,6 @@ public class GZYQLTask extends AbstractTask {
*/
private SchBasePoint findStartPoint(List<String> startRegionStr, JSONObject jsonObject) {
// 无需工单
// 判断是使用desc还是asc
int countUp = yzMapper.countConveyorLine(startRegionStr.get(0), GeneralDefinition.UPPER_CONVEYOR_LINE,
PointStatusEnum.EMPTY_VEHICLE.getCode());
int countLower = yzMapper.countConveyorLine(startRegionStr.get(0), GeneralDefinition.LOWER_CONVEYOR_LINE,
PointStatusEnum.EMPTY_VEHICLE.getCode());
// 默认认为缓存线有东西
LambdaQueryWrapper<SchBasePoint> lam = new LambdaQueryWrapper<>();
lam.in(SchBasePoint::getRegion_code, startRegionStr)
@ -146,7 +141,8 @@ public class GZYQLTask extends AbstractTask {
.eq(SchBasePoint::getIng_task_code, ""))
.eq(SchBasePoint::getPoint_status, PointStatusEnum.EMPTY_VEHICLE.getCode())
.eq(SchBasePoint::getIs_used, true)
.orderBy(true, countUp > countLower, SchBasePoint::getPoint_code);;
.ne(SchBasePoint::getVehicle_qty, 5)
.orderByDesc(SchBasePoint::getVehicle_qty); // 每次都将载具数量+1,每次拿最大的
List<SchBasePoint> schBasePoints = pointService.list(lam);
return ObjectUtil.isNotEmpty(schBasePoints) ? schBasePoints.get(0) : null;
}
@ -205,6 +201,7 @@ public class GZYQLTask extends AbstractTask {
if (ObjectUtil.isNotEmpty(startPointObj)) {
startPointObj.setIng_task_code("");
PointUtils.setUpdateByType(startPointObj, taskFinishedType);
PointUtils.clearPointAndRetainNum(startPointObj);
pointService.updateById(startPointObj);
}
// 任务完成

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

@ -2,6 +2,7 @@ package org.nl.wms.util;
import cn.hutool.core.date.DateUtil;
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.utils.SecurityUtils;
@ -29,6 +30,19 @@ public class TaskUtils {
taskObj.setCreate_name(GeneralDefinition.ACS_NAME);
taskObj.setCreate_time(DateUtil.now());
}
public static void setCreateByPda(SchBaseTask taskObj) {
taskObj.setCreate_id(SecurityUtils.getCurrentUserId());
taskObj.setCreate_name(SecurityUtils.getCurrentNickName());
taskObj.setCreate_time(DateUtil.now());
}
public static void setCreateByAcsOrPda(SchBaseTask taskObj, JSONObject param) {
// 如果是人工创建,会带个用户过来
if (ObjectUtil.isNotEmpty(param.getString("user_id"))) {
setCreateByPda(taskObj);
} else {
setCreateByAcs(taskObj);
}
}
public static void setUpdateByAcs(SchBaseTask taskObj) {
taskObj.setUpdate_id(GeneralDefinition.ACS_ID);

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