add:新增手动下发充电任务
This commit is contained in:
@@ -86,4 +86,6 @@ public interface NDCAgvService {
|
||||
public boolean createChargingTaskToNDC(String carno);
|
||||
|
||||
public void charge(String carno);
|
||||
|
||||
public void charge(String carno,String station);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.opc.DeviceAppServiceImpl;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.system.service.dict.ISysDictService;
|
||||
import org.nl.system.service.dict.dao.Dict;
|
||||
import org.nl.system.service.param.ISysParamService;
|
||||
@@ -585,4 +586,59 @@ public class NDCAgvServiceImpl implements NDCAgvService {
|
||||
return AGVDeviceStatus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void charge(String carno, String station) {
|
||||
//判断当前充电桩是否已下发充电任务
|
||||
Dict temp = dictService.getDictByName2("station", station);
|
||||
if (ObjectUtil.isNotEmpty(temp)) {
|
||||
int satation = 0;
|
||||
if(ObjectUtil.isNotEmpty(temp)){
|
||||
satation = Integer.parseInt(temp.getPara1());
|
||||
}
|
||||
String instcode =CodeUtil.getNewCode("INSTRUCT_NO");
|
||||
byte ikeyhigh = (byte) IntToHexHigh(Integer.parseInt(instcode));
|
||||
byte ikeylow = (byte) IntToHexLow(Integer.parseInt(instcode));
|
||||
byte carhigh = (byte) IntToHexHigh(Integer.parseInt(carno));
|
||||
byte carlow = (byte) IntToHexLow(Integer.parseInt(carno));
|
||||
byte satationhigh = (byte) IntToHexHigh(satation);
|
||||
byte satationlow = (byte) IntToHexLow(satation);
|
||||
String str = "十进制下发:";
|
||||
String str1 = "十六进制下发:";
|
||||
str += "ikey:" + (Integer.parseInt(instcode));
|
||||
str1 += "ikey:" + hexToString(ikeyhigh & 0xFF) + hexToString(ikeylow & 0xFF);
|
||||
str += "carno:" + (Integer.parseInt(carno));
|
||||
str1 += "carno:" + hexToString(carhigh & 0xFF) + hexToString(carlow & 0xFF);
|
||||
str += "/satation:" + (satation);
|
||||
str1 += "/satation:" + hexToString(satationhigh & 0xFF) + hexToString(satationlow & 0xFF);
|
||||
//todo 核对NDC协议
|
||||
byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD,
|
||||
(byte) 0X00, (byte) 0X08,
|
||||
(byte) 0X00, (byte) 0X0E,
|
||||
(byte) 0X00, (byte) 0X01,
|
||||
(byte) 0X00, (byte) 0X71,
|
||||
(byte) 0X00, (byte) 0X0A,
|
||||
(byte) 0X64, (byte) 0X80,
|
||||
(byte) 0X00, (byte) 0X01,
|
||||
(byte) ikeyhigh, (byte) ikeylow,
|
||||
(byte) carhigh, (byte) carlow,
|
||||
(byte) satationhigh, (byte) satationlow
|
||||
|
||||
};
|
||||
log.info("下发AGV充电任务--{}", str1);
|
||||
|
||||
try{
|
||||
OneNDCSocketConnectionAutoRun.write(b);
|
||||
temp.setValue("1");
|
||||
temp.setPara2(String.valueOf(carno));
|
||||
dictService.updateDetail(temp);
|
||||
} catch (Exception e){
|
||||
log.error("下发充电任务失败{}{}",e,e.getMessage());
|
||||
}
|
||||
|
||||
} else {
|
||||
log.info("当前充电桩{}已被使用!请检查充电桩状态再操作!", station);
|
||||
throw new BadRequestException("当前充电桩已被使用或者车号不为空,请检查充电桩状态再操作!");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@ import org.nl.acs.instruction.service.impl.InstructionServiceImpl;
|
||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.config.lucene.service.LuceneExecuteLogService;
|
||||
import org.nl.system.service.dict.ISysDictService;
|
||||
import org.nl.system.service.dict.dao.Dict;
|
||||
import org.nl.system.service.param.ISysParamService;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.nl.system.service.param.impl.SysParamServiceImpl;
|
||||
@@ -62,6 +64,8 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
AutoRunService autoRunService;
|
||||
@Autowired
|
||||
LuceneExecuteLogService luceneExecuteLogService;
|
||||
@Autowired
|
||||
ISysDictService dictService;
|
||||
|
||||
|
||||
public OneNDCSocketConnectionAutoRun() {
|
||||
@@ -133,6 +137,8 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
int agvaddr = arr[18] * 256 + arr[19];
|
||||
//车号
|
||||
int carno = arr[20];
|
||||
//充电桩站点号
|
||||
int station = arr[25];
|
||||
Instruction link_inst = null;
|
||||
Instruction inst = null;
|
||||
List<Instruction> insts = null;
|
||||
@@ -196,6 +202,28 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
}
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
|
||||
|
||||
}else if (phase == 0x64){
|
||||
log.info("AGV车号{}反馈充电任务下发成功,锁定充电桩{}",agvaddr,station);
|
||||
Dict dict = dictService.getDictByName3("station",String.valueOf(agvaddr),null);
|
||||
if (ObjectUtil.isNotEmpty(dict)){
|
||||
dict.setValue("1");
|
||||
dict.setPara2(String.valueOf(agvaddr));
|
||||
dict.setPara3("下发成功");
|
||||
dictService.updateDetail(dict);
|
||||
}
|
||||
//充电成功
|
||||
}else if (phase == 0x65){
|
||||
log.info("AGV车号{}反馈充电中,充电桩{}",agvaddr,station);
|
||||
//充电取消上报
|
||||
}else if (phase == 0x66){
|
||||
log.info("AGV车号{}反馈充电任务已取消,释放充电桩{}",agvaddr,station);
|
||||
Dict dict = dictService.getDictByName3("station",String.valueOf(agvaddr),null);
|
||||
if (ObjectUtil.isNotEmpty(dict)){
|
||||
dict.setValue("0");
|
||||
dict.setPara2("");
|
||||
dict.setPara3("充电桩空闲");
|
||||
dictService.updateDetail(dict);
|
||||
}
|
||||
} else {
|
||||
//上报异常信息
|
||||
//(不需要WCS反馈)
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.nl.acs.device.rest;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device.service.dto.DeviceDto;
|
||||
@@ -55,6 +56,14 @@ public class DeviceController {
|
||||
deviceService.downDeviceDBloadCSV(deviceService.queryDeviceProtocol(whereJson), response);
|
||||
}
|
||||
|
||||
@GetMapping("/selectCarList")
|
||||
@Log("下拉选车号")
|
||||
@ApiOperation("下拉选车号")
|
||||
//@PreAuthorize("@el.check('routePlan:list')")
|
||||
public ResponseEntity<Object> selectCarList() {
|
||||
return new ResponseEntity<>(deviceService.selectCarList(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增设备")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody DeviceDto dto) {
|
||||
|
||||
@@ -383,4 +383,6 @@ public interface DeviceService extends CommonService<Device> {
|
||||
* @return
|
||||
*/
|
||||
JSONArray selectDriverCodeList(String device_code);
|
||||
|
||||
JSONArray selectCarList();
|
||||
}
|
||||
|
||||
@@ -1989,4 +1989,18 @@ public class DeviceServiceImpl extends CommonServiceImpl<DeviceMapper, Device> i
|
||||
ja = JSONArray.parseArray(JSON.toJSONString(uniqueDriverSet));
|
||||
return ja;
|
||||
}
|
||||
|
||||
public JSONArray selectCarList() {
|
||||
List<Device> deviceList = new LambdaQueryChainWrapper<>(deviceMapper).apply("device_type = 'agv' AND is_delete= '0' AND is_active= '1' AND is_config = 'true'").orderByAsc(Device::getDevice_code).list();
|
||||
JSONArray arr = JSONArray.parseArray(JSON.toJSONString(deviceList));
|
||||
JSONArray result = new JSONArray();
|
||||
for (int i = 0; i < arr.size(); i++) {
|
||||
JSONObject obj = arr.getJSONObject(i);
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("device_code", obj.getString("device_code"));
|
||||
json.put("device_name", obj.getString("device_name"));
|
||||
result.add(json);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.nl.system.controller.dict;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
@@ -58,6 +59,14 @@ public class SysDictController {
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@Log("查询充电桩")
|
||||
@PutMapping( "/{car}")
|
||||
@ApiOperation("查询充电桩")
|
||||
// @SaCheckPermission("dict:list")
|
||||
public ResponseEntity<Object> selectStationByCar(@PathVariable String car){
|
||||
return new ResponseEntity<>(dictService.selectStationByCar(car), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改字典")
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@ package org.nl.system.controller.param;
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
@@ -87,6 +89,15 @@ class SysParamController {
|
||||
paramService.setParam(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/sendTask")
|
||||
@Log("下发充电任务")
|
||||
@ApiOperation("下发充电任务")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> sendTask(@RequestBody JSONObject json) {
|
||||
paramService.sendTask(json);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.system.service.dict;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
@@ -103,4 +104,8 @@ public interface ISysDictService extends IService<Dict> {
|
||||
* @return
|
||||
*/
|
||||
Dict getDictByName3(String name,String carno,String station);
|
||||
|
||||
Dict getDictByName2(String name,String station);
|
||||
|
||||
JSONArray selectStationByCar(String car);
|
||||
}
|
||||
|
||||
@@ -3,12 +3,17 @@ package org.nl.system.service.dict.impl;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
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 com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.ibatis.annotations.Lang;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
import org.nl.acs.device.service.mapper.DeviceMapper;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
@@ -37,6 +42,8 @@ import java.util.Set;
|
||||
public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, Dict> implements ISysDictService {
|
||||
@Autowired
|
||||
private SysDictMapper sysDictMapper;
|
||||
@Autowired
|
||||
private DeviceMapper deviceMapper;
|
||||
|
||||
@Override
|
||||
public IPage<Dict> queryAll(Map whereJson, PageQuery page) {
|
||||
@@ -197,14 +204,6 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, Dict> impleme
|
||||
sysDictMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Dict> queryAll() {
|
||||
return sysDictMapper.selectList(new QueryWrapper<Dict>()
|
||||
.select("MAX(dict_id) AS dictId, code, name")
|
||||
.lambda()
|
||||
.groupBy(Dict::getCode, Dict::getName));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void initDict(Dict dto) {
|
||||
@@ -223,6 +222,24 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, Dict> impleme
|
||||
sysDictMapper.updateById(dict);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray selectStationByCar(String car) {
|
||||
Device device = deviceMapper.selectOne(new QueryWrapper<Device>().eq("device_code", car));
|
||||
String manufacturer = device.getManufacturer();//车间
|
||||
List<Dict> stations = sysDictMapper.selectList(new LambdaQueryWrapper<Dict>().eq(Dict::getDict_type, manufacturer));
|
||||
JSONArray arr = JSONArray.parseArray(JSON.toJSONString(stations));
|
||||
JSONArray result = new JSONArray();
|
||||
for (int i = 0; i < arr.size(); i++) {
|
||||
JSONObject obj = arr.getJSONObject(i);
|
||||
JSONObject json = new JSONObject();
|
||||
String value = obj.getString("value");
|
||||
json.put("label", obj.getString("label") + ("1".equals(obj.getString("value")) ? "(已使用)" : "(未使用)"));
|
||||
json.put("para1", obj.getString("para1"));
|
||||
result.add(json);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dict getDictByName2(String name) {
|
||||
Dict dict = null;
|
||||
@@ -240,6 +257,32 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, Dict> impleme
|
||||
return dict;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dict getDictByName2(String name, String station) {
|
||||
Dict dict = null;
|
||||
Dict dict1 = sysDictMapper.selectOne(
|
||||
new LambdaQueryWrapper<Dict>()
|
||||
.eq(Dict::getCode, name)
|
||||
.eq(ObjectUtil.isNotEmpty(station), Dict::getPara1, station)
|
||||
.eq(Dict::getValue, "0")
|
||||
.and(slam -> slam.isNull(Dict::getPara2)
|
||||
.or()
|
||||
.eq(Dict::getPara2, ""))
|
||||
);
|
||||
if (ObjectUtil.isNotEmpty(dict1)) {
|
||||
dict = dict1;
|
||||
}
|
||||
return dict;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Dict> queryAll() {
|
||||
return sysDictMapper.selectList(new QueryWrapper<Dict>()
|
||||
.select("MAX(dict_id) AS dictId, code, name")
|
||||
.lambda()
|
||||
.groupBy(Dict::getCode, Dict::getName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dict getDictByName3(String name,String carno,String station) {
|
||||
Dict dict = null;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.system.service.param;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
@@ -61,4 +62,6 @@ public interface ISysParamService extends IService<Param> {
|
||||
Map<String, Object> queryParam();
|
||||
|
||||
void setParam(Map whereJson);
|
||||
|
||||
void sendTask(JSONObject json);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ package org.nl.system.service.param.impl;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
@@ -10,6 +12,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.AcsConfig;
|
||||
import org.nl.acs.agv.server.NDCAgvService;
|
||||
import org.nl.acs.task.domain.Task;
|
||||
import org.nl.acs.utils.PageUtil;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
@@ -17,10 +20,13 @@ import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.config.MapOf;
|
||||
import org.nl.config.language.LangProcess;
|
||||
import org.nl.system.service.dict.ISysDictService;
|
||||
import org.nl.system.service.dict.dao.Dict;
|
||||
import org.nl.system.service.param.ISysParamService;
|
||||
import org.nl.system.service.param.dao.Param;
|
||||
import org.nl.system.service.param.dao.mapper.SysParamMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -43,6 +49,11 @@ public class SysParamServiceImpl extends ServiceImpl<SysParamMapper, Param> impl
|
||||
|
||||
@Autowired
|
||||
private SysParamMapper paramMapper;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private NDCAgvService ndcAgvService;
|
||||
@Autowired
|
||||
private ISysDictService dictService;
|
||||
|
||||
@Override
|
||||
public IPage<Param> queryPage(Map whereJson, Pageable page) {
|
||||
@@ -170,4 +181,23 @@ public class SysParamServiceImpl extends ServiceImpl<SysParamMapper, Param> impl
|
||||
paramMapper.updateById(param_electric_end);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendTask(JSONObject json) {
|
||||
String carno = json.getString("carno");
|
||||
String station = json.getString("station");
|
||||
if (StrUtil.isEmpty(carno)){
|
||||
throw new BadRequestException("车辆编号不能为空");
|
||||
}
|
||||
if (StrUtil.isEmpty(station)){
|
||||
throw new BadRequestException("充电站编号不能为空");
|
||||
}
|
||||
//判断是否已下发充电任务
|
||||
Dict dict1 = dictService.getDictByName3("station",carno,null);
|
||||
if(ObjectUtil.isNotEmpty(dict1)){
|
||||
log.info("当前车辆{}已分配充电桩{},退出后续判断",carno,dict1.getPara1());
|
||||
}else {
|
||||
ndcAgvService.charge(carno, station);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,6 +164,13 @@ export function selectListByType() {
|
||||
})
|
||||
}
|
||||
|
||||
export function selectCarList() {
|
||||
return request({
|
||||
url: 'api/device/selectCarList',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, selectDeviceList, selectDeviceListByRegion, callAgv, responseAgv, selectDeviceDevicerInfo, autoCreateTask,
|
||||
changeDeviceStatus, cleanTask, queryStorageExtra, selectConDeviceList, saveBarcode, selectDeviceListOne, selectDeviceListTwo, selectDeviceListThree,
|
||||
addMaterial, cleanMaterial, reload, excelImport, selectListByType }
|
||||
addMaterial, cleanMaterial, reload, excelImport, selectListByType, selectCarList }
|
||||
|
||||
@@ -31,4 +31,11 @@ export function edit(data) {
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del }
|
||||
export function selectStationByCar(car) {
|
||||
return request({
|
||||
url: 'api/dict/' + car,
|
||||
method: 'put'
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, selectStationByCar }
|
||||
|
||||
@@ -124,7 +124,6 @@ export default {
|
||||
get(this.device_code).then(data => {
|
||||
this.form = data.device
|
||||
// 默认是普通站点
|
||||
// this.currentComponent = 'standard_ordinary_site'
|
||||
if (data.device.driver_code) {
|
||||
this.currentComponent = data.device.driver_code
|
||||
}
|
||||
|
||||
@@ -145,9 +145,21 @@
|
||||
<el-form-item :label="$t('device.device_table_title.sequence_number')" prop="seq_num">
|
||||
<el-input-number v-model="form.seq_num" value="1" :min="1" label="描述文字" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="生产厂家">-->
|
||||
<!-- <el-input v-model="form.manufacturer" style="width: 370px;" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<el-form-item label="所属车间" prop="manufacturer">
|
||||
<el-select
|
||||
v-model="form.manufacturer"
|
||||
size="mini"
|
||||
placeholder="位置"
|
||||
class="filter-item"
|
||||
style="width: 370px;"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.area"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="厂家电话">-->
|
||||
<!-- <el-input v-model="form.manufacturer_phone" style="width: 370px;" />-->
|
||||
<!-- </el-form-item>-->
|
||||
@@ -192,7 +204,7 @@
|
||||
<span v-else>否</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column prop="manufacturer" label="生产厂家" />-->
|
||||
<el-table-column prop="manufacturer" label="所属车间" />
|
||||
<!-- <el-table-column prop="manufacturer_phone" label="厂家电话" />-->
|
||||
<el-table-column prop="remark" :label="$t('device.device_table_title.descriptive_information')" :min-width="flexWidth('remark',crud.data,$t('device.device_table_title.descriptive_information'))" />
|
||||
<el-table-column v-permission="['admin','device:edit','device:del']" :label="$t('auto.common.Operate')" width="200px" align="center">
|
||||
@@ -253,6 +265,7 @@ const defaultForm = {
|
||||
export default {
|
||||
name: 'Device',
|
||||
components: { pagination, crudOperation, rrOperation, udOperation, UploadDialog },
|
||||
dicts: ['area'],
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
|
||||
@@ -73,6 +73,21 @@
|
||||
<el-form-item :label="$t('dict.other.Parameter3')" prop="para3">
|
||||
<el-input v-model="form.para3" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="所属车间" prop="dict_type">
|
||||
<el-select
|
||||
v-model="form.dict_type"
|
||||
size="mini"
|
||||
placeholder="位置"
|
||||
class="filter-item"
|
||||
style="width: 370px;"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.area"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="text" @click="crud.cancelCU">{{ $t('task.select.Cancel') }}</el-button>
|
||||
@@ -97,6 +112,7 @@
|
||||
<el-table-column prop="para1" :label="$t('dict.other.Parameter1')" align="center" :min-width="flexWidth('para1',crud.data,$t('dict.other.Parameter1'))" />
|
||||
<el-table-column prop="para2" :label="$t('dict.other.Parameter2')" align="center" :min-width="flexWidth('para2',crud.data,$t('dict.other.Parameter2'))" />
|
||||
<el-table-column prop="para3" :label="$t('dict.other.Parameter3')" align="center" :min-width="flexWidth('para3',crud.data,$t('dict.other.Parameter3'))" />
|
||||
<el-table-column prop="dict_type" label="所属车间" align="center" width="65" />
|
||||
<el-table-column
|
||||
v-permission="['admin','dict:edit','dict:del']"
|
||||
:label="$t('dict.table_value.Operate')"
|
||||
@@ -126,12 +142,13 @@ import rrOperation from '@crud/RR.operation'
|
||||
import udOperation from '@crud/UD.operation'
|
||||
import i18n from '@/i18n'
|
||||
|
||||
const defaultForm = { dict_id: null, name: null, label: null, value: null, dict_sort: null, dictType: null, para1: null,
|
||||
const defaultForm = { dict_id: null, name: null, label: null, value: null, dict_sort: null, dict_type: null, para1: null,
|
||||
para2: null, para3: null, createId: null, createName: null, createTime: null, updateId: null, updateName: null,
|
||||
updateTime: null, zh_label: null, in_label: null, en_label: null }
|
||||
|
||||
export default {
|
||||
components: { pagination, rrOperation, udOperation },
|
||||
dicts: ['area'],
|
||||
cruds() {
|
||||
return [
|
||||
CRUD({
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
size="mini"
|
||||
@click="divOpen"
|
||||
>
|
||||
配置自动充电
|
||||
下发充电
|
||||
</el-button>
|
||||
<el-button
|
||||
slot="right"
|
||||
|
||||
@@ -37,9 +37,9 @@ export function queryParam() {
|
||||
})
|
||||
}
|
||||
|
||||
export function setParam(data) {
|
||||
export function sendTask(data) {
|
||||
return request({
|
||||
url: 'api/param/setParam',
|
||||
url: 'api/param/sendTask',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
@@ -61,4 +61,4 @@ export function initDict(data) {
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, getValueByCode, queryParam, setParam, showDetail2, initDict }
|
||||
export default { add, edit, del, getValueByCode, sendTask, showDetail2, initDict }
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
<el-table-column min-width="50" prop="para2" label="当前车号" align="center" />
|
||||
<el-table-column min-width="60" prop="use_time" label="充电时长(H)" align="center" :formatter="Myduration" />
|
||||
<el-table-column min-width="60" prop="para3" label="充电状态" align="center" />
|
||||
<el-table-column min-width="60" prop="dict_type" label="所属车间" align="center" />
|
||||
<el-table-column prop="update_time" label="修改时间" align="center" />
|
||||
<el-table-column prop="update_name" label="修改人" align="center" />
|
||||
<el-table-column
|
||||
@@ -43,7 +44,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crudParam, {updateDict} from '@/views/system/param/param'
|
||||
import crudParam from '@/views/system/param/param'
|
||||
import { crud } from '@crud/crud'
|
||||
|
||||
export default {
|
||||
|
||||
@@ -1,43 +1,48 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
append-to-body
|
||||
title="自动充电配置"
|
||||
title="下发充电任务"
|
||||
:visible.sync="dialogVisible"
|
||||
destroy-on-close
|
||||
width="800px"
|
||||
@close="close"
|
||||
@open="open"
|
||||
>
|
||||
<el-form ref="form" :model="form" :rules="rules" size="mini" :inline-message="true" label-width="150px">
|
||||
<el-form-item label="白班充电阈值(%):" prop="electric">
|
||||
<el-input-number v-model="form.electric" size="medium" :min="1" :max="100" :step="1" step-strictly></el-input-number>
|
||||
|
||||
<el-form-item label="车号:" prop="carno">
|
||||
<el-select
|
||||
v-model="form.carno"
|
||||
placeholder="选择车号"
|
||||
style="width: 400px"
|
||||
class="filter-item"
|
||||
clearable
|
||||
filterable
|
||||
@change="hand"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in carList"
|
||||
:key="item.device_code"
|
||||
:label="item.device_name"
|
||||
:value="item.device_code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="晚班充电阈值(%):" prop="electric2">
|
||||
<el-input-number v-model="form.electric2" size="medium" :min="1" :max="100" step-strictly></el-input-number>
|
||||
</el-form-item>
|
||||
<el-form-item label="白班开始时间:" prop="electric_begin">
|
||||
<el-time-select
|
||||
v-model="form.electric_begin"
|
||||
size="medium"
|
||||
:picker-options="{
|
||||
start: '06:00',
|
||||
step: '00:15',
|
||||
end: '12:00'
|
||||
}"
|
||||
placeholder="白班开始时间">
|
||||
</el-time-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="白班结束时间:" prop="electric_end">
|
||||
<el-time-select
|
||||
v-model="form.electric_end"
|
||||
size="medium"
|
||||
:picker-options="{
|
||||
start: '18:00',
|
||||
step: '00:15',
|
||||
end: '23:45'
|
||||
}"
|
||||
placeholder="白班结束时间">
|
||||
</el-time-select>
|
||||
<el-form-item label="充电桩:" prop="station">
|
||||
<el-select
|
||||
v-model="form.station"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="请选择充电桩"
|
||||
class="filter-item"
|
||||
style="width: 400px"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in stations"
|
||||
:key="item.para1"
|
||||
:label="item.label"
|
||||
:value="item.para1"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
@@ -48,6 +53,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crudDevice from '@/api/acs/device/device'
|
||||
import crudDict from '@/api/system/dict'
|
||||
import crudParam from '@/views/system/param/param'
|
||||
import CRUD, { crud } from '@crud/crud'
|
||||
|
||||
@@ -64,25 +71,19 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
carList: [],
|
||||
stations: [],
|
||||
rules: {
|
||||
electric: [
|
||||
{ required: true, message: '请输入白班充电阈值(%)', trigger: 'blur' }
|
||||
carno: [
|
||||
{ required: true, message: '请选择车号', trigger: 'blur' }
|
||||
],
|
||||
electric2: [
|
||||
{ required: true, message: '请输入晚班充电阈值(%)', trigger: 'blur' }
|
||||
],
|
||||
electric_begin: [
|
||||
{ required: true, message: '请输入白班开始时间', trigger: 'blur' }
|
||||
],
|
||||
electric_end: [
|
||||
{ required: true, message: '请输入白班结束时间', trigger: 'blur' }
|
||||
station: [
|
||||
{ required: true, message: '请选择充电桩', trigger: 'blur' }
|
||||
]
|
||||
},
|
||||
form: {
|
||||
electric: 0,
|
||||
electric2: 0,
|
||||
electric_begin: '06:00',
|
||||
electric_end: '18:00'
|
||||
carno: '',
|
||||
station: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -93,41 +94,51 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open() {
|
||||
this.queryTableDtl()
|
||||
created() {
|
||||
crudDevice.selectCarList().then(res => {
|
||||
this.carList = res
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
hand(value) {
|
||||
crudDict.selectStationByCar(value).then(res => {
|
||||
this.stations = res
|
||||
})
|
||||
},
|
||||
// open() {
|
||||
// this.queryTableDtl()
|
||||
// },
|
||||
close() {
|
||||
this.$emit('update:dialogShow', false)
|
||||
this.form.electric = 0
|
||||
this.form.electric2 = 0
|
||||
this.form.electric_begin = '06:00'
|
||||
this.form.electric_end = '18:00'
|
||||
this.carList = null
|
||||
this.stations = null
|
||||
this.form.carno = ''
|
||||
this.form.station = ''
|
||||
this.$emit('AddChanged')
|
||||
},
|
||||
save() {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
this.save_my()
|
||||
this.sendTask()
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
},
|
||||
save_my() {
|
||||
crudParam.setParam(this.form).then(res => {
|
||||
this.crud.notify('保存成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
sendTask() {
|
||||
crudParam.sendTask(this.form).then(res => {
|
||||
this.crud.notify('下发成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
this.close()
|
||||
})
|
||||
},
|
||||
queryTableDtl() {
|
||||
crudParam.queryParam().then(res => {
|
||||
this.form.electric = res.electric
|
||||
this.form.electric2 = res.electric2
|
||||
this.form.electric_begin = res.electric_begin
|
||||
this.form.electric_end = res.electric_end
|
||||
})
|
||||
}
|
||||
// queryTableDtl() {
|
||||
// crudParam.queryParam().then(res => {
|
||||
// this.form.electric = res.electric
|
||||
// this.form.electric2 = res.electric2
|
||||
// this.form.electric_begin = res.electric_begin
|
||||
// this.form.electric_end = res.electric_end
|
||||
// })
|
||||
// }
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user