代码更新
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
|
||||
35
mes/qd/src/api/wms/st/vehiclebill/inemptyvehicl.js
Normal file
35
mes/qd/src/api/wms/st/vehiclebill/inemptyvehicl.js
Normal file
@@ -0,0 +1,35 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: 'api/inemptyvehicle',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function del(ids) {
|
||||
return request({
|
||||
url: 'api/inemptyvehicle/',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
export function edit(data) {
|
||||
return request({
|
||||
url: 'api/inemptyvehicle',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function createTask(data) {
|
||||
return request({
|
||||
url: 'api/inemptyvehicle/createTask',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, createTask }
|
||||
35
mes/qd/src/api/wms/st/vehiclebill/outemptyvehicl.js
Normal file
35
mes/qd/src/api/wms/st/vehiclebill/outemptyvehicl.js
Normal file
@@ -0,0 +1,35 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: 'api/outemptyvehicle',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function del(ids) {
|
||||
return request({
|
||||
url: 'api/outemptyvehicle/',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
export function edit(data) {
|
||||
return request({
|
||||
url: 'api/outemptyvehicle',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function createTask(data) {
|
||||
return request({
|
||||
url: 'api/outemptyvehicle/createTask',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, createTask }
|
||||
@@ -238,7 +238,7 @@
|
||||
<el-table-column prop="inv_code" label="锁定单据编码" width="130" />
|
||||
<el-table-column prop="inv_type" label="锁定单据类型" width="110" :formatter="invtypeFormat" />
|
||||
<el-table-column prop="vehicle_qty" label="载具数量" />
|
||||
<el-table-column prop="update_by" label="修改者" />
|
||||
<el-table-column prop="update_optname" label="修改者" />
|
||||
<el-table-column prop="update_time" label="修改时间" width="150" />
|
||||
<el-table-column
|
||||
v-permission="[]"
|
||||
|
||||
202
mes/qd/src/views/wms/st/vehiclebill/PointDialog.vue
Normal file
202
mes/qd/src/views/wms/st/vehiclebill/PointDialog.vue
Normal file
@@ -0,0 +1,202 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
title="请选择点位"
|
||||
append-to-body
|
||||
:visible.sync="dialogVisible"
|
||||
destroy-on-close
|
||||
width="1000px"
|
||||
@close="close"
|
||||
@open="open"
|
||||
>
|
||||
<el-row style="margin-bottom: 10px;">
|
||||
<el-col :span="22">
|
||||
<el-form :inline="true" class="demo-form-inline">
|
||||
<el-form-item :inline="true" label="模糊搜索:">
|
||||
<el-input v-model="query.search" placeholder="请输入点位编码或名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="所属区域" prop="region_id">
|
||||
<el-select
|
||||
v-model="query.region_id"
|
||||
placeholder="请选择"
|
||||
@change="crud.toQuery"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in reginoList"
|
||||
:label="item.region_name"
|
||||
:value="item.region_id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<rrOperation />
|
||||
</el-form>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<!--表格渲染-->
|
||||
<el-table
|
||||
ref="table"
|
||||
v-loading="crud.loading"
|
||||
:data="crud.data"
|
||||
style="width: 100%;"
|
||||
size="mini"
|
||||
border
|
||||
:cell-style="{'text-align':'center'}"
|
||||
:header-cell-style="{background:'#f5f7fa',color:'#606266','text-align':'center'}"
|
||||
@select="handleSelectionChange"
|
||||
@select-all="onSelectAll"
|
||||
@current-change="clickChange"
|
||||
>
|
||||
<el-table-column v-if="!isSingle" type="selection" width="55" />
|
||||
<el-table-column v-if="isSingle" label="选择" width="55">
|
||||
<template slot-scope="scope">
|
||||
<el-radio v-model="tableRadio" :label="scope.row"><i /></el-radio>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="point_code" label="终点点位编码" show-overflow-tooltip />
|
||||
<el-table-column prop="point_name" label="终点点位名称" show-overflow-tooltip />
|
||||
<el-table-column prop="region_name" label="所属区域" show-overflow-tooltip />
|
||||
<el-table-column prop="vehicle_qty" label="载具数量" show-overflow-tooltip :formatter="formatQty" />
|
||||
<el-table-column prop="point_type" label="点位类型">
|
||||
<template slot-scope="scope">
|
||||
{{ dict.label.sch_point_type[scope.row.point_type] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="submit">确 定</el-button>
|
||||
</span>
|
||||
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import CRUD, { header, presenter } from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
import crudPoint from '@/api/wms/sch/point'
|
||||
|
||||
export default {
|
||||
name: 'EndPointDialog',
|
||||
components: { rrOperation, pagination },
|
||||
dicts: ['sch_area_type', 'sch_point_type'],
|
||||
cruds() {
|
||||
return CRUD({ title: '点位', url: 'api/point/selectPoint', crudMethod: { ...crudPoint }, optShow: {}})
|
||||
},
|
||||
mixins: [presenter(), header()],
|
||||
props: {
|
||||
dialogShow: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
isSingle: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
openParam: {
|
||||
type: Object,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
formInline: {
|
||||
search: ''
|
||||
},
|
||||
tableRadio: '',
|
||||
tableData: [],
|
||||
reginoList: [],
|
||||
dialogVisible: false,
|
||||
material: {}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
dialogShow: {
|
||||
handler(newValue, oldValue) {
|
||||
this.dialogVisible = newValue
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
crudPoint.getRegion().then(res => {
|
||||
this.reginoList = res
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
handleClose(done) {
|
||||
this.$confirm('确认关闭?')
|
||||
.then(_ => {
|
||||
done()
|
||||
})
|
||||
.catch(_ => {
|
||||
})
|
||||
},
|
||||
open() {
|
||||
this.crud.toQuery()
|
||||
},
|
||||
close() {
|
||||
this.crud.resetQuery(false)
|
||||
this.$emit('update:dialogShow', false)
|
||||
},
|
||||
submit() {
|
||||
// 处理单选
|
||||
if (this.isSingle && this.tableRadio) {
|
||||
this.$emit('update:dialogShow', false)
|
||||
this.$emit('tableChanged2', this.tableRadio)
|
||||
return
|
||||
}
|
||||
this.rows = this.$refs.table.selection
|
||||
if (this.rows.length <= 0) {
|
||||
this.$message('请先选择终点点位')
|
||||
return
|
||||
}
|
||||
this.crud.resetQuery(false)
|
||||
this.$emit('update:dialogShow', false)
|
||||
this.$emit('tableChanged2', this.rows)
|
||||
},
|
||||
handleSelectionChange(val, row) {
|
||||
if (val.length > 1) {
|
||||
this.$refs.table.clearSelection()
|
||||
this.$refs.table.toggleRowSelection(val.pop())
|
||||
} else {
|
||||
this.checkrow = row
|
||||
}
|
||||
},
|
||||
onSelectAll() {
|
||||
this.$refs.table.clearSelection()
|
||||
},
|
||||
clickChange(item) {
|
||||
this.tableRadio = item
|
||||
},
|
||||
hand(value) {
|
||||
this.crud.toQuery()
|
||||
},
|
||||
formatQty(row) {
|
||||
debugger
|
||||
if (row.vehicle_qty === '') {
|
||||
return '0'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.crud-opts2 {
|
||||
padding: 4px 0;
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.crud-opts2 .crud-opts-right2 {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.el-table_body tr.current-row>td {
|
||||
background-color: #e9e500;
|
||||
}
|
||||
</style>
|
||||
217
mes/qd/src/views/wms/st/vehiclebill/in/index.vue
Normal file
217
mes/qd/src/views/wms/st/vehiclebill/in/index.vue
Normal file
@@ -0,0 +1,217 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!--工具栏-->
|
||||
<div class="head-container">
|
||||
<div v-if="crud.props.searchToggle">
|
||||
<!-- 搜索 -->
|
||||
<el-form
|
||||
:inline="true"
|
||||
class="demo-form-inline"
|
||||
label-position="right"
|
||||
label-width="90px"
|
||||
label-suffix=":"
|
||||
>
|
||||
<el-form-item label="单据编号">
|
||||
<el-input
|
||||
v-model="query.bill_code"
|
||||
clearable
|
||||
placeholder="单据编号"
|
||||
style="width: 185px;"
|
||||
class="filter-item"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<rrOperation :crud="crud" />
|
||||
</el-form>
|
||||
</div>
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation :permission="permission">
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
type="success"
|
||||
icon="el-icon-position"
|
||||
size="mini"
|
||||
:loading="loading"
|
||||
:disabled="crud.selections.length !== 1"
|
||||
@click="createTask"
|
||||
>
|
||||
生成任务
|
||||
</el-button>
|
||||
</crudOperation>
|
||||
<!--表单组件-->
|
||||
<el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="550px">
|
||||
<el-form ref="form" :model="form" :rules="rules" size="mini" label-width="100px">
|
||||
<el-form-item label="数量:" prop="vehicle_qty">
|
||||
<el-input v-model="form.vehicle_qty" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="起始点位:" prop="start_point_code">
|
||||
<el-input v-model="form.start_point_name" style="width: 370px;" @focus="openStartPonit" />
|
||||
</el-form-item>
|
||||
<el-form-item label="下一点位:">
|
||||
<el-input v-model="form.next_point_name" style="width: 370px;" @focus="openEndPonit" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注:">
|
||||
<el-input v-model="form.remark" type="textarea" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="text" @click="crud.cancelCU">取消</el-button>
|
||||
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!--表格渲染-->
|
||||
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="mini" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column v-if="false" prop="record_uuid" label="记录标识" />
|
||||
<el-table-column prop="bill_code" label="单据编号" show-overflow-tooltip />
|
||||
<el-table-column prop="bill_status" label="单据状态">
|
||||
<template slot-scope="scope">
|
||||
{{ dict.label.st_bill_status[scope.row.bill_status] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="start_point_code" label="起始点位" />
|
||||
<el-table-column prop="next_point_code" label="下一点位" />
|
||||
<el-table-column prop="start_region_name" label="起始区域" />
|
||||
<el-table-column prop="endt_region_name" label="终点区域" />
|
||||
<el-table-column prop="vehicle_qty" label="数量" />
|
||||
<el-table-column prop="task_uuid" label="任务标识" show-overflow-tooltip/>
|
||||
<el-table-column prop="remark" label="备注" />
|
||||
<el-table-column prop="create_name" label="创建人" />
|
||||
<el-table-column prop="create_time" label="创建时间" width="150px" />
|
||||
<el-table-column prop="update_optname" label="修改人" />
|
||||
<el-table-column prop="update_time" label="修改时间" width="150px" />
|
||||
<el-table-column v-permission="[]" label="操作" width="120px" align="center" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<udOperation
|
||||
:data="scope.row"
|
||||
:permission="permission"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
</div>
|
||||
<PointDialog :dialog-show.sync="pointDialog" @tableChanged2="tableChanged2" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crudInemptyvehicl from '@/api/wms/st/vehiclebill/inemptyvehicl'
|
||||
import CRUD, { crud, form, header, presenter } from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import udOperation from '@crud/UD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
import PointDialog from '@/views/wms/st/vehiclebill/PointDialog'
|
||||
|
||||
const defaultForm = {
|
||||
record_uuid: null,
|
||||
bill_code: null,
|
||||
io_type: null,
|
||||
bill_status: null,
|
||||
vehicle_qty: null,
|
||||
start_point_code: null,
|
||||
next_point_code: null,
|
||||
start_point_name: null,
|
||||
next_point_name: null,
|
||||
start_region_id: null,
|
||||
end_region_id: null,
|
||||
task_uuid: null,
|
||||
remark: null,
|
||||
create_id: null,
|
||||
create_name: null,
|
||||
create_time: null,
|
||||
update_optid: null,
|
||||
update_optname: null,
|
||||
update_time: null,
|
||||
is_delete: null
|
||||
}
|
||||
export default {
|
||||
name: 'Inemptyvehicle',
|
||||
dicts: ['st_bill_status'],
|
||||
components: { pagination, crudOperation, rrOperation, udOperation, PointDialog },
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
title: '空载具入库',
|
||||
url: 'api/inemptyvehicle',
|
||||
idField: 'record_uuid',
|
||||
sort: 'record_uuid,desc',
|
||||
crudMethod: { ...crudInemptyvehicl },
|
||||
optShow: {
|
||||
add: true,
|
||||
edit: false,
|
||||
del: false,
|
||||
download: false,
|
||||
reset: true
|
||||
}
|
||||
})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
pointDialog: false,
|
||||
is_startAndEnd: null,
|
||||
loading: false,
|
||||
permission: {},
|
||||
rules: {
|
||||
vehicle_qty: [
|
||||
{ required: true, message: '数量不能为空', trigger: 'blur' }
|
||||
],
|
||||
start_point_code: [
|
||||
{ required: true, message: '起始点位不能为空', trigger: 'blur' }
|
||||
],
|
||||
next_point_code: [
|
||||
{ required: true, message: '终点点位不能为空', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
return true
|
||||
},
|
||||
openStartPonit() {
|
||||
// 1代表起始点位 2代表终点点位
|
||||
this.is_startAndEnd = '1'
|
||||
this.pointDialog = true
|
||||
},
|
||||
openEndPonit() {
|
||||
// 1代表起始点位 2代表终点点位
|
||||
this.is_startAndEnd = '2'
|
||||
this.pointDialog = true
|
||||
},
|
||||
tableChanged2(row) {
|
||||
if (this.is_startAndEnd === '1') {
|
||||
this.form.start_point_code = row.point_code
|
||||
this.form.start_point_name = row.point_name
|
||||
}
|
||||
if (this.is_startAndEnd === '2') {
|
||||
this.form.next_point_code = row.point_code
|
||||
this.form.next_point_name = row.point_name
|
||||
}
|
||||
},
|
||||
createTask() {
|
||||
const _selectData = this.$refs.table.selection
|
||||
if (_selectData[0].bill_status !== '10') {
|
||||
return this.crud.notify('只能对生成状态的单据生成任务', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
}
|
||||
const data = _selectData[0]
|
||||
this.loading = true
|
||||
crudInemptyvehicl.createTask(data).then(res => {
|
||||
this.crud.toQuery()
|
||||
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
this.loading = false
|
||||
}).cache(() => {
|
||||
this.loading = false
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
217
mes/qd/src/views/wms/st/vehiclebill/out/index.vue
Normal file
217
mes/qd/src/views/wms/st/vehiclebill/out/index.vue
Normal file
@@ -0,0 +1,217 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!--工具栏-->
|
||||
<div class="head-container">
|
||||
<div v-if="crud.props.searchToggle">
|
||||
<!-- 搜索 -->
|
||||
<el-form
|
||||
:inline="true"
|
||||
class="demo-form-inline"
|
||||
label-position="right"
|
||||
label-width="90px"
|
||||
label-suffix=":"
|
||||
>
|
||||
<el-form-item label="单据编号">
|
||||
<el-input
|
||||
v-model="query.bill_code"
|
||||
clearable
|
||||
placeholder="单据编号"
|
||||
style="width: 185px;"
|
||||
class="filter-item"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<rrOperation :crud="crud" />
|
||||
</el-form>
|
||||
</div>
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation :permission="permission">
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
type="success"
|
||||
icon="el-icon-position"
|
||||
size="mini"
|
||||
:loading="loading"
|
||||
:disabled="crud.selections.length !== 1"
|
||||
@click="createTask"
|
||||
>
|
||||
生成任务
|
||||
</el-button>
|
||||
</crudOperation>
|
||||
<!--表单组件-->
|
||||
<el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="550px">
|
||||
<el-form ref="form" :model="form" :rules="rules" size="mini" label-width="100px">
|
||||
<el-form-item label="数量:" prop="vehicle_qty">
|
||||
<el-input v-model="form.vehicle_qty" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="起始点位:">
|
||||
<el-input v-model="form.start_point_name" style="width: 370px;" @focus="openStartPonit" />
|
||||
</el-form-item>
|
||||
<el-form-item label="下一点位:" prop="next_point_code">
|
||||
<el-input v-model="form.next_point_name" style="width: 370px;" @focus="openEndPonit" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注:">
|
||||
<el-input v-model="form.remark" type="textarea" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="text" @click="crud.cancelCU">取消</el-button>
|
||||
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!--表格渲染-->
|
||||
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="mini" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column v-if="false" prop="record_uuid" label="记录标识" />
|
||||
<el-table-column prop="bill_code" label="单据编号" show-overflow-tooltip />
|
||||
<el-table-column prop="bill_status" label="单据状态">
|
||||
<template slot-scope="scope">
|
||||
{{ dict.label.st_bill_status[scope.row.bill_status] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="start_point_code" label="起始点位" />
|
||||
<el-table-column prop="next_point_code" label="下一点位" />
|
||||
<el-table-column prop="start_region_name" label="起始区域" />
|
||||
<el-table-column prop="endt_region_name" label="终点区域" />
|
||||
<el-table-column prop="vehicle_qty" label="数量" />
|
||||
<el-table-column prop="task_uuid" label="任务标识" show-overflow-tooltip/>
|
||||
<el-table-column prop="remark" label="备注" />
|
||||
<el-table-column prop="create_name" label="创建人" />
|
||||
<el-table-column prop="create_time" label="创建时间" width="150px" />
|
||||
<el-table-column prop="update_optname" label="修改人" />
|
||||
<el-table-column prop="update_time" label="修改时间" width="150px" />
|
||||
<el-table-column v-permission="[]" label="操作" width="120px" align="center" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<udOperation
|
||||
:data="scope.row"
|
||||
:permission="permission"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
</div>
|
||||
<PointDialog :dialog-show.sync="pointDialog" @tableChanged2="tableChanged2" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crudOutemptyvehicl from '@/api/wms/st/vehiclebill/outemptyvehicl'
|
||||
import CRUD, { crud, form, header, presenter } from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import udOperation from '@crud/UD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
import PointDialog from '@/views/wms/st/vehiclebill/PointDialog'
|
||||
|
||||
const defaultForm = {
|
||||
record_uuid: null,
|
||||
bill_code: null,
|
||||
io_type: null,
|
||||
bill_status: null,
|
||||
vehicle_qty: null,
|
||||
start_point_code: null,
|
||||
next_point_code: null,
|
||||
start_point_name: null,
|
||||
next_point_name: null,
|
||||
start_region_id: null,
|
||||
end_region_id: null,
|
||||
task_uuid: null,
|
||||
remark: null,
|
||||
create_id: null,
|
||||
create_name: null,
|
||||
create_time: null,
|
||||
update_optid: null,
|
||||
update_optname: null,
|
||||
update_time: null,
|
||||
is_delete: null
|
||||
}
|
||||
export default {
|
||||
name: 'Outemptyvehicle',
|
||||
dicts: ['st_bill_status'],
|
||||
components: { pagination, crudOperation, rrOperation, udOperation, PointDialog },
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
title: '空载具出库',
|
||||
url: 'api/outemptyvehicle',
|
||||
idField: 'record_uuid',
|
||||
sort: 'record_uuid,desc',
|
||||
crudMethod: { ...crudOutemptyvehicl },
|
||||
optShow: {
|
||||
add: true,
|
||||
edit: false,
|
||||
del: false,
|
||||
download: false,
|
||||
reset: true
|
||||
}
|
||||
})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
pointDialog: false,
|
||||
is_startAndEnd: null,
|
||||
loading: false,
|
||||
permission: {},
|
||||
rules: {
|
||||
vehicle_qty: [
|
||||
{ required: true, message: '数量不能为空', trigger: 'blur' }
|
||||
],
|
||||
start_point_code: [
|
||||
{ required: true, message: '起始点位不能为空', trigger: 'blur' }
|
||||
],
|
||||
next_point_code: [
|
||||
{ required: true, message: '终点点位不能为空', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
return true
|
||||
},
|
||||
openStartPonit() {
|
||||
// 1代表起始点位 2代表终点点位
|
||||
this.is_startAndEnd = '1'
|
||||
this.pointDialog = true
|
||||
},
|
||||
openEndPonit() {
|
||||
// 1代表起始点位 2代表终点点位
|
||||
this.is_startAndEnd = '2'
|
||||
this.pointDialog = true
|
||||
},
|
||||
tableChanged2(row) {
|
||||
if (this.is_startAndEnd === '1') {
|
||||
this.form.start_point_code = row.point_code
|
||||
this.form.start_point_name = row.point_name
|
||||
}
|
||||
if (this.is_startAndEnd === '2') {
|
||||
this.form.next_point_code = row.point_code
|
||||
this.form.next_point_name = row.point_name
|
||||
}
|
||||
},
|
||||
createTask() {
|
||||
const _selectData = this.$refs.table.selection
|
||||
if (_selectData[0].bill_status !== '10') {
|
||||
return this.crud.notify('只能对生成状态的单据生成任务', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
}
|
||||
const data = _selectData[0]
|
||||
this.loading = true
|
||||
crudOutemptyvehicl.createTask(data).then(res => {
|
||||
this.crud.toQuery()
|
||||
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
this.loading = false
|
||||
}).cache(() => {
|
||||
this.loading = false
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
Reference in New Issue
Block a user