WMS:
原材料库存和成品库存查询优化
master
xs 3 months ago
parent baa366a81a
commit bd11b2eec2

@ -247,4 +247,6 @@ public class WmsConstants {
//原材料出库拆分标识
public static final String WMS_RAW_OUTSTOCK_SPLIT_FLAG_YES = "1";
public static final String WMS_SAFE_FLAG_YES = "1";//安全库存,是
}

@ -46,7 +46,7 @@ public class WmsRawStockController extends BaseController
public TableDataInfo list(WmsRawStock wmsRawStock)
{
startPage();
List<WmsRawStock> list = wmsRawStockService.selectWmsRawStockList(wmsRawStock);
List<WmsRawStock> list = wmsRawStockService.selectWmsRawStockJoinList(wmsRawStock);
return getDataTable(list);
}

@ -4,6 +4,9 @@ import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson2.JSONObject;
import com.hw.common.core.constant.WmsConstants;
import com.hw.wms.domain.WmsBaseWarehouse;
import com.hw.wms.service.IWmsBaseWarehouseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@ -36,6 +39,9 @@ public class WmsStockTotalController extends BaseController
@Autowired
private IWmsStockTotalService wmsStockTotalService;
@Autowired
private IWmsBaseWarehouseService wmsBaseWarehouseService;
/**
* /
*/
@ -44,10 +50,19 @@ public class WmsStockTotalController extends BaseController
public TableDataInfo list(WmsStockTotal wmsStockTotal)
{
startPage();
List<WmsStockTotal> list = wmsStockTotalService.selectWmsStockTotalList(wmsStockTotal);
List<WmsStockTotal> list = wmsStockTotalService.selectWmsStockTotalJoinList(wmsStockTotal);
return getDataTable(list);
}
@RequiresPermissions("wms:stocktotal:list")
@GetMapping("/getWarehouses")
public AjaxResult list(WmsBaseWarehouse wmsBaseWarehouse) {
wmsBaseWarehouse.setActiveFlag(WmsConstants.WMS_WAREHOUSE_ACTIVE_FLAG_YES);
List<WmsBaseWarehouse> list = wmsBaseWarehouseService.selectWmsBaseWarehouseList(wmsBaseWarehouse);
return success(list);
}
/**
* /
*/

