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