Commit 676c8c98 authored by 刘帅's avatar 刘帅

1.盘点增加初始化

parent 92138d25
......@@ -60,6 +60,14 @@ public class ErpMaterialController extends BaseController {
return iErpMaterialService.customQueryPageList(bo, pageQuery);
}
/**
* 查询物资列表根据仓库ID
*/
@GetMapping("/customListByWarehouseId")
public R<List<ErpMaterialVo>> customQueryListByWarehouseId(ErpMaterialBo bo) {
return R.ok(iErpMaterialService.customQueryListByWarehouseId(bo));
}
/**
* 查询物资列表(全部)
*/
......
......@@ -120,4 +120,14 @@ public class ErpMaterialCheckVo implements Serializable {
*/
private List<ErpMaterialCheckInfoVo> checkInfoList;
/**
* 盘点明细列表(盘亏)
*/
private List<ErpMaterialCheckInfoVo> checkInfoLoseList;
/**
* 盘点明细列表(盘盈)
*/
private List<ErpMaterialCheckInfoVo> checkInfoJustList;
}
......@@ -43,7 +43,7 @@ public class ErpPostVo implements Serializable {
/**
* 类型(1维修 2管理)
*/
@ExcelProperty(value = "岗位类型")
@ExcelProperty(value = "岗位类型", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "post_type")
private Integer type;
......
......@@ -10,6 +10,8 @@ import com.maintain.business.domain.vo.ErpMaterialVo;
import com.maintain.common.core.mapper.BaseMapperPlus;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 物资Mapper接口
*
......@@ -35,4 +37,12 @@ public interface ErpMaterialMapper extends BaseMapperPlus<ErpMaterialMapper, Erp
*/
Page<ErpMaterialVo> customQueryPageListByWarehouseId(@Param("page") Page<ErpMaterial> page, @Param(Constants.WRAPPER) Wrapper<ErpMaterial> queryWrapper, @Param("warehouseId") Long warehouseId);
/**
* 根据仓库自定义查询(不分页)
* @param warehouseId
* @return
*/
List<ErpMaterialVo> customQueryListByWarehouseId(@Param("warehouseId") Long warehouseId);
}
......@@ -33,6 +33,11 @@ public interface IErpMaterialService {
*/
TableDataInfo<ErpMaterialVo> customQueryPageList(ErpMaterialBo bo, PageQuery pageQuery);
/**
* 查询物资列表根据仓库ID(不分页)
*/
List<ErpMaterialVo> customQueryListByWarehouseId(ErpMaterialBo bo);
/**
* 查询物资列表(自定义查询全部)
*/
......
......@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.maintain.business.domain.*;
import com.maintain.business.domain.bo.ErpMaterialCheckInfoBo;
import com.maintain.business.domain.vo.ErpMaterialCheckInfoVo;
import com.maintain.business.domain.vo.ErpMaterialInventoryRecordVo;
import com.maintain.business.domain.vo.ErpWarehouseVo;
import com.maintain.business.mapper.*;
......@@ -65,7 +66,19 @@ public class ErpMaterialCheckServiceImpl implements IErpMaterialCheckService {
ErpMaterialCheckVo checkVo = baseMapper.selectVoById(id);
LambdaQueryWrapper<ErpMaterialCheckInfo> lqw = Wrappers.lambdaQuery();
lqw.eq(ErpMaterialCheckInfo::getCheckId, id);
checkVo.setCheckInfoList(checkInfoMapper.selectVoList(lqw));
List<ErpMaterialCheckInfoVo> checkInfoVoList = checkInfoMapper.selectVoList(lqw);
checkVo.setCheckInfoList(checkInfoVoList);
List<ErpMaterialCheckInfoVo> checkInfoJustList = new ArrayList<>();
List<ErpMaterialCheckInfoVo> checkInfoLoseList = new ArrayList<>();
for (ErpMaterialCheckInfoVo infoVo : checkInfoVoList) {
if (infoVo.getResultState() == 1) {
checkInfoJustList.add(infoVo);
}else if (infoVo.getResultState() == 2) {
checkInfoLoseList.add(infoVo);
}
}
checkVo.setCheckInfoJustList(checkInfoJustList);
checkVo.setCheckInfoLoseList(checkInfoLoseList);
return checkVo;
}
......
......@@ -64,10 +64,29 @@ public class ErpMaterialServiceImpl implements IErpMaterialService {
*/
@Override
public TableDataInfo<ErpMaterialVo> customQueryPageList(ErpMaterialBo bo, PageQuery pageQuery) {
Page<ErpMaterialVo> result = baseMapper.customQueryPageList(pageQuery.build(), this.customBuildQueryWrapper(bo));
QueryWrapper<ErpMaterial> query = Wrappers.query();
query.like(null != bo.getVendorName(), "t.vendor_name", bo.getVendorName())
.like(null != bo.getMaterialName(), "t.material_name", bo.getMaterialName())
.like(null != bo.getMaterialCode(), "t.material_code", bo.getMaterialCode())
.like(null != bo.getMaterialSpecifications(), "t.material_specifications", bo.getMaterialSpecifications())
.like(null != bo.getWarehouseName(), "t.name", bo.getWarehouseName())
.eq(null != bo.getWarehouseId(), "t.warehouse_id", bo.getWarehouseId())
.in(null != bo.getWarehouseIdList(), "t.warehouse_id", bo.getWarehouseIdList())
.ge(null != bo.getInventory(), "t.inventory", bo.getInventory());
Page<ErpMaterialVo> result = baseMapper.customQueryPageList(pageQuery.build(), query);
return TableDataInfo.build(result);
}
/**
* 查询物资列表根据仓库ID(不分页)
*
* @param bo
*/
@Override
public List<ErpMaterialVo> customQueryListByWarehouseId(ErpMaterialBo bo) {
return baseMapper.customQueryListByWarehouseId(bo.getWarehouseId());
}
/**
* 查询物资列表(自定义查询全部)
*
......
......@@ -105,6 +105,55 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
) bac ON m.id = bac.material_id
${ew.getCustomSqlSegment}
</select>
<select id="customQueryListByWarehouseId" resultType="com.maintain.business.domain.vo.ErpMaterialVo">
SELECT
m.id AS material_id,
m.material_code,
m.material_name,
m.material_specifications,
m.vendor_id,
m.vendor_name,
m.material_unit,
m.material_brand,
m.procurement_subject,
m.compatible_with,
m.material_warranty_period,
m.reference_price,
m.selling_price,
m.material_url,
IFNULL(put.putNumber, 0) - IFNULL(ret.retNumber, 0) - IFNULL(pic.picNumber, 0) + IFNULL(bac.bacNumber, 0) AS inventory
FROM
erp_material m
LEFT JOIN (
SELECT material_id, SUM(number) AS putNumber
FROM erp_material_inventory_record
WHERE type = '1' AND warehouse_id = #{warehouseId}
GROUP BY material_id
) put ON m.id = put.material_id
LEFT JOIN (
SELECT material_id, SUM(number) AS retNumber
FROM erp_material_inventory_record
WHERE type = '2' AND warehouse_id = #{warehouseId}
GROUP BY material_id
) ret ON m.id = ret.material_id
LEFT JOIN (
SELECT material_id, SUM(number) AS picNumber
FROM erp_material_inventory_record
WHERE type = '3' AND warehouse_id = #{warehouseId}
GROUP BY material_id
) pic ON m.id = pic.material_id
LEFT JOIN (
SELECT material_id, SUM(number) AS bacNumber
FROM erp_material_inventory_record
WHERE type = '4' AND warehouse_id = #{warehouseId}
GROUP BY material_id
) bac ON m.id = bac.material_id
WHERE
put.putNumber IS NOT NULL OR
ret.retNumber IS NOT NULL OR
pic.picNumber IS NOT NULL OR
bac.bacNumber IS NOT NULL
</select>
</mapper>
......@@ -27,6 +27,15 @@ export function customListAll(query) {
})
}
// 查询物资列表(自定义查询用于物料盘点初始化)
export function customListAllByWarehouseId(query) {
return request({
url: '/business/material/customListByWarehouseId',
method: 'get',
params: query
})
}
// 查询物资库存列表
export function listMaterialInventory(query) {
return request({
......
......@@ -583,10 +583,8 @@ export default {
this.reset();
this.open = true;
this.title = "添加物资";
this.getTypeList();
this.getVendorList();
this.getWarehouseList();
this.getWarehouseLocationList();
},
/** 修改按钮操作 */
handleUpdate(row) {
......
......@@ -249,6 +249,9 @@
<el-col :span="1.5">
<el-button v-loading="infoLoading" type="primary" plain icon="el-icon-plus" size="mini" @click="openMaterialModel">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button v-loading="infoLoading" type="primary" plain icon="el-icon-plus" size="mini" @click="openMaterialInit">初始化</el-button>
</el-col>
</el-row>
<el-divider />
<el-table v-loading="infoLoading" :data="form.checkInfoList">
......@@ -373,6 +376,8 @@
</el-descriptions>
<span style="font-weight: bold; font-size: 18px">盘点明细</span>
<el-divider />
<el-tabs v-model="activeName">
<el-tab-pane label="全部" name="all">
<el-table :data="form.checkInfoList">
<el-table-column label="物资编码" align="center" prop="materialCode" />
<el-table-column label="物资名称" align="center" prop="materialName" />
......@@ -386,14 +391,63 @@
<el-table-column label="质保期" align="center" prop="materialWarrantyPeriod" />
<el-table-column label="库存" align="center" prop="inventory" />
<el-table-column label="实盘数量" align="center" prop="checkNum" width="140px" />
<!-- <el-table-column label="期间出库数量" align="center" prop="periodOutNum" width="140px" />-->
<!-- <el-table-column label="结果数量" align="center" prop="resultNum" width="120px" />-->
<!-- <el-table-column label="期间出库数量" align="center" prop="periodOutNum" width="140px" />-->
<!-- <el-table-column label="结果数量" align="center" prop="resultNum" width="120px" />-->
<el-table-column label="盘点结果" align="center" prop="resultState">
<template slot-scope="scope">
<dict-tag :options="dict.type.check_info_state" :value="scope.row.resultState"/>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
<el-tab-pane label="盘盈" name="just">
<el-table :data="form.checkInfoJustList">
<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">
<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="vendorName" />
<el-table-column label="质保期" align="center" prop="materialWarrantyPeriod" />
<el-table-column label="库存" align="center" prop="inventory" />
<el-table-column label="实盘数量" align="center" prop="checkNum" width="140px" />
<!-- <el-table-column label="期间出库数量" align="center" prop="periodOutNum" width="140px" />-->
<!-- <el-table-column label="结果数量" align="center" prop="resultNum" width="120px" />-->
<el-table-column label="盘点结果" align="center" prop="resultState">
<template slot-scope="scope">
<dict-tag :options="dict.type.check_info_state" :value="scope.row.resultState"/>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
<el-tab-pane label="盘亏" name="lose">
<el-table :data="form.checkInfoLoseList">
<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">
<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="vendorName" />
<el-table-column label="质保期" align="center" prop="materialWarrantyPeriod" />
<el-table-column label="库存" align="center" prop="inventory" />
<el-table-column label="实盘数量" align="center" prop="checkNum" width="140px" />
<!-- <el-table-column label="期间出库数量" align="center" prop="periodOutNum" width="140px" />-->
<!-- <el-table-column label="结果数量" align="center" prop="resultNum" width="120px" />-->
<el-table-column label="盘点结果" align="center" prop="resultState">
<template slot-scope="scope">
<dict-tag :options="dict.type.check_info_state" :value="scope.row.resultState"/>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
</el-tabs>
</el-dialog>
</div>
</template>
......@@ -410,7 +464,7 @@ import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import { getSiteTree } from '@/api/business/unit'
import {listSiteWarehouse, listWarehouseAll} from '@/api/business/siteWarehouse'
import {customListAll, listMaterial} from '@/api/business/material'
import {customListAll, customListAllByWarehouseId, listMaterial} from '@/api/business/material'
import { formatDate } from '@/utils'
export default {
......@@ -419,6 +473,7 @@ export default {
dicts: ['check_state', 'check_type', 'check_state', 'check_info_state', 'material_unit'],
data() {
return {
activeName: 'all',
// 按钮loading
materialLoading: false,
// 按钮loading
......@@ -606,7 +661,9 @@ export default {
updateBy: undefined,
updateTime: undefined,
createDeptId: undefined,
checkInfoList: []
checkInfoList: [],
checkInfoJustList: [],
checkInfoLoseList: []
};
this.resetForm("form");
},
......@@ -636,6 +693,15 @@ export default {
this.open2 = true
this.getMaterialList()
},
/* 初始化 */
openMaterialInit() {
if (!this.form.warehouseId) {
this.$modal.msgError("请先选择要盘点的仓库");
}
customListAllByWarehouseId({warehouseId: this.form.warehouseId}).then(response => {
this.form.checkInfoList = response.data;
})
},
/** 搜索按钮操作 */
handleMaterialQuery() {
this.queryMaterialParams.pageNum = 1;
......
......@@ -625,7 +625,7 @@ export default {
arrivalNumber: undefined,
putawayNumber: undefined,
putawayType: undefined,
putawayTime: undefined,
putawayTime: formatDate(new Date().getTime()),
putawayMoney: undefined,
returnNumber: undefined,
returnTime: undefined,
......
......@@ -107,13 +107,13 @@
icon="el-icon-document"
@click="handleDetail(scope.row)"
>详情</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['business:materialReturns:remove']"
>删除</el-button>
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-delete"-->
<!-- @click="handleDelete(scope.row)"-->
<!-- v-hasPermi="['business:materialReturns:remove']"-->
<!-- >删除</el-button>-->
</template>
</el-table-column>
</el-table>
......@@ -144,13 +144,11 @@
<el-input v-model="form.warehouseName" disabled placeholder="请输入仓库名称" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="入库类型" prop="warehouseName">
<el-input v-model="form.warehouseName" disabled placeholder="请选择入库类型" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<!-- <el-col :span="8">-->
<!-- <el-form-item label="入库类型" prop="warehouseName">-->
<!-- <el-input v-model="form.warehouseName" disabled placeholder="请选择入库类型" />-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<el-col :span="8">
<el-form-item label="入库时间" prop="putawayTime">
<el-date-picker clearable
......@@ -163,6 +161,13 @@
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="退货单号" prop="returnsNumber">
<el-input v-model="form.returnsNumber" disabled placeholder="自动生成" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="订单单号" prop="orderNumber">
<el-input v-model="form.orderNumber" disabled placeholder="请输入订单单号" />
......@@ -176,13 +181,19 @@
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="入库金额" prop="putawayMoney">
<el-input v-model="form.putawayMoney" disabled placeholder="请输入入库金额" />
<el-form-item label="退货时间" prop="returnsTime">
<el-date-picker clearable
v-model="form.returnsTime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
style="width: 100%"
placeholder="请选择退货时间">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="退货单号" prop="returnsNumber">
<el-input v-model="form.returnsNumber" disabled placeholder="自动生成" />
<el-form-item label="入库金额" prop="putawayMoney">
<el-input v-model="form.putawayMoney" disabled placeholder="请输入入库金额" />
</el-form-item>
</el-col>
<el-col :span="8">
......@@ -192,17 +203,6 @@
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="退货时间" prop="returnsTime">
<el-date-picker clearable
v-model="form.returnsTime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
style="width: 100%"
placeholder="请选择退货时间">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="操作人" prop="createBy">
<el-input v-model="form.createBy" placeholder="请输入操作人" disabled />
......@@ -416,7 +416,7 @@ export default {
id: undefined,
returnsCode: undefined,
returnsMoney: undefined,
returnsTime: undefined,
returnsTime: formatDate(new Date().getTime()),
putawayId: undefined,
putawayNumber: undefined,
orderNumber: undefined,
......
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