@ -175,6 +175,9 @@ public class WmsBaseWarehouse extends BaseEntity {
@Excel(name = "是否按照线体入库 0否 1是")
private String lineFlag;
private String warehouseInstockTypeStr;
/**
*
*/
@ -425,6 +428,14 @@ public class WmsBaseWarehouse extends BaseEntity {
this.mesAreaType = mesAreaType;
}
public String getWarehouseInstockTypeStr() {
return warehouseInstockTypeStr;
}
public void setWarehouseInstockTypeStr(String warehouseInstockTypeStr) {
this.warehouseInstockTypeStr = warehouseInstockTypeStr;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

@ -114,6 +114,12 @@ public class WmsProductStock extends BaseEntity
private BigDecimal applyAmount;
private String materialSpec;
private String safeFlag;
private String stockTypeStr;
public void setProductStockId(Long productStockId)
{
this.productStockId = productStockId;
@ -332,6 +338,30 @@ public class WmsProductStock extends BaseEntity
this.applyAmount = applyAmount;
}
public String getMaterialSpec() {
return materialSpec;
}
public void setMaterialSpec(String materialSpec) {
this.materialSpec = materialSpec;
}
public String getSafeFlag() {
return safeFlag;
}
public void setSafeFlag(String safeFlag) {
this.safeFlag = safeFlag;
}
public String getStockTypeStr() {
return stockTypeStr;
}
public void setStockTypeStr(String stockTypeStr) {
this.stockTypeStr = stockTypeStr;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

@ -157,6 +157,10 @@ public class WmsRawStock extends BaseEntity {
@Excel(name = "有效标记")
private String activeFlag;
private String materialSpec;
private String saleorderCode;
public String getWarehouseName() {
return warehouseName;
}
@ -354,6 +358,22 @@ public class WmsRawStock extends BaseEntity {
",安全库存:"+(safeFlag!=null && safeFlag.equals(MesConstants.MES_ORDER_BIND_SAFE_FLAG_YES)?"是":"否")+";";
}
public String getMaterialSpec() {
return materialSpec;
}
public void setMaterialSpec(String materialSpec) {
this.materialSpec = materialSpec;
}
public String getSaleorderCode() {
return saleorderCode;
}
public void setSaleorderCode(String saleorderCode) {
this.saleorderCode = saleorderCode;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

@ -118,6 +118,9 @@ public class WmsStockTotal extends BaseEntity {
private String planDetailCode;
private String saleorderCode;
private String stockTypeStr;
public String getWarehouseName() {
return warehouseName;
@ -288,6 +291,22 @@ public class WmsStockTotal extends BaseEntity {
this.planDetailCode = planDetailCode;
}
public String getSaleorderCode() {
return saleorderCode;
}
public void setSaleorderCode(String saleorderCode) {
this.saleorderCode = saleorderCode;
}
public String getStockTypeStr() {
return stockTypeStr;
}
public void setStockTypeStr(String stockTypeStr) {
this.stockTypeStr = stockTypeStr;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

@ -100,4 +100,13 @@ public interface WmsRawStockMapper {
* @return
*/
public List<WmsRawStock> selectOnlyWmsRawStockInList(WmsRawStock wmsRawStock);
/**
* join warehousematerialsaleorder
*
* @param wmsRawStock
* @return
*/
public List<WmsRawStock> selectWmsRawStockJoinList(WmsRawStock wmsRawStock);
}

@ -80,4 +80,12 @@ public interface WmsStockTotalMapper
*/
public List<WmsStockTotal> selectWmsStockTotalJoinRealListBySaleOrder(WmsStockTotal wmsStockTotal);
/**
* ,Join warehouse,material,sale_order
*
* @param wmsStockTotal
* @return
*/
public List<WmsStockTotal> selectWmsStockTotalJoinList(WmsStockTotal wmsStockTotal);
}

@ -26,6 +26,14 @@ public interface IWmsRawStockService
* @return
*/
public List<WmsRawStock> selectWmsRawStockList(WmsRawStock wmsRawStock);
;
/**
* join warehousematerialsaleorder
*
* @param wmsRawStock
* @return
*/
public List<WmsRawStock> selectWmsRawStockJoinList(WmsRawStock wmsRawStock);
/**
*

@ -31,6 +31,14 @@ public interface IWmsStockTotalService
*/
public List<WmsStockTotal> selectWmsStockTotalList(WmsStockTotal wmsStockTotal);
/**
* ,Join warehouse,material,sale_order
*
* @param wmsStockTotal
* @return
*/
public List<WmsStockTotal> selectWmsStockTotalJoinList(WmsStockTotal wmsStockTotal);
/**
*
*

@ -6,7 +6,9 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.hw.common.core.constant.WmsConstants;
import com.hw.common.core.exception.ServiceException;
import com.hw.common.core.utils.StringUtils;
import com.hw.wms.controller.WmsProductStockController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -44,6 +46,11 @@ public class WmsProductStockServiceImpl implements IWmsProductStockService {
*/
@Override
public List<WmsProductStock> selectWmsProductStockList(WmsProductStock wmsProductStock) {
String safeFlag = wmsProductStock.getSafeFlag();
if(StringUtils.isNotEmpty(safeFlag) && safeFlag.equals(WmsConstants.WMS_SAFE_FLAG_YES)){
wmsProductStock.setSaleOrderId(0L);
wmsProductStock.setSafeFlag(null);
}
return wmsProductStockMapper.selectWmsProductStockList(wmsProductStock);
}

@ -2,6 +2,8 @@ package com.hw.wms.service.impl;
import java.util.List;
import com.hw.common.core.constant.WmsConstants;
import com.hw.common.core.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hw.wms.mapper.WmsRawStockMapper;
@ -43,6 +45,25 @@ public class WmsRawStockServiceImpl implements IWmsRawStockService {
return wmsRawStocks;
}
/**
* join warehousematerialsaleorder
*
* @param wmsRawStock
* @return
*/
@Override
public List<WmsRawStock> selectWmsRawStockJoinList(WmsRawStock wmsRawStock) {
String safeFlag = wmsRawStock.getSafeFlag();
if (StringUtils.isNotEmpty(safeFlag) && safeFlag.equals(WmsConstants.WMS_SAFE_FLAG_YES)) {
wmsRawStock.setSaleOrderId(0L);
wmsRawStock.setSafeFlag(null);
}
List<WmsRawStock> wmsRawStocks = wmsRawStockMapper.selectWmsRawStockJoinList(wmsRawStock);
;
return wmsRawStocks;
}
/**
*
*
@ -102,6 +123,7 @@ public class WmsRawStockServiceImpl implements IWmsRawStockService {
/**
* ID
*
* @param wmsRawStock
* @return
*/

@ -49,6 +49,19 @@ public class WmsStockTotalServiceImpl implements IWmsStockTotalService
return wmsStockTotalMapper.selectWmsStockTotalList(wmsStockTotal);
}
/**
* ,Join warehouse,material,sale_order
*
* @param wmsStockTotal
* @return
*/
@Override
public List<WmsStockTotal> selectWmsStockTotalJoinList(WmsStockTotal wmsStockTotal)
{
return wmsStockTotalMapper.selectWmsStockTotalJoinList(wmsStockTotal);
}
/**
*
*

@ -84,6 +84,7 @@
<where>
<if test="warehouseId != null "> and warehouse_id = #{warehouseId}</if>
<if test="warehouseInstockType != null and warehouseInstockType != ''"> and warehouse_instock_type = #{warehouseInstockType}</if>
<if test="warehouseInstockTypeStr != null and warehouseInstockTypeStr != ''"> and warehouse_instock_type in ('2','3')</if>
<if test="warehouseType != null and warehouseType != ''"> and warehouse_type = #{warehouseType}</if>
<if test="warehouseCode != null and warehouseCode != ''"> and warehouse_code = #{warehouseCode}</if>
<if test="warehouseName != null and warehouseName != ''"> and warehouse_name like concat('%', #{warehouseName}, '%')</if>

@ -29,6 +29,7 @@
<result property="instockDate" column="instock_date"/>
<result property="materialCode" column="material_code"/>
<result property="materialName" column="material_name"/>
<result property="materialSpec" column="material_spec"/>
<result property="orderAmount" column="order_amount"/>
<result property="warehouseName" column="warehouse_name"/>
<result property="applyAmount" column="apply_amount"/>
@ -47,6 +48,7 @@
wps.product_id,
mbmi.material_code,
mbmi.material_name,
mbmi.material_spec,
wps.plan_code,
wps.plan_detail_code,
wps.sale_order_id,
@ -71,15 +73,19 @@
<if test="warehouseId != null ">and wps.warehouse_id = #{warehouseId}</if>
<if test="locationCode != null and locationCode != ''">and wps.location_code = #{locationCode}</if>
<if test="stockType != null and stockType != ''">and wps.stock_type = #{stockType}</if>
<if test="stockTypeStr != null and stockTypeStr != ''">and wps.stock_type in ('2','3')</if>
<if test="productBatch != null and productBatch != ''">and wps.product_batch = #{productBatch}</if>
<if test="qualityStatus != null and qualityStatus != ''">and wps.quality_status = #{qualityStatus}</if>
<if test="productId != null ">and wps.product_id = #{productId}</if>
<if test="planCode != null ">and wps.plan_code = #{planCode}</if>
<if test="planDetailCode != null ">and wps.plan_detail_code = #{planDetailCode}</if>
<if test="saleorderCode != null ">and wps.saleorder_code = #{saleorderCode}</if>
<if test="totalAmount != null ">and wps.total_amount = #{totalAmount}</if>
<if test="frozenAmount != null ">and wps.frozen_amount = #{frozenAmount}</if>
<if test="occupyAmount != null ">and wps.occupy_amount = #{occupyAmount}</if>
<if test="materialCode != null and materialCode != ''"> and mbmi.material_code like concat('%', #{materialCode}, '%')</if>
<if test="materialName != null and materialName != ''"> and mbmi.material_name like concat('%', #{materialName}, '%')</if>
<if test="materialSpec != null and materialSpec != ''">and replace(mbmi.material_spec,' ','') like concat('%', #{materialSpec},
'%')</if>
<if test="saleOrderId != null ">and wps.sale_order_id = #{saleOrderId}</if>
<if test="safeFlag != null and safeFlag != ''">and wps.sale_order_id !=0</if>
<if test="saleorderCode != null and saleorderCode != ''">and wps.saleorder_code like concat('%', #{saleorderCode}, '%')</if>
<if test="updateDate != null ">and wps.update_date = #{updateDate}</if>
<if test="activeFlag != null and activeFlag != ''">and wps.active_flag = #{activeFlag}</if>
<if test="instockDate != null ">and wps.instock_date = #{instockDate}</if>

@ -30,7 +30,9 @@
<result property="activeFlag" column="active_flag"/>
<result property="materialCode" column="material_code"/>
<result property="materialName" column="material_name"/>
<result property="materialSpec" column="material_spec"/>
<result property="warehouseName" column="warehouse_name"/>
<result property="saleorderCode" column="saleorder_code"/>
</resultMap>
<sql id="selectWmsRawStockVo">
@ -43,6 +45,7 @@
wrs.material_id,
mbmi.material_code,
mbmi.material_name,
mbmi.material_spec,
wrs.instock_batch,
wrs.pallet_info_code,
wrs.sale_order_id,
@ -282,4 +285,68 @@
</select>
<select id="selectWmsRawStockJoinList" parameterType="WmsRawStock" resultMap="WmsRawStockResult">
select wrs.raw_stock_id,
wrs.warehouse_id,
wbw.warehouse_name,
wbw.warehouse_floor,
wrs.location_code,
wrs.stock_type,
wrs.material_id,
mbmi.material_code,
mbmi.material_name,
mbmi.material_spec,
wrs.instock_batch,
wrs.pallet_info_code,
wrs.sale_order_id,
wrs.safe_flag,
wrs.instock_date,
wrs.last_outstock_time,
wrs.quality_status,
wrs.complete_flag,
wrs.total_amount,
wrs.frozen_amount,
wrs.occupy_amount,
wrs.supplier_id,
wrs.create_by,
wrs.create_date,
wrs.update_by,
wrs.update_date,
wrs.active_flag,
mso.saleorder_code
from wms_raw_stock wrs
left join wms_base_warehouse wbw on wbw.warehouse_id = wrs.warehouse_id
left join mes_base_material_info mbmi on mbmi.material_id = wrs.material_id
left join mes_sale_order mso on wrs.sale_order_id = mso.sale_order_id
<where>
<if test="warehouseId != null ">and wrs.warehouse_id = #{warehouseId}</if>
<if test="locationCode != null and locationCode != ''">and wrs.location_code = #{locationCode}</if>
<if test="stockType != null and stockType != ''">and wrs.stock_type = #{stockType}</if>
<if test="materialId != null ">and wrs.material_id = #{materialId}</if>
<if test="saleOrderId != null ">and wrs.sale_order_id = #{saleOrderId}</if>
<if test="safeFlag != null and safeFlag != ''">and wrs.safe_flag = #{safeFlag}</if>
<if test="materialCode != null and materialCode != ''"> and mbmi.material_code like concat('%', #{materialCode}, '%')</if>
<if test="materialName != null and materialName != ''"> and mbmi.material_name like concat('%', #{materialName}, '%')</if>
<if test="materialSpec != null and materialSpec != ''">and replace(mbmi.material_spec,' ','') like concat('%', #{materialSpec},
'%')</if>
<if test="saleorderCode != null and saleorderCode != ''">and mso.saleorder_code like concat('%', #{saleorderCode}, '%')</if>
<if test="instockBatch != null and instockBatch != ''">and wrs.instock_batch = #{instockBatch}</if>
<if test="instockDate != null ">and wrs.instock_date = #{instockDate}</if>
<if test="lastOutstockTime != null ">and wrs.last_outstock_time = #{lastOutstockTime}</if>
<if test="qualityStatus != null and qualityStatus != ''">and wrs.quality_status = #{qualityStatus}</if>
<if test="totalAmount != null ">and wrs.total_amount = #{totalAmount}</if>
<if test="frozenAmount != null ">and wrs.frozen_amount = #{frozenAmount}</if>
<if test="occupyAmount != null ">and wrs.occupy_amount = #{occupyAmount}</if>
<if test="supplierId != null ">and wrs.supplier_id = #{supplierId}</if>
<if test="updateDate != null ">and wrs.update_date = #{updateDate}</if>
<if test="activeFlag != null and activeFlag != ''">and wrs.active_flag = #{activeFlag}</if>
<if test="params.beginCreateDate != null and params.beginCreateDate != '' and params.endCreateDate != null and params.endCreateDate != ''">
and wrs.create_date between #{params.beginCreateDate} and #{params.endCreateDate}
</if>
</where>
order by wrs.instock_date desc
</select>
</mapper>

@ -25,6 +25,7 @@
<result property="materialSpec" column="material_spec"/>
<result property="warehouseName" column="warehouse_name"/>
<result property="outstockAmount" column="outstock_amount"/>
<result property="saleorderCode" column="saleorder_code"/>
</resultMap>
<sql id="selectWmsStockTotalVo">
@ -59,9 +60,6 @@
<if test="materialId != null ">and wst.material_id = #{materialId}</if>
<if test="saleOrderId != null ">and wst.sale_order_id = #{saleOrderId}</if>
<if test="safeFlag != null and safeFlag != ''">and wst.safe_flag = #{safeFlag}</if>
<if test="totalAmount != null ">and wst.total_amount = #{totalAmount}</if>
<if test="frozenAmount != null ">and wst.frozen_amount = #{frozenAmount}</if>
<if test="occupyAmount != null ">and wst.occupy_amount = #{occupyAmount}</if>
<if test="createDate != null ">and wst.create_date = #{createDate}</if>
<if test="updateDate != null ">and wst.update_date = #{updateDate}</if>
<if test="activeFlag != null and activeFlag != ''">and wst.active_flag = #{activeFlag}</if>
@ -194,4 +192,48 @@
</select>
<select id="selectWmsStockTotalJoinList" parameterType="WmsStockTotal" resultMap="WmsStockTotalResult">
select wst.stock_total_id,
wst.warehouse_id,
wbw.warehouse_name,
wst.warehouse_floor,
wst.stock_type,
wst.material_id,
wst.sale_order_id,
wst.safe_flag,
mbmi.material_code,
mbmi.material_name,
mbmi.material_spec,
wst.total_amount,
wst.frozen_amount,
wst.occupy_amount,
wst.create_by,
wst.create_date,
wst.update_by,
wst.update_date,
wst.active_flag,
mso.saleorder_code
from wms_stock_total wst
left join wms_base_warehouse wbw on wbw.warehouse_id = wst.warehouse_id
left join mes_base_material_info mbmi on mbmi.material_id = wst.material_id
left join mes_sale_order mso on wst.sale_order_id = mso.sale_order_id
<where>
<if test="warehouseId != null ">and wst.warehouse_id = #{warehouseId}</if>
<if test="warehouseFloor != null ">and wst.warehouse_floor = #{warehouseFloor}</if>
<if test="stockType != null and stockType != ''">and wst.stock_type = #{stockType}</if>
<if test="stockTypeStr != null and stockTypeStr != ''">and wst.stock_type in ('2','3')</if>
<if test="materialId != null ">and wst.material_id = #{materialId}</if>
<if test="materialCode != null and materialCode != ''"> and mbmi.material_code like concat('%', #{materialCode}, '%')</if>
<if test="materialName != null and materialName != ''"> and mbmi.material_name like concat('%', #{materialName}, '%')</if>
<if test="materialSpec != null and materialSpec != ''">and replace(mbmi.material_spec,' ','') like concat('%', #{materialSpec},
'%')</if>
<if test="saleOrderId != null ">and wst.sale_order_id = #{saleOrderId}</if>
<if test="safeFlag != null and safeFlag != ''">and wst.sale_order_id !=0</if>
<if test="saleorderCode != null and saleorderCode != ''">and mso.saleorder_code like concat('%', #{saleorderCode}, '%')</if>
<if test="createDate != null ">and wst.create_date = #{createDate}</if>
<if test="updateDate != null ">and wst.update_date = #{updateDate}</if>
<if test="activeFlag != null and activeFlag != ''">and wst.active_flag = #{activeFlag}</if>
</where>
</select>
</mapper>

@ -46,7 +46,7 @@ export function delWmslocation(locationId) {
// 查询仓库列表
export function getWarehouses(query) {
return request({
url: '/wms/wmslocation/getWarehouses',
url: '/wms/stocktotal/getWarehouses',
method: 'get',
params: query
})

@ -32,15 +32,54 @@
<el-col :span="20" :xs="24">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
label-width="68px">
<!-- <el-form-item label="仓库ID" prop="warehouseId">-->
<!-- <el-input-->
<!-- v-model="queryParams.warehouseId"-->
<!-- placeholder="请输入仓库ID"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<el-form-item label="创建时间">
<el-form-item label="物料编码" prop="materialCode">
<el-input
v-model="queryParams.materialCode"
placeholder="请输入物料编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="物料名称" prop="materialName">
<el-input
v-model="queryParams.materialName"
placeholder="请输入物料名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="物料规格" prop="materialSpec">
<el-input
v-model="queryParams.materialSpec"
placeholder="请输入物料规格"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="销售订单" prop="saleorderCode">
<el-input
v-model="queryParams.saleorderCode"
placeholder="请输入销售订单"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="安全库存" prop="safeFlag">
<el-select
v-model="queryParams.safeFlag"
placeholder="请选择安全库存标识"
clearable
style="width: 240px"
>
<el-option
v-for="dict in dict.type.mes_safe_flag"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<!--el-form-item label="创建时间">
<el-date-picker
v-model="daterangeCreateDate"
style="width: 340px"
@ -50,7 +89,7 @@
start-placeholder="开始时间"
end-placeholder="结束时间"
></el-date-picker>
</el-form-item>
</el-form-item-->
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
@ -58,79 +97,35 @@
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="primary"-->
<!-- plain-->
<!-- icon="el-icon-plus"-->
<!-- size="mini"-->
<!-- @click="handleAdd"-->
<!-- v-hasPermi="['wms:stocktotal:add']"-->
<!-- >新增-->
<!-- </el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="success"-->
<!-- plain-->
<!-- icon="el-icon-edit"-->
<!-- size="mini"-->
<!-- :disabled="single"-->
<!-- @click="handleUpdate"-->
<!-- v-hasPermi="['wms:stocktotal:edit']"-->
<!-- >修改-->
<!-- </el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="danger"-->
<!-- plain-->
<!-- icon="el-icon-delete"-->
<!-- size="mini"-->
<!-- :disabled="multiple"-->
<!-- @click="handleDelete"-->
<!-- v-hasPermi="['wms:stocktotal:remove']"-->
<!-- >删除-->
<!-- </el-button>-->
<!-- </el-col>-->
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['wms:stocktotal:export']"
>导出
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="stocktotalList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center"/>
<!--el-table-column type="selection" width="55" align="center"/-->
<!-- <el-table-column label="总库存ID" align="center" prop="stockTotalId"/>-->
<!-- <el-table-column label="仓库ID" align="center" prop="warehouseId"/>-->
<el-table-column label="仓库名称" align="center" prop="warehouseName"/>
<el-table-column label="仓库楼层" align="center" prop="warehouseFloor"/>
<!-- <el-table-column label="库存类型" align="center" prop="stockType"/>-->
<el-table-column label="物料ID" align="center" prop="materialId"/>
<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="materialSpec"/>
<el-table-column label="安全库存" align="center" prop="safeFlag" width="80">
<template slot-scope="scope">
{{scope.row.saleOrderId === 0 ? "是" :"否"}}
</template>
</el-table-column>
<el-table-column label="销售订单" align="center" prop="saleorderCode"/>
<el-table-column label="总数量" align="center" prop="totalAmount"/>
<!--el-table-column label="冻结数量" align="center" prop="frozenAmount"/-->
<el-table-column label="占用数量" align="center" prop="occupyAmount"/>
<!-- <el-table-column label="创建时间" align="center" prop="createDate" width="180">-->
<!-- <template slot-scope="scope">-->
<!-- <span>{{ parseTime(scope.row.createDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column label="最后更新时间" align="center" prop="updateDate" width="180">-->
<!-- <template slot-scope="scope">-->
<!-- <span>{{ parseTime(scope.row.updateDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column label="创建时间" align="center" prop="createDate" width="180">-->
<!-- <template slot-scope="scope">-->
<!-- <span>{{ parseTime(scope.row.createDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column label="最后更新时间" align="center" prop="updateDate" width="180">-->
<!-- <template slot-scope="scope">-->
<!-- <span>{{ parseTime(scope.row.updateDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column label="有效标记" align="center" prop="activeFlag"/>-->
</el-table>
<pagination
@ -147,49 +142,40 @@
<el-divider content-position="center">库位库存明细信息</el-divider>
<el-table v-loading="loadingTwo" :data="rawstockList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center"/>
<!-- <el-table-column label="原材料库存ID" align="center" prop="rawStockId" />-->
<!-- <el-table-column label="仓库ID" align="center" prop="warehouseId"/>-->
<el-table-column label="仓库名称" align="center" prop="warehouseName" width="120" v-if="columns[0].visible"/>
<el-table-column label="仓库楼层" align="center" prop="warehouseFloor" v-if="columns[1].visible"/>
<el-table-column label="库位编码" align="center" prop="locationCode" v-if="columns[2].visible"/>
<!-- <el-table-column label="库存类型" align="center" prop="stockType"/>-->
<el-table-column label="物料编号" align="center" prop="materialCode" width="120" v-if="columns[3].visible"/>
<el-table-column label="物料名称" align="center" prop="materialName" width="150" v-if="columns[4].visible"/>
<el-table-column label="成品编号" align="center" prop="materialCode" width="120" v-if="columns[10].visible"/>
<el-table-column label="成品名称" align="center" prop="materialName" width="150" v-if="columns[11].visible"/>
<el-table-column label="计划编号" align="center" prop="planCode" width="100" v-if="columns[12].visible"/>
<el-table-column label="计划明细编号" align="center" prop="planDetailCode" width="120" v-if="columns[13].visible"/>
<el-table-column label="销售订单编号" align="center" prop="saleorderCode" width="120" v-if="columns[14].visible"/>
<el-table-column label="入库批次号" align="center" prop="instockBatch" width="100" v-if="columns[5].visible"/>
<el-table-column label="托盘RFID代码" align="center" prop="palletInfoCode" width="120" v-if="columns[6].visible"/>
<!-- <el-table-column label="入库时间" align="center" prop="instockDate" width="180">-->
<!-- <template slot-scope="scope">-->
<!-- <span>{{ parseTime(scope.row.instockDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column label="最晚出库时间" align="center" prop="lastOutstockTime" width="180">-->
<!-- <template slot-scope="scope">-->
<!-- <span>{{ parseTime(scope.row.lastOutstockTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column label="质检状态" align="center" prop="qualityStatus" />-->
<!-- <el-table-column label="完整标识" align="center" prop="completeFlag" />-->
<el-table-column label="物料编码" align="center" prop="materialCode" width="120" v-if="columns[3].visible"/>
<el-table-column label="物料名称" align="center" prop="materialName" width="120" v-if="columns[4].visible"/>
<el-table-column label="物料规格" align="center" prop="materialSpec" width="150" v-if="columns[16].visible"/>
<el-table-column label="派工单号" align="center" prop="planCode" width="100" v-if="columns[12].visible"/>
<el-table-column label="生产明细编号" align="center" prop="planDetailCode" width="120"
v-if="columns[13].visible"/>
<el-table-column label="销售订单" align="center" prop="saleorderCode" width="120"
v-if="columns[14].visible"/>
<el-table-column label="安全库存" align="center" prop="safeFlag" width="80"
v-if="columns[15].visible">
<template slot-scope="scope">
{{scope.row.saleOrderId === 0 ? "是" :"否"}}
</template>
</el-table-column>
<el-table-column label="物料条码" align="center" prop="instockBatch" width="100" v-if="columns[5].visible"/>
<el-table-column label="容器码" align="center" prop="palletInfoCode" width="120"
v-if="columns[6].visible"/>
<el-table-column label="入库时间" align="center" prop="instockDate" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.instockDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="总数量" align="center" prop="totalAmount" v-if="columns[7].visible"/>
<!-- <el-table-column label="冻结数量" align="center" prop="frozenAmount"/>-->
<el-table-column label="占用数量" align="center" prop="occupyAmount" v-if="columns[8].visible"/>
<!-- <el-table-column label="供应商ID" align="center" prop="supplierId" />-->
<el-table-column label="创建时间" align="center" prop="createDate" width="180" v-if="columns[9].visible">
<el-table-column label="完整标识" align="center" prop="completeFlag" v-if="columns[17].visible">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
<dict-tag :options="dict.type.wms_stock_complete_flag" :value="scope.row.safeFlag"/>
</template>
</el-table-column>
<!-- <el-table-column label="最后更新时间" align="center" prop="updateDate" width="180" >-->
<!-- <template slot-scope="scope">-->
<!-- <span>{{ parseTime(scope.row.updateDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column label="有效标记" align="center" prop="activeFlag" />-->
</el-table>
<pagination
v-show="twoPTotal>0"
@ -201,52 +187,6 @@
</el-col>
</el-row>
<!-- 添加或修改原材料库存对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="仓库ID" prop="warehouseId">
<el-input v-model="form.warehouseId" placeholder="请输入仓库ID"/>
</el-form-item>
<el-form-item label="仓库楼层" prop="warehouseFloor">
<el-input v-model="form.warehouseFloor" placeholder="请输入仓库楼层"/>
</el-form-item>
<el-form-item label="物料ID" prop="materialId">
<el-input v-model="form.materialId" placeholder="请输入物料ID"/>
</el-form-item>
<el-form-item label="总数量;仓库存放的总数量" prop="totalAmount">
<el-input v-model="form.totalAmount" placeholder="请输入总数量;仓库存放的总数量"/>
</el-form-item>
<el-form-item label="冻结数量;手动冻结的,暂时可不用" prop="frozenAmount">
<el-input v-model="form.frozenAmount" placeholder="请输入冻结数量;手动冻结的,暂时可不用"/>
</el-form-item>
<el-form-item label="占用数量;申请时占用的数量,在出库时要减去出库数量,并且总数量要同步更新;" prop="occupyAmount">
<el-input v-model="form.occupyAmount" placeholder="请输入占用数量;申请时占用的数量,在出库时要减去出库数量,并且总数量要同步更新;"/>
</el-form-item>
<el-form-item label="创建时间" prop="createDate">
<el-date-picker clearable
v-model="form.createDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择创建时间">
</el-date-picker>
</el-form-item>
<el-form-item label="最后更新时间" prop="updateDate">
<el-date-picker clearable
v-model="form.updateDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择最后更新时间">
</el-date-picker>
</el-form-item>
<el-form-item label="有效标记" prop="activeFlag">
<el-input v-model="form.activeFlag" placeholder="请输入有效标记"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
@ -264,6 +204,7 @@ import {getWarehouses} from "@//api/wms/wmslocation";
export default {
name: "Stocktotal",
dicts: ['mes_safe_flag', 'wms_stock_complete_flag'],
data() {
return {
//
@ -302,11 +243,15 @@ export default {
//
queryParams: {
pageNum: 1,
pageSize: 2,
pageSize: 10,
warehouseId: null,
warehouseFloor: null,
stockType: null,
materialId: null,
materialCode: null,
materialName: null,
materialSpec: null,
saleorderCode: null,
safeFlag: null,
totalAmount: null,
frozenAmount: null,
occupyAmount: null,
@ -316,7 +261,7 @@ export default {
},
queryTwoParams: {
pageNum: 1,
pageSize: 2
pageSize: 10
},
//
form: {},
@ -324,48 +269,68 @@ export default {
rawstockList: [],
//
columns: [],
STOCK_TYPE: {
RAW: "1",
SEMI: "2",
PRODUCT: "3",
}
};
},
watch: {
//
warehouseName(val) {
this.$refs.tree.filter(val);
}
},
created() {
this.type = this.$route.query && this.$route.query.type;
if (this.type === '1') {
if (this.type === this.STOCK_TYPE.RAW) {
this.queryParams.stockType = this.STOCK_TYPE.RAW;
this.columns =
[
{key: 0, label: `仓库名称`, visible: true},
{key: 1, label: `仓库楼层`, visible: true},
{key: 2, label: `库位编码`, visible: true},
{key: 3, label: `物料编`, visible: true},
{key: 3, label: `物料编`, visible: true},
{key: 4, label: `物料名称`, visible: true},
{key: 5, label: `入库批次号`, visible: true},
{key: 6, label: `托盘RFID代`, visible: true},
{key: 5, label: `物料条码`, visible: true},
{key: 6, label: `托盘`, visible: true},
{key: 7, label: `总数量`, visible: true},
{key: 8, label: `占用数量`, visible: true},
{key: 9, label: `创建时间`, visible: true},
{key: 10, label: `成品编号`, visible: false},
{key: 11, label: `成品名称`, visible: false},
{key: 12, label: `计划编号`, visible: false},
{key: 13, label: `计划明细编号`, visible: false},
{key: 14, label: `销售订单编号`, visible: false},
{key: 12, label: `派工单号`, visible: false},
{key: 13, label: `生产明细编号`, visible: false},
{key: 14, label: `销售订单`, visible: true},
{key: 15, label: `安全库存`, visible: true},
{key: 16, label: `物料规格`, visible: true},
{key: 17, label: `完整标识`, visible: true},
]
}
if (this.type === '3') {
if (this.type === this.STOCK_TYPE.PRODUCT) {
this.queryParams.stockTypeStr = this.STOCK_TYPE.SEMI +","+ this.STOCK_TYPE.PRODUCT;
this.columns =
[
{key: 0, label: `仓库名称`, visible: true},
{key: 1, label: `仓库楼层`, visible: true},
{key: 2, label: `库位编码`, visible: true},
{key: 3, label: `物料编`, visible: false},
{key: 4, label: `物料名称`, visible: false},
{key: 5, label: `入库批次号`, visible: false},
{key: 6, label: `托盘RFID代`, visible: true},
{key: 3, label: `物料编`, visible: true},
{key: 4, label: `物料名称`, visible: true},
{key: 5, label: `物料条码`, visible: true},
{key: 6, label: `托盘`, visible: true},
{key: 7, label: `总数量`, visible: true},
{key: 8, label: `占用数量`, visible: true},
{key: 9, label: `创建时间`, visible: true},
{key: 10, label: `成品编号`, visible: true},
{key: 11, label: `成品名称`, visible: true},
{key: 12, label: `计划编号`, visible: true},
{key: 13, label: `计划明细编号`, visible: true},
{key: 14, label: `销售订单编号`, visible: true},
{key: 10, label: `成品编号`, visible: false},
{key: 11, label: `成品名称`, visible: false},
{key: 12, label: `派工单号`, visible: true},
{key: 13, label: `生产明细编号`, visible: false},
{key: 14, label: `销售订单`, visible: true},
{key: 15, label: `安全库存`, visible: true},
{key: 16, label: `物料规格`, visible: true},
{key: 17, label: `完整标识`, visible: false},
]
}
this.getWarehouseList();
@ -386,19 +351,20 @@ export default {
/** 查询库位库存明细列表 */
getTwoList() {
this.loadingTwo = true;
this.queryTwoParams.params = {};
if (null != this.daterangeCreateDate && '' != this.daterangeCreateDate) {
this.queryTwoParams.params["beginCreateDate"] = this.daterangeCreateDate[0];
this.queryTwoParams.params["endCreateDate"] = this.daterangeCreateDate[1];
}
if (this.type === '1') {
this.queryTwoParams = this.queryParams;
// if (null != this.daterangeCreateDate && '' != this.daterangeCreateDate) {
// this.queryTwoParams.params["beginCreateDate"] = this.daterangeCreateDate[0];
// this.queryTwoParams.params["endCreateDate"] = this.daterangeCreateDate[1];
// }
if (this.type === this.STOCK_TYPE.RAW) {
listRawstock(this.queryTwoParams).then(response => {
this.rawstockList = response.rows;
this.twoPTotal = response.total;
this.loadingTwo = false;
});
}
if (this.type === '3') {
if (this.type === this.STOCK_TYPE.PRODUCT) {
listProductstock(this.queryTwoParams).then(response => {
this.rawstockList = response.rows;
this.twoPTotal = response.total;
@ -439,7 +405,10 @@ export default {
},
/** 重置按钮操作 */
resetQuery() {
this.queryParams.warehouseId = null;
this.queryTwoParams.warehouseId = null;
this.resetForm("queryForm");
this.$refs.tree.setCurrentKey(null);
this.handleQuery();
},
//
@ -448,12 +417,6 @@ export default {
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加原材料库存";
},
//
filterNode(value, data) {
@ -471,7 +434,14 @@ export default {
getWarehouseList() {
this.loading = true;
this.loadingTwo = true;
getWarehouses({warehouseInstockType: this.type}).then(response => {
let query;
if(this.type === this.STOCK_TYPE.RAW){
query = {warehouseInstockType: this.type}
}else if(this.type===this.STOCK_TYPE.PRODUCT){
query = {warehouseInstockTypeStr: this.STOCK_TYPE.SEMI+","+this.STOCK_TYPE.PRODUCT}
}
getWarehouses(query).then(response => {
this.warehouseList = response.data;
// this.queryParams.warehouseId = this.warehouseList[0].warehouseId;
// this.queryTwoParams.warehouseId = this.warehouseList[0].warehouseId;
@ -480,36 +450,6 @@ export default {
});
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const stockTotalId = row.stockTotalId || this.ids
getStocktotal(stockTotalId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改原材料库存";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.stockTotalId != null) {
updateStocktotal(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addStocktotal(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {

Loading…
Cancel
Save