Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
85d6291312
|
|
@ -0,0 +1,28 @@
|
|||
package com.bonus.sgzb.material.config;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 返回异常枚举类
|
||||
* @Author ma_sh
|
||||
* @create 2024/3/29 14:43
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum ExceptionEnum {
|
||||
|
||||
SAVE_TO_DATABASE(500, "盘点入库新增保存失败,请联系管理员!!!");
|
||||
|
||||
private Integer code;
|
||||
|
||||
private String msg;
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package com.bonus.sgzb.material.config;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
/**
|
||||
* 后端生产随机编码通用方法(格式:今日年月日日期-随机4位编码 20240328-0001)
|
||||
* @Author ma_sh
|
||||
* @create 2024/3/28 17:42
|
||||
*/
|
||||
public class FieldGenerator {
|
||||
|
||||
public static String generateField() {
|
||||
LocalDate today = LocalDate.now();
|
||||
String currentDate = today.format(DateTimeFormatter.ofPattern("yyyyMMdd"));
|
||||
// 生成UUID并取后4位,转换为纯数字类型
|
||||
String uuid = UUID.randomUUID().toString().replaceAll("-", "");
|
||||
String uuidLast4Digits = uuid.substring(uuid.length() - 4);
|
||||
int uuidLast4DigitsNumeric = Integer.parseInt(uuidLast4Digits, 16);
|
||||
return currentDate + "-" + String.format("%04d", uuidLast4DigitsNumeric % 10000);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +1,10 @@
|
|||
package com.bonus.sgzb.material.controller;
|
||||
|
||||
import com.bonus.sgzb.common.core.web.controller.BaseController;
|
||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.sgzb.common.core.web.page.TableDataInfo;
|
||||
import com.bonus.sgzb.material.domain.PutInStorageBean;
|
||||
import com.bonus.sgzb.material.domain.SavePutInfoDto;
|
||||
import com.bonus.sgzb.material.service.InventoryAndWarehousingService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
|
@ -33,4 +35,16 @@ public class InventoryAndWarehousingController extends BaseController {
|
|||
List<PutInStorageBean> list = inventoryAndWarehousingService.getList(bean);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增入库盘点
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "新增入库盘点")
|
||||
@PostMapping("/addList")
|
||||
public AjaxResult savePutInfo(@RequestBody SavePutInfoDto dto) {
|
||||
return inventoryAndWarehousingService.savePutInfo(dto);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,78 @@
|
|||
package com.bonus.sgzb.material.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author ma_sh
|
||||
* @create 2024/3/28 17:53
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class MachIneDto {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
/** 机具ID */
|
||||
@ApiModelProperty(value = "机具ID")
|
||||
private Long maId;
|
||||
|
||||
/**
|
||||
* 类型id
|
||||
*/
|
||||
private String typeId;
|
||||
|
||||
/** 设备编号 */
|
||||
@ApiModelProperty(value = "设备编号")
|
||||
private String maCode;
|
||||
|
||||
/** 出厂编码 */
|
||||
@ApiModelProperty(value = "出厂编码")
|
||||
private String outFacCode;
|
||||
|
||||
/** 生产厂家 */
|
||||
@ApiModelProperty(value = "生产厂家")
|
||||
private String maVender;
|
||||
|
||||
/** 本次检修日期 */
|
||||
@ApiModelProperty(value = "本次检修日期")
|
||||
private String thisCheckTime;
|
||||
|
||||
/** 下次检修日期 */
|
||||
@ApiModelProperty(value = "下次检修日期")
|
||||
private String nextCheckTime;
|
||||
|
||||
/** 单价 */
|
||||
@ApiModelProperty(value = "单价")
|
||||
private String buyPrice;
|
||||
|
||||
/** 编码 */
|
||||
@ApiModelProperty(value = "编码")
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
@ApiModelProperty(value = "创建者")
|
||||
private String creator;
|
||||
|
||||
/**
|
||||
* 入库形式
|
||||
*/
|
||||
@ApiModelProperty(value = "入库形式")
|
||||
private String putInType;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remarks;
|
||||
}
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
package com.bonus.sgzb.material.domain;
|
||||
|
||||
import com.bonus.sgzb.common.core.web.domain.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 新增盘点入库接口实体类dto
|
||||
* @Author ma_sh
|
||||
* @create 2024/3/28 14:22
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class SavePutInfoDto extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 判断为数量还是编号,true为编号
|
||||
*/
|
||||
private Boolean isCode;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 类型id
|
||||
*/
|
||||
private String typeId;
|
||||
|
||||
/**
|
||||
* 主信息
|
||||
*/
|
||||
private Integer info;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private Double num;
|
||||
|
||||
/**
|
||||
* 库房
|
||||
*/
|
||||
private Integer ram;
|
||||
|
||||
/**
|
||||
* 设备工器具类型
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 设备主键
|
||||
*/
|
||||
private Integer machine;
|
||||
|
||||
/**
|
||||
* 入库形式
|
||||
*/
|
||||
private String putInType;
|
||||
|
||||
/**
|
||||
* 盘点入库单号
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 单位名称
|
||||
*/
|
||||
private String unitId;
|
||||
|
||||
/**
|
||||
* 工程名称
|
||||
*/
|
||||
private String projectId;
|
||||
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
private String creator;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String createDate;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remarks;
|
||||
|
||||
/**
|
||||
* 表单类型集合
|
||||
*/
|
||||
private List<MachIneDto> machIneDtoList;
|
||||
|
||||
}
|
||||
|
|
@ -1,7 +1,9 @@
|
|||
package com.bonus.sgzb.material.mapper;
|
||||
|
||||
import com.bonus.sgzb.material.domain.MachIneDto;
|
||||
import com.bonus.sgzb.material.domain.PutInStorageBean;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -20,4 +22,41 @@ public interface InventoryAndWarehousingMapper {
|
|||
*/
|
||||
List<PutInStorageBean> getList(PutInStorageBean bean);
|
||||
|
||||
/**
|
||||
* ma_type_put_in_storage_details表
|
||||
* @param machIneDto
|
||||
* @return
|
||||
*/
|
||||
Integer saveDetails(MachIneDto machIneDto);
|
||||
|
||||
/**
|
||||
* 插入ma_type_put_in_storage_info表
|
||||
* @param machIneDto
|
||||
* @return
|
||||
*/
|
||||
int saveInfo(MachIneDto machIneDto);
|
||||
|
||||
/**
|
||||
* 更新matype表中num数量
|
||||
* @param
|
||||
*/
|
||||
int updateMaType(@Param("typeId") String typeId, @Param("num") Double num);
|
||||
|
||||
/**
|
||||
* 新增ma_machine表
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
int insertMachine(MachIneDto machIneDtoy);
|
||||
|
||||
int insertMachineLabel(MachIneDto machIneDto);
|
||||
|
||||
int insertLabelBind(MachIneDto machIneDto);
|
||||
|
||||
/**
|
||||
* 根据code从ma_machine表查询是否有数据,去重
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
int selectById(String code);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
package com.bonus.sgzb.material.service;
|
||||
|
||||
|
||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.sgzb.material.domain.PutInStorageBean;
|
||||
import com.bonus.sgzb.material.domain.SavePutInfoDto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -18,4 +20,11 @@ public interface InventoryAndWarehousingService {
|
|||
* @return 结果
|
||||
*/
|
||||
List<PutInStorageBean> getList(PutInStorageBean bean);
|
||||
|
||||
/**
|
||||
* 新增入库盘点
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
AjaxResult savePutInfo(SavePutInfoDto dto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,26 +1,189 @@
|
|||
package com.bonus.sgzb.material.service.impl;
|
||||
|
||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.sgzb.common.security.utils.SecurityUtils;
|
||||
import com.bonus.sgzb.material.config.ExceptionEnum;
|
||||
import com.bonus.sgzb.material.domain.MachIneDto;
|
||||
import com.bonus.sgzb.material.domain.PutInStorageBean;
|
||||
import com.bonus.sgzb.material.domain.SavePutInfoDto;
|
||||
import com.bonus.sgzb.material.mapper.InventoryAndWarehousingMapper;
|
||||
import com.bonus.sgzb.material.service.InventoryAndWarehousingService;
|
||||
import com.bonus.sgzb.material.config.FieldGenerator;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @description 入库盘点
|
||||
* @author hay
|
||||
* @date 2024/3/27 13:32
|
||||
*/
|
||||
* @author hay
|
||||
* @description 入库盘点
|
||||
* @date 2024/3/27 13:32
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class InventoryAndWarehousingServiceImpl implements InventoryAndWarehousingService {
|
||||
|
||||
@Autowired
|
||||
private InventoryAndWarehousingMapper inventoryAndWarehousingMapper;
|
||||
|
||||
/**
|
||||
* 查询入库盘点列表
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<PutInStorageBean> getList(PutInStorageBean bean) {
|
||||
return inventoryAndWarehousingMapper.getList(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增入库盘点
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult savePutInfo(SavePutInfoDto dto) {
|
||||
Long userId = SecurityUtils.getLoginUser().getUserid();
|
||||
dto.setCreator(userId.toString());
|
||||
List<String> codeList = new ArrayList<>();
|
||||
while (codeList.size() < dto.getNum()) {
|
||||
String code = FieldGenerator.generateField();
|
||||
int count = selectById(code);
|
||||
if (count == 0) {
|
||||
codeList.add(code);
|
||||
}
|
||||
}
|
||||
int res = 0;
|
||||
try {
|
||||
//1. 判断是数量还是编号,保存到不同表
|
||||
//1.1 如果是编号
|
||||
if (dto.getIsCode()) {
|
||||
/*插入ma_machine、ma_machine_label和ma_label_bind以及
|
||||
ma_type_put_in_storage_info表和ma_type_put_in_storage_details表*/
|
||||
res = insertMaMachineInfo(dto, codeList);
|
||||
if (res == 0) {
|
||||
log.error("insertMaMachineInfo方法插入异常");
|
||||
throw new RuntimeException("insertMaMachineInfo方法插入异常");
|
||||
}
|
||||
} else {
|
||||
//2.插入ma_type_put_in_storage_info表和ma_type_put_in_storage_details表
|
||||
res = insertPutInfo(dto, codeList);
|
||||
if (res == 0) {
|
||||
log.error("insertPutInfo方法插入异常");
|
||||
throw new RuntimeException("insertPutInfo方法插入异常");
|
||||
}
|
||||
}
|
||||
//去修改ma_type里面的库存num,根据前端传的数量追加
|
||||
res = updateMaTypeInfo(dto.getTypeId(), dto.getNum());
|
||||
if (res == 0) {
|
||||
log.error("updateMaTypeInfo方法修改异常");
|
||||
throw new RuntimeException("updateMaTypeInfo方法修改异常");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
// 添加事务回滚逻辑
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
}
|
||||
if (res == 0) {
|
||||
return AjaxResult.error(ExceptionEnum.SAVE_TO_DATABASE.getCode(), ExceptionEnum.SAVE_TO_DATABASE.getMsg());
|
||||
}
|
||||
return AjaxResult.success(res);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据code从ma_machine表查询是否有数据,去重
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
private int selectById(String code) {
|
||||
return inventoryAndWarehousingMapper.selectById(code);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编号新增,插入ma_machine、ma_machine_label和ma_label_bind
|
||||
* @param dto
|
||||
* @param codeList
|
||||
* @return
|
||||
*/
|
||||
private int insertMaMachineInfo(SavePutInfoDto dto, List<String> codeList) {
|
||||
int num = 0;
|
||||
for (int i = 0; i < dto.getMachIneDtoList().size(); i++) {
|
||||
MachIneDto machIneDto = dto.getMachIneDtoList().get(i);
|
||||
String code = codeList.get(i);
|
||||
machIneDto.setCode(code);
|
||||
machIneDto.setTypeId(dto.getTypeId());
|
||||
machIneDto.setCreator(dto.getCreator());
|
||||
machIneDto.setRemarks(dto.getRemarks());
|
||||
machIneDto.setPutInType(dto.getPutInType());
|
||||
num = inventoryAndWarehousingMapper.insertMachine(machIneDto);
|
||||
if (num == 0) {
|
||||
throw new RuntimeException("新增到ma_machine表失败");
|
||||
}
|
||||
num = inventoryAndWarehousingMapper.insertMachineLabel(machIneDto);
|
||||
if (num == 0) {
|
||||
throw new RuntimeException("新增到ma_machine_label表失败");
|
||||
}
|
||||
num = inventoryAndWarehousingMapper.insertLabelBind(machIneDto);
|
||||
if (num == 0) {
|
||||
throw new RuntimeException("新增到ma_label_bind表失败");
|
||||
}
|
||||
//ma_type_put_in_storage_details表,返回主键id
|
||||
num = inventoryAndWarehousingMapper.saveDetails(machIneDto);
|
||||
if (num == 0) {
|
||||
throw new RuntimeException("新增到ma_type_put_in_storage_details表失败");
|
||||
}
|
||||
//插入ma_type_put_in_storage_info表
|
||||
num = inventoryAndWarehousingMapper.saveInfo(machIneDto);
|
||||
if (num == 0) {
|
||||
throw new RuntimeException("新增到ma_type_put_in_storage_info表失败");
|
||||
}
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 方法抽取,追加ma_type表里面的num
|
||||
*
|
||||
* @param typeId
|
||||
* @param num
|
||||
* @return
|
||||
*/
|
||||
private int updateMaTypeInfo(String typeId, Double num) {
|
||||
return inventoryAndWarehousingMapper.updateMaType(typeId, num);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 插入表方法
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
private int insertPutInfo(SavePutInfoDto dto, List<String> codeList) {
|
||||
int num = 0;
|
||||
for (int i = 0; i < dto.getMachIneDtoList().size(); i++) {
|
||||
MachIneDto machIneDto = dto.getMachIneDtoList().get(i);
|
||||
String code = codeList.get(i);
|
||||
machIneDto.setCode(code);
|
||||
machIneDto.setTypeId(dto.getTypeId());
|
||||
machIneDto.setCreator(dto.getCreator());
|
||||
machIneDto.setRemarks(dto.getRemarks());
|
||||
machIneDto.setPutInType(dto.getPutInType());
|
||||
//ma_type_put_in_storage_details表,返回主键id
|
||||
num = inventoryAndWarehousingMapper.saveDetails(machIneDto);
|
||||
if (num == 0) {
|
||||
throw new RuntimeException("新增到ma_type_put_in_storage_details表失败");
|
||||
}
|
||||
//插入ma_type_put_in_storage_info表
|
||||
num = inventoryAndWarehousingMapper.saveInfo(machIneDto);
|
||||
if (num == 0) {
|
||||
throw new RuntimeException("新增到ma_type_put_in_storage_info表失败");
|
||||
}
|
||||
}
|
||||
return num;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,124 @@
|
|||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.sgzb.material.mapper.InventoryAndWarehousingMapper">
|
||||
<insert id="saveDetails" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO ma_type_put_in_storage_details (NUM,
|
||||
<trim prefix="" suffixOverrides=",">
|
||||
<if test="maId != null and maId != ''">
|
||||
MACHINE,
|
||||
</if>
|
||||
<if test="remarks != null and remarks != ''">
|
||||
REMARKS,
|
||||
</if>
|
||||
<if test="maCode != null and maCode != ''">
|
||||
MA_CODE,
|
||||
</if>
|
||||
</trim>
|
||||
)
|
||||
VALUES (1,
|
||||
<trim prefix="" suffixOverrides=",">
|
||||
<if test="maId != null and maId != ''">
|
||||
#{maId},
|
||||
</if>
|
||||
<if test="remarks != null and remarks != ''">
|
||||
#{remarks},
|
||||
</if>
|
||||
<if test="maCode != null and maCode != ''">
|
||||
#{maCode},
|
||||
</if>
|
||||
</trim>
|
||||
)
|
||||
</insert>
|
||||
<insert id="saveInfo">
|
||||
INSERT INTO ma_type_put_in_storage_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null and id != 0">ID,</if>
|
||||
<if test="putInType != null and putInType != ''">PUT_IN_TYPE,</if>
|
||||
NUM,
|
||||
<if test="creator != null and creator != ''">CREATOR,</if>
|
||||
CREATE_DATE,
|
||||
<if test="remarks != null and remarks != ''">REMARKS</if>
|
||||
</trim>
|
||||
VALUES
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null and id != 0">#{id},</if>
|
||||
<if test="putInType != null and putInType != ''">#{putInType},</if>
|
||||
1,
|
||||
<if test="creator != null and creator != ''">#{creator},</if>
|
||||
sysdate(),
|
||||
<if test="remarks != null and remarks != ''">#{remarks}</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<insert id="insertMachine" useGeneratedKeys="true" keyProperty="maId">
|
||||
insert into ma_machine (
|
||||
<if test="typeId != null and typeId != '' ">type_id,</if>
|
||||
<if test="maCode != null and maCode != '' ">ma_code,</if>
|
||||
ma_status,
|
||||
<if test="code != null and code != ''">qr_code,</if>
|
||||
<if test="buyPrice != null and buyPrice != ''">buy_price,</if>
|
||||
<if test="maVender != null and maVender != ''">ma_vender,</if>
|
||||
<if test="outFacCode != null and outFacCode != ''">out_fac_code,</if>
|
||||
<if test="thisCheckTime != null and thisCheckTime != ''">this_check_time,</if>
|
||||
<if test="nextCheckTime != null and nextCheckTime != ''">next_check_time,</if>
|
||||
create_time
|
||||
)values(
|
||||
<if test="typeId != null and typeId != ''">#{typeId},</if>
|
||||
<if test="maCode != null and maCode != ''">#{maCode},</if>
|
||||
15,
|
||||
<if test="code != null and code != ''">#{code},</if>
|
||||
<if test="buyPrice != null and buyPrice != ''">#{buyPrice},</if>
|
||||
<if test="maVender != null and maVender != ''">#{maVender},</if>
|
||||
<if test="outFacCode != null and outFacCode != ''">#{outFacCode},</if>
|
||||
<if test="thisCheckTime != null and thisCheckTime != ''">#{thisCheckTime},</if>
|
||||
<if test="nextCheckTime != null and nextCheckTime != ''">#{nextCheckTime},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertMachineLabel">
|
||||
insert into ma_machine_label
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="maId != null">label_id,</if>
|
||||
<if test="code != null">label_code,</if>
|
||||
<if test="maId != null">ma_id,</if>
|
||||
is_bind,
|
||||
label_type,
|
||||
create_time
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="maId != null">#{maId},</if>
|
||||
<if test="code != null">#{code},</if>
|
||||
<if test="maId != null">#{maId},</if>
|
||||
1,
|
||||
9,
|
||||
now()
|
||||
</trim>
|
||||
</insert>
|
||||
<insert id="insertLabelBind">
|
||||
insert into ma_label_bind
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="maId != null">ma_id,</if>
|
||||
<if test="code != null">label_code,</if>
|
||||
<if test="typeId != null">type_id,</if>
|
||||
label_type,
|
||||
bind_time,
|
||||
status
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="maId != null">#{maId},</if>
|
||||
<if test="code != null">#{code},</if>
|
||||
<if test="typeId != null">#{typeId},</if>
|
||||
9,
|
||||
now(),
|
||||
1
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateMaType">
|
||||
UPDATE ma_type
|
||||
SET num = num + #{num}
|
||||
<where>
|
||||
<if test="typeId != null "> and type_id = #{typeId}</if>
|
||||
</where>
|
||||
</update>
|
||||
|
||||
<select id="getList" resultType="com.bonus.sgzb.material.domain.PutInStorageBean">
|
||||
SELECT
|
||||
|
|
@ -22,4 +140,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
LEFT JOIN ma_type mt2 on mt2.type_id=mt.parent_id
|
||||
LEFT JOIN sys_user su on su.user_id=pisi.CREATOR
|
||||
</select>
|
||||
<select id="selectById" resultType="java.lang.Integer">
|
||||
select count(*)
|
||||
from ma_machine
|
||||
<where>
|
||||
<if test="code != null "> and qr_code = #{code}</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -55,6 +55,14 @@ export function getDeviceTypeTree(params = {}){
|
|||
})
|
||||
}
|
||||
|
||||
// 提交编码入库
|
||||
export function inputByCode(data) {
|
||||
return request({
|
||||
url: '/material/inventoryAndWarehousing/addList',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@
|
|||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">查询</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
<el-button type="success" icon="el-icon-plus" size="mini" @click="handleNumberAdd">数量盘点</el-button>
|
||||
<el-button type="success" icon="el-icon-plus" size="mini" @click="handleCodeAdd">编号盘点</el-button>
|
||||
<el-button type="success" icon="el-icon-plus" size="mini" @click="handleCodeAdd">编码盘点</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
|
|
@ -157,142 +157,178 @@
|
|||
<el-dialog
|
||||
:title="title"
|
||||
:visible.sync="codeOpen"
|
||||
width="95%"
|
||||
width="1450px"
|
||||
append-to-body
|
||||
:show-close="false"
|
||||
:close-on-click-modal="false"
|
||||
>
|
||||
<el-form :model="codeForm" :rules="codeFormRules" ref="codeForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="入库来源" label-width="150px" prop="codeInStoreSource">
|
||||
<!-- <el-input
|
||||
v-model="queryParams.dictName"
|
||||
placeholder="请输入关键字"
|
||||
clearable
|
||||
style="width: 240px"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/> -->
|
||||
<el-select
|
||||
v-model="codeForm.codeInStoreSource"
|
||||
placeholder="请选择入库来源"
|
||||
clearable filterable
|
||||
style="width: 260px"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in dict.type.sys_normal_disable"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备/物资类型" label-width="150px" prop="codeDeviceType">
|
||||
<!-- <el-input
|
||||
v-model="codeForm.codeDeviceType"
|
||||
placeholder="请输入设备/物资类型"
|
||||
clearable
|
||||
style="width: 260px"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/> -->
|
||||
<el-cascader
|
||||
placeholder="请输入物品类型"
|
||||
:options="deviceTypeTree"
|
||||
:props="deviceTypeTreeProps"
|
||||
v-model="deviceType"
|
||||
@change="deviceTypeChange"
|
||||
ref="deviceTypeCascader"
|
||||
style="width: 320px;"
|
||||
filterable
|
||||
:disabled="cascaderDisabled"
|
||||
></el-cascader>
|
||||
</el-form-item>
|
||||
<el-form-item label="待入库总数" label-width="150px" prop="codeWaitInSum">
|
||||
<el-input
|
||||
v-model="codeForm.codeWaitInSum"
|
||||
placeholder="请输入待入库总数"
|
||||
clearable
|
||||
style="width: 260px"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="前缀" label-width="150px" prop="codePrefix">
|
||||
<el-input
|
||||
v-model="codeForm.codePrefix"
|
||||
placeholder="请输入前缀"
|
||||
clearable
|
||||
style="width: 260px"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="后缀范围" label-width="150px" prop="codeSuffixStart">
|
||||
<el-input
|
||||
v-model="codeForm.codeSuffixStart"
|
||||
clearable
|
||||
style="width: 320px"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="~" label-width="auto" prop="codeSuffixEnd">
|
||||
<el-input
|
||||
v-model="codeForm.codeSuffixEnd"
|
||||
clearable
|
||||
style="width: 320px"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="单价" label-width="150px" prop="codeSinglePrice">
|
||||
<el-input
|
||||
v-model="codeForm.codeSinglePrice"
|
||||
placeholder="请输入单价"
|
||||
clearable
|
||||
style="width: 260px"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="选择厂家" label-width="150px" prop="codeFactory">
|
||||
<el-select
|
||||
v-model="codeForm.codeFactory"
|
||||
placeholder="请选择厂家"
|
||||
clearable filterable
|
||||
style="width: 320px"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in supplierList"
|
||||
:key="item.supplierId"
|
||||
:label="item.supplier"
|
||||
:value="item.supplierId"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="检修时间" label-width="150px" prop="codeCheckFixTime">
|
||||
<el-input
|
||||
v-model="codeForm.codeCheckFixTime"
|
||||
placeholder="请输入检修时间"
|
||||
clearable
|
||||
style="width: 260px"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="下次检修时间" label-width="150px" prop="codeNextCheckFixTime">
|
||||
<el-input
|
||||
v-model="codeForm.codeNextCheckFixTime"
|
||||
placeholder="请输入下次检修时间"
|
||||
clearable
|
||||
style="width: 260px"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" label-width="150px" prop="codeNote">
|
||||
<el-input
|
||||
v-model="codeForm.codeNote"
|
||||
type="textarea"
|
||||
style="width: 320px"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item style="margin-left: 200px;">
|
||||
<el-button type="primary" icon="el-icon-edit" size="mini" @click="fillCodeForm">点击填充</el-button>
|
||||
<!-- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> -->
|
||||
</el-form-item>
|
||||
<el-form :model="codeForm" :rules="codeFormRules" ref="codeForm" size="small" :inline="true" v-show="showSearch">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="7">
|
||||
<el-form-item label="入库来源" label-width="130px" prop="putInType">
|
||||
<el-select
|
||||
v-model="codeForm.putInType"
|
||||
placeholder="请选择入库来源"
|
||||
clearable filterable
|
||||
style="width: 220px"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in codeInStoreOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="10">
|
||||
<el-form-item label="设备/物资类型" label-width="130px" prop="typeId">
|
||||
<el-cascader
|
||||
placeholder="请选择物品类型"
|
||||
:options="deviceTypeTree"
|
||||
:props="deviceTypeTreeProps"
|
||||
v-model="deviceType"
|
||||
@change="deviceTypeChange"
|
||||
ref="deviceTypeCascader"
|
||||
style="width: 400px;"
|
||||
clearable filterable
|
||||
:disabled="cascaderDisabled"
|
||||
></el-cascader>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="待入库总数" label-width="130px" prop="num">
|
||||
<el-input-number
|
||||
v-model="codeForm.num"
|
||||
placeholder="请输入待入库总数"
|
||||
clearable
|
||||
:min="1"
|
||||
:max="99"
|
||||
:controls="false"
|
||||
style="width: 220px;"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="7">
|
||||
<el-form-item label="前缀" label-width="130px" prop="codePrefix">
|
||||
<el-input
|
||||
v-model="codeForm.codePrefix"
|
||||
placeholder="请输入前缀"
|
||||
clearable
|
||||
style="width: 220px"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="10">
|
||||
<el-form-item label="后缀范围" label-width="130px" prop="codeSuffixStart">
|
||||
<el-input
|
||||
v-model="codeForm.codeSuffixStart"
|
||||
clearable
|
||||
placeholder="请输入后缀范围"
|
||||
style="width: 185px"
|
||||
@keyup.enter.native="handleQuery"
|
||||
@input="changeInput(codeForm.codeSuffixStart)"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="~" label-width="auto" prop="codeSuffixEnd">
|
||||
<el-input
|
||||
v-model="codeForm.codeSuffixEnd"
|
||||
clearable
|
||||
placeholder="请输入后缀范围"
|
||||
style="width: 185px"
|
||||
@keyup.enter.native="handleQuery"
|
||||
@input="changeInput(codeForm.codeSuffixEnd)"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="单价" label-width="130px" prop="buyPrice">
|
||||
<el-input-number
|
||||
v-model="codeForm.buyPrice"
|
||||
:precision="2"
|
||||
placeholder="请输入单价"
|
||||
clearable
|
||||
:min="0"
|
||||
:controls="false"
|
||||
style="width: 220px"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="7">
|
||||
<el-form-item label="选择厂家" label-width="130px" prop="codeFactory">
|
||||
<el-select
|
||||
v-model="codeForm.codeFactory"
|
||||
placeholder="请选择厂家"
|
||||
clearable filterable
|
||||
style="width: 220px"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in supplierList"
|
||||
:key="item.supplierId"
|
||||
:label="item.supplier"
|
||||
:value="item.supplierId"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="10">
|
||||
<el-form-item label="检修时间" label-width="130px" prop="thisCheckFixTime">
|
||||
<el-date-picker
|
||||
v-model="codeForm.thisCheckFixTime"
|
||||
type="date"
|
||||
placeholder="请输入检修时间"
|
||||
style="width: 400px"
|
||||
@keyup.enter.native="handleQuery">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="下次检修时间" label-width="130px" prop="nextCheckFixTime">
|
||||
<el-date-picker
|
||||
v-model="codeForm.nextCheckFixTime"
|
||||
type="date"
|
||||
placeholder="请输入检修时间"
|
||||
style="width: 220px"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="20">
|
||||
|
||||
<el-col :span="7">
|
||||
<el-form-item label="备注" label-width="130px" prop="remarks">
|
||||
<el-input
|
||||
v-model="codeForm.remarks"
|
||||
type="textarea"
|
||||
placeholder="请输入备注"
|
||||
maxlength="200"
|
||||
rows="4"
|
||||
show-word-limit
|
||||
style="width: 220px"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="10">
|
||||
<el-form-item style="margin-left: 200px;">
|
||||
<el-button type="primary" icon="el-icon-edit" size="mini" @click="fillCodeForm">点击填充</el-button>
|
||||
<!-- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> -->
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<!-- <el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
|
|
@ -324,15 +360,67 @@
|
|||
>导出</el-button>
|
||||
</el-col>
|
||||
</el-row> -->
|
||||
<el-table v-loading="loading" :data="returnList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="序号" align="center" prop="dictId" />
|
||||
<el-table-column label="设备编码" align="center" prop="dictName" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="出厂编码" align="center" prop="dictName" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="生产厂家" align="center" prop="dictName" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="检修日期" align="center" prop="dictName" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="下次检修日期" align="center" prop="dictName" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="单价" align="center" prop="dictName" :show-overflow-tooltip="true" />
|
||||
<el-table v-loading="loading" :data="codeTableList" @selection-change="handleSelectionChange" :stripe="true" :border="true">
|
||||
<!-- <el-table-column type="selection" width="55" align="center" /> -->
|
||||
<el-table-column label="序号" align="center" type="index" />
|
||||
<el-table-column label="设备编码" align="center" prop="maCode" :show-overflow-tooltip="true">
|
||||
<template v-slot:default="{ row }">
|
||||
<el-input v-model="row.maCode" placeholder="请输入设备编码"></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="出厂编码" align="center" prop="outFacCode" :show-overflow-tooltip="true">
|
||||
<template v-slot:default="{ row }">
|
||||
<el-input v-model="row.outFacCode" placeholder="请输入设备编码"></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="生产厂家" align="center" prop="maVender" :show-overflow-tooltip="true">
|
||||
<template v-slot:default="{ row }">
|
||||
<el-select v-model="row.maVender" placeholder="请选择生产厂家" clearable filterable>
|
||||
<el-option
|
||||
v-for="item in supplierList"
|
||||
:key="item.supplierId"
|
||||
:label="item.supplier"
|
||||
:value="item.supplierId"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="检修日期" align="center" prop="thisCheckFixTime" :show-overflow-tooltip="true">
|
||||
<template v-slot:default="{ row }">
|
||||
<el-date-picker
|
||||
v-model="row.thisCheckFixTime"
|
||||
type="date"
|
||||
placeholder="请输入检修时间"
|
||||
style="width: 160px"
|
||||
@keyup.enter.native="handleQuery"
|
||||
></el-date-picker>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="下次检修日期" align="center" prop="nextCheckFixTime" :show-overflow-tooltip="true">
|
||||
<template v-slot:default="{ row }">
|
||||
<el-date-picker
|
||||
v-model="row.nextCheckFixTime"
|
||||
type="date"
|
||||
placeholder="请输入下次检修时间"
|
||||
style="width: 160px"
|
||||
@keyup.enter.native="handleQuery"
|
||||
></el-date-picker>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单价" align="center" prop="buyPrice" :show-overflow-tooltip="true">
|
||||
<template v-slot:default="{ row }">
|
||||
<el-input-number
|
||||
v-model="row.buyPrice"
|
||||
:precision="2"
|
||||
placeholder="请输入单价"
|
||||
:min="0"
|
||||
:controls="false"
|
||||
clearable
|
||||
style="width: 160px"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="状态" align="center" prop="status">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
|
||||
|
|
@ -340,18 +428,19 @@
|
|||
</el-table-column> -->
|
||||
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<template v-slot:default="{ row }">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
>通过</el-button>
|
||||
<el-button
|
||||
icon="el-icon-edit"
|
||||
@click="handleResetRow(row)"
|
||||
>重置</el-button>
|
||||
<!-- <el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
>不通过</el-button>
|
||||
>不通过</el-button> -->
|
||||
<!-- <el-button-->
|
||||
<!-- size="mini"-->
|
||||
<!-- type="text"-->
|
||||
|
|
@ -386,14 +475,15 @@ import { listType, getType, delType, addType, updateType, refreshCache } from "@
|
|||
import {
|
||||
getReturnOfMaterialsInfoAll,
|
||||
getTypeList,
|
||||
getDeviceTypeTree
|
||||
getDeviceTypeTree,
|
||||
inputByCode
|
||||
} from "@/api/store/putInStore";
|
||||
import { getInfo } from '@/api/login'
|
||||
import { supplierInfoList } from "@/api/store/tools";
|
||||
|
||||
export default {
|
||||
name: "DevicesWarehousing",
|
||||
dicts: ['sys_normal_disable'],
|
||||
// dicts: ['sys_normal_disable'],
|
||||
data() {
|
||||
return {
|
||||
// 用户信息
|
||||
|
|
@ -414,8 +504,15 @@ export default {
|
|||
modelList: [],
|
||||
// 表格数据
|
||||
returnList: [],
|
||||
// 编码盘点表格数据
|
||||
codeTableList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 入库来源选项
|
||||
codeInStoreOptions: [
|
||||
{ label: "库存盘点入库", value: "库存盘点入库" },
|
||||
{ label: "退料入库", value: "退料入库" },
|
||||
],
|
||||
// 是否显示弹出层
|
||||
numberOpen: false,
|
||||
codeOpen: false,
|
||||
|
|
@ -459,17 +556,17 @@ export default {
|
|||
// 表单参数:编号表单 / 数量表单
|
||||
numberForm: {},
|
||||
codeForm: {
|
||||
codeInStoreSource: undefined,
|
||||
codeNote: undefined,
|
||||
codeDeviceType: undefined,
|
||||
codeWaitInSum: undefined,
|
||||
putInType: undefined,
|
||||
remarks: undefined,
|
||||
typeId: undefined,
|
||||
num: undefined,
|
||||
codePrefix: undefined,
|
||||
codeSuffixStart: undefined,
|
||||
codeSuffixEnd: undefined,
|
||||
codeSinglePrice: undefined,
|
||||
buyPrice: undefined,
|
||||
codeFactory: undefined,
|
||||
codeCheckFixTime: undefined,
|
||||
codeNextCheckFixTime: undefined,
|
||||
thisCheckFixTime: undefined,
|
||||
nextCheckFixTime: undefined,
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
},
|
||||
|
|
@ -483,13 +580,13 @@ export default {
|
|||
]
|
||||
},
|
||||
codeFormRules: {
|
||||
codeInStoreSource: [
|
||||
putInType: [
|
||||
{ required: true, message: "入库来源不能为空", trigger: "blur" }
|
||||
],
|
||||
codeDeviceType: [
|
||||
typeId: [
|
||||
{ required: true, message: "设备/物资类型不能为空", trigger: "blur" }
|
||||
],
|
||||
codeWaitInSum: [
|
||||
num: [
|
||||
{ required: true, message: "待入库总数不能为空", trigger: "blur" }
|
||||
],
|
||||
}
|
||||
|
|
@ -538,6 +635,8 @@ export default {
|
|||
this.resetCodeForm();
|
||||
this.deviceType = {}
|
||||
this.reset();
|
||||
this.codeTableList = []
|
||||
this.$refs['codeForm'].clearValidate()
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
|
|
@ -553,17 +652,17 @@ export default {
|
|||
// 编码表单重置
|
||||
resetCodeForm() {
|
||||
this.codeForm = {
|
||||
codeInStoreSource: undefined,
|
||||
codeNote: undefined,
|
||||
codeDeviceType: undefined,
|
||||
codeWaitInSum: undefined,
|
||||
putInType: undefined,
|
||||
remarks: undefined,
|
||||
typeId: undefined,
|
||||
num: undefined,
|
||||
codePrefix: undefined,
|
||||
codeSuffixStart: undefined,
|
||||
codeSuffixEnd: undefined,
|
||||
codeSinglePrice: undefined,
|
||||
buyPrice: undefined,
|
||||
codeFactory: undefined,
|
||||
codeCheckFixTime: undefined,
|
||||
codeNextCheckFixTime: undefined,
|
||||
thisCheckFixTime: undefined,
|
||||
nextCheckFixTime: undefined,
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
}
|
||||
|
|
@ -575,7 +674,59 @@ export default {
|
|||
},
|
||||
/** 填充编码盘点表单 */
|
||||
fillCodeForm() {
|
||||
console.log(this.codeForm)
|
||||
// 校验表单
|
||||
this.$refs['codeForm'].validate(valid => {
|
||||
if (!valid) return
|
||||
console.log('🚀 ~ fillCodeForm ~ this.codeForm:', this.codeForm);
|
||||
// 清空this.codeTableList
|
||||
this.codeTableList = []
|
||||
// 根据this.codeForm.num的数量, 往this.codeTableList中添加this.codeForm的数据
|
||||
for (let i = 0; i < this.codeForm.num; i++) {
|
||||
// 设备编码: 前缀 拼接 后缀
|
||||
let suffix = (parseInt(this.codeForm.codeSuffixStart) + i).toString().padStart(this.codeForm.codeSuffixStart?.length, '0')
|
||||
console.log('🚀 ~ fillCodeForm ~ suffix:', suffix);
|
||||
suffix = isNaN(suffix) ? '' : suffix
|
||||
const maCode = `${this.codeForm.codePrefix || ''}${suffix}`
|
||||
// 出厂编码
|
||||
const outFacCode = ''
|
||||
// 生产厂家
|
||||
const maVender = this.supplierList.find(item => item.supplierId == this.codeForm.codeFactory)?.supplier || ''
|
||||
// 检修日期: codeForm.thisCheckFixTime, 时间格式为 yyyy-MM-dd
|
||||
let thisCheckFixTime = new Date(this.codeForm.thisCheckFixTime).toLocaleDateString('zh-CN', {year: 'numeric', month: '2-digit', day: '2-digit'}).replace(/\//g, '-')
|
||||
if (thisCheckFixTime == 'Invalid Date') thisCheckFixTime = ''
|
||||
// 下次检修日期: codeForm.nextCheckFixTime
|
||||
let nextCheckFixTime = new Date(this.codeForm.nextCheckFixTime).toLocaleDateString('zh-CN', {year: 'numeric', month: '2-digit', day: '2-digit'}).replace(/\//g, '-')
|
||||
if (nextCheckFixTime == 'Invalid Date') nextCheckFixTime = ''
|
||||
// 单价: codeForm.buyPrice
|
||||
const buyPrice = this.codeForm.buyPrice || 0
|
||||
this.codeTableList.push({
|
||||
maCode,
|
||||
outFacCode,
|
||||
maVender,
|
||||
thisCheckFixTime,
|
||||
nextCheckFixTime,
|
||||
buyPrice
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
/** 输入框改变 */
|
||||
changeInput(num) {
|
||||
if (isNaN(num)) {
|
||||
this.$message.error('请输入数字类型')
|
||||
this.codeForm.codeSuffixStart = this.codeForm.codeSuffixStart.replace(/[^\d]/g, '')
|
||||
}
|
||||
},
|
||||
|
||||
handleResetRow(row) {
|
||||
// 重置当前行所有数据为空
|
||||
row.maCode = ''
|
||||
row.outFacCode = ''
|
||||
row.maVender = ''
|
||||
row.thisCheckFixTime = ''
|
||||
row.nextCheckFixTime = ''
|
||||
row.buyPrice = 0
|
||||
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
|
|
@ -615,7 +766,34 @@ export default {
|
|||
submitForm: function() {
|
||||
this.$refs['codeForm'].validate(valid => {
|
||||
if (valid) {
|
||||
console.log(this.codeForm)
|
||||
console.log('🚀 ~ this.codeForm:', this.codeForm);
|
||||
console.log('🚀 ~ this.codeTableList:', this.codeTableList);
|
||||
// 提交数据
|
||||
const SavePutInfoDto = {
|
||||
isCode: true, // 是否编码盘点
|
||||
putInType: this.codeForm.putInType,
|
||||
typeId: this.codeForm.typeId,
|
||||
num: this.codeForm.num,
|
||||
remarks: this.codeForm.remarks || '',
|
||||
machIneDtoList: this.codeTableList
|
||||
}
|
||||
console.log('🚀 ~ submitForm: ~ SavePutInfoDto', SavePutInfoDto)
|
||||
|
||||
if (this.codeTableList.length == 0) {
|
||||
this.$message.error('请点击填充按钮, 填充数据')
|
||||
return
|
||||
}
|
||||
|
||||
// 发送请求
|
||||
inputByCode(SavePutInfoDto).then(response => {
|
||||
this.$message.success('入库成功')
|
||||
this.codeOpen = false
|
||||
this.getList()
|
||||
this.resetCodeForm()
|
||||
this.reset()
|
||||
this.codeTableList = []
|
||||
this.deviceType = {}
|
||||
})
|
||||
}
|
||||
})
|
||||
/* this.$refs["form"].validate(valid => {
|
||||
|
|
@ -670,14 +848,14 @@ export default {
|
|||
},
|
||||
/////// 设备类型树 切换
|
||||
deviceTypeChange(val){
|
||||
console.log(val)
|
||||
this.cascaderDisabled = true
|
||||
console.log('🚀 ~ deviceTypeChange ~ val:', val);
|
||||
// this.cascaderDisabled = true
|
||||
let nodes = null;
|
||||
nodes = this.$refs.deviceTypeCascader.getCheckedNodes().length > 0 ? this.$refs.deviceTypeCascader.getCheckedNodes() : [this.$refs.deviceTypeCascader.panel.getNodeByValue(val)]
|
||||
if(nodes[0].level != 4){
|
||||
return
|
||||
}
|
||||
console.log(nodes[0])
|
||||
console.log('🚀 ~ deviceTypeChange ~ nodes[0]:', nodes[0]);
|
||||
for(let i = 0; i < this.leaseApplyDetails.length; i++) {
|
||||
if (this.leaseApplyDetails[i].typeId == nodes[0].data.id) {
|
||||
this.leaseApplyDetails.splice(i,1)
|
||||
|
|
@ -687,15 +865,15 @@ export default {
|
|||
this.leaseApplyDetails.push(
|
||||
this.handelTableItemData(nodes[0])
|
||||
)
|
||||
console.log(this.leaseApplyDetails)
|
||||
console.log('🚀 ~ deviceTypeChange ~ this.leaseApplyDetails:', this.leaseApplyDetails);
|
||||
// this.deviceType = {}
|
||||
},
|
||||
//// 将数据处理成 表格中需要的数据
|
||||
handelTableItemData(node){
|
||||
const template = JSON.parse(JSON.stringify(this.leaseApplyDetailsItem))
|
||||
// template.createBy = this.user.name
|
||||
console.log(node.data, node.data.id)
|
||||
this.codeForm.codeDeviceType = node.data.id
|
||||
console.log('🚀 ~ handelTableItemData ~ node.data, node.data.id:', node.data, node.data.id);
|
||||
this.codeForm.typeId = node.data.id
|
||||
template.num = node.data.num
|
||||
template.companyId = node.data.companyId
|
||||
template.typeId = node.data.id
|
||||
|
|
@ -707,8 +885,7 @@ export default {
|
|||
const index = this.leaseApplyInfoList.find(key => key.companyId == node.data.companyId)
|
||||
template.parentId = index ? index.id : ''
|
||||
}
|
||||
|
||||
console.log(template)
|
||||
console.log('🚀 ~ handelTableItemData ~ template:', template);
|
||||
|
||||
return template
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue