Commit c5024746 authored by 刘帅's avatar 刘帅

1.基础结构调整,增加仓库

2.物料库存改为动态计算
parent 51ce87e0
......@@ -49,9 +49,25 @@ public class ErpMaterialController extends BaseController {
@SaCheckPermission("business:material:list")
@GetMapping("/list")
public TableDataInfo<ErpMaterialVo> list(ErpMaterialBo bo, PageQuery pageQuery) {
return iErpMaterialService.queryPageList(bo, pageQuery);
}
/**
* 查询物资列表(库存大于0)
*/
@GetMapping("/customList")
public TableDataInfo<ErpMaterialVo> customList(ErpMaterialBo bo, PageQuery pageQuery) {
return iErpMaterialService.customQueryPageList(bo, pageQuery);
}
/**
* 查询物资列表(全部)
*/
@GetMapping("/customListAll")
public TableDataInfo<ErpMaterialVo> customListAll(ErpMaterialBo bo, PageQuery pageQuery) {
return iErpMaterialService.customQueryPageListAll(bo, pageQuery);
}
/**
* 物料导入模板下载
*/
......
package com.maintain.business.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.maintain.business.domain.bo.ErpMaterialInventoryRecordBo;
import com.maintain.business.domain.vo.ErpMaterialInventoryRecordVo;
import com.maintain.business.service.IErpMaterialInventoryRecordService;
import com.maintain.common.annotation.Log;
import com.maintain.common.annotation.RepeatSubmit;
import com.maintain.common.core.controller.BaseController;
import com.maintain.common.core.domain.PageQuery;
import com.maintain.common.core.domain.R;
import com.maintain.common.core.page.TableDataInfo;
import com.maintain.common.core.validate.AddGroup;
import com.maintain.common.core.validate.EditGroup;
import com.maintain.common.enums.BusinessType;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.Arrays;
import java.util.List;
/**
* 物料库存记录
*
* @author liushuai
* @date 2025-07-16
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/business/materialInventoryRecord")
public class ErpMaterialInventoryRecordController extends BaseController {
private final IErpMaterialInventoryRecordService iErpMaterialInventoryRecordService;
/**
* 查询物料库存记录列表
*/
@GetMapping("/list")
public TableDataInfo<ErpMaterialInventoryRecordVo> list(ErpMaterialInventoryRecordBo bo, PageQuery pageQuery) {
return iErpMaterialInventoryRecordService.customQueryPageList(bo, pageQuery);
}
/**
* 查询物料库存记录列表
*/
@GetMapping("/listByMaterialId")
public R<List<ErpMaterialInventoryRecordVo>> listByMaterialId(ErpMaterialInventoryRecordBo bo) {
return R.ok(iErpMaterialInventoryRecordService.queryListByMaterialId(bo));
}
/**
* 获取物料库存记录详细信息
*
* @param id 主键
*/
@SaCheckPermission("business:materialInventoryRecord:query")
@GetMapping("/{id}")
public R<ErpMaterialInventoryRecordVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable Long id) {
return R.ok(iErpMaterialInventoryRecordService.queryById(id));
}
/**
* 新增物料库存记录
*/
@SaCheckPermission("business:materialInventoryRecord:add")
@Log(title = "物料库存记录", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
public R<Void> add(@Validated(AddGroup.class) @RequestBody ErpMaterialInventoryRecordBo bo) {
return toAjax(iErpMaterialInventoryRecordService.insertByBo(bo));
}
/**
* 修改物料库存记录
*/
@SaCheckPermission("business:materialInventoryRecord:edit")
@Log(title = "物料库存记录", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping()
public R<Void> edit(@Validated(EditGroup.class) @RequestBody ErpMaterialInventoryRecordBo bo) {
return toAjax(iErpMaterialInventoryRecordService.updateByBo(bo));
}
/**
* 删除物料库存记录
*
* @param ids 主键串
*/
@SaCheckPermission("business:materialInventoryRecord:remove")
@Log(title = "物料库存记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] ids) {
return toAjax(iErpMaterialInventoryRecordService.deleteWithValidByIds(Arrays.asList(ids), true));
}
}
package com.maintain.business.domain;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.*;
import com.maintain.common.convert.ExcelDictConvert;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.Date;
import java.math.BigDecimal;
import java.math.BigDecimal;
import com.maintain.common.core.domain.BaseEntity;
/**
* 物料库存记录对象 erp_material_inventory_record
*
* @author liushuai
* @date 2025-07-16
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("erp_material_inventory_record")
public class ErpMaterialInventoryRecord extends BaseEntity {
private static final long serialVersionUID=1L;
/**
* 主键
*/
@TableId(value = "id")
private Long id;
/**
* 明细ID(入库|退货|出库|退料)
*/
private Long infoId;
/**
* 物料ID
*/
private Long materialId;
/**
* 部门ID
*/
private Long deptId;
/**
* 仓库ID
*/
private Long warehouseId;
/**
* 数量
*/
private BigDecimal number;
/**
* 单价
*/
private BigDecimal price;
/**
* 金额
*/
private BigDecimal money;
/**
* 类型(1入库2退货3出库4退料)
*/
private String type;
/**
* 创建部门(数据权限)
*/
private Long createDeptId;
}
package com.maintain.business.domain;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
......@@ -52,6 +53,14 @@ public class ErpMaterialPickingInfo extends BaseEntity {
* 仓库货位ID
*/
private Long warehouseLocationId;
/**
* 仓库ID
*/
private Long warehouseId;
/**
* 仓库名称
*/
private String warehouseName;
/**
* 供应商ID
*/
......
......@@ -10,6 +10,8 @@ import javax.validation.constraints.*;
import java.util.Date;
import java.math.BigDecimal;
import java.util.List;
import com.maintain.common.core.domain.BaseEntity;
/**
......@@ -44,6 +46,11 @@ public class ErpMaterialBo extends BaseEntity {
*/
private Long deptId;
/**
* 仓库ID列表
*/
private List<Long> warehouseIdList;
/**
* 仓库ID
*/
......
package com.maintain.business.domain.bo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.maintain.common.convert.ExcelDictConvert;
import com.maintain.common.core.validate.AddGroup;
import com.maintain.common.core.validate.EditGroup;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.*;
import java.util.Date;
import java.math.BigDecimal;
import com.maintain.common.core.domain.BaseEntity;
/**
* 物料库存记录业务对象 erp_material_inventory_record
*
* @author liushuai
* @date 2025-07-16
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class ErpMaterialInventoryRecordBo extends BaseEntity {
/**
* 主键
*/
@NotNull(message = "主键不能为空", groups = { EditGroup.class })
private Long id;
/**
* 明细ID(入库|退货|出库|退料)
*/
@NotNull(message = "明细ID(入库|退货|出库|退料)不能为空", groups = { AddGroup.class, EditGroup.class })
private Long infoId;
/**
* 物料ID
*/
@NotNull(message = "物料ID不能为空", groups = { AddGroup.class, EditGroup.class })
private Long materialId;
/**
* 供应商名称
*/
private String vendorName;
/**
* 物资编码
*/
@NotBlank(message = "物资编码不能为空", groups = { AddGroup.class, EditGroup.class })
private String materialCode;
/**
* 物资名称
*/
@NotBlank(message = "物资名称不能为空", groups = { AddGroup.class, EditGroup.class })
private String materialName;
/**
* 物资规格
*/
@NotBlank(message = "物资规格不能为空", groups = { AddGroup.class, EditGroup.class })
private String materialSpecifications;
/**
* 部门ID
*/
@NotNull(message = "部门ID不能为空", groups = { AddGroup.class, EditGroup.class })
private Long deptId;
/**
* 仓库ID
*/
@NotNull(message = "仓库ID不能为空", groups = { AddGroup.class, EditGroup.class })
private Long warehouseId;
/**
* 仓库ID
*/
private String warehouseName;
/**
* 数量
*/
@NotNull(message = "数量不能为空", groups = { AddGroup.class, EditGroup.class })
private BigDecimal number;
/**
* 单价
*/
@NotNull(message = "单价不能为空", groups = { AddGroup.class, EditGroup.class })
private BigDecimal price;
/**
* 金额
*/
@NotNull(message = "金额不能为空", groups = { AddGroup.class, EditGroup.class })
private BigDecimal money;
/**
* 类型(1入库2退货3出库4退料)
*/
@NotBlank(message = "类型(1入库2退货3出库4退料)不能为空", groups = { AddGroup.class, EditGroup.class })
private String type;
/**
* 创建部门(数据权限)
*/
private Long createDeptId;
}
......@@ -64,6 +64,17 @@ public class ErpMaterialPickingInfoBo extends BaseEntity {
@NotNull(message = "仓库货位ID不能为空", groups = { AddGroup.class, EditGroup.class })
private Long warehouseLocationId;
/**
* 仓库ID
*/
@NotNull(message = "仓库ID不能为空", groups = { AddGroup.class, EditGroup.class })
private Long warehouseId;
/**
* 仓库名称
*/
private String warehouseName;
/**
* 供应商ID
*/
......
......@@ -47,31 +47,26 @@ public class ErpSettlementMaintainBo extends BaseEntity {
/**
* 客户名称
*/
@NotBlank(message = "客户名称不能为空", groups = { AddGroup.class, EditGroup.class })
private String clientName;
/**
* 客户手机号
*/
@NotBlank(message = "客户手机号不能为空", groups = { AddGroup.class, EditGroup.class })
private String clientPhone;
/**
* 客户类型(1个人 2企业)
*/
@NotNull(message = "客户类型(1个人 2企业)不能为空", groups = { AddGroup.class, EditGroup.class })
private Integer clientType;
/**
* 证件类型(1居民身份证 2纳税识别号)
*/
@NotNull(message = "证件类型(1居民身份证 2纳税识别号)不能为空", groups = { AddGroup.class, EditGroup.class })
private Integer clientCertificateType;
/**
* 证件号
*/
@NotBlank(message = "证件号不能为空", groups = { AddGroup.class, EditGroup.class })
private String clientCertificateNumber;
/**
......
package com.maintain.business.domain.vo;
import java.math.BigDecimal;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.maintain.common.annotation.ExcelDictFormat;
import com.maintain.common.convert.ExcelDictConvert;
import lombok.Data;
import java.util.Date;
import java.io.Serializable;
/**
* 物料库存记录视图对象 erp_material_inventory_record
*
* @author liushuai
* @date 2025-07-16
*/
@Data
@ExcelIgnoreUnannotated
public class ErpMaterialInventoryRecordVo implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private Long id;
/**
* 明细ID(入库|退货|出库|退料)
*/
@ExcelProperty(value = "明细ID", converter = ExcelDictConvert.class)
@ExcelDictFormat(readConverterExp = "入=库|退货|出库|退料")
private Long infoId;
/**
* 入库单号
*/
private String putawayCode;
/**
* 报修单号
*/
private String repairNumber;
/**
* 退货单号
*/
private String returnsCode;
/**
* 出库单号
*/
private String outNumber;
/**
* 退料单号
*/
private String returnNumber;
/**
* 物料ID
*/
@ExcelProperty(value = "物料ID")
private Long materialId;
/**
* 仓库
*/
@ExcelProperty(value = "仓库")
private String warehouseName;
/**
* 物资编码
*/
@ExcelProperty(value = "物资编码")
private String materialCode;
/**
* 物资名称
*/
@ExcelProperty(value = "物资名称")
private String materialName;
/**
* 物资规格
*/
@ExcelProperty(value = "物资规格")
private String materialSpecifications;
/**
* 物资单位
*/
@ExcelProperty(value = "物资单位")
private String materialUnit;
/**
* 供应商ID
*/
private Long vendorId;
/**
* 供应商名称
*/
@ExcelProperty(value = "供应商名称")
private String vendorName;
/**
* 物资品牌
*/
@ExcelProperty(value = "物资品牌")
private String materialBrand;
/**
* 采购标的
*/
@ExcelProperty(value = "采购标的")
private String procurementSubject;
/**
* 适用车型
*/
@ExcelProperty(value = "适用车型")
private String compatibleWith;
/**
* 物资图片
*/
private String materialUrl;
/**
* 质保期(月)
*/
@ExcelProperty(value = "质保期(月)")
private Integer materialWarrantyPeriod;
/**
* 参考价
*/
@ExcelProperty(value = "参考价")
private BigDecimal referencePrice;
/**
* 销售价
*/
@ExcelProperty(value = "销售价")
private BigDecimal sellingPrice;
/**
* 库存
*/
@ExcelProperty(value = "库存")
private BigDecimal inventory;
/**
* 部门ID
*/
@ExcelProperty(value = "部门ID")
private Long deptId;
/**
* 仓库ID
*/
@ExcelProperty(value = "仓库ID")
private Long warehouseId;
/**
* 数量
*/
@ExcelProperty(value = "数量")
private BigDecimal number;
/**
* 单价
*/
@ExcelProperty(value = "单价")
private BigDecimal price;
/**
* 金额
*/
@ExcelProperty(value = "金额")
private BigDecimal money;
/**
* 类型(1入库2退货3出库4退料)
*/
@ExcelProperty(value = "类型", converter = ExcelDictConvert.class)
@ExcelDictFormat(readConverterExp = "1=入库2退货3出库4退料")
private String type;
/**
* 创建部门(数据权限)
*/
@ExcelProperty(value = "创建部门(数据权限)", converter = ExcelDictConvert.class)
private Long createDeptId;
/**
* 创建人
*/
private String createBy;
/**
* 创建时间
*/
private Date createTime;
}
......@@ -53,6 +53,17 @@ public class ErpMaterialPickingInfoVo implements Serializable {
*/
private Long pickingId;
/**
* 仓库ID
*/
private Long warehouseId;
/**
* 仓库名称
*/
@ExcelProperty(value = "仓库名称")
private String warehouseName;
/**
* 供应商ID
*/
......
......@@ -43,6 +43,11 @@ public class ErpMaterialVo implements Serializable {
*/
private Long warehouseLocationId;
/**
* 物资ID
*/
private Long materialId;
/**
* 物资编码
*/
......@@ -165,15 +170,11 @@ public class ErpMaterialVo implements Serializable {
/**
* 是否通用(0否 1是 默认1)
*/
//@ExcelProperty(value = "是否通用", converter = ExcelDictConvert.class)
//@ExcelDictFormat(dictType = "sys_is_enable")
private String isUniversal;
/**
* 是否盘点中(0否 1是 默认0)
*/
//@ExcelProperty(value = "是否盘点中", converter = ExcelDictConvert.class)
//@ExcelDictFormat(dictType = "sys_is_enable")
private Integer isCheck;
/**
......
package com.maintain.business.mapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.maintain.business.domain.ErpMaterial;
import com.maintain.business.domain.ErpMaterialInventoryRecord;
import com.maintain.business.domain.bo.ErpMaterialInventoryRecordBo;
import com.maintain.business.domain.vo.ErpMaterialInventoryRecordVo;
import com.maintain.business.domain.vo.ErpMaterialVo;
import com.maintain.common.core.mapper.BaseMapperPlus;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 物料库存记录Mapper接口
*
* @author liushuai
* @date 2025-07-16
*/
public interface ErpMaterialInventoryRecordMapper extends BaseMapperPlus<ErpMaterialInventoryRecordMapper, ErpMaterialInventoryRecord, ErpMaterialInventoryRecordVo> {
/**
* 自定义分页查询
* @param page
* @param queryWrapper
* @return
*/
Page<ErpMaterialInventoryRecordVo> customQueryPageList(@Param("page") Page<ErpMaterialInventoryRecord> page, @Param(Constants.WRAPPER) Wrapper<ErpMaterialInventoryRecord> queryWrapper);
/**
* 自定义查询
* @param queryWrapper
* @return
*/
List<ErpMaterialInventoryRecordVo> customQueryList(@Param(Constants.WRAPPER) Wrapper<ErpMaterialInventoryRecord> queryWrapper);
/**
* 查询物料库存列表
*/
List<ErpMaterialInventoryRecordVo> queryListByWarehouseIdAndMaterialId(@Param("warehouseId") Long warehouseId, @Param("materialId") Long materialId, @Param("type") String type);
/**
* 根据仓库ID以及物料ID动态计算物料库存
*/
ErpMaterialInventoryRecordVo queryMaterialByWarehouseIdAndMaterialId(@Param("warehouseId") Long warehouseId, @Param("materialId") Long materialId);
}
......@@ -19,11 +19,20 @@ import org.apache.ibatis.annotations.Param;
public interface ErpMaterialMapper extends BaseMapperPlus<ErpMaterialMapper, ErpMaterial, ErpMaterialVo> {
/**
* 自定义分页查询
* 自定义分页查询(查询存在库存的物料)
* @param page
* @param queryWrapper
* @return
*/
Page<ErpMaterialVo> customQueryPageList(@Param("page") Page<ErpMaterial> page, @Param(Constants.WRAPPER) Wrapper<ErpMaterial> queryWrapper);
/**
* 自定义分页查询(查询全部物料)
* @param page
* @param queryWrapper
* @return
*/
Page<ErpMaterialVo> customQueryPageListByWarehouseId(@Param("page") Page<ErpMaterial> page, @Param(Constants.WRAPPER) Wrapper<ErpMaterial> queryWrapper, @Param("warehouseId") Long warehouseId);
}
package com.maintain.business.service;
import com.maintain.business.domain.ErpMaterialInventoryRecord;
import com.maintain.business.domain.vo.ErpMaterialInventoryRecordVo;
import com.maintain.business.domain.bo.ErpMaterialInventoryRecordBo;
import com.maintain.common.core.page.TableDataInfo;
import com.maintain.common.core.domain.PageQuery;
import java.util.Collection;
import java.util.List;
/**
* 物料库存记录Service接口
*
* @author liushuai
* @date 2025-07-16
*/
public interface IErpMaterialInventoryRecordService {
/**
* 查询物料库存记录
*/
ErpMaterialInventoryRecordVo queryById(Long id);
/**
* 查询物料库存记录列表
*/
TableDataInfo<ErpMaterialInventoryRecordVo> queryPageList(ErpMaterialInventoryRecordBo bo, PageQuery pageQuery);
/**
* 查询物料库存记录列表(自定义查询)
*/
TableDataInfo<ErpMaterialInventoryRecordVo> customQueryPageList(ErpMaterialInventoryRecordBo bo, PageQuery pageQuery);
/**
* 查询物料库存记录列表
*/
List<ErpMaterialInventoryRecordVo> queryListByMaterialId(ErpMaterialInventoryRecordBo bo);
/**
* 新增物料库存记录
*/
Boolean insertByBo(ErpMaterialInventoryRecordBo bo);
/**
* 修改物料库存记录
*/
Boolean updateByBo(ErpMaterialInventoryRecordBo bo);
/**
* 校验并批量删除物料库存记录信息
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
}
......@@ -33,6 +33,11 @@ public interface IErpMaterialService {
*/
TableDataInfo<ErpMaterialVo> customQueryPageList(ErpMaterialBo bo, PageQuery pageQuery);
/**
* 查询物资列表(自定义查询全部)
*/
TableDataInfo<ErpMaterialVo> customQueryPageListAll(ErpMaterialBo bo, PageQuery pageQuery);
/**
* 查询物资列表
*/
......
......@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.maintain.business.domain.*;
import com.maintain.business.domain.bo.ErpMaterialCheckInfoBo;
import com.maintain.business.domain.vo.ErpMaterialInventoryRecordVo;
import com.maintain.business.domain.vo.ErpWarehouseVo;
import com.maintain.business.mapper.*;
import com.maintain.business.service.IErpMaterialService;
......@@ -52,6 +53,7 @@ public class ErpMaterialCheckServiceImpl implements IErpMaterialCheckService {
private final ErpMaterialPutawayInfoMapper materialPutawayInfoMapper;
private final ErpMaterialPickingMapper materialPickingMapper;
private final ErpMaterialPickingInfoMapper materialPickingInfoMapper;
private final ErpMaterialInventoryRecordMapper materialInventoryRecordMapper;
/**
* 查询物资盘点
*/
......@@ -133,10 +135,10 @@ public class ErpMaterialCheckServiceImpl implements IErpMaterialCheckService {
}).collect(Collectors.toList());
checkInfoMapper.insertBatch(collect);
// 将盘点所在仓库下的物料是否盘点状态更改为 是
LambdaUpdateWrapper<ErpMaterial> materialLambdaUpdateWrapper = Wrappers.lambdaUpdate();
materialLambdaUpdateWrapper.eq(ErpMaterial::getWarehouseId, add.getWarehouseId());
materialLambdaUpdateWrapper.set(ErpMaterial::getIsCheck, IsEnableStatus.YES.getCode());
materialMapper.update(materialLambdaUpdateWrapper);
// LambdaUpdateWrapper<ErpMaterial> materialLambdaUpdateWrapper = Wrappers.lambdaUpdate();
// materialLambdaUpdateWrapper.eq(ErpMaterial::getWarehouseId, add.getWarehouseId());
// materialLambdaUpdateWrapper.set(ErpMaterial::getIsCheck, IsEnableStatus.YES.getCode());
// materialMapper.update(materialLambdaUpdateWrapper);
}
return flag;
}
......@@ -170,15 +172,14 @@ public class ErpMaterialCheckServiceImpl implements IErpMaterialCheckService {
materialCheck.setTaskEndTime(new Date());
materialCheck.setCheckState(CheckState.TWO.getCode());
// 将盘点的仓库状态改为 否
ErpWarehouse warehouse = new ErpWarehouse();
warehouse.setId(bo.getWarehouseId());
ErpWarehouse warehouse = warehouseMapper.selectById(bo.getWarehouseId());
warehouse.setIsCheck(IsEnableStatus.NO.getCode());
warehouseMapper.updateById(warehouse);
// 将盘点所在仓库下的物料是否盘点状态更改为 是
LambdaUpdateWrapper<ErpMaterial> materialLambdaUpdateWrapper = Wrappers.lambdaUpdate();
materialLambdaUpdateWrapper.eq(ErpMaterial::getWarehouseId, materialCheck.getWarehouseId());
materialLambdaUpdateWrapper.set(ErpMaterial::getIsCheck, IsEnableStatus.NO.getCode());
materialMapper.update(materialLambdaUpdateWrapper);
// LambdaUpdateWrapper<ErpMaterial> materialLambdaUpdateWrapper = Wrappers.lambdaUpdate();
// materialLambdaUpdateWrapper.eq(ErpMaterial::getWarehouseId, materialCheck.getWarehouseId());
// materialLambdaUpdateWrapper.set(ErpMaterial::getIsCheck, IsEnableStatus.NO.getCode());
// materialMapper.update(materialLambdaUpdateWrapper);
boolean flag = baseMapper.updateById(materialCheck) > 0;
if (flag) {
List<ErpMaterialPutawayInfo> putawayInfoList = new ArrayList<>();
......@@ -190,24 +191,26 @@ public class ErpMaterialCheckServiceImpl implements IErpMaterialCheckService {
throw new RuntimeException("盘点结束失败,盘点明细不能为空!");
}
checkInfoList.forEach(item -> {
/* 查询物料 */
ErpMaterial material = materialMapper.selectById(item.getMaterialId());
// 判断盘盈或盘亏
/* 查询物料库存 */
ErpMaterialInventoryRecordVo recordVo = materialInventoryRecordMapper.queryMaterialByWarehouseIdAndMaterialId(bo.getWarehouseId(), item.getMaterialId());
// 判断盘盈或盘亏 盘盈则新增入库、盘亏新增出库
if (item.getResultState().equals(CheckInfoState.ONE.getCode())) {
ErpMaterialPutawayInfo putawayInfo = BeanUtil.toBean(material, ErpMaterialPutawayInfo.class);
putawayInfo.setPutawayNumber(item.getCheckNum().subtract(material.getInventory()));
putawayInfo.setMaterialId(material.getId());
putawayInfo.setPutawayNumber(item.getCheckNum().subtract(recordVo.getInventory()));
putawayInfo.setMaterialId(recordVo.getMaterialId());
putawayInfo.setId(null);
putawayInfoList.add(putawayInfo);
}else if (item.getResultState().equals(CheckInfoState.TWO.getCode())) {
ErpMaterialPickingInfo pickingInfo = BeanUtil.toBean(material, ErpMaterialPickingInfo.class);
pickingInfo.setCollectNumber(material.getInventory().subtract(item.getCheckNum()));
pickingInfo.setMaterialId(material.getId());
pickingInfo.setCollectNumber(recordVo.getInventory().subtract(item.getCheckNum()));
pickingInfo.setMaterialId(recordVo.getMaterialId());
pickingInfo.setId(null);
pickingInfoList.add(pickingInfo);
}
material.setInventory(item.getCheckNum());
materialMapper.updateById(material);
});
/* 创建入库单 */
if (!putawayInfoList.isEmpty()) {
ErpMaterialPutaway putaway = new ErpMaterialPutaway();
putaway.setPutawayCode(RedisUtils.generateNextNumber("RK"));
......@@ -222,21 +225,50 @@ public class ErpMaterialCheckServiceImpl implements IErpMaterialCheckService {
.stream()
.peek(item -> item.setPutawayId(putaway.getId()))
.collect(Collectors.toList()));
/* 新增物料库存记录 */
materialInventoryRecordMapper.insertBatch(
putawayInfoList.stream().map(item -> {
ErpMaterialInventoryRecord record = new ErpMaterialInventoryRecord();
record.setInfoId(item.getId());
record.setMaterialId(item.getMaterialId());
record.setWarehouseId(warehouse.getId());
record.setDeptId(warehouse.getDeptId());
record.setNumber(item.getPutawayNumber());
record.setPrice(item.getPutawayPrice());
record.setMoney(item.getPutawayMoney());
record.setType(InventoryType.putaway.getCode());
return record;
}).collect(Collectors.toList())
);
}
/* 创建出库单 */
if (!pickingInfoList.isEmpty()) {
ErpMaterialPicking picking = new ErpMaterialPicking();
picking.setOutNumber(RedisUtils.generateNextNumber("CK"));
picking.setType(PickingType.TWO.getCode());
picking.setState(PickingState.TWO.getCode());
picking.setOutTime(new Date());
// picking.setReceiveUserId(LoginHelper.getUserId());
// picking.setReceiveUserName(LoginHelper.getUsername());
materialPickingMapper.insert(picking);
materialPickingInfoMapper.insertBatch(
pickingInfoList
.stream()
.peek(item -> item.setPickingId(picking.getId()))
.collect(Collectors.toList()));
/* 新增物料库存记录 */
materialInventoryRecordMapper.insertBatch(
pickingInfoList.stream().map(item -> {
ErpMaterialInventoryRecord record = new ErpMaterialInventoryRecord();
record.setInfoId(item.getId());
record.setMaterialId(item.getMaterialId());
record.setWarehouseId(warehouse.getId());
record.setDeptId(warehouse.getDeptId());
record.setNumber(item.getCollectNumber());
record.setPrice(item.getPrice());
record.setMoney(item.getMoney());
record.setType(InventoryType.putaway.getCode());
return record;
}).collect(Collectors.toList())
);
}
}
return flag;
......
package com.maintain.business.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.maintain.common.utils.StringUtils;
import com.maintain.common.core.page.TableDataInfo;
import com.maintain.common.core.domain.PageQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import com.maintain.business.domain.bo.ErpMaterialInventoryRecordBo;
import com.maintain.business.domain.vo.ErpMaterialInventoryRecordVo;
import com.maintain.business.domain.ErpMaterialInventoryRecord;
import com.maintain.business.mapper.ErpMaterialInventoryRecordMapper;
import com.maintain.business.service.IErpMaterialInventoryRecordService;
import java.util.List;
import java.util.Map;
import java.util.Collection;
/**
* 物料库存记录Service业务层处理
*
* @author liushuai
* @date 2025-07-16
*/
@RequiredArgsConstructor
@Service
public class ErpMaterialInventoryRecordServiceImpl implements IErpMaterialInventoryRecordService {
private final ErpMaterialInventoryRecordMapper baseMapper;
/**
* 查询物料库存记录
*/
@Override
public ErpMaterialInventoryRecordVo queryById(Long id){
return baseMapper.selectVoById(id);
}
/**
* 查询物料库存记录列表
*/
@Override
public TableDataInfo<ErpMaterialInventoryRecordVo> queryPageList(ErpMaterialInventoryRecordBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<ErpMaterialInventoryRecord> lqw = buildQueryWrapper(bo);
Page<ErpMaterialInventoryRecordVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
return TableDataInfo.build(result);
}
/**
* 查询物料库存记录列表(自定义查询)
*
* @param bo
* @param pageQuery
*/
@Override
public TableDataInfo<ErpMaterialInventoryRecordVo> customQueryPageList(ErpMaterialInventoryRecordBo bo, PageQuery pageQuery) {
Page<ErpMaterialInventoryRecordVo> queryPageList = baseMapper.customQueryPageList(pageQuery.build(), this.customBuildQueryWrapper(bo));
return TableDataInfo.build(queryPageList);
}
private QueryWrapper<ErpMaterialInventoryRecord> customBuildQueryWrapper(ErpMaterialInventoryRecordBo bo) {
QueryWrapper<ErpMaterialInventoryRecord> query = Wrappers.query();
query.eq(null != bo.getMaterialId(),"t.material_id", bo.getMaterialId())
.eq(null != bo.getWarehouseId(),"t.warehouse_id", bo.getWarehouseId())
.like(StringUtils.isNotBlank(bo.getMaterialName()),"t.material_name", bo.getMaterialName())
.like(StringUtils.isNotBlank(bo.getMaterialCode()),"t.material_code", bo.getMaterialCode())
.like(StringUtils.isNotBlank(bo.getMaterialSpecifications()),"t.material_specifications", bo.getMaterialSpecifications())
.like(StringUtils.isNotBlank(bo.getVendorName()),"t.vendor_name", bo.getVendorName())
.like(StringUtils.isNotBlank(bo.getWarehouseName()), "t.name", bo.getWarehouseName());
return query;
}
/**
* 查询物料库存记录列表
*/
@Override
public List<ErpMaterialInventoryRecordVo> queryListByMaterialId(ErpMaterialInventoryRecordBo bo) {
return baseMapper.queryListByWarehouseIdAndMaterialId(bo.getWarehouseId(), bo.getMaterialId(), bo.getType());
}
private LambdaQueryWrapper<ErpMaterialInventoryRecord> buildQueryWrapper(ErpMaterialInventoryRecordBo bo) {
Map<String, Object> params = bo.getParams();
LambdaQueryWrapper<ErpMaterialInventoryRecord> lqw = Wrappers.lambdaQuery();
lqw.eq(bo.getInfoId() != null, ErpMaterialInventoryRecord::getInfoId, bo.getInfoId());
lqw.eq(bo.getMaterialId() != null, ErpMaterialInventoryRecord::getMaterialId, bo.getMaterialId());
lqw.eq(bo.getDeptId() != null, ErpMaterialInventoryRecord::getDeptId, bo.getDeptId());
lqw.eq(bo.getWarehouseId() != null, ErpMaterialInventoryRecord::getWarehouseId, bo.getWarehouseId());
lqw.eq(bo.getNumber() != null, ErpMaterialInventoryRecord::getNumber, bo.getNumber());
lqw.eq(bo.getPrice() != null, ErpMaterialInventoryRecord::getPrice, bo.getPrice());
lqw.eq(bo.getMoney() != null, ErpMaterialInventoryRecord::getMoney, bo.getMoney());
lqw.eq(StringUtils.isNotBlank(bo.getType()), ErpMaterialInventoryRecord::getType, bo.getType());
return lqw;
}
/**
* 新增物料库存记录
*/
@Override
public Boolean insertByBo(ErpMaterialInventoryRecordBo bo) {
ErpMaterialInventoryRecord add = BeanUtil.toBean(bo, ErpMaterialInventoryRecord.class);
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setId(add.getId());
}
return flag;
}
/**
* 修改物料库存记录
*/
@Override
public Boolean updateByBo(ErpMaterialInventoryRecordBo bo) {
ErpMaterialInventoryRecord update = BeanUtil.toBean(bo, ErpMaterialInventoryRecord.class);
validEntityBeforeSave(update);
return baseMapper.updateById(update) > 0;
}
/**
* 保存前的数据校验
*/
private void validEntityBeforeSave(ErpMaterialInventoryRecord entity){
//TODO 做一些数据校验,如唯一约束
}
/**
* 批量删除物料库存记录
*/
@Override
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if(isValid){
//TODO 做一些业务上的校验,判断是否需要校验
}
return baseMapper.deleteBatchIds(ids) > 0;
}
}
......@@ -5,13 +5,14 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.maintain.business.domain.*;
import com.maintain.business.domain.bo.ErpMaterialPickingInfoBo;
import com.maintain.business.domain.vo.ErpMaterialPickingInfoVo;
import com.maintain.business.domain.vo.ErpMaterialPutawayInfoVo;
import com.maintain.business.domain.vo.*;
import com.maintain.business.mapper.*;
import com.maintain.business.service.IErpMaterialService;
import com.maintain.common.core.domain.BaseEntity;
import com.maintain.common.enums.InventoryType;
import com.maintain.common.enums.IsEnableStatus;
import com.maintain.common.enums.PickingState;
import com.maintain.common.exception.ServiceException;
import com.maintain.common.helper.LoginHelper;
import com.maintain.common.utils.StringUtils;
import com.maintain.common.core.page.TableDataInfo;
......@@ -23,7 +24,6 @@ import com.maintain.common.utils.redis.RedisUtils;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import com.maintain.business.domain.bo.ErpMaterialPickingBo;
import com.maintain.business.domain.vo.ErpMaterialPickingVo;
import com.maintain.business.service.IErpMaterialPickingService;
import org.springframework.transaction.annotation.Transactional;
......@@ -48,6 +48,8 @@ public class ErpMaterialPickingServiceImpl implements IErpMaterialPickingService
private final ErpCarMapper carMapper;
private final IErpMaterialService materialService;
private final ErpMaterialMapper materialMapper;
private final ErpMaterialInventoryRecordMapper materialInventoryRecordMapper;
private final ErpWarehouseMapper warehouseMapper;
/**
* 查询报修单-领料出库单
......@@ -152,23 +154,51 @@ public class ErpMaterialPickingServiceImpl implements IErpMaterialPickingService
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
List<ErpMaterialPickingInfoBo> infoBoList = bo.getMaterialList();
List<ErpMaterialPickingInfo> collect = infoBoList.stream().map(item -> {
List<ErpMaterialPickingInfo> collect = bo.getMaterialList().stream().map(item -> {
ErpMaterialPickingInfo info = BeanUtil.toBean(item, ErpMaterialPickingInfo.class);
ErpMaterial material = materialMapper.selectById(item.getMaterialId());
BeanUtil.copyProperties(material, info);
info.setId(null);
info.setRepairFormId(bo.getRepairFormId());
info.setPickingId(add.getId());
info.setWarehouseId(item.getWarehouseId());
info.setWarehouseName(item.getWarehouseName());
info.setState(bo.getState());
// 更新物料库存
if (bo.getState().equals(PickingState.TWO.getCode())) {
materialService.modifyMaterialInventory(item.getMaterialId(), item.getCollectNumber(), false);
}
info.setPrice(item.getPrice());
info.setMoney(item.getMoney());
return info;
}).collect(Collectors.toList());
pickingInfoMapper.insertBatch(collect);
bo.setId(add.getId());
/* 创建物料库存记录表 */
if (bo.getState().equals(PickingState.TWO.getCode())) {
List<ErpMaterialInventoryRecord> inventoryRecordList = collect.stream().map(item -> {
LambdaQueryWrapper<ErpMaterialInventoryRecord> lambdaQueryWrapper = Wrappers.lambdaQuery();
lambdaQueryWrapper
.eq(ErpMaterialInventoryRecord::getWarehouseId, item.getWarehouseId())
.eq(ErpMaterialInventoryRecord::getMaterialId, item.getMaterialId());
List<ErpMaterialInventoryRecordVo> recordVoList = materialInventoryRecordMapper.customQueryList(lambdaQueryWrapper);
if (recordVoList.isEmpty()) {
throw new ServiceException("仓库["+item.getWarehouseName()+"]中物料["+item.getMaterialName()+"]库存异常,请联系管理员!");
}
ErpMaterialInventoryRecordVo recordVo = recordVoList.get(0);
if (item.getCollectNumber().compareTo(recordVo.getInventory()) > 0) {
throw new ServiceException("仓库["+item.getWarehouseName()+"]中物料["+item.getMaterialName()+"]库存不足,请调整后重试!");
}
ErpMaterialInventoryRecord record = new ErpMaterialInventoryRecord();
record.setInfoId(item.getId());
record.setMaterialId(item.getMaterialId());
ErpWarehouseVo warehouseVo = warehouseMapper.selectVoById(item.getWarehouseId());
record.setWarehouseId(warehouseVo.getId());
record.setDeptId(warehouseVo.getDeptId());
record.setNumber(item.getCollectNumber());
record.setPrice(item.getPrice());
record.setMoney(item.getMoney());
record.setType(InventoryType.picking.getCode());
return record;
}).collect(Collectors.toList());
materialInventoryRecordMapper.insertBatch(inventoryRecordList);
}
}
return flag;
}
......@@ -204,14 +234,44 @@ public class ErpMaterialPickingServiceImpl implements IErpMaterialPickingService
info.setId(null);
info.setPickingId(update.getId());
info.setRepairFormId(update.getRepairFormId());
info.setWarehouseId(item.getWarehouseId());
info.setWarehouseName(item.getWarehouseName());
info.setState(bo.getState());
// 更新物料库存
if (bo.getState().equals(PickingState.TWO.getCode())) {
materialService.modifyMaterialInventory(item.getMaterialId(), item.getCollectNumber(), false);
}
info.setPrice(item.getPrice());
info.setMoney(item.getMoney());
return info;
}).collect(Collectors.toList());
pickingInfoMapper.insertBatch(collect);
/* 创建物料库存记录表 */
if (bo.getState().equals(PickingState.TWO.getCode())) {
List<ErpMaterialInventoryRecord> inventoryRecordList = collect.stream().map(item -> {
LambdaQueryWrapper<ErpMaterialInventoryRecord> lambdaQueryWrapper = Wrappers.lambdaQuery();
lambdaQueryWrapper
.eq(ErpMaterialInventoryRecord::getWarehouseId, item.getWarehouseId())
.eq(ErpMaterialInventoryRecord::getMaterialId, item.getMaterialId());
List<ErpMaterialInventoryRecordVo> recordVoList = materialInventoryRecordMapper.customQueryList(lambdaQueryWrapper);
if (recordVoList.isEmpty()) {
throw new ServiceException("仓库["+item.getWarehouseName()+"]中物料["+item.getMaterialName()+"]库存异常,请联系管理员!");
}
ErpMaterialInventoryRecordVo recordVo = recordVoList.get(0);
if (item.getCollectNumber().compareTo(recordVo.getInventory()) > 0) {
throw new ServiceException("仓库["+item.getWarehouseName()+"]中物料["+item.getMaterialName()+"]库存不足,请调整后重试!");
}
ErpMaterialInventoryRecord record = new ErpMaterialInventoryRecord();
record.setInfoId(item.getId());
record.setMaterialId(item.getMaterialId());
ErpWarehouseVo warehouseVo = warehouseMapper.selectVoById(item.getWarehouseId());
record.setWarehouseId(warehouseVo.getId());
record.setDeptId(warehouseVo.getDeptId());
record.setNumber(item.getCollectNumber());
record.setPrice(item.getPrice());
record.setMoney(item.getMoney());
record.setType(InventoryType.picking.getCode());
return record;
}).collect(Collectors.toList());
materialInventoryRecordMapper.insertBatch(inventoryRecordList);
}
}
return flag;
}
......@@ -235,14 +295,14 @@ public class ErpMaterialPickingServiceImpl implements IErpMaterialPickingService
// 删除领料出库单
boolean flag = baseMapper.deleteBatchIds(ids) > 0;
if (flag) {
// 更新物料库存
// 删除物料库存记录数据
LambdaQueryWrapper<ErpMaterialPickingInfo> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.in(ErpMaterialPickingInfo::getPickingId, ids);
List<ErpMaterialPickingInfoVo> pickingInfoVoList = pickingInfoMapper.selectVoList(queryWrapper);
for (ErpMaterialPickingInfoVo infoVo : pickingInfoVoList) {
if (infoVo.getState().equals(PickingState.TWO.getCode())) {
materialService.modifyMaterialInventory(infoVo.getMaterialId(), infoVo.getCollectNumber(), false);
}
if (!pickingInfoVoList.isEmpty()) {
LambdaQueryWrapper<ErpMaterialInventoryRecord> lambdaQueryWrapper = Wrappers.lambdaQuery();
lambdaQueryWrapper.eq(ErpMaterialInventoryRecord::getInfoId, pickingInfoVoList.stream().map(ErpMaterialPickingInfoVo::getId).collect(Collectors.toList()));
materialInventoryRecordMapper.delete(lambdaQueryWrapper);
}
// 删除领料出库单明细
LambdaUpdateWrapper<ErpMaterialPickingInfo> updateWrapper = Wrappers.lambdaUpdate();
......@@ -267,18 +327,40 @@ public class ErpMaterialPickingServiceImpl implements IErpMaterialPickingService
lqw.set(ErpMaterialPicking::getState, PickingState.TWO.getCode());
boolean flag = baseMapper.update(lqw) > 0;
if (flag) {
// 更新出库明细状态
LambdaUpdateWrapper<ErpMaterialPickingInfo> updateWrapper = Wrappers.lambdaUpdate();
updateWrapper.in(ErpMaterialPickingInfo::getPickingId, ids).set(ErpMaterialPickingInfo::getState, PickingState.TWO.getCode());
pickingInfoMapper.update(updateWrapper);
// 更新物料库存
LambdaQueryWrapper<ErpMaterialPickingInfo> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.in(ErpMaterialPickingInfo::getPickingId, ids).eq(ErpMaterialPickingInfo::getState, PickingState.ONE.getCode());
List<ErpMaterialPickingInfoVo> pickingInfoVoList = pickingInfoMapper.selectVoList(queryWrapper);
for (ErpMaterialPickingInfoVo infoVo : pickingInfoVoList) {
materialService.modifyMaterialInventory(infoVo.getMaterialId(), infoVo.getCollectNumber(), false);
List<ErpMaterialInventoryRecord> inventoryRecordList = pickingInfoVoList.stream().map(item -> {
LambdaQueryWrapper<ErpMaterialInventoryRecord> lambdaQueryWrapper = Wrappers.lambdaQuery();
lambdaQueryWrapper
.eq(ErpMaterialInventoryRecord::getWarehouseId, item.getWarehouseId())
.eq(ErpMaterialInventoryRecord::getMaterialId, item.getMaterialId());
List<ErpMaterialInventoryRecordVo> recordVoList = materialInventoryRecordMapper.customQueryList(lambdaQueryWrapper);
if (recordVoList.isEmpty()) {
throw new ServiceException("仓库["+item.getWarehouseName()+"]中物料["+item.getMaterialName()+"]库存异常,请联系管理员!");
}
ErpMaterialInventoryRecordVo recordVo = recordVoList.get(0);
if (item.getCollectNumber().compareTo(recordVo.getInventory()) > 0) {
throw new ServiceException("仓库["+item.getWarehouseName()+"]中物料["+item.getMaterialName()+"]库存不足,请调整后重试!");
}
ErpMaterialInventoryRecord record = new ErpMaterialInventoryRecord();
record.setInfoId(item.getId());
record.setMaterialId(item.getMaterialId());
ErpWarehouseVo warehouseVo = warehouseMapper.selectVoById(item.getWarehouseId());
record.setWarehouseId(warehouseVo.getId());
record.setDeptId(warehouseVo.getDeptId());
record.setNumber(item.getCollectNumber());
record.setPrice(item.getPrice());
record.setMoney(item.getMoney());
record.setType(InventoryType.picking.getCode());
return record;
}).collect(Collectors.toList());
materialInventoryRecordMapper.insertBatch(inventoryRecordList);
// 更新出库明细状态
LambdaUpdateWrapper<ErpMaterialPickingInfo> updateWrapper = Wrappers.lambdaUpdate();
updateWrapper.in(ErpMaterialPickingInfo::getPickingId, ids).set(ErpMaterialPickingInfo::getState, PickingState.TWO.getCode());
pickingInfoMapper.update(updateWrapper);
}
return flag;
}
......@@ -293,23 +375,37 @@ public class ErpMaterialPickingServiceImpl implements IErpMaterialPickingService
ErpMaterialPicking materialPicking = baseMapper.selectById(bo.getId());
materialPicking.setReturnNumber(RedisUtils.generateNextNumber("TL"));
materialPicking.setReturnTime(new Date());
// 如果领料单状态已完成,if需要更新物料库存以及领料出库明细状态,else只需要更新领料出库明细状态
// 更新领料出库单状态
materialPicking.setState(PickingState.THREE.getCode());
boolean flag = baseMapper.updateById(materialPicking) > 0;
if (flag) {
// 更新领料出库明细状态
LambdaUpdateWrapper<ErpMaterialPickingInfo> updateWrapper = Wrappers.lambdaUpdate();
updateWrapper.eq(ErpMaterialPickingInfo::getPickingId, bo.getId());
updateWrapper.set(ErpMaterialPickingInfo::getState, PickingState.THREE.getCode());
if (materialPicking.getState().equals(PickingState.TWO.getCode())) {
updateWrapper
.eq(ErpMaterialPickingInfo::getPickingId, bo.getId())
.set(ErpMaterialPickingInfo::getState, PickingState.THREE.getCode());
pickingInfoMapper.update(updateWrapper);
// 创建物料库存记录数据
LambdaQueryWrapper<ErpMaterialPickingInfo> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.eq(ErpMaterialPickingInfo::getPickingId, bo.getId());
List<ErpMaterialPickingInfoVo> pickingInfoVoList = pickingInfoMapper.selectVoList(queryWrapper);
for (ErpMaterialPickingInfoVo infoVo : pickingInfoVoList) {
// 更新物料库存
materialService.modifyMaterialInventory(infoVo.getMaterialId(), infoVo.getCollectNumber(), true);
if (!pickingInfoVoList.isEmpty()) {
List<ErpMaterialInventoryRecord> inventoryRecordList = pickingInfoVoList.stream().map(item -> {
ErpMaterialInventoryRecord record = new ErpMaterialInventoryRecord();
record.setInfoId(item.getId());
record.setMaterialId(item.getMaterialId());
ErpWarehouseVo warehouseVo = warehouseMapper.selectVoById(item.getWarehouseId());
record.setWarehouseId(warehouseVo.getId());
record.setDeptId(warehouseVo.getDeptId());
record.setNumber(item.getCollectNumber());
record.setPrice(item.getPrice());
record.setMoney(item.getMoney());
record.setType(InventoryType.back.getCode());
return record;
}).collect(Collectors.toList());
materialInventoryRecordMapper.insertBatch(inventoryRecordList);
}
}
// 更新领料出库明细状态
pickingInfoMapper.update(updateWrapper);
// 更新领料出库单状态
materialPicking.setState(PickingState.THREE.getCode());
return baseMapper.updateById(materialPicking) > 0;
return flag;
}
}
......@@ -10,11 +10,13 @@ import com.maintain.business.domain.bo.ErpMaterialPutawayBo;
import com.maintain.business.domain.bo.ErpMaterialPutawayInfoBo;
import com.maintain.business.domain.vo.*;
import com.maintain.business.mapper.*;
import com.maintain.business.service.IErpMaterialInventoryRecordService;
import com.maintain.business.service.IErpMaterialPutawayService;
import com.maintain.business.service.IErpMaterialService;
import com.maintain.common.core.domain.BaseEntity;
import com.maintain.common.core.domain.PageQuery;
import com.maintain.common.core.page.TableDataInfo;
import com.maintain.common.enums.InventoryType;
import com.maintain.common.enums.PickingState;
import com.maintain.common.helper.LoginHelper;
import com.maintain.common.utils.StringUtils;
......@@ -44,6 +46,7 @@ public class ErpMaterialPutawayServiceImpl implements IErpMaterialPutawayService
private final ErpMaterialPutawayInfoMapper putawayInfoMapper;
private final ErpMaterialMapper materialMapper;
private final IErpMaterialService materialService;
private final ErpMaterialInventoryRecordMapper materialInventoryRecordMapper;
/**
* 查询物料入库
......@@ -108,6 +111,7 @@ public class ErpMaterialPutawayServiceImpl implements IErpMaterialPutawayService
add.setCreateDeptId(LoginHelper.getDeptId());
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
/* 保存明细 */
List<ErpMaterialPutawayInfoBo> infoBoList = bo.getPutawayInfoList();
List<ErpMaterialPutawayInfo> collect = infoBoList.stream().map(item -> {
ErpMaterialPutawayInfo putawayInfo = BeanUtil.toBean(item, ErpMaterialPutawayInfo.class);
......@@ -115,15 +119,27 @@ public class ErpMaterialPutawayServiceImpl implements IErpMaterialPutawayService
BeanUtil.copyProperties(material, putawayInfo);
putawayInfo.setId(null);
putawayInfo.setPutawayId(add.getId());
if (bo.getState().equals(PickingState.TWO.getCode())) {
// 更新物料库存
materialService.modifyMaterialInventory(item.getMaterialId(), item.getPutawayNumber(), true);
}
putawayInfo.setState(bo.getState());
return putawayInfo;
}).collect(Collectors.toList());
bo.setId(add.getId());
putawayInfoMapper.insertBatch(collect);
/* 创建物料库存记录表 */
if (bo.getState().equals(PickingState.TWO.getCode())) {
List<ErpMaterialInventoryRecord> inventoryRecordList = collect.stream().map(item -> {
ErpMaterialInventoryRecord record = new ErpMaterialInventoryRecord();
record.setInfoId(item.getId());
record.setMaterialId(item.getMaterialId());
record.setWarehouseId(warehouseVo.getId());
record.setDeptId(warehouseVo.getDeptId());
record.setNumber(item.getPutawayNumber());
record.setPrice(item.getPutawayPrice());
record.setMoney(item.getPutawayMoney());
record.setType(InventoryType.putaway.getCode());
return record;
}).collect(Collectors.toList());
materialInventoryRecordMapper.insertBatch(inventoryRecordList);
}
}
return flag;
}
......@@ -148,12 +164,30 @@ public class ErpMaterialPutawayServiceImpl implements IErpMaterialPutawayService
updateWrapper.in(ErpMaterialPutawayInfo::getPutawayId, ids).set(ErpMaterialPutawayInfo::getState, PickingState.TWO.getCode());
putawayInfoMapper.update(updateWrapper);
// 更新物料库存
/* 创建物料库存记录表 */
LambdaQueryWrapper<ErpMaterialPutawayInfo> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.in(ErpMaterialPutawayInfo::getPutawayId, ids).eq(ErpMaterialPutawayInfo::getState, PickingState.ONE.getCode());
queryWrapper.in(ErpMaterialPutawayInfo::getPutawayId, ids);
List<ErpMaterialPutawayInfo> putawayInfoList = putawayInfoMapper.selectList(queryWrapper);
for (ErpMaterialPutawayInfo info : putawayInfoList) {
materialService.modifyMaterialInventory(info.getMaterialId(), info.getPutawayNumber(), false);
if (!putawayInfoList.isEmpty()) {
List<ErpMaterialInventoryRecord> inventoryRecordList = putawayInfoList.stream().map(item -> {
ErpMaterialInventoryRecord record = new ErpMaterialInventoryRecord();
record.setInfoId(item.getId());
record.setMaterialId(item.getMaterialId());
// 查出入库单
ErpMaterialPutaway materialPutaway = baseMapper.selectById(item.getPutawayId());
record.setWarehouseId(materialPutaway.getWarehouseId());
// 查出仓库
ErpWarehouseVo warehouseVo = warehouseMapper.selectVoById(materialPutaway.getWarehouseId());
if (null != warehouseVo) {
record.setDeptId(warehouseVo.getDeptId());
}
record.setNumber(item.getPutawayNumber());
record.setPrice(item.getPutawayPrice());
record.setMoney(item.getPutawayMoney());
record.setType(InventoryType.putaway.getCode());
return record;
}).collect(Collectors.toList());
materialInventoryRecordMapper.insertBatch(inventoryRecordList);
}
}
return flag;
......@@ -174,30 +208,42 @@ public class ErpMaterialPutawayServiceImpl implements IErpMaterialPutawayService
// 删除原有进货明细
LambdaQueryWrapper<ErpMaterialPutawayInfo> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.eq(ErpMaterialPutawayInfo::getPutawayId, bo.getId());
/* 删除物料库存记录数据 */
List<ErpMaterialPutawayInfoVo> putawayInfoVoList = putawayInfoMapper.selectVoList(queryWrapper);
for (ErpMaterialPutawayInfoVo infoVo : putawayInfoVoList) {
if (infoVo.getState().equals(PickingState.TWO.getCode())) {
// 更新物料库存
materialService.modifyMaterialInventory(infoVo.getMaterialId(), infoVo.getPutawayNumber(), false);
}
if (!putawayInfoVoList.isEmpty() && update.getState().equals(PickingState.TWO.getCode())) {
LambdaQueryWrapper<ErpMaterialInventoryRecord> lambdaQueryWrapper = Wrappers.lambdaQuery();
lambdaQueryWrapper.in(ErpMaterialInventoryRecord::getInfoId, putawayInfoVoList.stream().map(ErpMaterialPutawayInfoVo::getId).collect(Collectors.toList()));
materialInventoryRecordMapper.delete(lambdaQueryWrapper);
}
putawayInfoMapper.delete(queryWrapper);
// 绑定新的进货明细
List<ErpMaterialPutawayInfoBo> infoBoList = bo.getPutawayInfoList();
List<ErpMaterialPutawayInfo> collect = infoBoList.stream().map(item -> {
List<ErpMaterialPutawayInfo> collect = bo.getPutawayInfoList().stream().map(item -> {
ErpMaterialPutawayInfo putawayInfo = BeanUtil.toBean(item, ErpMaterialPutawayInfo.class);
ErpMaterial material = materialMapper.selectById(item.getMaterialId());
BeanUtil.copyProperties(material, putawayInfo);
putawayInfo.setId(null);
putawayInfo.setPutawayId(update.getId());
if (bo.getState().equals(PickingState.TWO.getCode())) {
// 更新物料库存
materialService.modifyMaterialInventory(item.getMaterialId(), item.getPutawayNumber(), true);
}
putawayInfo.setState(bo.getState());
return putawayInfo;
}).collect(Collectors.toList());
putawayInfoMapper.insertBatch(collect);
/* 创建物料库存记录表 */
if (update.getState().equals(PickingState.TWO.getCode())) {
List<ErpMaterialInventoryRecord> inventoryRecordList = collect.stream().map(item -> {
ErpMaterialInventoryRecord record = new ErpMaterialInventoryRecord();
record.setInfoId(item.getId());
record.setMaterialId(item.getMaterialId());
record.setWarehouseId(warehouseVo.getId());
record.setDeptId(warehouseVo.getDeptId());
record.setNumber(item.getPutawayNumber());
record.setPrice(item.getPutawayPrice());
record.setMoney(item.getPutawayMoney());
record.setType(InventoryType.putaway.getCode());
return record;
}).collect(Collectors.toList());
materialInventoryRecordMapper.insertBatch(inventoryRecordList);
}
}
return flag;
}
......@@ -222,13 +268,10 @@ public class ErpMaterialPutawayServiceImpl implements IErpMaterialPutawayService
LambdaQueryWrapper<ErpMaterialPutawayInfo> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.in(ErpMaterialPutawayInfo::getPutawayId, ids);
List<ErpMaterialPutawayInfoVo> putawayInfoVoList = putawayInfoMapper.selectVoList(queryWrapper);
// 遍历处理明细数据
for (ErpMaterialPutawayInfoVo infoVo : putawayInfoVoList) {
if (infoVo.getState().equals(PickingState.TWO.getCode())) {
// 更新物料库存
materialService.modifyMaterialInventory(infoVo.getMaterialId(), infoVo.getPutawayNumber(), false);
}
}
// 删除物料库存记录
LambdaQueryWrapper<ErpMaterialInventoryRecord> lambdaQueryWrapper = Wrappers.lambdaQuery();
lambdaQueryWrapper.in(ErpMaterialInventoryRecord::getInfoId, putawayInfoVoList.stream().map(ErpMaterialPutawayInfoVo::getId).collect(Collectors.toList()));
materialInventoryRecordMapper.delete(lambdaQueryWrapper);
// 删除入库明细
putawayInfoMapper.delete(queryWrapper);
// 删除入库单
......
......@@ -3,16 +3,17 @@ package com.maintain.business.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.maintain.business.domain.ErpMaterialInventoryRecord;
import com.maintain.business.domain.ErpMaterialPutawayInfo;
import com.maintain.business.domain.ErpMaterialReturnsInfo;
import com.maintain.business.domain.bo.ErpMaterialReturnsInfoBo;
import com.maintain.business.domain.vo.ErpMaterialPutawayVo;
import com.maintain.business.domain.vo.ErpMaterialReturnsInfoVo;
import com.maintain.business.mapper.ErpMaterialPutawayInfoMapper;
import com.maintain.business.mapper.ErpMaterialPutawayMapper;
import com.maintain.business.mapper.ErpMaterialReturnsInfoMapper;
import com.maintain.business.domain.vo.ErpWarehouseVo;
import com.maintain.business.mapper.*;
import com.maintain.business.service.IErpMaterialService;
import com.maintain.common.core.domain.BaseEntity;
import com.maintain.common.enums.InventoryType;
import com.maintain.common.enums.IsEnableStatus;
import com.maintain.common.helper.LoginHelper;
import com.maintain.common.utils.StringUtils;
......@@ -27,7 +28,6 @@ import org.springframework.stereotype.Service;
import com.maintain.business.domain.bo.ErpMaterialReturnsBo;
import com.maintain.business.domain.vo.ErpMaterialReturnsVo;
import com.maintain.business.domain.ErpMaterialReturns;
import com.maintain.business.mapper.ErpMaterialReturnsMapper;
import com.maintain.business.service.IErpMaterialReturnsService;
import org.springframework.transaction.annotation.Transactional;
......@@ -51,6 +51,8 @@ public class ErpMaterialReturnsServiceImpl implements IErpMaterialReturnsService
private final ErpMaterialPutawayMapper materialPutawayMapper;
private final ErpMaterialPutawayInfoMapper materialPutawayInfoMapper;
private final IErpMaterialService materialService;
private final ErpMaterialInventoryRecordMapper erpMaterialInventoryRecordMapper;
private final ErpWarehouseMapper warehouseMapper;
/**
* 查询物料退货
......@@ -130,12 +132,26 @@ public class ErpMaterialReturnsServiceImpl implements IErpMaterialReturnsService
BeanUtil.copyProperties(putawayInfo, returnsInfo);
returnsInfo.setId(null);
returnsInfo.setReturnsId(materialReturns.getId());
// 更新物料库存
materialService.modifyMaterialInventory(item.getMaterialId(), item.getReturnsNumber(), false);
return returnsInfo;
}).collect(Collectors.toList());
materialReturnsInfoMapper.insertBatch(collect);
// 处理入库明细状态
// 创建物料库存记录
ErpWarehouseVo warehouseVo = warehouseMapper.selectVoById(materialReturns.getWarehouseId());
List<ErpMaterialInventoryRecord> inventoryRecordList = collect.stream().map(item -> {
ErpMaterialInventoryRecord record = new ErpMaterialInventoryRecord();
record.setInfoId(item.getId());
record.setMaterialId(item.getMaterialId());
record.setWarehouseId(warehouseVo.getId());
record.setDeptId(warehouseVo.getDeptId());
record.setNumber(item.getReturnsNumber());
record.setPrice(item.getReturnsPrice());
record.setMoney(item.getReturnsMoney());
record.setType(InventoryType.returns.getCode());
return record;
}).collect(Collectors.toList());
erpMaterialInventoryRecordMapper.insertBatch(inventoryRecordList);
// 处理入库明细状态(记录已退数量)
List<ErpMaterialPutawayInfo> putawayInfoList = infoBoList.stream().map(item -> {
ErpMaterialPutawayInfo putawayInfo = materialPutawayInfoMapper.selectById(item.getPutawayInfoId());
putawayInfo.setIsReturns(IsEnableStatus.YES.getCode());
......@@ -160,35 +176,48 @@ public class ErpMaterialReturnsServiceImpl implements IErpMaterialReturnsService
materialReturns.setReturnsTime(bo.getReturnsTime());
boolean flag = baseMapper.updateById(materialReturns) > 0;
if (flag) {
// 删除原有退货明细
LambdaQueryWrapper<ErpMaterialReturnsInfo> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.eq(ErpMaterialReturnsInfo::getReturnsId, bo.getId());
List<ErpMaterialReturnsInfoVo> returnsInfoVoList = materialReturnsInfoMapper.selectVoList(queryWrapper);
for (ErpMaterialReturnsInfoVo infoVo : returnsInfoVoList) {
// 更新物料库存
materialService.modifyMaterialInventory(infoVo.getMaterialId(), infoVo.getReturnsNumber(), true);
// 删除物料库存记录数据
if (!returnsInfoVoList.isEmpty()) {
LambdaQueryWrapper<ErpMaterialInventoryRecord> lambdaQuery = Wrappers.lambdaQuery();
lambdaQuery.in(ErpMaterialInventoryRecord::getInfoId, returnsInfoVoList.stream().map(ErpMaterialReturnsInfoVo::getId).collect(Collectors.toList()));
erpMaterialInventoryRecordMapper.delete(lambdaQuery);
}
List<ErpMaterialReturnsInfoBo> infoBoList = bo.getReturnsInfoBoList();
// 删除原有退货明细
materialReturnsInfoMapper.delete(queryWrapper);
// 绑定新的退货明细
List<ErpMaterialReturnsInfoBo> infoBoList = bo.getReturnsInfoBoList();
List<ErpMaterialReturnsInfo> collect = infoBoList.stream().map(item -> {
ErpMaterialReturnsInfo returnsInfo = BeanUtil.toBean(item, ErpMaterialReturnsInfo.class);
ErpMaterialPutawayInfo putawayInfo = materialPutawayInfoMapper.selectById(item.getPutawayInfoId());
BeanUtil.copyProperties(putawayInfo, returnsInfo);
returnsInfo.setId(null);
returnsInfo.setReturnsId(materialReturns.getId());
// 更新物料库存
materialService.modifyMaterialInventory(item.getMaterialId(), item.getReturnsNumber(), false);
return returnsInfo;
}).collect(Collectors.toList());
materialReturnsInfoMapper.insertBatch(collect);
// 还原入库明细状态
// 创建物料库存记录
ErpWarehouseVo warehouseVo = warehouseMapper.selectVoById(materialReturns.getWarehouseId());
List<ErpMaterialInventoryRecord> inventoryRecordList = collect.stream().map(item -> {
ErpMaterialInventoryRecord record = new ErpMaterialInventoryRecord();
record.setInfoId(item.getId());
record.setMaterialId(item.getMaterialId());
record.setWarehouseId(warehouseVo.getId());
record.setDeptId(warehouseVo.getDeptId());
record.setNumber(item.getReturnsNumber());
record.setPrice(item.getReturnsPrice());
record.setMoney(item.getReturnsMoney());
record.setType(InventoryType.returns.getCode());
return record;
}).collect(Collectors.toList());
erpMaterialInventoryRecordMapper.insertBatch(inventoryRecordList);
// 还原入库明细状态(是否存在退货改为否)
LambdaUpdateWrapper<ErpMaterialPutawayInfo> updateWrapper = Wrappers.lambdaUpdate();
updateWrapper.eq(ErpMaterialPutawayInfo::getPutawayId, bo.getPutawayId());
updateWrapper.set(ErpMaterialPutawayInfo::getIsReturns, IsEnableStatus.NO.getCode());
updateWrapper.eq(ErpMaterialPutawayInfo::getPutawayId, bo.getPutawayId()).set(ErpMaterialPutawayInfo::getIsReturns, IsEnableStatus.NO.getCode());
materialPutawayInfoMapper.update(updateWrapper);
// 处理入库明细状态
// 处理入库明细状态(是否存在退货改为是)
List<ErpMaterialPutawayInfo> putawayInfoList = infoBoList.stream().map(item -> {
ErpMaterialPutawayInfo putawayInfo = new ErpMaterialPutawayInfo();
putawayInfo.setId(item.getId());
......@@ -219,17 +248,17 @@ public class ErpMaterialReturnsServiceImpl implements IErpMaterialReturnsService
LambdaQueryWrapper<ErpMaterialReturnsInfo> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.in(ErpMaterialReturnsInfo::getReturnsId, ids);
List<ErpMaterialReturnsInfoVo> returnsInfoVoList = materialReturnsInfoMapper.selectVoList(queryWrapper);
// 处理入库明细状态(取消入库明细是否存在退货标记)
List<ErpMaterialPutawayInfo> putawayInfoList = returnsInfoVoList.stream().map(item -> {
ErpMaterialPutawayInfo putawayInfo = new ErpMaterialPutawayInfo();
putawayInfo.setId(item.getId());
// 处理入库明细状态(取消入库明细是否存在退货标记,回退已退数量)
for (ErpMaterialReturnsInfoVo returnsInfoVo : returnsInfoVoList) {
ErpMaterialPutawayInfo putawayInfo = materialPutawayInfoMapper.selectById(returnsInfoVo.getPutawayInfoId());
putawayInfo.setIsReturns(IsEnableStatus.NO.getCode());
// 更新物料库存
materialService.modifyMaterialInventory(item.getMaterialId(), item.getReturnsNumber(), true);
return putawayInfo;
}).collect(Collectors.toList());
// 更新入库明细列表
materialPutawayInfoMapper.updateBatchById(putawayInfoList);
putawayInfo.setReturnedNumber(putawayInfo.getReturnedNumber().subtract(returnsInfoVo.getReturnsNumber()));
materialPutawayInfoMapper.updateById(putawayInfo);
}
// 删除物料库存记录
LambdaQueryWrapper<ErpMaterialInventoryRecord> lambdaQuery = Wrappers.lambdaQuery();
lambdaQuery.in(ErpMaterialInventoryRecord::getInfoId, returnsInfoVoList.stream().map(ErpMaterialReturnsInfoVo::getId).collect(Collectors.toList()));
erpMaterialInventoryRecordMapper.delete(lambdaQuery);
// 删除退货明细
materialReturnsInfoMapper.delete(queryWrapper);
return baseMapper.deleteBatchIds(ids) > 0;
......
......@@ -68,6 +68,24 @@ public class ErpMaterialServiceImpl implements IErpMaterialService {
return TableDataInfo.build(result);
}
/**
* 查询物资列表(自定义查询全部)
*
* @param bo
* @param pageQuery
*/
@Override
public TableDataInfo<ErpMaterialVo> customQueryPageListAll(ErpMaterialBo bo, PageQuery pageQuery) {
QueryWrapper<ErpMaterial> query = Wrappers.query();
query.eq("m.is_delete", IsDeleteStatus.NO.getCode())
.like(bo.getMaterialCode() != null, "m.material_code", bo.getMaterialCode())
.like(bo.getMaterialName() != null, "m.material_name", bo.getMaterialName())
.like(bo.getMaterialSpecifications() != null, "m.material_specifications", bo.getMaterialSpecifications())
.like(bo.getVendorName() != null, "vendor_name", bo.getVendorName());
Page<ErpMaterialVo> result = baseMapper.customQueryPageListByWarehouseId(pageQuery.build(), query, bo.getWarehouseId());
return TableDataInfo.build(result);
}
/**
* 查询物资列表
*/
......@@ -79,13 +97,14 @@ public class ErpMaterialServiceImpl implements IErpMaterialService {
private QueryWrapper<ErpMaterial> customBuildQueryWrapper(ErpMaterialBo bo) {
QueryWrapper<ErpMaterial> query = Wrappers.query();
query.like(null != bo.getVendorName(), "vendor_name", bo.getVendorName())
.like(null != bo.getMaterialName(), "material_name", bo.getMaterialName())
.like(null != bo.getMaterialCode(), "material_code", bo.getMaterialCode())
.like(null != bo.getMaterialSpecifications(), "material_specifications", bo.getMaterialSpecifications())
.eq(null != bo.getIsEnable(), "is_enable", bo.getIsEnable())
.eq(null != bo.getIsCheck(), "is_check", bo.getIsCheck())
.eq(null != bo.getIsUniversal(), "is_universal", bo.getIsUniversal());
query.like(null != bo.getVendorName(), "t.vendor_name", bo.getVendorName())
.like(null != bo.getMaterialName(), "t.material_name", bo.getMaterialName())
.like(null != bo.getMaterialCode(), "t.material_code", bo.getMaterialCode())
.like(null != bo.getMaterialSpecifications(), "t.material_specifications", bo.getMaterialSpecifications())
.like(null != bo.getWarehouseName(), "t.name", bo.getWarehouseName())
.eq(null != bo.getWarehouseId(), "t.warehouse_id", bo.getWarehouseId())
.in(null != bo.getWarehouseIdList(), "t.warehouse_id", bo.getWarehouseIdList())
.ge(null != bo.getInventory(), "t.inventory", bo.getInventory());
return query;
}
......
......@@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.maintain.business.domain.ErpRepairForm;
import com.maintain.business.domain.ErpSettlementMaintainRepairForm;
import com.maintain.business.domain.bo.ErpSettlementMaintainRepairFormBo;
import com.maintain.business.domain.vo.ErpClientVo;
import com.maintain.business.mapper.ErpClientMapper;
import com.maintain.business.mapper.ErpRepairFormMapper;
import com.maintain.business.mapper.ErpSettlementMaintainRepairFormMapper;
import com.maintain.common.enums.RepairFormSettlementState;
......@@ -46,6 +48,7 @@ public class ErpSettlementMaintainServiceImpl implements IErpSettlementMaintainS
private final ErpSettlementMaintainMapper baseMapper;
private final ErpSettlementMaintainRepairFormMapper settlementMaintainRepairFormMapper;
private final ErpRepairFormMapper repairFormMapper;
private final ErpClientMapper clientMapper;
/**
* 查询结算维修单
......@@ -96,13 +99,20 @@ public class ErpSettlementMaintainServiceImpl implements IErpSettlementMaintainS
@Transactional(rollbackFor = Exception.class)
@Override
public Boolean insertByBo(ErpSettlementMaintainBo bo) {
ErpClientVo clientVo = clientMapper.selectVoById(bo.getClientId());
ErpSettlementMaintain add = BeanUtil.toBean(bo, ErpSettlementMaintain.class);
validEntityBeforeSave(add);
add.setClientName(clientVo.getName());
add.setClientPhone(clientVo.getPhone());
add.setClientType(clientVo.getType());
add.setClientCertificateType(clientVo.getCertificateType());
add.setClientCertificateNumber(clientVo.getCertificateNumber());
add.setSettlementNumber(RedisUtils.generateNextNumber("BXJS"));
add.setCreateDeptId(LoginHelper.getDeptId());
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
settlementMaintainRepairFormMapper.insertBatch(bo.getRepairFormIds().stream().map(item -> {
settlementMaintainRepairFormMapper.insertBatch(
bo.getRepairFormIds().stream().map(item -> {
ErpSettlementMaintainRepairForm repairForm = new ErpSettlementMaintainRepairForm();
repairForm.setRepairFormId(item);
repairForm.setSettlementMaintainId(add.getId());
......
<?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="com.maintain.business.mapper.ErpMaterialInventoryRecordMapper">
<resultMap type="com.maintain.business.domain.ErpMaterialInventoryRecord" id="ErpMaterialInventoryRecordResult">
<result property="id" column="id"/>
<result property="infoId" column="info_id"/>
<result property="materialId" column="material_id"/>
<result property="deptId" column="dept_id"/>
<result property="warehouseId" column="warehouse_id"/>
<result property="number" column="number"/>
<result property="price" column="price"/>
<result property="money" column="money"/>
<result property="type" column="type"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<resultMap type="com.maintain.business.domain.vo.ErpMaterialInventoryRecordVo" id="ErpMaterialInventoryRecordResultVo">
<result property="id" column="id"/>
<result property="infoId" column="info_id"/>
<result property="materialId" column="material_id"/>
<result property="deptId" column="dept_id"/>
<result property="warehouseId" column="warehouse_id"/>
<result property="number" column="number"/>
<result property="price" column="price"/>
<result property="money" column="money"/>
<result property="type" column="type"/>
</resultMap>
<sql id="custom">
SELECT t.* FROM (SELECT r.warehouse_id,
r.type,
w.name as warehouseName,
r.material_id,
m.material_code,
m.material_name,
m.material_specifications,
m.vendor_id,
m.vendor_name,
m.material_unit,
m.material_brand,
m.procurement_subject,
m.compatible_with,
m.material_warranty_period,
m.reference_price,
m.selling_price,
m.material_url,
IFNULL(put.putNumber, 0) AS putNumber,
IFNULL(ret.retNumber, 0) AS retNumber,
IFNULL(pic.picNumber, 0) AS picNumber,
IFNULL(bac.bacNumber, 0) AS bacNumber,
IFNULL(put.putNumber, 0) - IFNULL(ret.retNumber, 0) - IFNULL(pic.picNumber, 0) +
IFNULL(bac.bacNumber, 0) AS inventory
FROM erp_material_inventory_record r
LEFT JOIN erp_material m ON r.material_id = m.id
LEFT JOIN erp_warehouse w ON r.warehouse_id = w.id
LEFT JOIN(SELECT warehouse_id, material_id, SUM(number) AS putNumber
FROM erp_material_inventory_record
WHERE type = '1'
GROUP BY warehouse_id, material_id) put
ON r.warehouse_id = put.warehouse_id AND r.material_id = put.material_id
LEFT JOIN(SELECT warehouse_id, material_id, SUM(number) AS retNumber
FROM erp_material_inventory_record
WHERE type = '2'
GROUP BY warehouse_id, material_id) ret
ON r.warehouse_id = ret.warehouse_id AND r.material_id = ret.material_id
LEFT JOIN(SELECT warehouse_id, material_id, SUM(number) AS picNumber
FROM erp_material_inventory_record
WHERE type = '3'
GROUP BY warehouse_id, material_id) pic
ON r.warehouse_id = pic.warehouse_id AND r.material_id = pic.material_id
LEFT JOIN(SELECT warehouse_id, material_id, SUM(number) AS bacNumber
FROM erp_material_inventory_record
WHERE type = '4'
GROUP BY warehouse_id, material_id) bac
ON r.warehouse_id = bac.warehouse_id AND r.material_id = bac.material_id
GROUP BY r.warehouse_id, r.material_id
) t
</sql>
<select id="customQueryPageList" resultType="com.maintain.business.domain.vo.ErpMaterialInventoryRecordVo">
<include refid="custom"/>
${ew.getCustomSqlSegment}
</select>
<select id="queryListByWarehouseIdAndMaterialId" resultType="com.maintain.business.domain.vo.ErpMaterialInventoryRecordVo">
SELECT r.id, r.number, r.price, r.money, r.create_by, r.create_time,
<if test="type != null and type == 1">
p.putaway_code
</if>
<if test="type != null and type == 2">
mr.returns_code, mr.putaway_code
</if>
<if test="type != null and type == 3">
mp.out_number, mp.repair_number
</if>
<if test="type != null and type == 4">
mp.out_number, mp.repair_number, mp.return_number
</if>
FROM erp_material_inventory_record r
<if test="type != null and type == 1">
LEFT JOIN erp_material_putaway_info i ON r.info_id = i.id
LEFT JOIN erp_material_putaway p ON i.putaway_id = p.id
</if>
<if test="type != null and type == 2">
LEFT JOIN erp_material_returns_info ri ON r.info_id = ri.id
LEFT JOIN erp_material_returns mr ON ri.returns_id = mr.id
</if>
<if test="type != null and type == 3">
LEFT JOIN erp_material_picking_info pi ON r.info_id = pi.id
LEFT JOIN erp_material_picking mp ON pi.picking_id = mp.id
</if>
<if test="type != null and type == 4">
LEFT JOIN erp_material_picking_info pi ON r.info_id = pi.id
LEFT JOIN erp_material_picking mp ON pi.picking_id = mp.id
</if>
WHERE r.warehouse_id = #{warehouseId} AND r.material_id = #{materialId} and r.type = #{type}
</select>
<select id="customQueryList" resultType="com.maintain.business.domain.vo.ErpMaterialInventoryRecordVo">
<include refid="custom"/>
${ew.getCustomSqlSegment}
</select>
<select id="queryMaterialByWarehouseIdAndMaterialId"
resultType="com.maintain.business.domain.vo.ErpMaterialInventoryRecordVo">
<include refid="custom"/>
WHERE t.warehouse_id = #{warehouseId} AND t.material_id = #{materialId}
</select>
</mapper>
......@@ -10,6 +10,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="materialTypeName" column="material_type_name"/>
<result property="warehouseLocationId" column="warehouse_location_id"/>
<result property="warehouseLocationType" column="warehouse_location_type"/>
<result property="warehouseId" column="warehouse_id"/>
<result property="warehouseName" column="warehouse_name"/>
<result property="vendorId" column="vendor_id"/>
<result property="vendorName" column="vendor_name"/>
<result property="materialCode" column="material_code"/>
......@@ -26,19 +28,83 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createTime" column="create_time"/>
</resultMap>
<sql id="customQuerySql">
SELECT DISTINCT m.*
FROM erp_material m
LEFT JOIN erp_material_picking_info p ON m.id = p.material_id
LEFT JOIN erp_material_putaway_info pu ON m.id = pu.material_id
LEFT JOIN erp_material_returns_info r ON m.id = r.material_id
WHERE p.material_id IS NOT NULL
OR pu.material_id IS NOT NULL
OR r.material_id IS NOT NULL
SELECT
t.*
FROM(
SELECT
r.warehouse_id, w.name as warehouse_name, r.material_id, m.material_code, m.material_name, m.material_specifications,
m.vendor_id, m.vendor_name, m.material_unit, m.material_brand, m.procurement_subject, m.compatible_with,
m.material_warranty_period,m.reference_price, m.selling_price, m.material_url,
IFNULL(put.putNumber,0) AS putNumber, IFNULL(ret.retNumber,0) AS retNumber,
IFNULL(pic.picNumber,0) AS picNumber, IFNULL(bac.bacNumber,0) AS bacNumber,
IFNULL(put.putNumber,0) - IFNULL(ret.retNumber,0) - IFNULL(pic.picNumber,0) + IFNULL(bac.bacNumber,0) AS inventory
FROM erp_material_inventory_record r
LEFT JOIN erp_material m ON r.material_id = m.id
LEFT JOIN erp_warehouse w ON r.warehouse_id = w.id
LEFT JOIN(
SELECT warehouse_id, material_id, SUM(number) AS putNumber
FROM erp_material_inventory_record
WHERE type = '1'
GROUP BY warehouse_id, material_id
) put ON r.warehouse_id = put.warehouse_id AND r.material_id = put.material_id
LEFT JOIN(
SELECT warehouse_id, material_id, SUM(number) AS retNumber
FROM erp_material_inventory_record
WHERE type = '2'
GROUP BY warehouse_id, material_id
) ret ON r.warehouse_id = ret.warehouse_id AND r.material_id = ret.material_id
LEFT JOIN(
SELECT warehouse_id, material_id, SUM(number) AS picNumber
FROM erp_material_inventory_record
WHERE type = '3'
GROUP BY warehouse_id, material_id
) pic ON r.warehouse_id = pic.warehouse_id AND r.material_id = pic.material_id
LEFT JOIN(
SELECT warehouse_id, material_id, SUM(number) AS bacNumber
FROM erp_material_inventory_record
WHERE type = '4'
GROUP BY warehouse_id, material_id
) bac ON r.warehouse_id = bac.warehouse_id AND r.material_id = bac.material_id
GROUP BY r.warehouse_id, r.material_id
) t
</sql>
<select id="customQueryPageList" resultType="com.maintain.business.domain.vo.ErpMaterialVo">
<include refid="customQuerySql" />
${ew.getCustomSqlSegment}
</select>
<select id="customQueryPageListByWarehouseId" resultType="com.maintain.business.domain.vo.ErpMaterialVo">
SELECT
m.id as material_id, m.material_code, m.material_name, m.material_specifications,m.vendor_id, m.vendor_name,
m.material_unit, m.material_brand, m.procurement_subject, m.compatible_with,
m.material_warranty_period,m.reference_price, m.selling_price, m.material_url,
IFNULL(put.putNumber,0) - IFNULL(ret.retNumber,0) - IFNULL(pic.picNumber,0) + IFNULL(bac.bacNumber,0) AS inventory
FROM erp_material m
LEFT JOIN(
SELECT warehouse_id, material_id, SUM(number) AS putNumber
FROM erp_material_inventory_record
WHERE type = '1' AND warehouse_id = #{warehouseId}
GROUP BY warehouse_id, material_id
) put ON m.id = put.material_id
LEFT JOIN(
SELECT warehouse_id, material_id, SUM(number) AS retNumber
FROM erp_material_inventory_record
WHERE type = '2' AND warehouse_id = #{warehouseId}
GROUP BY warehouse_id, material_id
) ret ON m.id = ret.material_id
LEFT JOIN(
SELECT warehouse_id, material_id, SUM(number) AS picNumber
FROM erp_material_inventory_record
WHERE type = '3' AND warehouse_id = #{warehouseId}
GROUP BY warehouse_id, material_id
) pic ON m.id = pic.material_id
LEFT JOIN(
SELECT warehouse_id, material_id, SUM(number) AS bacNumber
FROM erp_material_inventory_record
WHERE type = '4' AND warehouse_id = #{warehouseId}
GROUP BY warehouse_id, material_id
) bac ON m.id = bac.material_id
${ew.getCustomSqlSegment}
</select>
</mapper>
......@@ -8,6 +8,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="id" column="id"/>
<result property="repairFormId" column="repair_form_id"/>
<result property="pickingId" column="picking_id"/>
<result property="warehouseId" column="warehouse_id"/>
<result property="warehouseName" column="warehouse_name"/>
<result property="vendorId" column="vendor_id"/>
<result property="vendorName" column="vendor_name"/>
<result property="materialId" column="material_id"/>
......@@ -30,7 +32,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="info">
SELECT
empi.id, empi.repair_form_id, empi.picking_id, empi.vendor_id, empi.vendor_name, empi.material_id, empi.material_code,
empi.id, empi.repair_form_id, empi.picking_id, empi.warehouse_id, empi.warehouse_name, empi.vendor_id, empi.vendor_name, empi.material_id, empi.material_code,
empi.material_name,empi.material_specifications, empi.material_unit, empi.material_warranty_period, empi.reference_price, empi.selling_price, empi.collect_number,
empi.price, empi.money, empi.state, empi.create_by, empi.create_time, emp.return_number, emp.repair_number, emp.out_number
FROM erp_material_picking_info empi
......
package com.maintain.common.enums;
import lombok.Getter;
/**
* 物料库存类型
*
* @author liushuai
*/
@Getter
public enum InventoryType {
putaway("1", "入库"),
returns("2", "退货"),
picking("3", "出库"),
back("4", "退料");
private final String code;
private final String info;
InventoryType(String code, String info) {
this.code = code;
this.info = info;
}
}
......@@ -9,6 +9,42 @@ export function listMaterial(query) {
})
}
// 查询物资列表(自定义查询用于查询库存大于0的物料)
export function customListMaterial(query) {
return request({
url: '/business/material/customList',
method: 'get',
params: query
})
}
// 查询物资列表(自定义查询用于物料盘点)
export function customListAll(query) {
return request({
url: '/business/material/customListAll',
method: 'get',
params: query
})
}
// 查询物资库存列表
export function listMaterialInventory(query) {
return request({
url: '/business/materialInventoryRecord/list',
method: 'get',
params: query
})
}
// 查询物资库存列表
export function listByMaterialId(query) {
return request({
url: '/business/materialInventoryRecord/listByMaterialId',
method: 'get',
params: query
})
}
// 查询物资详细
export function getMaterial(id) {
return request({
......
......@@ -140,7 +140,7 @@
<el-table-column label="物资规格" align="center" fixed="left" prop="materialSpecifications" />
<el-table-column label="物资品牌" align="center" fixed="left" prop="materialBrand" />
<el-table-column label="物资单位" align="center" fixed="left" prop="materialUnit" />
<el-table-column label="所在仓库" align="center" prop="warehouseName" />
<!-- <el-table-column label="所在仓库" align="center" prop="warehouseName" />-->
<!-- <el-table-column label="分类名称" align="center" prop="materialTypeName" />-->
<el-table-column label="供应商" align="center" prop="vendorName" show-overflow-tooltip />
<el-table-column label="采购标的" align="center" prop="procurementSubject" />
......@@ -159,11 +159,11 @@
<dict-tag :options="dict.type.sys_is_enable" :value="scope.row.isEnable"/>
</template>
</el-table-column>
<el-table-column label="盘点中" align="center" prop="isCheck">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_is_enable" :value="String(scope.row.isCheck)"/>
</template>
</el-table-column>
<!-- <el-table-column label="盘点中" align="center" prop="isCheck">-->
<!-- <template slot-scope="scope">-->
<!-- <dict-tag :options="dict.type.sys_is_enable" :value="String(scope.row.isCheck)"/>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column label="是否通用" align="center" prop="isUniversal">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_is_enable" :value="scope.row.isUniversal"/>
......@@ -218,13 +218,13 @@
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="仓库" prop="warehouseId">
<el-select v-model="form.warehouseId" filterable placeHolder="请选择仓库">
<el-option v-for="item in warehouseList" :key="item.id" :value="item.id" :label="item.name" />
</el-select>
</el-form-item>
</el-col>
<!-- <el-col :span="8">-->
<!-- <el-form-item label="仓库" prop="warehouseId">-->
<!-- <el-select v-model="form.warehouseId" filterable placeHolder="请选择仓库">-->
<!-- <el-option v-for="item in warehouseList" :key="item.id" :value="item.id" :label="item.name" />-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- <el-col :span="8">-->
<!-- <el-form-item label="物资分类" prop="materialTypeId">-->
<!-- <treeselect v-model="form.materialTypeId" :options="materialTypeList" :show-count="true" @select="materialTypeIdChange" :normalizer="normalizer" placeholder="请选择" />-->
......@@ -238,29 +238,34 @@
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="物资品牌" prop="materialBrand">
<el-input v-model="form.materialBrand" placeholder="请输入物资品牌" />
<el-form-item label="物资单位" prop="materialUnit">
<el-input v-model="form.materialUnit" placeholder="请输入物资单位" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="质保期(月)" prop="materialWarrantyPeriod">
<el-input-number v-model="form.materialWarrantyPeriod" :min="1" style="width: 100%" placeholder="请输入质保期" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="采购标的" prop="procurementSubject">
<el-input v-model="form.procurementSubject" placeholder="请输入采购标的" />
<el-form-item label="参考价" prop="referencePrice">
<el-input-number v-model="form.referencePrice" :min="0" style="width: 100%" placeholder="请输入参考价" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="适用车型" prop="compatibleWith">
<el-input v-model="form.compatibleWith" placeholder="请输入适用车型" />
<el-form-item label="销售价" prop="sellingPrice">
<el-input-number v-model="form.sellingPrice" :min="0" style="width: 100%" placeholder="请输入销售价" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="物资单位" prop="materialUnit">
<el-input v-model="form.materialUnit" placeholder="请输入物资单位" />
<el-form-item label="适用车型" prop="compatibleWith">
<el-input v-model="form.compatibleWith" placeholder="请输入适用车型" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<!-- <el-col :span="8">-->
<!-- <el-form-item label="仓库货位" prop="warehouseLocationId">-->
......@@ -270,35 +275,29 @@
<!-- </el-form-item>-->
<!-- </el-col>-->
<el-col :span="8">
<el-form-item label="质保期(月)" prop="materialWarrantyPeriod">
<el-input-number v-model="form.materialWarrantyPeriod" :min="1" style="width: 100%" placeholder="请输入质保期" />
<el-form-item label="是否启用" prop="isEnable">
<el-select v-model="form.isEnable" style="width: 100%" placeholder="请选择是否启用">
<el-option v-for="dict in dict.type.sys_is_enable" :key="dict.value" :label="dict.label" :value="dict.value"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="参考价" prop="referencePrice">
<el-input-number v-model="form.referencePrice" :min="0" style="width: 100%" placeholder="请输入参考价" />
<el-form-item label="物资品牌" prop="materialBrand">
<el-input v-model="form.materialBrand" placeholder="请输入物资品牌" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="销售价" prop="sellingPrice">
<el-input-number v-model="form.sellingPrice" :min="0" style="width: 100%" placeholder="请输入销售价" />
<el-form-item label="采购标的" prop="procurementSubject">
<el-input v-model="form.procurementSubject" placeholder="请输入采购标的" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<!-- <el-col :span="8">-->
<!-- <el-form-item label="库存数量" prop="inventory">-->
<!-- <el-input-number v-model="form.inventory" :min="0" style="width: 100%" :disabled="form.id != null" placeholder="请输入库存数量" />-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<el-col :span="8">
<el-form-item label="是否启用" prop="isEnable">
<el-select v-model="form.isEnable" style="width: 100%" placeholder="请选择是否启用">
<el-option v-for="dict in dict.type.sys_is_enable" :key="dict.value" :label="dict.label" :value="dict.value"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="是否通用" prop="isUniversal">
<el-select v-model="form.isUniversal" style="width: 100%" placeholder="请选择是否通用">
......@@ -436,7 +435,7 @@ export default {
// 表单校验
rules: {
warehouseId: [
{ required: true, message: "仓库不能为空", trigger: "change" }
{ required: false, message: "仓库不能为空", trigger: "change" }
],
vendorId: [
{ required: true, message: "供应商不能为空", trigger: "change" }
......
......@@ -244,16 +244,18 @@
</el-col>
</el-row>
</el-form>
<span style="font-weight: bold; font-size: 18px">盘点明细</span>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button v-loading="infoLoading" type="primary" plain icon="el-icon-plus" size="mini" @click="openMaterialModel">新增</el-button>
</el-col>
</el-row>
<el-divider />
<el-table v-loading="infoLoading" :data="form.checkInfoList">
<el-table-column label="分类名称" align="center" prop="materialTypeName" />
<el-table-column label="货位类型" align="center" prop="warehouseLocationType" />
<el-table-column label="供应商" align="center" prop="vendorName" />
<el-table-column label="物资编码" align="center" prop="materialCode" />
<el-table-column label="物资名称" align="center" prop="materialName" />
<el-table-column label="物资规格" align="center" prop="materialSpecifications" />
<el-table-column label="物资单位" align="center" prop="materialUnit" />
<el-table-column label="供应商" align="center" prop="vendorName" />
<el-table-column label="质保期" align="center" prop="materialWarrantyPeriod" />
<el-table-column label="库存" align="center" prop="inventory" />
<el-table-column label="实盘数量" align="center" prop="checkNum" width="140px">
......@@ -279,6 +281,60 @@
</div>
</el-dialog>
<!-- 物料列表对话框 -->
<el-dialog title="选择盘点物料" :visible.sync="open2" width="65%" append-to-body>
<el-form :model="queryMaterialParams" ref="queryMaterialForm" size="small" :inline="true" v-show="showSearch" label-width="80px">
<!-- <el-form-item label="仓库" prop="warehouseId">-->
<!-- <el-input v-model="queryMaterialParams.warehouseId" placeHolder="请选择仓库" />-->
<!-- </el-form-item>-->
<el-form-item label="物资编码" prop="materialCode">
<el-input
v-model="queryMaterialParams.materialCode"
placeholder="请输入物资编码"
clearable
@keyup.enter.native="handleMaterialQuery"
/>
</el-form-item>
<el-form-item label="物资名称" prop="materialName">
<el-input
v-model="queryMaterialParams.materialName"
placeholder="请输入物资名称"
clearable
@keyup.enter.native="handleMaterialQuery"
/>
</el-form-item>
<el-form-item label="供应商" prop="vendorName">
<el-input
v-model="queryMaterialParams.vendorName"
placeholder="请输入供应商名称"
clearable
@keyup.enter.native="handleMaterialQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleMaterialQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetMaterialQuery">重置</el-button>
</el-form-item>
</el-form>
<el-table v-loading="materialLoading" :data="materialList" ref="selectionTable" max-height="450" row-key="materialId" @selection-change="handleMaterialSelectionChange">
<el-table-column type="selection" width="55" align="center" reserve-selection />
<el-table-column label="物资编码" align="center" prop="materialCode" />
<el-table-column label="物资名称" align="center" prop="materialName" />
<el-table-column label="物资规格" align="center" prop="materialSpecifications" />
<el-table-column label="物资单位" align="center" prop="materialUnit" />
<el-table-column label="供应商" align="center" prop="vendorName" />
<el-table-column label="质保期" align="center" prop="materialWarrantyPeriod" />
<el-table-column label="参考价" align="center" prop="referencePrice" />
<el-table-column label="销售价" align="center" prop="sellingPrice" />
<el-table-column label="库存" align="center" prop="inventory" />
</el-table>
<pagination v-show="materialTotal>0" :total="materialTotal" :page.sync="queryMaterialParams.pageNum" :limit.sync="queryMaterialParams.pageSize" @pagination="getMaterialList"/>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="confirmSelection">确 定</el-button>
<el-button @click="cancelMaterial">取 消</el-button>
</div>
</el-dialog>
<!-- 物资盘点详情对话框 -->
<el-dialog :title="title" :visible.sync="open1" width="80%" append-to-body>
<span style="font-weight: bold; font-size: 18px">盘点信息</span>
......@@ -304,8 +360,6 @@
<span style="font-weight: bold; font-size: 18px">盘点明细</span>
<el-divider />
<el-table :data="form.checkInfoList">
<el-table-column label="分类名称" align="center" prop="materialTypeName" />
<el-table-column label="货位类型" align="center" prop="warehouseLocationType" />
<el-table-column label="供应商" align="center" prop="vendorName" />
<el-table-column label="物资编码" align="center" prop="materialCode" />
<el-table-column label="物资名称" align="center" prop="materialName" />
......@@ -338,7 +392,7 @@ import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import { getSiteTree } from '@/api/business/unit'
import { listSiteWarehouse } from '@/api/business/siteWarehouse'
import { listMaterial } from '@/api/business/material'
import {customListAll, listMaterial} from '@/api/business/material'
import { formatDate } from '@/utils'
export default {
......@@ -347,6 +401,8 @@ export default {
dicts: ['check_state', 'check_type', 'check_state', 'check_info_state'],
data() {
return {
// 按钮loading
materialLoading: false,
// 按钮loading
buttonLoading: false,
// 遮罩层
......@@ -366,11 +422,25 @@ export default {
materialCheckList: [],
deptTreeData: [],
warehouseList: [],
warehouseId: undefined,
tempSelection: [],
// 物料列表
materialList: [],
materialTotal: 0,
queryMaterialParams: {
pageNum: 1,
pageSize: 10,
materialCode: undefined,
materialName: undefined,
materialSpecifications: undefined,
vendorName: undefined,
},
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
open1: false,
open2: false,
// 查询参数
queryParams: {
pageNum: 1,
......@@ -457,14 +527,18 @@ export default {
listSiteWarehouse({ deptId: e.deptId, pageNum: 0, pageSize: 100 }).then(response => {
this.warehouseList = response.rows;
});
this.form.checkInfoList = []
this.materialList = [];
this.warehouseId = undefined;
},
// 仓库变更
warehouseChange(id) {
this.infoLoading = true
this.form.checkInfoList = []
listMaterial({ pageNum: 1, pageSize: 1000, warehouseId: id}).then(response => {
this.form.checkInfoList = response.rows;
this.$forceUpdate()
this.warehouseId = id;
customListAll({ ...this.queryMaterialParams, warehouseId: this.warehouseId}).then(response => {
this.materialList = response.rows;
this.materialTotal = response.total;
this.infoLoading = false
});
},
......@@ -536,6 +610,63 @@ export default {
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 打开物料列表 */
openMaterialModel() {
if (!this.warehouseId) {
this.$modal.msgError("请先选择要盘点的仓库");
return
}
this.open2 = true
this.getMaterialList()
},
/** 搜索按钮操作 */
handleMaterialQuery() {
this.queryMaterialParams.pageNum = 1;
this.getMaterialList();
},
/** 重置按钮操作 */
resetMaterialQuery() {
this.resetForm("queryMaterialForm");
this.handleMaterialQuery();
},
/** 查询物资列表 */
getMaterialList() {
this.materialLoading = true;
customListAll({ ...this.queryMaterialParams, warehouseId: this.warehouseId }).then(response => {
this.materialList = response.rows;
this.materialTotal = response.total;
this.materialLoading = false;
}).then(() =>{
this.$nextTick(() => {
// 清空临时勾选
this.tempSelection = [];
// 手动设置勾选(匹配外部已选数据)
this.materialList.forEach(row => {
const isSelected = this.form.checkInfoList.some(item => item.materialId === row.materialId);
this.$refs.selectionTable.toggleRowSelection(row, isSelected);
});
});
})
},
// 多选框选中数据
handleMaterialSelectionChange(selection) {
console.log('selection', selection)
this.tempSelection = selection
console.log('tempSelection', this.tempSelection)
},
confirmSelection() {
console.log('this.tempSelection', this.tempSelection)
console.log(' this.form.checkInfoList ', this.form.checkInfoList)
this.form.checkInfoList = this.tempSelection.map(item =>{
return item
})
this.open2 = false
},
// 取消按钮
cancelMaterial() {
this.open2 = false;
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
......
......@@ -59,13 +59,14 @@
</el-col>
</el-row>
<el-table :data="form.pickingInfoList">
<el-table-column label="分类名称" align="center" prop="materialTypeName" />
<el-table-column label="货位类型" align="center" prop="warehouseLocationType" />
<el-table-column label="供应商" align="center" prop="vendorName" />
<!-- <el-table-column label="分类名称" align="center" prop="materialTypeName" />-->
<!-- <el-table-column label="货位类型" align="center" prop="warehouseLocationType" />-->
<el-table-column label="仓库" align="center" prop="warehouseName" />
<el-table-column label="物资编码" align="center" prop="materialCode" />
<el-table-column label="物资名称" align="center" prop="materialName" />
<el-table-column label="物资规格" align="center" prop="materialSpecifications" />
<el-table-column label="物资单位" align="center" prop="materialUnit" />
<el-table-column label="供应商" align="center" prop="vendorName" />
<el-table-column label="质保期" align="center" prop="materialWarrantyPeriod" />
<el-table-column label="参考价" align="center" prop="referencePrice" />
<el-table-column label="销售价" align="center" prop="sellingPrice" />
......@@ -75,14 +76,14 @@
<el-input-number v-model="scope.row.collectNumber" @change="collectNumberChange" controls-position="right" size="mini" :min="1" :precision="0" style="width: 100%" placeholder="数量"/>
</template>
</el-table-column>
<el-table-column label="销售单价" align="center" prop="price" width="120px">
<template slot-scope="scope">
<el-input-number v-model="scope.row.price" disabled controls-position="right" size="mini" :min="1" :precision="2" style="width: 100%" placeholder="单价"/>
</template>
</el-table-column>
<!-- <el-table-column label="销售单价" align="center" prop="price" width="120px">-->
<!-- <template slot-scope="scope">-->
<!-- <el-input-number v-model="scope.row.price" disabled controls-position="right" size="mini" :min="1" :precision="2" style="width: 100%" placeholder="单价"/>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column label="领料金额" align="center" prop="money" width="120px">
<template slot-scope="scope">
<el-input-number v-model="scope.row.money" disabled controls-position="right" size="mini" :min="1" style="width: 100%" placeholder="金额"/>
<el-input-number v-model="scope.row.money" disabled controls-position="right" size="mini" :min="0" style="width: 100%" placeholder="金额"/>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
......@@ -130,24 +131,20 @@
<el-button icon="el-icon-refresh" size="mini" @click="resetMaterialQuery">重置</el-button>
</el-form-item>
</el-form>
<el-table v-loading="materialLoading" :data="materialList" ref="selectionTable" max-height="300" @selection-change="handleMaterialSelectionChange">
<el-table v-loading="materialLoading" :data="materialList" ref="selectionTable" max-height="450" @selection-change="handleMaterialSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="分类名称" align="center" prop="materialTypeName" />
<el-table-column label="货位类型" align="center" prop="warehouseLocationType" />
<el-table-column label="供应商" align="center" prop="vendorName" />
<!-- <el-table-column label="分类名称" align="center" prop="materialTypeName" />-->
<!-- <el-table-column label="货位类型" align="center" prop="warehouseLocationType" />-->
<el-table-column label="仓库" align="center" prop="warehouseName" />
<el-table-column label="物资编码" align="center" prop="materialCode" />
<el-table-column label="物资名称" align="center" prop="materialName" />
<el-table-column label="物资规格" align="center" prop="materialSpecifications" />
<el-table-column label="物资单位" align="center" prop="materialUnit" />
<el-table-column label="供应商" align="center" prop="vendorName" />
<el-table-column label="质保期" align="center" prop="materialWarrantyPeriod" />
<el-table-column label="参考价" align="center" prop="referencePrice" />
<el-table-column label="销售价" align="center" prop="sellingPrice" />
<el-table-column label="库存" align="center" prop="inventory" />
<el-table-column label="是否启用" align="center" prop="isEnable">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_is_enable" :value="scope.row.isEnable"/>
</template>
</el-table-column>
</el-table>
<pagination v-show="materialTotal>0" :total="materialTotal" :page.sync="queryMaterialParams.pageNum" :limit.sync="queryMaterialParams.pageSize" @pagination="getMaterialList"/>
<div slot="footer" class="dialog-footer">
......@@ -168,7 +165,8 @@ import {
updateMaterialPicking
} from '@/api/business/materialPicking'
import { getRepairForm } from '@/api/business/repairForm'
import { listMaterial } from '@/api/business/material'
import {customListMaterial, listMaterial} from '@/api/business/material'
import {listWarehouseAll} from "@/api/business/siteWarehouse";
export default {
name: "MaterialPickingAdd",
......@@ -227,7 +225,9 @@ export default {
outTime: undefined,
},
// 表单参数
form: {},
form: {
pickingInfoList: []
},
open1: false,
open2: false,
materialLoading: false,
......@@ -235,13 +235,18 @@ export default {
// 物料列表
materialList: [],
materialTotal: 0,
// 仓库列表
warehouseOpt: [],
// 查询参数
queryMaterialParams: {
pageNum: 1,
pageSize: 10,
vendorName: undefined,
warehouseId: undefined,
warehouseIdList: [],
materialCode: undefined,
materialName: undefined,
inventory: 0,
},
// 表单校验
rules: {
......@@ -256,8 +261,16 @@ export default {
},
created() {
this.form = {...this.$route.params}
this.getWarehouseList(this.form.repairerDeptId)
},
methods: {
/** 查询仓库列表 */
getWarehouseList(deptId) {
listWarehouseAll({deptId}).then(response => {
this.warehouseOpt = response.data;
this.queryMaterialParams.warehouseIdList = response.data.map(item => item.id);
});
},
/** 查询物料出库列表 */
getList() {
this.loading = true;
......@@ -267,17 +280,6 @@ export default {
this.loading = false;
});
},
// 报修单更改
repairFormChange(id) {
getRepairForm(id).then(res =>{
this.form.clientName = res.data.clientName
this.form.repairerDeptId = res.data.repairerDeptId
this.form.repairerDeptName = res.data.repairerDeptName
this.form.repairerGroupName = res.data.repairerGroupName
this.form.plateNumber = res.data.car.plateNumber
this.form.carId = res.data.carId
})
},
/** 打开物料列表 */
openMaterialModel() {
if (!this.form.repairerDeptId) {
......@@ -290,6 +292,7 @@ export default {
/** 搜索按钮操作 */
handleMaterialQuery() {
this.queryMaterialParams.pageNum = 1;
this.queryMaterialParams.warehouseIdList = this.warehouseOpt.map(item => item.id);
this.getMaterialList();
},
/** 重置按钮操作 */
......@@ -300,7 +303,7 @@ export default {
/** 查询物资列表 */
getMaterialList() {
this.materialLoading = true;
listMaterial({ ...this.queryMaterialParams, deptId: this.repairerDeptId }).then(response => {
customListMaterial({ ...this.queryMaterialParams }).then(response => {
this.materialList = response.rows;
this.materialTotal = response.total;
this.materialLoading = false;
......@@ -309,24 +312,25 @@ export default {
// 清空临时勾选
this.tempSelection = [];
// 手动设置勾选(匹配外部已选数据)
if (this.form.pickingInfoList && this.form.pickingInfoList.length > 0 && this.materialList.length > 0) {
this.materialList.forEach(row => {
const isSelected = this.form.pickingInfoList.some(item => item.id === row.id || item.materialId === row.id);
const isSelected = this.form.pickingInfoList.some(item => item.warehouseId === row.warehouseId && item.materialId === row.materialId);
this.$refs.selectionTable.toggleRowSelection(row, isSelected);
});
}
});
})
},
// 入库明细删除
handleRowDelete(row) {
this.form.pickingInfoList = this.form.pickingInfoList.filter(item => item.id !== row.id);
this.form.pickingInfoList = this.form.pickingInfoList.filter(item =>
!(item.materialId === row.materialId && item.warehouseId === row.warehouseId)
);
this.$forceUpdate();
},
// 入库数量变动
collectNumberChange() {
this.form.outMoney = this.form.pickingInfoList.reduce((sum, item) => {
item.money = item.collectNumber * item.price
return sum + (item.collectNumber * item.price);
item.money = item.collectNumber * item.sellingPrice
return sum + (item.collectNumber * item.sellingPrice);
}, 0)
},
// 多选框选中数据
......@@ -349,104 +353,6 @@ export default {
cancel() {
this.$tab.closeOpenPage({name: "repairFormEdit", params:{repairFormId: this.form.repairFormId, flag: this.form.flag, isDelivery: this.form.isDelivery}});
},
// 表单重置
reset() {
this.form = {
id: undefined,
repairFormId: undefined,
repairNumber: undefined,
outNumber: undefined,
returnNumber: undefined,
carId: undefined,
plateNumber: undefined,
outMoney: undefined,
receiveUserId: undefined,
receiveUserName: undefined,
receiveTime: undefined,
state: undefined,
outTime: undefined,
pickingInfoList: []
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
let isTrue = false
this.ids = selection.map(item => {
if (item.state !== 1) {
isTrue = true
}
return item.id
})
if (selection.length > 0) {
this.isTrue = isTrue
}else {
this.isTrue = true
}
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加物料出库";
this.form.repairFormId = this.repairFormId
this.form.repairNumber = this.repairNumber
this.form.carId = this.carId
this.form.plateNumber = this.plateNumber
this.form.clientName = this.clientName
this.form.repairerDeptId = this.repairerDeptId
this.form.repairerDeptName = this.repairerDeptName
this.form.repairerGroupName = this.repairerGroupName
},
// 详情按钮
handleDetail(row) {
getMaterialPicking(row.id).then(response => {
this.form = response.data;
getRepairForm(response.data.repairFormId).then(res =>{
this.loading = false;
this.form.clientName = res.data.clientName
this.form.repairerDeptId = res.data.repairerDeptId
this.form.repairerDeptName = res.data.repairerDeptName
this.form.repairerGroupName = res.data.repairerGroupName
this.form.plateNumber = res.data.car.plateNumber
this.form.carId = res.data.carId
this.open2 = true;
this.title = "物料出库详情";
})
});
},
/** 修改按钮操作 */
handleUpdate(row) {
this.loading = true;
this.reset();
const id = row.id || this.ids
getMaterialPicking(id).then(response => {
this.form = response.data;
getRepairForm(response.data.repairFormId).then(res =>{
this.loading = false;
this.form.clientName = res.data.clientName
this.form.repairerDeptId = res.data.repairerDeptId
this.form.repairerDeptName = res.data.repairerDeptName
this.form.repairerGroupName = res.data.repairerGroupName
this.form.plateNumber = res.data.car.plateNumber
this.form.carId = res.data.carId
this.open = true;
this.title = "修改物料出库";
})
});
},
/** 提交按钮 */
submitForm(state) {
this.$refs["form"].validate(valid => {
......@@ -466,7 +372,14 @@ export default {
return
}
this.form.materialList = this.form.pickingInfoList.map(item =>{
return { materialId: item.materialId || item.id, collectNumber: item.collectNumber, price: item.price, money: item.money, }
return {
warehouseId: item.warehouseId,
warehouseName: item.warehouseName,
materialId: item.materialId,
collectNumber: item.collectNumber,
price: item.price,
money: item.money,
}
})
this.buttonLoading = true;
this.form.state = state
......@@ -496,36 +409,6 @@ export default {
}
});
},
/** 出库按钮操作 */
handleConfirm(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认物料出库?').then(() => {
this.loading = true;
return confirmMaterialPicking(ids);
}).then(() => {
this.loading = false;
this.getList();
this.$modal.msgSuccess("出库成功");
}).catch(() => {
}).finally(() => {
this.loading = false;
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除物料出库编号为"' + ids + '"的数据项?').then(() => {
this.loading = true;
return delMaterialPicking(ids);
}).then(() => {
this.loading = false;
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
}).finally(() => {
this.loading = false;
});
},
}
};
</script>
......
......@@ -246,34 +246,33 @@
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="openMaterialModel">新增</el-button>
<el-button v-loading="addLoading" type="primary" plain icon="el-icon-plus" size="mini" @click="openMaterialModel">新增</el-button>
</el-col>
</el-row>
<el-table :data="form.pickingInfoList">
<el-table-column label="分类名称" align="center" prop="materialTypeName" />
<el-table-column label="货位类型" align="center" prop="warehouseLocationType" />
<el-table-column label="供应商" align="center" prop="vendorName" />
<el-table-column label="仓库名称" align="center" prop="warehouseName" />
<el-table-column label="物资编码" align="center" prop="materialCode" />
<el-table-column label="物资名称" align="center" prop="materialName" />
<el-table-column label="物资规格" align="center" prop="materialSpecifications" />
<el-table-column label="物资单位" align="center" prop="materialUnit" />
<el-table-column label="供应商" align="center" prop="vendorName" />
<el-table-column label="质保期" align="center" prop="materialWarrantyPeriod" />
<el-table-column label="参考价" align="center" prop="referencePrice" />
<el-table-column label="销售价" align="center" prop="sellingPrice" />
<!-- <el-table-column label="库存" align="center" prop="inventory" />-->
<el-table-column label="库存" align="center" prop="inventory" />
<el-table-column label="领料数量" align="center" prop="collectNumber" width="120px">
<template slot-scope="scope">
<el-input-number v-model="scope.row.collectNumber" @change="collectNumberChange" controls-position="right" size="mini" :min="1" :precision="0" style="width: 100%" placeholder="数量"/>
</template>
</el-table-column>
<el-table-column label="销售单价" align="center" prop="price" width="120px">
<template slot-scope="scope">
<el-input-number v-model="scope.row.price" disabled controls-position="right" size="mini" :min="1" :precision="2" style="width: 100%" placeholder="单价"/>
<el-input-number v-model="scope.row.collectNumber" @change="collectNumberChange" controls-position="right" size="mini" :min="1" :max="parseInt(scope.row.inventory)" :precision="0" style="width: 100%" placeholder="数量"/>
</template>
</el-table-column>
<!-- <el-table-column label="销售单价" align="center" prop="price" width="120px">-->
<!-- <template slot-scope="scope">-->
<!-- <el-input-number v-model="scope.row.price" disabled controls-position="right" size="mini" :min="1" :precision="2" style="width: 100%" placeholder="单价"/>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column label="领料金额" align="center" prop="money" width="120px">
<template slot-scope="scope">
<el-input-number v-model="scope.row.money" disabled controls-position="right" size="mini" :min="1" style="width: 100%" placeholder="金额"/>
<el-input-number v-model="scope.row.money" disabled controls-position="right" size="mini" :min="0" style="width: 100%" placeholder="金额"/>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
......@@ -292,6 +291,11 @@
<!-- 物料列表对话框 -->
<el-dialog title="物料列表" :visible.sync="open1" width="65%" append-to-body>
<el-form :model="queryMaterialParams" ref="queryMaterialForm" size="small" :inline="true" v-show="showSearch" label-width="80px">
<!-- <el-form-item label="仓库" prop="warehouseId">-->
<!-- <el-select v-model="queryMaterialParams.warehouseId" placeHolder="请选择仓库">-->
<!-- <el-option v-for="item in warehouseOpt" :key="item.id" :value="item.id" :label="item.name" />-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<el-form-item label="供应商" prop="vendorName">
<el-input
v-model="queryMaterialParams.vendorName"
......@@ -321,24 +325,20 @@
<el-button icon="el-icon-refresh" size="mini" @click="resetMaterialQuery">重置</el-button>
</el-form-item>
</el-form>
<el-table v-loading="materialLoading" :data="materialList" ref="selectionTable" max-height="300" @selection-change="handleMaterialSelectionChange">
<el-table v-loading="materialLoading" :data="materialList" ref="selectionTable" max-height="450" @selection-change="handleMaterialSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="分类名称" align="center" prop="materialTypeName" />
<el-table-column label="货位类型" align="center" prop="warehouseLocationType" />
<el-table-column label="供应商" align="center" prop="vendorName" />
<!-- <el-table-column label="分类名称" align="center" prop="materialTypeName" />-->
<!-- <el-table-column label="货位类型" align="center" prop="warehouseLocationType" />-->
<el-table-column label="仓库名称" align="center" prop="warehouseName" />
<el-table-column label="物资编码" align="center" prop="materialCode" />
<el-table-column label="物资名称" align="center" prop="materialName" />
<el-table-column label="物资规格" align="center" prop="materialSpecifications" />
<el-table-column label="物资单位" align="center" prop="materialUnit" />
<el-table-column label="供应商" align="center" prop="vendorName" />
<el-table-column label="质保期" align="center" prop="materialWarrantyPeriod" />
<el-table-column label="参考价" align="center" prop="referencePrice" />
<el-table-column label="销售价" align="center" prop="sellingPrice" />
<el-table-column label="库存" align="center" prop="inventory" />
<el-table-column label="是否启用" align="center" prop="isEnable">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_is_enable" :value="scope.row.isEnable"/>
</template>
</el-table-column>
</el-table>
<pagination v-show="materialTotal>0" :total="materialTotal" :page.sync="queryMaterialParams.pageNum" :limit.sync="queryMaterialParams.pageSize" @pagination="getMaterialList"/>
<div slot="footer" class="dialog-footer">
......@@ -372,18 +372,19 @@
<span style="font-weight: bold; font-size: 18px">出库明细</span>
<el-divider />
<el-table :data="form.pickingInfoList">
<el-table-column label="分类名称" align="center" prop="materialTypeName" />
<el-table-column label="货位类型" align="center" prop="warehouseLocationType" />
<el-table-column label="供应商" align="center" prop="vendorName" />
<!-- <el-table-column label="分类名称" align="center" prop="materialTypeName" />-->
<!-- <el-table-column label="货位类型" align="center" prop="warehouseLocationType" />-->
<el-table-column label="仓库名称" align="center" prop="warehouseName" />
<el-table-column label="物资编码" align="center" prop="materialCode" />
<el-table-column label="物资名称" align="center" prop="materialName" />
<el-table-column label="物资规格" align="center" prop="materialSpecifications" />
<el-table-column label="物资单位" align="center" prop="materialUnit" />
<el-table-column label="供应商" align="center" prop="vendorName" />
<el-table-column label="质保期" align="center" prop="materialWarrantyPeriod" />
<el-table-column label="参考价" align="center" prop="referencePrice" />
<el-table-column label="销售价" align="center" prop="sellingPrice" />
<el-table-column label="数量" align="center" prop="collectNumber" width="120px" />
<el-table-column label="销售单价" align="center" prop="price" width="120px" />
<!-- <el-table-column label="销售单价" align="center" prop="price" width="120px" />-->
<el-table-column label="领料金额" align="center" prop="money" width="120px" />
</el-table>
</el-dialog>
......@@ -400,16 +401,20 @@ import {
confirmMaterialPicking
} from '@/api/business/materialPicking'
import { getRepairForm, listRepairForm } from '@/api/business/repairForm'
import { listMaterial } from '@/api/business/material'
import {customListMaterial, listMaterial} from '@/api/business/material'
import { formatDate } from '@/utils'
import {listSiteWarehouse, listWarehouseAll} from "@/api/business/siteWarehouse";
export default {
name: "MaterialPicking",
dicts: ['sys_is_enable', 'picking_state', 'picking_type'],
data() {
return {
// 新增loading
addLoading: false,
// 按钮loading
buttonLoading: false,
materialLoading: false,
// 遮罩层
loading: true,
// 选中数组
......@@ -427,6 +432,7 @@ export default {
// 物料出库表格数据
materialPickingList: [],
repairFormOpt: [],
warehouseOpt: [],
// 弹出层标题
title: "",
// 是否显示弹出层
......@@ -452,7 +458,6 @@ export default {
form: {},
open1: false,
open2: false,
materialLoading: false,
tempSelection: [],
// 物料列表
materialList: [],
......@@ -462,9 +467,14 @@ export default {
pageNum: 1,
pageSize: 10,
vendorName: undefined,
warehouseId: undefined,
warehouseIdList: [],
materialCode: undefined,
materialName: undefined,
inventory: 0,
},
warehouseId: undefined,
warehouseName: undefined,
// 表单校验
rules: {
repairFormId: [
......@@ -480,7 +490,6 @@ export default {
this.getList();
},
methods: {
confirmMaterialPicking,
/** 查询物料出库列表 */
getList() {
this.loading = true;
......@@ -490,14 +499,15 @@ export default {
this.loading = false;
});
},
/** 查询物料出库列表 */
/** 查询报修单列表 */
getRepairList() {
listRepairForm({pageNum: 1, pageSize: 100, state: 1}).then(response => {
listRepairForm({pageNum: 1, pageSize: 1000, state: 1}).then(response => {
this.repairFormOpt = response.rows;
});
},
// 报修单更改
repairFormChange(id) {
this.addLoading = true;
getRepairForm(id).then(res =>{
this.form.clientName = res.data.clientName
this.form.repairerDeptId = res.data.repairerDeptId
......@@ -505,13 +515,22 @@ export default {
this.form.repairerGroupName = res.data.repairerGroupName
this.form.plateNumber = res.data.car.plateNumber
this.form.carId = res.data.carId
console.log(this.form)
this.form.pickingInfoList = []
this.getWarehouseList(res.data.repairerDeptId)
})
},
/** 查询仓库列表 */
getWarehouseList(deptId) {
listWarehouseAll({deptId}).then(response => {
this.warehouseOpt = response.data;
this.queryMaterialParams.warehouseIdList = response.data.map(item => item.id);
this.addLoading = false;
});
},
/** 打开物料列表 */
openMaterialModel() {
if (!this.form.repairerDeptId) {
this.$modal.msgError("请选择报修单");
this.$modal.msgError("请先选择报修单");
return
}
this.open1 = true
......@@ -530,7 +549,7 @@ export default {
/** 查询物资列表 */
getMaterialList() {
this.materialLoading = true;
listMaterial({ ...this.queryMaterialParams, deptId: this.form.repairerDeptId }).then(response => {
customListMaterial({ ...this.queryMaterialParams }).then(response => {
this.materialList = response.rows;
this.materialTotal = response.total;
this.materialLoading = false;
......@@ -540,7 +559,7 @@ export default {
this.tempSelection = [];
// 手动设置勾选(匹配外部已选数据)
this.materialList.forEach(row => {
const isSelected = this.form.pickingInfoList.some(item => item.id === row.id || item.materialId === row.id);
const isSelected = this.form.pickingInfoList.some(item => item.warehouseId === row.warehouseId && item.materialId === row.materialId);
this.$refs.selectionTable.toggleRowSelection(row, isSelected);
});
});
......@@ -548,7 +567,9 @@ export default {
},
// 入库明细删除
handleRowDelete(row) {
this.form.pickingInfoList = this.form.pickingInfoList.filter(item => item.id !== row.id);
this.form.pickingInfoList = this.form.pickingInfoList.filter(item =>
!(item.materialId === row.materialId && item.warehouseId === row.warehouseId)
);
},
// 入库数量变动
collectNumberChange() {
......@@ -644,10 +665,8 @@ export default {
// 详情按钮
handleDetail(row) {
getMaterialPicking(row.id).then(response => {
this.open2 = true;
this.title = "物料出库详情";
this.form = response.data;
this.getRepairList()
if (response.data.repairFormId) {
getRepairForm(response.data.repairFormId).then(res =>{
this.form.clientName = res.data.clientName
......@@ -656,6 +675,7 @@ export default {
this.form.repairerGroupName = res.data.repairerGroupName
this.form.plateNumber = res.data.car.plateNumber
this.form.carId = res.data.carId
this.open2 = true;
})
}
});
......@@ -678,6 +698,7 @@ export default {
this.open = true;
this.title = "修改物料出库";
this.getRepairList()
this.getWarehouseList(res.data.repairerDeptId)
})
});
},
......@@ -686,11 +707,18 @@ export default {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.pickingInfoList.length < 1) {
this.$modal.msgError('出库明细列表不能为空')
this.$modal.msgError('出库物料列表不能为空')
return
}
this.form.materialList = this.form.pickingInfoList.map(item =>{
return { materialId: item.materialId || item.id, collectNumber: item.collectNumber, price: item.price, money: item.money, }
return {
warehouseId: item.warehouseId,
warehouseName: item.warehouseName,
materialId: item.materialId,
collectNumber: item.collectNumber,
price: item.price,
money: item.money,
}
})
this.buttonLoading = true;
this.form.state = state
......
......@@ -161,11 +161,11 @@
<el-input-number v-model="scope.row.collectNumber" @change="collectNumberChange" controls-position="right" size="mini" :min="1" :precision="0" style="width: 100%" placeholder="数量"/>
</template>
</el-table-column>
<el-table-column label="销售单价" align="center" prop="price" width="120px">
<template slot-scope="scope">
<el-input-number v-model="scope.row.price" disabled controls-position="right" size="mini" :min="1" :precision="2" style="width: 100%" placeholder="单价"/>
</template>
</el-table-column>
<!-- <el-table-column label="销售单价" align="center" prop="price" width="120px">-->
<!-- <template slot-scope="scope">-->
<!-- <el-input-number v-model="scope.row.price" disabled controls-position="right" size="mini" :min="1" :precision="2" style="width: 100%" placeholder="单价"/>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column label="领料金额" align="center" prop="money" width="120px">
<template slot-scope="scope">
<el-input-number v-model="scope.row.money" disabled controls-position="right" size="mini" :min="1" style="width: 100%" placeholder="金额"/>
......@@ -216,7 +216,7 @@
<el-button icon="el-icon-refresh" size="mini" @click="resetMaterialQuery">重置</el-button>
</el-form-item>
</el-form>
<el-table v-loading="materialLoading" :data="materialList" ref="selectionTable" max-height="300" @selection-change="handleMaterialSelectionChange">
<el-table v-loading="materialLoading" :data="materialList" ref="selectionTable" max-height="450" @selection-change="handleMaterialSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="分类名称" align="center" prop="materialTypeName" />
<el-table-column label="货位类型" align="center" prop="warehouseLocationType" />
......@@ -261,8 +261,8 @@
<span style="font-weight: bold; font-size: 18px">出库明细</span>
<el-divider />
<el-table :data="form.pickingInfoList">
<el-table-column label="分类名称" align="center" prop="materialTypeName" />
<el-table-column label="货位类型" align="center" prop="warehouseLocationType" />
<!-- <el-table-column label="分类名称" align="center" prop="materialTypeName" />-->
<!-- <el-table-column label="货位类型" align="center" prop="warehouseLocationType" />-->
<el-table-column label="供应商" align="center" prop="vendorName" />
<el-table-column label="物资编码" align="center" prop="materialCode" />
<el-table-column label="物资名称" align="center" prop="materialName" />
......@@ -272,7 +272,7 @@
<el-table-column label="参考价" align="center" prop="referencePrice" />
<el-table-column label="销售价" align="center" prop="sellingPrice" />
<el-table-column label="领料数量" align="center" prop="collectNumber" width="120px" />
<el-table-column label="销售单价" align="center" prop="price" width="120px" />
<!-- <el-table-column label="销售单价" align="center" prop="price" width="120px" />-->
<el-table-column label="领料金额" align="center" prop="money" width="120px" />
</el-table>
</el-dialog>
......@@ -445,8 +445,8 @@ export default {
// 入库数量变动
collectNumberChange() {
this.form.outMoney = this.form.pickingInfoList.reduce((sum, item) => {
item.money = item.collectNumber * item.price
return sum + (item.collectNumber * item.price);
item.money = item.collectNumber * item.sellingPrice
return sum + (item.collectNumber * item.sellingPrice);
}, 0)
},
// 多选框选中数据
......
......@@ -315,7 +315,7 @@
<el-button icon="el-icon-refresh" size="mini" @click="resetMaterialQuery">重置</el-button>
</el-form-item>
</el-form>
<el-table v-loading="materialLoading" :data="materialList" ref="selectionTable" max-height="300" @selection-change="handleMaterialSelectionChange">
<el-table v-loading="materialLoading" :data="materialList" ref="selectionTable" max-height="450" @selection-change="handleMaterialSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<!-- <el-table-column label="分类名称" align="center" prop="materialTypeName" />-->
<!-- <el-table-column label="货位类型" align="center" prop="warehouseLocationType" />-->
......@@ -327,7 +327,7 @@
<el-table-column label="质保期" align="center" prop="materialWarrantyPeriod" />
<el-table-column label="参考价" align="center" prop="referencePrice" />
<el-table-column label="销售价" align="center" prop="sellingPrice" />
<el-table-column label="库存" align="center" prop="inventory" />
<!-- <el-table-column label="库存" align="center" prop="inventory" />-->
<el-table-column label="是否启用" align="center" prop="isEnable">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_is_enable" :value="scope.row.isEnable"/>
......
......@@ -9,9 +9,9 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="入库单号" prop="putawayNumber">
<el-form-item label="入库单号" prop="putawayCode">
<el-input
v-model="queryParams.putawayNumber"
v-model="queryParams.putawayCode"
placeholder="请输入入库单号"
clearable
@keyup.enter.native="handleQuery"
......@@ -80,8 +80,8 @@
<el-table v-loading="loading" :data="materialReturnsList" @selection-change="handleSelectionChange">
<!-- <el-table-column type="selection" width="55" align="center" />-->
<el-table-column label="仓库名称" align="center" prop="warehouseName" />
<el-table-column label="退货单号" align="center" prop="returnsNumber" width="160px"/>
<el-table-column label="入库单号" align="center" prop="putawayNumber" width="160px" />
<el-table-column label="退货单号" align="center" prop="returnsCode" width="160px"/>
<el-table-column label="入库单号" align="center" prop="putawayCode" width="160px" />
<el-table-column label="到货单号" align="center" prop="arrivalNumber" />
<el-table-column label="订单单号" align="center" prop="orderNumber" />
<el-table-column label="退货金额" align="center" prop="returnsMoney" />
......@@ -135,7 +135,7 @@
<el-col :span="8">
<el-form-item label="入库单号" prop="putawayId">
<el-select clearable v-model="form.putawayId" filterable placeholder="请选择入库单" @change="putawayChange" style="width:100%">
<el-option v-for="(item,index) of materialPutawayOpt" :key="index" :label="item.putawayNumber" :value="item.id">{{item.putawayNumber}}</el-option>
<el-option v-for="(item,index) of materialPutawayOpt" :key="index" :label="item.putawayCode" :value="item.id">{{item.putawayCode}}</el-option>
</el-select>
</el-form-item>
</el-col>
......@@ -217,9 +217,9 @@
</el-form>
<span style="font-weight: bold; font-size: 18px">物料信息</span>
<el-divider />
<el-table :data="materialList" ref="selectionTable" max-height="300">
<el-table-column label="分类名称" align="center" prop="materialTypeName" />
<el-table-column label="货位类型" align="center" prop="warehouseLocationType" />
<el-table :data="materialList" ref="selectionTable" max-height="450">
<!-- <el-table-column label="分类名称" align="center" prop="materialTypeName" />-->
<!-- <el-table-column label="货位类型" align="center" prop="warehouseLocationType" />-->
<el-table-column label="供应商" align="center" prop="vendorName" />
<el-table-column label="物资编码" align="center" prop="materialCode" />
<el-table-column label="物资名称" align="center" prop="materialName" />
......@@ -261,7 +261,7 @@
<el-dialog :title="title" :visible.sync="open1" width="80%" append-to-body>
<span style="font-size: 16px; font-weight: bold; margin-bottom: 20px">退货信息</span>
<el-descriptions class="margin-top" :column="3" border>
<el-descriptions-item label="入库单号">{{form.putawayNumber}}</el-descriptions-item>
<el-descriptions-item label="入库单号">{{form.putawayCode}}</el-descriptions-item>
<el-descriptions-item label="仓库名称">{{form.warehouseName}}</el-descriptions-item>
<el-descriptions-item label="入库时间">{{form.putawayTime}}</el-descriptions-item>
<el-descriptions-item label="订单单号">{{form.orderNumber}}</el-descriptions-item>
......@@ -270,7 +270,7 @@
<dict-tag :options="dict.type.putaway_type" :value="form.putawayType"/>
</el-descriptions-item>
<el-descriptions-item label="入库金额">{{form.putawayMoney}}</el-descriptions-item>
<el-descriptions-item label="退货单号">{{form.returnsNumber}}</el-descriptions-item>
<el-descriptions-item label="退货单号">{{form.returnsCode}}</el-descriptions-item>
<el-descriptions-item label="退货金额">{{form.returnsMoney}}</el-descriptions-item>
<el-descriptions-item label="退货时间">{{form.returnsTime}}</el-descriptions-item>
<el-descriptions-item label="创建人">{{form.createBy}}</el-descriptions-item>
......@@ -278,8 +278,8 @@
</el-descriptions>
<span style="font-size: 16px; font-weight: bold; margin-bottom: 20px">退货明细</span>
<el-table :data="form.returnsInfoList">
<el-table-column label="分类名称" align="center" prop="materialTypeName" />
<el-table-column label="货位类型" align="center" prop="warehouseLocationType" />
<!-- <el-table-column label="分类名称" align="center" prop="materialTypeName" />-->
<!-- <el-table-column label="货位类型" align="center" prop="warehouseLocationType" />-->
<el-table-column label="供应商" align="center" prop="vendorName" />
<el-table-column label="物资编码" align="center" prop="materialCode" />
<el-table-column label="物资名称" align="center" prop="materialName" />
......@@ -406,7 +406,7 @@ export default {
reset() {
this.form = {
id: undefined,
returnsNumber: undefined,
returnsCode: undefined,
returnsMoney: undefined,
returnsTime: undefined,
putawayId: undefined,
......
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="供应商名称" prop="vendorName">
<el-form-item label="仓库名称" prop="warehouseName">
<el-input
v-model="queryParams.vendorName"
placeholder="请输入供应商名称"
v-model="queryParams.warehouseName"
placeholder="请输入仓库名称"
clearable
@keyup.enter.native="handleQuery"
/>
......@@ -33,36 +33,6 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="是否启用" prop="isEnable">
<el-select v-model="queryParams.isEnable" placeholder="是否启用" clearable>
<el-option
v-for="dict in dict.type.sys_is_enable"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="是否盘点" prop="isCheck">
<el-select v-model="queryParams.isCheck" placeholder="是否盘点" clearable>
<el-option
v-for="dict in dict.type.sys_is_enable"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="是否通用" prop="isUniversal">
<el-select v-model="queryParams.isUniversal" placeholder="是否通用" clearable>
<el-option
v-for="dict in dict.type.sys_is_enable"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<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>
......@@ -74,13 +44,12 @@
</el-row>
<el-table v-loading="loading" :data="materialList">
<el-table-column label="仓库" align="center" fixed="left" prop="warehouseName" />
<el-table-column label="物资编码" align="center" fixed="left" prop="materialCode" />
<el-table-column label="物资名称" align="center" fixed="left" prop="materialName" />
<el-table-column label="物资规格" align="center" fixed="left" prop="materialSpecifications" />
<el-table-column label="物资品牌" align="center" fixed="left" prop="materialBrand" />
<el-table-column label="物资单位" align="center" fixed="left" prop="materialUnit" />
<el-table-column label="所在仓库" align="center" prop="warehouseName" />
<!-- <el-table-column label="分类名称" align="center" prop="materialTypeName" />-->
<el-table-column label="供应商" align="center" prop="vendorName" show-overflow-tooltip />
<el-table-column label="采购标的" align="center" prop="procurementSubject" />
<el-table-column label="适用车型" align="center" prop="compatibleWith" />
......@@ -93,11 +62,6 @@
<el-table-column label="参考价" align="center" prop="referencePrice" />
<el-table-column label="销售价" align="center" prop="sellingPrice" />
<el-table-column label="库存" align="center" prop="inventory" />
<el-table-column label="是否启用" align="center" prop="isEnable">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_is_enable" :value="scope.row.isEnable"/>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="90px" fixed="right" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
......@@ -125,38 +89,33 @@
<el-tab-pane label="入库记录" name="1">
<el-table :data="materialPutawayInfoList">
<el-table-column label="入库单号" align="center" prop="putawayCode" />
<el-table-column label="状态" align="center" prop="state">
<template slot-scope="scope">
<dict-tag :options="dict.type.putaway_info_state" :value="scope.row.state" />
</template>
</el-table-column>
<el-table-column label="入库数量" align="center" prop="putawayNumber" />
<el-table-column label="入库单价" align="center" prop="putawayPrice" />
<el-table-column label="入库金额" align="center" prop="putawayMoney" />
<el-table-column label="入库数量" align="center" prop="number" />
<el-table-column label="入库单价" align="center" prop="price" />
<el-table-column label="入库金额" align="center" prop="money" />
<el-table-column label="创建人" align="center" prop="createBy" />
<el-table-column label="创建时间" align="center" prop="createTime" />
<el-table-column label="创建时间" align="center" prop="createTime" width="150px" />
</el-table>
</el-tab-pane>
<el-tab-pane label="退货记录" name="2">
<el-table :data="materialReturnsInfoList">
<el-table-column label="退货单号" align="center" prop="returnsNumber" />
<el-table-column label="退货单号" align="center" prop="returnsCode" />
<el-table-column label="入库单号" align="center" prop="putawayCode" />
<el-table-column label="退货数量" align="center" prop="returnsNumber" />
<el-table-column label="退货单价" align="center" prop="returnsPrice" />
<el-table-column label="退货金额" align="center" prop="returnsMoney" />
<el-table-column label="退货数量" align="center" prop="number" />
<el-table-column label="退货单价" align="center" prop="price" />
<el-table-column label="退货金额" align="center" prop="money" />
<el-table-column label="创建人" align="center" prop="createBy" />
<el-table-column label="创建时间" align="center" prop="createTime" />
<el-table-column label="创建时间" align="center" prop="createTime" width="150px" />
</el-table>
</el-tab-pane>
<el-tab-pane label="出库记录" name="3">
<el-table :data="materialPickingInfoList">
<el-table-column label="报修单号" align="center" prop="repairNumber" />
<el-table-column label="出库单号" align="center" prop="outNumber" />
<el-table-column label="出库数量" align="center" prop="collectNumber" />
<el-table-column label="出库数量" align="center" prop="number" />
<el-table-column label="出库单价" align="center" prop="price" />
<el-table-column label="出库金额" align="center" prop="money" />
<el-table-column label="创建人" align="center" prop="createBy" />
<el-table-column label="创建时间" align="center" prop="createTime" />
<el-table-column label="创建时间" align="center" prop="createTime" width="150px" />
</el-table>
</el-tab-pane>
<el-tab-pane label="退料记录" name="4">
......@@ -164,11 +123,11 @@
<el-table-column label="报修单号" align="center" prop="repairNumber" />
<el-table-column label="出库单号" align="center" prop="outNumber" />
<el-table-column label="退料单号" align="center" prop="returnNumber" />
<el-table-column label="退料数量" align="center" prop="collectNumber" />
<el-table-column label="退料数量" align="center" prop="number" />
<el-table-column label="退料单价" align="center" prop="price" />
<el-table-column label="退料金额" align="center" prop="money" />
<el-table-column label="创建人" align="center" prop="createBy" />
<el-table-column label="创建时间" align="center" prop="createTime" />
<el-table-column label="创建时间" align="center" prop="createTime" width="150px" />
</el-table>
</el-tab-pane>
</el-tabs>
......@@ -177,12 +136,9 @@
</template>
<script>
import {listMaterial} from "@/api/business/material";
import {listByMaterialId, listMaterialInventory} from "@/api/business/material";
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import {listMaterialPutawayInfoAll} from "@/api/business/materialPutawayInfo";
import {listMaterialReturnsInfoAll} from "@/api/business/materialReturnsInfo";
import {listMaterialPickingInfoAll} from "@/api/business/materialPickingInfo";
export default {
name: "Material",
......@@ -224,23 +180,11 @@ export default {
queryParams: {
pageNum: 1,
pageSize: 10,
materialTypeId: undefined,
materialTypeName: undefined,
warehouseLocationId: undefined,
warehouseLocationType: undefined,
vendorId: undefined,
vendorName: undefined,
materialCode: undefined,
materialName: undefined,
materialSpecifications: undefined,
materialUnit: undefined,
materialWarrantyPeriod: undefined,
referencePrice: undefined,
sellingPrice: undefined,
inventory: undefined,
isEnable: undefined,
isUniversal: undefined,
isCheck: undefined,
warehouseName: undefined
},
// 表单参数
form: {},
......@@ -253,7 +197,7 @@ export default {
/** 查询物资列表 */
getList() {
this.loading = true;
listMaterial(this.queryParams).then(response => {
listMaterialInventory(this.queryParams).then(response => {
this.materialList = response.rows;
this.total = response.total;
this.loading = false;
......@@ -313,32 +257,33 @@ export default {
handleUpdate(row) {
this.open = true;
this.title = `物资【${row.materialName}】库存记录`;
this.getPutawayInfoList(row.id)
this.getReturnsInfoList(row.id)
this.getPickingInfoList(row.id)
this.getBackInfoList(row.id)
let {warehouseId, materialId, type} = row
this.getPutawayInfoList(warehouseId, materialId)
this.getReturnsInfoList(warehouseId, materialId)
this.getPickingInfoList(warehouseId, materialId)
this.getBackInfoList(warehouseId, materialId)
},
/** 查询物料入库明细列表 */
getPutawayInfoList(materialId) {
listMaterialPutawayInfoAll({materialId}).then(response => {
getPutawayInfoList(warehouseId, materialId) {
listByMaterialId({warehouseId, materialId, type: 1}).then(response => {
this.materialPutawayInfoList = response.data;
});
},
/** 查询物料退货明细列表 */
getReturnsInfoList(materialId) {
listMaterialReturnsInfoAll({materialId}).then(response => {
getReturnsInfoList(warehouseId, materialId) {
listByMaterialId({warehouseId, materialId, type: 2}).then(response => {
this.materialReturnsInfoList = response.data;
});
},
/** 查询物料出库列表 */
getPickingInfoList(materialId) {
listMaterialPickingInfoAll({materialId, stateList:[1, 2]}).then(response => {
getPickingInfoList(warehouseId, materialId) {
listByMaterialId({warehouseId, materialId, type: 3}).then(response => {
this.materialPickingInfoList = response.data;
});
},
/** 查询物料退料列表 */
getBackInfoList(materialId) {
listMaterialPickingInfoAll({materialId, stateList:[3]}).then(response => {
getBackInfoList(warehouseId, materialId) {
listByMaterialId({warehouseId, materialId, type: 4}).then(response => {
this.materialBackInfoList = response.data;
});
},
......
......@@ -190,15 +190,18 @@
<span style="font-weight: bold; font-size: 18px">退料明细</span>
<el-divider />
<el-table :data="form.pickingInfoList">
<!-- <el-table-column label="分类名称" align="center" prop="materialTypeName" />-->
<!-- <el-table-column label="货位类型" align="center" prop="warehouseLocationType" />-->
<el-table-column label="供应商" align="center" prop="vendorName" />
<el-table-column label="仓库名称" align="center" prop="warehouseName" />
<el-table-column label="物资编码" align="center" prop="materialCode" />
<el-table-column label="物资名称" align="center" prop="materialName" />
<el-table-column label="物资规格" align="center" prop="materialSpecifications" />
<el-table-column label="物资单位" align="center" prop="materialUnit" />
<el-table-column label="供应商" align="center" prop="vendorName" />
<el-table-column label="质保期" align="center" prop="materialWarrantyPeriod" />
<el-table-column label="退料数量" align="center" prop="collectNumber" />
<el-table-column label="参考价" align="center" prop="referencePrice" />
<el-table-column label="销售价" align="center" prop="sellingPrice" />
<el-table-column label="数量" align="center" prop="collectNumber" width="120px" />
<!-- <el-table-column label="销售单价" align="center" prop="price" width="120px" />-->
<el-table-column label="领料金额" align="center" prop="money" width="120px" />
</el-table>
<div slot="footer" class="dialog-footer">
<el-button :loading="buttonLoading" type="primary" @click="submitForm">提 交</el-button>
......@@ -227,13 +230,18 @@
<el-table :data="form.pickingInfoList">
<!-- <el-table-column label="分类名称" align="center" prop="materialTypeName" />-->
<!-- <el-table-column label="货位类型" align="center" prop="warehouseLocationType" />-->
<el-table-column label="供应商" align="center" prop="vendorName" />
<el-table-column label="仓库名称" align="center" prop="warehouseName" />
<el-table-column label="物资编码" align="center" prop="materialCode" />
<el-table-column label="物资名称" align="center" prop="materialName" />
<el-table-column label="物资规格" align="center" prop="materialSpecifications" />
<el-table-column label="物资单位" align="center" prop="materialUnit" />
<el-table-column label="供应商" align="center" prop="vendorName" />
<el-table-column label="质保期" align="center" prop="materialWarrantyPeriod" />
<el-table-column label="退料数量" align="center" prop="collectNumber" />
<el-table-column label="参考价" align="center" prop="referencePrice" />
<el-table-column label="销售价" align="center" prop="sellingPrice" />
<el-table-column label="数量" align="center" prop="collectNumber" width="120px" />
<!-- <el-table-column label="销售单价" align="center" prop="price" width="120px" />-->
<el-table-column label="领料金额" align="center" prop="money" width="120px" />
</el-table>
</el-dialog>
</div>
......@@ -322,7 +330,7 @@ export default {
},
/** 查询报修单列表 */
getRepairList() {
listRepairForm({pageNum: 1, pageSize: 100, state: 1}).then(response => {
listRepairForm({pageNum: 1, pageSize: 1000, state: 1}).then(response => {
this.repairFormOpt = response.rows;
});
},
......
......@@ -468,24 +468,24 @@
</template>
<script>
import { addRepairForm, getRepairForm, updateRepairForm } from '@/api/business/repairForm'
import {addRepairForm, getRepairForm, updateRepairForm} from '@/api/business/repairForm'
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import examineProject from '../examineProject/index'
import malfunctionProject from '../malfunctionProject/index'
import { listCar } from '@/api/business/car'
import { listClient } from '@/api/business/client'
import { listMaintainCause } from '@/api/business/maintainCause'
import { getSiteTree } from '@/api/business/unit'
import { listSiteGroup } from '@/api/business/siteGroup'
import { getVehicleModel } from '@/api/business/vehicleModel'
import {listCar} from '@/api/business/car'
import {listClient} from '@/api/business/client'
import {listMaintainCause} from '@/api/business/maintainCause'
import {getSiteTree} from '@/api/business/unit'
import {listSiteGroup} from '@/api/business/siteGroup'
import {getVehicleModel} from '@/api/business/vehicleModel'
import repairFormProject from '@/views/business/repairFormProject/index.vue'
import MaterialPickingInfo from '@/views/business/materialPickingInfo/index.vue'
import { addRepairFormDelivery, updateRepairFormDelivery } from '@/api/business/repairFormDelivery'
import { listUser } from '@/api/business/user'
import {addRepairFormDelivery, updateRepairFormDelivery} from '@/api/business/repairFormDelivery'
import {listUser} from '@/api/business/user'
import RepairFormClaim from '@/views/business/repairFormClaim/index.vue'
import { authCarNumber, authPhone } from '@/utils/ruoyi'
import { formatDate } from '@/utils'
import {authCarNumber} from '@/utils/ruoyi'
import {formatDate} from '@/utils'
export default {
name: "Detail",
......@@ -680,12 +680,12 @@ export default {
},
created() {
this.repairFormId = this.$route.params && this.$route.params.repairFormId
this.flag = this.$route.params && this.$route.params.flag;
this.isDelivery = this.$route.params && this.$route.params.isDelivery;
this.getCarList();
this.getClientList();
this.getReason();
this.getTreeData();
this.flag = this.$route.params && this.$route.params.flag;
if (this.flag && this.flag != 0) {
this.getDetail();
this.getMaintainUserList()
......@@ -717,7 +717,7 @@ export default {
response.data.isFindMaintain=''+response.data.isFindMaintain;
response.data.isByoPart=''+response.data.isByoPart;
response.data.repairerGroupId=''+response.data.repairerGroupId;
this.carList.push(response.data.car);
this.form = response.data;
this.deliveryForm = response.data.deliveryVo
......
......@@ -6,20 +6,18 @@
<el-divider />
<el-row>
<el-col :span="6">
<el-form-item label="客户" prop="clientId">
<el-select v-model="form.clientId" disabled filterable @change="clientChange" placeholder="请选择客户">
<el-option v-for="item in clientOpt" :key="item.id" :value="item.id" :label="item.name" />
</el-select>
<el-form-item label="客户" prop="clientName">
<el-input v-model="form.clientName" disabled placeholder="请选择客户" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="客户手机号" prop="clientPhone">
<el-input v-model="form.clientPhone" disabled placeholder="请输入客户手机号" />
<el-input v-model="form.clientPhone" disabled placeholder="客户手机号" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="证件类型" prop="clientCertificateType">
<el-select v-model="form.clientCertificateType" disabled placeholder="请选择证件类型">
<el-select v-model="form.clientCertificateType" disabled placeholder="证件类型">
<el-option v-for="item in dict.type.zhengjianleixing" :key="item.value" :value="parseInt(item.value)" :label="item.label" />
</el-select>
</el-form-item>
......@@ -33,18 +31,17 @@
<span style="font-weight: bold; font-size: 18px">报修信息</span>
<el-divider />
<el-table v-loading="loading" :data="form.settlementRepairFormList">
<!-- <el-table-column type="selection" width="55" align="center" />-->
<el-table-column label="序号" align="center" type="index" />
<el-table-column label="报修单号" align="center" prop="repairNumber" />
<el-table-column label="客户类型" align="center" prop="repairNumber">
<el-table-column label="序号" align="center" type="index" fixed="left" />
<el-table-column label="报修单号" align="center" prop="repairNumber" width="140px" fixed="left" />
<el-table-column label="客户类型" align="center" prop="repairNumber" fixed="left">
<template slot-scope="scope">
<dict-tag :options="dict.type.client_type" :value="scope.row.client.type"/>
</template>
</el-table-column>
<el-table-column label="客户名称" align="center" prop="client.name" />
<el-table-column label="客户名称" align="center" prop="client.name" width="120px" fixed="left" show-overflow-tooltip/>
<el-table-column label="联系方式" align="center" prop="client.phone" min-width="130px" show-overflow-tooltip />
<el-table-column label="车辆品牌" align="center" prop="car.carBrand" />
<el-table-column label="车牌号" align="center" prop="car.plateNumber" />
<el-table-column label="车牌号" align="center" prop="car.plateNumber" width="110"/>
<el-table-column label="总工时" align="center" prop="totalActualTime" />
<el-table-column label="工时费用(元)" align="center" prop="totalActualTimeMoney" min-width="120px" />
<el-table-column label="材料费用(元)" align="center" prop="totalMaterialMoney" min-width="120px" />
......@@ -124,7 +121,7 @@
<el-row>
<el-col :span="6">
<el-form-item label="支付方式" prop="paymentMethod">
<el-select v-model="form.paymentMethod" placeholder="请选择支付方式">
<el-select v-model="form.paymentMethod" placeholder="请选择支付方式" style="width: 100%">
<el-option v-for="item in dict.type.settlement_payment_method" :key="item.value" :value="parseInt(item.value)" :label="item.label" />
</el-select>
</el-form-item>
......@@ -251,19 +248,19 @@ export default {
{ required: true, message: "客户不能为空", trigger: "blur" }
],
clientName: [
{ required: true, message: "客户名称不能为空", trigger: "blur" }
{ required: false, message: "客户名称不能为空", trigger: "blur" }
],
clientPhone: [
{ required: true, message: "客户手机号不能为空", trigger: "blur" }
{ required: false, message: "客户手机号不能为空", trigger: "blur" }
],
clientType: [
{ required: true, message: "客户类型不能为空", trigger: "change" }
{ required: false, message: "客户类型不能为空", trigger: "change" }
],
clientCertificateType: [
{ required: true, message: "证件类型不能为空", trigger: "change" }
{ required: false, message: "证件类型不能为空", trigger: "change" }
],
clientCertificateNumber: [
{ required: true, message: "证件号不能为空", trigger: "blur" }
{ required: false, message: "证件号不能为空", trigger: "blur" }
],
manHourDiscountMoney: [
{ required: true, message: "工时费优惠不能为空", trigger: "blur" }
......@@ -300,6 +297,7 @@ export default {
getClientList() {
listClient().then(res =>{
this.clientOpt = res.rows
if (this.clientOpt.length > 0) {
let client = this.clientOpt.find(item => item.id === this.form.clientId)
// this.form.clientId = client.id
this.form.clientType = client.type
......@@ -307,6 +305,7 @@ export default {
this.form.clientPhone = client.phone
this.form.clientCertificateType = client.certificateType
this.form.clientCertificateNumber = client.certificateNumber
}
})
},
// 取消按钮
......@@ -339,16 +338,6 @@ export default {
};
this.resetForm("form");
},
// 客户改变
clientChange(id) {
let client = this.clientOpt.find(item => item.id === id)
this.form.clientId = client.id
this.form.clientType = client.type
this.form.clientName = client.name
this.form.clientPhone = client.phone
this.form.clientCertificateType = client.certificateType
this.form.clientCertificateNumber = client.certificateNumber
},
// 工时费或原料费优惠金额更改
moneyChange() {
this.form.practicalMoney = this.form.receivableMoney - this.form.manHourDiscountMoney - this.form.materialDiscountMoney
......@@ -391,7 +380,6 @@ export default {
this.buttonLoading = false;
this.$tab.closeOpenPage({path: '/settlement/settlementMaintain?clientType=1'})
});
}
});
},
......
......@@ -87,17 +87,17 @@
<el-table v-loading="loading" :data="repairFormList" ref="table" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" fixed="left"/>
<el-table-column label="序号" align="center" type="index" />
<el-table-column label="报修单号" align="center" prop="repairNumber" />
<el-table-column label="客户类型" align="center" prop="client.type">
<el-table-column label="序号" align="center" type="index" fixed="left" />
<el-table-column label="报修单号" align="center" prop="repairNumber" fixed="left" />
<el-table-column label="客户类型" align="center" prop="client.type" fixed="left">
<template slot-scope="scope">
<dict-tag :options="dict.type.client_type" :value="scope.row.client.type"/>
</template>
</el-table-column>
<el-table-column label="客户名称" align="center" prop="client.name" />
<el-table-column label="客户名称" align="center" prop="client.name" width="120" fixed="left" show-overflow-tooltip/>
<el-table-column label="联系方式" align="center" prop="client.phone" min-width="130px" show-overflow-tooltip />
<el-table-column label="车辆品牌" align="center" prop="car.carBrand" />
<el-table-column label="车牌号" align="center" prop="car.plateNumber" />
<el-table-column label="车牌号" align="center" prop="car.plateNumber" width="100" />
<el-table-column label="总工时" align="center" prop="totalActualTime" />
<el-table-column label="工时费用(元)" align="center" prop="totalActualTimeMoney" min-width="120px" />
<el-table-column label="材料费用(元)" align="center" prop="totalMaterialMoney" min-width="120px" />
......@@ -107,17 +107,17 @@
<el-table-column label="结算时间" align="center" prop="settlementTime" min-width="150px" />
<el-table-column label="登记时间" align="center" prop="createTime" min-width="150px" />
<el-table-column label="登记人员" align="center" prop="createBy" min-width="100px" />
<el-table-column label="是否交车" align="center" prop="isDelivery" fixed="right">
<el-table-column label="是否交车" align="center" prop="isDelivery" width="50" fixed="right">
<template slot-scope="scope">
<dict-tag :options="dict.type.repair_form_is_delivery" :value="scope.row.isDelivery" />
</template>
</el-table-column>
<el-table-column label="状态" align="center" prop="state" fixed="right">
<el-table-column label="状态" align="center" prop="state" width="60" fixed="right">
<template slot-scope="scope">
<dict-tag :options="dict.type.repair_form_state" :value="scope.row.state" />
</template>
</el-table-column>
<el-table-column label="结算状态" align="center" prop="settlementState" fixed="right">
<el-table-column label="结算状态" align="center" prop="settlementState" width="60" fixed="right">
<template slot-scope="scope">
<dict-tag :options="dict.type.repair_form_settlement_state" :value="scope.row.settlementState" />
</template>
......@@ -263,7 +263,6 @@
<el-input-number v-model="form.practicalMoney" disabled :min="0" style="width: 100%" placeholder="请输入结算金额" />
</el-form-item>
</el-col>
</el-row>
<el-row >
<el-col :span="6">
......@@ -309,7 +308,6 @@
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-scrollbar>
<div slot="footer" class="dialog-footer">
......@@ -534,7 +532,9 @@ export default {
return;
}
const firstCustomerId = selectedRows[0].clientId;
const clientName = selectedRows[0].client.name;
this.form.clientId = firstCustomerId
this.form.clientName = clientName
const allSame = selectedRows.every(row => row.clientId === firstCustomerId);
if (!allSame) {
this.$modal.msgError('请勾选相同客户报修单')
......
......@@ -183,8 +183,8 @@
<el-table-column type="expand">
<template slot-scope="props">
<el-table :data="props.row.pickingInfoList">
<el-table-column label="分类名称" align="center" prop="materialTypeName" />
<el-table-column label="货位类型" align="center" prop="warehouseLocationType" />
<!-- <el-table-column label="分类名称" align="center" prop="materialTypeName" />-->
<!-- <el-table-column label="货位类型" align="center" prop="warehouseLocationType" />-->
<el-table-column label="供应商" align="center" prop="vendorName" />
<el-table-column label="物资编码" align="center" prop="materialCode" />
<el-table-column label="物资名称" align="center" prop="materialName" />
......@@ -255,8 +255,8 @@
<span style="font-weight: bold; font-size: 18px">出库明细</span>
<el-divider />
<el-table :data="form.pickingInfoList">
<el-table-column label="分类名称" align="center" prop="materialTypeName" />
<el-table-column label="货位类型" align="center" prop="warehouseLocationType" />
<!-- <el-table-column label="分类名称" align="center" prop="materialTypeName" />-->
<!-- <el-table-column label="货位类型" align="center" prop="warehouseLocationType" />-->
<el-table-column label="供应商" align="center" prop="vendorName" />
<el-table-column label="物资编码" align="center" prop="materialCode" />
<el-table-column label="物资名称" align="center" prop="materialName" />
......@@ -266,7 +266,7 @@
<el-table-column label="参考价" align="center" prop="referencePrice" />
<el-table-column label="销售价" align="center" prop="sellingPrice" />
<el-table-column label="领料数量" align="center" prop="collectNumber" width="120px" />
<el-table-column label="销售单价" align="center" prop="price" width="120px" />
<el-table-column label="入库单价" align="center" prop="price" width="120px" />
<el-table-column label="领料金额" align="center" prop="money" width="120px" />
</el-table>
</el-dialog>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment