代码更新
This commit is contained in:
Binary file not shown.
@@ -56,6 +56,11 @@ public class PointDto implements Serializable {
|
||||
*/
|
||||
private String vehicle_code;
|
||||
|
||||
/**
|
||||
* 载具数量
|
||||
*/
|
||||
private Integer vehicle_qty;
|
||||
|
||||
/**
|
||||
* 来源标识
|
||||
*/
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,224 @@
|
||||
package org.nl.wms.sch.tasks;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.utils.SecurityUtils;
|
||||
import org.nl.utils.SpringContextHolder;
|
||||
import org.nl.wms.sch.manage.AbstractAcsTask;
|
||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||
import org.nl.wms.sch.service.PointService;
|
||||
import org.nl.wms.sch.service.dto.PointDto;
|
||||
import org.nl.wql.WQL;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class CallEmpVehicleTask extends AbstractAcsTask {
|
||||
private final String THIS_CLASS = CallEmpVehicleTask.class.getName();
|
||||
|
||||
@Override
|
||||
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task");
|
||||
WQLObject empTab = WQLObject.getWQLObject("st_ivt_EmptyVehicleRecord");
|
||||
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point");
|
||||
|
||||
// 完成任务
|
||||
if(StrUtil.equals(status, TaskStatusEnum.FINISHED.getCode())) {
|
||||
// 更改任务状态为完成
|
||||
JSONObject jsonTask = taskTab.query("task_id = '" + taskObj.getString("task_id") + "'").uniqueResult(0);
|
||||
jsonTask.put("task_status",TaskStatusEnum.FINISHED.getCode());
|
||||
jsonTask.put("update_optid", SecurityUtils.getCurrentUserId());
|
||||
jsonTask.put("update_optname", SecurityUtils.getCurrentUsername());
|
||||
jsonTask.put("update_time", DateUtil.now());
|
||||
taskTab.update(jsonTask);
|
||||
|
||||
PointService point = SpringContextHolder.getBean(PointService.class);
|
||||
// 校验起点是否存在
|
||||
PointDto start_point_code = point.findByCode(jsonTask.getString("start_point_code"));
|
||||
if (ObjectUtil.isEmpty(start_point_code)) throw new BadRequestException("未找到可用点位:" + start_point_code);
|
||||
// 校验终点是否存在
|
||||
PointDto next_point_code = point.findByCode(jsonTask.getString("next_point_code"));
|
||||
if (ObjectUtil.isEmpty(start_point_code)) throw new BadRequestException("未找到可用点位:" + next_point_code);
|
||||
|
||||
// 1.更新点位数量 2.解锁点位
|
||||
JSONObject jsonEmp = empTab.query("task_uuid = '" + taskObj.getString("task_id") + "'").uniqueResult(0);
|
||||
int vehicle_qty = JSONObject.parseObject(JSON.toJSONString(start_point_code)).getIntValue("vehicle_qty");
|
||||
BigDecimal vehicle_qty_point = NumberUtil.sub(String.valueOf(vehicle_qty), String.valueOf(jsonEmp.getIntValue("vehicle_qty")));
|
||||
|
||||
start_point_code.setVehicle_qty(Integer.valueOf(vehicle_qty_point.toString()));
|
||||
if (StrUtil.equals(vehicle_qty_point.toString(), "0")) start_point_code.setPoint_status("00");
|
||||
start_point_code.setLock_type("00");
|
||||
pointTab.update(JSONObject.parseObject(JSON.toJSONString(start_point_code)));
|
||||
|
||||
// 完成单据状态
|
||||
jsonEmp.put("bill_status", "50");
|
||||
jsonEmp.put("update_optid", SecurityUtils.getCurrentUserId());
|
||||
jsonEmp.put("update_optname", SecurityUtils.getCurrentUsername());
|
||||
jsonEmp.put("update_time", DateUtil.now());
|
||||
empTab.update(jsonEmp);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void findStartPoint() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void findNextPoint() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createTask(JSONObject form) {
|
||||
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task");
|
||||
WQLObject empTab = WQLObject.getWQLObject("st_ivt_EmptyVehicleRecord");
|
||||
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point");
|
||||
|
||||
String start_point_code = form.getString("start_point_code");
|
||||
String next_point_code = form.getString("next_point_code");
|
||||
String qty = form.getString("qty");
|
||||
String record_uuid = form.getString("record_uuid");
|
||||
|
||||
// 出库终点不能为空
|
||||
if (ObjectUtil.isEmpty(next_point_code)) {
|
||||
throw new BadRequestException("终点不能为空");
|
||||
} else {
|
||||
// 判断终点是否有正在执行的任务
|
||||
JSONObject beforTaskObj = taskTab.query("is_delete='0' and next_point_code='" + next_point_code + "' and task_status <>'" + TaskStatusEnum.FINISHED.getCode() + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(beforTaskObj)) throw new BadRequestException("存在指令号为'" + beforTaskObj.getString("task_code") + "' 未完成!");
|
||||
}
|
||||
// 载具数量不能为空
|
||||
if (ObjectUtil.isEmpty(qty)) throw new BadRequestException("载具数量不能为空");
|
||||
|
||||
/*
|
||||
* 1. 点对点: 起点和终点都确定,直接创建任务
|
||||
* 2. 终点确定: 需要找到对应起点,在创建任务 具体找起点货位的规则在findBeginPoint()中
|
||||
*/
|
||||
// 终点确定:找起点
|
||||
if (ObjectUtil.isEmpty(start_point_code)) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("next_point_code",next_point_code);
|
||||
param.put("vehicle_qty",qty);
|
||||
start_point_code = this.findBeginPoint(param);
|
||||
} else {
|
||||
// 判断终点是否是空位
|
||||
JSONObject jsonPoint = pointTab.query("point_code = '" + start_point_code + "' and lock_type = '00' and point_status <> '02' and is_delete = '0' and is_used = '1'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonPoint)) throw new BadRequestException("起点点位不可用或不存在");
|
||||
}
|
||||
// 创建任务
|
||||
JSONObject jsonTask = new JSONObject();
|
||||
String task_id = IdUtil.getSnowflake(1, 1).nextId() + "";
|
||||
|
||||
jsonTask.put("task_id", task_id);
|
||||
jsonTask.put("taskdtl_id", task_id);
|
||||
jsonTask.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
||||
jsonTask.put("task_type", "04");
|
||||
jsonTask.put("taskdtl_type", "04");
|
||||
jsonTask.put("task_status", "01");
|
||||
jsonTask.put("start_point_code", start_point_code);
|
||||
jsonTask.put("next_point_code", next_point_code);
|
||||
jsonTask.put("handle_class", THIS_CLASS);
|
||||
jsonTask.put("create_name", SecurityUtils.getCurrentUsername());
|
||||
jsonTask.put("create_id", SecurityUtils.getCurrentUserId());
|
||||
jsonTask.put("create_time", DateUtil.now());
|
||||
jsonTask.put("acs_task_type", "1");
|
||||
taskTab.insert(jsonTask);
|
||||
|
||||
// 锁定起点点位
|
||||
JSONObject jsonPoint = pointTab.query("point_code = '" + start_point_code + "'").uniqueResult(0);
|
||||
jsonPoint.put("lock_type", "02");
|
||||
pointTab.update(jsonPoint);
|
||||
|
||||
// 更新空载具单据状态
|
||||
if (ObjectUtil.isNotEmpty(record_uuid)) {
|
||||
JSONObject jsonEmp = empTab.query("record_uuid ='" + record_uuid + "'").uniqueResult(0);
|
||||
jsonEmp.put("bill_status","20");
|
||||
empTab.update(jsonEmp);
|
||||
}
|
||||
return task_id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forceFinish(String task_id) {
|
||||
JSONObject taskObj = WQLObject.getWQLObject("SCH_BASE_Task").query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
this.updateTaskStatus(taskObj, TaskStatusEnum.FINISHED.getCode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pullBack(String task_id) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancel(String task_id) {
|
||||
|
||||
}
|
||||
|
||||
public String findBeginPoint(JSONObject json) {
|
||||
String next_point_code = json.getString("next_point_code");
|
||||
String vehicle_qty = json.getString("vehicle_qty");
|
||||
if (ObjectUtil.isEmpty(next_point_code)) throw new BadRequestException("终点不能为空");
|
||||
if (ObjectUtil.isEmpty(vehicle_qty)) throw new BadRequestException("载具数量不能为空");
|
||||
|
||||
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point");
|
||||
WQLObject regionTab = WQLObject.getWQLObject("SCH_BASE_Region");
|
||||
// 根据终点区域判断优先的起点区域
|
||||
JSONObject jsonPointEnd = pointTab.query("point_code = '" + next_point_code + "'").uniqueResult(0);
|
||||
JSONObject jsonRegionEnd = regionTab.query("region_id ='" + jsonPointEnd.getString("region_id") + "'").uniqueResult(0);
|
||||
|
||||
/*
|
||||
* 空托盘出库任务:
|
||||
* 1.叠盘架B区、养生A区 --> 共挤线 (优先级:1叠盘架B区 2养生A区)
|
||||
* 2.叠盘架A区、养生A区 --> 油漆线 (优先级:1叠盘架A区 2养生A区)
|
||||
*/
|
||||
String start_point_code = "";
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
if (StrUtil.equals(jsonRegionEnd.getString("region_code"),RegionTypeEnum.GJQY.getCode())) {
|
||||
// 共挤线呼叫空托盘业务:查找叠盘架B区是否有满足条件的点位
|
||||
map.put("flag", "1");
|
||||
map.put("vehicle_qty", vehicle_qty);
|
||||
map.put("region_code", RegionTypeEnum.DPJQB.getCode());
|
||||
JSONObject jsonStartPointDPB = WQL.getWO("ST_VEHICLE_OUT_02").addParamMap(map).process().uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(jsonStartPointDPB)) {
|
||||
start_point_code = jsonStartPointDPB.getString("point_code");
|
||||
} else {
|
||||
// 为空说明叠盘架B区没有,则去养生A区找
|
||||
map.put("region_code", RegionTypeEnum.YSQA.getCode());
|
||||
JSONObject jsonStartPointYSA = WQL.getWO("ST_VEHICLE_OUT_02").addParamMap(map).process().uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonStartPointYSA)) throw new BadRequestException("没有满足需求数量的点位");
|
||||
start_point_code = jsonStartPointYSA.getString("point_code");
|
||||
}
|
||||
} else if (StrUtil.equals(jsonRegionEnd.getString("region_code"),RegionTypeEnum.YQQY.getCode())) {
|
||||
// 油漆线呼叫空托盘业务:查找叠盘架A区是否有满足条件的点位
|
||||
map.put("flag", "1");
|
||||
map.put("vehicle_qty", vehicle_qty);
|
||||
map.put("region_code", RegionTypeEnum.DPJQA.getCode());
|
||||
JSONObject jsonStartPointDPA = WQL.getWO("ST_VEHICLE_OUT_02").addParamMap(map).process().uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(jsonStartPointDPA)) {
|
||||
start_point_code = jsonStartPointDPA.getString("point_code");
|
||||
} else {
|
||||
// 为空说明叠盘架A区没有,则去养生A区找
|
||||
map.put("region_code", RegionTypeEnum.YSQA.getCode());
|
||||
JSONObject jsonStartPointYSA = WQL.getWO("ST_VEHICLE_OUT_02").addParamMap(map).process().uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonStartPointYSA)) throw new BadRequestException("没有满足需求数量的点位");
|
||||
start_point_code = jsonStartPointYSA.getString("point_code");
|
||||
}
|
||||
}
|
||||
return start_point_code;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package org.nl.wms.sch.tasks;
|
||||
|
||||
/**
|
||||
* 任务状态枚举
|
||||
*/
|
||||
public enum RegionTypeEnum {
|
||||
CPQY(1, "CPQY01", "成品区域"),
|
||||
YSQA(2, "YSQA01", "养生A区"),
|
||||
YSQB(3, "YSQB01", "养生B区"),
|
||||
GJQY(4, "GJQY01", "共挤区"),
|
||||
YQQY(5, "YQQY01", "油漆区"),
|
||||
DPJQA(6, "DPJQA01", "叠盘架A区"),
|
||||
DPJQB(7, "DPJQB01", "叠盘架B区"),
|
||||
KTPHCQA(8, "KTPHCQA01", "空托盘缓存A区"),
|
||||
KTPHCQB(8, "KTPHCQB01", "空托盘缓存B区");
|
||||
|
||||
private int index;
|
||||
private String code;
|
||||
private String name;
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
RegionTypeEnum(int index, String code, String name) {
|
||||
this.index = index;
|
||||
this.code = code;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,225 @@
|
||||
package org.nl.wms.sch.tasks;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.utils.SecurityUtils;
|
||||
import org.nl.utils.SpringContextHolder;
|
||||
import org.nl.wms.sch.manage.AbstractAcsTask;
|
||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||
import org.nl.wms.sch.service.PointService;
|
||||
import org.nl.wms.sch.service.dto.PointDto;
|
||||
import org.nl.wql.WQL;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class SendEmpVehicleTask extends AbstractAcsTask {
|
||||
private final String THIS_CLASS = SendEmpVehicleTask.class.getName();
|
||||
|
||||
@Override
|
||||
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task");
|
||||
WQLObject empTab = WQLObject.getWQLObject("st_ivt_EmptyVehicleRecord");
|
||||
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point");
|
||||
|
||||
// 完成任务
|
||||
if(StrUtil.equals(status, TaskStatusEnum.FINISHED.getCode())) {
|
||||
// 更改任务状态为完成
|
||||
JSONObject jsonTask = taskTab.query("task_id = '" + taskObj.getString("task_id") + "'").uniqueResult(0);
|
||||
jsonTask.put("task_status",TaskStatusEnum.FINISHED.getCode());
|
||||
jsonTask.put("update_optid", SecurityUtils.getCurrentUserId());
|
||||
jsonTask.put("update_optname", SecurityUtils.getCurrentUsername());
|
||||
jsonTask.put("update_time", DateUtil.now());
|
||||
taskTab.update(jsonTask);
|
||||
|
||||
PointService point = SpringContextHolder.getBean(PointService.class);
|
||||
// 校验起点是否存在
|
||||
PointDto start_point_code = point.findByCode(jsonTask.getString("start_point_code"));
|
||||
if (ObjectUtil.isEmpty(start_point_code)) throw new BadRequestException("未找到可用点位:" + start_point_code);
|
||||
// 校验终点是否存在
|
||||
PointDto next_point_code = point.findByCode(jsonTask.getString("next_point_code"));
|
||||
if (ObjectUtil.isEmpty(start_point_code)) throw new BadRequestException("未找到可用点位:" + next_point_code);
|
||||
|
||||
// 1.更新点位数量 2.解锁点位
|
||||
JSONObject jsonEmp = empTab.query("task_uuid = '" + taskObj.getString("task_id") + "'").uniqueResult(0);
|
||||
int vehicle_qty = JSONObject.parseObject(JSON.toJSONString(next_point_code)).getIntValue("vehicle_qty");
|
||||
BigDecimal vehicle_qty_point = NumberUtil.add(String.valueOf(vehicle_qty), String.valueOf(jsonEmp.getIntValue("vehicle_qty")));
|
||||
|
||||
next_point_code.setVehicle_qty(Integer.valueOf(vehicle_qty_point.toString()));
|
||||
next_point_code.setPoint_status("01");
|
||||
next_point_code.setLock_type("00");
|
||||
pointTab.update(JSONObject.parseObject(JSON.toJSONString(next_point_code)));
|
||||
|
||||
// 完成单据状态
|
||||
jsonEmp.put("bill_status", "50");
|
||||
jsonEmp.put("update_optid", SecurityUtils.getCurrentUserId());
|
||||
jsonEmp.put("update_optname", SecurityUtils.getCurrentUsername());
|
||||
jsonEmp.put("update_time", DateUtil.now());
|
||||
empTab.update(jsonEmp);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void findStartPoint() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void findNextPoint() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createTask(JSONObject form) {
|
||||
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task");
|
||||
WQLObject empTab = WQLObject.getWQLObject("st_ivt_EmptyVehicleRecord");
|
||||
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point");
|
||||
|
||||
String start_point_code = form.getString("start_point_code");
|
||||
String next_point_code = form.getString("next_point_code");
|
||||
String qty = form.getString("qty");
|
||||
String record_uuid = form.getString("record_uuid");
|
||||
|
||||
// 入库起点不能为空
|
||||
if (ObjectUtil.isEmpty(start_point_code)) {
|
||||
throw new BadRequestException("起点不能为空");
|
||||
} else {
|
||||
// 判断起点是否有正在执行的任务
|
||||
JSONObject beforTaskObj = taskTab.query("is_delete='0' and start_point_code='" + start_point_code + "' and task_status <>'" + TaskStatusEnum.FINISHED.getCode() + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(beforTaskObj)) throw new BadRequestException("存在指令号为'" + beforTaskObj.getString("task_code") + "' 未完成!");
|
||||
}
|
||||
// 载具数量不能为空
|
||||
if (ObjectUtil.isEmpty(qty)) throw new BadRequestException("载具数量不能为空");
|
||||
|
||||
/*
|
||||
* 1. 点对点: 起点和终点都确定,直接创建任务
|
||||
* 2. 起点确定: 需要找到对应终点,在创建任务 具体找终点货位的规则在findEndPoint()中
|
||||
*/
|
||||
// 起点确定:找终点
|
||||
if (ObjectUtil.isEmpty(next_point_code)) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("start_point_code",start_point_code);
|
||||
param.put("vehicle_qty",qty);
|
||||
next_point_code = this.findEndPoint(param);
|
||||
} else {
|
||||
// 判断终点是否是空位
|
||||
JSONObject jsonPoint = pointTab.query("point_code = '" + next_point_code + "' and lock_type = '00' and point_status <> '02' and is_delete = '0' and is_used = '1'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonPoint)) throw new BadRequestException("终点点位不不可用或不存在");
|
||||
}
|
||||
// 创建任务
|
||||
JSONObject jsonTask = new JSONObject();
|
||||
String task_id = IdUtil.getSnowflake(1, 1).nextId() + "";
|
||||
|
||||
jsonTask.put("task_id", task_id);
|
||||
jsonTask.put("taskdtl_id", task_id);
|
||||
jsonTask.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
||||
jsonTask.put("task_type", "03");
|
||||
jsonTask.put("taskdtl_type", "03");
|
||||
jsonTask.put("task_status", "01");
|
||||
jsonTask.put("start_point_code", start_point_code);
|
||||
jsonTask.put("next_point_code", next_point_code);
|
||||
jsonTask.put("handle_class", THIS_CLASS);
|
||||
jsonTask.put("create_name", SecurityUtils.getCurrentUsername());
|
||||
jsonTask.put("create_id", SecurityUtils.getCurrentUserId());
|
||||
jsonTask.put("create_time", DateUtil.now());
|
||||
jsonTask.put("acs_task_type", "1");
|
||||
taskTab.insert(jsonTask);
|
||||
|
||||
// 锁定终点点位
|
||||
JSONObject jsonPoint = pointTab.query("point_code = '" + next_point_code + "'").uniqueResult(0);
|
||||
jsonPoint.put("lock_type", "02");
|
||||
pointTab.update(jsonPoint);
|
||||
|
||||
// 更新空载具单据状态
|
||||
if (ObjectUtil.isNotEmpty(record_uuid)) {
|
||||
JSONObject jsonEmp = empTab.query("record_uuid ='" + record_uuid + "'").uniqueResult(0);
|
||||
jsonEmp.put("bill_status","20");
|
||||
empTab.update(jsonEmp);
|
||||
}
|
||||
return task_id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forceFinish(String task_id) {
|
||||
JSONObject taskObj = WQLObject.getWQLObject("SCH_BASE_Task").query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
this.updateTaskStatus(taskObj, TaskStatusEnum.FINISHED.getCode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pullBack(String task_id) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancel(String task_id) {
|
||||
|
||||
}
|
||||
|
||||
public String findEndPoint(JSONObject json) {
|
||||
String start_point_code = json.getString("start_point_code");
|
||||
String vehicle_qty = json.getString("vehicle_qty");
|
||||
if (ObjectUtil.isEmpty(start_point_code)) throw new BadRequestException("起点不能为空");
|
||||
if (ObjectUtil.isEmpty(vehicle_qty)) throw new BadRequestException("载具数量不能为空");
|
||||
|
||||
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point");
|
||||
WQLObject regionTab = WQLObject.getWQLObject("SCH_BASE_Region");
|
||||
// 根据起点区域判断优先的终点区域
|
||||
JSONObject jsonPointStart = pointTab.query("point_code = '" + start_point_code + "'").uniqueResult(0);
|
||||
JSONObject jsonRegionStart = regionTab.query("region_id ='" + jsonPointStart.getString("region_id") + "'").uniqueResult(0);
|
||||
/*
|
||||
* 空托盘入库业务:
|
||||
* 1.油漆线 --> 叠盘架A区、养生区A区 (优先级:1叠盘架A区 2.养生A区)
|
||||
* 2.货梯 --> 叠盘架B区、养生区A区 (优先级:1叠盘架B区 2.养生A区)
|
||||
*/
|
||||
String EndPoint_code = "";
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
if (StrUtil.equals(jsonRegionStart.getString("region_code"), RegionTypeEnum.YQQY.getCode())) {
|
||||
// 油漆线入库:查找叠盘架A区是否有满足的空位
|
||||
map.put("flag", "1");
|
||||
map.put("vehicle_qty",vehicle_qty);
|
||||
map.put("region_code",RegionTypeEnum.DPJQA.getCode());
|
||||
JSONObject jsonEndPointDPA = WQL.getWO("ST_VEHICLE_IN_02").addParamMap(map).process().uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(jsonEndPointDPA)) {
|
||||
EndPoint_code = jsonEndPointDPA.getString("point_code");
|
||||
} else {
|
||||
// 为空说明叠盘架A区上货位不足,则需要入库到养生A区
|
||||
map.put("flag", "2");
|
||||
map.put("region_code",RegionTypeEnum.YSQA.getCode() );
|
||||
JSONObject jsonEndPointYSA = WQL.getWO("ST_VEHICLE_IN_02").addParamMap(map).process().uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonEndPointYSA)) throw new BadRequestException("没有满足需求的空位");
|
||||
EndPoint_code = jsonEndPointYSA.getString("point_code");
|
||||
}
|
||||
} else {
|
||||
// 货梯入库:查找叠盘架B区是否有满足的空位
|
||||
map.put("flag", "1");
|
||||
map.put("vehicle_qty",vehicle_qty);
|
||||
map.put("region_code",RegionTypeEnum.DPJQB.getCode());
|
||||
JSONObject jsonEndPointDPB = WQL.getWO("ST_VEHICLE_IN_02").addParamMap(map).process().uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(jsonEndPointDPB)) {
|
||||
EndPoint_code = jsonEndPointDPB.getString("point_code");
|
||||
} else {
|
||||
// 为空说明叠盘架B区上货位不足,则需要入库到养生A区
|
||||
map.put("flag", "2");
|
||||
map.put("region_code", RegionTypeEnum.YSQA.getCode());
|
||||
JSONObject jsonEndPointYSA = WQL.getWO("ST_VEHICLE_IN_02").addParamMap(map).process().uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonEndPointYSA)) throw new BadRequestException("没有满足需求的空位");
|
||||
EndPoint_code = jsonEndPointYSA.getString("point_code");
|
||||
}
|
||||
}
|
||||
return EndPoint_code;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
|
||||
package org.nl.wms.st.vehiclebill.rest;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.annotation.Log;
|
||||
import org.nl.wms.st.vehiclebill.service.InEmptyvehiclerecordService;
|
||||
import org.nl.wms.st.vehiclebill.service.dto.EmptyvehiclerecordDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
* @date 2022-08-12
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "空载具入库管理")
|
||||
@RequestMapping("/api/inemptyvehicle")
|
||||
@Slf4j
|
||||
public class InEmptyvehiclerecordController {
|
||||
|
||||
private final InEmptyvehiclerecordService inEmptyvehiclerecordService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询空载具入库")
|
||||
@ApiOperation("查询空载具入库")
|
||||
//@PreAuthorize("@el.check('emptyvehiclerecord:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(inEmptyvehiclerecordService.queryAll(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增空载具入库")
|
||||
@ApiOperation("新增空载具入库")
|
||||
//@PreAuthorize("@el.check('emptyvehiclerecord:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody EmptyvehiclerecordDto dto) {
|
||||
inEmptyvehiclerecordService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改空载具入库")
|
||||
@ApiOperation("修改空载具入库")
|
||||
//@PreAuthorize("@el.check('emptyvehiclerecord:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody EmptyvehiclerecordDto dto) {
|
||||
inEmptyvehiclerecordService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除空载具入库")
|
||||
@ApiOperation("删除空载具入库")
|
||||
//@PreAuthorize("@el.check('emptyvehiclerecord:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||
inEmptyvehiclerecordService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("生成任务")
|
||||
@ApiOperation("生成任务")
|
||||
@PostMapping("/createTask")
|
||||
public ResponseEntity<Object> createTask(@RequestBody JSONObject whereJson) {
|
||||
inEmptyvehiclerecordService.createTask(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
|
||||
package org.nl.wms.st.vehiclebill.rest;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.annotation.Log;
|
||||
import org.nl.wms.st.vehiclebill.service.OutEmptyvehiclerecordService;
|
||||
import org.nl.wms.st.vehiclebill.service.dto.EmptyvehiclerecordDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
* @date 2022-08-12
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "空载具出库管理")
|
||||
@RequestMapping("/api/outemptyvehicle")
|
||||
@Slf4j
|
||||
public class OutEmptyvehiclerecordController {
|
||||
|
||||
private final OutEmptyvehiclerecordService outEmptyvehiclerecordService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询空载具出库")
|
||||
@ApiOperation("查询空载具出库")
|
||||
//@PreAuthorize("@el.check('emptyvehiclerecord:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(outEmptyvehiclerecordService.queryAll(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增空载具出库")
|
||||
@ApiOperation("新增空载具出库")
|
||||
//@PreAuthorize("@el.check('emptyvehiclerecord:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody EmptyvehiclerecordDto dto) {
|
||||
outEmptyvehiclerecordService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改空载具出库")
|
||||
@ApiOperation("修改空载具出库")
|
||||
//@PreAuthorize("@el.check('emptyvehiclerecord:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody EmptyvehiclerecordDto dto) {
|
||||
outEmptyvehiclerecordService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除空载具出库")
|
||||
@ApiOperation("删除空载具出库")
|
||||
//@PreAuthorize("@el.check('emptyvehiclerecord:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||
outEmptyvehiclerecordService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("生成任务")
|
||||
@ApiOperation("生成任务")
|
||||
@PostMapping("/createTask")
|
||||
public ResponseEntity<Object> createTask(@RequestBody JSONObject whereJson) {
|
||||
outEmptyvehiclerecordService.createTask(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
|
||||
package org.nl.wms.st.vehiclebill.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.st.vehiclebill.service.dto.EmptyvehiclerecordDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
* @description 服务接口
|
||||
* @date 2022-08-12
|
||||
**/
|
||||
public interface InEmptyvehiclerecordService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
*
|
||||
* @param whereJson 条件参数
|
||||
* @return List<EmptyvehiclerecordDto>
|
||||
*/
|
||||
List<EmptyvehiclerecordDto> queryAll(Map whereJson);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
*
|
||||
* @param record_uuid ID
|
||||
* @return Emptyvehiclerecord
|
||||
*/
|
||||
EmptyvehiclerecordDto findById(Long record_uuid);
|
||||
|
||||
/**
|
||||
* 根据编码查询
|
||||
*
|
||||
* @param code code
|
||||
* @return Emptyvehiclerecord
|
||||
*/
|
||||
EmptyvehiclerecordDto findByCode(String code);
|
||||
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param dto /
|
||||
*/
|
||||
void create(EmptyvehiclerecordDto dto);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param dto /
|
||||
*/
|
||||
void update(EmptyvehiclerecordDto dto);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
|
||||
/**
|
||||
* 生成任务
|
||||
*
|
||||
* @param whereJson /
|
||||
*/
|
||||
void createTask(JSONObject whereJson);
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
|
||||
package org.nl.wms.st.vehiclebill.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.st.vehiclebill.service.dto.EmptyvehiclerecordDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
* @description 服务接口
|
||||
* @date 2022-08-12
|
||||
**/
|
||||
public interface OutEmptyvehiclerecordService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
*
|
||||
* @param whereJson 条件参数
|
||||
* @return List<EmptyvehiclerecordDto>
|
||||
*/
|
||||
List<EmptyvehiclerecordDto> queryAll(Map whereJson);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
*
|
||||
* @param record_uuid ID
|
||||
* @return Emptyvehiclerecord
|
||||
*/
|
||||
EmptyvehiclerecordDto findById(Long record_uuid);
|
||||
|
||||
/**
|
||||
* 根据编码查询
|
||||
*
|
||||
* @param code code
|
||||
* @return Emptyvehiclerecord
|
||||
*/
|
||||
EmptyvehiclerecordDto findByCode(String code);
|
||||
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param dto /
|
||||
*/
|
||||
void create(EmptyvehiclerecordDto dto);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param dto /
|
||||
*/
|
||||
void update(EmptyvehiclerecordDto dto);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
|
||||
/**
|
||||
* 生成任务
|
||||
*
|
||||
* @param whereJson /
|
||||
*/
|
||||
void createTask(JSONObject whereJson);
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package org.nl.wms.st.vehiclebill.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
* @description /
|
||||
* @date 2022-08-12
|
||||
**/
|
||||
@Data
|
||||
public class EmptyvehiclerecordDto implements Serializable {
|
||||
|
||||
/** 记录标识 */
|
||||
/**
|
||||
* 防止精度丢失
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long record_uuid;
|
||||
|
||||
/**
|
||||
* 单据编号
|
||||
*/
|
||||
private String bill_code;
|
||||
|
||||
/**
|
||||
* 单据类型
|
||||
*/
|
||||
private String io_type;
|
||||
|
||||
/**
|
||||
* 单据状态
|
||||
*/
|
||||
private String bill_status;
|
||||
|
||||
/**
|
||||
* 载具数量
|
||||
*/
|
||||
private BigDecimal vehicle_qty;
|
||||
|
||||
/**
|
||||
* 起始点位
|
||||
*/
|
||||
private String start_point_code;
|
||||
|
||||
/**
|
||||
* 下一点位
|
||||
*/
|
||||
private String next_point_code;
|
||||
|
||||
/**
|
||||
* 起始区域
|
||||
*/
|
||||
private Long start_region_id;
|
||||
|
||||
/**
|
||||
* 终点区域
|
||||
*/
|
||||
private Long end_region_id;
|
||||
|
||||
/**
|
||||
* 任务标识
|
||||
*/
|
||||
private Long task_uuid;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private Long create_id;
|
||||
|
||||
/**
|
||||
* 创建人姓名
|
||||
*/
|
||||
private String create_name;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String create_time;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private Long update_optid;
|
||||
|
||||
/**
|
||||
* 修改人姓名
|
||||
*/
|
||||
private String update_optname;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private String update_time;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private String is_delete;
|
||||
}
|
||||
@@ -0,0 +1,205 @@
|
||||
|
||||
package org.nl.wms.st.vehiclebill.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.utils.SpringContextHolder;
|
||||
import org.nl.wms.sch.service.PointService;
|
||||
import org.nl.wms.sch.tasks.SendEmpVehicleTask;
|
||||
import org.nl.wms.st.vehiclebill.service.InEmptyvehiclerecordService;
|
||||
import org.nl.wms.st.vehiclebill.service.dto.EmptyvehiclerecordDto;
|
||||
import org.nl.wql.WQL;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.utils.SecurityUtils;
|
||||
import org.nl.wql.core.bean.ResultBean;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.nl.wql.util.WqlUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
* @description 服务实现
|
||||
* @date 2022-08-12
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class InEmptyvehiclerecordServiceImpl implements InEmptyvehiclerecordService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
String bill_code = MapUtil.getStr(whereJson, "bill_code");
|
||||
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("flag", "1");
|
||||
|
||||
if (ObjectUtil.isNotEmpty(bill_code)) map.put("bill_code",bill_code + "%");
|
||||
|
||||
JSONObject json = WQL.getWO("ST_VEHICLE_IN_01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "st.create_time DESC");
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EmptyvehiclerecordDto> queryAll(Map whereJson) {
|
||||
WQLObject wo = WQLObject.getWQLObject("st_ivt_emptyvehiclerecord");
|
||||
JSONArray arr = wo.query().getResultJSONArray(0);
|
||||
if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(EmptyvehiclerecordDto.class);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EmptyvehiclerecordDto findById(Long record_uuid) {
|
||||
WQLObject wo = WQLObject.getWQLObject("st_ivt_emptyvehiclerecord");
|
||||
JSONObject json = wo.query("record_uuid = '" + record_uuid + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)) {
|
||||
return json.toJavaObject(EmptyvehiclerecordDto.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EmptyvehiclerecordDto findByCode(String code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("st_ivt_emptyvehiclerecord");
|
||||
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)) {
|
||||
return json.toJavaObject(EmptyvehiclerecordDto.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(EmptyvehiclerecordDto dto) {
|
||||
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point");
|
||||
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
String start_point_code = dto.getStart_point_code();
|
||||
String next_point_code = dto.getNext_point_code();
|
||||
// 判断起点是否为空! 入库起点不能为空
|
||||
if (ObjectUtil.isEmpty(start_point_code)) throw new BadRequestException("起点不能为空");
|
||||
// 根据点位编码找到对应的所属区域
|
||||
Long start_region_id = pointTab.query("point_code = '" + start_point_code + "'").uniqueResult(0).getLongValue("region_id");
|
||||
if (ObjectUtil.isNotEmpty(next_point_code)) {
|
||||
Long end_region_id = pointTab.query("point_code = '" + next_point_code + "'").uniqueResult(0).getLongValue("region_id");
|
||||
dto.setEnd_region_id(end_region_id);
|
||||
}
|
||||
|
||||
dto.setRecord_uuid(IdUtil.getSnowflake(1, 1).nextId());
|
||||
dto.setCreate_id(currentUserId);
|
||||
dto.setCreate_name(nickName);
|
||||
dto.setUpdate_optid(currentUserId);
|
||||
dto.setUpdate_optname(nickName);
|
||||
dto.setUpdate_time(now);
|
||||
dto.setCreate_time(now);
|
||||
dto.setBill_code(CodeUtil.getNewCode("KZJ_BILL_CODE"));
|
||||
dto.setIo_type("0");
|
||||
dto.setBill_status("10");
|
||||
dto.setStart_region_id(start_region_id);
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("st_ivt_emptyvehiclerecord");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.insert(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(EmptyvehiclerecordDto dto) {
|
||||
EmptyvehiclerecordDto entity = this.findById(dto.getRecord_uuid());
|
||||
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
|
||||
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point");
|
||||
|
||||
String start_point_code = dto.getStart_point_code();
|
||||
String next_point_code = dto.getNext_point_code();
|
||||
// 判断起点是否为空! 入库起点不能为空
|
||||
if (ObjectUtil.isEmpty(start_point_code)) throw new BadRequestException("起点不能为空");
|
||||
// 根据点位编码找到对应的所属区域
|
||||
Long start_region_id = pointTab.query("point_code = '" + start_point_code + "'").uniqueResult(0).getLongValue("region_id");
|
||||
if (ObjectUtil.isNotEmpty(next_point_code)) {
|
||||
Long end_region_id = pointTab.query("point_code = '" + next_point_code + "'").uniqueResult(0).getLongValue("region_id");
|
||||
dto.setEnd_region_id(end_region_id);
|
||||
}
|
||||
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
|
||||
String now = DateUtil.now();
|
||||
dto.setUpdate_time(now);
|
||||
dto.setStart_region_id(start_region_id);
|
||||
dto.setUpdate_optid(currentUserId);
|
||||
dto.setUpdate_optname(nickName);
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("st_ivt_emptyvehiclerecord");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.update(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(Long[] ids) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("st_ivt_emptyvehiclerecord");
|
||||
for (Long record_uuid : ids) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("record_uuid", String.valueOf(record_uuid));
|
||||
param.put("is_delete", "1");
|
||||
param.put("update_optid", currentUserId);
|
||||
param.put("update_optname", nickName);
|
||||
param.put("update_time", now);
|
||||
wo.update(param);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void createTask(JSONObject whereJson) {
|
||||
WQLObject empTab = WQLObject.getWQLObject("st_ivt_EmptyVehicleRecord");
|
||||
WQLObject taskTab = WQLObject.getWQLObject("sch_base_task");
|
||||
|
||||
JSONObject jsonEmp = empTab.query("record_uuid = '" + whereJson.getString("record_uuid") + "'").uniqueResult(0);
|
||||
// 准备参数 调用空载具处理类中的 创建任务的方法
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("start_point_code", jsonEmp.getString("start_point_code"));
|
||||
param.put("next_point_code", jsonEmp.getString("next_point_code"));
|
||||
param.put("qty", jsonEmp.getString("vehicle_qty"));
|
||||
param.put("record_uuid", jsonEmp.getString("record_uuid"));
|
||||
|
||||
String task_id = new SendEmpVehicleTask().createTask(param);
|
||||
// 更新空载具表中的任务id和单据状态
|
||||
PointService pointDto = SpringContextHolder.getBean(PointService.class);
|
||||
JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
|
||||
jsonEmp.put("task_uuid", Long.valueOf(task_id));
|
||||
jsonEmp.put("bill_status","20");
|
||||
jsonEmp.put("next_point_code",jsonTask.getString("next_point_code"));
|
||||
jsonEmp.put("end_region_id",pointDto.findByCode(jsonTask.getString("next_point_code")).getRegion_id());
|
||||
jsonEmp.put("update_optid", SecurityUtils.getCurrentUserId());
|
||||
jsonEmp.put("update_optname", SecurityUtils.getNickName());
|
||||
jsonEmp.put("update_time", DateUtil.now());
|
||||
empTab.update(jsonEmp);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,204 @@
|
||||
|
||||
package org.nl.wms.st.vehiclebill.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.utils.SecurityUtils;
|
||||
import org.nl.utils.SpringContextHolder;
|
||||
import org.nl.wms.sch.service.PointService;
|
||||
import org.nl.wms.sch.tasks.CallEmpVehicleTask;
|
||||
import org.nl.wms.sch.tasks.SendEmpVehicleTask;
|
||||
import org.nl.wms.st.vehiclebill.service.InEmptyvehiclerecordService;
|
||||
import org.nl.wms.st.vehiclebill.service.OutEmptyvehiclerecordService;
|
||||
import org.nl.wms.st.vehiclebill.service.dto.EmptyvehiclerecordDto;
|
||||
import org.nl.wql.WQL;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.nl.wql.util.WqlUtil;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
* @description 服务实现
|
||||
* @date 2022-08-12
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class OutEmptyvehiclerecordServiceImpl implements OutEmptyvehiclerecordService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
String bill_code = MapUtil.getStr(whereJson, "bill_code");
|
||||
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("flag", "1");
|
||||
|
||||
if (ObjectUtil.isNotEmpty(bill_code)) map.put("bill_code",bill_code + "%");
|
||||
|
||||
JSONObject json = WQL.getWO("ST_VEHICLE_OUT_01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "st.create_time DESC");
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EmptyvehiclerecordDto> queryAll(Map whereJson) {
|
||||
WQLObject wo = WQLObject.getWQLObject("st_ivt_emptyvehiclerecord");
|
||||
JSONArray arr = wo.query().getResultJSONArray(0);
|
||||
if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(EmptyvehiclerecordDto.class);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EmptyvehiclerecordDto findById(Long record_uuid) {
|
||||
WQLObject wo = WQLObject.getWQLObject("st_ivt_emptyvehiclerecord");
|
||||
JSONObject json = wo.query("record_uuid = '" + record_uuid + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)) {
|
||||
return json.toJavaObject(EmptyvehiclerecordDto.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EmptyvehiclerecordDto findByCode(String code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("st_ivt_emptyvehiclerecord");
|
||||
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)) {
|
||||
return json.toJavaObject(EmptyvehiclerecordDto.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(EmptyvehiclerecordDto dto) {
|
||||
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point");
|
||||
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
String start_point_code = dto.getStart_point_code();
|
||||
String next_point_code = dto.getNext_point_code();
|
||||
// 判断终点是否为空! 出库终点不能为空
|
||||
if (ObjectUtil.isEmpty(next_point_code)) throw new BadRequestException("终点不能为空");
|
||||
// 根据点位编码找到对应的所属区域
|
||||
Long end_region_id = pointTab.query("point_code = '" + next_point_code + "'").uniqueResult(0).getLongValue("region_id");
|
||||
if (ObjectUtil.isNotEmpty(start_point_code)) {
|
||||
Long start_region_id = pointTab.query("point_code = '" + start_point_code + "'").uniqueResult(0).getLongValue("region_id");
|
||||
dto.setStart_region_id(start_region_id);
|
||||
}
|
||||
|
||||
dto.setRecord_uuid(IdUtil.getSnowflake(1, 1).nextId());
|
||||
dto.setCreate_id(currentUserId);
|
||||
dto.setCreate_name(nickName);
|
||||
dto.setUpdate_optid(currentUserId);
|
||||
dto.setUpdate_optname(nickName);
|
||||
dto.setUpdate_time(now);
|
||||
dto.setCreate_time(now);
|
||||
dto.setBill_code(CodeUtil.getNewCode("KZJ_BILL_CODE"));
|
||||
dto.setIo_type("1");
|
||||
dto.setBill_status("10");
|
||||
dto.setEnd_region_id(end_region_id);
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("st_ivt_emptyvehiclerecord");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.insert(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(EmptyvehiclerecordDto dto) {
|
||||
EmptyvehiclerecordDto entity = this.findById(dto.getRecord_uuid());
|
||||
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
|
||||
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point");
|
||||
|
||||
String start_point_code = dto.getStart_point_code();
|
||||
String next_point_code = dto.getNext_point_code();
|
||||
// 判断起点是否为空! 入库起点不能为空
|
||||
if (ObjectUtil.isEmpty(next_point_code)) throw new BadRequestException("终点不能为空");
|
||||
// 根据点位编码找到对应的所属区域
|
||||
Long end_region_id = pointTab.query("point_code = '" + next_point_code + "'").uniqueResult(0).getLongValue("region_id");
|
||||
if (ObjectUtil.isNotEmpty(start_point_code)) {
|
||||
Long start_region_id = pointTab.query("point_code = '" + start_point_code + "'").uniqueResult(0).getLongValue("region_id");
|
||||
dto.setStart_region_id(start_region_id);
|
||||
}
|
||||
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
|
||||
String now = DateUtil.now();
|
||||
dto.setUpdate_time(now);
|
||||
dto.setStart_region_id(end_region_id);
|
||||
dto.setUpdate_optid(currentUserId);
|
||||
dto.setUpdate_optname(nickName);
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("st_ivt_emptyvehiclerecord");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.update(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(Long[] ids) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("st_ivt_emptyvehiclerecord");
|
||||
for (Long record_uuid : ids) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("record_uuid", String.valueOf(record_uuid));
|
||||
param.put("is_delete", "1");
|
||||
param.put("update_optid", currentUserId);
|
||||
param.put("update_optname", nickName);
|
||||
param.put("update_time", now);
|
||||
wo.update(param);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void createTask(JSONObject whereJson) {
|
||||
WQLObject empTab = WQLObject.getWQLObject("st_ivt_EmptyVehicleRecord");
|
||||
WQLObject taskTab = WQLObject.getWQLObject("sch_base_task");
|
||||
|
||||
JSONObject jsonEmp = empTab.query("record_uuid = '" + whereJson.getString("record_uuid") + "'").uniqueResult(0);
|
||||
// 准备参数 调用空载具处理类中的 创建任务的方法
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("start_point_code", jsonEmp.getString("start_point_code"));
|
||||
param.put("next_point_code", jsonEmp.getString("next_point_code"));
|
||||
param.put("qty", jsonEmp.getString("vehicle_qty"));
|
||||
param.put("record_uuid", jsonEmp.getString("record_uuid"));
|
||||
|
||||
String task_id = new CallEmpVehicleTask().createTask(param);
|
||||
// 更新空载具表中的任务id和单据状态
|
||||
PointService pointDto = SpringContextHolder.getBean(PointService.class);
|
||||
JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
|
||||
jsonEmp.put("task_uuid", Long.valueOf(task_id));
|
||||
jsonEmp.put("bill_status","20");
|
||||
jsonEmp.put("start_point_code",jsonTask.getString("start_point_code"));
|
||||
jsonEmp.put("start_region_id",pointDto.findByCode(jsonTask.getString("start_point_code")).getRegion_id());
|
||||
jsonEmp.put("update_optid", SecurityUtils.getCurrentUserId());
|
||||
jsonEmp.put("update_optname", SecurityUtils.getNickName());
|
||||
jsonEmp.put("update_time", DateUtil.now());
|
||||
empTab.update(jsonEmp);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
[交易说明]
|
||||
交易名: 空载具入库分页查询
|
||||
所属模块:
|
||||
功能简述:
|
||||
版权所有:
|
||||
表引用:
|
||||
版本经历:
|
||||
|
||||
[数据库]
|
||||
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||
|
||||
[IO定义]
|
||||
#################################################
|
||||
## 表字段对应输入参数
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
输入.bill_code TYPEAS s_string
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
|
||||
[临时变量]
|
||||
--所有中间过程变量均可在此处定义
|
||||
|
||||
[业务过程]
|
||||
|
||||
##########################################
|
||||
# 1、输入输出检查 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 2、主过程前处理 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 3、业务主过程 #
|
||||
##########################################
|
||||
|
||||
IF 输入.flag = "1"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
st.*,
|
||||
region1.region_name AS start_region_name,
|
||||
region2.region_name AS endt_region_name
|
||||
FROM
|
||||
st_ivt_EmptyVehicleRecord st
|
||||
LEFT JOIN sch_base_region region1 ON st.start_region_id = region1.region_id
|
||||
LEFT JOIN sch_base_region region2 ON st.end_region_id = region2.region_id
|
||||
WHERE
|
||||
st.is_delete = '0'
|
||||
AND st.io_type = '0'
|
||||
|
||||
OPTION 输入.bill_code <> ""
|
||||
st.bill_code like 输入.bill_code
|
||||
ENDOPTION
|
||||
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
@@ -0,0 +1,82 @@
|
||||
[交易说明]
|
||||
交易名: 空载具入库业务
|
||||
所属模块:
|
||||
功能简述:
|
||||
版权所有:
|
||||
表引用:
|
||||
版本经历:
|
||||
|
||||
[数据库]
|
||||
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||
|
||||
[IO定义]
|
||||
#################################################
|
||||
## 表字段对应输入参数
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
输入.vehicle_qty TYPEAS s_string
|
||||
输入.region_code TYPEAS s_string
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
|
||||
[临时变量]
|
||||
--所有中间过程变量均可在此处定义
|
||||
|
||||
[业务过程]
|
||||
|
||||
##########################################
|
||||
# 1、输入输出检查 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 2、主过程前处理 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 3、业务主过程 #
|
||||
##########################################
|
||||
|
||||
IF 输入.flag = "1"
|
||||
QUERY
|
||||
SELECT
|
||||
point.*
|
||||
FROM
|
||||
sch_base_point point
|
||||
LEFT JOIN SCH_BASE_Region region ON point.region_id = region.region_id
|
||||
WHERE
|
||||
point.lock_type = '00'
|
||||
AND (12 - IFNULL(point.vehicle_qty,0)) >= 输入.vehicle_qty
|
||||
|
||||
OPTION 输入.region_code <> ""
|
||||
region.region_code = 输入.region_code
|
||||
ENDOPTION
|
||||
|
||||
order by point.vehicle_qty DESC
|
||||
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "2"
|
||||
QUERY
|
||||
SELECT
|
||||
point.*
|
||||
FROM
|
||||
sch_base_point point
|
||||
LEFT JOIN SCH_BASE_Region region ON point.region_id = region.region_id
|
||||
WHERE
|
||||
point.lock_type = '00'
|
||||
AND point.point_status = '00'
|
||||
|
||||
OPTION 输入.region_code <> ""
|
||||
region.region_code = 输入.region_code
|
||||
ENDOPTION
|
||||
|
||||
order by point.point_code DESC
|
||||
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
@@ -0,0 +1,61 @@
|
||||
[交易说明]
|
||||
交易名: 空载具出库分页查询
|
||||
所属模块:
|
||||
功能简述:
|
||||
版权所有:
|
||||
表引用:
|
||||
版本经历:
|
||||
|
||||
[数据库]
|
||||
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||
|
||||
[IO定义]
|
||||
#################################################
|
||||
## 表字段对应输入参数
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
输入.bill_code TYPEAS s_string
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
|
||||
[临时变量]
|
||||
--所有中间过程变量均可在此处定义
|
||||
|
||||
[业务过程]
|
||||
|
||||
##########################################
|
||||
# 1、输入输出检查 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 2、主过程前处理 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 3、业务主过程 #
|
||||
##########################################
|
||||
|
||||
IF 输入.flag = "1"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
st.*,
|
||||
region1.region_name AS start_region_name,
|
||||
region2.region_name AS endt_region_name
|
||||
FROM
|
||||
st_ivt_EmptyVehicleRecord st
|
||||
LEFT JOIN sch_base_region region1 ON st.start_region_id = region1.region_id
|
||||
LEFT JOIN sch_base_region region2 ON st.end_region_id = region2.region_id
|
||||
WHERE
|
||||
st.is_delete = '0'
|
||||
AND st.io_type = '1'
|
||||
|
||||
OPTION 输入.bill_code <> ""
|
||||
st.bill_code like 输入.bill_code
|
||||
ENDOPTION
|
||||
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
@@ -0,0 +1,83 @@
|
||||
[交易说明]
|
||||
交易名: 空载具出库业务
|
||||
所属模块:
|
||||
功能简述:
|
||||
版权所有:
|
||||
表引用:
|
||||
版本经历:
|
||||
|
||||
[数据库]
|
||||
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||
|
||||
[IO定义]
|
||||
#################################################
|
||||
## 表字段对应输入参数
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
输入.vehicle_qty TYPEAS s_string
|
||||
输入.region_code TYPEAS s_string
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
|
||||
[临时变量]
|
||||
--所有中间过程变量均可在此处定义
|
||||
|
||||
[业务过程]
|
||||
|
||||
##########################################
|
||||
# 1、输入输出检查 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 2、主过程前处理 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 3、业务主过程 #
|
||||
##########################################
|
||||
|
||||
IF 输入.flag = "1"
|
||||
QUERY
|
||||
SELECT
|
||||
point.*
|
||||
FROM
|
||||
sch_base_point point
|
||||
LEFT JOIN SCH_BASE_Region region ON point.region_id = region.region_id
|
||||
WHERE
|
||||
point.lock_type = '00'
|
||||
AND point.point_status = '01'
|
||||
AND IFNULL(point.vehicle_qty,0) >= 输入.vehicle_qty
|
||||
|
||||
OPTION 输入.region_code <> ""
|
||||
region.region_code = 输入.region_code
|
||||
ENDOPTION
|
||||
|
||||
order by point.vehicle_qty ASC
|
||||
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "2"
|
||||
QUERY
|
||||
SELECT
|
||||
point.*
|
||||
FROM
|
||||
sch_base_point point
|
||||
LEFT JOIN SCH_BASE_Region region ON point.region_id = region.region_id
|
||||
WHERE
|
||||
point.lock_type = '00'
|
||||
AND point.point_status = '00'
|
||||
|
||||
OPTION 输入.region_code <> ""
|
||||
region.region_code = 输入.region_code
|
||||
ENDOPTION
|
||||
|
||||
order by point.point_code DESC
|
||||
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
Reference in New Issue
Block a user