rev:工单导入/缓存线物料更新
This commit is contained in:
@@ -27,7 +27,23 @@
|
||||
<!-- <jna.version>5.8.0</jna.version>-->
|
||||
<configuration.version>1.9</configuration.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<artifactId>poi</artifactId>-->
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<version>4.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<version>4.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml-schemas</artifactId>
|
||||
<version>4.0.0</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.jetbrains/annotations -->
|
||||
<dependency>
|
||||
<groupId>org.jetbrains</groupId>
|
||||
@@ -364,12 +380,6 @@
|
||||
<version>0.1.55</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 导入Excel相关-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>easyexcel</artifactId>
|
||||
<version>2.2.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
|
||||
@@ -21,9 +21,7 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.common.anno.Log;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.modules.common.config.FileProperties;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.common.utils.*;
|
||||
@@ -146,12 +144,7 @@ public class LocalStorageServiceImpl implements LocalStorageService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void importExcel(String path) {
|
||||
WQLObject measureunitTab = WQLObject.getWQLObject("md_pb_measureunit");
|
||||
WQLObject materialbaseTab = WQLObject.getWQLObject("md_me_materialbase");
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
|
||||
//List<Map<String, Object>> listMap = EasyExcel.read(path).sheet(1).doReadSync();
|
||||
List<Map<String, Object>> listMap = new ArrayList<>();
|
||||
for (int i = 3; i < listMap.size(); i++) {
|
||||
Map<String, Object> map = listMap.get(i);
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
package org.nl.wms.device_manage.controller.userdevice;
|
||||
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 人员设备关系表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-06-06
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/pdmBiPersoncorrdevice")
|
||||
public class PdmBiPersoncorrdeviceController {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,13 +1,21 @@
|
||||
|
||||
package org.nl.wms.mps.rest;
|
||||
package org.nl.wms.device_manage.controller.userdevice;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import io.jsonwebtoken.lang.Assert;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.common.TableDataInfo;
|
||||
import org.nl.common.anno.Log;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.wms.device_manage.service.userdevice.IPdmBiPersoncorrdeviceService;
|
||||
import org.nl.wms.device_manage.service.userdevice.dao.PdmBiPersoncorrdevice;
|
||||
import org.nl.wms.mps.service.PersoncorrdeviceService;
|
||||
import org.nl.wms.mps.service.dto.PersoncorrdeviceDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
@@ -16,6 +24,8 @@ import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -30,50 +40,43 @@ import java.util.Map;
|
||||
public class PersoncorrdeviceController {
|
||||
|
||||
private final PersoncorrdeviceService personcorrdeviceService;
|
||||
private final IPdmBiPersoncorrdeviceService pdmBiPersoncorrdeviceService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询人员设备维护")
|
||||
@ApiOperation("查询人员设备维护")
|
||||
//@PreAuthorize("@el.check('personcorrdevice:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page){
|
||||
return new ResponseEntity<>(personcorrdeviceService.queryAll(whereJson,page),HttpStatus.OK);
|
||||
public ResponseEntity<Object> query(@RequestParam Map query, PageQuery page){
|
||||
Page<Object> result = PageHelper.startPage(page.getPage() + 1, page.getSize());
|
||||
List<Map> list = pdmBiPersoncorrdeviceService.queryAll(query);
|
||||
TableDataInfo build = TableDataInfo.build(list);
|
||||
build.setTotalElements(result.getTotal());
|
||||
return new ResponseEntity<>(build,HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增人员设备维护")
|
||||
@ApiOperation("新增人员设备维护")
|
||||
//@PreAuthorize("@el.check('personcorrdevice:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody PersoncorrdeviceDto dto){
|
||||
personcorrdeviceService.create(dto);
|
||||
public ResponseEntity<Object> create(@RequestBody JSONObject entity){
|
||||
Assert.notNull(entity,"请求参数不能为空");
|
||||
PdmBiPersoncorrdevice pdmBiPersoncorrdevice = entity.toJavaObject(PdmBiPersoncorrdevice.class);
|
||||
pdmBiPersoncorrdevice.setId(IdUtil.getStringId());
|
||||
pdmBiPersoncorrdeviceService.save(pdmBiPersoncorrdevice);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改人员设备维护")
|
||||
@ApiOperation("修改人员设备维护")
|
||||
//@PreAuthorize("@el.check('personcorrdevice:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody PersoncorrdeviceDto dto){
|
||||
personcorrdeviceService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除人员设备维护")
|
||||
@ApiOperation("删除人员设备维护")
|
||||
//@PreAuthorize("@el.check('personcorrdevice:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||
personcorrdeviceService.deleteAll(ids);
|
||||
if (ids != null && ids.length>0){
|
||||
pdmBiPersoncorrdeviceService.removeByIds(Arrays.asList(ids));
|
||||
}
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/addPersons")
|
||||
@Log("添加人员")
|
||||
@ApiOperation("添加人员")
|
||||
//@PreAuthorize("@el.check('teamcorrperson:list')")
|
||||
public ResponseEntity<Object> addPersons(@RequestBody JSONObject param) {
|
||||
personcorrdeviceService.addPersons(param);
|
||||
return new ResponseEntity<>( HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/getDeviceByPerson")
|
||||
@Log("查询设备")
|
||||
@@ -1,7 +1,15 @@
|
||||
package org.nl.wms.device_manage.service.userdevice;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.device_manage.service.userdevice.dao.PdmBiPersoncorrdevice;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.wms.mps.service.dto.PersoncorrdeviceDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -13,4 +21,63 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
*/
|
||||
public interface IPdmBiPersoncorrdeviceService extends IService<PdmBiPersoncorrdevice> {
|
||||
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param whereJson 条件
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
List<Map> queryAll(Map whereJson);
|
||||
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* @param team_person_device_id ID
|
||||
* @return Personcorrdevice
|
||||
*/
|
||||
PersoncorrdeviceDto findById(Long team_person_device_id);
|
||||
|
||||
/**
|
||||
* 根据编码查询
|
||||
* @param code code
|
||||
* @return Personcorrdevice
|
||||
*/
|
||||
PersoncorrdeviceDto findByCode(String code);
|
||||
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param dto /
|
||||
*/
|
||||
void create(PersoncorrdeviceDto dto);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param dto /
|
||||
*/
|
||||
void update(PersoncorrdeviceDto dto);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
|
||||
void addPersons(JSONObject param);
|
||||
|
||||
/**
|
||||
* 设备
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
Map<String,Object> getDeviceByPerson(Map whereJson, Pageable page);
|
||||
|
||||
Map<String, Object> getHeader(JSONObject param);
|
||||
|
||||
JSONArray getDeviceIdByUserId(JSONObject param);
|
||||
|
||||
void addDevices(JSONObject param);
|
||||
|
||||
void deleteRow(JSONObject param);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.wms.device_manage.service.userdevice.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
@@ -20,6 +21,8 @@ public class PdmBiPersoncorrdevice implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id")
|
||||
private String id;
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
|
||||
@@ -3,6 +3,9 @@ package org.nl.wms.device_manage.service.userdevice.dao.mapper;
|
||||
import org.nl.wms.device_manage.service.userdevice.dao.PdmBiPersoncorrdevice;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 人员设备关系表 Mapper 接口
|
||||
@@ -13,4 +16,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
*/
|
||||
public interface PdmBiPersoncorrdeviceMapper extends BaseMapper<PdmBiPersoncorrdevice> {
|
||||
|
||||
List<Map> queryAll(Map query);
|
||||
}
|
||||
|
||||
@@ -2,4 +2,7 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.nl.wms.device_manage.service.userdevice.dao.mapper.PdmBiPersoncorrdeviceMapper">
|
||||
|
||||
<select id="queryAll" resultType="java.util.Map">
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -1,11 +1,19 @@
|
||||
package org.nl.wms.device_manage.service.userdevice.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.device_manage.service.userdevice.dao.PdmBiPersoncorrdevice;
|
||||
import org.nl.wms.device_manage.service.userdevice.dao.mapper.PdmBiPersoncorrdeviceMapper;
|
||||
import org.nl.wms.device_manage.service.userdevice.IPdmBiPersoncorrdeviceService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.nl.wms.mps.service.dto.PersoncorrdeviceDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 人员设备关系表 服务实现类
|
||||
@@ -17,4 +25,64 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class PdmBiPersoncorrdeviceServiceImpl extends ServiceImpl<PdmBiPersoncorrdeviceMapper, PdmBiPersoncorrdevice> implements IPdmBiPersoncorrdeviceService {
|
||||
|
||||
@Override
|
||||
public List<Map> queryAll(Map query) {
|
||||
this.baseMapper.queryAll(query);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PersoncorrdeviceDto findById(Long team_person_device_id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PersoncorrdeviceDto findByCode(String code) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(PersoncorrdeviceDto dto) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(PersoncorrdeviceDto dto) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAll(Long[] ids) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPersons(JSONObject param) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getDeviceByPerson(Map whereJson, Pageable page) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getHeader(JSONObject param) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray getDeviceIdByUserId(JSONObject param) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDevices(JSONObject param) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteRow(JSONObject param) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
package org.nl.wms.ext.sap.rest;
|
||||
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
@@ -30,6 +31,7 @@ import java.util.Map;
|
||||
@Api(tags = "wms发送sap")
|
||||
@RequestMapping("/api/sap/")
|
||||
@Slf4j
|
||||
@SaIgnore
|
||||
public class WmsToSapController {
|
||||
private final WmsToSapService wmsToSapService;
|
||||
|
||||
@@ -50,6 +52,7 @@ public class WmsToSapController {
|
||||
@PostMapping("/getDeliveryNote")
|
||||
@Log("获取物料基础信息")
|
||||
@ApiOperation("获取物料基础信息")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> getDeliveryNote(@RequestBody JSONObject form) {
|
||||
return new ResponseEntity<>(wmsToSapService.getDeliveryNote(form), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -216,6 +216,10 @@ public class SpeFullTask extends AbstractAcsTask {
|
||||
taskService.update(wrapper);
|
||||
//outboxt箱子更新到任务表vechile_code2?
|
||||
if (extParam.get("inbox") != null){
|
||||
List<SchCachelineVehilematerial> list = cacheLineVechileService.list(new QueryWrapper<SchCachelineVehilematerial>().eq("vehicle_code", extParam.get("inbox")));
|
||||
if (!CollectionUtils.isEmpty(list)){
|
||||
cacheLineVechileService.removeByIds(list.stream().map(SchCachelineVehilematerial::getVehmaterial_id).collect(Collectors.toList()));
|
||||
}
|
||||
SchCachelineVehilematerial vehilematerial = new SchCachelineVehilematerial();
|
||||
vehilematerial.setCreate_time(DateUtil.now());
|
||||
vehilematerial.setVehmaterial_id(IdUtil.getStringId());
|
||||
|
||||
@@ -11,6 +11,7 @@ import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.poi.excel.ExcelReader;
|
||||
import cn.hutool.poi.excel.ExcelUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
@@ -14,8 +15,12 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import io.jsonwebtoken.lang.Assert;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.nl.common.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
@@ -30,6 +35,7 @@ import org.nl.wms.masterdata_manage.master.service.classstandard.IMdPbClassstand
|
||||
import org.nl.wms.masterdata_manage.service.material.IMdMeMaterialbaseService;
|
||||
import org.nl.wms.masterdata_manage.service.material.dao.MdMeMaterialbase;
|
||||
import org.nl.wms.mps.service.WorkOrderImportEnum;
|
||||
import org.nl.wms.mps.service.dto.ProduceWorkorderDto;
|
||||
import org.nl.wms.mps.service.dto.ProduceshiftorderDto;
|
||||
import org.nl.wms.product_manage.ReportEnum;
|
||||
import org.nl.wms.product_manage.service.device.IPdmBiDeviceService;
|
||||
@@ -42,6 +48,8 @@ import org.nl.wms.product_manage.service.workorder.dao.WorkorderRecord;
|
||||
import org.nl.wms.product_manage.service.workorder.dao.mapper.PdmProduceWorkorderMapper;
|
||||
import org.nl.wms.product_manage.service.workorder.dto.ReportQuery;
|
||||
import org.nl.wms.product_manage.service.workorder.dto.WorkorderQuery;
|
||||
import org.nl.wms.product_manage.service.workprocedure.IPdmBiWorkprocedureService;
|
||||
import org.nl.wms.product_manage.service.workprocedure.dao.PdmBiWorkprocedure;
|
||||
import org.nl.wms.system_manage.service.user.ISysUserService;
|
||||
import org.nl.wms.system_manage.service.user.dao.SysUser;
|
||||
import org.redisson.misc.Hash;
|
||||
@@ -55,9 +63,12 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.*;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -84,6 +95,8 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
||||
@Resource
|
||||
private PdmProduceWorkorderMapper pdmProduceWorkorderMapper;
|
||||
@Resource
|
||||
private IPdmBiWorkprocedureService workprocedureService;
|
||||
@Resource
|
||||
private IPdmProduceWorkorderrecordService reportRecordService;
|
||||
|
||||
@Override
|
||||
@@ -227,287 +240,130 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void excelImport(MultipartFile file, HttpServletRequest request) {
|
||||
// todo: 根据需求修改
|
||||
if (file.isEmpty()) {
|
||||
throw new BadRequestException("文件为空,请添加数据后重新导入");
|
||||
}
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
// 1.获取上传文件输入流
|
||||
InputStream inputStream = null;
|
||||
try {
|
||||
inputStream = file.getInputStream();
|
||||
//A1_TW_+device_code 日期2023/5/30
|
||||
//material_spec='24030921S'
|
||||
ExcelReader excelReader = ExcelUtil.getReader(inputStream,"推弯计划表");
|
||||
List<List<Object>> read = excelReader.read();
|
||||
String produce_date = "";
|
||||
// 循环获取的数据
|
||||
List<PdmProduceWorkorder> data = new ArrayList<>();
|
||||
row:
|
||||
for (int i = 0; i < read.size(); i++) {
|
||||
List<Object> list = read.get(i);
|
||||
if (ObjectUtil.isEmpty(list)) {
|
||||
continue;
|
||||
}
|
||||
//获取每列
|
||||
JSONObject param = new JSONObject();
|
||||
//按照列获取
|
||||
param.put("workorder_id", IdUtil.getStringId());
|
||||
param.put("workorder_code", CodeUtil.getNewCode("PDM_SHIFTORDER"));
|
||||
param.put("workorder_status", WorkerOrderEnum.CREATE.getCode());
|
||||
param.put("shift_type_scode", StatusEnum.DAYSHIFT.getCode()); // 默认白班
|
||||
String error_message = "";
|
||||
PdmProduceWorkorder workorder = new PdmProduceWorkorder();
|
||||
workorder.setWorkorder_id(IdUtil.getStringId());
|
||||
workorder.setWorkorder_code(CodeUtil.getNewCode("PDM_SHIFTORDER"));
|
||||
workorder.setWorkorder_status(WorkerOrderEnum.CREATE.getCode());
|
||||
workorder.setIs_needmove(true);
|
||||
workorder.setIs_canupdate_update(true);
|
||||
workorder.setCreate_time(DateUtil.now());
|
||||
workorder.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||
workorder.setCreate_name("导入订单");
|
||||
workorder.setCreate_type(StatusEnum.EXCELINTO.getCode());
|
||||
|
||||
Map<String,String> errorMap = new HashMap();
|
||||
for (int j = 0; j < list.size(); j++) {
|
||||
String col = String.valueOf(list.get(j));
|
||||
解析cell:{ //如果是第一行 为生产日期
|
||||
if (i == 0 && j == 0) {
|
||||
continue row;
|
||||
}
|
||||
//如果第一列包含规格二字 则为表头 结束内循环列
|
||||
if (j == 0 && col.contains("班次")) {
|
||||
continue row;
|
||||
}
|
||||
if (j == 0) {
|
||||
//物料
|
||||
workorder.setShift_type_scode(col.equals("夜班") ? "0" : "1");
|
||||
}
|
||||
if (j == 1) {
|
||||
//物料
|
||||
workorder.setPlanproduceend_date(col.substring(0,col.indexOf(" "))+" 18:30:00");
|
||||
workorder.setPlanproducestart_date(col.substring(0,col.indexOf(" "))+" 07:30:00");
|
||||
}
|
||||
if (j == 2) {
|
||||
//物料
|
||||
List<MdMeMaterialbase> material_specs = materialbaseService.list(new QueryWrapper<MdMeMaterialbase>().eq("material_spec", col));
|
||||
if (CollectionUtils.isEmpty(material_specs)) {
|
||||
errorMap.put("第" + i + "行" + col, "物料规格对应物料信息不存在");
|
||||
error_message = error_message + col + "物料规格对应物料信息不存在,";
|
||||
} else {
|
||||
Optional<MdMeMaterialbase> first = material_specs.stream().filter(new Predicate<MdMeMaterialbase>() {
|
||||
@Override
|
||||
public boolean test(MdMeMaterialbase mdMeMaterialbase) {
|
||||
return mdMeMaterialbase.getMaterial_code().contains("S") && !mdMeMaterialbase.getMaterial_code().contains("TH");
|
||||
}
|
||||
}).findFirst();
|
||||
if (!first.isPresent()) {
|
||||
errorMap.put("第" + i + "行" + col, "物料规格对应物料信息不存在");
|
||||
}
|
||||
workorder.setMaterial_id(first.get().getMaterial_id());
|
||||
}
|
||||
}
|
||||
if (j == 3) {
|
||||
PdmBiWorkprocedure workprocedure = workprocedureService.getOne(new QueryWrapper<PdmBiWorkprocedure>().eq("workprocedure_name", col));
|
||||
if (ObjectUtil.isEmpty(workprocedure)) {
|
||||
errorMap.put("第" + i + "行" + col, "工序名称是否正确");
|
||||
} else {
|
||||
workorder.setWorkprocedure_id(workprocedure.getWorkprocedure_id());
|
||||
}
|
||||
}
|
||||
if (j == 4) {
|
||||
//设备 A1_TW_
|
||||
workorder.setDevice_code("A1_TW_" + col);
|
||||
}
|
||||
if (j == 7) {
|
||||
//单重
|
||||
BigDecimal bigDecimal = BigDecimal.valueOf(Double.valueOf(col) * 1000);
|
||||
workorder.setMaterial_weight(bigDecimal.setScale(3, RoundingMode.HALF_UP));
|
||||
}
|
||||
if (j == 8) {
|
||||
//操作工
|
||||
SysUser user = userService.getOne(new QueryWrapper<SysUser>().eq("username", col));
|
||||
if (ObjectUtil.isEmpty(user)) {
|
||||
errorMap.put("第" + i + "行" + col, " 操作工没有账号");
|
||||
} else {
|
||||
workorder.setCurrent_produce_person_id(user.getUser_id());
|
||||
}
|
||||
}
|
||||
if (j == 9) {
|
||||
workorder.setPlan_qty(new BigDecimal(Long.valueOf(col)));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isEmpty(errorMap)){
|
||||
data.add(workorder);
|
||||
}else {
|
||||
throw new BadRequestException(JSON.toJSONString(errorMap));
|
||||
}
|
||||
}
|
||||
this.saveBatch(data);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
ExcelReader reader = ExcelUtil.getReader(inputStream);
|
||||
// 调用用 hutool 方法读取数据 调用第一个sheet白班数据
|
||||
ExcelReader excelReader = ExcelUtil.getReader(inputStream, 0);
|
||||
// 从第1行开始获取数据 excelReader.read的结果是一个2纬的list,外层是行,内层是行对应的所有列
|
||||
List<List<Object>> read = excelReader.read(0, excelReader.getRowCount());
|
||||
String produce_date = "";
|
||||
// 循环获取的数据
|
||||
List<PdmProduceWorkorder> entitys = new ArrayList<>();
|
||||
row:
|
||||
for (int i = 0; i < read.size(); i++) {
|
||||
List<Object> list = read.get(i);
|
||||
if (ObjectUtil.isEmpty(list)) {
|
||||
continue;
|
||||
throw new BadRequestException(e.getMessage());
|
||||
}finally {
|
||||
if (inputStream !=null){
|
||||
try {
|
||||
inputStream.close();
|
||||
}catch (Exception ex){ }
|
||||
}
|
||||
//获取每列
|
||||
JSONObject param = new JSONObject();
|
||||
//按照列获取
|
||||
param.put("workorder_id", cn.hutool.core.util.IdUtil.getSnowflake(1, 1).nextId());
|
||||
param.put("workorder_code", CodeUtil.getNewCode("PDM_SHIFTORDER"));
|
||||
// param.put("macoperate_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
param.put("workorder_status", WorkerOrderEnum.CREATE.getCode());
|
||||
param.put("shift_type_scode", StatusEnum.DAYSHIFT.getCode()); // 默认白班
|
||||
String is_error = "0";
|
||||
String error_message = "";
|
||||
//循环每一行
|
||||
col:
|
||||
for (int j = 0; j < list.size(); j++) {
|
||||
|
||||
String col = String.valueOf(list.get(j));
|
||||
//如果是第一行 为生产日期
|
||||
if (i == 0 && j == 0) {
|
||||
produce_date = col.split(":")[col.split(":").length - 1];
|
||||
continue row;
|
||||
}
|
||||
//如果第一列包含规格二字 则为表头 结束内循环列
|
||||
if (j == 0 && col.contains("规格名称")) {
|
||||
continue row;
|
||||
}
|
||||
if (j == 0) {
|
||||
//物料
|
||||
if (StrUtil.isEmpty(col)) {
|
||||
is_error = "1";
|
||||
error_message = error_message + "物料规格为空,";
|
||||
}
|
||||
MdMeMaterialbase material = materialbaseService.getOne(new QueryWrapper<MdMeMaterialbase>().eq("material_spec", col));
|
||||
if (ObjectUtil.isEmpty(material)) {
|
||||
is_error = "1";
|
||||
error_message = error_message + "物料规格对应物料信息不存在,";
|
||||
} else {
|
||||
param.put("material_id", material.getMaterial_id());
|
||||
}
|
||||
}
|
||||
if (j == 2) {
|
||||
if (StrUtil.isEmpty(col)) {
|
||||
is_error = "1";
|
||||
error_message = error_message + "工序名称为空,";
|
||||
}
|
||||
WorkOrderImportEnum idByName = WorkOrderImportEnum.getIdByName(col);
|
||||
if (ObjectUtil.isEmpty(idByName)) {
|
||||
is_error = "1";
|
||||
error_message = error_message + "工序名称是否正确,";
|
||||
} else {
|
||||
param.put("workprocedure_id", idByName.getId());
|
||||
}
|
||||
}
|
||||
if (j == 4) {
|
||||
//单重
|
||||
param.put("material_weight", col);
|
||||
}
|
||||
if (j == 6) {
|
||||
if (StrUtil.isEmpty(col)) {
|
||||
is_error = "1";
|
||||
error_message = error_message + "工单计划数量为空,";
|
||||
} else {
|
||||
param.put("plan_qty", col);
|
||||
}
|
||||
}
|
||||
if (j == 10) {
|
||||
String workprocedure_id = param.getString("workprocedure_id");
|
||||
PdmBiDevice device = deviceService.getOne(new QueryWrapper<PdmBiDevice>().eq("device_code", col));
|
||||
if (ObjectUtil.isEmpty(device)) {
|
||||
is_error = "1";
|
||||
error_message = error_message + "设备编码不存在,";
|
||||
}
|
||||
if (!workprocedure_id.equals(device.getWorkprocedure_id())) {
|
||||
is_error = "1";
|
||||
error_message = error_message + "设备与所属工序不匹配,";
|
||||
} else {
|
||||
param.put("device_code", device.getDevice_code());
|
||||
}
|
||||
}
|
||||
if (j == 11) {
|
||||
SysUser jsonUser = userService.getOne(new QueryWrapper<SysUser>().eq("username", col));
|
||||
if (ObjectUtil.isEmpty(jsonUser)) {
|
||||
is_error = "1";
|
||||
error_message = error_message + "生产人员编码不存在!";
|
||||
} else {
|
||||
param.put("current_produce_person_id", jsonUser.getUser_id());
|
||||
}
|
||||
}
|
||||
if (j == 12) {
|
||||
//允许修改报工数量
|
||||
String is_canupdate = "0";
|
||||
if (col.equals("是")) {
|
||||
is_canupdate = "1";
|
||||
}
|
||||
param.put("is_canupdate_update", is_canupdate);
|
||||
}
|
||||
if (j == 13) {
|
||||
//是否agv搬运
|
||||
String needmoce = "0";
|
||||
if (col.equals("是")) {
|
||||
needmoce = "1";
|
||||
}
|
||||
param.put("is_needmove", needmoce);
|
||||
}
|
||||
}
|
||||
param.put("is_error", is_error);
|
||||
param.put("error_info", error_message);
|
||||
param.put("create_type", StatusEnum.EXCELINTO.getCode());
|
||||
param.put("planproducestart_date", produce_date + "07:30:00");
|
||||
param.put("planproduceend_date", produce_date + "18:30:00");
|
||||
param.put("create_id", currentUserId);
|
||||
param.put("create_name", nickName);
|
||||
param.put("create_time", DateUtil.now());
|
||||
entitys.add(param.toJavaObject(PdmProduceWorkorder.class));
|
||||
}
|
||||
|
||||
// 1.获取上传文件输入流
|
||||
inputStream = null;
|
||||
try {
|
||||
inputStream = file.getInputStream();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
//读取夜班工单数据
|
||||
excelReader = ExcelUtil.getReader(inputStream, 1);
|
||||
read = excelReader.read(0, excelReader.getRowCount());
|
||||
String is_error = "0";
|
||||
String error_message = "";
|
||||
// 循环获取的数据
|
||||
row:
|
||||
for (int i = 0; i < read.size(); i++) {
|
||||
List<Object> list = read.get(i);
|
||||
//获取每列
|
||||
JSONObject param = new JSONObject();
|
||||
//按照列获取
|
||||
param.put("workorder_id", cn.hutool.core.util.IdUtil.getSnowflake(1, 1).nextId());
|
||||
param.put("workorder_code", CodeUtil.getNewCode("PDM_SHIFTORDER"));
|
||||
// param.put("producedeviceorder_code", CodeUtil.getNewCode("PDM_SHIFTORDER"));
|
||||
param.put("workorder_status", WorkerOrderEnum.CREATE.getCode());
|
||||
// param.put("produce_date", produce_date);
|
||||
param.put("shift_type_scode", StatusEnum.NIGHTSHIFT.getCode()); // 夜班
|
||||
//循环每一行
|
||||
col:
|
||||
for (int j = 0; j < list.size(); j++) {
|
||||
|
||||
String col = String.valueOf(list.get(j));
|
||||
//如果是第一行 为生产日期
|
||||
if (i == 0 && j == 0) {
|
||||
produce_date = col.split(":")[col.split(":").length - 1];
|
||||
continue row;
|
||||
}
|
||||
//如果第一列包含规格二字 则为表头 结束内循环列
|
||||
if (j == 0 && col.contains("规格名称")) {
|
||||
continue row;
|
||||
}
|
||||
if (j == 0) {
|
||||
//物料
|
||||
if (StrUtil.isEmpty(col)) {
|
||||
is_error = "1";
|
||||
error_message = error_message + "物料规格为空,";
|
||||
}
|
||||
MdMeMaterialbase material = materialbaseService.getOne(new QueryWrapper<MdMeMaterialbase>().eq("material_spec", col));
|
||||
if (ObjectUtil.isEmpty(material)) {
|
||||
is_error = "1";
|
||||
error_message = error_message + "物料规格对应物料信息不存在,";
|
||||
} else {
|
||||
param.put("material_id", material.getMaterial_id());
|
||||
}
|
||||
}
|
||||
if (j == 2) {
|
||||
if (StrUtil.isEmpty(col)) {
|
||||
is_error = "1";
|
||||
error_message = error_message + "工序名称为空,";
|
||||
}
|
||||
WorkOrderImportEnum idByName = WorkOrderImportEnum.getIdByName(col);
|
||||
if (ObjectUtil.isEmpty(idByName)) {
|
||||
is_error = "1";
|
||||
error_message = error_message + "工序名称是否正确,";
|
||||
} else {
|
||||
param.put("workprocedure_id", idByName.getId());
|
||||
}
|
||||
}
|
||||
if (j == 4) {
|
||||
//单重
|
||||
param.put("material_weight", col);
|
||||
}
|
||||
if (j == 6) {
|
||||
if (StrUtil.isEmpty(col)) {
|
||||
is_error = "1";
|
||||
error_message = error_message + "工单计划数量为空,";
|
||||
} else {
|
||||
param.put("plan_qty", col);
|
||||
}
|
||||
}
|
||||
// if (j == 10) {
|
||||
// //物料
|
||||
// JSONObject json_material = wo_material.query("is_delete = '0' and material_code = '" + col + "'").uniqueResult(0);
|
||||
// if (ObjectUtil.isEmpty(json_material)) {
|
||||
// throw new BadRequestException("第'" + (i + 2) + "'行,物料编码不存在");
|
||||
// }
|
||||
// param.put("material_id", json_material.getString("material_id"));
|
||||
// }
|
||||
if (j == 10) {
|
||||
String workprocedure_id = param.getString("workprocedure_id");
|
||||
PdmBiDevice device = deviceService.getOne(new QueryWrapper<PdmBiDevice>().eq("device_code", col));
|
||||
if (ObjectUtil.isEmpty(device)) {
|
||||
is_error = "1";
|
||||
error_message = error_message + "设备编码不存在,";
|
||||
}
|
||||
if (!workprocedure_id.equals(device.getWorkprocedure_id())) {
|
||||
is_error = "1";
|
||||
error_message = error_message + "设备与所属工序不匹配,";
|
||||
} else {
|
||||
param.put("device_code", device.getDevice_code());
|
||||
}
|
||||
}
|
||||
if (j == 11) {
|
||||
SysUser jsonUser = userService.getOne(new QueryWrapper<SysUser>().eq("username", col));
|
||||
if (ObjectUtil.isEmpty(jsonUser)) {
|
||||
is_error = "1";
|
||||
error_message = error_message + "生产人员编码不存在!";
|
||||
} else {
|
||||
param.put("current_produce_person_id", jsonUser.getUser_id());
|
||||
}
|
||||
}
|
||||
if (j == 12) {
|
||||
//允许修改报工数量
|
||||
String is_canupdate = "0";
|
||||
if (col.equals("是")) {
|
||||
is_canupdate = "1";
|
||||
}
|
||||
param.put("is_canupdate_update", is_canupdate);
|
||||
}
|
||||
if (j == 13) {
|
||||
//是否agv搬运
|
||||
String needmoce = "0";
|
||||
if (col.equals("是")) {
|
||||
needmoce = "1";
|
||||
}
|
||||
param.put("is_needmove", needmoce);
|
||||
}
|
||||
}
|
||||
param.put("is_error", is_error);
|
||||
param.put("error_info", error_message);
|
||||
param.put("create_type", StatusEnum.EXCELINTO.getCode());
|
||||
param.put("planproducestart_date", produce_date + "18:30:00");
|
||||
DateTime dateTime = DateUtil.offsetDay(DateUtil.parse(produce_date), 1);
|
||||
param.put("planproduceend_date", DateUtil.format(dateTime, "yyyy-MM-dd") + " 07:30:00");
|
||||
param.put("create_id", currentUserId);
|
||||
param.put("create_name", nickName);
|
||||
param.put("create_time", DateUtil.now());
|
||||
entitys.add(param.toJavaObject(PdmProduceWorkorder.class));
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(entitys)) {
|
||||
this.saveBatch(entitys);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -23,11 +23,11 @@ spring:
|
||||
db-type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
# url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.46.5}:${DB_PORT:3306}/${DB_NAME:hl_one_mes_test}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.46.5}:${DB_PORT:3306}/${DB_NAME:hl_one_mes_test}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false
|
||||
# url: jdbc:log4jdbc:mysql://${DB_HOST:localhost}:${DB_PORT:3306}/${DB_NAME:hl_one_mes}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false
|
||||
# url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.46.5}:${DB_PORT:3306}/${DB_NAME:hl_one_mes_test}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:localhost}:${DB_PORT:3306}/${DB_NAME:hl_one_mes}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false
|
||||
username: ${DB_USER:root}
|
||||
# password: ${DB_PWD:123456}
|
||||
password: ${DB_PWD:123456}
|
||||
password: ${DB_PWD:942464Yy}
|
||||
|
||||
# 初始连接数
|
||||
initial-size: 5
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function query(data) {
|
||||
return request({
|
||||
url: 'api/specialDevice/query',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function edit(data) {
|
||||
return request({
|
||||
url: 'api/specialDevice/update',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export default { query, edit }
|
||||
146
mes/qd/src/views/wms/device_manage/deviceMaterial/index.vue
Normal file
146
mes/qd/src/views/wms/device_manage/deviceMaterial/index.vue
Normal file
@@ -0,0 +1,146 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!--表单组件-->
|
||||
<el-dialog
|
||||
append-to-body
|
||||
:close-on-click-modal="false"
|
||||
:before-close="crud.cancelCU"
|
||||
:visible="crud.status.cu > 0"
|
||||
:title="crud.status.title"
|
||||
width="500px"
|
||||
>
|
||||
<el-form ref="form" :model="form" :rules="rules" size="mini" label-width="80px">
|
||||
<el-form-item label="物料系列" prop="code">
|
||||
<el-input v-model="form.material_spec" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="工序调度编号">
|
||||
<el-input v-model="form.process_id" 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.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!-- 字典列表 -->
|
||||
<el-card class="box-card">
|
||||
<!--工具栏-->
|
||||
<div class="head-container">
|
||||
<div v-if="crud.props.searchToggle">
|
||||
<!-- 搜索 -->
|
||||
<el-input
|
||||
v-model="query.search"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="设备编号模糊查询"
|
||||
style="width: 200px;"
|
||||
class="filter-item"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
<rrOperation :permission="permission" />
|
||||
</div>
|
||||
<crudOperation :permission="permission" />
|
||||
</div>
|
||||
<!--表格渲染-->
|
||||
|
||||
<el-table
|
||||
ref="table"
|
||||
v-loading="crud.loading"
|
||||
:data="crud.data"
|
||||
highlight-current-row
|
||||
style="width: 100%;"
|
||||
@selection-change="crud.selectionChangeHandler"
|
||||
@current-change="handleCurrentChange"
|
||||
>
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column prop="product_area" label="生产车间" width="100px" show-overflow-tooltip />
|
||||
<el-table-column prop="device_code" label="设备编码" width="100px" show-overflow-tooltip />
|
||||
<el-table-column prop="material_id" label="物料id" width="200px" show-overflow-tooltip>
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.material_id">
|
||||
<el-button slot="append" icon="el-icon-plus" @click="queryMater(scope.$index, scope.row)" />
|
||||
</el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="material_name" label="物料名称" width="200px" show-overflow-tooltip />
|
||||
<el-table-column prop="material_spec" label="物料规格" width="200px" show-overflow-toolti />
|
||||
<el-table-column prop="deviceinstor_qty" label="深坑物料数量" align="center" width="120px" show-overflow-tooltip>
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.deviceinstor_qty/" /></template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="remark" label="备注" width="200px" show-overflow-tooltip />
|
||||
<el-table-column label="操作" width="150px" align="center" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" style="margin-left: -1px;margin-right: 2px" type="text" @click="updateSKMaterial(scope.row)">提交修改</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<MaterDtl
|
||||
:dialog-show.sync="materialShow"
|
||||
:is-single="true"
|
||||
:mater-opt-code="materType"
|
||||
@setMaterValue="setMaterValue"
|
||||
/>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crudDevice from '@/views/wms/device_manage/deviceMaterial/deviceMaterial.js'
|
||||
import CRUD, { presenter, header, form } from '@crud/crud'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import MaterDtl from '@/views/wms/pub/MaterDialog'
|
||||
|
||||
const defaultForm = { product_area: 'A1', workprocedure_id: '1535144552481034240', device_code: null, material_id: null, material_name: null, material_spec: null, deviceinstor_qty: null, remark: null }
|
||||
|
||||
export default {
|
||||
name: 'SKdevice',
|
||||
components: { crudOperation, pagination, rrOperation, MaterDtl },
|
||||
cruds() {
|
||||
return [
|
||||
CRUD({ title: '深坑设备物料', url: 'api/specialDevice/query', query: { product_area: 'A1', workprocedure_id: '1535144552481034240' }, idField: 'device_code', crudMethod: { ...crudDevice }})
|
||||
]
|
||||
},
|
||||
mixins: [presenter(), header(), form(defaultForm)],
|
||||
data() {
|
||||
return {
|
||||
materialShow: false,
|
||||
queryTypeOptions: [
|
||||
{ key: 'name', display_name: '字典名称' },
|
||||
{ key: 'description', display_name: '描述' }
|
||||
],
|
||||
rules: {
|
||||
material_spec: [
|
||||
{ required: true, message: '请输入编码', trigger: 'blur' }
|
||||
]
|
||||
},
|
||||
permission: {
|
||||
add: ['admin', 'dict:add'],
|
||||
edit: ['admin', 'dict:edit'],
|
||||
del: ['admin', 'dict:del']
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
queryMater(index, row) {
|
||||
this.materialShow = true
|
||||
this.nowindex = index
|
||||
this.nowrow = row
|
||||
},
|
||||
setMaterValue(row) {
|
||||
this.nowrow.material_id = row.material_id
|
||||
this.nowrow.material_code = row.material_code
|
||||
this.nowrow.material_name = row.material_name
|
||||
this.nowrow.material_spec = row.material_spec
|
||||
this.tableData.splice(this.nowindex, 1, this.nowrow) // 通过splice 替换数据 触发视图更新
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
</style>
|
||||
293
mes/qd/src/views/wms/device_manage/userDeviceReplate/index.vue
Normal file
293
mes/qd/src/views/wms/device_manage/userDeviceReplate/index.vue
Normal file
@@ -0,0 +1,293 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!--工具栏-->
|
||||
<div class="head-container">
|
||||
<div v-if="crud.props.searchToggle">
|
||||
<!-- 搜索 -->
|
||||
<el-input
|
||||
v-model="query.blurry"
|
||||
size="mini"
|
||||
clearable
|
||||
placeholder="输入用户名"
|
||||
style="width: 200px;"
|
||||
class="filter-item"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
<rrOperation />
|
||||
</div>
|
||||
<crudOperation :permission="permission" />
|
||||
</div>
|
||||
<!-- 表单渲染 -->
|
||||
<el-dialog
|
||||
append-to-body
|
||||
:close-on-click-modal="false"
|
||||
:before-close="crud.cancelCU"
|
||||
:visible.sync="crud.status.cu > 0"
|
||||
:title="crud.status.title"
|
||||
width="520px"
|
||||
>
|
||||
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="mini" label-width="80px">
|
||||
<el-form-item label="角色名称" prop="name">
|
||||
<el-input v-model="form.name" style="width: 380px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="description">
|
||||
<el-input v-model="form.remark" style="width: 380px;" rows="2" type="textarea" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="text" @click="crud.cancelCU">取消</el-button>
|
||||
<el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<el-row :gutter="15">
|
||||
<!--角色管理-->
|
||||
<el-col :span="12" style="margin-bottom: 10px">
|
||||
<el-card class="box-card" shadow="never">
|
||||
<div slot="header" class="clearfix">
|
||||
<span class="role-span">用户列表</span>
|
||||
</div>
|
||||
<el-table
|
||||
ref="table"
|
||||
v-loading="crud.loading"
|
||||
highlight-current-row
|
||||
style="width: 100%;"
|
||||
:data="crud.data"
|
||||
@selection-change="crud.selectionChangeHandler"
|
||||
@current-change="handleCurrentChange"
|
||||
>
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column prop="name" label="名称" min-width="100" show-overflow-tooltip />
|
||||
<el-table-column show-overflow-tooltip prop="remark" label="描述" />
|
||||
<el-table-column show-overflow-tooltip width="135px" prop="createTime" label="创建日期">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-permission="['admin','roles:edit','roles:del']"
|
||||
label="操作"
|
||||
width="130px"
|
||||
align="center"
|
||||
fixed="right"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<udOperation
|
||||
:data="scope.row"
|
||||
:permission="permission"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
</el-card>
|
||||
</el-col>
|
||||
<!-- 菜单授权 -->
|
||||
<el-col :span="12">
|
||||
<el-card class="box-card" shadow="never">
|
||||
<div slot="header" class="clearfix">
|
||||
<el-tooltip class="item" effect="dark" content="选择指定用户分配设备" placement="top">
|
||||
<span class="role-span">设备分配</span>
|
||||
</el-tooltip>
|
||||
<el-button
|
||||
v-permission="['admin','roles:edit']"
|
||||
:disabled="!showButton"
|
||||
:loading="menuLoading"
|
||||
icon="el-icon-check"
|
||||
size="mini"
|
||||
style="float: right; padding: 6px 10px"
|
||||
type="primary"
|
||||
@click="saveMenu"
|
||||
>保存
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<el-tree
|
||||
ref="menu"
|
||||
lazy
|
||||
:data="menus"
|
||||
:default-checked-keys="menu_ids"
|
||||
:load="getMenuDatas"
|
||||
:props="defaultProps"
|
||||
check-strictly
|
||||
accordion
|
||||
show-checkbox
|
||||
node-key="menu_id"
|
||||
@check="menuChange"
|
||||
/>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crudUsers from '@/views/system/user/user.js'
|
||||
import crudMenu from '@/views/system/menu/menu'
|
||||
import { getChild, getMenusTree } from '@/views/system/menu/menu'
|
||||
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'
|
||||
|
||||
const defaultForm = { role_id: null, name: null, remark: null }
|
||||
export default {
|
||||
name: 'Role',
|
||||
components: { pagination, crudOperation, rrOperation, udOperation, crudMenu },
|
||||
cruds() {
|
||||
return CRUD({ idField: 'user_id', title: '用户', url: '/api/users', crudMethod: { ...crudUsers }})
|
||||
},
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
data() {
|
||||
return {
|
||||
defaultProps: { children: 'children', label: 'title', isLeaf: 'leaf' },
|
||||
currentId: 0, menuLoading: false, showButton: false,
|
||||
menus: [], menu_ids: [], // 多选时使用
|
||||
permission: {
|
||||
add: ['admin', 'roles:add'],
|
||||
edit: ['admin', 'roles:edit'],
|
||||
del: ['admin', 'roles:del']
|
||||
},
|
||||
rules: {
|
||||
name: [
|
||||
{ required: true, message: '请输入名称', trigger: 'blur' }
|
||||
],
|
||||
permission: [
|
||||
{ required: true, message: '请输入权限', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
},
|
||||
methods: {
|
||||
getMenuDatas(node, resolve) {
|
||||
setTimeout(() => {
|
||||
getMenusTree(node.data.menu_id ? node.data.menu_id : 0).then(res => {
|
||||
resolve(res)
|
||||
})
|
||||
}, 100)
|
||||
},
|
||||
getMenusByRole(val) {
|
||||
if (this.currentId && val[0] && val[1]) {
|
||||
const param = {
|
||||
role_id: this.currentId,
|
||||
system_type: val[0],
|
||||
category: val[1]
|
||||
}
|
||||
|
||||
const _this = this
|
||||
crudMenu.getMenusByRole(param).then(res => {
|
||||
_this.menus = res
|
||||
|
||||
// 初始化默认选中的key
|
||||
_this.menu_ids = []
|
||||
_this.menus.forEach(function(data) {
|
||||
_this.menu_ids.push(data)
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
[CRUD.HOOK.afterRefresh]() {
|
||||
this.$refs.menu.setCheckedKeys([])
|
||||
},
|
||||
// 提交前做的操作
|
||||
[CRUD.HOOK.afterValidateCU](crud) {
|
||||
return true
|
||||
},
|
||||
// 触发单选
|
||||
handleCurrentChange(val) {
|
||||
if (val) {
|
||||
const _this = this
|
||||
// 清空菜单的选中
|
||||
this.$refs.menu.setCheckedKeys([])
|
||||
// 保存当前的角色id
|
||||
this.currentId = val.role_id
|
||||
// 初始化默认选中的key
|
||||
this.menu_ids = []
|
||||
val.menus.forEach(function(data) {
|
||||
_this.menu_ids.push(data)
|
||||
})
|
||||
this.showButton = true
|
||||
}
|
||||
},
|
||||
menuChange(menu) {
|
||||
// 获取该节点的所有子节点,id 包含自身
|
||||
getChild(menu.menu_id).then(childIds => {
|
||||
// 判断是否在 menu_ids 中,如果存在则删除,否则添加
|
||||
if (this.menu_ids.indexOf(menu.menu_id) !== -1) {
|
||||
for (let i = 0; i < childIds.length; i++) {
|
||||
const index = this.menu_ids.indexOf(childIds[i])
|
||||
if (index !== -1) {
|
||||
this.menu_ids.splice(index, 1)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (let i = 0; i < childIds.length; i++) {
|
||||
const index = this.menu_ids.indexOf(childIds[i])
|
||||
if (index === -1) {
|
||||
this.menu_ids.push(childIds[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
this.$refs.menu.setCheckedKeys(this.menu_ids)
|
||||
})
|
||||
},
|
||||
// 保存菜单
|
||||
saveMenu() {
|
||||
this.menuLoading = true
|
||||
const role = { role_id: this.currentId, menus: [] }
|
||||
// 得到已选中的 key 值
|
||||
this.menu_ids.forEach(function(menu_id) {
|
||||
const menu = { menu_id: menu_id }
|
||||
role.menus.push(menu)
|
||||
})
|
||||
crudRoles.editMenu(role).then(() => {
|
||||
this.crud.notify('保存成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
this.menuLoading = false
|
||||
this.crud.toQuery()
|
||||
// this.update()
|
||||
}).catch(err => {
|
||||
this.menuLoading = false
|
||||
console.log(err.response.data.message)
|
||||
})
|
||||
},
|
||||
// 改变数据
|
||||
update() {
|
||||
// 无刷新更新 表格数据
|
||||
crudRoles.get(this.currentId).then(res => {
|
||||
for (let i = 0; i < this.crud.data.length; i++) {
|
||||
if (res.menu_id === this.crud.data[i].menu_id) {
|
||||
this.crud.data[i] = res
|
||||
break
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style rel="stylesheet/scss" lang="scss">
|
||||
.role-span {
|
||||
font-weight: bold;
|
||||
color: #303133;
|
||||
font-size: 15px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
::v-deep .el-input-number .el-input__inner {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
::v-deep .el-card__header {
|
||||
padding: 5px 0 5px 10px;
|
||||
background-color: #f8f8f9;
|
||||
}
|
||||
|
||||
::v-deep .el-card__body {
|
||||
padding: 10px 0 10px 0;
|
||||
}
|
||||
</style>
|
||||
57
mes/qd/src/views/wms/device_manage/userDeviceReplate/role.js
Normal file
57
mes/qd/src/views/wms/device_manage/userDeviceReplate/role.js
Normal file
@@ -0,0 +1,57 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 获取所有的Role
|
||||
export function getAll() {
|
||||
return request({
|
||||
url: 'api/sysRole/all',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: 'api/sysRole',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function get(id) {
|
||||
return request({
|
||||
url: 'api/sysRole/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function getLevel() {
|
||||
return request({
|
||||
url: 'api/sysRole/level',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function del(ids) {
|
||||
return request({
|
||||
url: 'api/sysRole',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
export function edit(data) {
|
||||
return request({
|
||||
url: 'api/sysRole',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function editMenu(data) {
|
||||
return request({
|
||||
url: 'api/sysRole/menu',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, get, editMenu, getLevel }
|
||||
Reference in New Issue
Block a user