@ -16,17 +16,11 @@ import org.nl.wms.sch.base.point.LockType;
import org.nl.wms.sch.base.point.PointStatus ;
import org.nl.wms.sch.base.point.PointStatus ;
import org.nl.wms.sch.base.point.PointType ;
import org.nl.wms.sch.base.point.PointType ;
import org.nl.wms.sch.base.region.RegionEnum ;
import org.nl.wms.sch.base.region.RegionEnum ;
import org.nl.wms.sch.task.CallEmptyVehicleTask ;
import org.nl.wms.sch.task.* ;
import org.nl.wms.sch.task.CallMaterialTask ;
import org.nl.wms.sch.task.SendFullVehicleTask ;
import org.nl.wms.sch.task.SendResiduesMaterialTask ;
import org.nl.wms.sch.task.SendEmptyVehicleTask ;
import org.nl.wms.util.CommonUtils ;
import org.nl.wms.util.CommonUtils ;
import org.springframework.stereotype.Service ;
import org.springframework.stereotype.Service ;
import org.springframework.transaction.annotation.Transactional ;
import org.springframework.transaction.annotation.Transactional ;
import java.util.concurrent.locks.Lock ;
/ * *
/ * *
* @author 张江玮
* @author 张江玮
* @date 2022 / 11 / 04 18 : 25
* @date 2022 / 11 / 04 18 : 25
@ -65,12 +59,7 @@ public class PdaServiceImpl implements PdaService {
point . put ( "status" , "2" ) ;
point . put ( "status" , "2" ) ;
}
}
}
}
// for (Object o : points) {
// JSONObject point = (JSONObject) o;
// if (StrUtil.equals(point.getString("lock_type"), LockType.TASK_LOCKED.getCode())) {
// point.put("status", "3");
// }
// }
return points ;
return points ;
}
}
@ -117,7 +106,7 @@ public class PdaServiceImpl implements PdaService {
if ( StrUtil . isNotEmpty ( vehicleCode ) ) {
if ( StrUtil . isNotEmpty ( vehicleCode ) ) {
JSONObject vehicle = WQLObject . getWQLObject ( "md_pb_vehicle" ) . query ( "vehicle_code = '" + vehicleCode + "'" ) . uniqueResult ( 0 ) ;
JSONObject vehicle = WQLObject . getWQLObject ( "md_pb_vehicle" ) . query ( "vehicle_code = '" + vehicleCode + "'" ) . uniqueResult ( 0 ) ;
if ( ObjectUtil . isEmpty ( vehicle ) ) {
if ( ObjectUtil . isEmpty ( vehicle ) ) {
throw new BadRequestException ( "该载具号不存在,请从组盘功能添加 " ) ;
throw new BadRequestException ( "该载具号不存在" ) ;
}
}
JSONObject existPoint = pointTable . query ( "vehicle_code = '" + vehicleCode + "'" ) . uniqueResult ( 0 ) ;
JSONObject existPoint = pointTable . query ( "vehicle_code = '" + vehicleCode + "'" ) . uniqueResult ( 0 ) ;
@ -185,7 +174,7 @@ public class PdaServiceImpl implements PdaService {
. query ( "material_code = '" + materialCode + "'" )
. query ( "material_code = '" + materialCode + "'" )
. uniqueResult ( 0 ) ;
. uniqueResult ( 0 ) ;
if ( ObjectUtil . isEmpty ( material ) ) {
if ( ObjectUtil . isEmpty ( material ) ) {
throw new BadRequestException ( "条码为" + code + "的物料信息不存在,请从后台管理界面添加 " ) ;
throw new BadRequestException ( "条码为" + code + "的物料信息不存在" ) ;
}
}
JSONObject vm = new JSONObject ( ) ;
JSONObject vm = new JSONObject ( ) ;
@ -248,10 +237,6 @@ public class PdaServiceImpl implements PdaService {
vm . put ( "create_time" , oldVm . getString ( "create_time" ) ) ;
vm . put ( "create_time" , oldVm . getString ( "create_time" ) ) ;
vmTable . insert ( vm ) ;
vmTable . insert ( vm ) ;
}
}
// for (Object o : materials) {
// JSONObject material = (JSONObject) o;
//
// }
vehicle . put ( "vehicle_status" , VehicleStatus . HAS_MATERIAL . getCode ( ) ) ;
vehicle . put ( "vehicle_status" , VehicleStatus . HAS_MATERIAL . getCode ( ) ) ;
} else {
} else {
@ -268,13 +253,26 @@ public class PdaServiceImpl implements PdaService {
}
}
@Override
@Override
public JSONObject queryInventory ( String materialCode , String vehicleCode ) {
public JSONArray queryInventory ( String materialCode , String vehicleCode ) {
if ( StrUtil . isNotEmpty ( materialCode ) ) {
JSONObject material = WQLObject
. getWQLObject ( "md_me_materialbase" )
. query ( "material_code = '" + materialCode + "'" )
. uniqueResult ( 0 ) ;
if ( ObjectUtil . isEmpty ( material ) ) {
throw new BadRequestException ( "该物料号不存在" ) ;
}
}
if ( StrUtil . isNotEmpty ( vehicleCode ) ) {
JSONObject vehicle = WQLObject
JSONObject vehicle = WQLObject
. getWQLObject ( "md_pb_vehicle" )
. getWQLObject ( "md_pb_vehicle" )
. query ( "vehicle_code = '" + vehicleCode + "'" )
. query ( "vehicle_code = '" + vehicleCode + "'" )
. uniqueResult ( 0 ) ;
. uniqueResult ( 0 ) ;
if ( ObjectUtil . isEmpty ( vehicle ) ) {
if ( ObjectUtil . isEmpty ( vehicle ) ) {
throw new BadRequestException ( "该载具号不存在,请从组盘功能添加" ) ;
throw new BadRequestException ( "该载具号不存在" ) ;
}
}
if ( StrUtil . equals ( vehicle . getString ( "vehicle_status" ) , VehicleStatus . EMPTY . getCode ( ) ) ) {
if ( StrUtil . equals ( vehicle . getString ( "vehicle_status" ) , VehicleStatus . EMPTY . getCode ( ) ) ) {
throw new BadRequestException ( "该载具为空载具" ) ;
throw new BadRequestException ( "该载具为空载具" ) ;
@ -293,27 +291,18 @@ public class PdaServiceImpl implements PdaService {
if ( StrUtil . equals ( point . getString ( "is_used" ) , "0" ) ) {
if ( StrUtil . equals ( point . getString ( "is_used" ) , "0" ) ) {
throw new BadRequestException ( "该载具所在点位已被禁用" ) ;
throw new BadRequestException ( "该载具所在点位已被禁用" ) ;
}
}
JSONObject result = new JSONObject ( ) ;
result . put ( "point_id" , point . getString ( "point_id" ) ) ;
result . put ( "point_name" , point . getString ( "point_name" ) ) ;
JSONObject material = WQLObject
. getWQLObject ( "md_me_materialbase" )
. query ( "material_code = '" + materialCode + "'" )
. uniqueResult ( 0 ) ;
if ( ObjectUtil . isEmpty ( material ) ) {
throw new BadRequestException ( "该物料号不存在" ) ;
}
}
JSONArray detail = WQL
JSONArray result = WQL
. getWO ( "PDA" )
. getWO ( "PDA" )
. addParam ( "flag" , "5" )
. addParam ( "flag" , "5" )
. addParam ( "vehicle_id" , vehicle . getString ( "vehicle_id" ) )
. addParam ( "material_code" , materialCode )
. addParam ( "material_id" , material . getString ( "material_id" ) )
. addParam ( "vehicle_code" , vehicleCode )
. process ( )
. process ( )
. getResultJSONArray ( 0 ) ;
. getResultJSONArray ( 0 ) ;
result . put ( "detail" , detail ) ;
if ( ObjectUtil . isEmpty ( result ) ) {
throw new BadRequestException ( "未找到符合条件的暂存区点位" ) ;
}
return result ;
return result ;
}
}
@ -355,14 +344,11 @@ public class PdaServiceImpl implements PdaService {
if ( StrUtil . equals ( point . getString ( "point_status" ) , PointStatus . EMPTY . getCode ( ) ) ) {
if ( StrUtil . equals ( point . getString ( "point_status" ) , PointStatus . EMPTY . getCode ( ) ) ) {
throw new BadRequestException ( "该点位为空位" ) ;
throw new BadRequestException ( "该点位为空位" ) ;
}
}
if ( StrUtil . equals ( point . getString ( "region_id" ) , RegionEnum . ZC . getId ( ) ) ) {
throw new BadRequestException ( "暂存区不能生成入库任务" ) ;
}
String regionId = point . getString ( "region_id" ) ;
String regionId = point . getString ( "region_id" ) ;
if ( StrUtil . equals ( regionId , RegionEnum . JJ . getId ( ) )
if ( StrUtil . equals ( regionId , RegionEnum . ZC . getId ( ) )
& & point . getString ( "point_code" ) . startsWith ( "JJC" ) ) {
| | ( StrUtil . equals ( regionId , RegionEnum . JJ . getId ( ) )
throw new BadRequestException ( "交接区出库位不能生成入库任务" ) ;
& & point . getString ( "point_code" ) . startsWith ( "JJC" ) ) ) {
throw new BadRequestException ( "只有交接区的入库位和接料区才能发起入库任务" ) ;
}
}
JSONObject vehicle = WQLObject
JSONObject vehicle = WQLObject