李永德
2 years ago
16 changed files with 330 additions and 110 deletions
@ -0,0 +1,60 @@ |
|||||
|
[交易说明] |
||||
|
交易名: 工单分页查询 |
||||
|
所属模块: |
||||
|
功能简述: |
||||
|
版权所有: |
||||
|
表引用: |
||||
|
版本经历: |
||||
|
|
||||
|
[数据库] |
||||
|
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库 |
||||
|
|
||||
|
[IO定义] |
||||
|
################################################# |
||||
|
## 表字段对应输入参数 |
||||
|
################################################# |
||||
|
输入.flag TYPEAS s_string |
||||
|
输入.vehicle_type TYPEAS s_string |
||||
|
输入.vehicle_code TYPEAS s_string |
||||
|
|
||||
|
[临时表] |
||||
|
--这边列出来的临时表就会在运行期动态创建 |
||||
|
|
||||
|
[临时变量] |
||||
|
--所有中间过程变量均可在此处定义 |
||||
|
|
||||
|
[业务过程] |
||||
|
|
||||
|
########################################## |
||||
|
# 1、输入输出检查 # |
||||
|
########################################## |
||||
|
|
||||
|
|
||||
|
########################################## |
||||
|
# 2、主过程前处理 # |
||||
|
########################################## |
||||
|
|
||||
|
|
||||
|
########################################## |
||||
|
# 3、业务主过程 # |
||||
|
########################################## |
||||
|
|
||||
|
IF 输入.flag = "1" |
||||
|
QUERY |
||||
|
SELECT |
||||
|
vd.*, |
||||
|
material.product_code, |
||||
|
material.a AS AlongSide, |
||||
|
material.b AS BshortSide, |
||||
|
material.h AS Htrapezoidal, |
||||
|
material.w AS Wthickness |
||||
|
FROM |
||||
|
st_ivt_vehicle_detail vd |
||||
|
JOIN md_me_materialbase material ON vd.material_id = material.material_id |
||||
|
WHERE |
||||
|
vd.is_delete = '0' |
||||
|
AND vd.vehicle_type = 输入.vehicle_type |
||||
|
AND vd.vehicle_code = 输入.vehicle_code |
||||
|
ENDSELECT |
||||
|
ENDQUERY |
||||
|
ENDIF |
@ -0,0 +1,162 @@ |
|||||
|
package org.nl.wms.sch.task.call.empty; |
||||
|
|
||||
|
import cn.hutool.core.util.ObjectUtil; |
||||
|
import com.alibaba.fastjson.JSONArray; |
||||
|
import com.alibaba.fastjson.JSONObject; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import org.nl.modules.common.exception.BadRequestException; |
||||
|
import org.nl.modules.wql.WQL; |
||||
|
import org.nl.modules.wql.core.bean.WQLObject; |
||||
|
import org.nl.wms.basedata.eum.VehicleType; |
||||
|
import org.nl.wms.sch.manage.*; |
||||
|
import org.nl.wms.sch.task.util.TaskUtils; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
/** |
||||
|
* @author zhangjiangwei |
||||
|
* @date 2023/04/21 09:15 |
||||
|
*/ |
||||
|
@RequiredArgsConstructor |
||||
|
@Component |
||||
|
public class GTKCallEmptyTask extends AbstractAcsTask { |
||||
|
|
||||
|
@Override |
||||
|
public void updateTaskStatus(JSONObject task, String status) { |
||||
|
if (TaskStatus.EXECUTING.value().equals(status)) { |
||||
|
task.put("task_status", TaskStatus.EXECUTING.value()); |
||||
|
TaskUtils.addACSUpdateColum(task); |
||||
|
WQLObject.getWQLObject("sch_base_task").update(task); |
||||
|
} else if (TaskStatus.FINISHED.value().equals(status)) { |
||||
|
this.finishTask(task, OperationType.AUTO); |
||||
|
} else if (TaskStatus.CANCELLED.value().equals(status)) { |
||||
|
this.cancelTask(task, OperationType.AUTO); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String createTask(JSONObject form) { |
||||
|
JSONObject point = form.getJSONObject("point"); |
||||
|
|
||||
|
JSONObject task = TaskUtils.buildTask( |
||||
|
"钢托库叫空", |
||||
|
TaskType.CALL_EMPTY.value(), |
||||
|
TaskStatus.SURE_END.value(), |
||||
|
null, |
||||
|
point.getString("point_code"), |
||||
|
null, |
||||
|
VehicleType.STEEL_TRAY.value(), |
||||
|
null, |
||||
|
"1", |
||||
|
GTKCallEmptyTask.class.getName(), |
||||
|
form.getString("create_mode"), |
||||
|
form.getString("request_param"), |
||||
|
form.getString("create_id"), |
||||
|
form.getString("create_name") |
||||
|
); |
||||
|
WQLObject.getWQLObject("sch_base_task").insert(task); |
||||
|
|
||||
|
point.put("lock_type", LockType.TASK_LOCKED.value()); |
||||
|
point.put("task_code", task.getString("task_code")); |
||||
|
TaskUtils.addFormUpdateColum(point, form); |
||||
|
WQLObject.getWQLObject("sch_base_point").update(point); |
||||
|
|
||||
|
return task.getString("task_code"); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void findStartPoint() { |
||||
|
WQLObject task_table = WQLObject.getWQLObject("sch_base_task"); |
||||
|
JSONArray tasks = task_table |
||||
|
.query("is_delete = '0' AND task_status = '" + TaskStatus.SURE_END.value() + "' AND handle_class = '" + GTKCallEmptyTask.class.getName() + "'", "priority DESC, create_time ASC") |
||||
|
.getResultJSONArray(0); |
||||
|
|
||||
|
for (int i = 0; i < tasks.size(); i++) { |
||||
|
JSONObject task = tasks.getJSONObject(i); |
||||
|
|
||||
|
JSONObject point = WQL |
||||
|
.getWO("CALL_EMPTY_TASK") |
||||
|
.addParam("flag", "3") |
||||
|
.process() |
||||
|
.uniqueResult(0); |
||||
|
|
||||
|
if (ObjectUtil.isNotEmpty(point)) { |
||||
|
task.put("task_status", TaskStatus.START_AND_END.value()); |
||||
|
task.put("point_code1", point.getString("point_code")); |
||||
|
task.put("vehicle_code", TaskUtils.formatVehicleCode(point.getString("vehicle_code"))); |
||||
|
task.put("remark", ""); |
||||
|
TaskUtils.addAutoUpdateColum(task); |
||||
|
task_table.update(task); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void forceFinish(String task_id) { |
||||
|
JSONObject task = WQLObject.getWQLObject("sch_base_task").query("task_id = " + task_id).uniqueResult(0); |
||||
|
if (ObjectUtil.isEmpty(task)) { |
||||
|
throw new BadRequestException("未找到任务!"); |
||||
|
} |
||||
|
this.finishTask(task, OperationType.MANUAL); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@Override |
||||
|
public void cancel(String task_id) { |
||||
|
JSONObject task = WQLObject.getWQLObject("sch_base_task").query("task_id = " + task_id).uniqueResult(0); |
||||
|
if (ObjectUtil.isEmpty(task)) { |
||||
|
throw new BadRequestException("未找到任务!"); |
||||
|
} |
||||
|
this.cancelTask(task, OperationType.MANUAL); |
||||
|
} |
||||
|
|
||||
|
public void cancelTask(JSONObject task, OperationType operation_type) { |
||||
|
if (task.getIntValue("task_status") < Integer.parseInt(TaskStatus.FINISHED.value())) { |
||||
|
task.put("task_status", TaskStatus.CANCELLED.value()); |
||||
|
if (operation_type == OperationType.AUTO) { |
||||
|
TaskUtils.addACSUpdateColum(task); |
||||
|
} else if (operation_type == OperationType.MANUAL) { |
||||
|
TaskUtils.addCurrentUpdateColum(task); |
||||
|
} |
||||
|
WQLObject.getWQLObject("sch_base_task").update(task); |
||||
|
|
||||
|
WQLObject point_table = WQLObject.getWQLObject("sch_base_point"); |
||||
|
|
||||
|
JSONObject point2 = new JSONObject(); |
||||
|
point2.put("lock_type", LockType.UNLOCKED.value()); |
||||
|
point2.put("task_code", ""); |
||||
|
if (operation_type == OperationType.AUTO) { |
||||
|
TaskUtils.addACSUpdateColum(point2); |
||||
|
} else if (operation_type == OperationType.MANUAL) { |
||||
|
TaskUtils.addCurrentUpdateColum(point2); |
||||
|
} |
||||
|
point_table.update(point2, "point_code = '" + task.getString("point_code2") + "'"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public void finishTask(JSONObject task, OperationType operation_type) { |
||||
|
if (task.getIntValue("task_status") < Integer.parseInt(TaskStatus.FINISHED.value())) { |
||||
|
task.put("task_status", TaskStatus.FINISHED.value()); |
||||
|
if (operation_type == OperationType.AUTO) { |
||||
|
TaskUtils.addACSUpdateColum(task); |
||||
|
} else if (operation_type == OperationType.MANUAL) { |
||||
|
TaskUtils.addCurrentUpdateColum(task); |
||||
|
} |
||||
|
WQLObject.getWQLObject("sch_base_task").update(task); |
||||
|
|
||||
|
WQLObject point_table = WQLObject.getWQLObject("sch_base_point"); |
||||
|
JSONObject point2 = new JSONObject(); |
||||
|
point2.put("lock_type", LockType.UNLOCKED.value()); |
||||
|
point2.put("task_code", ""); |
||||
|
if (operation_type == OperationType.AUTO) { |
||||
|
TaskUtils.addACSUpdateColum(point2); |
||||
|
} else if (operation_type == OperationType.MANUAL) { |
||||
|
TaskUtils.addCurrentUpdateColum(point2); |
||||
|
} |
||||
|
point_table.update(point2, "point_code = '" + task.getString("point_code2") + "'"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void pickUpComplete(JSONObject task) { |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue