前端修改 机械手双工位任务完成修改 工单反馈mes修改为系统参数控制

This commit is contained in:
张江玮
2023-01-12 15:27:18 +08:00
parent c6b177e6cd
commit f4711db7b5
7 changed files with 96 additions and 70 deletions

View File

@@ -214,26 +214,26 @@ public class HfGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
if (StrUtil.equals(inst2.getInstruction_status(), "1")) { if (StrUtil.equals(inst2.getInstruction_status(), "1")) {
this.finish_instruction(inst2); this.finish_instruction(inst2);
//获取当前工单数量 //获取当前工单数量
TaskDto taskDto = taskserver.findByCode(inst2.getTask_code()); // TaskDto taskDto = taskserver.findByCode(inst2.getTask_code());
if (ObjectUtil.isNotEmpty(taskDto)) { // if (ObjectUtil.isNotEmpty(taskDto)) {
if (StrUtil.isNotEmpty(taskDto.getExt_task_id())) { // if (StrUtil.isNotEmpty(taskDto.getExt_task_id())) {
String next_device_code = inst2.getNext_device_code(); // String next_device_code = inst2.getNext_device_code();
Device device = appService.findDeviceByCode(next_device_code); // Device device = appService.findDeviceByCode(next_device_code);
HfStationDeviceDriver hfStationDeviceDriver; // HfStationDeviceDriver hfStationDeviceDriver;
String current_num = ""; // String current_num = "";
if (device.getDeviceDriver() instanceof HfStationDeviceDriver) { // if (device.getDeviceDriver() instanceof HfStationDeviceDriver) {
hfStationDeviceDriver = (HfStationDeviceDriver) device.getDeviceDriver(); // hfStationDeviceDriver = (HfStationDeviceDriver) device.getDeviceDriver();
current_num = String.valueOf(hfStationDeviceDriver.getCurrent_order_num()); // current_num = String.valueOf(hfStationDeviceDriver.getCurrent_order_num());
} // }
JSONArray array = new JSONArray(); // JSONArray array = new JSONArray();
JSONObject map = new JSONObject(); // JSONObject map = new JSONObject();
map.put("task_id", taskDto.getExt_task_id()); // map.put("task_id", taskDto.getExt_task_id());
map.put("task_status", "2"); // map.put("task_status", "2");
map.put("material_num", current_num); // map.put("material_num", current_num);
array.add(map); // array.add(map);
acsToWmsService.feedbackTaskStatusToWms(array); // acsToWmsService.feedbackTaskStatusToWms(array);
} // }
} // }
logServer.deviceInfo("反馈电气信号", this.getDevice_code(), "机械手任务完成,开始反馈电气信号"); logServer.deviceInfo("反馈电气信号", this.getDevice_code(), "机械手任务完成,开始反馈电气信号");
this.writing("to_onset", "0"); this.writing("to_onset", "0");
this.writing("to_target", "0"); this.writing("to_target", "0");

View File

@@ -206,18 +206,18 @@ public class HfTwoRGVDeviceDriver extends AbstractOpcDeviceDriver implements Dev
if (inst1 != null) { if (inst1 != null) {
if (StrUtil.equals(inst1.getInstruction_status(), "1")) { if (StrUtil.equals(inst1.getInstruction_status(), "1")) {
finish_instruction(inst1); finish_instruction(inst1);
JSONArray array = new JSONArray(); // JSONArray array = new JSONArray();
TaskDto taskDto = taskserver.findByCode(inst1.getTask_code()); // TaskDto taskDto = taskserver.findByCode(inst1.getTask_code());
if (ObjectUtil.isNotEmpty(taskDto)) { // if (ObjectUtil.isNotEmpty(taskDto)) {
if (StrUtil.isNotEmpty(taskDto.getExt_task_id())) { // if (StrUtil.isNotEmpty(taskDto.getExt_task_id())) {
JSONObject map = new JSONObject(); // JSONObject map = new JSONObject();
map.put("task_id", taskDto.getExt_task_id()); // map.put("task_id", taskDto.getExt_task_id());
map.put("task_status", "2"); // map.put("task_status", "2");
map.put("finished_type", "1"); // map.put("finished_type", "1");
array.add(map); // array.add(map);
acsToWmsService.feedbackTaskStatusToWms(array); // acsToWmsService.feedbackTaskStatusToWms(array);
} // }
} // }
logServer.deviceInfo("反馈电气信号", this.getDevice_code(), "RGV前工位任务完成,开始反馈电气信号"); logServer.deviceInfo("反馈电气信号", this.getDevice_code(), "RGV前工位任务完成,开始反馈电气信号");
this.writing("to_command1", "0"); this.writing("to_command1", "0");
this.writing("to_onset1", "0"); this.writing("to_onset1", "0");
@@ -249,18 +249,18 @@ public class HfTwoRGVDeviceDriver extends AbstractOpcDeviceDriver implements Dev
if (inst2 != null) { if (inst2 != null) {
if (StrUtil.equals(inst2.getInstruction_status(), "1")) { if (StrUtil.equals(inst2.getInstruction_status(), "1")) {
finish_instruction(inst2); finish_instruction(inst2);
JSONArray array = new JSONArray(); // JSONArray array = new JSONArray();
TaskDto taskDto = taskserver.findByCode(inst2.getTask_code()); // TaskDto taskDto = taskserver.findByCode(inst2.getTask_code());
if (ObjectUtil.isNotEmpty(taskDto)) { // if (ObjectUtil.isNotEmpty(taskDto)) {
if (StrUtil.isNotEmpty(taskDto.getExt_task_id())) { // if (StrUtil.isNotEmpty(taskDto.getExt_task_id())) {
JSONObject map = new JSONObject(); // JSONObject map = new JSONObject();
map.put("task_id", taskDto.getExt_task_id()); // map.put("task_id", taskDto.getExt_task_id());
map.put("task_status", "2"); // map.put("task_status", "2");
map.put("finished_type", "1"); // map.put("finished_type", "1");
array.add(map); // array.add(map);
acsToWmsService.feedbackTaskStatusToWms(array); // acsToWmsService.feedbackTaskStatusToWms(array);
} // }
} // }
logServer.deviceInfo("反馈电气信号", this.getDevice_code(), "RGV后工位任务完成,开始反馈电气信号"); logServer.deviceInfo("反馈电气信号", this.getDevice_code(), "RGV后工位任务完成,开始反馈电气信号");
this.writing("to_command2", "0"); this.writing("to_command2", "0");
this.writing("to_onset2", "0"); this.writing("to_onset2", "0");

View File

@@ -12,6 +12,7 @@ import lombok.extern.slf4j.Slf4j;
import org.nl.modules.common.exception.BadRequestException; import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.common.utils.RedisUtils; import org.nl.modules.common.utils.RedisUtils;
import org.nl.modules.system.service.ParamService; import org.nl.modules.system.service.ParamService;
import org.nl.modules.system.service.dto.ParamDto;
import org.nl.modules.wql.core.bean.WQLObject; import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.SpringContextHolder; import org.nl.modules.wql.util.SpringContextHolder;
import org.nl.wms.basedata.service.MaterialbaseService; import org.nl.wms.basedata.service.MaterialbaseService;
@@ -169,16 +170,19 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
message = "操作成功!"; message = "操作成功!";
// 操作成功后向 MES 反馈 // 操作成功后向 MES 反馈
// JSONObject param = new JSONObject(); ParamDto has_mes = paramService.findByCode("has_mes");
// param.put("material_code", materialbaseService.findById(jsonObject1.getLong("material_id")).getMaterial_code()); if (ObjectUtil.isNotEmpty(has_mes) && StrUtil.equals(has_mes.getValue(), "1")) {
// param.put("workorder_code", jsonObject1.getString("workorder_code")); JSONObject param = new JSONObject();
// param.put("workorder_qty", jsonObject1.getString("plan_qty")); param.put("material_code", materialbaseService.findById(jsonObject1.getLong("material_id")).getMaterial_code());
// param.put("device_code", deviceService.findByCode(jsonObject1.getString("device_code")).getExtend_code()); param.put("workorder_code", jsonObject1.getString("workorder_code"));
// String workorder_uri = paramService.findByCode("mes_url").getValue() + "api/mes/materialIvt"; param.put("workorder_qty", jsonObject1.getString("plan_qty"));
// HttpRequest param.put("device_code", deviceService.findByCode(jsonObject1.getString("device_code")).getExtend_code());
// .post(workorder_uri) String workorder_uri = paramService.findByCode("mes_url").getValue() + "api/mes/materialIvt";
// .body(param.toJSONString()) HttpRequest
// .execute(); .post(workorder_uri)
.body(param.toJSONString())
.execute();
}
} catch (Exception e) { } catch (Exception e) {
status = "400"; status = "400";
message = "操作失败!"; message = "操作失败!";

View File

@@ -19,6 +19,7 @@ import org.nl.modules.common.utils.SecurityUtils;
import org.nl.modules.common.utils.dto.CurrentUser; import org.nl.modules.common.utils.dto.CurrentUser;
import org.nl.modules.system.service.ParamService; import org.nl.modules.system.service.ParamService;
import org.nl.modules.system.service.dto.ParamDto;
import org.nl.modules.system.util.CodeUtil; import org.nl.modules.system.util.CodeUtil;
import org.nl.modules.wql.WQL; import org.nl.modules.wql.WQL;
@@ -28,6 +29,7 @@ import org.nl.wms.basedata.service.ClassstandardService;
import org.nl.wms.basedata.service.MaterialbaseService; import org.nl.wms.basedata.service.MaterialbaseService;
import org.nl.wms.basedata.service.dto.MaterialbaseDto; import org.nl.wms.basedata.service.dto.MaterialbaseDto;
import org.nl.wms.ext.acs.service.WmsToAcsService; import org.nl.wms.ext.acs.service.WmsToAcsService;
import org.nl.wms.pdm.service.DeviceService;
import org.nl.wms.pdm.service.WorkordeService; import org.nl.wms.pdm.service.WorkordeService;
import org.nl.wms.pdm.service.dto.WorkorderDto; import org.nl.wms.pdm.service.dto.WorkorderDto;
@@ -53,6 +55,7 @@ public class WorkorderServiceImpl implements WorkordeService {
private final WmsToAcsService wmsToAcsService; private final WmsToAcsService wmsToAcsService;
private final MaterialbaseService materialbaseService; private final MaterialbaseService materialbaseService;
private final ParamService paramService; private final ParamService paramService;
private final DeviceService deviceService;
@Override @Override
public Map<String, Object> queryAll(Map whereJson, Pageable page) { public Map<String, Object> queryAll(Map whereJson, Pageable page) {
@@ -422,7 +425,7 @@ public class WorkorderServiceImpl implements WorkordeService {
array.add(map); array.add(map);
Map<String, Object> resp = wmsToAcsService.orderStatusUpdate(array); Map<String, Object> resp = wmsToAcsService.orderStatusUpdate(array);
if (StrUtil.equals(String.valueOf(resp.get("status")), "200")) { if (StrUtil.equals(String.valueOf(resp.get("status")), "200")) {
JSONObject produceorderMap = new JSONObject(); JSONObject produceorderMap = JSONObject.parseObject(JSONObject.toJSONString(this.findById(Long.valueOf(workorder_id))));
produceorderMap.put("workorder_id", workorder_id); produceorderMap.put("workorder_id", workorder_id);
produceorderMap.put("order_status", "5"); produceorderMap.put("order_status", "5");
produceorderMap.put("update_optid", currentUserId); produceorderMap.put("update_optid", currentUserId);
@@ -430,6 +433,21 @@ public class WorkorderServiceImpl implements WorkordeService {
produceorderMap.put("update_time", now); produceorderMap.put("update_time", now);
produceorderMap.put("realproduceend_date", now); produceorderMap.put("realproduceend_date", now);
wo.update(produceorderMap); wo.update(produceorderMap);
// 操作成功后向 MES 反馈
ParamDto has_mes = paramService.findByCode("has_mes");
if (ObjectUtil.isNotEmpty(has_mes) && StrUtil.equals(has_mes.getValue(), "1")) {
JSONObject mes_param = new JSONObject();
mes_param.put("material_code", materialbaseService.findById(produceorderMap.getLong("material_id")).getMaterial_code());
mes_param.put("workorder_code", produceorderMap.getString("workorder_code"));
mes_param.put("workorder_qty", produceorderMap.getString("plan_qty"));
mes_param.put("device_code", deviceService.findByCode(produceorderMap.getString("device_code")).getExtend_code());
String workorder_uri = paramService.findByCode("mes_url").getValue() + "api/mes/materialIvt";
HttpRequest
.post(workorder_uri)
.body(mes_param.toJSONString())
.execute();
}
} }
} }

View File

@@ -9,6 +9,7 @@ import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.nl.modules.common.exception.BadRequestException; import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.common.utils.RedisUtils;
import org.nl.modules.common.utils.SecurityUtils; import org.nl.modules.common.utils.SecurityUtils;
import org.nl.modules.system.util.CodeUtil; import org.nl.modules.system.util.CodeUtil;
import org.nl.modules.wql.WQL; import org.nl.modules.wql.WQL;
@@ -88,6 +89,11 @@ public class YljCallMaterialTask extends AbstractAcsTask {
return; return;
} }
String vehicle_code = taskObj.getString("vehicle_code");
RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class);
redisUtils.del(vehicle_code);
redisUtils.del(vehicle_code + "-ivt_qty");
// 更改任务状态为完成 // 更改任务状态为完成
taskObj.put("task_status", TaskStatusEnum.FINISHED.getCode()); taskObj.put("task_status", TaskStatusEnum.FINISHED.getCode());
taskObj.put("update_optname", "acs"); taskObj.put("update_optname", "acs");

View File

@@ -353,7 +353,6 @@
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期" end-placeholder="结束日期"
:default-value="default_date_show" :default-value="default_date_show"
:picker-options="disabled_time"
/> />
</el-form-item> </el-form-item>
</el-form> </el-form>
@@ -453,11 +452,6 @@ export default {
show_sync_dialog: false, show_sync_dialog: false,
sync_time: '', sync_time: '',
default_date_show: '', default_date_show: '',
disabled_time: {
disabledDate(time) {
return time.getTime() > Date.now() // 可选历史天、可选当前天、不可选未来天
}
},
rules: { rules: {
// produceorder_code: [ // produceorder_code: [
// { required: true, message: '生产班次工单编号不能为空', trigger: 'blur' } // { required: true, message: '生产班次工单编号不能为空', trigger: 'blur' }

View File

@@ -32,12 +32,13 @@
> >
<el-option <el-option
v-for="item in region_code_list" v-for="item in region_code_list"
:key="item.region_id"
:label="item.region_name" :label="item.region_name"
:value="item.region_code" :value="item.region_code"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="载具类型"> <el-form-item v-if="false" label="载具类型">
<el-select <el-select
v-model="query.vehicle_type" v-model="query.vehicle_type"
clearable clearable
@@ -49,12 +50,13 @@
> >
<el-option <el-option
v-for="item in dict.vehicle_type" v-for="item in dict.vehicle_type"
:key="item.id"
:label="item.label" :label="item.label"
:value="item.value" :value="item.value"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="入库时间"> <el-form-item v-if="false" label="入库时间">
<el-date-picker <el-date-picker
v-model="query.createTime" v-model="query.createTime"
type="daterange" type="daterange"
@@ -65,7 +67,7 @@
@change="crud.toQuery" @change="crud.toQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="锁定类型"> <el-form-item v-if="false" label="锁定类型">
<el-select <el-select
v-model="query.lock_type" v-model="query.lock_type"
clearable clearable
@@ -77,6 +79,7 @@
> >
<el-option <el-option
v-for="item in dict.d_lock_type" v-for="item in dict.d_lock_type"
:key="item.id"
:label="item.label" :label="item.label"
:value="item.value" :value="item.value"
/> />
@@ -141,6 +144,7 @@
> >
<el-option <el-option
v-for="item in dict.vehicle_type" v-for="item in dict.vehicle_type"
:key="item.id"
:label="item.label" :label="item.label"
:value="item.value" :value="item.value"
/> />
@@ -157,6 +161,7 @@
> >
<el-option <el-option
v-for="item in vehicleList" v-for="item in vehicleList"
:key="item.vehicle_id"
:label="item.vehicle_code" :label="item.vehicle_code"
:value="item.vehicle_code" :value="item.vehicle_code"
/> />
@@ -208,14 +213,14 @@
<el-table-column prop="material_code" label="物料编号" /> <el-table-column prop="material_code" label="物料编号" />
<el-table-column prop="material_name" label="物料名称" /> <el-table-column prop="material_name" label="物料名称" />
<!-- <el-table-column prop="pcsn" label="批次" />--> <!-- <el-table-column prop="pcsn" label="批次" />-->
<el-table-column prop="ivt_qty" label="库存数" :formatter="crud.formatNum3" /> <el-table-column v-if="false" prop="ivt_qty" label="库存数" :formatter="crud.formatNum3" />
<el-table-column prop="instorage_time" label="出入库时间" min-width="150" show-overflow-tooltip /> <el-table-column v-if="false" prop="instorage_time" label="出入库时间" min-width="150" show-overflow-tooltip />
<el-table-column prop="lock_type" label="锁定类型"> <el-table-column v-if="false" prop="lock_type" label="锁定类型">
<template slot-scope="scope"> <template slot-scope="scope">
{{ dict.label.d_lock_type[scope.row.lock_type] }} {{ dict.label.d_lock_type[scope.row.lock_type] }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="is_used" label="是否启用"> <el-table-column v-if="false" prop="is_used" label="是否启用">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.is_used == '1' ? '是' : '否' }} {{ scope.row.is_used == '1' ? '是' : '否' }}
</template> </template>
@@ -234,7 +239,6 @@ import crudStructivt from '../structivt'
import CRUD, { crud, form, header, presenter } from '@crud/crud' import CRUD, { crud, form, header, presenter } from '@crud/crud'
import rrOperation from '@crud/RR.operation' import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation' import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination' import pagination from '@crud/Pagination'
import crudPoint from '@/api/wms/sch/point' import crudPoint from '@/api/wms/sch/point'
import MaterDtl from '@/views/wms/pub/MaterDialog' import MaterDtl from '@/views/wms/pub/MaterDialog'
@@ -270,7 +274,7 @@ const defaultForm = {
} }
export default { export default {
name: 'Inventory', name: 'Inventory',
components: { pagination, crudOperation, rrOperation, udOperation, MaterDtl }, components: { pagination, crudOperation, rrOperation, MaterDtl },
dicts: ['sch_point_status', 'vehicle_type', 'is_used', 'd_lock_type'], dicts: ['sch_point_status', 'vehicle_type', 'is_used', 'd_lock_type'],
mixins: [presenter(), header(), form(defaultForm), crud()], mixins: [presenter(), header(), form(defaultForm), crud()],
cruds() { cruds() {