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

1.优化

parent 27943d29
......@@ -37,13 +37,21 @@ 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("/inventoryList")
public TableDataInfo<ErpMaterialInventoryRecordVo> inventoryList(ErpMaterialInventoryRecordBo bo, PageQuery pageQuery) {
return iErpMaterialInventoryRecordService.customQueryPageInventoryList(bo, pageQuery);
}
/**
* 查询物料库存记录列表
*/
......
......@@ -46,6 +46,10 @@ public class ErpMaterialInventoryRecord extends BaseEntity {
* 仓库ID
*/
private Long warehouseId;
/**
* 供应商ID
*/
private Long vendorId;
/**
* 数量
*/
......
......@@ -37,22 +37,6 @@ public class ErpMaterialPickingInfo extends BaseEntity {
* 出库单ID
*/
private Long pickingId;
/**
* 物资分类ID
*/
private Long materialTypeId;
/**
* 物资分类名称
*/
private String materialTypeName;
/**
* 仓库货位类型
*/
private String warehouseLocationType;
/**
* 仓库货位ID
*/
private Long warehouseLocationId;
/**
* 仓库ID
*/
......@@ -113,6 +97,18 @@ public class ErpMaterialPickingInfo extends BaseEntity {
* 出库金额
*/
private BigDecimal money;
/**
* 记录ID
*/
private Long recordId;
/**
* 入库单价(铺货结算)
*/
private BigDecimal putawayPrice;
/**
* 入库金额(铺货结算)
*/
private BigDecimal putawayMoney;
/**
* 状态(1已领料 2已退料)
*/
......
......@@ -112,6 +112,10 @@ public class ErpMaterialPutawayInfo extends BaseEntity {
* 已退数量
*/
private BigDecimal returnedNumber;
/**
* 已出数量
*/
private BigDecimal issuedNumber;
/**
* 状态(1登记中 2已入库)
*/
......
......@@ -11,6 +11,8 @@ import javax.validation.constraints.*;
import java.util.Date;
import java.math.BigDecimal;
import java.util.List;
import com.maintain.common.core.domain.BaseEntity;
/**
......@@ -78,10 +80,21 @@ public class ErpMaterialInventoryRecordBo extends BaseEntity {
private Long warehouseId;
/**
* 仓库ID
* 仓库ID列表
*/
private List<Long> warehouseIdList;
/**
* 仓库名称
*/
private String warehouseName;
/**
* 供应商ID
*/
@NotNull(message = "供应商ID不能为空", groups = { AddGroup.class, EditGroup.class })
private Long vendorId;
/**
* 数量
*/
......
......@@ -118,7 +118,7 @@ public class ErpMaterialPickingBo extends BaseEntity {
private Date outTime;
@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 {
@NotNull(message = "出库单ID不能为空", groups = { AddGroup.class, EditGroup.class })
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
*/
......
......@@ -27,6 +27,11 @@ public class ErpMaterialInventoryRecordVo implements Serializable {
*/
private Long id;
/**
* 主键
*/
private Long recordId;
/**
* 明细ID(入库|退货|出库|退料)
*/
......@@ -62,7 +67,6 @@ public class ErpMaterialInventoryRecordVo implements Serializable {
/**
* 物料ID
*/
@ExcelProperty(value = "物料ID")
private Long materialId;
/**
......
......@@ -67,7 +67,6 @@ public class ErpMaterialPickingInfoVo implements Serializable {
/**
* 供应商ID
*/
@ExcelProperty(value = "供应商ID")
private Long vendorId;
/**
......@@ -141,6 +140,21 @@ public class ErpMaterialPickingInfoVo implements Serializable {
@ExcelProperty(value = "出库金额")
private BigDecimal money;
/**
* 记录ID
*/
private Long recordId;
/**
* 入库单价(铺货结算)
*/
private BigDecimal putawayPrice;
/**
* 入库金额(铺货结算)
*/
private BigDecimal putawayMoney;
/**
* 状态(1已领料 2已退料)
*/
......@@ -160,6 +174,11 @@ public class ErpMaterialPickingInfoVo implements Serializable {
@ExcelProperty(value = "创建时间")
private Date createTime;
/**
* 库存
*/
private BigDecimal inventory;
/**
* 可选价格列表
*/
......
......@@ -169,6 +169,12 @@ public class ErpMaterialPutawayInfoVo implements Serializable {
@ExcelProperty(value = "已退数量")
private BigDecimal returnedNumber;
/**
* 已出数量
*/
@ExcelProperty(value = "已出数量")
private BigDecimal issuedNumber;
/**
* 状态(1登记中 2已入库)
*/
......
......@@ -37,6 +37,21 @@ public interface ErpMaterialInventoryRecordMapper extends BaseMapperPlus<ErpMate
*/
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 {
TableDataInfo<ErpMaterialInventoryRecordVo> queryPageList(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
}
/**
* 查询物料库存记录列表(自定义查询)
* 查询物料汇总记录列表(自定义查询)
*
* @param bo
* @param pageQuery
......@@ -74,6 +74,27 @@ public class ErpMaterialInventoryRecordServiceImpl implements IErpMaterialInvent
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);
}
/**
* 查询物料库存记录列表
*/
......
......@@ -127,6 +127,8 @@ public class ErpMaterialPutawayServiceImpl implements IErpMaterialPutawayService
putawayInfo.setMaterialId(material.getId());
putawayInfo.setPutawayId(add.getId());
putawayInfo.setState(bo.getState());
putawayInfo.setVendorId(item.getVendorId());
putawayInfo.setVendorName(item.getVendorName());
return putawayInfo;
}).collect(Collectors.toList());
putawayInfoMapper.insertBatch(collect);
......@@ -139,6 +141,7 @@ public class ErpMaterialPutawayServiceImpl implements IErpMaterialPutawayService
record.setMaterialId(item.getMaterialId());
record.setWarehouseId(warehouseVo.getId());
record.setDeptId(warehouseVo.getDeptId());
record.setVendorId(item.getVendorId());
record.setNumber(item.getPutawayNumber());
record.setPrice(item.getPutawayPrice());
record.setMoney(item.getPutawayMoney());
......@@ -188,6 +191,7 @@ public class ErpMaterialPutawayServiceImpl implements IErpMaterialPutawayService
if (null != warehouseVo) {
record.setDeptId(warehouseVo.getDeptId());
}
record.setVendorId(item.getVendorId());
record.setNumber(item.getPutawayNumber());
record.setPrice(item.getPutawayPrice());
record.setMoney(item.getPutawayMoney());
......@@ -229,6 +233,8 @@ public class ErpMaterialPutawayServiceImpl implements IErpMaterialPutawayService
ErpMaterial material = materialMapper.selectById(item.getMaterialId());
BeanUtil.copyProperties(material, putawayInfo);
putawayInfo.setId(null);
putawayInfo.setVendorId(item.getVendorId());
putawayInfo.setVendorName(item.getVendorName());
putawayInfo.setMaterialId(material.getId());
putawayInfo.setPutawayId(update.getId());
putawayInfo.setState(bo.getState());
......
......@@ -137,6 +137,10 @@ public class ErpMaterialReturnsServiceImpl implements IErpMaterialReturnsService
BeanUtil.copyProperties(putawayInfo, returnsInfo);
returnsInfo.setId(null);
returnsInfo.setReturnsId(materialReturns.getId());
returnsInfo.setCreateTime(null);
returnsInfo.setCreateBy(null);
returnsInfo.setUpdateTime(null);
returnsInfo.setUpdateBy(null);
return returnsInfo;
}).collect(Collectors.toList());
materialReturnsInfoMapper.insertBatch(collect);
......@@ -148,6 +152,7 @@ public class ErpMaterialReturnsServiceImpl implements IErpMaterialReturnsService
record.setMaterialId(item.getMaterialId());
record.setWarehouseId(warehouseVo.getId());
record.setDeptId(warehouseVo.getDeptId());
record.setVendorId(item.getVendorId());
record.setNumber(item.getReturnsNumber());
record.setPrice(item.getReturnsPrice());
record.setMoney(item.getReturnsMoney());
......@@ -200,6 +205,10 @@ public class ErpMaterialReturnsServiceImpl implements IErpMaterialReturnsService
BeanUtil.copyProperties(putawayInfo, returnsInfo);
returnsInfo.setId(null);
returnsInfo.setReturnsId(materialReturns.getId());
returnsInfo.setCreateTime(null);
returnsInfo.setCreateBy(null);
returnsInfo.setUpdateTime(null);
returnsInfo.setUpdateBy(null);
return returnsInfo;
}).collect(Collectors.toList());
materialReturnsInfoMapper.insertBatch(collect);
......@@ -211,6 +220,7 @@ public class ErpMaterialReturnsServiceImpl implements IErpMaterialReturnsService
record.setMaterialId(item.getMaterialId());
record.setWarehouseId(warehouseVo.getId());
record.setDeptId(warehouseVo.getDeptId());
record.setVendorId(item.getVendorId());
record.setNumber(item.getReturnsNumber());
record.setPrice(item.getReturnsPrice());
record.setMoney(item.getReturnsMoney());
......
......@@ -36,11 +36,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
r.type,
w.name as warehouseName,
r.material_id,
r.vendor_id,
v.vendor_name,
m.material_code,
m.material_name,
m.material_specifications,
m.vendor_id,
m.vendor_name,
m.material_unit,
m.material_brand,
m.procurement_subject,
......@@ -55,32 +55,91 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
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
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
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
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
GROUP BY warehouse_id, material_id, vendor_id) put
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, vendor_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
GROUP BY warehouse_id, material_id, vendor_id) ret
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, vendor_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
GROUP BY warehouse_id, material_id, vendor_id) pic
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, vendor_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
GROUP BY warehouse_id, material_id, vendor_id) bac
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, r.vendor_id
) t
</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">
<include refid="custom"/>
${ew.getCustomSqlSegment}
......@@ -128,6 +187,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="custom"/>
WHERE t.warehouse_id = #{warehouseId} AND t.material_id = #{materialId}
</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>
......@@ -31,41 +31,38 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
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
SELECT
r.warehouse_id, w.name as warehouse_name, r.material_id, r.vendor_id, v.vendor_name, 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,
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 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
WHERE type = '1'
GROUP BY warehouse_id, material_id, vendor_id) put
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, vendor_id, SUM(number) AS retNumber
FROM erp_material_inventory_record
WHERE type = '2'
GROUP BY warehouse_id, material_id, vendor_id) ret
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, vendor_id, SUM(number) AS picNumber
FROM erp_material_inventory_record
WHERE type = '3'
GROUP BY warehouse_id, material_id, vendor_id) pic
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, vendor_id, SUM(number) AS bacNumber
FROM erp_material_inventory_record
WHERE type = '4'
GROUP BY warehouse_id, material_id, vendor_id) bac
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, r.vendor_id
) t
</sql>
<select id="customQueryPageList" resultType="com.maintain.business.domain.vo.ErpMaterialVo">
......@@ -85,19 +82,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE type = '1' AND warehouse_id = #{warehouseId}
GROUP BY warehouse_id, material_id
) put ON m.id = put.material_id
LEFT JOIN(
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(
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(
LEFT JOIN(
SELECT warehouse_id, material_id, SUM(number) AS bacNumber
FROM erp_material_inventory_record
WHERE type = '4' AND warehouse_id = #{warehouseId}
......
......@@ -9,10 +9,19 @@ export function listMaterial(query) {
})
}
// 查询物资列表(自定义查询用于查询库存大于0的物料)
// export function customListMaterial(query) {
// return request({
// url: '/business/material/customList',
// method: 'get',
// params: query
// })
// }
// 查询物资列表(自定义查询用于查询库存大于0的物料)
export function customListMaterial(query) {
return request({
url: '/business/material/customList',
url: '/business/materialInventoryRecord/inventoryList',
method: 'get',
params: query
})
......
......@@ -62,6 +62,7 @@
<!-- <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="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" />
......@@ -70,7 +71,6 @@
<dict-tag :options="dict.type.material_unit" :value="scope.row.materialUnit" />
</template>
</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="referencePrice" />
<el-table-column label="销售价" align="center" prop="sellingPrice" />
......@@ -140,6 +140,7 @@
<!-- <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="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" />
......@@ -148,7 +149,6 @@
<dict-tag :options="dict.type.material_unit" :value="scope.row.materialUnit" />
</template>
</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="referencePrice" />
<el-table-column label="销售价" align="center" prop="sellingPrice" />
......@@ -384,6 +384,8 @@ export default {
warehouseId: item.warehouseId,
warehouseName: item.warehouseName,
materialId: item.materialId,
vendorId: item.vendorId,
vendorName: item.vendorName,
collectNumber: item.collectNumber,
price: item.price,
money: item.money,
......
......@@ -251,6 +251,7 @@
</el-row>
<el-table :data="form.pickingInfoList">
<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="materialName" />
<el-table-column label="物资规格" align="center" prop="materialSpecifications" />
......@@ -259,7 +260,6 @@
<dict-tag :options="dict.type.material_unit" :value="scope.row.materialUnit" />
</template>
</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="referencePrice" />
<el-table-column label="销售价" align="center" prop="sellingPrice" />
......@@ -300,13 +300,10 @@
<!-- <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"
placeholder="请输入供应商名称"
clearable
@keyup.enter.native="handleMaterialQuery"
/>
<el-form-item label="供应商" prop="vendorId">
<el-select v-model="queryMaterialParams.vendorId" filterable placeholder="请选择供应商" style="width: 100%">
<el-option v-for="item in materialVendorOpt" :key="item.id" :value="item.id" :label="item.vendorName" />
</el-select>
</el-form-item>
<el-form-item label="物资编码" prop="materialCode">
<el-input
......@@ -334,6 +331,7 @@
<!-- <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="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" />
......@@ -342,8 +340,7 @@
<dict-tag :options="dict.type.material_unit" :value="scope.row.materialUnit" />
</template>
</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="sellingPrice" />
<el-table-column label="库存" align="center" prop="inventory" />
......@@ -383,6 +380,7 @@
<!-- <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="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" />
......@@ -391,8 +389,7 @@
<dict-tag :options="dict.type.material_unit" :value="scope.row.materialUnit" />
</template>
</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="sellingPrice" />
<el-table-column label="数量" align="center" prop="collectNumber" width="120px" />
......@@ -416,6 +413,7 @@ import { getRepairForm, listRepairForm } from '@/api/business/repairForm'
import {customListMaterial, listMaterial} from '@/api/business/material'
import { formatDate } from '@/utils'
import {listSiteWarehouse, listWarehouseAll} from "@/api/business/siteWarehouse";
import {listMaterialVendor, listMaterialVendorAll} from "@/api/business/materialVendor";
export default {
name: "MaterialPicking",
......@@ -473,6 +471,7 @@ export default {
tempSelection: [],
// 物料列表
materialList: [],
materialVendorOpt: [],
materialTotal: 0,
// 查询参数
queryMaterialParams: {
......@@ -511,6 +510,12 @@ export default {
this.loading = false;
});
},
/** 查询物资供应商列表 */
getVendorList() {
listMaterialVendorAll().then(response => {
this.materialVendorOpt = response.data;
});
},
/** 查询报修单列表 */
getRepairList() {
listRepairForm({pageNum: 1, pageSize: 1000, state: 1}).then(response => {
......@@ -541,6 +546,7 @@ export default {
},
/** 打开物料列表 */
openMaterialModel() {
this.getVendorList();
if (!this.form.repairerDeptId) {
this.$modal.msgError("请先选择报修单");
return
......@@ -711,6 +717,7 @@ export default {
this.title = "修改物料出库";
this.getRepairList()
this.getWarehouseList(res.data.repairerDeptId)
this.getVendorList()
})
});
},
......@@ -724,9 +731,20 @@ export default {
}
this.form.materialList = this.form.pickingInfoList.map(item =>{
return {
recordId: item.recordId,
infoId: item.infoId,
warehouseId: item.warehouseId,
warehouseName: item.warehouseName,
vendorId: item.vendorId,
vendorName: item.vendorName,
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,
price: item.price,
money: item.money,
......
......@@ -246,18 +246,24 @@
<el-table v-loading="loading" :data="form.putawayInfoList">
<!-- <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="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="materialName" />
<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">
<dict-tag :options="dict.type.material_unit" :value="scope.row.materialUnit" />
</template>
</el-table-column>
<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="materialWarrantyPeriod" width="80"/>
<el-table-column label="参考价" align="center" prop="referencePrice" width="80"/>
<el-table-column label="销售价" align="center" prop="sellingPrice" width="80"/>
<el-table-column label="入库数量" align="center" prop="putawayNumber" width="120px">
<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="数量"/>
......@@ -273,7 +279,7 @@
<el-input-number v-model="scope.row.putawayMoney" disabled controls-position="right" size="mini" :min="1" style="width: 100%" placeholder="金额"/>
</template>
</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">
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleRowDelete(scope.row)">删除</el-button>
</template>
......@@ -332,7 +338,7 @@
<dict-tag :options="dict.type.material_unit" :value="scope.row.materialUnit" />
</template>
</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="sellingPrice" />
<!-- <el-table-column label="库存" align="center" prop="inventory" />-->
......@@ -378,7 +384,7 @@
<dict-tag :options="dict.type.material_unit" :value="scope.row.materialUnit" />
</template>
</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="sellingPrice" />
<el-table-column label="入库数量" align="center" prop="putawayNumber" />
......@@ -518,6 +524,11 @@ export default {
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 {
this.open = true;
this.title = "添加物料入库";
this.getWarehouseList()
// this.getVendorList()
this.getVendorList()
},
/** 详情按钮操作 */
handleDetail(row) {
......@@ -687,7 +698,7 @@ export default {
this.open = true;
this.title = "修改物料入库";
this.getWarehouseList()
// this.getVendorList()
this.getVendorList()
});
},
/** 提交按钮 */
......
......@@ -134,7 +134,7 @@
<el-row>
<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-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-select>
</el-form-item>
......@@ -220,11 +220,11 @@
<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" />
<el-table-column label="物资规格" align="center" prop="materialSpecifications" />
<el-table-column label="物资单位" align="center" prop="materialUnit">
<el-table-column label="供应商" align="center" prop="vendorName" fixed="left" show-overflow-tooltip width="200"/>
<el-table-column label="物资编码" align="center" prop="materialCode" show-overflow-tooltip fixed="left" width="130" />
<el-table-column label="物资名称" align="center" prop="materialName" show-overflow-tooltip fixed="left" width="130" />
<el-table-column label="物资规格" align="center" prop="materialSpecifications" fixed="left" />
<el-table-column label="物资单位" align="center" prop="materialUnit" fixed="left">
<template slot-scope="scope">
<dict-tag :options="dict.type.material_unit" :value="scope.row.materialUnit" />
</template>
......@@ -234,9 +234,15 @@
<el-table-column label="入库单价" align="center" prop="putawayPrice" />
<el-table-column label="入库金额" align="center" prop="putawayMoney" />
<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">
<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>
</el-table-column>
<el-table-column label="退货单价" align="center" prop="returnsPrice" width="120px">
......@@ -249,7 +255,7 @@
<el-input-number v-model="scope.row.returnsMoney" disabled controls-position="right" size="mini" :min="1" style="width: 100%" placeholder="金额"/>
</template>
</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">
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleRowDelete(scope.row)">删除</el-button>
</template>
......
......@@ -47,6 +47,7 @@
<el-table v-loading="loading" :data="materialList">
<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="materialName" />
<el-table-column label="物资规格" align="center" fixed="left" prop="materialSpecifications" />
......@@ -56,7 +57,6 @@
<dict-tag :options="dict.type.material_unit" :value="scope.row.materialUnit" />
</template>
</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="compatibleWith" />
<el-table-column label="物资图片" align="center" prop="materialUrl">
......@@ -149,7 +149,7 @@ import {listWarehouseAll} from "@/api/business/siteWarehouse";
export default {
name: "Material",
dicts:['sys_is_enable', 'putaway_info_state', 'picking_state'],
dicts:['sys_is_enable', 'putaway_info_state', 'picking_state', 'material_unit'],
components: { Treeselect },
data() {
return {
......
......@@ -546,7 +546,7 @@ export default {
vehicleModelId: undefined,
trailerDocumentNumber: undefined,
repairerCompany: undefined,
repairerDeptId: undefined,
repairerDeptId: this.$store.state.user.userInfo.deptId,
repairerGroupId: undefined,
state: undefined,
maintainEndTime: undefined,
......@@ -689,12 +689,13 @@ export default {
this.flag = this.$route.query && this.$route.query.flag;
if (this.flag && this.flag != 0) {
this.getDetail();
this.getMaintainUserList()
}
},
methods: {
getDetail(){
getRepairForm(this.repairFormId).then(response =>{
/* 查询维修人员列表 */
this.getMaintainUserList(response.data.repairerDeptId)
this.handleDeptChange({deptId:response.data.repairerDeptId},1)
if(response.data.repairCause){
response.data.repairCause=response.data.repairCause.split(';');
......@@ -745,8 +746,8 @@ export default {
}
},
/** 查询人员-人员列表 */
getMaintainUserList() {
listUser({ type: 1, pageNum: 1, pageSize: 100 }).then(response => {
getMaintainUserList(deptId) {
listUser({ type: 1, pageNum: 1, pageSize: 100, deptId }).then(response => {
this.maintainUserList = response.rows;
});
},
......
......@@ -50,8 +50,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" />
......@@ -137,6 +137,7 @@
<el-form-item label="结算时间" prop="settlementTime">
<el-date-picker clearable
v-model="form.settlementTime"
style="width: 100%"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择结算时间">
......@@ -154,7 +155,7 @@
<el-row>
<el-col :span="6">
<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-select>
</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