|
|
@ -14,11 +14,16 @@ import org.nl.common.enums.VehicleTypeEnum; |
|
|
|
import org.nl.common.enums.region.RegionEnum; |
|
|
|
import org.nl.common.exception.BadRequestException; |
|
|
|
import org.nl.common.utils.RedisUtils; |
|
|
|
import org.nl.config.SpringContextHolder; |
|
|
|
import org.nl.system.service.param.dao.Param; |
|
|
|
import org.nl.system.service.param.impl.SysParamServiceImpl; |
|
|
|
import org.nl.system.service.user.ISysUserService; |
|
|
|
import org.nl.system.service.user.dao.SysUser; |
|
|
|
import org.nl.wms.database.vehicle.service.IMdBaseVehicleService; |
|
|
|
import org.nl.wms.database.vehicle.service.dao.MdBaseVehicle; |
|
|
|
import org.nl.wms.ext.acs.service.WmsToAcsService; |
|
|
|
import org.nl.wms.ext.connector.service.WmsToConnectorService; |
|
|
|
import org.nl.wms.ext.handheld.handheldEnum.RouteEnum; |
|
|
|
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; |
|
|
@ -35,6 +40,7 @@ import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.util.*; |
|
|
|
import java.util.concurrent.TimeUnit; |
|
|
|
|
|
|
|
/** |
|
|
|
* @author LENOVO |
|
|
@ -60,6 +66,8 @@ public class HandheldServiceImpl implements HandheldService { |
|
|
|
private ISysUserService iSysUserService; |
|
|
|
@Autowired |
|
|
|
private RedisUtils redisUtils; |
|
|
|
@Autowired |
|
|
|
private WmsToAcsService wmsToAcsService; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@ -180,6 +188,11 @@ public class HandheldServiceImpl implements HandheldService { |
|
|
|
public void cageBlankingTask(JSONObject param) { |
|
|
|
Assert.noNullElements(new Object[]{param.getString("device_code"), param.getString("vehicle_code")}, |
|
|
|
"当前点位或目的地不能为空!"); |
|
|
|
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(param.getString("device_code")); |
|
|
|
if (ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("设备点位不存在!"); |
|
|
|
if (schBasePoint.getIs_lock()) { |
|
|
|
throw new BadRequestException("该点位正在执行任务,请稍后再试!"); |
|
|
|
} |
|
|
|
String region_code = param.getString("region_code"); |
|
|
|
String device_code = param.getString("device_code"); |
|
|
|
String vehicle_code = param.getString("vehicle_code"); |
|
|
@ -187,7 +200,7 @@ public class HandheldServiceImpl implements HandheldService { |
|
|
|
AbstractTask connectorTask = taskFactory.getTask("BLANKINGTask"); |
|
|
|
switch (type) { |
|
|
|
case "1": |
|
|
|
goShelves(param, region_code, device_code, vehicle_code, connectorTask); |
|
|
|
goShelves(schBasePoint, param, region_code, device_code, vehicle_code, connectorTask); |
|
|
|
break; |
|
|
|
case "2": |
|
|
|
goWxOrNx(param, region_code, device_code, vehicle_code, connectorTask); |
|
|
@ -209,11 +222,9 @@ public class HandheldServiceImpl implements HandheldService { |
|
|
|
* @param vehicle_code |
|
|
|
* @param connectorTask |
|
|
|
*/ |
|
|
|
private void goShelves(JSONObject param, String region_code, String device_code, String vehicle_code, AbstractTask connectorTask) { |
|
|
|
private void goShelves(SchBasePoint schBasePoint, JSONObject param, String region_code, String device_code, String vehicle_code, AbstractTask connectorTask) { |
|
|
|
Assert.noNullElements(param.getJSONArray("material"), "参数不能为空!"); |
|
|
|
JSONArray materials = param.getJSONArray("material"); |
|
|
|
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(device_code); |
|
|
|
if (ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("设备点位不存在!"); |
|
|
|
JSONObject jo = new JSONObject(); |
|
|
|
if (StrUtil.isBlank(region_code)) { |
|
|
|
JSONObject json = new JSONObject(); |
|
|
@ -451,15 +462,14 @@ public class HandheldServiceImpl implements HandheldService { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public void updateRegionCodeByOrder(JSONObject json) { |
|
|
|
Assert.noNullElements((Collection<?>) json, "参数不能为空!"); |
|
|
|
JSONArray material_info = json.getJSONArray("material_info"); |
|
|
|
material_info.stream().forEach(material -> { |
|
|
|
JSONObject jsonObject = JSONObject.parseObject(StrUtil.toString(material)); |
|
|
|
public void updateRegionCodeByOrder(JSONArray json) { |
|
|
|
Assert.noNullElements(json, "参数不能为空!"); |
|
|
|
json.stream().forEach(material -> { |
|
|
|
cn.hutool.json.JSONObject jsonObject = JSONUtil.parseObj(material); |
|
|
|
iSchBaseVehiclematerialgroupService.update(Wrappers.lambdaUpdate(SchBaseVehiclematerialgroup.class) |
|
|
|
.eq(SchBaseVehiclematerialgroup::getOrder_code, jsonObject.getString("order_code")) |
|
|
|
.set(SchBaseVehiclematerialgroup::getDue_date, jsonObject.getString("due_date")) |
|
|
|
.set(SchBaseVehiclematerialgroup::getRegion_code, jsonObject.getString("region_code")) |
|
|
|
.eq(SchBaseVehiclematerialgroup::getOrder_code, jsonObject.getStr("order_code")) |
|
|
|
.set(SchBaseVehiclematerialgroup::getDue_date, jsonObject.getStr("due_date")) |
|
|
|
.set(SchBaseVehiclematerialgroup::getRegion_code, jsonObject.getStr("region_code")) |
|
|
|
); |
|
|
|
}); |
|
|
|
} |
|
|
@ -493,7 +503,13 @@ public class HandheldServiceImpl implements HandheldService { |
|
|
|
if (regin_code != null) { |
|
|
|
throw new BadRequestException("当前设备工序已经登陆,无法继续选择"); |
|
|
|
} else { |
|
|
|
redisUtils.set("mobile:" + json.getString("device_code"), json.getString("device_code")); |
|
|
|
SysParamServiceImpl sysParamService = SpringContextHolder.getBean(SysParamServiceImpl.class); |
|
|
|
Param isInvokeConnector = sysParamService.findByCode(GeneralDefinition.HANDHELD_LOGIN_TIME); |
|
|
|
int loginTime = 3; |
|
|
|
if(ObjectUtil.isNotEmpty(isInvokeConnector)){ |
|
|
|
loginTime = Integer.parseInt(isInvokeConnector.getValue()); |
|
|
|
} |
|
|
|
redisUtils.set("mobile:" + json.getString("device_code"), json.getString("device_code"),loginTime, TimeUnit.HOURS); |
|
|
|
} |
|
|
|
} |
|
|
|
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(json.getString("device_code")); |
|
|
@ -517,5 +533,22 @@ public class HandheldServiceImpl implements HandheldService { |
|
|
|
return schBasePoint.getVehicle_code(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void updateRoute(JSONObject json) { |
|
|
|
Assert.noNullElements(new String[]{json.getString("type"), json.getString("status")}, "参数不能为空!"); |
|
|
|
switch(json.getString("type")){ |
|
|
|
case "1": |
|
|
|
JSONObject jsonObject = new JSONObject(); |
|
|
|
SysParamServiceImpl sysParamService = SpringContextHolder.getBean(SysParamServiceImpl.class); |
|
|
|
Param isConnectConnector = sysParamService.findByCode(GeneralDefinition.ADD_ROUTE_DOOR_1); |
|
|
|
jsonObject.put("pointCode",isConnectConnector.getValue()); |
|
|
|
jsonObject.put("status",json.getString("status")); |
|
|
|
wmsToAcsService.notifyAcs1(jsonObject); |
|
|
|
break; |
|
|
|
default: |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|