Browse Source

opt: 手持操作,取空笼框优化

master
yanps 3 months ago
parent
commit
3eb61381fb
  1. 7
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/handheld/controller/HandheldController.java
  2. 4
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/handheld/service/HandheldService.java
  3. 40
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/handheld/service/impl/HandheldServiceImpl.java
  4. 1
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/dao/SchBaseVehiclematerialgroup.java
  5. 7
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/ISchBasePointService.java
  6. 3
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/dao/mapper/SchBasePointMapper.java
  7. 10
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/dao/mapper/SchBasePointMapper.xml
  8. 27
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/impl/SchBasePointServiceImpl.java
  9. 8
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/handheld/BlankingTask.java
  10. 25
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/handheld/EmptyCageTask.java
  11. 20
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/handheld/ToStoreHouseTask.java
  12. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/sorting/SortingSMTTask.java

7
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/handheld/controller/HandheldController.java

@ -62,14 +62,13 @@ public class HandheldController {
@ApiOperation("点位锁定释放")
@SaIgnore
public ResponseEntity<Object> applyPointLock(@RequestBody JSONObject param) {
handheldService.pointLock(param);
return new ResponseEntity<>(HttpStatus.OK);
return new ResponseEntity<>(handheldService.pointLock(param), HttpStatus.OK);
}
@PostMapping("/sourehouse")
@Log("物料回库")
@ApiOperation("物料回库")
@Log("补空框")
@ApiOperation("补空框")
@SaIgnore
public ResponseEntity<Object> createToStorehouse(@RequestBody JSONObject param) {
handheldService.toStorehouse(param);

4
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/handheld/service/HandheldService.java

@ -33,10 +33,10 @@ public interface HandheldService {
* 点位锁定
* @param param
*/
void pointLock(JSONObject param);
String pointLock(JSONObject param);
/**
* 物料回库任务
* 补空框
* @param param
*/
void toStorehouse(JSONObject param);

40
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/handheld/service/impl/HandheldServiceImpl.java

@ -9,11 +9,15 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import nl.basjes.shaded.org.springframework.util.Assert;
import org.nl.common.exception.BadRequestException;
import org.nl.system.service.notice.ISysNoticeService;
import org.nl.wms.ext.handheld.service.HandheldService;
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.region.service.ISchBaseRegionService;
import org.nl.wms.sch.region.service.dao.SchBaseRegion;
import org.nl.wms.sch.task.service.ISchBaseTaskService;
import org.nl.wms.sch.task_manage.AbstractTask;
import org.nl.wms.sch.task_manage.GeneralDefinition;
import org.nl.wms.sch.task_manage.task.TaskFactory;
@ -30,12 +34,14 @@ public class HandheldServiceImpl implements HandheldService {
@Autowired
private ISchBasePointService iSchBasePointService;
@Autowired
private TaskFactory taskFactory;
@Autowired
private ISchBaseRegionService iSchBaseRegionService;
@Autowired
private ISchBaseVehiclematerialgroupService iSchBaseVehiclematerialgroupService;
@Autowired
private ISchBaseTaskService iSchBaseTaskService;
@Override
@ -82,12 +88,12 @@ public class HandheldServiceImpl implements HandheldService {
@Override
public void cageBlankingTask(JSONObject param) {
Assert.noNullElements(new Object[]{param.getString("device_code"), param.getString("vehicle_code")
, param.getString("material_id"), param.getString("region_code"), param.getString("has_report")}, "参数不能为空!");
, param.getString("material_qty"), param.getString("region_code"), param.getString("order_code")}, "参数不能为空!");
String device_code = param.getString("device_code");
String vehicle_code = param.getString("vehicle_code");
String material_id = param.getString("material_id");
String material_qty = param.getString("material_qty");
String region_code = param.getString("region_code");
String has_report = param.getString("has_report");
String order_code = param.getString("order_id");
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(device_code);
if (ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("设备点位不存在!");
iSchBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
@ -103,43 +109,53 @@ public class HandheldServiceImpl implements HandheldService {
jo.put("region_code", region_code);
jo.put("ext_data", param);
connectorTask.apply(jo);
iSchBaseVehiclematerialgroupService.remove(Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class)
.eq(SchBaseVehiclematerialgroup::getVehicle_code, vehicle_code));
SchBaseVehiclematerialgroup schBaseVehiclematerialgroup = new SchBaseVehiclematerialgroup();
schBaseVehiclematerialgroup.setVehicle_code(vehicle_code);
schBaseVehiclematerialgroup.setMaterial_qty(Integer.parseInt(material_qty));
schBaseVehiclematerialgroup.setOrder_code(order_code);
iSchBaseVehiclematerialgroupService.create(schBaseVehiclematerialgroup);
}
@Override
public void pointLock(JSONObject param) {
public String pointLock(JSONObject param) {
Assert.noNullElements(new Object[]{param.getString("region_code"), param.getString("status")}, "参数不能为空!");
String region_code = param.getString("region_code");
String status = param.getString("status");
SchBaseRegion schBaseRegion = iSchBaseRegionService.getOne(Wrappers.lambdaQuery(SchBaseRegion.class)
.eq(SchBaseRegion::getRegion_code, region_code));
if (ObjectUtil.isEmpty(schBaseRegion)) throw new BadRequestException("该区域不存在!");
List<String> byRegionCode = iSchBasePointService.getByRegionCode(region_code);
if (StrUtil.equals(status, "0")) {
iSchBasePointService.releasePoint(region_code);
} else if (StrUtil.equals(status, "1")) {
iSchBasePointService.lockPoint(region_code);
}
if(CollUtil.isNotEmpty(byRegionCode) && byRegionCode.size()>0){
return "当前区域已存在的任务有" + byRegionCode.size() + "个";
}
return "操作成功";
}
@Override
public void toStorehouse(JSONObject param) {
Assert.noNullElements(new Object[]{param.getString("device_code"), param.getString("vehicle_code"), param.getString("ext")}, "参数不能为空!");
Assert.noNullElements(new Object[]{param.getString("device_code"), param.getString("vehicle_type")}, "参数不能为空!");
//点位编码
String device_code = param.getString("device_code");
//载具号
String vehicle_code = param.getString("vehicle_code");
String region_code = param.getString("region_code");
String vehicle_type = param.getString("vehicle_type");
//物料数据
String ext = param.getString("ext");
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(device_code);
if (ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("设备点位不存在!");
AbstractTask connectorTask = taskFactory.getTask("BLANKINGTask");
AbstractTask connectorTask = taskFactory.getTask("TOSTOREHOUSETask");
// 准备参数:设备编码
JSONObject jo = new JSONObject();
jo.put("device_code", device_code);
jo.put("config_code", "TOSTOREHOUSETask");
jo.put("create_mode", GeneralDefinition.AUTO_CREATION);
jo.put("vehicle_code", vehicle_code);
jo.put("region_code", region_code);
jo.put("vehicle_code", vehicle_type);
jo.put("ext_data", param);
connectorTask.apply(jo);
}

1
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/dao/SchBaseVehiclematerialgroup.java

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;

7
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/ISchBasePointService.java

@ -179,4 +179,11 @@ public interface ISchBasePointService extends IService<SchBasePoint> {
* @param region_code
*/
void lockPoint(String region_code);
/**
* 根据区域编码查找点位名称
* @return
*/
List<String> getByRegionCode(String region_code);
}

3
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/dao/mapper/SchBasePointMapper.java

@ -23,4 +23,7 @@ public interface SchBasePointMapper extends BaseMapper<SchBasePoint> {
SchBasePoint selectByIdLock(String id);
List<PointMaterialInfo> getStructList(@Param("region_code") String region_code, @Param("vehicle_type")String vehicle_type);
List<String> selectByRegionCode(@Param("region_code") String region_code);
}

10
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/dao/mapper/SchBasePointMapper.xml

@ -42,4 +42,14 @@
AND sch_base_point.region_code = #{region_code}
</select>
<select id="selectByRegionCode" resultType="java.lang.String">
select
sbp.vehicle_code
from
sch_base_point sbp
where
sbp.region_code = #{region_code}
and sbp.is_lock = true
and sbp.is_used = true
</select>
</mapper>

27
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/impl/SchBasePointServiceImpl.java

@ -68,6 +68,9 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
@Autowired
private ISysNoticeService noticeService;
private final String nameClass = "SchBasePoint";
@Override
public IPage<SchBasePoint> queryAll(Map whereJson, PageQuery page) {
String blurry = ObjectUtil.isNotEmpty(whereJson.get("blurry")) ? whereJson.get("blurry").toString() : null;
@ -386,7 +389,17 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
@Override
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
public SchBasePoint selectByEmptyCage(String region_code, String vehicle_type, String pointStatus, boolean isVehicle, SchBaseTask task) {
synchronized (this.nameClass){
List<SchBasePoint> schBasePoints = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class)
.eq(SchBasePoint::getIs_lock, false)
.eq(SchBasePoint::getIs_used, true)
.eq(SchBasePoint::getPoint_status, pointStatus)
.eq(SchBasePoint::getCan_vehicle_type, vehicle_type)
.isNotNull(SchBasePoint::getVehicle_code));
if(CollUtil.isNotEmpty(schBasePoints) && schBasePoints.size() > 0){
return schBasePoints.get(0);
}
schBasePoints = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class)
.eq(SchBasePoint::getIs_lock, false)
.eq(SchBasePoint::getIs_used, true)
.eq(SchBasePoint::getPoint_status, pointStatus)
@ -396,8 +409,8 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
.orderByDesc(SchBasePoint::getIn_order_seq));
if (CollUtil.isNotEmpty(schBasePoints) && schBasePoints.size() > 0) {
SchBasePoint schBasePoint = schBasePoints.get(0);
if (schBasePoints.size() == 1 && isVehicle) {
if (schBasePoint.getVehicle_qty() == 1) {
/*if (schBasePoints.size() == 1 && isVehicle) {
if (schBasePoint.getVehicle_qty() <= 1) {
task.setRemark("没有多余空笼框,待补充!");
taskService.updateById(task);
// 消息通知
@ -405,7 +418,7 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
NoticeTypeEnum.WARN.getCode());
return null;
}
}
}*/
Gson gson = new Gson();
Type setType = new TypeToken<List<String>>() {
}.getType();
@ -416,7 +429,6 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
schBasePoint.setVehicle_qty(vehicle_qty - 1);
msg.remove(s);
schBasePoint.setVehicles(JSONUtil.toJsonStr(msg));
/*schBasePoint.setIs_lock(true);*/
this.updateById(schBasePoint);
if (schBasePoint.getVehicle_qty() == 0) {
update(Wrappers.lambdaUpdate(SchBasePoint.class)
@ -430,6 +442,7 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
}
return null;
}
}
@Override
public void releasePoint(String region_code) {
@ -441,6 +454,12 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getRegion_code, region_code).set(SchBasePoint::getIs_lock, true));
}
@Override
public List<String> getByRegionCode(String region_code) {
List<String> list = pointMapper.selectByRegionCode(region_code);
return list;
}
@Override
public List<PointMaterialInfo> getStructList(String region_code, String vehicle_type) {
List<PointMaterialInfo> structList = pointMapper.getStructList(region_code, vehicle_type);

8
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/handheld/BlankingTask.java

@ -64,8 +64,14 @@ public class BlankingTask extends AbstractTask {
NoticeTypeEnum.WARN.getCode());
continue;
}
SchBasePoint schBasePoint = schBasePointService.selectByGroundPoint(task.getRegion_code(),
SchBasePoint schBasePoint = null;
if (ObjectUtil.isEmpty(task.getRegion_code())) {
schBasePoint = schBasePointService.selectByGroundPoint(null,
GoodsEnum.OUT_OF_STOCK.getValue(), mdBaseVehicle.getVehicle_type(), 1);
} else {
schBasePoint = schBasePointService.selectByGroundPoint(task.getRegion_code(),
GoodsEnum.OUT_OF_STOCK.getValue(), mdBaseVehicle.getVehicle_type(), 1);
}
if (ObjectUtil.isEmpty(schBasePoint)) {
task.setRemark("未找到所需点位!");
taskService.updateById(task);

25
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/handheld/EmptyCageTask.java

@ -1,6 +1,9 @@
package org.nl.wms.sch.task_manage.task.tasks.handheld;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.nl.common.enums.GoodsEnum;
@ -56,19 +59,29 @@ public class EmptyCageTask extends AbstractTask {
for (SchBaseTask task : tasks) {
TaskUtils.setUpdateByAcs(task);
// 查询是空料笼还是,空料架
Integer vehicle_qty = task.getVehicle_qty();
String vehicle_type = task.getVehicle_type();
/*String vehicle_code = task.getVehicle_code();
if(StrUtil.isNotEmpty(vehicle_code)){
JSONArray json = JSONUtil.parseArray(vehicle_code);
String s = json.get(0, String.class);
}*/
SchBasePoint schBasePoint = null;
switch (vehicle_qty) {
case 1:
switch (vehicle_type) {
case "S04":
//空料架
schBasePoint = schBasePointService.selectByGroundPoint(null, GoodsEnum.OUT_OF_STOCK.getValue(), task.getVehicle_type(), 1);
break;
case "S06":
//空料架
/*schBasePoint = schBasePointService.selectByGroundPoint(GoodsEnum.OUT_OF_STOCK.getValue(),task.getVehicle_type(),1);*/
schBasePoint = schBasePointService.selectByGroundPoint(null, GoodsEnum.OUT_OF_STOCK.getValue(), task.getVehicle_type(), 1);
break;
case 2:
case "R01":
//RO1空料容
schBasePoint = schBasePointService.selectByGroundPoint(RegionEnum.DDLK.getRegion_code(),
GoodsEnum.OUT_OF_STOCK.getValue(), VehicleTypeEnum.FRAME_R01.getVehicleCode(), 2);
break;
case 4:
case "R02":
//RO2空料容
schBasePoint = schBasePointService.selectByGroundPoint(RegionEnum.DDLK.getRegion_code(),
GoodsEnum.OUT_OF_STOCK.getValue(), VehicleTypeEnum.FRAME_R02.getVehicleCode(), 2);

20
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/handheld/ToStoreHouseTask.java

@ -29,7 +29,7 @@ import java.util.List;
/**
* @author LENOVO
* 物料回库
* 补空框任务
*/
@Component("TOSTOREHOUSETask")
public class ToStoreHouseTask extends AbstractTask {
@ -55,18 +55,8 @@ public class ToStoreHouseTask extends AbstractTask {
List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY);
// 配置信息
for (SchBaseTask task : tasks) {
TaskUtils.setUpdateByAcs(task);
MdBaseVehicle mdBaseVehicle = iMdBaseVehicleService.selectByVehicleCode(task.getVehicle_code());
if(ObjectUtil.isEmpty(mdBaseVehicle)){
task.setRemark("该载具不存在!");
taskService.updateById(task);
// 消息通知
noticeService.createNotice("该载具不存在!", TASK_CONFIG_CODE + task.getTask_code(),
NoticeTypeEnum.WARN.getCode());
continue;
}
SchBasePoint schBasePoint = schBasePointService.selectByGroundPoint(task.getRegion_code(), GoodsEnum.OUT_OF_STOCK.getValue()
,mdBaseVehicle.getVehicle_type(),1);
SchBasePoint schBasePoint = schBasePointService.selectByGroundPoint(null, GoodsEnum.EMPTY_PALLETS.getValue()
,task.getVehicle_type(),0);
if (ObjectUtil.isEmpty(schBasePoint)) {
task.setRemark("未找到所需点位!");
taskService.updateById(task);
@ -76,8 +66,8 @@ public class ToStoreHouseTask extends AbstractTask {
continue;
}
// 设置终点并修改创建成功状态
task.setPoint_code2(schBasePoint.getPoint_code());
task.setVehicle_type(schBasePoint.getCan_vehicle_type());
task.setPoint_code1(schBasePoint.getPoint_code());
task.setVehicle_code(schBasePoint.getVehicle_code());
task.setRemark("");
task.setTask_status(TaskStatus.CREATED.getCode());
taskService.updateById(task);

2
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/sorting/SortingSMTTask.java

@ -78,6 +78,8 @@ public class SortingSMTTask extends AbstractTask {
NoticeTypeEnum.WARN.getCode());
continue;
}
schBaseVehiclematerialgroupService.remove(Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class)
.eq(SchBaseVehiclematerialgroup::getVehicle_code, task.getVehicle_code()));
JSONArray pallet_detail = jsonObject.getJSONArray("pallet_detail");
for (Object o : pallet_detail) {
JSONObject jO = (JSONObject)JSONObject.toJSON(o);

Loading…
Cancel
Save