add 驱动代码
This commit is contained in:
@@ -421,10 +421,16 @@ public class CartonLabelingMachineDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
String psdigits = null;
|
||||
Integer psdigits1 = 0;
|
||||
if (customer.contains("晶科")) {
|
||||
psletters = bottle_number.substring(0, 18);
|
||||
psdigits = bottle_number.substring(18, 23);
|
||||
psletters = bottle_number.substring(0, 20);
|
||||
psdigits = bottle_number.substring(20, 23);
|
||||
psdigits1 = Integer.parseInt(psdigits) - fbottle_number1;
|
||||
|
||||
if(psdigits1>100){
|
||||
psdigits=String.valueOf(psdigits1);
|
||||
}else if(psdigits1>=10){
|
||||
psdigits="0"+ psdigits1;
|
||||
}else if(psdigits1>0&&psdigits1<10){
|
||||
psdigits="00"+ psdigits1;
|
||||
}
|
||||
}
|
||||
if (customer.contains("晶澳")) {
|
||||
psletters = bottle_number.substring(0, bottle_number.length() - 5);
|
||||
@@ -459,12 +465,12 @@ public class CartonLabelingMachineDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
JSONObject options = printElement.getJSONObject("options");
|
||||
if (options.containsKey("testData")) {
|
||||
if (options.get("title").equals("晶科二维码")) {
|
||||
String number1 = psletters + psdigits1;
|
||||
String number1 = psletters + psdigits;
|
||||
options.put("testData", number1);
|
||||
options.put("title", "");
|
||||
printElement.put("options", options);
|
||||
} else if (options.get("testData").equals("瓶号")) {
|
||||
String number1 = psletters + psdigits1;
|
||||
String number1 = psletters + psdigits;
|
||||
options.put("title", number1);
|
||||
printElement.put("options", options);
|
||||
} else if (options.get("testData").equals("晶澳瓶号")) {
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
package org.nl.system.controller.material;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.system.service.material.MdBaseMaterialService;
|
||||
import org.nl.system.service.material.dto.MdBaseMaterial;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.annotation.MultipartConfig;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@MultipartConfig
|
||||
@RequestMapping("/api/mdBaseMaterial")
|
||||
public class MaterialController {
|
||||
@Autowired
|
||||
MdBaseMaterialService materialService;
|
||||
@GetMapping
|
||||
@Log("查询物料基础信息")
|
||||
//@SaCheckPermission("@el.check('mdBaseMaterial:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page){
|
||||
return new ResponseEntity<>(TableDataInfo.build(materialService.queryAll(whereJson,page)), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增物料基础信息")
|
||||
//@SaCheckPermission("@el.check('mdBaseMaterial:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody MdBaseMaterial entity){
|
||||
materialService.create(entity);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改物料基础信息")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody MdBaseMaterial entity){
|
||||
materialService.update(entity);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除物料基础信息")
|
||||
//@SaCheckPermission("@el.check('mdBaseMaterial:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) {
|
||||
materialService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("/excelImport")
|
||||
@Log("excel导入")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> excelImport(@RequestParam("file") MultipartFile file) {
|
||||
HttpServletRequest request = ((ServletRequestAttributes) (RequestContextHolder.currentRequestAttributes())).getRequest();
|
||||
materialService.excelImport(file, request);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
@Log("导出眉山通威报表")
|
||||
@GetMapping(value = "/doExport")
|
||||
public void doExport(HttpServletResponse response) throws IOException {
|
||||
materialService.doExport(response);
|
||||
}
|
||||
@Log("导出晶科报表")
|
||||
@GetMapping(value = "/doExport1")
|
||||
public void doExport1(HttpServletResponse response) throws IOException {
|
||||
materialService.doExport1(response);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package org.nl.system.service.material;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.system.service.material.dto.MdBaseMaterial;
|
||||
import org.nl.system.service.tickets.dto.TicketsDto;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
public interface MdBaseMaterialService extends IService<MdBaseMaterial> {
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param whereJson 条件
|
||||
* @param pageable 分页参数
|
||||
* @return IPage<MdBaseMaterial>
|
||||
*/
|
||||
IPage<MdBaseMaterial> queryAll(Map whereJson, PageQuery pageable);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param entity /
|
||||
*/
|
||||
void create(MdBaseMaterial entity);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param entity /
|
||||
*/
|
||||
void update(MdBaseMaterial entity);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Set<String> ids);
|
||||
|
||||
/**
|
||||
* excel导入
|
||||
* @param file
|
||||
* @param request
|
||||
*/
|
||||
void excelImport(MultipartFile file, HttpServletRequest request);
|
||||
|
||||
|
||||
void doExport(HttpServletResponse response) throws IOException;
|
||||
|
||||
void doExport1(HttpServletResponse response) throws IOException;
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
package org.nl.system.service.material.dto;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("md_base_material")
|
||||
public class MdBaseMaterial {
|
||||
/**
|
||||
* 物料标识
|
||||
*/
|
||||
@TableId(type = IdType.NONE)
|
||||
private String material_id;
|
||||
/**
|
||||
* 客户
|
||||
*/
|
||||
private String customer;
|
||||
|
||||
/**
|
||||
* 大型号
|
||||
*/
|
||||
private String large_model;
|
||||
/**
|
||||
* 小型号
|
||||
*/
|
||||
private String small_model;
|
||||
/**
|
||||
* 实发型号
|
||||
*/
|
||||
private String production_materials;
|
||||
/**
|
||||
* 实发批次
|
||||
*/
|
||||
private String actual_batch;
|
||||
/**
|
||||
* 批次号
|
||||
*
|
||||
*/
|
||||
private String batch_number;
|
||||
/**
|
||||
* 库存数量
|
||||
*
|
||||
*/
|
||||
private String inventory_qty;
|
||||
/**
|
||||
* 当天生产
|
||||
*
|
||||
*/
|
||||
private String product_qty;
|
||||
/**
|
||||
* 重量
|
||||
*
|
||||
*/
|
||||
private String weight;
|
||||
/**
|
||||
* 瓶身号
|
||||
*
|
||||
*/
|
||||
private String bottle_number;
|
||||
/**
|
||||
* 纸箱号
|
||||
*
|
||||
*/
|
||||
private String carton_number;
|
||||
/**
|
||||
* 纸箱装瓶数量
|
||||
*
|
||||
*/
|
||||
private String carton_qty;
|
||||
/**
|
||||
* 总罐数
|
||||
*
|
||||
*/
|
||||
private String sum_qty;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
private Boolean is_used;
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private Boolean is_delete;
|
||||
/**
|
||||
* 修改者
|
||||
*/
|
||||
private String update_name;
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
private String create_name;
|
||||
/**
|
||||
* 送货单号
|
||||
*/
|
||||
private String shdnumber;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private String create_time;
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private String update_time;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package org.nl.system.service.material.dto;
|
||||
|
||||
import lombok.*;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class MdBaseMaterialDto {
|
||||
private String material_id;
|
||||
private String customer;
|
||||
private String large_model;
|
||||
private String small_model;
|
||||
private String remark;
|
||||
private String production_materials;
|
||||
private String actual_batch;
|
||||
private String batch_number;
|
||||
private String inventory_qty;
|
||||
private String product_qty;
|
||||
private String weight;
|
||||
private String bottle_number;
|
||||
private String carton_number;
|
||||
private String carton_qty;
|
||||
private String sum_qty;
|
||||
private String shdnumber;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package org.nl.system.service.material.dto.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.nl.system.service.material.dto.MdBaseMaterial;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface MdBaseMaterialMapper extends BaseMapper<MdBaseMaterial> {
|
||||
//判断批次号和实发批次是否重复
|
||||
MdBaseMaterial isbatch(String batch_number,String actual_batch);
|
||||
//眉山通威物料信息
|
||||
List<MdBaseMaterial> mstwmaterials();
|
||||
//晶科物料信息
|
||||
List<MdBaseMaterial> jkmaterials();
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.nl.system.service.material.dto.mapper.MdBaseMaterialMapper">
|
||||
<select id="isbatch" resultType="org.nl.system.service.material.dto.MdBaseMaterial">
|
||||
SELECT *
|
||||
FROM `md_base_material`
|
||||
WHERE batch_number= #{batch_number}
|
||||
AND actual_batch= #{actual_batch}
|
||||
</select>
|
||||
<select id="mstwmaterials" resultType="org.nl.system.service.material.dto.MdBaseMaterial">
|
||||
SELECT *
|
||||
FROM `md_base_material`
|
||||
WHERE customer= '眉山通威'
|
||||
</select>
|
||||
<select id="jkmaterials" resultType="org.nl.system.service.material.dto.MdBaseMaterial">
|
||||
SELECT *
|
||||
FROM `md_base_material`
|
||||
WHERE customer LIKE ('%晶科%')
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,359 @@
|
||||
package org.nl.system.service.material.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 cn.hutool.poi.excel.ExcelReader;
|
||||
import cn.hutool.poi.excel.ExcelUtil;
|
||||
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 lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
import org.nl.acs.utils.ConvertUtil;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.FileUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.config.language.LangProcess;
|
||||
import org.nl.system.service.material.MdBaseMaterialService;
|
||||
import org.nl.system.service.material.dto.MdBaseMaterial;
|
||||
import org.nl.system.service.material.dto.MdBaseMaterialDto;
|
||||
import org.nl.system.service.material.dto.mapper.MdBaseMaterialMapper;
|
||||
import org.nl.system.service.tickets.dto.TicketsDto;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class MdBaseMaterialServiceImpl extends ServiceImpl<MdBaseMaterialMapper, MdBaseMaterial> implements MdBaseMaterialService {
|
||||
@Autowired
|
||||
private MdBaseMaterialMapper mdBaseMaterialMapper;
|
||||
@Override
|
||||
public IPage<MdBaseMaterial> queryAll(Map whereJson, PageQuery page) {
|
||||
Boolean is_used = ObjectUtil.isNotEmpty(whereJson.get("is_used"))
|
||||
? Boolean.valueOf(whereJson.get("is_used").toString()) : null;
|
||||
String customer = ObjectUtil.isNotEmpty(whereJson.get("customer"))
|
||||
? whereJson.get("customer").toString() : null;
|
||||
String production_materials = ObjectUtil.isNotEmpty(whereJson.get("production_materials"))
|
||||
? whereJson.get("production_materials").toString() : null;
|
||||
String actual_batch = ObjectUtil.isNotEmpty(whereJson.get("actual_batch"))
|
||||
? whereJson.get("actual_batch").toString() : null;
|
||||
String large_model = ObjectUtil.isNotEmpty(whereJson.get("large_model"))
|
||||
? whereJson.get("large_model").toString() : null;
|
||||
String small_model=ObjectUtil.isNotEmpty(whereJson.get("small_model"))
|
||||
? whereJson.get("small_model").toString() :null;
|
||||
String batch_number=ObjectUtil.isNotEmpty(whereJson.get("batch_number"))
|
||||
? whereJson.get("batch_number").toString() :null;
|
||||
LambdaQueryWrapper<MdBaseMaterial> lam = new LambdaQueryWrapper<>();
|
||||
lam.like(ObjectUtil.isNotEmpty(customer), MdBaseMaterial::getCustomer, customer)
|
||||
.eq(ObjectUtil.isNotEmpty(large_model), MdBaseMaterial::getLarge_model, large_model)
|
||||
.eq(ObjectUtil.isNotEmpty(production_materials), MdBaseMaterial::getProduction_materials, production_materials)
|
||||
.eq(ObjectUtil.isNotEmpty(actual_batch), MdBaseMaterial::getActual_batch, actual_batch)
|
||||
.eq(ObjectUtil.isNotEmpty(batch_number), MdBaseMaterial::getBatch_number, batch_number)
|
||||
.eq(ObjectUtil.isNotEmpty(is_used), MdBaseMaterial::getIs_used, is_used)
|
||||
.eq(ObjectUtil.isNotEmpty(small_model), MdBaseMaterial::getSmall_model, small_model);
|
||||
IPage<MdBaseMaterial> pages = new Page<>(page.getPage() + 1, page.getSize());
|
||||
mdBaseMaterialMapper.selectPage(pages, lam);
|
||||
return pages;
|
||||
}
|
||||
@Override
|
||||
public void create(MdBaseMaterial entity) {
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
entity.setMaterial_id(IdUtil.getSnowflake(1, 1).nextIdStr());
|
||||
entity.setCreate_name(nickName);
|
||||
entity.setCreate_time(now);
|
||||
entity.setUpdate_name(nickName);
|
||||
entity.setUpdate_time(now);
|
||||
mdBaseMaterialMapper.insert(entity);
|
||||
}
|
||||
@Override
|
||||
public void update(MdBaseMaterial entity) {
|
||||
MdBaseMaterial dto = mdBaseMaterialMapper.selectById(entity.getMaterial_id());
|
||||
if (dto == null) {
|
||||
throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
}
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
entity.setUpdate_name(nickName);
|
||||
entity.setUpdate_time(now);
|
||||
mdBaseMaterialMapper.updateById(entity);
|
||||
}
|
||||
@Override
|
||||
public void deleteAll(Set<String> ids) {
|
||||
// 真删除
|
||||
mdBaseMaterialMapper.deleteBatchIds(ids);
|
||||
}
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void excelImport(MultipartFile file, HttpServletRequest request) {
|
||||
if (file.isEmpty()) {
|
||||
throw new BadRequestException(LangProcess.msg("error_nullPoint"));
|
||||
}
|
||||
Long currentUserId = Long.valueOf(SecurityUtils.getCurrentUserId());
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
// 1.获取上传文件输入流
|
||||
InputStream inputStream = null;
|
||||
try {
|
||||
inputStream = file.getInputStream();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// WQLObject wo = WQLObject.getWQLObject("acs_device");
|
||||
|
||||
// 调用用 hutool 方法读取数据 默认调用第一个sheet
|
||||
ExcelReader excelReader = ExcelUtil.getReader(inputStream);
|
||||
// 从第二行开始获取数据 excelReader.read的结果是一个2纬的list,外层是行,内层是行对应的所有列
|
||||
List<List<Object>> read = excelReader.read(1, excelReader.getRowCount());
|
||||
|
||||
// 循环获取的数据
|
||||
for (int i = 0; i < read.size(); i++) {
|
||||
List list = read.get(i);
|
||||
JSONObject param = new JSONObject();
|
||||
String customer = list.get(1).toString();
|
||||
if(StrUtil.isBlank(customer)){
|
||||
continue;
|
||||
}
|
||||
String production_materials = list.get(2).toString();
|
||||
String actual_batch = list.get(3).toString();
|
||||
String inventory_qty=list.get(4).toString();
|
||||
String product_qty=list.get(5).toString();
|
||||
String large_model = list.get(9).toString();
|
||||
String small_model = list.get(10).toString();
|
||||
String batch_number = list.get(11).toString();
|
||||
String weight = list.get(12).toString();
|
||||
String remark = list.get(14).toString();
|
||||
String bottle_number=null;
|
||||
String carton_number=null;
|
||||
String shdnumber=list.get(17).toString();;
|
||||
try {
|
||||
bottle_number = list.get(18).toString();
|
||||
}catch (Exception var17){
|
||||
throw new BadRequestException("当前客户"+list.get(1).toString()+"所在行瓶盖号为空");
|
||||
}
|
||||
try {
|
||||
carton_number = list.get(19).toString();
|
||||
}catch (Exception var17){
|
||||
throw new BadRequestException("当前客户"+list.get(1).toString()+"所在行纸箱号为空");
|
||||
}
|
||||
String carton_qty=list.get(21).toString();
|
||||
String sum_qty=list.get(20).toString();
|
||||
MdBaseMaterial mdBaseMaterial=new MdBaseMaterial();
|
||||
// mdBaseMaterial=mdBaseMaterialMapper.isbatch(batch_number,actual_batch);
|
||||
// if(mdBaseMaterial!=null){
|
||||
// continue;
|
||||
// }
|
||||
param.put("material_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
param.put("customer",customer);
|
||||
param.put("production_materials",production_materials);
|
||||
param.put("actual_batch",actual_batch);
|
||||
param.put("inventory_qty",inventory_qty);
|
||||
param.put("product_qty",product_qty);
|
||||
param.put("large_model",large_model);
|
||||
param.put("small_model",small_model);
|
||||
param.put("batch_number",batch_number);
|
||||
param.put("weight",weight);
|
||||
param.put("remark",remark);
|
||||
param.put("shdnumber",shdnumber);
|
||||
param.put("bottle_number",bottle_number);
|
||||
param.put("carton_number",carton_number);
|
||||
param.put("carton_qty",carton_qty);
|
||||
param.put("sum_qty",sum_qty);
|
||||
MdBaseMaterial entity = ConvertUtil.convert(param, MdBaseMaterial.class);
|
||||
mdBaseMaterialMapper.insert(entity);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void doExport(HttpServletResponse response) throws IOException {
|
||||
List<MdBaseMaterial> mstwmaterials=mdBaseMaterialMapper.mstwmaterials();
|
||||
LocalDate currentDate = LocalDate.now();
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for(MdBaseMaterial MdBaseMaterial:mstwmaterials){
|
||||
//该批次数量
|
||||
Integer pznum=Integer.parseInt(MdBaseMaterial.getSum_qty());
|
||||
if(pznum==0){
|
||||
continue;
|
||||
}
|
||||
Integer carton_qty=Integer.parseInt(MdBaseMaterial.getCarton_qty());
|
||||
Integer real_carton_qty=0;
|
||||
Integer real_carton_number=0;//当前箱号
|
||||
// Integer zxnumber=pznum/carton_qty;
|
||||
String bottle_number=MdBaseMaterial.getBottle_number();
|
||||
String carton_number=MdBaseMaterial.getCarton_number();
|
||||
String large_model=MdBaseMaterial.getLarge_model();
|
||||
String small_model=MdBaseMaterial.getSmall_model();
|
||||
String batch_number=MdBaseMaterial.getBatch_number();
|
||||
Integer weishu=MdBaseMaterial.getSum_qty().length();
|
||||
String psletters = bottle_number.substring(0,4);
|
||||
String psdigits = bottle_number.substring(4,15);
|
||||
String year=bottle_number.substring(3,5);
|
||||
String month=bottle_number.substring(5,7);
|
||||
String day=bottle_number.substring(7,9);
|
||||
String zxletters = carton_number.replaceAll("\\d+$", ""); // 匹配并去掉末尾的数字
|
||||
String zxdigits = extractNumberAfterLastLetter(carton_number); // 匹配并取出末尾的数字部分
|
||||
//总纸箱数
|
||||
Integer sum_carton1 = (pznum+carton_qty-1)/carton_qty;
|
||||
for(int i=0;i<pznum;i++){
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
if(real_carton_qty<carton_qty){
|
||||
real_carton_qty++;
|
||||
}else{
|
||||
real_carton_qty=1;
|
||||
real_carton_number++;
|
||||
}
|
||||
Integer real_zxdigits2= Integer.parseInt(zxdigits)+real_carton_number;
|
||||
Integer real_zxdigits= Integer.parseInt(zxdigits)+real_carton_number-sum_carton1+1;
|
||||
String real_zxdigits1=null;
|
||||
if(real_zxdigits<=9){
|
||||
real_zxdigits1="0"+String.valueOf(real_zxdigits);
|
||||
}else{
|
||||
real_zxdigits1=String.valueOf(real_zxdigits);
|
||||
}
|
||||
map.put("箱号",zxletters+real_zxdigits1);
|
||||
// Integer real_psdigits=Integer.parseInt(psdigits)+i-pznum+1;
|
||||
Long real_psdigits=Long.valueOf(psdigits)+i-pznum+1;
|
||||
map.put("单枚号/瓶号/包号",psletters+real_psdigits);
|
||||
map.put("规格型号",large_model+"-"+small_model);
|
||||
map.put("批号",small_model+"-"+batch_number);
|
||||
map.put("数量","2");
|
||||
map.put("供应商","帝科");
|
||||
map.put("生产日期(yyyy/MM/dd)","20"+year+"/"+month+"/"+day);
|
||||
Integer month1=Integer.parseInt(month);
|
||||
month1=month1+6;
|
||||
if(month1>12){
|
||||
month1=month1-12;
|
||||
}
|
||||
map.put("有效日期(yyyy/MM/dd)","20"+year+"/"+month+"/"+day);
|
||||
// 获取当前日期
|
||||
LocalDate currentDate1 = LocalDate.now();
|
||||
|
||||
// 定义所需的日期格式
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy/MM/dd");
|
||||
|
||||
// 格式化当前日期
|
||||
String formattedDate = currentDate1.format(formatter);
|
||||
map.put("发货日期(yyyy/MM/dd)",formattedDate);
|
||||
list.add(map);
|
||||
}
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
@Override
|
||||
public void doExport1(HttpServletResponse response) throws IOException {
|
||||
List<MdBaseMaterial> jkmaterials=mdBaseMaterialMapper.jkmaterials();
|
||||
LocalDate currentDate = LocalDate.now();
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for(MdBaseMaterial MdBaseMaterial:jkmaterials){
|
||||
Integer pzweight=Integer.parseInt(MdBaseMaterial.getWeight());
|
||||
Integer pznum=Integer.parseInt(MdBaseMaterial.getSum_qty());
|
||||
if(pznum==0){
|
||||
continue;
|
||||
}
|
||||
|
||||
Integer carton_qty=Integer.parseInt(MdBaseMaterial.getCarton_qty());
|
||||
Integer real_carton_qty=0;
|
||||
Integer real_carton_number=0;//当前箱号
|
||||
//单重
|
||||
Integer wt=0;
|
||||
//整箱总重
|
||||
Integer wtsum=0;
|
||||
if(pzweight.equals(pznum)){
|
||||
wt=1;
|
||||
wtsum=wt*carton_qty;
|
||||
}else{
|
||||
wt=2;
|
||||
wtsum=wt*carton_qty;
|
||||
}
|
||||
// Integer zxnumber=pznum/carton_qty;
|
||||
String bottle_number=MdBaseMaterial.getBottle_number();
|
||||
String carton_number=MdBaseMaterial.getCarton_number();
|
||||
String large_model=MdBaseMaterial.getLarge_model();
|
||||
String small_model=MdBaseMaterial.getSmall_model();
|
||||
String batch_number=MdBaseMaterial.getBatch_number();
|
||||
String customer=MdBaseMaterial.getCustomer();
|
||||
String psletters = bottle_number.substring(0,20);
|
||||
String psdigits = bottle_number.substring(20,23);
|
||||
String zxletters = carton_number.substring(0,18);
|
||||
String zx1 = carton_number.substring(18,20);
|
||||
String zx2 = carton_number.substring(20,23);
|
||||
String zxdigits = carton_number.substring(23,33);
|
||||
//总纸箱数
|
||||
Integer sum_carton1 = (pznum+carton_qty-1)/carton_qty;
|
||||
for(int i=0;i<pznum;i++){
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
if(real_carton_qty<carton_qty){
|
||||
real_carton_qty++;
|
||||
}else{
|
||||
real_carton_qty=1;
|
||||
real_carton_number++;
|
||||
}
|
||||
Long real_zxdigits= Long.valueOf(zxdigits)+real_carton_number-sum_carton1+1;
|
||||
String real_zxdigits1=String.valueOf(real_zxdigits);
|
||||
if(i>(sum_carton1-1)*carton_qty-1) {
|
||||
map.put("托号(必填)", zxletters + zx1+zx2+real_zxdigits1);
|
||||
map.put("箱号(必填)", zxletters + zx1+zx2+real_zxdigits1);
|
||||
}else {
|
||||
if(wtsum>9) {
|
||||
map.put("托号(必填)", zxletters + wtsum + zx2 + real_zxdigits1);
|
||||
map.put("箱号(必填)", zxletters + wtsum + zx2 + real_zxdigits1);
|
||||
}else{
|
||||
map.put("托号(必填)", zxletters + "0" + wtsum + zx2 + real_zxdigits1);
|
||||
map.put("箱号(必填)", zxletters + "0" + wtsum + zx2 + real_zxdigits1);
|
||||
}
|
||||
}
|
||||
Integer real_psdigits=Integer.parseInt(psdigits)+i-pznum+1;
|
||||
if(real_psdigits>=100){
|
||||
map.put("包号(选填)",psletters+real_psdigits);
|
||||
} else if(real_psdigits>=10){
|
||||
map.put("包号(选填)",psletters+"0"+real_psdigits);
|
||||
}else if(real_psdigits>0){
|
||||
map.put("包号(选填)",psletters+"00"+real_psdigits);
|
||||
}
|
||||
if(wt==1){
|
||||
map.put("包实装货物数","1");
|
||||
}else if(wt==2){
|
||||
if(i==pznum-1&&pzweight % 2 == 1 ){
|
||||
map.put("包实装货物数","1");
|
||||
}
|
||||
else{
|
||||
map.put("包实装货物数","2");
|
||||
}
|
||||
}
|
||||
map.put("批号",small_model+"-"+batch_number);
|
||||
map.put("发运数量",String.valueOf(pzweight));
|
||||
map.put("客户",customer);
|
||||
list.add(map);
|
||||
}
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
public static String extractNumberAfterLastLetter(String input) {
|
||||
// 正则表达式:匹配最后一个字母后面的数字
|
||||
Pattern pattern = Pattern.compile("[a-zA-Z]([0-9]+)$");
|
||||
Matcher matcher = pattern.matcher(input);
|
||||
|
||||
if (matcher.find()) {
|
||||
return matcher.group(1); // 返回匹配的数字部分
|
||||
}
|
||||
|
||||
return ""; // 如果没有匹配到数字,返回空字符串
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<included>
|
||||
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
|
||||
<property name="LOG_HOME" value="${logPath}"/>
|
||||
<!--<define name="DEVICECODE" class="org.nl.common.logging.DeviceCodeDir"/>-->
|
||||
<!-- 按照每天生成日志文件 -->
|
||||
<appender name="FILE_ComPortUtil" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<!--日志文件输出的文件名-->
|
||||
<FileNamePattern>${LOG_HOME}/ComPortUtil/${DEVICECODE}/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
|
||||
<!--日志文件保留天数-->
|
||||
<maxHistory>15</maxHistory>
|
||||
<!--单个日志最大容量 至少10MB才能看得出来-->
|
||||
<maxFileSize>200MB</maxFileSize>
|
||||
<!--所有日志最多占多大容量-->
|
||||
<totalSizeCap>2GB</totalSizeCap>
|
||||
</rollingPolicy>
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
|
||||
<charset>${log.charset}</charset>
|
||||
</encoder>
|
||||
|
||||
</appender>
|
||||
|
||||
<!-- <logger name="org.nl.start.Init" level="info" additivity="false">
|
||||
<appender-ref ref="FILE3"/>
|
||||
</logger>-->
|
||||
|
||||
<!-- 打印sql -->
|
||||
<logger name="org.nl.common.utils.ComPortUtil" level="info" additivity="false">
|
||||
<appender-ref ref="FILE_ComPortUtil"/>
|
||||
</logger>
|
||||
</included>
|
||||
47
acs/nladmin-ui/src/api/acs/order/mdBaseMaterial.js
Normal file
47
acs/nladmin-ui/src/api/acs/order/mdBaseMaterial.js
Normal file
@@ -0,0 +1,47 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: 'api/mdBaseMaterial',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function del(ids) {
|
||||
return request({
|
||||
url: 'api/mdBaseMaterial/',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
export function edit(data) {
|
||||
return request({
|
||||
url: 'api/mdBaseMaterial',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function synchronize(data) {
|
||||
return request({
|
||||
url: 'api/mdBaseMaterial/synchronize',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
export function excelImport(data) {
|
||||
return request({
|
||||
url: 'api/mdBaseMaterial/excelImport',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
export function doExport() {
|
||||
return request({
|
||||
url: 'api/mdBaseMaterial/doExport',
|
||||
method: 'post',
|
||||
})
|
||||
}
|
||||
export default { add, edit, del, synchronize ,excelImport ,doExport }
|
||||
@@ -0,0 +1,507 @@
|
||||
<template>
|
||||
<!--纸箱贴标机-->
|
||||
<div>
|
||||
<el-card class="box-card" shadow="never">
|
||||
<div slot="header" class="clearfix">
|
||||
<span class="role-span">设备协议:</span>
|
||||
</div>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
OpcServer:
|
||||
<el-select
|
||||
v-model="opc_id"
|
||||
placeholder="无"
|
||||
clearable
|
||||
filterable
|
||||
@change="changeOpc"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dataOpcservers"
|
||||
:key="item.opc_id"
|
||||
:label="item.opc_name"
|
||||
:value="item.opc_id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
PLC:
|
||||
<el-select
|
||||
v-model="plc_id"
|
||||
placeholder="无"
|
||||
clearable
|
||||
filterable
|
||||
@change="changePlc"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dataOpcPlcs"
|
||||
:key="item.plc_id"
|
||||
:label="item.plc_name"
|
||||
:value="item.plc_id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
</el-card>
|
||||
|
||||
<el-card class="box-card" shadow="never">
|
||||
<div slot="header" class="clearfix">
|
||||
<span class="role-span">输送系统:</span>
|
||||
</div>
|
||||
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="电气调度号" label-width="150px">
|
||||
<el-input v-model="form.address" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card class="box-card" shadow="never">
|
||||
<div slot="header" class="clearfix">
|
||||
<span class="role-span">指令相关:</span>
|
||||
</div>
|
||||
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="检验有货">
|
||||
<el-switch v-model="form.inspect_in_stocck" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="取货校验" label-width="150px">
|
||||
<el-switch v-model="form.ignore_pickup_check" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="放货校验" label-width="150px">
|
||||
<el-switch v-model="form.ignore_release_check" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="呼叫">
|
||||
<el-switch v-model="form.apply_task" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="响应" label-width="150px">
|
||||
<el-switch v-model="form.manual_create_task" />
|
||||
</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.link_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-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="关联三色灯" prop="device_code" label-width="100px">
|
||||
<el-select
|
||||
v-model="form.link_three_lamp"
|
||||
filterable
|
||||
clearable
|
||||
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-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="是否输入物料" label-width="150px">
|
||||
<el-switch v-model="form.input_material" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card class="box-card" shadow="never">
|
||||
<div slot="header" class="clearfix">
|
||||
<span class="role-span">AGV相关:</span>
|
||||
</div>
|
||||
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="取货">
|
||||
<el-switch v-model="form.is_pickup" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="放货">
|
||||
<el-switch v-model="form.is_release" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card class="box-card" shadow="never">
|
||||
<div slot="header" class="clearfix">
|
||||
<span class="role-span">PLC读取字段:</span>
|
||||
</div>
|
||||
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
|
||||
<el-table
|
||||
v-loading="false"
|
||||
:data="data1"
|
||||
:max-height="550"
|
||||
size="small"
|
||||
style="width: 100%;margin-bottom: 15px"
|
||||
>
|
||||
|
||||
<el-table-column prop="name" label="用途" />
|
||||
<el-table-column prop="code" label="别名要求" />
|
||||
<el-table-column prop="db" label="DB块">
|
||||
<template slot-scope="scope">
|
||||
<el-input
|
||||
v-model="data1[scope.$index].db"
|
||||
size="mini"
|
||||
class="edit-input"
|
||||
@input="finishReadEdit(data1[scope.$index])"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="dbr_value">
|
||||
<template slot="header">
|
||||
<el-link type="primary" :underline="false" @click.native="test_read1()">测试读</el-link>
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="data1[scope.$index].dbr_value" size="mini" class="edit-input" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card class="box-card" shadow="never">
|
||||
<div slot="header" class="clearfix">
|
||||
<span class="role-span">PLC写入字段:</span>
|
||||
</div>
|
||||
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
|
||||
<el-table
|
||||
v-loading="false"
|
||||
:data="data2"
|
||||
:max-height="550"
|
||||
size="small"
|
||||
style="width: 100%;margin-bottom: 15px"
|
||||
>
|
||||
|
||||
<el-table-column prop="name" label="用途" />
|
||||
<el-table-column prop="code" label="别名要求" />
|
||||
<el-table-column prop="db" label="DB块">
|
||||
<template slot-scope="scope">
|
||||
<el-input
|
||||
v-model="data2[scope.$index].db"
|
||||
size="mini"
|
||||
class="edit-input"
|
||||
@input="finishWriteEdit(data2[scope.$index])"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="dbr_value2">
|
||||
<template slot="header">
|
||||
<el-link type="primary" :underline="false" @click.native="test_read2()">测试读</el-link>
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="data2[scope.$index].dbr_value" size="mini" class="edit-input" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="dbw_value">
|
||||
<template slot="header">
|
||||
<el-link type="primary" :underline="false" @click.native="test_write1()">测试写</el-link>
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="data2[scope.$index].dbw_value" size="mini" class="edit-input" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card class="box-card" shadow="never">
|
||||
<div slot="header" class="clearfix">
|
||||
<span class="role-span" />
|
||||
<el-button
|
||||
:loading="false"
|
||||
icon="el-icon-check"
|
||||
size="mini"
|
||||
style="float: right; padding: 6px 9px"
|
||||
type="primary"
|
||||
@click="doSubmit"
|
||||
>保存
|
||||
</el-button>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
queryDriverConfig,
|
||||
updateConfig,
|
||||
testRead,
|
||||
testwrite
|
||||
} from '@/api/acs/device/driverConfig'
|
||||
import { selectOpcList } from '@/api/acs/device/opc'
|
||||
import { selectPlcList } from '@/api/acs/device/opcPlc'
|
||||
import { selectListByOpcID } from '@/api/acs/device/opcPlc'
|
||||
|
||||
import crud from '@/mixins/crud'
|
||||
import deviceCrud from '@/api/acs/device/device'
|
||||
|
||||
export default {
|
||||
name: 'PlugPullDeviceSite',
|
||||
mixins: [crud],
|
||||
props: {
|
||||
parentForm: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
device_code: '',
|
||||
device_id: '',
|
||||
plc_id: '',
|
||||
plc_code: '',
|
||||
opc_id: '',
|
||||
opc_code: '',
|
||||
configLoading: false,
|
||||
dataOpcservers: [],
|
||||
dataOpcPlcs: [],
|
||||
deviceList: [],
|
||||
data1: [],
|
||||
data2: [],
|
||||
form: {
|
||||
inspect_in_stocck: true,
|
||||
ignore_pickup_check: true,
|
||||
ignore_release_check: true,
|
||||
apply_task: true,
|
||||
link_three_lamp: '',
|
||||
manual_create_task: true,
|
||||
is_pickup: true,
|
||||
is_release: true,
|
||||
link_device_code: [],
|
||||
address: ''
|
||||
},
|
||||
rules: {}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.$nextTick(() => {
|
||||
// 从父表单获取设备编码
|
||||
this.device_id = this.$props.parentForm.device_id
|
||||
this.device_code = this.$props.parentForm.device_code
|
||||
queryDriverConfig(this.device_id, this.$props.parentForm.driver_code).then(data => {
|
||||
// 给表单赋值,并且属性不能为空
|
||||
if (data.form) {
|
||||
const arr = Object.keys(data.form)
|
||||
// 不为空
|
||||
if (arr.length > 0) {
|
||||
this.form = data.form
|
||||
}
|
||||
}
|
||||
|
||||
// 给表单赋值,并且属性不能为空
|
||||
if (data.parentForm) {
|
||||
const arr = Object.keys(data.parentForm)
|
||||
// 不为空
|
||||
if (arr.length > 0) {
|
||||
this.opc_code = data.parentForm.opc_code
|
||||
this.plc_code = data.parentForm.plc_code
|
||||
}
|
||||
}
|
||||
this.data1 = data.rs
|
||||
this.data2 = data.ws
|
||||
this.sliceItem()
|
||||
})
|
||||
selectPlcList().then(data => {
|
||||
this.dataOpcPlcs = data
|
||||
this.plc_id = this.$props.parentForm.opc_plc_id
|
||||
})
|
||||
selectOpcList().then(data => {
|
||||
this.dataOpcservers = data
|
||||
this.opc_id = this.$props.parentForm.opc_server_id
|
||||
})
|
||||
deviceCrud.selectDeviceList().then(data => {
|
||||
this.deviceList = data
|
||||
})
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
finishReadEdit(data) {
|
||||
// 编辑的是code列,并且值包含mode
|
||||
if (data.code.indexOf('mode') !== -1) {
|
||||
debugger
|
||||
const dbValue = data.db
|
||||
// .之前的字符串
|
||||
const beforeStr = dbValue.match(/(\S*)\./)[1]
|
||||
// .之后的字符串
|
||||
const afterStr = dbValue.match(/\.(\S*)/)[1]
|
||||
// 取最后数字
|
||||
const endNumber = afterStr.substring(1)
|
||||
// 最后为非数字
|
||||
if (isNaN(parseInt(endNumber))) {
|
||||
return
|
||||
}
|
||||
for (const val in this.data1) {
|
||||
if (this.data1[val].code.indexOf('move') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 1)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('error') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 5)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('task') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 7)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
finishWriteEdit(data) {
|
||||
// 编辑的是code列,并且值包含mode
|
||||
if (data.code.indexOf('to_command') !== -1) {
|
||||
const dbValue = data.db
|
||||
// .之前的字符串
|
||||
const beforeStr = dbValue.match(/(\S*)\./)[1]
|
||||
// .之后的字符串
|
||||
const afterStr = dbValue.match(/\.(\S*)/)[1]
|
||||
// 取最后数字
|
||||
const endNumber = afterStr.substring(1)
|
||||
// 最后为非数字
|
||||
if (isNaN(parseInt(endNumber))) {
|
||||
return
|
||||
}
|
||||
for (const val in this.data2) {
|
||||
if (this.data2[val].code.indexOf('to_target') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 2)
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_task') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 6)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
changeOpc(val) {
|
||||
this.dataOpcservers.forEach(item => {
|
||||
if (item.opc_id === val) {
|
||||
this.opc_code = item.opc_code
|
||||
}
|
||||
})
|
||||
|
||||
selectListByOpcID(val).then(data => {
|
||||
this.dataOpcPlcs = data
|
||||
this.plc_id = ''
|
||||
this.plc_code = ''
|
||||
if (this.dataOpcPlcs && this.dataOpcPlcs.length > 0) {
|
||||
this.plc_id = this.dataOpcPlcs[0].plc_id
|
||||
this.plc_code = this.dataOpcPlcs[0].plc_code
|
||||
}
|
||||
this.sliceItem()
|
||||
})
|
||||
},
|
||||
changePlc(val) {
|
||||
this.dataOpcPlcs.forEach(item => {
|
||||
if (item.plc_id === val) {
|
||||
this.plc_code = item.plc_code
|
||||
this.sliceItem()
|
||||
return
|
||||
}
|
||||
})
|
||||
},
|
||||
test_read1() {
|
||||
testRead(this.data1, this.opc_id).then(data => {
|
||||
this.data1 = data
|
||||
this.notify('操作成功!', 'success')
|
||||
}).catch(err => {
|
||||
console.log(err.response.data.message)
|
||||
})
|
||||
},
|
||||
test_read2() {
|
||||
testRead(this.data2, this.opc_id).then(data => {
|
||||
this.data2 = data
|
||||
console.log(this.data2)
|
||||
this.notify('操作成功!', 'success')
|
||||
}).catch(err => {
|
||||
console.log(err.response.data.message)
|
||||
})
|
||||
},
|
||||
test_write1() {
|
||||
testwrite(this.data2, this.opc_id).then(data => {
|
||||
this.notify('操作成功!', 'success')
|
||||
}).catch(err => {
|
||||
console.log(err.response.data.message)
|
||||
})
|
||||
},
|
||||
doSubmit() {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.configLoading = true
|
||||
// 根据驱动类型判断是否为路由设备
|
||||
const parentForm = this.parentForm
|
||||
parentForm.is_route = true
|
||||
parentForm.plc_id = this.plc_id
|
||||
parentForm.opc_id = this.opc_id
|
||||
updateConfig(parentForm, this.form, this.data1, this.data2).then(res => {
|
||||
this.notify('保存成功', 'success')
|
||||
this.configLoading = false
|
||||
}).catch(err => {
|
||||
this.configLoading = false
|
||||
console.log(err.response.data.message)
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
sliceItem() { // 拼接DB的Item值
|
||||
this.data1.forEach(item => {
|
||||
const str = item.code
|
||||
// 是否包含.
|
||||
if (str.search('.') !== -1) {
|
||||
// 截取最后一位
|
||||
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + str.slice(str.lastIndexOf('.') + 1)
|
||||
} else {
|
||||
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + item.code
|
||||
}
|
||||
})
|
||||
this.data2.forEach(item => {
|
||||
const str = item.code
|
||||
// 是否包含.
|
||||
if (str.search('.') !== -1) {
|
||||
// 截取最后一位
|
||||
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + str.slice(str.lastIndexOf('.') + 1)
|
||||
} else {
|
||||
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + item.code
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
507
acs/nladmin-ui/src/views/acs/device/driver/primary_device.vue
Normal file
507
acs/nladmin-ui/src/views/acs/device/driver/primary_device.vue
Normal file
@@ -0,0 +1,507 @@
|
||||
<template>
|
||||
<!--主PLC-->
|
||||
<div>
|
||||
<el-card class="box-card" shadow="never">
|
||||
<div slot="header" class="clearfix">
|
||||
<span class="role-span">设备协议:</span>
|
||||
</div>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
OpcServer:
|
||||
<el-select
|
||||
v-model="opc_id"
|
||||
placeholder="无"
|
||||
clearable
|
||||
filterable
|
||||
@change="changeOpc"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dataOpcservers"
|
||||
:key="item.opc_id"
|
||||
:label="item.opc_name"
|
||||
:value="item.opc_id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
PLC:
|
||||
<el-select
|
||||
v-model="plc_id"
|
||||
placeholder="无"
|
||||
clearable
|
||||
filterable
|
||||
@change="changePlc"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dataOpcPlcs"
|
||||
:key="item.plc_id"
|
||||
:label="item.plc_name"
|
||||
:value="item.plc_id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
</el-card>
|
||||
|
||||
<el-card class="box-card" shadow="never">
|
||||
<div slot="header" class="clearfix">
|
||||
<span class="role-span">输送系统:</span>
|
||||
</div>
|
||||
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="电气调度号" label-width="150px">
|
||||
<el-input v-model="form.address" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card class="box-card" shadow="never">
|
||||
<div slot="header" class="clearfix">
|
||||
<span class="role-span">指令相关:</span>
|
||||
</div>
|
||||
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="检验有货">
|
||||
<el-switch v-model="form.inspect_in_stocck" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="取货校验" label-width="150px">
|
||||
<el-switch v-model="form.ignore_pickup_check" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="放货校验" label-width="150px">
|
||||
<el-switch v-model="form.ignore_release_check" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="呼叫">
|
||||
<el-switch v-model="form.apply_task" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="响应" label-width="150px">
|
||||
<el-switch v-model="form.manual_create_task" />
|
||||
</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.link_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-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="关联三色灯" prop="device_code" label-width="100px">
|
||||
<el-select
|
||||
v-model="form.link_three_lamp"
|
||||
filterable
|
||||
clearable
|
||||
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-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="是否输入物料" label-width="150px">
|
||||
<el-switch v-model="form.input_material" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card class="box-card" shadow="never">
|
||||
<div slot="header" class="clearfix">
|
||||
<span class="role-span">AGV相关:</span>
|
||||
</div>
|
||||
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="取货">
|
||||
<el-switch v-model="form.is_pickup" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="放货">
|
||||
<el-switch v-model="form.is_release" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card class="box-card" shadow="never">
|
||||
<div slot="header" class="clearfix">
|
||||
<span class="role-span">PLC读取字段:</span>
|
||||
</div>
|
||||
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
|
||||
<el-table
|
||||
v-loading="false"
|
||||
:data="data1"
|
||||
:max-height="550"
|
||||
size="small"
|
||||
style="width: 100%;margin-bottom: 15px"
|
||||
>
|
||||
|
||||
<el-table-column prop="name" label="用途" />
|
||||
<el-table-column prop="code" label="别名要求" />
|
||||
<el-table-column prop="db" label="DB块">
|
||||
<template slot-scope="scope">
|
||||
<el-input
|
||||
v-model="data1[scope.$index].db"
|
||||
size="mini"
|
||||
class="edit-input"
|
||||
@input="finishReadEdit(data1[scope.$index])"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="dbr_value">
|
||||
<template slot="header">
|
||||
<el-link type="primary" :underline="false" @click.native="test_read1()">测试读</el-link>
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="data1[scope.$index].dbr_value" size="mini" class="edit-input" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card class="box-card" shadow="never">
|
||||
<div slot="header" class="clearfix">
|
||||
<span class="role-span">PLC写入字段:</span>
|
||||
</div>
|
||||
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
|
||||
<el-table
|
||||
v-loading="false"
|
||||
:data="data2"
|
||||
:max-height="550"
|
||||
size="small"
|
||||
style="width: 100%;margin-bottom: 15px"
|
||||
>
|
||||
|
||||
<el-table-column prop="name" label="用途" />
|
||||
<el-table-column prop="code" label="别名要求" />
|
||||
<el-table-column prop="db" label="DB块">
|
||||
<template slot-scope="scope">
|
||||
<el-input
|
||||
v-model="data2[scope.$index].db"
|
||||
size="mini"
|
||||
class="edit-input"
|
||||
@input="finishWriteEdit(data2[scope.$index])"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="dbr_value2">
|
||||
<template slot="header">
|
||||
<el-link type="primary" :underline="false" @click.native="test_read2()">测试读</el-link>
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="data2[scope.$index].dbr_value" size="mini" class="edit-input" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="dbw_value">
|
||||
<template slot="header">
|
||||
<el-link type="primary" :underline="false" @click.native="test_write1()">测试写</el-link>
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="data2[scope.$index].dbw_value" size="mini" class="edit-input" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card class="box-card" shadow="never">
|
||||
<div slot="header" class="clearfix">
|
||||
<span class="role-span" />
|
||||
<el-button
|
||||
:loading="false"
|
||||
icon="el-icon-check"
|
||||
size="mini"
|
||||
style="float: right; padding: 6px 9px"
|
||||
type="primary"
|
||||
@click="doSubmit"
|
||||
>保存
|
||||
</el-button>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
queryDriverConfig,
|
||||
updateConfig,
|
||||
testRead,
|
||||
testwrite
|
||||
} from '@/api/acs/device/driverConfig'
|
||||
import { selectOpcList } from '@/api/acs/device/opc'
|
||||
import { selectPlcList } from '@/api/acs/device/opcPlc'
|
||||
import { selectListByOpcID } from '@/api/acs/device/opcPlc'
|
||||
|
||||
import crud from '@/mixins/crud'
|
||||
import deviceCrud from '@/api/acs/device/device'
|
||||
|
||||
export default {
|
||||
name: 'PlugPullDeviceSite',
|
||||
mixins: [crud],
|
||||
props: {
|
||||
parentForm: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
device_code: '',
|
||||
device_id: '',
|
||||
plc_id: '',
|
||||
plc_code: '',
|
||||
opc_id: '',
|
||||
opc_code: '',
|
||||
configLoading: false,
|
||||
dataOpcservers: [],
|
||||
dataOpcPlcs: [],
|
||||
deviceList: [],
|
||||
data1: [],
|
||||
data2: [],
|
||||
form: {
|
||||
inspect_in_stocck: true,
|
||||
ignore_pickup_check: true,
|
||||
ignore_release_check: true,
|
||||
apply_task: true,
|
||||
link_three_lamp: '',
|
||||
manual_create_task: true,
|
||||
is_pickup: true,
|
||||
is_release: true,
|
||||
link_device_code: [],
|
||||
address: ''
|
||||
},
|
||||
rules: {}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.$nextTick(() => {
|
||||
// 从父表单获取设备编码
|
||||
this.device_id = this.$props.parentForm.device_id
|
||||
this.device_code = this.$props.parentForm.device_code
|
||||
queryDriverConfig(this.device_id, this.$props.parentForm.driver_code).then(data => {
|
||||
// 给表单赋值,并且属性不能为空
|
||||
if (data.form) {
|
||||
const arr = Object.keys(data.form)
|
||||
// 不为空
|
||||
if (arr.length > 0) {
|
||||
this.form = data.form
|
||||
}
|
||||
}
|
||||
|
||||
// 给表单赋值,并且属性不能为空
|
||||
if (data.parentForm) {
|
||||
const arr = Object.keys(data.parentForm)
|
||||
// 不为空
|
||||
if (arr.length > 0) {
|
||||
this.opc_code = data.parentForm.opc_code
|
||||
this.plc_code = data.parentForm.plc_code
|
||||
}
|
||||
}
|
||||
this.data1 = data.rs
|
||||
this.data2 = data.ws
|
||||
this.sliceItem()
|
||||
})
|
||||
selectPlcList().then(data => {
|
||||
this.dataOpcPlcs = data
|
||||
this.plc_id = this.$props.parentForm.opc_plc_id
|
||||
})
|
||||
selectOpcList().then(data => {
|
||||
this.dataOpcservers = data
|
||||
this.opc_id = this.$props.parentForm.opc_server_id
|
||||
})
|
||||
deviceCrud.selectDeviceList().then(data => {
|
||||
this.deviceList = data
|
||||
})
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
finishReadEdit(data) {
|
||||
// 编辑的是code列,并且值包含mode
|
||||
if (data.code.indexOf('mode') !== -1) {
|
||||
debugger
|
||||
const dbValue = data.db
|
||||
// .之前的字符串
|
||||
const beforeStr = dbValue.match(/(\S*)\./)[1]
|
||||
// .之后的字符串
|
||||
const afterStr = dbValue.match(/\.(\S*)/)[1]
|
||||
// 取最后数字
|
||||
const endNumber = afterStr.substring(1)
|
||||
// 最后为非数字
|
||||
if (isNaN(parseInt(endNumber))) {
|
||||
return
|
||||
}
|
||||
for (const val in this.data1) {
|
||||
if (this.data1[val].code.indexOf('move') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 1)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('error') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 5)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('task') !== -1) {
|
||||
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 7)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
finishWriteEdit(data) {
|
||||
// 编辑的是code列,并且值包含mode
|
||||
if (data.code.indexOf('to_command') !== -1) {
|
||||
const dbValue = data.db
|
||||
// .之前的字符串
|
||||
const beforeStr = dbValue.match(/(\S*)\./)[1]
|
||||
// .之后的字符串
|
||||
const afterStr = dbValue.match(/\.(\S*)/)[1]
|
||||
// 取最后数字
|
||||
const endNumber = afterStr.substring(1)
|
||||
// 最后为非数字
|
||||
if (isNaN(parseInt(endNumber))) {
|
||||
return
|
||||
}
|
||||
for (const val in this.data2) {
|
||||
if (this.data2[val].code.indexOf('to_target') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 2)
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_task') !== -1) {
|
||||
this.data2[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 6)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
changeOpc(val) {
|
||||
this.dataOpcservers.forEach(item => {
|
||||
if (item.opc_id === val) {
|
||||
this.opc_code = item.opc_code
|
||||
}
|
||||
})
|
||||
|
||||
selectListByOpcID(val).then(data => {
|
||||
this.dataOpcPlcs = data
|
||||
this.plc_id = ''
|
||||
this.plc_code = ''
|
||||
if (this.dataOpcPlcs && this.dataOpcPlcs.length > 0) {
|
||||
this.plc_id = this.dataOpcPlcs[0].plc_id
|
||||
this.plc_code = this.dataOpcPlcs[0].plc_code
|
||||
}
|
||||
this.sliceItem()
|
||||
})
|
||||
},
|
||||
changePlc(val) {
|
||||
this.dataOpcPlcs.forEach(item => {
|
||||
if (item.plc_id === val) {
|
||||
this.plc_code = item.plc_code
|
||||
this.sliceItem()
|
||||
return
|
||||
}
|
||||
})
|
||||
},
|
||||
test_read1() {
|
||||
testRead(this.data1, this.opc_id).then(data => {
|
||||
this.data1 = data
|
||||
this.notify('操作成功!', 'success')
|
||||
}).catch(err => {
|
||||
console.log(err.response.data.message)
|
||||
})
|
||||
},
|
||||
test_read2() {
|
||||
testRead(this.data2, this.opc_id).then(data => {
|
||||
this.data2 = data
|
||||
console.log(this.data2)
|
||||
this.notify('操作成功!', 'success')
|
||||
}).catch(err => {
|
||||
console.log(err.response.data.message)
|
||||
})
|
||||
},
|
||||
test_write1() {
|
||||
testwrite(this.data2, this.opc_id).then(data => {
|
||||
this.notify('操作成功!', 'success')
|
||||
}).catch(err => {
|
||||
console.log(err.response.data.message)
|
||||
})
|
||||
},
|
||||
doSubmit() {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.configLoading = true
|
||||
// 根据驱动类型判断是否为路由设备
|
||||
const parentForm = this.parentForm
|
||||
parentForm.is_route = true
|
||||
parentForm.plc_id = this.plc_id
|
||||
parentForm.opc_id = this.opc_id
|
||||
updateConfig(parentForm, this.form, this.data1, this.data2).then(res => {
|
||||
this.notify('保存成功', 'success')
|
||||
this.configLoading = false
|
||||
}).catch(err => {
|
||||
this.configLoading = false
|
||||
console.log(err.response.data.message)
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
sliceItem() { // 拼接DB的Item值
|
||||
this.data1.forEach(item => {
|
||||
const str = item.code
|
||||
// 是否包含.
|
||||
if (str.search('.') !== -1) {
|
||||
// 截取最后一位
|
||||
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + str.slice(str.lastIndexOf('.') + 1)
|
||||
} else {
|
||||
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + item.code
|
||||
}
|
||||
})
|
||||
this.data2.forEach(item => {
|
||||
const str = item.code
|
||||
// 是否包含.
|
||||
if (str.search('.') !== -1) {
|
||||
// 截取最后一位
|
||||
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + str.slice(str.lastIndexOf('.') + 1)
|
||||
} else {
|
||||
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + item.code
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
218
acs/nladmin-ui/src/views/acs/order/MaterialDialog.vue
Normal file
218
acs/nladmin-ui/src/views/acs/order/MaterialDialog.vue
Normal file
@@ -0,0 +1,218 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
title="物料选择"
|
||||
append-to-body
|
||||
:visible.sync="dialogVisible"
|
||||
destroy-on-close
|
||||
width="1000px"
|
||||
@close="close"
|
||||
@open="open"
|
||||
>
|
||||
<el-form
|
||||
:inline="true"
|
||||
class="demo-form-inline"
|
||||
label-position="right"
|
||||
label-width="80px"
|
||||
>
|
||||
<el-form-item label="客户">
|
||||
<el-input
|
||||
v-model="query.customer"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="客户"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="实发型号">
|
||||
<el-input
|
||||
v-model="query.production_materials"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="实发型号"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="大型号">
|
||||
<el-input
|
||||
v-model="query.large_model"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="大型号"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="小型号">
|
||||
<el-input
|
||||
v-model="query.small_model"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="小型号"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="批次号">
|
||||
<el-input
|
||||
v-model="query.batch_number"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="批次号"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="queryInfo">
|
||||
<el-button icon="el-icon-sort" circle @click="queryMaterials"></el-button>
|
||||
</el-form-item>
|
||||
<rrOperation />
|
||||
</el-form>
|
||||
|
||||
<!--表格渲染-->
|
||||
<el-table
|
||||
ref="table"
|
||||
v-loading="crud.loading"
|
||||
:data="crud.data"
|
||||
style="width: 100%;"
|
||||
size="mini"
|
||||
border
|
||||
:cell-style="{'text-align':'center'}"
|
||||
:header-cell-style="{background:'#f5f7fa',color:'#606266','text-align':'center'}"
|
||||
@select="handleSelectionChange"
|
||||
@select-all="onSelectAll"
|
||||
@current-change="clickChange"
|
||||
>
|
||||
<el-table-column v-if="!isSingle" type="selection" width="55" />
|
||||
<el-table-column v-if="isSingle" label="选择" width="55">
|
||||
<template slot-scope="scope">
|
||||
<el-radio v-model="tableRadio" :label="scope.row"><i /></el-radio>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="customer" label="客户" :min-width="flexWidth('customer',crud.data,'客户')" />
|
||||
<el-table-column prop="production_materials" label="实发型号" :min-width="flexWidth('production_materials',crud.data,'实发型号')" />
|
||||
<el-table-column prop="actual_batch" label="实发批次" :min-width="flexWidth('actual_batch',crud.data,'实发批次')" />
|
||||
<el-table-column prop="inventory_qty" label="库存数量" :min-width="flexWidth('inventory_qty',crud.data,'库存数量')" />
|
||||
<el-table-column prop="product_qty" label="当天生产" :min-width="flexWidth('product_qty',crud.data,'当天生产')" />
|
||||
<el-table-column prop="large_model" label="大型号 " :min-width="flexWidth('large_model',crud.data,'大型号 ')" />
|
||||
<el-table-column prop="small_model" label="小型号" :min-width="flexWidth('small_model',crud.data,'小型号')" />
|
||||
<el-table-column prop="batch_number" label="批次号" :min-width="flexWidth('batch_number',crud.data,'批次号')" />
|
||||
<el-table-column prop="weight" label="重量/KG" :min-width="flexWidth('weight',crud.data,'重量/KG')" />
|
||||
<el-table-column prop="bottle_number" label="瓶盖号" :min-width="flexWidth('bottle_number',crud.data,'瓶盖号')" />
|
||||
<el-table-column prop="carton_number" label="纸箱号" :min-width="flexWidth('carton_number',crud.data,'纸箱号')" />
|
||||
<el-table-column prop="sum_qty" label="总罐数" :min-width="flexWidth('sum_qty',crud.data,'总罐数')" />
|
||||
<el-table-column prop="remark" label="备注" :min-width="flexWidth('remark',crud.data,'备注')" />
|
||||
<el-table-column prop="sum_qty" label="总罐数" :min-width="flexWidth('sum_qty',crud.data,'备注')" />
|
||||
<el-table-column prop="carton_qty" label="纸箱装瓶数量" :min-width="flexWidth('carton_qty',crud.data,'备注')" />
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="submit">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import CRUD, { header, presenter } from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
||||
|
||||
export default {
|
||||
name: 'MaterialDialog',
|
||||
components: { rrOperation, pagination },
|
||||
dicts: ['is_used'],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
title: '生产任务',
|
||||
url: 'api/mdBaseMaterial',
|
||||
optShow: {},
|
||||
query: {
|
||||
is_used: true
|
||||
}
|
||||
})
|
||||
},
|
||||
mixins: [presenter(), header()],
|
||||
props: {
|
||||
dialogShow: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
isSingle: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
flag: {
|
||||
type: Number,
|
||||
default: 1
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
tableRadio: null,
|
||||
tableData: [],
|
||||
queryInfo: '物料顺序',
|
||||
queryFlag: false
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
dialogShow: {
|
||||
handler(newValue) {
|
||||
this.dialogVisible = newValue
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
clickChange(item) {
|
||||
this.tableRadio = item
|
||||
},
|
||||
open() {
|
||||
|
||||
},
|
||||
queryMaterials() {
|
||||
this.queryInfo = '物料顺序'
|
||||
this.crud.url = 'api/mdBaseMaterial'
|
||||
this.crud.toQuery()
|
||||
},
|
||||
handleSelectionChange(val, row) {
|
||||
if (val.length > 1) {
|
||||
this.$refs.table.clearSelection()
|
||||
this.$refs.table.toggleRowSelection(val.pop())
|
||||
} else {
|
||||
this.checkrow = row
|
||||
}
|
||||
},
|
||||
onSelectAll() {
|
||||
this.$refs.table.clearSelection()
|
||||
},
|
||||
close() {
|
||||
this.crud.resetQuery(false)
|
||||
this.$emit('update:dialogShow', false)
|
||||
},
|
||||
submit() {
|
||||
// 处理单选
|
||||
if (this.isSingle && this.tableRadio) {
|
||||
this.$emit('update:dialogShow', false)
|
||||
this.$emit('tableChanged', this.tableRadio, this.flag)
|
||||
return
|
||||
}
|
||||
this.rows = this.$refs.table.selection
|
||||
if (this.rows.length <= 0) {
|
||||
this.$message('请先勾选物料')
|
||||
return
|
||||
}
|
||||
this.crud.resetQuery(false)
|
||||
this.$emit('update:dialogShow', false)
|
||||
this.$emit('tableChanged', this.rows, this.flag)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
::v-deep .el-dialog__body {
|
||||
padding-top: 0px;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
117
acs/nladmin-ui/src/views/acs/order/UploadDialog.vue
Normal file
117
acs/nladmin-ui/src/views/acs/order/UploadDialog.vue
Normal file
@@ -0,0 +1,117 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
title="导入Excel文件"
|
||||
append-to-body
|
||||
:visible.sync="dialogVisible"
|
||||
destroy-on-close
|
||||
width="400px"
|
||||
:show-close="true"
|
||||
@close="close"
|
||||
@open="open"
|
||||
>
|
||||
<el-upload
|
||||
ref="upload"
|
||||
class="upload-demo"
|
||||
action=""
|
||||
drag
|
||||
:on-exceed="is_one"
|
||||
:limit="1"
|
||||
:auto-upload="false"
|
||||
:multiple="false"
|
||||
:show-file-list="true"
|
||||
:on-change="uploadByJsqd"
|
||||
:file-list="fileList"
|
||||
accept=".xlsx,.xls"
|
||||
>
|
||||
<i class="el-icon-upload" />
|
||||
<div class="el-upload__text">
|
||||
将文件拖到此处,或
|
||||
<em>点击上传</em>
|
||||
</div>
|
||||
<div slot="tip" class="el-upload__tip">只能上传Excel文件,且不超过10MB</div>
|
||||
</el-upload>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="submit">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import mdBaseMaterial from '@/api/acs/order/mdBaseMaterial'
|
||||
import CRUD, { crud } from '@crud/crud'
|
||||
|
||||
export default {
|
||||
name: 'UploadDialog',
|
||||
mixins: [crud()],
|
||||
components: {},
|
||||
props: {
|
||||
dialogShow: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
openParam: {
|
||||
type: String
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
fileList: [],
|
||||
file1: ''
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
dialogShow: {
|
||||
handler(newValue, oldValue) {
|
||||
this.dialogVisible = newValue
|
||||
}
|
||||
},
|
||||
openParam: {
|
||||
handler(newValue, oldValue) {
|
||||
this.opendtlParam = newValue
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open() {
|
||||
},
|
||||
close() {
|
||||
this.$emit('update:dialogShow', false)
|
||||
},
|
||||
is_one() {
|
||||
this.crud.notify('只能上传一个excel文件!', CRUD.NOTIFICATION_TYPE.WARNING)
|
||||
},
|
||||
// 文件校验方法
|
||||
beforeAvatarUpload(file) {
|
||||
// 不能导入大小超过2Mb的文件
|
||||
if (file.size > 10 * 1024 * 1024) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
},
|
||||
// 文件发生改变就会触发的事件
|
||||
uploadByJsqd(file) {
|
||||
this.file1 = file
|
||||
},
|
||||
submit() {
|
||||
if (this.beforeAvatarUpload(this.file1)) {
|
||||
this.fileList.name = this.file1.name
|
||||
this.fileList.url = ''
|
||||
var formdata = new FormData()
|
||||
formdata.append('file', this.file1.raw)
|
||||
console.log(this.file1.raw)
|
||||
// excelImport:请求接口 formdata:传递参数
|
||||
mdBaseMaterial.excelImport(formdata).then((res) => {
|
||||
this.crud.notify('导入成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
this.$emit('tableChanged3', '')
|
||||
this.$emit('update:dialogShow', false)
|
||||
})
|
||||
} else {
|
||||
this.crud.notify('文件过大,请上传小于10MB的文件〜', CRUD.NOTIFICATION_TYPE.WARNING)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
</el-button>
|
||||
<el-button
|
||||
slot="left"
|
||||
<!-- v-permission="['admin','task:add']" -->
|
||||
v-permission="['admin','task:add']"
|
||||
class="filter-item"
|
||||
size="mini"
|
||||
type="primary"
|
||||
@@ -170,6 +170,12 @@
|
||||
<el-form-item label="小型号" prop="small_model">
|
||||
<el-input v-model="form.small_model" style="width: 370px;" @change="isDisabled=false" />
|
||||
</el-form-item>
|
||||
<el-form-item label="瓶盖完成数量" prop="fbottle_number">
|
||||
<el-input v-model="form.fbottle_number" style="width: 370px;" @change="isDisabled=false" />
|
||||
</el-form-item>
|
||||
<el-form-item label="纸箱完成数量" prop="fcarton_number">
|
||||
<el-input v-model="form.fcarton_number" style="width: 370px;" @change="isDisabled=false" />
|
||||
</el-form-item>
|
||||
<el-form-item label="计划数量" prop="planned_quantity">
|
||||
<el-input v-model="form.planned_quantity" style="width: 370px;" @change="isDisabled=false" />
|
||||
</el-form-item>
|
||||
@@ -234,8 +240,8 @@
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="text" @click="formDias=false">{{ $t('task.select.Cancel') }}</el-button>
|
||||
<el-button :loading="crud.cu === 2" v-permission="['admin','task:del']" type="primary" @click="editBtn">{{ $t('task.select.Confirm') }}</el-button>
|
||||
<!-- <el-button type="text" @click="formDias=true">{{ $t('task.select.Cancel') }}</el-button> -->
|
||||
<el-button :loading="crud.cu === 2" type="primary" @click="editBtn">{{ $t('task.select.Confirm') }}</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!--表单组件-->
|
||||
@@ -247,6 +253,8 @@
|
||||
<el-table-column prop="production_materials" label="实发型号" :min-width="flexWidth('production_materials',crud.data,'实发型号')" />
|
||||
<el-table-column prop="large_model" label="大型号" :min-width="flexWidth('large_model',crud.data,'大型号')" />
|
||||
<el-table-column prop="small_model" label="小型号" :min-width="flexWidth('small_model',crud.data,'小型号')" />
|
||||
<el-table-column prop="fbottle_number" label="瓶盖完成数量" :min-width="flexWidth('fbottle_number',crud.data,'瓶盖完成数量')" />
|
||||
<el-table-column prop="fcarton_number" label="纸箱完成数量" :min-width="flexWidth('fcarton_number',crud.data,'纸箱完成数量')" />
|
||||
<el-table-column prop="bottle_number" label="瓶盖号" :min-width="flexWidth('bottle_number',crud.data,'瓶盖号')" />
|
||||
<el-table-column prop="carton_number" label="纸箱号" :min-width="flexWidth('carton_number',crud.data,'纸箱号')" />
|
||||
<el-table-column prop="bottle_board" label="瓶盖关联标签模板" :min-width="flexWidth('bottle_board',crud.data,'瓶盖关联标签模板')" />
|
||||
@@ -649,7 +657,7 @@ export default {
|
||||
}, 1000) // 5000 毫秒,即 5 秒钟
|
||||
},
|
||||
editBtn() {
|
||||
// this.form=crudTask.query(ticket.ticket_id)
|
||||
|
||||
this.isDisabled = true
|
||||
// if (!this.isFormChanged) {
|
||||
// // 如果表单没有变化,不进行提交
|
||||
|
||||
353
acs/nladmin-ui/src/views/acs/order/material.vue
Normal file
353
acs/nladmin-ui/src/views/acs/order/material.vue
Normal file
@@ -0,0 +1,353 @@
|
||||
<template>
|
||||
<div v-loading.fullscreen.lock="fullscreenLoading" class="app-container">
|
||||
<!--工具栏-->
|
||||
<div class="head-container">
|
||||
<div v-if="crud.props.searchToggle">
|
||||
<el-form
|
||||
:inline="true"
|
||||
class="demo-form-inline"
|
||||
label-position="right"
|
||||
label-width="90px"
|
||||
label-suffix=":"
|
||||
>
|
||||
<!-- <el-form-item label="模糊搜索">
|
||||
<el-input
|
||||
v-model="query.blurry"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="编码名称"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="客户">
|
||||
<el-input
|
||||
v-model="query.customer"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="客户"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="实发型号">
|
||||
<el-input
|
||||
v-model="query.production_materials"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="实发型号"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="实发批次">
|
||||
<el-input
|
||||
v-model="query.actual_batch"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="实发批次"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="大型号">
|
||||
<el-input
|
||||
v-model="query.large_model"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="大型号"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="小型号">
|
||||
<el-input
|
||||
v-model="query.small_model"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="小型号"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="批次号">
|
||||
<el-input
|
||||
v-model="query.batch_number"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="批次号"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<rrOperation />
|
||||
</el-form>
|
||||
</div>
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation :permission="permission">
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
size="mini"
|
||||
type="warning"
|
||||
icon="el-icon-download"
|
||||
:loading="downloadLoading"
|
||||
@click="doExport"
|
||||
>导出眉山通威
|
||||
</el-button>
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
size="mini"
|
||||
type="warning"
|
||||
icon="el-icon-download"
|
||||
:loading="downloadLoading"
|
||||
@click="doExport1"
|
||||
>导出晶科报表
|
||||
</el-button>
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
type="warning"
|
||||
icon="el-icon-upload2"
|
||||
size="mini"
|
||||
@click="uploadShow = true"
|
||||
>
|
||||
导入
|
||||
</el-button>
|
||||
</crudOperation>
|
||||
<!--表单组件-->
|
||||
<el-dialog
|
||||
:close-on-click-modal="false"
|
||||
:before-close="crud.cancelCU"
|
||||
:visible.sync="crud.status.cu > 0"
|
||||
:title="crud.status.title"
|
||||
width="500px"
|
||||
>
|
||||
<el-form
|
||||
ref="form"
|
||||
:inline="true"
|
||||
style="border: 1px solid #cfe0df;margin-top: 10px;padding-top: 10px;"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
size="mini"
|
||||
label-width="125px"
|
||||
label-suffix=":"
|
||||
>
|
||||
<el-form-item label="客户" prop="customer">
|
||||
<el-input v-model="form.customer" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="实发型号" prop="production_materials">
|
||||
<el-input v-model="form.production_materials" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="实发批次" prop="actual_batch">
|
||||
<el-input v-model="form.actual_batch" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="库存数量" prop="inventory_qty">
|
||||
<el-input v-model="form.inventory_qty" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="当天生产" prop="product_qty">
|
||||
<el-input v-model="form.product_qty" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="大型号 " prop="large_model">
|
||||
<el-input v-model="form.large_model" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="小型号" prop="small_model">
|
||||
<el-input v-model="form.small_model" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="批次号" prop="batch_number">
|
||||
<el-input v-model="form.batch_number" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="重量/KG" prop="weight">
|
||||
<el-input v-model="form.weight" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注"prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="瓶盖号"prop="bottle_number">
|
||||
<el-input v-model="form.bottle_number" type="textarea" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="纸箱号"prop="carton_number">
|
||||
<el-input v-model="form.carton_number" type="textarea" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="纸箱装瓶数量"prop="carton_qty">
|
||||
<el-input v-model="form.carton_qty" type="textarea" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="总罐数"prop="sum_qty">
|
||||
<el-input v-model="form.sum_qty" type="textarea" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="送货单"prop="shdnumber">
|
||||
<el-input v-model="form.shdnumber" type="textarea" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="info" @click="crud.cancelCU">取消</el-button>
|
||||
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!--表格渲染-->
|
||||
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="mini" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column prop="customer" label="客户" :min-width="flexWidth('customer',crud.data,'客户')" />
|
||||
<el-table-column prop="production_materials" label="实发型号" :min-width="flexWidth('production_materials',crud.data,'实发型号')" />
|
||||
<el-table-column prop="actual_batch" label="实发批次" :min-width="flexWidth('actual_batch',crud.data,'实发批次')" />
|
||||
<el-table-column prop="inventory_qty" label="库存数量" :min-width="flexWidth('inventory_qty',crud.data,'库存数量')" />
|
||||
<el-table-column prop="product_qty" label="当天生产" :min-width="flexWidth('product_qty',crud.data,'当天生产')" />
|
||||
<el-table-column prop="large_model" label="大型号 " :min-width="flexWidth('large_model',crud.data,'大型号 ')" />
|
||||
<el-table-column prop="small_model" label="小型号" :min-width="flexWidth('small_model',crud.data,'小型号')" />
|
||||
<el-table-column prop="batch_number" label="批次号" :min-width="flexWidth('batch_number',crud.data,'批次号')" />
|
||||
<el-table-column prop="weight" label="重量/KG" :min-width="flexWidth('weight',crud.data,'重量/KG')" />
|
||||
<el-table-column prop="remark" label="备注" :min-width="flexWidth('remark',crud.data,'备注')" />
|
||||
<el-table-column prop="bottle_number" label="瓶盖号" :min-width="flexWidth('bottle_number',crud.data,'瓶盖号')" />
|
||||
<el-table-column prop="carton_number" label="纸箱号" :min-width="flexWidth('carton_number',crud.data,'纸箱号')" />
|
||||
<el-table-column prop="sum_qty" label="总罐数" :min-width="flexWidth('sum_qty',crud.data,'总罐数')" />
|
||||
<el-table-column prop="shdnumber" label="送货单" :min-width="flexWidth('shdnumber',crud.data,'送货单')" />
|
||||
<el-table-column prop="carton_qty" label="纸箱装瓶数量" :min-width="flexWidth('carton_qty',crud.data,'纸箱装瓶数量')" />
|
||||
<el-table-column prop="is_used" label="是否启用" :min-width="flexWidth('is_used',crud.data,'是否启用')">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.is_used?'是':'否' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="is_delete" label="是否删除" :min-width="flexWidth('is_delete',crud.data,'是否删除')">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.is_delete?'是':'否' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="create_name" label="创建人" :min-width="flexWidth('create_name',crud.data,'创建人')" />
|
||||
<el-table-column prop="create_time" label="同步时间" :min-width="flexWidth('create_time',crud.data,'创建时间')" />
|
||||
<el-table-column prop="update_name" label="修改人" :min-width="flexWidth('update_name',crud.data,'修改人')" />
|
||||
<el-table-column prop="update_time" label="修改时间" :min-width="flexWidth('update_time',crud.data,'修改时间')" />
|
||||
<el-table-column v-permission="[]" label="操作" width="120px" align="center" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<udOperation
|
||||
:data="scope.row"
|
||||
:permission="permission"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
</div>
|
||||
<UploadDialog :dialog-show.sync="uploadShow" @tableChanged3="tableChanged3" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crudMdBaseMaterial from '@/api/acs/order/mdBaseMaterial'
|
||||
import CRUD, { crud, form, header, presenter } from '@crud/crud'
|
||||
import UploadDialog from '@/views/acs/order/UploadDialog'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import udOperation from '@crud/UD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
import { downloadFile, parseTime } from '@/utils/index'
|
||||
import { download, initData } from '@/api/data'
|
||||
const defaultForm = {
|
||||
small_model: null,
|
||||
production_materials: null,
|
||||
material_id: null,
|
||||
actual_batch: null,
|
||||
batch_number: null,
|
||||
large_model: null,
|
||||
customer: null,
|
||||
workshop_code: null,
|
||||
remark: null,
|
||||
is_used: true,
|
||||
is_special: false,
|
||||
is_delete: false
|
||||
}
|
||||
export default {
|
||||
name: 'MdBaseMaterial',
|
||||
dicts: ['vehicle_type'],
|
||||
components: { pagination, crudOperation, rrOperation, udOperation, UploadDialog },
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
title: '物料基础信息',
|
||||
url: 'api/mdBaseMaterial',
|
||||
idField: 'material_id',
|
||||
sort: 'material_id,desc',
|
||||
crudMethod: { ...crudMdBaseMaterial }
|
||||
})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
classes1: [],
|
||||
permission: {
|
||||
add: ['admin', 'device:add'],
|
||||
edit: ['admin', 'device:edit'],
|
||||
del: ['admin', 'device:del']
|
||||
},
|
||||
uploadShow: false,
|
||||
rules: {
|
||||
large_model: [
|
||||
{ required: true, message: '大型号不能为空', trigger: 'blur' }
|
||||
],
|
||||
small_model: [
|
||||
{ required: true, message: '小型号不能为空', trigger: 'blur' }
|
||||
],
|
||||
customer: [
|
||||
{ required: true, message: '客户不能为空', trigger: 'blur' }
|
||||
],
|
||||
},
|
||||
downloadLoading: false,
|
||||
fullscreenLoading: false,
|
||||
workShopList: []
|
||||
}
|
||||
},
|
||||
// created() {
|
||||
// this.getWorkShopList()
|
||||
// },
|
||||
methods: {
|
||||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
return true
|
||||
},
|
||||
tableChanged3() {
|
||||
this.crud.toQuery()
|
||||
},
|
||||
synchronize() {
|
||||
this.fullscreenLoading = true
|
||||
crudMdBaseMaterial.synchronize(this.crud.query).then(res => {
|
||||
this.fullscreenLoading = false
|
||||
this.crud.notify('同步成功!', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
}).catch(() => {
|
||||
this.fullscreenLoading = false
|
||||
})
|
||||
},
|
||||
doExport() {
|
||||
this.downloadLoading = true
|
||||
download('api/mdBaseMaterial' + '/doExport', {}).then(result => {
|
||||
downloadFile(result, crud.title + '数据', 'xlsx')
|
||||
this.downloadLoading = false
|
||||
}).catch(() => {
|
||||
this.downloadLoading = false
|
||||
})
|
||||
},
|
||||
doExport1() {
|
||||
this.downloadLoading = true
|
||||
download('api/mdBaseMaterial' + '/doExport1', {}).then(result => {
|
||||
downloadFile(result, crud.title + '数据', 'xlsx')
|
||||
this.downloadLoading = false
|
||||
}).catch(() => {
|
||||
this.downloadLoading = false
|
||||
})
|
||||
},
|
||||
// 获取子节点数据
|
||||
loadChildNodes({ action, parentNode, callback }) {
|
||||
// if (action === LOAD_CHILDREN_OPTIONS) {
|
||||
// crudClassstandard.getClass({ pid: parentNode.id }).then(res => {
|
||||
// parentNode.children = res.content.map(function(obj) {
|
||||
// if (obj.hasChildren) {
|
||||
// obj.children = null
|
||||
// }
|
||||
// return obj
|
||||
// })
|
||||
// setTimeout(() => {
|
||||
// callback()
|
||||
// }, 100)
|
||||
// })
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
|
||||
101
acs/nladmin-ui/src/views/acs/order/preview.vue
Normal file
101
acs/nladmin-ui/src/views/acs/order/preview.vue
Normal file
@@ -0,0 +1,101 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
:title="预览页面"
|
||||
append-to-body
|
||||
:visible.sync="previewVisible"
|
||||
:width="width+'mm'"
|
||||
@close="close"
|
||||
@open="open"
|
||||
>
|
||||
<el-button type="primary" icon="el-icon-printer" @click="print">打印</el-button>
|
||||
<el-button type="primary" icon="el-icon-printer" @click="print">PDF</el-button>
|
||||
<div id="preview_content_design" />
|
||||
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: 'PrintPreview',
|
||||
|
||||
props: {
|
||||
previewShow: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
previewVisible: false,
|
||||
visible: false,
|
||||
spinning: true,
|
||||
waitShowPrinter: false,
|
||||
// 纸张宽 mm
|
||||
width: 0,
|
||||
// 模板
|
||||
hiprintTemplate: {},
|
||||
// 数据
|
||||
printData: {}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
previewShow: {
|
||||
handler(newValue, oldValue) {
|
||||
this.previewVisible = newValue
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
methods: {
|
||||
close() {
|
||||
this.$emit('update:previewShow', false)
|
||||
},
|
||||
open() {
|
||||
|
||||
},
|
||||
|
||||
hideModal() {
|
||||
this.visible = false
|
||||
},
|
||||
show(hiprintTemplate, printData, width = '210') {
|
||||
// debugger
|
||||
this.visible = true
|
||||
this.spinning = true
|
||||
this.width = hiprintTemplate.editingPanel ? hiprintTemplate.editingPanel.width : width
|
||||
this.hiprintTemplate = hiprintTemplate
|
||||
this.printData = printData
|
||||
setTimeout(() => {
|
||||
// eslint-disable-next-line no-undef
|
||||
$('#preview_content_design').html(hiprintTemplate.getHtml(printData))
|
||||
this.spinning = false
|
||||
}, 500)
|
||||
},
|
||||
print() {
|
||||
this.waitShowPrinter = true
|
||||
this.hiprintTemplate.print(this.printData, {}, {
|
||||
callback: () => {
|
||||
console.log('callback')
|
||||
this.waitShowPrinter = false
|
||||
}
|
||||
})
|
||||
},
|
||||
toPdf() {
|
||||
this.hiprintTemplate.toPdf({}, '打印预览')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
/deep/ .ant-modal-body {
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
/deep/ .ant-modal-content {
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user