最终更新

This commit is contained in:
张江玮
2022-11-17 10:31:24 +08:00
parent 9a9947e9b2
commit 709a5befe9
5 changed files with 36 additions and 33 deletions

View File

@@ -1,5 +1,7 @@
package org.nl.wms.pda.rest;
import cn.hutool.core.map.MapUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
@@ -15,6 +17,8 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
/**
* @author 张江玮
* @date 2022/11/04 18:16
@@ -61,8 +65,8 @@ public class PdaController {
@PostMapping("/vm")
@Log("组盘")
@ApiOperation("组盘")
public ResponseEntity<JSONObject> vm(@RequestBody JSONObject param) {
pdaService.vm(param.getString("vehicle_code"), param.getJSONArray("material"));
public ResponseEntity<JSONObject> vm(@RequestBody Map<String, Object> param) {
pdaService.vm(MapUtil.getStr(param, "vehicle_code"), JSON.parseArray(JSON.toJSONString(param.get("material"))));
return this.success();
}

View File

@@ -149,12 +149,7 @@ public class PdaServiceImpl implements PdaService {
WQLObject vehicleTable = WQLObject.getWQLObject("md_pb_vehicle");
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());
vehicle.put("vehicle_code", vehicleCode);
vehicle.put("vehicle_status", VehicleStatus.EMPTY.getCode());
CommonUtils.addCommonColum(vehicle);
vehicleTable.insert(vehicle);
throw new BadRequestException("该载具号不存在");
}
String vehicleId = vehicle.getString("vehicle_id");
@@ -188,9 +183,12 @@ public class PdaServiceImpl implements PdaService {
}
vehicle.put("vehicle_status", VehicleStatus.HAS_MATERIAL.getCode());
CommonUtils.addUpdateColum(vehicle);
vehicleTable.update(vehicle);
} else {
vehicle.put("vehicle_status", VehicleStatus.EMPTY.getCode());
}
CommonUtils.addUpdateColum(vehicle);
vehicleTable.update(vehicle);
}
@Override
@@ -347,7 +345,7 @@ public class PdaServiceImpl implements PdaService {
String regionId = point.getString("region_id");
if (StrUtil.equals(regionId, RegionEnum.ZC.getId())
|| (StrUtil.equals(regionId, RegionEnum.JJ.getId())
&& point.getString("point_code").startsWith("JJC"))) {
&& !point.getString("point_code").startsWith("JJR"))) {
throw new BadRequestException("只有交接区的入库位和接料区才能发起入库任务");
}
@@ -406,7 +404,7 @@ public class PdaServiceImpl implements PdaService {
throw new BadRequestException("终点有载具");
}
if (!StrUtil.equals(nextPoint.getString("region_id"), RegionEnum.JJ.getId())
&& nextPoint.getString("point_code").startsWith("JJC")) {
|| !nextPoint.getString("point_code").startsWith("JJC")) {
throw new BadRequestException("只有终点为交接区的出库位才能生成出库任务");
}