工单完成按钮添加

This commit is contained in:
loujf
2022-08-01 21:48:52 +08:00
parent ef3e35c3b5
commit 19875364a8
9 changed files with 181 additions and 46 deletions

View File

@@ -742,12 +742,14 @@ public class AgvServiceImpl implements AgvService {
if ("Load".equals(action)) {
if (lnshStationDeviceDriver.getMode() == 2 && lnshStationDeviceDriver.getMove() > 0) {
inst.setExecute_status("1");
lnshStationDeviceDriver.setFlag(1);
is_feedback = true;
}
//请求放货
} else if ("Unload".equals(action)) {
if (lnshStationDeviceDriver.getMode() == 2 && lnshStationDeviceDriver.getMove() == 0) {
inst.setExecute_status("3");
lnshStationDeviceDriver.setFlag(3);
is_feedback = true;
}
}
@@ -769,23 +771,6 @@ public class AgvServiceImpl implements AgvService {
}
}
}
//晟华码垛机械手
if (addressdevice.getDeviceDriver() instanceof LnshPalletizingManipulatorDeviceDriver) {
lnshPalletizingManipulatorDeviceDriver = (LnshPalletizingManipulatorDeviceDriver) addressdevice.getDeviceDriver();
//请求取货
if ("Load".equals(action)) {
if (lnshPalletizingManipulatorDeviceDriver.getMode() == 2) {
inst.setExecute_status("1");
is_feedback = true;
}
//请求放货
} else if ("Unload".equals(action)) {
if (lnshPalletizingManipulatorDeviceDriver.getMode() == 2) {
inst.setExecute_status("3");
is_feedback = true;
}
}
}
if (addressdevice.getDeviceDriver() instanceof SpecialOrdinarySiteDeviceDriver) {
specialOrdinarySiteDeviceDriver = (SpecialOrdinarySiteDeviceDriver) addressdevice.getDeviceDriver();
//请求取货
@@ -862,6 +847,7 @@ public class AgvServiceImpl implements AgvService {
if (lnshStationDeviceDriver.getMode() == 2 && lnshStationDeviceDriver.getMove() == 0) {
inst.setExecute_device_code(processingVehicle);
inst.setExecute_status("2");
lnshStationDeviceDriver.setFlag(2);
is_feedback = true;
}
//放货完成
@@ -869,6 +855,7 @@ public class AgvServiceImpl implements AgvService {
if (lnshStationDeviceDriver.getMode() == 2 && lnshStationDeviceDriver.getMove() > 0) {
inst.setExecute_device_code(address);
inst.setExecute_status("4");
lnshStationDeviceDriver.setFlag(4);
is_feedback = true;
}
}
@@ -892,25 +879,6 @@ public class AgvServiceImpl implements AgvService {
}
}
}
//晟华码垛机械手
if (addressdevice.getDeviceDriver() instanceof LnshPalletizingManipulatorDeviceDriver) {
lnshPalletizingManipulatorDeviceDriver = (LnshPalletizingManipulatorDeviceDriver) addressdevice.getDeviceDriver();
//取货完成
if ("Load".equals(action)) {
if (lnshPalletizingManipulatorDeviceDriver.getMode() == 2) {
inst.setExecute_device_code(processingVehicle);
inst.setExecute_status("2");
is_feedback = true;
}
//放货完成
} else if ("Unload".equals(action)) {
if (lnshPalletizingManipulatorDeviceDriver.getMode() == 2) {
inst.setExecute_device_code(address);
inst.setExecute_status("4");
is_feedback = true;
}
}
}
if (addressdevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) addressdevice.getDeviceDriver();
//取货完成
@@ -1294,21 +1262,22 @@ public class AgvServiceImpl implements AgvService {
}
@Override
public String requestOpenOrCloseDoor(String device, String param) {
log.info("AGV请求开关门参数设备:{},参数:{}", device, param);
public String requestOpenOrCloseDoor(String device_code, String param) {
log.info("AGV请求开关门参数设备:{},参数:{}", device_code, param);
int type = Integer.parseInt(acsConfigService.findConfigFromCache().get(AcsConfig.BUSINESSTYPE));
switch (type) {
case 4:
acsToWmsService.applyOpenOrCloseDoor(device, param);
acsToWmsService.applyOpenOrCloseDoor(device_code, param);
break;
default:
StandardAutodoorDeviceDriver autodoor;
Device doordevice = deviceAppService.findDeviceByCode(device);
if (ObjectUtil.isEmpty(doordevice)) {
LnshStationDeviceDriver lnshStationDeviceDriver;
Device device = deviceAppService.findDeviceByCode(device_code);
if (ObjectUtil.isEmpty(device)) {
throw new BadRequestException("未找到对应设备");
}
if (doordevice.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) {
autodoor = (StandardAutodoorDeviceDriver) doordevice.getDeviceDriver();
if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) {
autodoor = (StandardAutodoorDeviceDriver) device.getDeviceDriver();
if (StrUtil.equals("open", param)) {
autodoor.OpenOrClose("1");
log.info("下发开门请求");
@@ -1318,6 +1287,17 @@ public class AgvServiceImpl implements AgvService {
log.info("下发关门请求");
}
}
if (device.getDeviceDriver() instanceof LnshStationDeviceDriver) {
lnshStationDeviceDriver = (LnshStationDeviceDriver) device.getDeviceDriver();
if (StrUtil.equals("open", param)) {
lnshStationDeviceDriver.OpenOrClose("1");
log.info("下发进入区域");
} else if (StrUtil.equals("close", param)) {
lnshStationDeviceDriver.OpenOrClose("2");
log.info("下发离开区域");
}
}
break;
}

View File

@@ -664,6 +664,17 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
if (!requireSucess) {
applyEmpty();
}
case 9:
//工单完成
if (!requireSucess && order_No != 0) {
JSONObject json = new JSONObject();
json.put("producetask_code",order_No);
json.put("device_code",this.device_code);
json.put("material_code",material);
json.put("qty",qty);
json.put("type","3");
enterProduction(json);
}
break;
}
@@ -778,7 +789,11 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
if (result.getStatus() == 200) {
this.writing(this.mode);
ProduceshiftorderDto dto = produceshiftorderService.findByCode(String.valueOf(order_No));
dto.setOrder_status("0");
if (this.mode == 4) {
dto.setOrder_status("0");
} else if (this.mode == 9){
dto.setOrder_status("2");
}
produceshiftorderService.update(dto);
}
requireSucess = true;
@@ -870,6 +885,7 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
this.writing(this.mode);
this.writing("to_material_qty",qty);
this.writing("to_material_code",material_code);
this.writing("to_product_code",product_code);
this.writing("to_AlongSide",AlongSide);
this.writing("to_BshortSide",BshortSide);
this.writing("to_Htrapezoidal",Htrapezoidal);

View File

@@ -227,6 +227,17 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
}
break;
}
switch (flag) {
//取货完成
case 2:
writing(2);
return;
//放货完成
case 4:
writing(3);
return;
}
}
last_mode = mode;
@@ -392,12 +403,24 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
}
public void writing(int command) {
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_command;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, command);
ReadUtil.write(itemMap, server);
}
public synchronized void OpenOrClose(String type) {
//进入区域
if ("1".equals(type)) {
writing(5);
} else {
//离开区域
writing(6);
}
}
public String toString() {

View File

@@ -72,4 +72,13 @@ public class ProduceshiftorderController {
public void download(HttpServletResponse response, @RequestParam Map whereJson) throws IOException {
produceshiftorderService.download(produceshiftorderService.queryAll(whereJson), response);
}
@Log("完成工单")
@ApiOperation("完成工单")
@PostMapping(value = "/finish/{id}")
//@PreAuthorize("@el.check('produceshiftorder:list')")
public ResponseEntity<Object> finish(@RequestBody String id) throws IOException {
produceshiftorderService.finish(id);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -70,4 +70,11 @@ public interface ProduceshiftorderService {
* @throws IOException /
*/
void download(List<ProduceshiftorderDto> dtos, HttpServletResponse response) throws IOException;
/**
* 完成工单
*
* @param ids
*/
void finish(String ids);
}

View File

@@ -147,4 +147,11 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
}
FileUtil.downloadExcel(list, response);
}
@Override
public void finish(String ids) {
ProduceshiftorderDto dto = this.findById(ids);
dto.setOrder_status("3");
this.update(dto);
}
}

