手持更新
This commit is contained in:
@@ -57,13 +57,18 @@ public class PdaServiceImpl implements PdaService {
|
||||
.addParam("region_id", regionId)
|
||||
.process()
|
||||
.getResultJSONArray(0);
|
||||
for (Object o : points) {
|
||||
JSONObject point = (JSONObject) o;
|
||||
for (int i = 0; i < points.size(); i++) {
|
||||
JSONObject point = points.getJSONObject(i);
|
||||
if (StrUtil.equals(point.getString("lock_type"), LockType.TASK_LOCKED.getCode())) {
|
||||
point.put("status", "3");
|
||||
}
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
@@ -73,7 +78,7 @@ public class PdaServiceImpl implements PdaService {
|
||||
|
||||
JSONObject point = WQLObject
|
||||
.getWQLObject("sch_base_point")
|
||||
.query("point_id = " + pointId)
|
||||
.query("point_id = '" + pointId + "'")
|
||||
.uniqueResult(0);
|
||||
|
||||
if (StrUtil.equals(point.getString("point_status"), PointStatus.HAS_VEHICLE.getCode())) {
|
||||
@@ -87,6 +92,10 @@ public class PdaServiceImpl implements PdaService {
|
||||
.process()
|
||||
.getResultJSONArray(0);
|
||||
result.put("detail", detail);
|
||||
} else {
|
||||
String vehicleCode = point.getString("vehicle_code");
|
||||
result.put("vehicle_code", "");
|
||||
result.put("detail", new JSONArray());
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -97,7 +106,7 @@ public class PdaServiceImpl implements PdaService {
|
||||
public void bindPoint(String pointId, String vehicleCode) {
|
||||
WQLObject pointTable = WQLObject.getWQLObject("sch_base_point");
|
||||
JSONObject point = pointTable
|
||||
.query("point_id = " + pointId)
|
||||
.query("point_id = '" + pointId + "'")
|
||||
.uniqueResult(0);
|
||||
if (StrUtil.equals(point.getString("lock_type"), LockType.TASK_LOCKED.getCode())) {
|
||||
throw new BadRequestException("该点位存在任务");
|
||||
@@ -105,12 +114,12 @@ public class PdaServiceImpl implements PdaService {
|
||||
|
||||
WQLObject ivtTable = WQLObject.getWQLObject("st_ivt_structivt");
|
||||
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)) {
|
||||
throw new BadRequestException("该载具号不存在,请从组盘功能添加");
|
||||
}
|
||||
|
||||
JSONObject existPoint = pointTable.query("vehicle_code = " + vehicleCode).uniqueResult(0);
|
||||
JSONObject existPoint = pointTable.query("vehicle_code = '" + vehicleCode + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(existPoint) && !StrUtil.equals(pointId, existPoint.getString("point_id"))) {
|
||||
throw new BadRequestException("该载具号存放于" + existPoint.getString("point_name"));
|
||||
}
|
||||
@@ -119,7 +128,7 @@ public class PdaServiceImpl implements PdaService {
|
||||
&& StrUtil.equals(point.getString("point_type"), PointType.STORAGE_LOCATION.getCode())) {
|
||||
JSONObject vm = WQLObject
|
||||
.getWQLObject("st_ivt_vehicle_material")
|
||||
.query("vehicle_id = " + vehicle.getString("vehicle_id"), "create_time ASC")
|
||||
.query("vehicle_id = '" + vehicle.getString("vehicle_id") + "'", "create_time ASC")
|
||||
.uniqueResult(0);
|
||||
|
||||
JSONObject ivt = new JSONObject();
|
||||
@@ -148,7 +157,7 @@ public class PdaServiceImpl implements PdaService {
|
||||
@Override
|
||||
public void vm(String vehicleCode, JSONArray materials) {
|
||||
WQLObject vehicleTable = WQLObject.getWQLObject("md_pb_vehicle");
|
||||
JSONObject vehicle = vehicleTable.query("vehicle_code = " + vehicleCode).uniqueResult(0);
|
||||
JSONObject vehicle = vehicleTable.query("vehicle_code = '" + vehicleCode + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(vehicle)) {
|
||||
vehicle = new JSONObject();
|
||||
vehicle.put("vehicle_id", IdUtil.getSnowflake(1L, 1L).nextId());
|
||||
@@ -170,7 +179,7 @@ public class PdaServiceImpl implements PdaService {
|
||||
String materialBatch = code.substring(8, 18);
|
||||
|
||||
JSONObject material = materialTable
|
||||
.query("material_code = " + materialCode)
|
||||
.query("material_code = '" + materialCode + "'")
|
||||
.uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(material)) {
|
||||
throw new BadRequestException("条码为" + code + "的物料信息不存在,请从后台管理界面添加");
|
||||
@@ -206,23 +215,23 @@ public class PdaServiceImpl implements PdaService {
|
||||
@Override
|
||||
public void outbound(String vehicleCode, JSONArray materials) {
|
||||
WQLObject vehicleTable = WQLObject.getWQLObject("md_pb_vehicle");
|
||||
JSONObject vehicle = vehicleTable.query("vehicle_code = " + vehicleCode).uniqueResult(0);
|
||||
JSONObject vehicle = vehicleTable.query("vehicle_code = '" + vehicleCode + "'").uniqueResult(0);
|
||||
String vehicleId = vehicle.getString("vehicle_id");
|
||||
|
||||
WQLObject vmTable = WQLObject.getWQLObject("st_ivt_vehicle_material");
|
||||
JSONObject oldVm = vmTable.query("vehicle_id = " + vehicleId, "create_time ASC").uniqueResult(0);
|
||||
JSONObject oldVm = vmTable.query("vehicle_id = '" + vehicleId + "'", "create_time ASC").uniqueResult(0);
|
||||
vmTable.delete("vehicle_id = " + vehicleId);
|
||||
WQLObject materialTable = WQLObject.getWQLObject("md_me_materialbase");
|
||||
|
||||
if (ObjectUtil.isNotEmpty(materials)) {
|
||||
WQLObject materialTable = WQLObject.getWQLObject("md_me_materialbase");
|
||||
for (Object o : materials) {
|
||||
JSONObject material = (JSONObject) o;
|
||||
for (int i = 0; i < materials.size(); i++) {
|
||||
JSONObject material = materials.getJSONObject(i);
|
||||
String materialCode = material.getString("material_code");
|
||||
String materialQty = material.getString("material_qty");
|
||||
String materialBatch = material.getString("batch");
|
||||
|
||||
String materialId = materialTable
|
||||
.query("material_code = " + materialCode)
|
||||
.query("material_code = '" + materialCode + "'")
|
||||
.uniqueResult(0)
|
||||
.getString("material_id");
|
||||
|
||||
@@ -236,6 +245,10 @@ public class PdaServiceImpl implements PdaService {
|
||||
vm.put("create_time", oldVm.getString("create_time"));
|
||||
vmTable.insert(vm);
|
||||
}
|
||||
// for (Object o : materials) {
|
||||
// JSONObject material = (JSONObject) o;
|
||||
//
|
||||
// }
|
||||
|
||||
vehicle.put("vehicle_status", VehicleStatus.HAS_MATERIAL.getCode());
|
||||
} else {
|
||||
@@ -271,7 +284,7 @@ public class PdaServiceImpl implements PdaService {
|
||||
if (ObjectUtil.isEmpty(point)) {
|
||||
throw new BadRequestException("该载具不存在于点位上");
|
||||
}
|
||||
if (!StrUtil.equals(point.getString("region_id"), RegionEnum.ZC.getCode())) {
|
||||
if (!StrUtil.equals(point.getString("region_code"), RegionEnum.ZC.getCode())) {
|
||||
throw new BadRequestException("该载具不在暂存区");
|
||||
}
|
||||
if (StrUtil.equals(point.getString("is_used"), "0")) {
|
||||
@@ -298,7 +311,7 @@ public class PdaServiceImpl implements PdaService {
|
||||
switch (type) {
|
||||
case "1":
|
||||
JSONObject point = WQLObject.getWQLObject("sch_base_point")
|
||||
.query("point_id = " + pointId)
|
||||
.query("point_id = '" + pointId + "'")
|
||||
.uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(point)) {
|
||||
throw new BadRequestException("该点位不存在");
|
||||
@@ -316,7 +329,7 @@ public class PdaServiceImpl implements PdaService {
|
||||
break;
|
||||
case "2":
|
||||
point = WQLObject.getWQLObject("sch_base_point")
|
||||
.query("point_id = " + pointId)
|
||||
.query("point_id = '" + pointId + "'")
|
||||
.uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(point)) {
|
||||
throw new BadRequestException("该点位不存在");
|
||||
@@ -330,7 +343,7 @@ public class PdaServiceImpl implements PdaService {
|
||||
|
||||
JSONObject vehicle = WQLObject
|
||||
.getWQLObject("md_pb_vehicle")
|
||||
.query("vehicle_code = " + point.getString("vehicle_code"))
|
||||
.query("vehicle_code = '" + point.getString("vehicle_code") + "'")
|
||||
.uniqueResult(0);
|
||||
param = new JSONObject();
|
||||
param.put("point_id", pointId);
|
||||
@@ -350,7 +363,7 @@ public class PdaServiceImpl implements PdaService {
|
||||
case "3":
|
||||
JSONObject startPoint = WQLObject
|
||||
.getWQLObject("sch_base_point")
|
||||
.query("point_id = " + startPointId)
|
||||
.query("point_id = '" + startPointId + "'")
|
||||
.uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(startPoint)) {
|
||||
throw new BadRequestException("起点不存在");
|
||||
@@ -361,7 +374,7 @@ public class PdaServiceImpl implements PdaService {
|
||||
|
||||
JSONObject startVehicle = WQLObject
|
||||
.getWQLObject("md_pb_vehicle")
|
||||
.query("vehicle_code = " + startPoint.getString("vehicle_code"))
|
||||
.query("vehicle_code = '" + startPoint.getString("vehicle_code") + "'")
|
||||
.uniqueResult(0);
|
||||
if (StrUtil.equals(startVehicle.getString("vehicle_status"), VehicleStatus.EMPTY.getCode())) {
|
||||
throw new BadRequestException("起点上的载具为空载具");
|
||||
|
||||
@@ -71,6 +71,7 @@
|
||||
SELECT
|
||||
material.material_code,
|
||||
material.material_name,
|
||||
vm.vm_id,
|
||||
vm.material_qty,
|
||||
vm.material_batch AS batch
|
||||
FROM
|
||||
|
||||
Reference in New Issue
Block a user