parent
ab70c480dc
commit
3f29d0bb36
@ -0,0 +1,39 @@
|
||||
package com.hw.jindie.controller;
|
||||
|
||||
import com.hw.common.core.web.domain.AjaxResult;
|
||||
import com.hw.common.log.annotation.Log;
|
||||
import com.hw.common.log.enums.BusinessType;
|
||||
import com.hw.jindie.service.IKingdeeErpSyncService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @ProjectName:HwMes
|
||||
* @Author:xins
|
||||
* @Date:2024-01-11 17:26
|
||||
* @Version:1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/jindie")
|
||||
public class KingdeeErpSyncController {
|
||||
@Autowired
|
||||
private IKingdeeErpSyncService kingdeeErpSyncService;
|
||||
|
||||
/**
|
||||
* 新增原材料入库记录
|
||||
*/
|
||||
// @RequiresPermissions("wms:mobile:addrawinstock")
|
||||
@Log(title = "物料信息", businessType = BusinessType.INSERT)
|
||||
@GetMapping(("/syncMaterialInfo"))
|
||||
public AjaxResult syncMaterialInfo() {
|
||||
try{
|
||||
return AjaxResult.success(kingdeeErpSyncService.syncMaterialInfoFromErp());
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
package com.hw.jindie.mapper;
|
||||
|
||||
|
||||
import com.hw.jindie.domain.MesBaseMaterialInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 物料信息Mapper接口
|
||||
*
|
||||
* @author xins
|
||||
* @date 2023-12-21
|
||||
*/
|
||||
public interface MesBaseMaterialInfoMapper
|
||||
{
|
||||
/**
|
||||
* 查询物料信息
|
||||
*
|
||||
* @param materialId 物料信息主键
|
||||
* @return 物料信息
|
||||
*/
|
||||
public MesBaseMaterialInfo selectMesBaseMaterialInfoByMaterialId(Long materialId);
|
||||
|
||||
/**
|
||||
* 查询物料信息列表
|
||||
*
|
||||
* @param mesBaseMaterialInfo 物料信息
|
||||
* @return 物料信息集合
|
||||
*/
|
||||
public List<MesBaseMaterialInfo> selectMesBaseMaterialInfoList(MesBaseMaterialInfo mesBaseMaterialInfo);
|
||||
|
||||
/**
|
||||
* 新增物料信息
|
||||
*
|
||||
* @param mesBaseMaterialInfo 物料信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertMesBaseMaterialInfo(MesBaseMaterialInfo mesBaseMaterialInfo);
|
||||
|
||||
/**
|
||||
* 修改物料信息
|
||||
*
|
||||
* @param mesBaseMaterialInfo 物料信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateMesBaseMaterialInfo(MesBaseMaterialInfo mesBaseMaterialInfo);
|
||||
|
||||
/**
|
||||
* 删除物料信息
|
||||
*
|
||||
* @param materialId 物料信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMesBaseMaterialInfoByMaterialId(Long materialId);
|
||||
|
||||
/**
|
||||
* 批量删除物料信息
|
||||
*
|
||||
* @param materialIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMesBaseMaterialInfoByMaterialIds(Long[] materialIds);
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询物料信息列表
|
||||
*
|
||||
* @param materialIds 物料信息ID列表
|
||||
* @return 物料信息集合
|
||||
*/
|
||||
public List<MesBaseMaterialInfo> selectMesBaseMaterialInfoListByMaterialIds(Long[] materialIds);
|
||||
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package com.hw.jindie.service;
|
||||
|
||||
public interface IKingdeeErpSyncService {
|
||||
|
||||
public int syncMaterialInfoFromErp() throws Exception;
|
||||
|
||||
}
|
@ -0,0 +1,237 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.hw.jindie.mapper.MesBaseMaterialInfoMapper">
|
||||
|
||||
<resultMap type="MesBaseMaterialInfo" id="MesBaseMaterialInfoResult">
|
||||
<result property="materialId" column="material_id"/>
|
||||
<result property="erpId" column="erp_id"/>
|
||||
<result property="materialCode" column="material_code"/>
|
||||
<result property="oldMaterialCode" column="old_material_code"/>
|
||||
<result property="materialName" column="material_name"/>
|
||||
<result property="materialCategories" column="material_categories"/>
|
||||
<result property="materialSubclass" column="material_subclass"/>
|
||||
<result property="materialTypeId" column="material_type_id"/>
|
||||
<result property="batchFlag" column="batch_flag"/>
|
||||
<result property="materialUnitId" column="material_unit_id"/>
|
||||
<result property="materialUnit" column="material_unit"/>
|
||||
<result property="materialMatkl" column="material_matkl"/>
|
||||
<result property="materialSpec" column="material_spec"/>
|
||||
<result property="netWeight" column="net_weight"/>
|
||||
<result property="grossWeight" column="gross_weight"/>
|
||||
<result property="factoryId" column="factory_id"/>
|
||||
<result property="createOrgId" column="create_org_id"/>
|
||||
<result property="useOrgId" column="use_org_id"/>
|
||||
<result property="prodlineId" column="prodline_id"/>
|
||||
<result property="activeFlag" column="active_flag"/>
|
||||
<result property="deletedFlag" column="deleted_flag"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="approveDate" column="approve_date"/>
|
||||
<result property="erpModifyDate" column="erp_modify_date"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectMesBaseMaterialInfoVo">
|
||||
select material_id,
|
||||
erp_id,
|
||||
material_code,
|
||||
old_material_code,
|
||||
material_name,
|
||||
material_categories,
|
||||
material_subclass,
|
||||
material_type_id,
|
||||
batch_flag,
|
||||
material_unit_id,
|
||||
material_unit,
|
||||
material_matkl,
|
||||
material_spec,
|
||||
net_weight,
|
||||
gross_weight,
|
||||
factory_id,
|
||||
create_org_id,
|
||||
use_org_id,
|
||||
prodline_id,
|
||||
active_flag,
|
||||
deleted_flag,
|
||||
remark,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time,
|
||||
approve_date,
|
||||
erp_modify_date
|
||||
from mes_base_material_info
|
||||
</sql>
|
||||
|
||||
<select id="selectMesBaseMaterialInfoList" parameterType="MesBaseMaterialInfo"
|
||||
resultMap="MesBaseMaterialInfoResult">
|
||||
<include refid="selectMesBaseMaterialInfoVo"/>
|
||||
<where>
|
||||
<if test="erpId != null ">and erp_id = #{erpId}</if>
|
||||
<if test="materialCode != null and materialCode != ''">and material_code = #{materialCode}</if>
|
||||
<if test="oldMaterialCode != null and oldMaterialCode != ''">and old_material_code = #{oldMaterialCode}
|
||||
</if>
|
||||
<if test="materialName != null and materialName != ''">and material_name like concat('%', #{materialName},
|
||||
'%')
|
||||
</if>
|
||||
<if test="materialCategories != null and materialCategories != ''">and material_categories =
|
||||
#{materialCategories}
|
||||
</if>
|
||||
<if test="materialSubclass != null and materialSubclass != ''">and material_subclass =
|
||||
#{materialSubclass}
|
||||
</if>
|
||||
<if test="materialTypeId != null ">and material_type_id = #{materialTypeId}</if>
|
||||
<if test="batchFlag != null and batchFlag != ''">and batch_flag = #{batchFlag}</if>
|
||||
<if test="materialUnitId != null ">and material_unit_id = #{materialUnitId}</if>
|
||||
<if test="materialUnit != null and materialUnit != ''">and material_unit = #{materialUnit}</if>
|
||||
<if test="materialMatkl != null and materialMatkl != ''">and material_matkl = #{materialMatkl}</if>
|
||||
<if test="materialSpec != null and materialSpec != ''">and material_spec = #{materialSpec}</if>
|
||||
<if test="netWeight != null ">and net_weight = #{netWeight}</if>
|
||||
<if test="grossWeight != null ">and gross_weight = #{grossWeight}</if>
|
||||
<if test="factoryId != null ">and factory_id = #{factoryId}</if>
|
||||
<if test="createOrgId != null ">and create_org_id = #{createOrgId}</if>
|
||||
<if test="useOrgId != null ">and use_org_id = #{useOrgId}</if>
|
||||
<if test="prodlineId != null and prodlineId != ''">and prodline_id = #{prodlineId}</if>
|
||||
<if test="activeFlag != null and activeFlag != ''">and active_flag = #{activeFlag}</if>
|
||||
<if test="deletedFlag != null and deletedFlag != ''">and deleted_flag = #{deletedFlag}</if>
|
||||
<if test="approveDate != null ">and approve_date = #{approveDate}</if>
|
||||
<if test="erpModifyDate != null ">and erp_modify_date = #{erpModifyDate}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectMesBaseMaterialInfoByMaterialId" parameterType="Long" resultMap="MesBaseMaterialInfoResult">
|
||||
<include refid="selectMesBaseMaterialInfoVo"/>
|
||||
where material_id = #{materialId}
|
||||
</select>
|
||||
|
||||
<insert id="insertMesBaseMaterialInfo" parameterType="MesBaseMaterialInfo" useGeneratedKeys="true"
|
||||
keyProperty="materialId">
|
||||
insert into mes_base_material_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="erpId != null">erp_id,</if>
|
||||
<if test="materialCode != null and materialCode != ''">material_code,</if>
|
||||
<if test="oldMaterialCode != null">old_material_code,</if>
|
||||
<if test="materialName != null and materialName != ''">material_name,</if>
|
||||
<if test="materialCategories != null and materialCategories != ''">material_categories,</if>
|
||||
<if test="materialSubclass != null">material_subclass,</if>
|
||||
<if test="materialTypeId != null">material_type_id,</if>
|
||||
<if test="batchFlag != null">batch_flag,</if>
|
||||
<if test="materialUnitId != null">material_unit_id,</if>
|
||||
<if test="materialUnit != null">material_unit,</if>
|
||||
<if test="materialMatkl != null">material_matkl,</if>
|
||||
<if test="materialSpec != null">material_spec,</if>
|
||||
<if test="netWeight != null">net_weight,</if>
|
||||
<if test="grossWeight != null">gross_weight,</if>
|
||||
<if test="factoryId != null">factory_id,</if>
|
||||
<if test="createOrgId != null">create_org_id,</if>
|
||||
<if test="useOrgId != null">use_org_id,</if>
|
||||
<if test="prodlineId != null">prodline_id,</if>
|
||||
<if test="activeFlag != null">active_flag,</if>
|
||||
<if test="deletedFlag != null">deleted_flag,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="approveDate != null">approve_date,</if>
|
||||
<if test="erpModifyDate != null">erp_modify_date,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="erpId != null">#{erpId},</if>
|
||||
<if test="materialCode != null and materialCode != ''">#{materialCode},</if>
|
||||
<if test="oldMaterialCode != null">#{oldMaterialCode},</if>
|
||||
<if test="materialName != null and materialName != ''">#{materialName},</if>
|
||||
<if test="materialCategories != null and materialCategories != ''">#{materialCategories},</if>
|
||||
<if test="materialSubclass != null">#{materialSubclass},</if>
|
||||
<if test="materialTypeId != null">#{materialTypeId},</if>
|
||||
<if test="batchFlag != null">#{batchFlag},</if>
|
||||
<if test="materialUnitId != null">#{materialUnitId},</if>
|
||||
<if test="materialUnit != null">#{materialUnit},</if>
|
||||
<if test="materialMatkl != null">#{materialMatkl},</if>
|
||||
<if test="materialSpec != null">#{materialSpec},</if>
|
||||
<if test="netWeight != null">#{netWeight},</if>
|
||||
<if test="grossWeight != null">#{grossWeight},</if>
|
||||
<if test="factoryId != null">#{factoryId},</if>
|
||||
<if test="createOrgId != null">#{createOrgId},</if>
|
||||
<if test="useOrgId != null">#{useOrgId},</if>
|
||||
<if test="prodlineId != null">#{prodlineId},</if>
|
||||
<if test="activeFlag != null">#{activeFlag},</if>
|
||||
<if test="deletedFlag != null">#{deletedFlag},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="approveDate != null">#{approveDate},</if>
|
||||
<if test="erpModifyDate != null">#{erpModifyDate},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateMesBaseMaterialInfo" parameterType="MesBaseMaterialInfo">
|
||||
update mes_base_material_info
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="erpId != null">erp_id = #{erpId},</if>
|
||||
<if test="materialCode != null and materialCode != ''">material_code = #{materialCode},</if>
|
||||
<if test="oldMaterialCode != null">old_material_code = #{oldMaterialCode},</if>
|
||||
<if test="materialName != null and materialName != ''">material_name = #{materialName},</if>
|
||||
<if test="materialCategories != null and materialCategories != ''">material_categories =
|
||||
#{materialCategories},
|
||||
</if>
|
||||
<if test="materialSubclass != null">material_subclass = #{materialSubclass},</if>
|
||||
<if test="materialTypeId != null">material_type_id = #{materialTypeId},</if>
|
||||
<if test="batchFlag != null">batch_flag = #{batchFlag},</if>
|
||||
<if test="materialUnitId != null">material_unit_id = #{materialUnitId},</if>
|
||||
<if test="materialUnit != null">material_unit = #{materialUnit},</if>
|
||||
<if test="materialMatkl != null">material_matkl = #{materialMatkl},</if>
|
||||
<if test="materialSpec != null">material_spec = #{materialSpec},</if>
|
||||
<if test="netWeight != null">net_weight = #{netWeight},</if>
|
||||
<if test="grossWeight != null">gross_weight = #{grossWeight},</if>
|
||||
<if test="factoryId != null">factory_id = #{factoryId},</if>
|
||||
<if test="createOrgId != null">create_org_id = #{createOrgId},</if>
|
||||
<if test="useOrgId != null">use_org_id = #{useOrgId},</if>
|
||||
<if test="prodlineId != null">prodline_id = #{prodlineId},</if>
|
||||
<if test="activeFlag != null">active_flag = #{activeFlag},</if>
|
||||
<if test="deletedFlag != null">deleted_flag = #{deletedFlag},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="approveDate != null">approve_date = #{approveDate},</if>
|
||||
<if test="erpModifyDate != null">erp_modify_date = #{erpModifyDate},</if>
|
||||
</trim>
|
||||
where material_id = #{materialId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteMesBaseMaterialInfoByMaterialId" parameterType="Long">
|
||||
delete
|
||||
from mes_base_material_info
|
||||
where material_id = #{materialId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteMesBaseMaterialInfoByMaterialIds" parameterType="String">
|
||||
delete from mes_base_material_info where material_id in
|
||||
<foreach item="materialId" collection="array" open="(" separator="," close=")">
|
||||
#{materialId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
|
||||
|
||||
|
||||
<!--新增以下-->
|
||||
|
||||
<select id="selectMesBaseMaterialInfoListByMaterialIds" parameterType="String"
|
||||
resultMap="MesBaseMaterialInfoResult">
|
||||
<include refid="selectMesBaseMaterialInfoVo"/>
|
||||
where material_id in
|
||||
<foreach item="materialId" collection="array" open="(" separator="," close=")">
|
||||
#{materialId}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询物料信息列表
|
||||
export function listMaterialinfo(query) {
|
||||
return request({
|
||||
url: '/mes/materialinfo/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询物料信息详细
|
||||
export function getMaterialinfo(materialId) {
|
||||
return request({
|
||||
url: '/mes/materialinfo/' + materialId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增物料信息
|
||||
export function addMaterialinfo(data) {
|
||||
return request({
|
||||
url: '/mes/materialinfo',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改物料信息
|
||||
export function updateMaterialinfo(data) {
|
||||
return request({
|
||||
url: '/mes/materialinfo',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除物料信息
|
||||
export function delMaterialinfo(materialId) {
|
||||
return request({
|
||||
url: '/mes/materialinfo/' + materialId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
@ -0,0 +1,316 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
|
||||
<h4 class="form-header h4">仓库信息</h4>
|
||||
<el-form ref="warehouseInfoForm" :model="warehouseInfoForm" label-width="80px">
|
||||
<el-row>
|
||||
<el-col :span="8" :offset="2">
|
||||
<el-form-item label="仓库编号" prop="warehouseCode">
|
||||
<el-input v-model="warehouseInfoForm.warehouseCode" disabled/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8" :offset="2">
|
||||
<el-form-item label="仓库名称" prop="warehouseName">
|
||||
<el-input v-model="warehouseInfoForm.warehouseName" disabled/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="11">
|
||||
<h4 class="form-header h4">已选物料</h4>
|
||||
<el-form :model="allocateMaterialQueryParams" ref="allocateMaterialQueryForm" size="small" :inline="true" v-show="showSearch"
|
||||
label-width="68px">
|
||||
<el-form-item label="物料编码" prop="materialCode">
|
||||
<el-input
|
||||
v-model="allocateMaterialQueryParams.materialCode"
|
||||
placeholder="请输入物料编码"
|
||||
style="width:140px;"
|
||||
clearable
|
||||
@keyup.enter.native="handleAllocateMaterialQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="物料名称" prop="materialName">
|
||||
<el-input
|
||||
v-model="allocateMaterialQueryParams.materialName"
|
||||
placeholder="请输入物料名称"
|
||||
style="width:140px;"
|
||||
clearable
|
||||
@keyup.enter.native="handleAllocateMaterialQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleAllocateMaterialQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetAllocateMaterialQuery">重置</el-button>
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
@click="handleUnallocateMaterials"
|
||||
v-hasPermi="['wms:wmswarehouse:add']"
|
||||
>删除
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-table v-loading="allocateMaterialLoading" :data="allocateMaterialList" @selection-change="handleAllocateMaterialSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center"/>
|
||||
<el-table-column label="物料编码" align="center" prop="materialCode"/>
|
||||
<el-table-column label="物料名称" align="center" prop="materialName"/>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="allocateMaterialTotal>0"
|
||||
:total="allocateMaterialTotal"
|
||||
:page.sync="allocateMaterialQueryParams.pageNum"
|
||||
:limit.sync="allocateMaterialQueryParams.pageSize"
|
||||
@pagination="getAllocateMaterialList"
|
||||
/>
|
||||
</el-col>
|
||||
|
||||
|
||||
<el-col :span="11" style="margin-left:10px;">
|
||||
<h4 class="form-header h4">可选物料</h4>
|
||||
<el-form :model="materialQueryParams" ref="materialQueryForm" size="small" :inline="true" v-show="showSearch"
|
||||
label-width="68px">
|
||||
<el-form-item label="物料编码" prop="materialCode">
|
||||
<el-input
|
||||
v-model="materialQueryParams.materialCode"
|
||||
placeholder="请输入物料编码"
|
||||
style="width:140px;"
|
||||
clearable
|
||||
@keyup.enter.native="handleMaterialQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="物料名称" prop="materialName">
|
||||
<el-input
|
||||
v-model="materialQueryParams.materialName"
|
||||
placeholder="请输入物料名称"
|
||||
style="width:140px;"
|
||||
clearable
|
||||
@keyup.enter.native="handleMaterialQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleMaterialQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetMaterialQuery">重置</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
:disabled = "allocateMaterialBtnDisable"
|
||||
@click="submitForm"
|
||||
v-hasPermi="['wms:wmswarehouse:add']"
|
||||
>保存
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
|
||||
<el-table v-loading="materialLoading" :data="materialinfoList" @selection-change="handleMaterialSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center"/>
|
||||
<el-table-column label="物料编码" align="center" prop="materialCode"/>
|
||||
<el-table-column label="物料名称" align="center" prop="materialName"/>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="materialTotal>0"
|
||||
:total="materialTotal"
|
||||
:page.sync="materialQueryParams.pageNum"
|
||||
:limit.sync="materialQueryParams.pageSize"
|
||||
@pagination="getMaterialList"
|
||||
/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
selectWmsWarehouseMaterialList,
|
||||
selectMaterialInfos4AllocationWarehouse,
|
||||
allocateMaterials, unallocateMaterials
|
||||
} from "@/api/wms/wmswarehouse";
|
||||
|
||||
export default {
|
||||
name: "AllocateMaterialinfo",
|
||||
data() {
|
||||
return {
|
||||
// 已选物料遮罩层
|
||||
allocateMaterialLoading: true,
|
||||
// 可选物料遮罩层
|
||||
materialLoading: true,
|
||||
// 已选物料选中数组
|
||||
allocateMaterialIds: [],
|
||||
//可选物料选中数组
|
||||
materialIds:[],
|
||||
// 已选物料非单个禁用
|
||||
allocateMaterialSingle: true,
|
||||
// 已选物料非多个禁用
|
||||
allocateMaterialMultiple: true,
|
||||
// 可选物料非单个禁用
|
||||
materialSingle: true,
|
||||
// 可选物料非多个禁用
|
||||
materialMultiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 已选物料总条数
|
||||
allocateMaterialTotal: 0,
|
||||
//可选物料总条数
|
||||
materialTotal:0,
|
||||
// 已选物料信息表格数据
|
||||
allocateMaterialList: [],
|
||||
// 可选物料信息表格数据
|
||||
materialinfoList: [],
|
||||
//仓库信息
|
||||
warehouseInfoForm: {},
|
||||
|
||||
allocateMaterialBtnDisable:true,
|
||||
|
||||
// 已选物料信息查询参数
|
||||
allocateMaterialQueryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
materialCode: null,
|
||||
materialName: null,
|
||||
materialCategories: null,
|
||||
materialSubclass: null,
|
||||
materialTypeId: null,
|
||||
batchFlag: null,
|
||||
materialUnitId: null,
|
||||
materialUnit: null,
|
||||
warehouseId: null
|
||||
},
|
||||
|
||||
// 可选物料信息查询参数
|
||||
materialQueryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
materialCode: null,
|
||||
materialName: null,
|
||||
materialCategories: null,
|
||||
materialSubclass: null,
|
||||
materialTypeId: null,
|
||||
batchFlag: null,
|
||||
materialUnitId: null,
|
||||
materialUnit: null,
|
||||
warehouseId: null
|
||||
},
|
||||
|
||||
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.allocateMaterialBtnDisable = false;
|
||||
const warehouseId = this.$route.params && this.$route.params.warehouseId;
|
||||
this.allocateMaterialQueryParams.warehouseId = warehouseId;
|
||||
this.materialQueryParams.warehouseId = warehouseId;
|
||||
this.warehouseInfoForm.warehouseCode = this.$route.query && this.$route.query.warehouseCode;
|
||||
this.warehouseInfoForm.warehouseName = this.$route.query && this.$route.query.warehouseName;
|
||||
this.getAllocateMaterialList();
|
||||
this.getMaterialList();
|
||||
|
||||
},
|
||||
methods: {
|
||||
/** 查询已选物料信息列表 */
|
||||
getAllocateMaterialList() {
|
||||
this.allocateMaterialLoading = true;
|
||||
selectWmsWarehouseMaterialList(this.allocateMaterialQueryParams).then(response => {
|
||||
this.allocateMaterialList = response.rows;
|
||||
this.allocateMaterialTotal = response.total;
|
||||
this.allocateMaterialLoading = false;
|
||||
});
|
||||
},
|
||||
|
||||
/** 查询可选物料信息列表 */
|
||||
getMaterialList() {
|
||||
this.materialLoading = true;
|
||||
selectMaterialInfos4AllocationWarehouse(this.materialQueryParams).then(response => {
|
||||
this.materialinfoList = response.rows;
|
||||
this.materialTotal = response.total;
|
||||
this.materialLoading = false;
|
||||
});
|
||||
},
|
||||
|
||||
/** 已选物料搜索按钮操作 */
|
||||
handleAllocateMaterialQuery() {
|
||||
this.allocateMaterialQueryParams.pageNum = 1;
|
||||
this.getAllocateMaterialList();
|
||||
},
|
||||
/** 已选物料重置按钮操作 */
|
||||
resetAllocateMaterialQuery() {
|
||||
this.resetForm("allocateMaterialQueryForm");
|
||||
this.handleAllocateMaterialQuery();
|
||||
},
|
||||
// 已选物料多选框选中数据
|
||||
handleAllocateMaterialSelectionChange(selection) {
|
||||
this.allocateMaterialIds = selection.map(item => item.warehouseMaterialId)
|
||||
this.allocateMaterialCodes = selection.map(item => item.materialCode)
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
|
||||
|
||||
/** 可选物料搜索按钮操作 */
|
||||
handleMaterialQuery() {
|
||||
this.materialQueryParams.pageNum = 1;
|
||||
this.getMaterialList();
|
||||
},
|
||||
/** 可选物料重置按钮操作 */
|
||||
resetMaterialQuery() {
|
||||
this.resetForm("materialQueryForm");
|
||||
this.handleMaterialQuery();
|
||||
},
|
||||
// 可选物料多选框选中数据
|
||||
handleMaterialSelectionChange(selection) {
|
||||
this.materialIds = selection.map(item => item.materialId)
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
|
||||
handleUnallocateMaterials(){
|
||||
const warehouseMaterialIds = this.allocateMaterialIds.join(",");
|
||||
const allocateMaterialCodes = this.allocateMaterialCodes;
|
||||
const params = {
|
||||
warehouseMaterialIds:warehouseMaterialIds
|
||||
}
|
||||
this.$modal.confirm('是否确认删除物料编码为"' + allocateMaterialCodes + '"的数据项?').then(function() {
|
||||
return unallocateMaterials(params);
|
||||
}).then(() => {
|
||||
this.getAllocateMaterialList();
|
||||
this.getMaterialList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
|
||||
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.allocateMaterialBtnDisable = true;
|
||||
const warehouseId = this.allocateMaterialQueryParams.warehouseId;
|
||||
const materialIds = this.materialIds.join(",");
|
||||
allocateMaterials({ warehouseId: warehouseId, materialIds: materialIds }).then((response) => {
|
||||
this.$modal.msgSuccess("保存成功");
|
||||
this.getAllocateMaterialList();
|
||||
this.getMaterialList();
|
||||
this.allocateMaterialBtnDisable = false;
|
||||
}).catch(() => {
|
||||
this.getAllocateMaterialList();
|
||||
this.getMaterialList();
|
||||
this.allocateMaterialBtnDisable = false;
|
||||
});
|
||||
},
|
||||
/** 关闭按钮 */
|
||||
close() {
|
||||
const obj = { path: "/system/user" };
|
||||
this.$tab.closeOpenPage(obj);
|
||||
},
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
Loading…
Reference in New Issue