View File

@@ -24,4 +24,12 @@ export function edit(data) {
})
}
export default { add, edit, del }
export function finish(order_id) {
return request({
url: 'api/produceshiftorder/finish/' + order_id,
method: 'post',
data: order_id
})
}
export default { add, edit, del, finish }

View File

@@ -55,6 +55,53 @@
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="取货点" prop="device_code">
<el-select
v-model="form.get_device_code"
multiple
placeholder="请选择"
>
<el-option
v-for="item in deviceList"
:label="item.device_name"
:value="item.device_code"
/>
</el-select>
</el-form-item>
</el-col>
<el-form-item label="装货点" prop="device_code">
<el-select
v-model="form.load_device_code"
filterable
multiple
placeholder="请选择"
>
<el-option
v-for="item in deviceList"
:key="item.device_code"
:label="item.device_name"
:value="item.device_code"
/>
</el-select>
</el-form-item>
<el-form-item label="放货点" prop="device_code">
<el-select
v-model="form.put_device_code"
filterable
multiple
placeholder="请选择"
>
<el-option
v-for="item in deviceList"
:key="item.device_code"
:label="item.device_name"
:value="item.device_code"
/>
</el-select>
</el-form-item>
</el-row>
</el-form>
</el-card>
@@ -282,6 +329,9 @@ export default {
opc_id: '',
opc_code: '',
configLoading: false,
get_device_code: '',
load_device_code: '',
put_device_code: '',
dataOpcservers: [],
dataOpcPlcs: [],
deviceList: [],

View File

@@ -62,6 +62,18 @@
<!--表格渲染-->
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
<el-table-column type="selection" width="55" />
<el-table-column v-permission="['admin','produceshiftorder:edit','produceshiftorder:del']" fixed="left" label="操作" width="150px" align="center">
<template slot-scope="scope">
<el-dropdown trigger="click" @command="handleCommand">
<span class="el-dropdown-link">
<i class="el-icon-menu" />
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="beforeHandleCommand(scope.$index, scope.row,'a')">完成</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
<el-table-column prop="order_code" label="工单编码" />
<el-table-column prop="device_code" label="设备编码" />
<el-table-column prop="order_status_name" label="工单状态" />
@@ -138,6 +150,29 @@ export default {
[CRUD.HOOK.beforeRefresh]() {
return true
}
},
beforeHandleCommand(index, row, command) {
return {
'index': index,
'row': row,
'command': command
}
},
finish(index, row) {
debugger
crudProduceshiftorder.finish(row.order_id).then(res => {
this.crud.toQuery()
this.crud.notify('完成成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
}).catch(err => {
console.log(err.response.data.message)
})
},
handleCommand(command) {
switch (command.command) {
case 'a':// 完成
this.finish(command.index, command.row)
break
}
}
}
</script>