Commit 0105a573 authored by 刘帅's avatar 刘帅

1.优化

parent 27943d29
...@@ -37,13 +37,21 @@ public class ErpMaterialInventoryRecordController extends BaseController { ...@@ -37,13 +37,21 @@ public class ErpMaterialInventoryRecordController extends BaseController {
private final IErpMaterialInventoryRecordService iErpMaterialInventoryRecordService; private final IErpMaterialInventoryRecordService iErpMaterialInventoryRecordService;
/** /**
* 查询物料库存记录列表 * 查询物料库存汇总记录列表
*/ */
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo<ErpMaterialInventoryRecordVo> list(ErpMaterialInventoryRecordBo bo, PageQuery pageQuery) { public TableDataInfo<ErpMaterialInventoryRecordVo> list(ErpMaterialInventoryRecordBo bo, PageQuery pageQuery) {
return iErpMaterialInventoryRecordService.customQueryPageList(bo, pageQuery); return iErpMaterialInventoryRecordService.customQueryPageList(bo, pageQuery);
} }
/**
* 查询物料库存明细记录列表
*/
@GetMapping("/inventoryList")
public TableDataInfo<ErpMaterialInventoryRecordVo> inventoryList(ErpMaterialInventoryRecordBo bo, PageQuery pageQuery) {
return iErpMaterialInventoryRecordService.customQueryPageInventoryList(bo, pageQuery);
}
/** /**
* 查询物料库存记录列表 * 查询物料库存记录列表
*/ */
......
...@@ -46,6 +46,10 @@ public class ErpMaterialInventoryRecord extends BaseEntity { ...@@ -46,6 +46,10 @@ public class ErpMaterialInventoryRecord extends BaseEntity {
* 仓库ID * 仓库ID
*/ */
private Long warehouseId; private Long warehouseId;
/**
* 供应商ID
*/
private Long vendorId;
/** /**
* 数量 * 数量
*/ */
......
...@@ -37,22 +37,6 @@ public class ErpMaterialPickingInfo extends BaseEntity { ...@@ -37,22 +37,6 @@ public class ErpMaterialPickingInfo extends BaseEntity {
* 出库单ID * 出库单ID
*/ */
private Long pickingId; private Long pickingId;
/**
* 物资分类ID
*/
private Long materialTypeId;
/**
* 物资分类名称
*/
private String materialTypeName;
/**
* 仓库货位类型
*/
private String warehouseLocationType;
/**
* 仓库货位ID
*/
private Long warehouseLocationId;
/** /**
* 仓库ID * 仓库ID
*/ */
...@@ -113,6 +97,18 @@ public class ErpMaterialPickingInfo extends BaseEntity { ...@@ -113,6 +97,18 @@ public class ErpMaterialPickingInfo extends BaseEntity {
* 出库金额 * 出库金额
*/ */
private BigDecimal money; private BigDecimal money;
/**
* 记录ID
*/
private Long recordId;
/**
* 入库单价(铺货结算)
*/
private BigDecimal putawayPrice;
/**
* 入库金额(铺货结算)
*/
private BigDecimal putawayMoney;
/** /**
* 状态(1已领料 2已退料) * 状态(1已领料 2已退料)
*/ */
......
...@@ -112,6 +112,10 @@ public class ErpMaterialPutawayInfo extends BaseEntity { ...@@ -112,6 +112,10 @@ public class ErpMaterialPutawayInfo extends BaseEntity {
* 已退数量 * 已退数量
*/ */
private BigDecimal returnedNumber; private BigDecimal returnedNumber;
/**
* 已出数量
*/
private BigDecimal issuedNumber;
/** /**
* 状态(1登记中 2已入库) * 状态(1登记中 2已入库)
*/ */
......
...@@ -11,6 +11,8 @@ import javax.validation.constraints.*; ...@@ -11,6 +11,8 @@ import javax.validation.constraints.*;
import java.util.Date; import java.util.Date;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List;
import com.maintain.common.core.domain.BaseEntity; import com.maintain.common.core.domain.BaseEntity;
/** /**
...@@ -78,10 +80,21 @@ public class ErpMaterialInventoryRecordBo extends BaseEntity { ...@@ -78,10 +80,21 @@ public class ErpMaterialInventoryRecordBo extends BaseEntity {
private Long warehouseId; private Long warehouseId;
/** /**
* 仓库ID * 仓库ID列表
*/
private List<Long> warehouseIdList;
/**
* 仓库名称
*/ */
private String warehouseName; private String warehouseName;
/**
* 供应商ID
*/
@NotNull(message = "供应商ID不能为空", groups = { AddGroup.class, EditGroup.class })
private Long vendorId;
/** /**
* 数量 * 数量
*/ */
......
...@@ -118,7 +118,7 @@ public class ErpMaterialPickingBo extends BaseEntity { ...@@ -118,7 +118,7 @@ public class ErpMaterialPickingBo extends BaseEntity {
private Date outTime; private Date outTime;
@NotEmpty(message = "出库明细不能为空", groups = { AddGroup.class, EditGroup.class }) @NotEmpty(message = "出库明细不能为空", groups = { AddGroup.class, EditGroup.class })
private List<ErpMaterialPickingInfoBo> materialList; private List<ErpMaterialPickingInfoAddBo> materialList;
} }
package com.maintain.business.domain.bo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.maintain.common.core.domain.BaseEntity;
import com.maintain.common.core.validate.AddGroup;
import com.maintain.common.core.validate.EditGroup;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.List;
/**
* 物料出库明细业务对象 erp_material_picking_info
*
* @author liushuai
* @date 2025-04-03
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class ErpMaterialPickingInfoAddBo extends BaseEntity {
/**
* 记录ID
*/
@NotNull(message = "记录ID不能为空", groups = { EditGroup.class })
private Long recordId;
/**
* 明细ID
*/
@NotNull(message = "明细ID不能为空", groups = { EditGroup.class })
private Long infoId;
/**
* 仓库ID
*/
@NotNull(message = "仓库ID不能为空", groups = { AddGroup.class, EditGroup.class })
private Long warehouseId;
/**
* 仓库名称
*/
private String warehouseName;
/**
* 供应商ID
*/
@NotNull(message = "供应商ID不能为空", groups = { AddGroup.class, EditGroup.class })
private Long vendorId;
/**
* 供应商名称
*/
private String vendorName;
/**
* 物料ID
*/
@NotNull(message = "物料ID不能为空", groups = { AddGroup.class, EditGroup.class })
private Long materialId;
/**
* 物资编码
*/
private String materialCode;
/**
* 物资名称
*/
private String materialName;
/**
* 物资规格
*/
private String materialSpecifications;
/**
* 物资单位
*/
private String materialUnit;
/**
* 质保期(月)
*/
private Integer materialWarrantyPeriod;
/**
* 参考价
*/
private BigDecimal referencePrice;
/**
* 销售价
*/
private BigDecimal sellingPrice;
/**
* 出库数量
*/
@NotNull(message = "出库数量不能为空", groups = { AddGroup.class, EditGroup.class })
private BigDecimal collectNumber;
/**
* 单价
*/
@NotNull(message = "单价不能为空", groups = { AddGroup.class, EditGroup.class })
private BigDecimal price;
/**
* 金额
*/
@NotNull(message = "金额不能为空", groups = { AddGroup.class, EditGroup.class })
private BigDecimal money;
}
...@@ -42,28 +42,6 @@ public class ErpMaterialPickingInfoBo extends BaseEntity { ...@@ -42,28 +42,6 @@ public class ErpMaterialPickingInfoBo extends BaseEntity {
@NotNull(message = "出库单ID不能为空", groups = { AddGroup.class, EditGroup.class }) @NotNull(message = "出库单ID不能为空", groups = { AddGroup.class, EditGroup.class })
private Long pickingId; private Long pickingId;
/**
* 物资分类ID
*/
@NotNull(message = "物资分类ID不能为空", groups = { AddGroup.class, EditGroup.class })
private Long materialTypeId;
/**
* 物资分类名称
*/
private String materialTypeName;
/**
* 仓库货位类型
*/
private String warehouseLocationType;
/**
* 仓库货位ID
*/
@NotNull(message = "仓库货位ID不能为空", groups = { AddGroup.class, EditGroup.class })
private Long warehouseLocationId;
/** /**
* 仓库ID * 仓库ID
*/ */
......
...@@ -27,6 +27,11 @@ public class ErpMaterialInventoryRecordVo implements Serializable { ...@@ -27,6 +27,11 @@ public class ErpMaterialInventoryRecordVo implements Serializable {
*/ */
private Long id; private Long id;
/**
* 主键
*/
private Long recordId;
/** /**
* 明细ID(入库|退货|出库|退料) * 明细ID(入库|退货|出库|退料)
*/ */
...@@ -62,7 +67,6 @@ public class ErpMaterialInventoryRecordVo implements Serializable { ...@@ -62,7 +67,6 @@ public class ErpMaterialInventoryRecordVo implements Serializable {
/** /**
* 物料ID * 物料ID
*/ */
@ExcelProperty(value = "物料ID")
private Long materialId; private Long materialId;
/** /**
......
...@@ -67,7 +67,6 @@ public class ErpMaterialPickingInfoVo implements Serializable { ...@@ -67,7 +67,6 @@ public class ErpMaterialPickingInfoVo implements Serializable {
/** /**
* 供应商ID * 供应商ID
*/ */
@ExcelProperty(value = "供应商ID")
private Long vendorId; private Long vendorId;
/** /**
...@@ -141,6 +140,21 @@ public class ErpMaterialPickingInfoVo implements Serializable { ...@@ -141,6 +140,21 @@ public class ErpMaterialPickingInfoVo implements Serializable {
@ExcelProperty(value = "出库金额") @ExcelProperty(value = "出库金额")
private BigDecimal money; private BigDecimal money;
/**
* 记录ID
*/
private Long recordId;
/**
* 入库单价(铺货结算)
*/
private BigDecimal putawayPrice;
/**
* 入库金额(铺货结算)
*/
private BigDecimal putawayMoney;
/** /**
* 状态(1已领料 2已退料) * 状态(1已领料 2已退料)
*/ */
...@@ -160,6 +174,11 @@ public class ErpMaterialPickingInfoVo implements Serializable { ...@@ -160,6 +174,11 @@ public class ErpMaterialPickingInfoVo implements Serializable {
@ExcelProperty(value = "创建时间") @ExcelProperty(value = "创建时间")
private Date createTime; private Date createTime;
/**
* 库存
*/
private BigDecimal inventory;
/** /**
* 可选价格列表 * 可选价格列表
*/ */
......
...@@ -169,6 +169,12 @@ public class ErpMaterialPutawayInfoVo implements Serializable { ...@@ -169,6 +169,12 @@ public class ErpMaterialPutawayInfoVo implements Serializable {
@ExcelProperty(value = "已退数量") @ExcelProperty(value = "已退数量")
private BigDecimal returnedNumber; private BigDecimal returnedNumber;
/**
* 已出数量
*/
@ExcelProperty(value = "已出数量")
private BigDecimal issuedNumber;
/** /**
* 状态(1登记中 2已入库) * 状态(1登记中 2已入库)
*/ */
......
...@@ -37,6 +37,21 @@ public interface ErpMaterialInventoryRecordMapper extends BaseMapperPlus<ErpMate ...@@ -37,6 +37,21 @@ public interface ErpMaterialInventoryRecordMapper extends BaseMapperPlus<ErpMate
*/ */
List<ErpMaterialInventoryRecordVo> customQueryList(@Param(Constants.WRAPPER) Wrapper<ErpMaterialInventoryRecord> queryWrapper); List<ErpMaterialInventoryRecordVo> customQueryList(@Param(Constants.WRAPPER) Wrapper<ErpMaterialInventoryRecord> queryWrapper);
/**
* 自定义分页查询(每一条入库记录运算)
* @param page
* @param queryWrapper
* @return
*/
Page<ErpMaterialInventoryRecordVo> customQueryPageInventoryList(@Param("page") Page<ErpMaterialInventoryRecord> page, @Param(Constants.WRAPPER) Wrapper<ErpMaterialInventoryRecord> queryWrapper);
/**
*
* @param id
* @return
*/
ErpMaterialInventoryRecordVo customQueryInventoryById(@Param("id") Long id);
/** /**
* 查询物料库存列表 * 查询物料库存列表
......
...@@ -28,10 +28,15 @@ public interface IErpMaterialInventoryRecordService { ...@@ -28,10 +28,15 @@ public interface IErpMaterialInventoryRecordService {
TableDataInfo<ErpMaterialInventoryRecordVo> queryPageList(ErpMaterialInventoryRecordBo bo, PageQuery pageQuery); TableDataInfo<ErpMaterialInventoryRecordVo> queryPageList(ErpMaterialInventoryRecordBo bo, PageQuery pageQuery);
/** /**
* 查询物料库存记录列表(自定义查询) * 查询物料汇总记录列表(自定义查询)
*/ */
TableDataInfo<ErpMaterialInventoryRecordVo> customQueryPageList(ErpMaterialInventoryRecordBo bo, PageQuery pageQuery); TableDataInfo<ErpMaterialInventoryRecordVo> customQueryPageList(ErpMaterialInventoryRecordBo bo, PageQuery pageQuery);
/**
* 查询物料库存记录列表(自定义查询)
*/
TableDataInfo<ErpMaterialInventoryRecordVo> customQueryPageInventoryList(ErpMaterialInventoryRecordBo bo, PageQuery pageQuery);
/** /**
* 查询物料库存记录列表 * 查询物料库存记录列表
*/ */
......
...@@ -51,7 +51,7 @@ public class ErpMaterialInventoryRecordServiceImpl implements IErpMaterialInvent ...@@ -51,7 +51,7 @@ public class ErpMaterialInventoryRecordServiceImpl implements IErpMaterialInvent
} }
/** /**
* 查询物料库存记录列表(自定义查询) * 查询物料汇总记录列表(自定义查询)
* *
* @param bo * @param bo
* @param pageQuery * @param pageQuery
...@@ -74,6 +74,27 @@ public class ErpMaterialInventoryRecordServiceImpl implements IErpMaterialInvent ...@@ -74,6 +74,27 @@ public class ErpMaterialInventoryRecordServiceImpl implements IErpMaterialInvent
return query; return query;
} }
/**
* 查询物料明细记录列表(自定义查询)
*
* @param bo
* @param pageQuery
*/
@Override
public TableDataInfo<ErpMaterialInventoryRecordVo> customQueryPageInventoryList(ErpMaterialInventoryRecordBo bo, PageQuery pageQuery) {
QueryWrapper<ErpMaterialInventoryRecord> query = Wrappers.query();
query
.eq("t.type", 1)
.like(StringUtils.isNotBlank(bo.getMaterialName()),"t.material_name", bo.getMaterialName())
.like(StringUtils.isNotBlank(bo.getMaterialCode()),"t.material_code", bo.getMaterialCode())
.like(null != bo.getVendorId(),"t.vendor_id", bo.getVendorId())
.like(null != bo.getWarehouseId(), "t.warehouse_id", bo.getWarehouseId())
.in(!bo.getWarehouseIdList().isEmpty(), "t.warehouse_id", bo.getWarehouseIdList())
.orderByDesc("t.create_time");
Page<ErpMaterialInventoryRecordVo> queryPageList = baseMapper.customQueryPageInventoryList(pageQuery.build(), query);
return TableDataInfo.build(queryPageList);
}
/** /**
* 查询物料库存记录列表 * 查询物料库存记录列表
*/ */
......
...@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil; ...@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.maintain.business.domain.*; import com.maintain.business.domain.*;
import com.maintain.business.domain.bo.ErpMaterialPickingInfoAddBo;
import com.maintain.business.domain.bo.ErpMaterialPickingInfoBo; import com.maintain.business.domain.bo.ErpMaterialPickingInfoBo;
import com.maintain.business.domain.vo.*; import com.maintain.business.domain.vo.*;
import com.maintain.business.mapper.*; import com.maintain.business.mapper.*;
...@@ -64,6 +65,10 @@ public class ErpMaterialPickingServiceImpl implements IErpMaterialPickingService ...@@ -64,6 +65,10 @@ public class ErpMaterialPickingServiceImpl implements IErpMaterialPickingService
lqw.eq(ErpMaterialPickingInfo::getPickingId, id); lqw.eq(ErpMaterialPickingInfo::getPickingId, id);
List<ErpMaterialPickingInfoVo> infoVoList = pickingInfoMapper.selectVoList(lqw); List<ErpMaterialPickingInfoVo> infoVoList = pickingInfoMapper.selectVoList(lqw);
if (!infoVoList.isEmpty()) { if (!infoVoList.isEmpty()) {
for (ErpMaterialPickingInfoVo infoVo : infoVoList) {
ErpMaterialInventoryRecordVo recordVo = materialInventoryRecordMapper.customQueryInventoryById(infoVo.getRecordId());
infoVo.setInventory(recordVo.getInventory());
}
materialVo.setPickingInfoList(infoVoList); materialVo.setPickingInfoList(infoVoList);
} }
return materialVo; return materialVo;
...@@ -154,7 +159,7 @@ public class ErpMaterialPickingServiceImpl implements IErpMaterialPickingService ...@@ -154,7 +159,7 @@ public class ErpMaterialPickingServiceImpl implements IErpMaterialPickingService
add.setReceiveUserId(LoginHelper.getUserId()); add.setReceiveUserId(LoginHelper.getUserId());
add.setReceiveUserName(LoginHelper.getUsername()); add.setReceiveUserName(LoginHelper.getUsername());
add.setReceiveTime(new Date()); add.setReceiveTime(new Date());
BigDecimal moneyTotal = bo.getMaterialList().stream().map(ErpMaterialPickingInfoBo::getMoney).reduce(BigDecimal.ZERO, BigDecimal::add); BigDecimal moneyTotal = bo.getMaterialList().stream().map(ErpMaterialPickingInfoAddBo::getMoney).reduce(BigDecimal.ZERO, BigDecimal::add);
add.setOutMoney(moneyTotal); add.setOutMoney(moneyTotal);
add.setCreateDeptId(LoginHelper.getUserId()); add.setCreateDeptId(LoginHelper.getUserId());
validEntityBeforeSave(add); validEntityBeforeSave(add);
...@@ -162,16 +167,14 @@ public class ErpMaterialPickingServiceImpl implements IErpMaterialPickingService ...@@ -162,16 +167,14 @@ public class ErpMaterialPickingServiceImpl implements IErpMaterialPickingService
if (flag) { if (flag) {
List<ErpMaterialPickingInfo> collect = bo.getMaterialList().stream().map(item -> { List<ErpMaterialPickingInfo> collect = bo.getMaterialList().stream().map(item -> {
ErpMaterialPickingInfo info = BeanUtil.toBean(item, ErpMaterialPickingInfo.class); ErpMaterialPickingInfo info = BeanUtil.toBean(item, ErpMaterialPickingInfo.class);
ErpMaterial material = materialMapper.selectById(item.getMaterialId());
BeanUtil.copyProperties(material, info);
info.setId(null); info.setId(null);
info.setRepairFormId(bo.getRepairFormId()); info.setRepairFormId(bo.getRepairFormId());
info.setPickingId(add.getId()); info.setPickingId(add.getId());
info.setWarehouseId(item.getWarehouseId());
info.setWarehouseName(item.getWarehouseName());
info.setState(bo.getState()); info.setState(bo.getState());
info.setPrice(item.getPrice()); /* 查询记录 */
info.setMoney(item.getMoney()); ErpMaterialInventoryRecord record = materialInventoryRecordMapper.selectById(item.getRecordId());
info.setPutawayPrice(record.getPrice());
info.setPutawayMoney(record.getMoney());
return info; return info;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
pickingInfoMapper.insertBatch(collect); pickingInfoMapper.insertBatch(collect);
...@@ -179,24 +182,29 @@ public class ErpMaterialPickingServiceImpl implements IErpMaterialPickingService ...@@ -179,24 +182,29 @@ public class ErpMaterialPickingServiceImpl implements IErpMaterialPickingService
/* 创建物料库存记录表 */ /* 创建物料库存记录表 */
if (bo.getState().equals(PickingState.TWO.getCode())) { if (bo.getState().equals(PickingState.TWO.getCode())) {
List<ErpMaterialInventoryRecord> inventoryRecordList = collect.stream().map(item -> { List<ErpMaterialInventoryRecord> inventoryRecordList = collect.stream().map(item -> {
LambdaQueryWrapper<ErpMaterialInventoryRecord> lambdaQueryWrapper = Wrappers.lambdaQuery(); ErpMaterialInventoryRecordVo recordVo = materialInventoryRecordMapper.customQueryInventoryById(item.getRecordId());
lambdaQueryWrapper if (null == recordVo) {
.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()+"]库存异常,请联系管理员!"); throw new ServiceException("仓库["+item.getWarehouseName()+"]中物料["+item.getMaterialName()+"]库存异常,请联系管理员!");
} }
ErpMaterialInventoryRecordVo recordVo = recordVoList.get(0);
if (item.getCollectNumber().compareTo(recordVo.getInventory()) > 0) { if (item.getCollectNumber().compareTo(recordVo.getInventory()) > 0) {
throw new ServiceException("仓库["+item.getWarehouseName()+"]中物料["+item.getMaterialName()+"]库存不足,请调整后重试!"); throw new ServiceException("仓库["+item.getWarehouseName()+"]中物料["+item.getMaterialName()+"]库存不足,请调整后重试!");
} }
/* 记录已出数量 */
ErpMaterialInventoryRecord inventoryRecord = materialInventoryRecordMapper.selectById(item.getRecordId());
if (null == inventoryRecord) {
throw new ServiceException("库存存在异常,请联系管理员!!!");
}
ErpMaterialPutawayInfo putawayInfo = putawayInfoMapper.selectById(inventoryRecord.getInfoId());
putawayInfo.setIssuedNumber(putawayInfo.getIssuedNumber().add(item.getCollectNumber()));
putawayInfoMapper.updateById(putawayInfo);
/* 创建库存记录 */
ErpMaterialInventoryRecord record = new ErpMaterialInventoryRecord(); ErpMaterialInventoryRecord record = new ErpMaterialInventoryRecord();
record.setInfoId(item.getId()); record.setInfoId(item.getId());
record.setMaterialId(item.getMaterialId()); record.setMaterialId(item.getMaterialId());
ErpWarehouseVo warehouseVo = warehouseMapper.selectVoById(item.getWarehouseId()); ErpWarehouseVo warehouseVo = warehouseMapper.selectVoById(item.getWarehouseId());
record.setWarehouseId(warehouseVo.getId()); record.setWarehouseId(warehouseVo.getId());
record.setDeptId(warehouseVo.getDeptId()); record.setDeptId(warehouseVo.getDeptId());
record.setVendorId(item.getVendorId());
record.setNumber(item.getCollectNumber()); record.setNumber(item.getCollectNumber());
record.setPrice(item.getPrice()); record.setPrice(item.getPrice());
record.setMoney(item.getMoney()); record.setMoney(item.getMoney());
...@@ -216,7 +224,7 @@ public class ErpMaterialPickingServiceImpl implements IErpMaterialPickingService ...@@ -216,7 +224,7 @@ public class ErpMaterialPickingServiceImpl implements IErpMaterialPickingService
@Override @Override
public Boolean updateByBo(ErpMaterialPickingBo bo) { public Boolean updateByBo(ErpMaterialPickingBo bo) {
ErpMaterialPicking update = BeanUtil.toBean(bo, ErpMaterialPicking.class); ErpMaterialPicking update = BeanUtil.toBean(bo, ErpMaterialPicking.class);
BigDecimal moneyTotal = bo.getMaterialList().stream().map(ErpMaterialPickingInfoBo::getMoney).reduce(BigDecimal.ZERO, BigDecimal::add); BigDecimal moneyTotal = bo.getMaterialList().stream().map(ErpMaterialPickingInfoAddBo::getMoney).reduce(BigDecimal.ZERO, BigDecimal::add);
ErpRepairForm repairForm = repairFormMapper.selectById(bo.getRepairFormId()); ErpRepairForm repairForm = repairFormMapper.selectById(bo.getRepairFormId());
ErpCar erpCar = carMapper.selectById(repairForm.getCarId()); ErpCar erpCar = carMapper.selectById(repairForm.getCarId());
update.setCarId(erpCar.getId()); update.setCarId(erpCar.getId());
...@@ -232,19 +240,19 @@ public class ErpMaterialPickingServiceImpl implements IErpMaterialPickingService ...@@ -232,19 +240,19 @@ public class ErpMaterialPickingServiceImpl implements IErpMaterialPickingService
pickingInfoMapper.delete(lqw); pickingInfoMapper.delete(lqw);
// 批量新增材料明细 // 批量新增材料明细
List<ErpMaterialPickingInfoBo> infoBoList = bo.getMaterialList(); List<ErpMaterialPickingInfoAddBo> materialList = bo.getMaterialList();
List<ErpMaterialPickingInfo> collect = infoBoList.stream().map(item -> { List<ErpMaterialPickingInfo> collect = materialList.stream().map(item -> {
ErpMaterialPickingInfo info = BeanUtil.toBean(item, ErpMaterialPickingInfo.class); ErpMaterialPickingInfo info = BeanUtil.toBean(item, ErpMaterialPickingInfo.class);
ErpMaterial material = materialMapper.selectById(item.getMaterialId());
BeanUtil.copyProperties(material, info);
info.setId(null); info.setId(null);
info.setPickingId(update.getId()); info.setPickingId(update.getId());
info.setRepairFormId(update.getRepairFormId()); info.setRepairFormId(update.getRepairFormId());
info.setWarehouseId(item.getWarehouseId());
info.setWarehouseName(item.getWarehouseName());
info.setState(bo.getState()); info.setState(bo.getState());
info.setPrice(item.getPrice()); info.setPrice(item.getPrice());
info.setMoney(item.getMoney()); info.setMoney(item.getMoney());
/* 查询记录 */
ErpMaterialInventoryRecord record = materialInventoryRecordMapper.selectById(item.getRecordId());
info.setPutawayPrice(record.getPrice());
info.setPutawayMoney(record.getMoney());
return info; return info;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
pickingInfoMapper.insertBatch(collect); pickingInfoMapper.insertBatch(collect);
...@@ -252,24 +260,29 @@ public class ErpMaterialPickingServiceImpl implements IErpMaterialPickingService ...@@ -252,24 +260,29 @@ public class ErpMaterialPickingServiceImpl implements IErpMaterialPickingService
/* 创建物料库存记录表 */ /* 创建物料库存记录表 */
if (bo.getState().equals(PickingState.TWO.getCode())) { if (bo.getState().equals(PickingState.TWO.getCode())) {
List<ErpMaterialInventoryRecord> inventoryRecordList = collect.stream().map(item -> { List<ErpMaterialInventoryRecord> inventoryRecordList = collect.stream().map(item -> {
LambdaQueryWrapper<ErpMaterialInventoryRecord> lambdaQueryWrapper = Wrappers.lambdaQuery(); ErpMaterialInventoryRecordVo recordVo = materialInventoryRecordMapper.customQueryInventoryById(item.getRecordId());
lambdaQueryWrapper if (null == recordVo) {
.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()+"]库存异常,请联系管理员!"); throw new ServiceException("仓库["+item.getWarehouseName()+"]中物料["+item.getMaterialName()+"]库存异常,请联系管理员!");
} }
ErpMaterialInventoryRecordVo recordVo = recordVoList.get(0);
if (item.getCollectNumber().compareTo(recordVo.getInventory()) > 0) { if (item.getCollectNumber().compareTo(recordVo.getInventory()) > 0) {
throw new ServiceException("仓库["+item.getWarehouseName()+"]中物料["+item.getMaterialName()+"]库存不足,请调整后重试!"); throw new ServiceException("仓库["+item.getWarehouseName()+"]中物料["+item.getMaterialName()+"]库存不足,请调整后重试!");
} }
/* 记录已出数量 */
ErpMaterialInventoryRecord inventoryRecord = materialInventoryRecordMapper.selectById(item.getRecordId());
if (null == inventoryRecord) {
throw new ServiceException("库存存在异常,请联系管理员!!!");
}
ErpMaterialPutawayInfo putawayInfo = putawayInfoMapper.selectById(inventoryRecord.getInfoId());
putawayInfo.setIssuedNumber(putawayInfo.getIssuedNumber().add(item.getCollectNumber()));
putawayInfoMapper.updateById(putawayInfo);
/* 创建库存记录 */
ErpMaterialInventoryRecord record = new ErpMaterialInventoryRecord(); ErpMaterialInventoryRecord record = new ErpMaterialInventoryRecord();
record.setInfoId(item.getId()); record.setInfoId(item.getId());
record.setMaterialId(item.getMaterialId()); record.setMaterialId(item.getMaterialId());
ErpWarehouseVo warehouseVo = warehouseMapper.selectVoById(item.getWarehouseId()); ErpWarehouseVo warehouseVo = warehouseMapper.selectVoById(item.getWarehouseId());
record.setWarehouseId(warehouseVo.getId()); record.setWarehouseId(warehouseVo.getId());
record.setDeptId(warehouseVo.getDeptId()); record.setDeptId(warehouseVo.getDeptId());
record.setVendorId(item.getVendorId());
record.setNumber(item.getCollectNumber()); record.setNumber(item.getCollectNumber());
record.setPrice(item.getPrice()); record.setPrice(item.getPrice());
record.setMoney(item.getMoney()); record.setMoney(item.getMoney());
...@@ -307,7 +320,7 @@ public class ErpMaterialPickingServiceImpl implements IErpMaterialPickingService ...@@ -307,7 +320,7 @@ public class ErpMaterialPickingServiceImpl implements IErpMaterialPickingService
List<ErpMaterialPickingInfoVo> pickingInfoVoList = pickingInfoMapper.selectVoList(queryWrapper); List<ErpMaterialPickingInfoVo> pickingInfoVoList = pickingInfoMapper.selectVoList(queryWrapper);
if (!pickingInfoVoList.isEmpty()) { if (!pickingInfoVoList.isEmpty()) {
LambdaQueryWrapper<ErpMaterialInventoryRecord> lambdaQueryWrapper = Wrappers.lambdaQuery(); LambdaQueryWrapper<ErpMaterialInventoryRecord> lambdaQueryWrapper = Wrappers.lambdaQuery();
lambdaQueryWrapper.eq(ErpMaterialInventoryRecord::getInfoId, pickingInfoVoList.stream().map(ErpMaterialPickingInfoVo::getId).collect(Collectors.toList())); lambdaQueryWrapper.in(ErpMaterialInventoryRecord::getInfoId, pickingInfoVoList.stream().map(ErpMaterialPickingInfoVo::getId).collect(Collectors.toList()));
materialInventoryRecordMapper.delete(lambdaQueryWrapper); materialInventoryRecordMapper.delete(lambdaQueryWrapper);
} }
// 删除领料出库单明细 // 删除领料出库单明细
...@@ -337,24 +350,25 @@ public class ErpMaterialPickingServiceImpl implements IErpMaterialPickingService ...@@ -337,24 +350,25 @@ public class ErpMaterialPickingServiceImpl implements IErpMaterialPickingService
queryWrapper.in(ErpMaterialPickingInfo::getPickingId, ids).eq(ErpMaterialPickingInfo::getState, PickingState.ONE.getCode()); queryWrapper.in(ErpMaterialPickingInfo::getPickingId, ids).eq(ErpMaterialPickingInfo::getState, PickingState.ONE.getCode());
List<ErpMaterialPickingInfoVo> pickingInfoVoList = pickingInfoMapper.selectVoList(queryWrapper); List<ErpMaterialPickingInfoVo> pickingInfoVoList = pickingInfoMapper.selectVoList(queryWrapper);
List<ErpMaterialInventoryRecord> inventoryRecordList = pickingInfoVoList.stream().map(item -> { List<ErpMaterialInventoryRecord> inventoryRecordList = pickingInfoVoList.stream().map(item -> {
LambdaQueryWrapper<ErpMaterialInventoryRecord> lambdaQueryWrapper = Wrappers.lambdaQuery(); ErpMaterialInventoryRecordVo recordVo = materialInventoryRecordMapper.customQueryInventoryById(item.getRecordId());
lambdaQueryWrapper if (null == recordVo) {
.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()+"]库存异常,请联系管理员!"); throw new ServiceException("仓库["+item.getWarehouseName()+"]中物料["+item.getMaterialName()+"]库存异常,请联系管理员!");
} }
ErpMaterialInventoryRecordVo recordVo = recordVoList.get(0);
if (item.getCollectNumber().compareTo(recordVo.getInventory()) > 0) { if (item.getCollectNumber().compareTo(recordVo.getInventory()) > 0) {
throw new ServiceException("仓库["+item.getWarehouseName()+"]中物料["+item.getMaterialName()+"]库存不足,请调整后重试!"); throw new ServiceException("仓库["+item.getWarehouseName()+"]中物料["+item.getMaterialName()+"]库存不足,请调整后重试!");
} }
/* 记录已出数量 */
ErpMaterialPutawayInfo putawayInfo = putawayInfoMapper.selectById(recordVo.getInfoId());
putawayInfo.setIssuedNumber(putawayInfo.getIssuedNumber().add(item.getCollectNumber()));
putawayInfoMapper.updateById(putawayInfo);
/* 创建库存记录 */
ErpMaterialInventoryRecord record = new ErpMaterialInventoryRecord(); ErpMaterialInventoryRecord record = new ErpMaterialInventoryRecord();
record.setInfoId(item.getId()); record.setInfoId(item.getId());
record.setMaterialId(item.getMaterialId()); record.setMaterialId(item.getMaterialId());
ErpWarehouseVo warehouseVo = warehouseMapper.selectVoById(item.getWarehouseId()); ErpWarehouseVo warehouseVo = warehouseMapper.selectVoById(item.getWarehouseId());
record.setWarehouseId(warehouseVo.getId()); record.setWarehouseId(warehouseVo.getId());
record.setDeptId(warehouseVo.getDeptId()); record.setDeptId(warehouseVo.getDeptId());
record.setVendorId(item.getVendorId());
record.setNumber(item.getCollectNumber()); record.setNumber(item.getCollectNumber());
record.setPrice(item.getPrice()); record.setPrice(item.getPrice());
record.setMoney(item.getMoney()); record.setMoney(item.getMoney());
...@@ -397,12 +411,20 @@ public class ErpMaterialPickingServiceImpl implements IErpMaterialPickingService ...@@ -397,12 +411,20 @@ public class ErpMaterialPickingServiceImpl implements IErpMaterialPickingService
List<ErpMaterialPickingInfoVo> pickingInfoVoList = pickingInfoMapper.selectVoList(queryWrapper); List<ErpMaterialPickingInfoVo> pickingInfoVoList = pickingInfoMapper.selectVoList(queryWrapper);
if (!pickingInfoVoList.isEmpty()) { if (!pickingInfoVoList.isEmpty()) {
List<ErpMaterialInventoryRecord> inventoryRecordList = pickingInfoVoList.stream().map(item -> { List<ErpMaterialInventoryRecord> inventoryRecordList = pickingInfoVoList.stream().map(item -> {
/* 回退入库明细中已出数量 */
ErpMaterialInventoryRecordVo recordVo = materialInventoryRecordMapper.customQueryInventoryById(item.getRecordId());
ErpMaterialPutawayInfo putawayInfo = putawayInfoMapper.selectById(recordVo.getInfoId());
putawayInfo.setIssuedNumber(putawayInfo.getIssuedNumber().subtract(item.getCollectNumber()));
putawayInfoMapper.updateById(putawayInfo);
/* 创建库存记录 */
ErpMaterialInventoryRecord record = new ErpMaterialInventoryRecord(); ErpMaterialInventoryRecord record = new ErpMaterialInventoryRecord();
record.setInfoId(item.getId()); record.setInfoId(item.getId());
record.setMaterialId(item.getMaterialId()); record.setMaterialId(item.getMaterialId());
ErpWarehouseVo warehouseVo = warehouseMapper.selectVoById(item.getWarehouseId()); ErpWarehouseVo warehouseVo = warehouseMapper.selectVoById(item.getWarehouseId());
record.setWarehouseId(warehouseVo.getId()); record.setWarehouseId(warehouseVo.getId());
record.setDeptId(warehouseVo.getDeptId()); record.setDeptId(warehouseVo.getDeptId());
record.setVendorId(item.getVendorId());
record.setNumber(item.getCollectNumber()); record.setNumber(item.getCollectNumber());
record.setPrice(item.getPrice()); record.setPrice(item.getPrice());
record.setMoney(item.getMoney()); record.setMoney(item.getMoney());
......
...@@ -127,6 +127,8 @@ public class ErpMaterialPutawayServiceImpl implements IErpMaterialPutawayService ...@@ -127,6 +127,8 @@ public class ErpMaterialPutawayServiceImpl implements IErpMaterialPutawayService
putawayInfo.setMaterialId(material.getId()); putawayInfo.setMaterialId(material.getId());
putawayInfo.setPutawayId(add.getId()); putawayInfo.setPutawayId(add.getId());
putawayInfo.setState(bo.getState()); putawayInfo.setState(bo.getState());
putawayInfo.setVendorId(item.getVendorId());
putawayInfo.setVendorName(item.getVendorName());
return putawayInfo; return putawayInfo;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
putawayInfoMapper.insertBatch(collect); putawayInfoMapper.insertBatch(collect);
...@@ -139,6 +141,7 @@ public class ErpMaterialPutawayServiceImpl implements IErpMaterialPutawayService ...@@ -139,6 +141,7 @@ public class ErpMaterialPutawayServiceImpl implements IErpMaterialPutawayService
record.setMaterialId(item.getMaterialId()); record.setMaterialId(item.getMaterialId());
record.setWarehouseId(warehouseVo.getId()); record.setWarehouseId(warehouseVo.getId());
record.setDeptId(warehouseVo.getDeptId()); record.setDeptId(warehouseVo.getDeptId());
record.setVendorId(item.getVendorId());
record.setNumber(item.getPutawayNumber()); record.setNumber(item.getPutawayNumber());
record.setPrice(item.getPutawayPrice()); record.setPrice(item.getPutawayPrice());
record.setMoney(item.getPutawayMoney()); record.setMoney(item.getPutawayMoney());
...@@ -188,6 +191,7 @@ public class ErpMaterialPutawayServiceImpl implements IErpMaterialPutawayService ...@@ -188,6 +191,7 @@ public class ErpMaterialPutawayServiceImpl implements IErpMaterialPutawayService
if (null != warehouseVo) { if (null != warehouseVo) {
record.setDeptId(warehouseVo.getDeptId()); record.setDeptId(warehouseVo.getDeptId());
} }
record.setVendorId(item.getVendorId());
record.setNumber(item.getPutawayNumber()); record.setNumber(item.getPutawayNumber());
record.setPrice(item.getPutawayPrice()); record.setPrice(item.getPutawayPrice());
record.setMoney(item.getPutawayMoney()); record.setMoney(item.getPutawayMoney());
...@@ -229,6 +233,8 @@ public class ErpMaterialPutawayServiceImpl implements IErpMaterialPutawayService ...@@ -229,6 +233,8 @@ public class ErpMaterialPutawayServiceImpl implements IErpMaterialPutawayService
ErpMaterial material = materialMapper.selectById(item.getMaterialId()); ErpMaterial material = materialMapper.selectById(item.getMaterialId());
BeanUtil.copyProperties(material, putawayInfo); BeanUtil.copyProperties(material, putawayInfo);
putawayInfo.setId(null); putawayInfo.setId(null);
putawayInfo.setVendorId(item.getVendorId());
putawayInfo.setVendorName(item.getVendorName());
putawayInfo.setMaterialId(material.getId()); putawayInfo.setMaterialId(material.getId());
putawayInfo.setPutawayId(update.getId()); putawayInfo.setPutawayId(update.getId());
putawayInfo.setState(bo.getState()); putawayInfo.setState(bo.getState());
......
...@@ -137,6 +137,10 @@ public class ErpMaterialReturnsServiceImpl implements IErpMaterialReturnsService ...@@ -137,6 +137,10 @@ public class ErpMaterialReturnsServiceImpl implements IErpMaterialReturnsService
BeanUtil.copyProperties(putawayInfo, returnsInfo); BeanUtil.copyProperties(putawayInfo, returnsInfo);
returnsInfo.setId(null); returnsInfo.setId(null);
returnsInfo.setReturnsId(materialReturns.getId()); returnsInfo.setReturnsId(materialReturns.getId());
returnsInfo.setCreateTime(null);
returnsInfo.setCreateBy(null);
returnsInfo.setUpdateTime(null);
returnsInfo.setUpdateBy(null);
return returnsInfo; return returnsInfo;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
materialReturnsInfoMapper.insertBatch(collect); materialReturnsInfoMapper.insertBatch(collect);
...@@ -148,6 +152,7 @@ public class ErpMaterialReturnsServiceImpl implements IErpMaterialReturnsService ...@@ -148,6 +152,7 @@ public class ErpMaterialReturnsServiceImpl implements IErpMaterialReturnsService
record.setMaterialId(item.getMaterialId()); record.setMaterialId(item.getMaterialId());
record.setWarehouseId(warehouseVo.getId()); record.setWarehouseId(warehouseVo.getId());
record.setDeptId(warehouseVo.getDeptId()); record.setDeptId(warehouseVo.getDeptId());
record.setVendorId(item.getVendorId());
record.setNumber(item.getReturnsNumber()); record.setNumber(item.getReturnsNumber());
record.setPrice(item.getReturnsPrice()); record.setPrice(item.getReturnsPrice());
record.setMoney(item.getReturnsMoney()); record.setMoney(item.getReturnsMoney());
...@@ -200,6 +205,10 @@ public class ErpMaterialReturnsServiceImpl implements IErpMaterialReturnsService ...@@ -200,6 +205,10 @@ public class ErpMaterialReturnsServiceImpl implements IErpMaterialReturnsService
BeanUtil.copyProperties(putawayInfo, returnsInfo); BeanUtil.copyProperties(putawayInfo, returnsInfo);
returnsInfo.setId(null); returnsInfo.setId(null);
returnsInfo.setReturnsId(materialReturns.getId()); returnsInfo.setReturnsId(materialReturns.getId());
returnsInfo.setCreateTime(null);
returnsInfo.setCreateBy(null);
returnsInfo.setUpdateTime(null);
returnsInfo.setUpdateBy(null);
return returnsInfo; return returnsInfo;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
materialReturnsInfoMapper.insertBatch(collect); materialReturnsInfoMapper.insertBatch(collect);
...@@ -211,6 +220,7 @@ public class ErpMaterialReturnsServiceImpl implements IErpMaterialReturnsService ...@@ -211,6 +220,7 @@ public class ErpMaterialReturnsServiceImpl implements IErpMaterialReturnsService
record.setMaterialId(item.getMaterialId()); record.setMaterialId(item.getMaterialId());
record.setWarehouseId(warehouseVo.getId()); record.setWarehouseId(warehouseVo.getId());
record.setDeptId(warehouseVo.getDeptId()); record.setDeptId(warehouseVo.getDeptId());
record.setVendorId(item.getVendorId());
record.setNumber(item.getReturnsNumber()); record.setNumber(item.getReturnsNumber());
record.setPrice(item.getReturnsPrice()); record.setPrice(item.getReturnsPrice());
record.setMoney(item.getReturnsMoney()); record.setMoney(item.getReturnsMoney());
......
...@@ -36,11 +36,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -36,11 +36,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
r.type, r.type,
w.name as warehouseName, w.name as warehouseName,
r.material_id, r.material_id,
r.vendor_id,
v.vendor_name,
m.material_code, m.material_code,
m.material_name, m.material_name,
m.material_specifications, m.material_specifications,
m.vendor_id,
m.vendor_name,
m.material_unit, m.material_unit,
m.material_brand, m.material_brand,
m.procurement_subject, m.procurement_subject,
...@@ -58,29 +58,88 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -58,29 +58,88 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM erp_material_inventory_record r FROM erp_material_inventory_record r
LEFT JOIN erp_material m ON r.material_id = m.id LEFT JOIN erp_material m ON r.material_id = m.id
LEFT JOIN erp_warehouse w ON r.warehouse_id = w.id LEFT JOIN erp_warehouse w ON r.warehouse_id = w.id
LEFT JOIN(SELECT warehouse_id, material_id, SUM(number) AS putNumber LEFT JOIN erp_material_vendor v ON r.vendor_id = v.id
LEFT JOIN(SELECT warehouse_id, material_id, vendor_id, SUM(number) AS putNumber
FROM erp_material_inventory_record FROM erp_material_inventory_record
WHERE type = '1' WHERE type = '1'
GROUP BY warehouse_id, material_id) put GROUP BY warehouse_id, material_id, vendor_id) put
ON r.warehouse_id = put.warehouse_id AND r.material_id = put.material_id ON r.warehouse_id = put.warehouse_id AND r.material_id = put.material_id AND r.vendor_id = put.vendor_id
LEFT JOIN(SELECT warehouse_id, material_id, SUM(number) AS retNumber LEFT JOIN(SELECT warehouse_id, material_id, vendor_id, SUM(number) AS retNumber
FROM erp_material_inventory_record FROM erp_material_inventory_record
WHERE type = '2' WHERE type = '2'
GROUP BY warehouse_id, material_id) ret GROUP BY warehouse_id, material_id, vendor_id) ret
ON r.warehouse_id = ret.warehouse_id AND r.material_id = ret.material_id ON r.warehouse_id = ret.warehouse_id AND r.material_id = ret.material_id AND r.vendor_id = ret.vendor_id
LEFT JOIN(SELECT warehouse_id, material_id, SUM(number) AS picNumber LEFT JOIN(SELECT warehouse_id, material_id, vendor_id, SUM(number) AS picNumber
FROM erp_material_inventory_record FROM erp_material_inventory_record
WHERE type = '3' WHERE type = '3'
GROUP BY warehouse_id, material_id) pic GROUP BY warehouse_id, material_id, vendor_id) pic
ON r.warehouse_id = pic.warehouse_id AND r.material_id = pic.material_id ON r.warehouse_id = pic.warehouse_id AND r.material_id = pic.material_id AND r.vendor_id = pic.vendor_id
LEFT JOIN(SELECT warehouse_id, material_id, SUM(number) AS bacNumber LEFT JOIN(SELECT warehouse_id, material_id, vendor_id, SUM(number) AS bacNumber
FROM erp_material_inventory_record FROM erp_material_inventory_record
WHERE type = '4' WHERE type = '4'
GROUP BY warehouse_id, material_id) bac GROUP BY warehouse_id, material_id, vendor_id) bac
ON r.warehouse_id = bac.warehouse_id AND r.material_id = bac.material_id ON r.warehouse_id = bac.warehouse_id AND r.material_id = bac.material_id AND r.vendor_id = bac.vendor_id
GROUP BY r.warehouse_id, r.material_id GROUP BY r.warehouse_id, r.material_id, r.vendor_id
) t ) t
</sql> </sql>
<sql id="list">
SELECT t.* FROM (SELECT
r.id as recordId,
r.info_id,
r.material_id,
r.warehouse_id,
r.vendor_id,
r.price,
r.type,
r.create_time,
IFNULL(put.put_number, 0) - IFNULL(ret.ret_number, 0) - IFNULL(pic.out_number, 0) + IFNULL(back.back_number, 0) AS inventory,
m.material_code,
m.material_name,
m.material_specifications,
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,
v.vendor_name,
w.name as warehouseName
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 erp_material_vendor v ON r.vendor_id = v.id
LEFT JOIN (
SELECT material_id, warehouse_id, vendor_id, SUM(number) AS put_number
FROM erp_material_inventory_record
WHERE type = '1'
GROUP BY material_id, warehouse_id, vendor_id
) put ON r.material_id = put.material_id AND r.warehouse_id = put.warehouse_id AND r.vendor_id = put.vendor_id
LEFT JOIN (
SELECT material_id, warehouse_id, vendor_id, SUM(number) AS ret_number
FROM erp_material_inventory_record
WHERE type = '2'
GROUP BY material_id, warehouse_id, vendor_id
) ret ON r.material_id = ret.material_id AND r.warehouse_id = ret.warehouse_id AND r.vendor_id = ret.vendor_id
LEFT JOIN (
SELECT material_id, warehouse_id, vendor_id, SUM(number) AS out_number
FROM erp_material_inventory_record
WHERE type = '3'
GROUP BY material_id, warehouse_id, vendor_id
) pic ON r.material_id = pic.material_id AND r.warehouse_id = pic.warehouse_id AND r.vendor_id = pic.vendor_id
LEFT JOIN (
SELECT material_id, warehouse_id, vendor_id, SUM(number) AS back_number
FROM erp_material_inventory_record
WHERE type = '4'
GROUP BY material_id, warehouse_id, vendor_id
) back ON r.material_id = back.material_id AND r.warehouse_id = back.warehouse_id AND r.vendor_id = back.vendor_id
) t
</sql>
<select id="customQueryPageInventoryList" resultType="com.maintain.business.domain.vo.ErpMaterialInventoryRecordVo">
<include refid="list"/>
${ew.getCustomSqlSegment}
</select>
<select id="customQueryPageList" resultType="com.maintain.business.domain.vo.ErpMaterialInventoryRecordVo"> <select id="customQueryPageList" resultType="com.maintain.business.domain.vo.ErpMaterialInventoryRecordVo">
<include refid="custom"/> <include refid="custom"/>
${ew.getCustomSqlSegment} ${ew.getCustomSqlSegment}
...@@ -128,6 +187,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -128,6 +187,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="custom"/> <include refid="custom"/>
WHERE t.warehouse_id = #{warehouseId} AND t.material_id = #{materialId} WHERE t.warehouse_id = #{warehouseId} AND t.material_id = #{materialId}
</select> </select>
<select id="customQueryInventoryById"
resultType="com.maintain.business.domain.vo.ErpMaterialInventoryRecordVo">
<include refid="list"/>
<where>
<if test="id != null">
t.recordId = #{id}
</if>
</where>
</select>
</mapper> </mapper>
...@@ -32,8 +32,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -32,8 +32,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
t.* t.*
FROM( FROM(
SELECT SELECT
r.warehouse_id, w.name as warehouse_name, r.material_id, m.material_code, m.material_name, m.material_specifications, r.warehouse_id, w.name as warehouse_name, r.material_id, r.vendor_id, v.vendor_name, m.material_code,
m.vendor_id, m.vendor_name, m.material_unit, m.material_brand, m.procurement_subject, m.compatible_with, m.material_name, m.material_specifications, 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, 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(put.putNumber,0) AS putNumber, IFNULL(ret.retNumber,0) AS retNumber,
IFNULL(pic.picNumber,0) AS picNumber, IFNULL(bac.bacNumber,0) AS bacNumber, IFNULL(pic.picNumber,0) AS picNumber, IFNULL(bac.bacNumber,0) AS bacNumber,
...@@ -41,31 +41,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -41,31 +41,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM erp_material_inventory_record r FROM erp_material_inventory_record r
LEFT JOIN erp_material m ON r.material_id = m.id LEFT JOIN erp_material m ON r.material_id = m.id
LEFT JOIN erp_warehouse w ON r.warehouse_id = w.id LEFT JOIN erp_warehouse w ON r.warehouse_id = w.id
LEFT JOIN( LEFT JOIN erp_material_vendor v ON r.vendor_id = v.id
SELECT warehouse_id, material_id, SUM(number) AS putNumber LEFT JOIN(SELECT warehouse_id, material_id, vendor_id, SUM(number) AS putNumber
FROM erp_material_inventory_record FROM erp_material_inventory_record
WHERE type = '1' WHERE type = '1'
GROUP BY warehouse_id, material_id GROUP BY warehouse_id, material_id, vendor_id) put
) put ON r.warehouse_id = put.warehouse_id AND r.material_id = put.material_id ON r.warehouse_id = put.warehouse_id AND r.material_id = put.material_id AND r.vendor_id = put.vendor_id
LEFT JOIN( LEFT JOIN(SELECT warehouse_id, material_id, vendor_id, SUM(number) AS retNumber
SELECT warehouse_id, material_id, SUM(number) AS retNumber
FROM erp_material_inventory_record FROM erp_material_inventory_record
WHERE type = '2' WHERE type = '2'
GROUP BY warehouse_id, material_id GROUP BY warehouse_id, material_id, vendor_id) ret
) ret ON r.warehouse_id = ret.warehouse_id AND r.material_id = ret.material_id ON r.warehouse_id = ret.warehouse_id AND r.material_id = ret.material_id AND r.vendor_id = ret.vendor_id
LEFT JOIN( LEFT JOIN(SELECT warehouse_id, material_id, vendor_id, SUM(number) AS picNumber
SELECT warehouse_id, material_id, SUM(number) AS picNumber
FROM erp_material_inventory_record FROM erp_material_inventory_record
WHERE type = '3' WHERE type = '3'
GROUP BY warehouse_id, material_id GROUP BY warehouse_id, material_id, vendor_id) pic
) pic ON r.warehouse_id = pic.warehouse_id AND r.material_id = pic.material_id ON r.warehouse_id = pic.warehouse_id AND r.material_id = pic.material_id AND r.vendor_id = pic.vendor_id
LEFT JOIN( LEFT JOIN(SELECT warehouse_id, material_id, vendor_id, SUM(number) AS bacNumber
SELECT warehouse_id, material_id, SUM(number) AS bacNumber
FROM erp_material_inventory_record FROM erp_material_inventory_record
WHERE type = '4' WHERE type = '4'
GROUP BY warehouse_id, material_id GROUP BY warehouse_id, material_id, vendor_id) bac
) bac ON r.warehouse_id = bac.warehouse_id AND r.material_id = bac.material_id ON r.warehouse_id = bac.warehouse_id AND r.material_id = bac.material_id AND r.vendor_id = bac.vendor_id
GROUP BY r.warehouse_id, r.material_id GROUP BY r.warehouse_id, r.material_id, r.vendor_id
) t ) t
</sql> </sql>
<select id="customQueryPageList" resultType="com.maintain.business.domain.vo.ErpMaterialVo"> <select id="customQueryPageList" resultType="com.maintain.business.domain.vo.ErpMaterialVo">
......
...@@ -9,10 +9,19 @@ export function listMaterial(query) { ...@@ -9,10 +9,19 @@ export function listMaterial(query) {
}) })
} }
// 查询物资列表(自定义查询用于查询库存大于0的物料)
// export function customListMaterial(query) {
// return request({
// url: '/business/material/customList',
// method: 'get',
// params: query
// })
// }
// 查询物资列表(自定义查询用于查询库存大于0的物料) // 查询物资列表(自定义查询用于查询库存大于0的物料)
export function customListMaterial(query) { export function customListMaterial(query) {
return request({ return request({
url: '/business/material/customList', url: '/business/materialInventoryRecord/inventoryList',
method: 'get', method: 'get',
params: query params: query
}) })
......
...@@ -62,6 +62,7 @@ ...@@ -62,6 +62,7 @@
<!-- <el-table-column label="分类名称" align="center" prop="materialTypeName" />--> <!-- <el-table-column label="分类名称" align="center" prop="materialTypeName" />-->
<!-- <el-table-column label="货位类型" align="center" prop="warehouseLocationType" />--> <!-- <el-table-column label="货位类型" align="center" prop="warehouseLocationType" />-->
<el-table-column label="仓库" align="center" prop="warehouseName" /> <el-table-column label="仓库" align="center" prop="warehouseName" />
<el-table-column label="供应商" align="center" prop="vendorName" />
<el-table-column label="物资编码" align="center" prop="materialCode" /> <el-table-column label="物资编码" align="center" prop="materialCode" />
<el-table-column label="物资名称" align="center" prop="materialName" /> <el-table-column label="物资名称" align="center" prop="materialName" />
<el-table-column label="物资规格" align="center" prop="materialSpecifications" /> <el-table-column label="物资规格" align="center" prop="materialSpecifications" />
...@@ -70,7 +71,6 @@ ...@@ -70,7 +71,6 @@
<dict-tag :options="dict.type.material_unit" :value="scope.row.materialUnit" /> <dict-tag :options="dict.type.material_unit" :value="scope.row.materialUnit" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="供应商" align="center" prop="vendorName" />
<el-table-column label="质保期" align="center" prop="materialWarrantyPeriod" /> <el-table-column label="质保期" align="center" prop="materialWarrantyPeriod" />
<el-table-column label="参考价" align="center" prop="referencePrice" /> <el-table-column label="参考价" align="center" prop="referencePrice" />
<el-table-column label="销售价" align="center" prop="sellingPrice" /> <el-table-column label="销售价" align="center" prop="sellingPrice" />
...@@ -140,6 +140,7 @@ ...@@ -140,6 +140,7 @@
<!-- <el-table-column label="分类名称" align="center" prop="materialTypeName" />--> <!-- <el-table-column label="分类名称" align="center" prop="materialTypeName" />-->
<!-- <el-table-column label="货位类型" align="center" prop="warehouseLocationType" />--> <!-- <el-table-column label="货位类型" align="center" prop="warehouseLocationType" />-->
<el-table-column label="仓库" align="center" prop="warehouseName" /> <el-table-column label="仓库" align="center" prop="warehouseName" />
<el-table-column label="供应商" align="center" prop="vendorName" />
<el-table-column label="物资编码" align="center" prop="materialCode" /> <el-table-column label="物资编码" align="center" prop="materialCode" />
<el-table-column label="物资名称" align="center" prop="materialName" /> <el-table-column label="物资名称" align="center" prop="materialName" />
<el-table-column label="物资规格" align="center" prop="materialSpecifications" /> <el-table-column label="物资规格" align="center" prop="materialSpecifications" />
...@@ -148,7 +149,6 @@ ...@@ -148,7 +149,6 @@
<dict-tag :options="dict.type.material_unit" :value="scope.row.materialUnit" /> <dict-tag :options="dict.type.material_unit" :value="scope.row.materialUnit" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="供应商" align="center" prop="vendorName" />
<el-table-column label="质保期" align="center" prop="materialWarrantyPeriod" /> <el-table-column label="质保期" align="center" prop="materialWarrantyPeriod" />
<el-table-column label="参考价" align="center" prop="referencePrice" /> <el-table-column label="参考价" align="center" prop="referencePrice" />
<el-table-column label="销售价" align="center" prop="sellingPrice" /> <el-table-column label="销售价" align="center" prop="sellingPrice" />
...@@ -384,6 +384,8 @@ export default { ...@@ -384,6 +384,8 @@ export default {
warehouseId: item.warehouseId, warehouseId: item.warehouseId,
warehouseName: item.warehouseName, warehouseName: item.warehouseName,
materialId: item.materialId, materialId: item.materialId,
vendorId: item.vendorId,
vendorName: item.vendorName,
collectNumber: item.collectNumber, collectNumber: item.collectNumber,
price: item.price, price: item.price,
money: item.money, money: item.money,
......
...@@ -251,6 +251,7 @@ ...@@ -251,6 +251,7 @@
</el-row> </el-row>
<el-table :data="form.pickingInfoList"> <el-table :data="form.pickingInfoList">
<el-table-column label="仓库名称" align="center" prop="warehouseName" /> <el-table-column label="仓库名称" align="center" prop="warehouseName" />
<el-table-column label="供应商" align="center" prop="vendorName" />
<el-table-column label="物资编码" align="center" prop="materialCode" /> <el-table-column label="物资编码" align="center" prop="materialCode" />
<el-table-column label="物资名称" align="center" prop="materialName" /> <el-table-column label="物资名称" align="center" prop="materialName" />
<el-table-column label="物资规格" align="center" prop="materialSpecifications" /> <el-table-column label="物资规格" align="center" prop="materialSpecifications" />
...@@ -259,7 +260,6 @@ ...@@ -259,7 +260,6 @@
<dict-tag :options="dict.type.material_unit" :value="scope.row.materialUnit" /> <dict-tag :options="dict.type.material_unit" :value="scope.row.materialUnit" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="供应商" align="center" prop="vendorName" />
<el-table-column label="质保期" align="center" prop="materialWarrantyPeriod" /> <el-table-column label="质保期" align="center" prop="materialWarrantyPeriod" />
<el-table-column label="参考价" align="center" prop="referencePrice" /> <el-table-column label="参考价" align="center" prop="referencePrice" />
<el-table-column label="销售价" align="center" prop="sellingPrice" /> <el-table-column label="销售价" align="center" prop="sellingPrice" />
...@@ -300,13 +300,10 @@ ...@@ -300,13 +300,10 @@
<!-- <el-option v-for="item in warehouseOpt" :key="item.id" :value="item.id" :label="item.name" />--> <!-- <el-option v-for="item in warehouseOpt" :key="item.id" :value="item.id" :label="item.name" />-->
<!-- </el-select>--> <!-- </el-select>-->
<!-- </el-form-item>--> <!-- </el-form-item>-->
<el-form-item label="供应商" prop="vendorName"> <el-form-item label="供应商" prop="vendorId">
<el-input <el-select v-model="queryMaterialParams.vendorId" filterable placeholder="请选择供应商" style="width: 100%">
v-model="queryMaterialParams.vendorName" <el-option v-for="item in materialVendorOpt" :key="item.id" :value="item.id" :label="item.vendorName" />
placeholder="请输入供应商名称" </el-select>
clearable
@keyup.enter.native="handleMaterialQuery"
/>
</el-form-item> </el-form-item>
<el-form-item label="物资编码" prop="materialCode"> <el-form-item label="物资编码" prop="materialCode">
<el-input <el-input
...@@ -334,6 +331,7 @@ ...@@ -334,6 +331,7 @@
<!-- <el-table-column label="分类名称" align="center" prop="materialTypeName" />--> <!-- <el-table-column label="分类名称" align="center" prop="materialTypeName" />-->
<!-- <el-table-column label="货位类型" align="center" prop="warehouseLocationType" />--> <!-- <el-table-column label="货位类型" align="center" prop="warehouseLocationType" />-->
<el-table-column label="仓库名称" align="center" prop="warehouseName" /> <el-table-column label="仓库名称" align="center" prop="warehouseName" />
<el-table-column label="供应商" align="center" prop="vendorName" />
<el-table-column label="物资编码" align="center" prop="materialCode" /> <el-table-column label="物资编码" align="center" prop="materialCode" />
<el-table-column label="物资名称" align="center" prop="materialName" /> <el-table-column label="物资名称" align="center" prop="materialName" />
<el-table-column label="物资规格" align="center" prop="materialSpecifications" /> <el-table-column label="物资规格" align="center" prop="materialSpecifications" />
...@@ -342,8 +340,7 @@ ...@@ -342,8 +340,7 @@
<dict-tag :options="dict.type.material_unit" :value="scope.row.materialUnit" /> <dict-tag :options="dict.type.material_unit" :value="scope.row.materialUnit" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="供应商" align="center" prop="vendorName" /> <!-- <el-table-column label="质保期" align="center" prop="materialWarrantyPeriod" />-->
<el-table-column label="质保期" align="center" prop="materialWarrantyPeriod" />
<el-table-column label="参考价" align="center" prop="referencePrice" /> <el-table-column label="参考价" align="center" prop="referencePrice" />
<el-table-column label="销售价" align="center" prop="sellingPrice" /> <el-table-column label="销售价" align="center" prop="sellingPrice" />
<el-table-column label="库存" align="center" prop="inventory" /> <el-table-column label="库存" align="center" prop="inventory" />
...@@ -383,6 +380,7 @@ ...@@ -383,6 +380,7 @@
<!-- <el-table-column label="分类名称" align="center" prop="materialTypeName" />--> <!-- <el-table-column label="分类名称" align="center" prop="materialTypeName" />-->
<!-- <el-table-column label="货位类型" align="center" prop="warehouseLocationType" />--> <!-- <el-table-column label="货位类型" align="center" prop="warehouseLocationType" />-->
<el-table-column label="仓库名称" align="center" prop="warehouseName" /> <el-table-column label="仓库名称" align="center" prop="warehouseName" />
<el-table-column label="供应商" align="center" prop="vendorName" />
<el-table-column label="物资编码" align="center" prop="materialCode" /> <el-table-column label="物资编码" align="center" prop="materialCode" />
<el-table-column label="物资名称" align="center" prop="materialName" /> <el-table-column label="物资名称" align="center" prop="materialName" />
<el-table-column label="物资规格" align="center" prop="materialSpecifications" /> <el-table-column label="物资规格" align="center" prop="materialSpecifications" />
...@@ -391,8 +389,7 @@ ...@@ -391,8 +389,7 @@
<dict-tag :options="dict.type.material_unit" :value="scope.row.materialUnit" /> <dict-tag :options="dict.type.material_unit" :value="scope.row.materialUnit" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="供应商" align="center" prop="vendorName" /> <!-- <el-table-column label="质保期" align="center" prop="materialWarrantyPeriod" />-->
<el-table-column label="质保期" align="center" prop="materialWarrantyPeriod" />
<el-table-column label="参考价" align="center" prop="referencePrice" /> <el-table-column label="参考价" align="center" prop="referencePrice" />
<el-table-column label="销售价" align="center" prop="sellingPrice" /> <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="collectNumber" width="120px" />
...@@ -416,6 +413,7 @@ import { getRepairForm, listRepairForm } from '@/api/business/repairForm' ...@@ -416,6 +413,7 @@ import { getRepairForm, listRepairForm } from '@/api/business/repairForm'
import {customListMaterial, listMaterial} from '@/api/business/material' import {customListMaterial, listMaterial} from '@/api/business/material'
import { formatDate } from '@/utils' import { formatDate } from '@/utils'
import {listSiteWarehouse, listWarehouseAll} from "@/api/business/siteWarehouse"; import {listSiteWarehouse, listWarehouseAll} from "@/api/business/siteWarehouse";
import {listMaterialVendor, listMaterialVendorAll} from "@/api/business/materialVendor";
export default { export default {
name: "MaterialPicking", name: "MaterialPicking",
...@@ -473,6 +471,7 @@ export default { ...@@ -473,6 +471,7 @@ export default {
tempSelection: [], tempSelection: [],
// 物料列表 // 物料列表
materialList: [], materialList: [],
materialVendorOpt: [],
materialTotal: 0, materialTotal: 0,
// 查询参数 // 查询参数
queryMaterialParams: { queryMaterialParams: {
...@@ -511,6 +510,12 @@ export default { ...@@ -511,6 +510,12 @@ export default {
this.loading = false; this.loading = false;
}); });
}, },
/** 查询物资供应商列表 */
getVendorList() {
listMaterialVendorAll().then(response => {
this.materialVendorOpt = response.data;
});
},
/** 查询报修单列表 */ /** 查询报修单列表 */
getRepairList() { getRepairList() {
listRepairForm({pageNum: 1, pageSize: 1000, state: 1}).then(response => { listRepairForm({pageNum: 1, pageSize: 1000, state: 1}).then(response => {
...@@ -541,6 +546,7 @@ export default { ...@@ -541,6 +546,7 @@ export default {
}, },
/** 打开物料列表 */ /** 打开物料列表 */
openMaterialModel() { openMaterialModel() {
this.getVendorList();
if (!this.form.repairerDeptId) { if (!this.form.repairerDeptId) {
this.$modal.msgError("请先选择报修单"); this.$modal.msgError("请先选择报修单");
return return
...@@ -711,6 +717,7 @@ export default { ...@@ -711,6 +717,7 @@ export default {
this.title = "修改物料出库"; this.title = "修改物料出库";
this.getRepairList() this.getRepairList()
this.getWarehouseList(res.data.repairerDeptId) this.getWarehouseList(res.data.repairerDeptId)
this.getVendorList()
}) })
}); });
}, },
...@@ -724,9 +731,20 @@ export default { ...@@ -724,9 +731,20 @@ export default {
} }
this.form.materialList = this.form.pickingInfoList.map(item =>{ this.form.materialList = this.form.pickingInfoList.map(item =>{
return { return {
recordId: item.recordId,
infoId: item.infoId,
warehouseId: item.warehouseId, warehouseId: item.warehouseId,
warehouseName: item.warehouseName, warehouseName: item.warehouseName,
vendorId: item.vendorId,
vendorName: item.vendorName,
materialId: item.materialId, materialId: item.materialId,
materialCode: item.materialCode,
materialName: item.materialName,
materialSpecifications: item.materialSpecifications,
materialUnit: item.materialUnit,
materialWarrantyPeriod: item.materialWarrantyPeriod,
referencePrice: item.referencePrice,
sellingPrice: item.sellingPrice,
collectNumber: item.collectNumber, collectNumber: item.collectNumber,
price: item.price, price: item.price,
money: item.money, money: item.money,
......
...@@ -246,18 +246,24 @@ ...@@ -246,18 +246,24 @@
<el-table v-loading="loading" :data="form.putawayInfoList"> <el-table v-loading="loading" :data="form.putawayInfoList">
<!-- <el-table-column label="分类名称" align="center" prop="materialTypeName" />--> <!-- <el-table-column label="分类名称" align="center" prop="materialTypeName" />-->
<!-- <el-table-column label="货位类型" align="center" prop="warehouseLocationType" />--> <!-- <el-table-column label="货位类型" align="center" prop="warehouseLocationType" />-->
<el-table-column label="供应商" align="center" prop="vendorName" /> <el-table-column label="供应商" align="center" prop="vendorId" width="300">
<template slot-scope="scope">
<el-select clearable v-model="scope.row.vendorId" @change="(id) =>{vendorChange(id, scope.row)}" placeholder="请选择供应商" style="width:100%">
<el-option v-for="(item,index) of materialVendorList" :key="index" :label="item.vendorName" :value="item.id">{{item.vendorName}}</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column label="物资编码" align="center" prop="materialCode" /> <el-table-column label="物资编码" align="center" prop="materialCode" />
<el-table-column label="物资名称" align="center" prop="materialName" /> <el-table-column label="物资名称" align="center" prop="materialName" />
<el-table-column label="物资规格" align="center" prop="materialSpecifications" /> <el-table-column label="物资规格" align="center" prop="materialSpecifications" />
<el-table-column label="物资单位" align="center" prop="materialUnit"> <el-table-column label="物资单位" align="center" prop="materialUnit" width="50">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.material_unit" :value="scope.row.materialUnit" /> <dict-tag :options="dict.type.material_unit" :value="scope.row.materialUnit" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="质保期" align="center" prop="materialWarrantyPeriod" /> <el-table-column label="质保期(月)" align="center" prop="materialWarrantyPeriod" width="80"/>
<el-table-column label="参考价" align="center" prop="referencePrice" /> <el-table-column label="参考价" align="center" prop="referencePrice" width="80"/>
<el-table-column label="销售价" align="center" prop="sellingPrice" /> <el-table-column label="销售价" align="center" prop="sellingPrice" width="80"/>
<el-table-column label="入库数量" align="center" prop="putawayNumber" width="120px"> <el-table-column label="入库数量" align="center" prop="putawayNumber" width="120px">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input-number v-model="scope.row.putawayNumber" @change="putawayChange" controls-position="right" size="mini" :min="1" :precision="0" style="width: 100%" placeholder="数量"/> <el-input-number v-model="scope.row.putawayNumber" @change="putawayChange" controls-position="right" size="mini" :min="1" :precision="0" style="width: 100%" placeholder="数量"/>
...@@ -273,7 +279,7 @@ ...@@ -273,7 +279,7 @@
<el-input-number v-model="scope.row.putawayMoney" disabled controls-position="right" size="mini" :min="1" style="width: 100%" placeholder="金额"/> <el-input-number v-model="scope.row.putawayMoney" disabled controls-position="right" size="mini" :min="1" style="width: 100%" placeholder="金额"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="50">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleRowDelete(scope.row)">删除</el-button> <el-button size="mini" type="text" icon="el-icon-delete" @click="handleRowDelete(scope.row)">删除</el-button>
</template> </template>
...@@ -332,7 +338,7 @@ ...@@ -332,7 +338,7 @@
<dict-tag :options="dict.type.material_unit" :value="scope.row.materialUnit" /> <dict-tag :options="dict.type.material_unit" :value="scope.row.materialUnit" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="质保期" align="center" prop="materialWarrantyPeriod" /> <el-table-column label="质保期(月)" align="center" prop="materialWarrantyPeriod" />
<el-table-column label="参考价" align="center" prop="referencePrice" /> <el-table-column label="参考价" align="center" prop="referencePrice" />
<el-table-column label="销售价" align="center" prop="sellingPrice" /> <el-table-column label="销售价" align="center" prop="sellingPrice" />
<!-- <el-table-column label="库存" align="center" prop="inventory" />--> <!-- <el-table-column label="库存" align="center" prop="inventory" />-->
...@@ -378,7 +384,7 @@ ...@@ -378,7 +384,7 @@
<dict-tag :options="dict.type.material_unit" :value="scope.row.materialUnit" /> <dict-tag :options="dict.type.material_unit" :value="scope.row.materialUnit" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="质保期" align="center" prop="materialWarrantyPeriod" /> <el-table-column label="质保期(月)" align="center" prop="materialWarrantyPeriod" />
<el-table-column label="参考价" align="center" prop="referencePrice" /> <el-table-column label="参考价" align="center" prop="referencePrice" />
<el-table-column label="销售价" align="center" prop="sellingPrice" /> <el-table-column label="销售价" align="center" prop="sellingPrice" />
<el-table-column label="入库数量" align="center" prop="putawayNumber" /> <el-table-column label="入库数量" align="center" prop="putawayNumber" />
...@@ -518,6 +524,11 @@ export default { ...@@ -518,6 +524,11 @@ export default {
this.loading = false; this.loading = false;
}); });
}, },
/* 供应商改变 */
vendorChange(id, item) {
let vendor = this.materialVendorList.find(v => v.id === id);
item.vendorName = vendor.vendorName;
},
/** /**
* 物资类型弃用 * 物资类型弃用
*/ */
...@@ -665,7 +676,7 @@ export default { ...@@ -665,7 +676,7 @@ export default {
this.open = true; this.open = true;
this.title = "添加物料入库"; this.title = "添加物料入库";
this.getWarehouseList() this.getWarehouseList()
// this.getVendorList() this.getVendorList()
}, },
/** 详情按钮操作 */ /** 详情按钮操作 */
handleDetail(row) { handleDetail(row) {
...@@ -687,7 +698,7 @@ export default { ...@@ -687,7 +698,7 @@ export default {
this.open = true; this.open = true;
this.title = "修改物料入库"; this.title = "修改物料入库";
this.getWarehouseList() this.getWarehouseList()
// this.getVendorList() this.getVendorList()
}); });
}, },
/** 提交按钮 */ /** 提交按钮 */
......
...@@ -134,7 +134,7 @@ ...@@ -134,7 +134,7 @@
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="入库单号" prop="putawayId"> <el-form-item label="入库单号" prop="putawayId">
<el-select clearable v-model="form.putawayId" filterable placeholder="请选择入库单" @change="putawayChange" style="width:100%"> <el-select v-model="form.putawayId" filterable placeholder="请选择入库单" @change="putawayChange" style="width:100%">
<el-option v-for="(item,index) of materialPutawayOpt" :key="index" :label="item.putawayCode" :value="item.id">{{item.putawayCode}}</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-select>
</el-form-item> </el-form-item>
...@@ -220,11 +220,11 @@ ...@@ -220,11 +220,11 @@
<el-table :data="materialList" ref="selectionTable" max-height="450"> <el-table :data="materialList" ref="selectionTable" max-height="450">
<!-- <el-table-column label="分类名称" align="center" prop="materialTypeName" />--> <!-- <el-table-column label="分类名称" align="center" prop="materialTypeName" />-->
<!-- <el-table-column label="货位类型" align="center" prop="warehouseLocationType" />--> <!-- <el-table-column label="货位类型" align="center" prop="warehouseLocationType" />-->
<el-table-column label="供应商" align="center" prop="vendorName" /> <el-table-column label="供应商" align="center" prop="vendorName" fixed="left" show-overflow-tooltip width="200"/>
<el-table-column label="物资编码" align="center" prop="materialCode" /> <el-table-column label="物资编码" align="center" prop="materialCode" show-overflow-tooltip fixed="left" width="130" />
<el-table-column label="物资名称" align="center" prop="materialName" /> <el-table-column label="物资名称" align="center" prop="materialName" show-overflow-tooltip fixed="left" width="130" />
<el-table-column label="物资规格" align="center" prop="materialSpecifications" /> <el-table-column label="物资规格" align="center" prop="materialSpecifications" fixed="left" />
<el-table-column label="物资单位" align="center" prop="materialUnit"> <el-table-column label="物资单位" align="center" prop="materialUnit" fixed="left">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.material_unit" :value="scope.row.materialUnit" /> <dict-tag :options="dict.type.material_unit" :value="scope.row.materialUnit" />
</template> </template>
...@@ -234,9 +234,15 @@ ...@@ -234,9 +234,15 @@
<el-table-column label="入库单价" align="center" prop="putawayPrice" /> <el-table-column label="入库单价" align="center" prop="putawayPrice" />
<el-table-column label="入库金额" align="center" prop="putawayMoney" /> <el-table-column label="入库金额" align="center" prop="putawayMoney" />
<el-table-column label="已退数量" align="center" prop="returnedNumber" /> <el-table-column label="已退数量" align="center" prop="returnedNumber" />
<el-table-column label="已出数量" align="center" prop="issuedNumber" />
<el-table-column label="可退数量" align="center" prop="canBackNumber">
<template slot-scope="scope">
<span>{{scope.row.putawayNumber - scope.row.returnedNumber - scope.row.issuedNumber}}</span>
</template>
</el-table-column>
<el-table-column label="退货数量" align="center" prop="returnsNumber" width="120px"> <el-table-column label="退货数量" align="center" prop="returnsNumber" width="120px">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input-number v-model="scope.row.returnsNumber" @change="returnsNumberChange" controls-position="right" size="mini" :min="1" :max="scope.row.putawayNumber - scope.row.returnedNumber" :precision="0" style="width: 100%" placeholder="数量"/> <el-input-number v-model="scope.row.returnsNumber" @change="returnsNumberChange" controls-position="right" size="mini" :min="1" :max="scope.row.putawayNumber - scope.row.returnedNumber - scope.row.issuedNumber" :precision="0" style="width: 100%" placeholder="数量"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="退货单价" align="center" prop="returnsPrice" width="120px"> <el-table-column label="退货单价" align="center" prop="returnsPrice" width="120px">
...@@ -249,7 +255,7 @@ ...@@ -249,7 +255,7 @@
<el-input-number v-model="scope.row.returnsMoney" disabled controls-position="right" size="mini" :min="1" style="width: 100%" placeholder="金额"/> <el-input-number v-model="scope.row.returnsMoney" disabled controls-position="right" size="mini" :min="1" style="width: 100%" placeholder="金额"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleRowDelete(scope.row)">删除</el-button> <el-button size="mini" type="text" icon="el-icon-delete" @click="handleRowDelete(scope.row)">删除</el-button>
</template> </template>
......
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
<el-table v-loading="loading" :data="materialList"> <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="warehouseName" />
<el-table-column label="供应商" align="center" prop="vendorName" fixed="left" show-overflow-tooltip />
<el-table-column label="物资编码" align="center" fixed="left" prop="materialCode" /> <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="materialName" />
<el-table-column label="物资规格" align="center" fixed="left" prop="materialSpecifications" /> <el-table-column label="物资规格" align="center" fixed="left" prop="materialSpecifications" />
...@@ -56,7 +57,6 @@ ...@@ -56,7 +57,6 @@
<dict-tag :options="dict.type.material_unit" :value="scope.row.materialUnit" /> <dict-tag :options="dict.type.material_unit" :value="scope.row.materialUnit" />
</template> </template>
</el-table-column> </el-table-column>
<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="procurementSubject" />-->
<el-table-column label="适用车型" align="center" prop="compatibleWith" /> <el-table-column label="适用车型" align="center" prop="compatibleWith" />
<el-table-column label="物资图片" align="center" prop="materialUrl"> <el-table-column label="物资图片" align="center" prop="materialUrl">
...@@ -149,7 +149,7 @@ import {listWarehouseAll} from "@/api/business/siteWarehouse"; ...@@ -149,7 +149,7 @@ import {listWarehouseAll} from "@/api/business/siteWarehouse";
export default { export default {
name: "Material", name: "Material",
dicts:['sys_is_enable', 'putaway_info_state', 'picking_state'], dicts:['sys_is_enable', 'putaway_info_state', 'picking_state', 'material_unit'],
components: { Treeselect }, components: { Treeselect },
data() { data() {
return { return {
......
...@@ -546,7 +546,7 @@ export default { ...@@ -546,7 +546,7 @@ export default {
vehicleModelId: undefined, vehicleModelId: undefined,
trailerDocumentNumber: undefined, trailerDocumentNumber: undefined,
repairerCompany: undefined, repairerCompany: undefined,
repairerDeptId: undefined, repairerDeptId: this.$store.state.user.userInfo.deptId,
repairerGroupId: undefined, repairerGroupId: undefined,
state: undefined, state: undefined,
maintainEndTime: undefined, maintainEndTime: undefined,
...@@ -689,12 +689,13 @@ export default { ...@@ -689,12 +689,13 @@ export default {
this.flag = this.$route.query && this.$route.query.flag; this.flag = this.$route.query && this.$route.query.flag;
if (this.flag && this.flag != 0) { if (this.flag && this.flag != 0) {
this.getDetail(); this.getDetail();
this.getMaintainUserList()
} }
}, },
methods: { methods: {
getDetail(){ getDetail(){
getRepairForm(this.repairFormId).then(response =>{ getRepairForm(this.repairFormId).then(response =>{
/* 查询维修人员列表 */
this.getMaintainUserList(response.data.repairerDeptId)
this.handleDeptChange({deptId:response.data.repairerDeptId},1) this.handleDeptChange({deptId:response.data.repairerDeptId},1)
if(response.data.repairCause){ if(response.data.repairCause){
response.data.repairCause=response.data.repairCause.split(';'); response.data.repairCause=response.data.repairCause.split(';');
...@@ -745,8 +746,8 @@ export default { ...@@ -745,8 +746,8 @@ export default {
} }
}, },
/** 查询人员-人员列表 */ /** 查询人员-人员列表 */
getMaintainUserList() { getMaintainUserList(deptId) {
listUser({ type: 1, pageNum: 1, pageSize: 100 }).then(response => { listUser({ type: 1, pageNum: 1, pageSize: 100, deptId }).then(response => {
this.maintainUserList = response.rows; this.maintainUserList = response.rows;
}); });
}, },
......
...@@ -50,8 +50,8 @@ ...@@ -50,8 +50,8 @@
<el-table-column type="expand"> <el-table-column type="expand">
<template slot-scope="props"> <template slot-scope="props">
<el-table :data="props.row.pickingInfoList"> <el-table :data="props.row.pickingInfoList">
<el-table-column label="分类名称" align="center" prop="materialTypeName" /> <!-- <el-table-column label="分类名称" align="center" prop="materialTypeName" />-->
<el-table-column label="货位类型" align="center" prop="warehouseLocationType" /> <!-- <el-table-column label="货位类型" align="center" prop="warehouseLocationType" />-->
<el-table-column label="供应商" align="center" prop="vendorName" /> <el-table-column label="供应商" align="center" prop="vendorName" />
<el-table-column label="物资编码" align="center" prop="materialCode" /> <el-table-column label="物资编码" align="center" prop="materialCode" />
<el-table-column label="物资名称" align="center" prop="materialName" /> <el-table-column label="物资名称" align="center" prop="materialName" />
...@@ -137,6 +137,7 @@ ...@@ -137,6 +137,7 @@
<el-form-item label="结算时间" prop="settlementTime"> <el-form-item label="结算时间" prop="settlementTime">
<el-date-picker clearable <el-date-picker clearable
v-model="form.settlementTime" v-model="form.settlementTime"
style="width: 100%"
type="datetime" type="datetime"
value-format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择结算时间"> placeholder="请选择结算时间">
...@@ -154,7 +155,7 @@ ...@@ -154,7 +155,7 @@
<el-row> <el-row>
<el-col :span="6"> <el-col :span="6">
<el-form-item label="结算方式" prop="settlementType"> <el-form-item label="结算方式" prop="settlementType">
<el-select v-model="form.settlementType" placeholder="请选择结算方式"> <el-select v-model="form.settlementType" style="width: 100%" placeholder="请选择结算方式">
<el-option v-for="item in dict.type.settlement_material_type" :key="item.value" :value="item.value" :label="item.label" /> <el-option v-for="item in dict.type.settlement_material_type" :key="item.value" :value="item.value" :label="item.label" />
</el-select> </el-select>
</el-form-item> </el-form-item>
......
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