|
|
@ -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); |
|
|
|
} |
|
|
|