完善
This commit is contained in:
@@ -90,7 +90,7 @@ public class PadController {
|
||||
public ResponseEntity<JSONObject> point(@RequestBody JSONObject param) {
|
||||
// 参数校验
|
||||
String regionId = param.getString("region");
|
||||
if (StrUtil.isEmpty(regionId)) {
|
||||
if (StrUtil.isBlank(regionId)) {
|
||||
JSONObject resultJSON = new JSONObject();
|
||||
resultJSON.put("code", "0");
|
||||
resultJSON.put("desc", "区域不能为空");
|
||||
@@ -111,15 +111,15 @@ public class PadController {
|
||||
@ApiOperation("查询物料")
|
||||
public ResponseEntity<JSONObject> material(@RequestBody JSONObject param) {
|
||||
// 参数校验
|
||||
String point_id = param.getString("device_id");
|
||||
if (StrUtil.isEmpty(point_id)) {
|
||||
String pointId = param.getString("device_id");
|
||||
if (StrUtil.isBlank(pointId)) {
|
||||
JSONObject resultJSON = new JSONObject();
|
||||
resultJSON.put("code", "0");
|
||||
resultJSON.put("desc", "点位不能为空");
|
||||
return new ResponseEntity<>(resultJSON, HttpStatus.OK);
|
||||
}
|
||||
|
||||
return new ResponseEntity<>(padService.material(point_id), HttpStatus.OK);
|
||||
return new ResponseEntity<>(padService.material(pointId), HttpStatus.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -136,7 +136,7 @@ public class PadController {
|
||||
public ResponseEntity<JSONObject> bindPoint(@RequestBody JSONObject param) {
|
||||
// 参数校验
|
||||
String type = param.getString("type");
|
||||
if (StrUtil.isEmpty(type)) {
|
||||
if (StrUtil.isBlank(type)) {
|
||||
JSONObject resultJSON = new JSONObject();
|
||||
resultJSON.put("code", "0");
|
||||
resultJSON.put("desc", "操作类型不能为空");
|
||||
@@ -144,14 +144,14 @@ public class PadController {
|
||||
}
|
||||
String pointCode = param.getString("device_code");
|
||||
String materialType = param.getString("material_type");
|
||||
if (StrUtil.equals(type, "1")) {
|
||||
if (StrUtil.isEmpty(pointCode)) {
|
||||
if ("1".equals(type)) {
|
||||
if (StrUtil.isBlank(pointCode)) {
|
||||
JSONObject resultJSON = new JSONObject();
|
||||
resultJSON.put("code", "0");
|
||||
resultJSON.put("desc", "设备不能为空");
|
||||
return new ResponseEntity<>(resultJSON, HttpStatus.OK);
|
||||
}
|
||||
if (StrUtil.isEmpty(materialType)) {
|
||||
if (StrUtil.isBlank(materialType)) {
|
||||
JSONObject resultJSON = new JSONObject();
|
||||
resultJSON.put("code", "0");
|
||||
resultJSON.put("desc", "物料不能为空");
|
||||
|
||||
@@ -32,6 +32,8 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 徐工手持服务实现
|
||||
@@ -238,11 +240,14 @@ public class PadServiceImpl implements PadService {
|
||||
switch (type) {
|
||||
case "1":
|
||||
// 判断是否是限定物料
|
||||
String pointMaterialType = point.getString("material_type");
|
||||
boolean isEmptyMaterial = StrUtil.equals(materialType, "14");
|
||||
if (!isEmptyMaterial
|
||||
&& !StrUtil.equals(pointMaterialType, "14")
|
||||
&& !StrUtil.equals(pointMaterialType, materialType)) {
|
||||
List<String> materialTypes = WQLObject
|
||||
.getWQLObject("sch_base_point_material")
|
||||
.query("point_id = " + point.getLong("point_id"))
|
||||
.getResultJSONArray(0)
|
||||
.stream()
|
||||
.map(o -> ((JSONObject) o).getString("material"))
|
||||
.collect(Collectors.toList());
|
||||
if (!materialTypes.contains(materialType)) {
|
||||
resultJSON.put("code", "0");
|
||||
resultJSON.put("desc", "该点位不能存放这种物料");
|
||||
return resultJSON;
|
||||
@@ -250,7 +255,7 @@ public class PadServiceImpl implements PadService {
|
||||
|
||||
// 修改点位
|
||||
point.put("current_material_type", materialType);
|
||||
point.put("point_status", isEmptyMaterial ? "00" : "01");
|
||||
point.put("point_status", "01");
|
||||
point.put("update_optid", SecurityUtils.getCurrentUserId());
|
||||
point.put("update_optname", SecurityUtils.getCurrentUsername());
|
||||
point.put("update_time", DateUtil.now());
|
||||
@@ -258,7 +263,7 @@ public class PadServiceImpl implements PadService {
|
||||
break;
|
||||
case "2":
|
||||
// 清空点位
|
||||
point.put("current_material_type", "14");
|
||||
point.put("current_material_type", null);
|
||||
point.put("point_status", "00");
|
||||
point.put("update_optid", SecurityUtils.getCurrentUserId());
|
||||
point.put("update_optname", SecurityUtils.getCurrentUsername());
|
||||
|
||||
@@ -94,7 +94,7 @@
|
||||
LEFT JOIN sys_dict_detail d4 ON point.point_status = d4.value and d4.name='sch_point_status'
|
||||
LEFT JOIN SCH_BASE_Region prev_region ON point.prev_region_id = prev_region.region_id
|
||||
LEFT JOIN SCH_BASE_Region next_region ON point.next_region_id = next_region.region_id
|
||||
LEFT JOIN sys_dict_detail d6 ON point.current_material_type = d6.`value` AND d6.`name` = 'current_material_type'
|
||||
LEFT JOIN sys_dict_detail d6 ON point.current_material_type = d6.`value` AND d6.`name` = 'material_type'
|
||||
WHERE
|
||||
point.is_delete = '0'
|
||||
OPTION 输入.region_id <> ""
|
||||
|
||||
Binary file not shown.
@@ -62,7 +62,7 @@ public class CallTask extends AbstractAcsTask {
|
||||
@Override
|
||||
public String createTask(JSONObject param) {
|
||||
String nextPointCode = param.getString("next_point_code");
|
||||
String materialType = param.getString("call_material_type");
|
||||
String materialType = param.getString("material_type");
|
||||
|
||||
// 判断点位是否存在
|
||||
JSONObject nextPoint = WQLObject
|
||||
@@ -73,6 +73,16 @@ public class CallTask extends AbstractAcsTask {
|
||||
throw new BadRequestException("未找到该点位");
|
||||
}
|
||||
|
||||
// 判断点位有没有被锁定
|
||||
if (!StrUtil.equals(nextPoint.getString("lock_type"), "00")) {
|
||||
throw new BadRequestException("该点位已被锁定");
|
||||
}
|
||||
|
||||
// 判断点位是否为空位
|
||||
if (!StrUtil.equals(nextPoint.getString("point_status"), "00")) {
|
||||
throw new BadRequestException("该点位不是空位");
|
||||
}
|
||||
|
||||
// 查询点位的叫料区域
|
||||
String startRegionId = nextPoint.getString("prev_region_id");
|
||||
if (StrUtil.isEmpty(startRegionId)) {
|
||||
@@ -91,16 +101,6 @@ public class CallTask extends AbstractAcsTask {
|
||||
throw new BadRequestException("该点位不能呼叫这种物料");
|
||||
}
|
||||
|
||||
// 判断点位有没有被锁定
|
||||
if (!StrUtil.equals(nextPoint.getString("lock_type"), "00")) {
|
||||
throw new BadRequestException("该点位已被锁定");
|
||||
}
|
||||
|
||||
// 判断点位是否为空位
|
||||
if (!StrUtil.equals(nextPoint.getString("point_status"), "00")) {
|
||||
throw new BadRequestException("该点位不是空位");
|
||||
}
|
||||
|
||||
// 查询叫料区域存放此物料的排
|
||||
JSONArray colArray = WQL
|
||||
.getWO("SEND_TASK")
|
||||
@@ -122,8 +122,10 @@ public class CallTask extends AbstractAcsTask {
|
||||
.process()
|
||||
.uniqueResult(0);
|
||||
|
||||
// 点位不为空 且 点位未锁定,则为合适的叫料点位
|
||||
if (ObjectUtil.isNotEmpty(tempPoint) && StrUtil.equals(tempPoint.getString("lock_type"), "00")) {
|
||||
// 点位不为空 且 点位未锁定 且 点位上的物料和需要的物料一致,则为合适的叫料点位
|
||||
if (ObjectUtil.isNotEmpty(tempPoint)
|
||||
&& "00".equals(tempPoint.getString("lock_type"))
|
||||
&& materialType.equals(tempPoint.getString("current_material_type"))) {
|
||||
startPoint = tempPoint;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ public class SendTask extends AbstractAcsTask {
|
||||
// 起点置空 解锁
|
||||
startPoint.put("point_status", "00");
|
||||
startPoint.put("lock_type", "00");
|
||||
startPoint.put("current_material_type", "14");
|
||||
startPoint.put("current_material_type", null);
|
||||
startPoint.put("update_optid", userId);
|
||||
startPoint.put("update_optname", username);
|
||||
startPoint.put("update_time", now);
|
||||
@@ -178,12 +178,6 @@ public class SendTask extends AbstractAcsTask {
|
||||
throw new BadRequestException("未找到该点位");
|
||||
}
|
||||
|
||||
// 查询点位的送料区域
|
||||
String nextRegionId = startPoint.getString("next_region_id");
|
||||
if (StrUtil.isEmpty(nextRegionId)) {
|
||||
throw new BadRequestException("该点位没有送料区域");
|
||||
}
|
||||
|
||||
// 判断点位有没有被锁定
|
||||
if (!StrUtil.equals(startPoint.getString("lock_type"), "00")) {
|
||||
throw new BadRequestException("该点位已被锁定");
|
||||
@@ -194,6 +188,13 @@ public class SendTask extends AbstractAcsTask {
|
||||
throw new BadRequestException("该点位是空位");
|
||||
}
|
||||
|
||||
// 查询点位的送料区域
|
||||
String nextRegionId = startPoint.getString("next_region_id");
|
||||
if (StrUtil.isEmpty(nextRegionId)) {
|
||||
throw new BadRequestException("该点位没有送料区域");
|
||||
}
|
||||
|
||||
|
||||
// 查送料点位(出入库顺序升序)
|
||||
JSONObject nextPoint;
|
||||
String currentMaterialType = startPoint.getString("current_material_type");
|
||||
|
||||
@@ -21,7 +21,7 @@ https://juejin.cn/post/6844903775631572999
|
||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
<charset>${log.charset}</charset>
|
||||
<!-- <charset>${log.charset}</charset>-->
|
||||
</encoder>
|
||||
|
||||
<!-- 转为JSON https://www.zoleet.com/details/328.html-->
|
||||
@@ -64,6 +64,7 @@ https://juejin.cn/post/6844903775631572999
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
|
||||
<charset>${log.charset}</charset>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
@@ -115,7 +116,7 @@ https://juejin.cn/post/6844903775631572999
|
||||
|
||||
<!--生产环境:打印控制台和输出到文件-->
|
||||
<springProfile name="prod">
|
||||
<root level="off">
|
||||
<root level="info">
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
</root>
|
||||
</springProfile>
|
||||
|
||||
@@ -21,6 +21,7 @@ public class PointTest {
|
||||
@Test
|
||||
public void test01() {
|
||||
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
|
||||
WQLObject pm_table = WQLObject.getWQLObject("sch_base_point_material");
|
||||
// JSONObject point = new JSONObject();
|
||||
// point.put("region_id", "1628275194667864064");
|
||||
// point.put("point_type", "00");
|
||||
@@ -49,19 +50,24 @@ public class PointTest {
|
||||
// point_table.insert(point);
|
||||
// }
|
||||
// }
|
||||
JSONArray points = point_table
|
||||
.query("region_id = 1628275194667864064")
|
||||
.getResultJSONArray(0);
|
||||
WQLObject pm_table = WQLObject.getWQLObject("sch_base_point_material");
|
||||
JSONObject pm = new JSONObject();
|
||||
String[] materials = new String[]{"08", "09", "10", "11", "12", "13"};
|
||||
// JSONArray points = point_table
|
||||
// .query("region_id = 1628275194667864064")
|
||||
// .getResultJSONArray(0);
|
||||
// WQLObject pm_table = WQLObject.getWQLObject("sch_base_point_material");
|
||||
// JSONObject pm = new JSONObject();
|
||||
// String[] materials = new String[]{"08", "09", "10", "11", "12", "13"};
|
||||
// for (Object o : points) {
|
||||
// pm.put("point_id", ((JSONObject) o).getLongValue("point_id"));
|
||||
// for (String material : materials) {
|
||||
// pm.put("pm_id", IdUtil.getSnowflake(1L, 1L).nextId());
|
||||
// pm.put("material", material);
|
||||
// pm_table.insert(pm);
|
||||
// }
|
||||
// }
|
||||
|
||||
JSONArray points = point_table.query("region_id = 1628275194667864064").getResultJSONArray(0);
|
||||
for (Object o : points) {
|
||||
pm.put("point_id", ((JSONObject) o).getLongValue("point_id"));
|
||||
for (String material : materials) {
|
||||
pm.put("pm_id", IdUtil.getSnowflake(1L, 1L).nextId());
|
||||
pm.put("material", material);
|
||||
pm_table.insert(pm);
|
||||
}
|
||||
pm_table.delete("point_id = " + ((JSONObject) o).getString("point_id") + " AND material IN ('11', '12', '13')");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user