''20240312

This commit is contained in:
xd 2024-03-12 12:54:52 +08:00
parent 465112e626
commit c0c70ea555
12 changed files with 1289 additions and 14 deletions

View File

@ -0,0 +1,104 @@
package com.ruoyi.web.controller.sapMaterial;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.sapMaterial.domain.SapMaterial;
import com.ruoyi.sapMaterial.service.ISapMaterialService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 物料管理Controller
*
* @author ruoyi
* @date 2024-03-12
*/
@RestController
@RequestMapping("/sapMaterial/sapMaterial")
public class SapMaterialController extends BaseController
{
@Autowired
private ISapMaterialService sapMaterialService;
/**
* 查询物料管理列表
*/
@PreAuthorize("@ss.hasPermi('sapMaterial:sapMaterial:list')")
@GetMapping("/list")
public TableDataInfo list(SapMaterial sapMaterial)
{
startPage();
List<SapMaterial> list = sapMaterialService.selectSapMaterialList(sapMaterial);
return getDataTable(list);
}
/**
* 导出物料管理列表
*/
@PreAuthorize("@ss.hasPermi('sapMaterial:sapMaterial:export')")
@Log(title = "物料管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SapMaterial sapMaterial)
{
List<SapMaterial> list = sapMaterialService.selectSapMaterialList(sapMaterial);
ExcelUtil<SapMaterial> util = new ExcelUtil<SapMaterial>(SapMaterial.class);
util.exportExcel(response, list, "物料管理数据");
}
/**
* 获取物料管理详细信息
*/
@PreAuthorize("@ss.hasPermi('sapMaterial:sapMaterial:query')")
@GetMapping(value = "/{materialId}")
public AjaxResult getInfo(@PathVariable("materialId") Long materialId)
{
return success(sapMaterialService.selectSapMaterialByMaterialId(materialId));
}
/**
* 新增物料管理
*/
@PreAuthorize("@ss.hasPermi('sapMaterial:sapMaterial:add')")
@Log(title = "物料管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SapMaterial sapMaterial)
{
return toAjax(sapMaterialService.insertSapMaterial(sapMaterial));
}
/**
* 修改物料管理
*/
@PreAuthorize("@ss.hasPermi('sapMaterial:sapMaterial:edit')")
@Log(title = "物料管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SapMaterial sapMaterial)
{
return toAjax(sapMaterialService.updateSapMaterial(sapMaterial));
}
/**
* 删除物料管理
*/
@PreAuthorize("@ss.hasPermi('sapMaterial:sapMaterial:remove')")
@Log(title = "物料管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{materialIds}")
public AjaxResult remove(@PathVariable Long[] materialIds)
{
return toAjax(sapMaterialService.deleteSapMaterialByMaterialIds(materialIds));
}
}

View File

@ -18,6 +18,14 @@ public class SapAccount extends BaseEntity
/** */ /** */
private Long id; private Long id;
/** 登录账号 */
@Excel(name = "登录账号")
private String userName;
/** 登录名 */
@Excel(name = "登录名")
private String nickName;
/** 账户 */ /** 账户 */
@Excel(name = "账户") @Excel(name = "账户")
private String sapBm; private String sapBm;
@ -39,6 +47,12 @@ public class SapAccount extends BaseEntity
{ {
return id; return id;
} }
public String getNickName() {return nickName;}
public void setNickName(String nickName) {this.nickName = nickName;}
public String getUserName() {return userName;}
public void setUserName(String userName) {this.userName = userName;}
public void setSapBm(String sapBm) public void setSapBm(String sapBm)
{ {
this.sapBm = sapBm; this.sapBm = sapBm;

View File

@ -0,0 +1,297 @@
package com.ruoyi.sapMaterial.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 物料管理对象 sap_material
*
* @author ruoyi
* @date 2024-03-12
*/
public class SapMaterial extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 物料id */
private Long materialId;
/** 编码 */
@Excel(name = "编码")
private String materialMatnr;
/** 名称 */
@Excel(name = "名称")
private String materialMaktx;
/** 销售组织 */
@Excel(name = "销售组织")
private String materialVkorg;
/** 分销渠道 */
@Excel(name = "分销渠道")
private String materialVtweg;
/** 单位 */
@Excel(name = "单位")
private String materialMeins;
/** 产品组 */
@Excel(name = "产品组")
private String materialSpart;
/** 产品组描述 */
@Excel(name = "产品组描述")
private String materialVtext;
/** 类别 */
@Excel(name = "类别")
private String materialMatkl;
/** 类别描述 */
@Excel(name = "类别描述")
private String materialWgbez;
/** 单位净重 */
@Excel(name = "单位净重")
private String materialDwjz;
/** 厂价 */
@Excel(name = "厂价")
private String materialChangj;
/** 型号 */
private String materialXingh;
/** 规格 */
private String materialGuig;
/** 截面 */
private String materialJiem;
/** 电压 */
private String materialDiany;
/** 临时字段 */
private String materialTemp;
/** 临时字段(IEC型号) */
private String materialModel;
/** 标识(100米/卷) */
@Excel(name = "标识(100米/卷)")
private String materialMrbs;
/** 是否有效 */
@Excel(name = "是否有效")
private String materialSfyx;
public void setMaterialId(Long materialId)
{
this.materialId = materialId;
}
public Long getMaterialId()
{
return materialId;
}
public void setMaterialMatnr(String materialMatnr)
{
this.materialMatnr = materialMatnr;
}
public String getMaterialMatnr()
{
return materialMatnr;
}
public void setMaterialMaktx(String materialMaktx)
{
this.materialMaktx = materialMaktx;
}
public String getMaterialMaktx()
{
return materialMaktx;
}
public void setMaterialVkorg(String materialVkorg)
{
this.materialVkorg = materialVkorg;
}
public String getMaterialVkorg()
{
return materialVkorg;
}
public void setMaterialVtweg(String materialVtweg)
{
this.materialVtweg = materialVtweg;
}
public String getMaterialVtweg()
{
return materialVtweg;
}
public void setMaterialMeins(String materialMeins)
{
this.materialMeins = materialMeins;
}
public String getMaterialMeins()
{
return materialMeins;
}
public void setMaterialSpart(String materialSpart)
{
this.materialSpart = materialSpart;
}
public String getMaterialSpart()
{
return materialSpart;
}
public void setMaterialVtext(String materialVtext)
{
this.materialVtext = materialVtext;
}
public String getMaterialVtext()
{
return materialVtext;
}
public void setMaterialMatkl(String materialMatkl)
{
this.materialMatkl = materialMatkl;
}
public String getMaterialMatkl()
{
return materialMatkl;
}
public void setMaterialWgbez(String materialWgbez)
{
this.materialWgbez = materialWgbez;
}
public String getMaterialWgbez()
{
return materialWgbez;
}
public void setMaterialDwjz(String materialDwjz)
{
this.materialDwjz = materialDwjz;
}
public String getMaterialDwjz()
{
return materialDwjz;
}
public void setMaterialChangj(String materialChangj)
{
this.materialChangj = materialChangj;
}
public String getMaterialChangj()
{
return materialChangj;
}
public void setMaterialXingh(String materialXingh)
{
this.materialXingh = materialXingh;
}
public String getMaterialXingh()
{
return materialXingh;
}
public void setMaterialGuig(String materialGuig)
{
this.materialGuig = materialGuig;
}
public String getMaterialGuig()
{
return materialGuig;
}
public void setMaterialJiem(String materialJiem)
{
this.materialJiem = materialJiem;
}
public String getMaterialJiem()
{
return materialJiem;
}
public void setMaterialDiany(String materialDiany)
{
this.materialDiany = materialDiany;
}
public String getMaterialDiany()
{
return materialDiany;
}
public void setMaterialTemp(String materialTemp)
{
this.materialTemp = materialTemp;
}
public String getMaterialTemp()
{
return materialTemp;
}
public void setMaterialModel(String materialModel)
{
this.materialModel = materialModel;
}
public String getMaterialModel()
{
return materialModel;
}
public void setMaterialMrbs(String materialMrbs)
{
this.materialMrbs = materialMrbs;
}
public String getMaterialMrbs()
{
return materialMrbs;
}
public void setMaterialSfyx(String materialSfyx)
{
this.materialSfyx = materialSfyx;
}
public String getMaterialSfyx()
{
return materialSfyx;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("materialId", getMaterialId())
.append("materialMatnr", getMaterialMatnr())
.append("materialMaktx", getMaterialMaktx())
.append("materialVkorg", getMaterialVkorg())
.append("materialVtweg", getMaterialVtweg())
.append("materialMeins", getMaterialMeins())
.append("materialSpart", getMaterialSpart())
.append("materialVtext", getMaterialVtext())
.append("materialMatkl", getMaterialMatkl())
.append("materialWgbez", getMaterialWgbez())
.append("materialDwjz", getMaterialDwjz())
.append("materialChangj", getMaterialChangj())
.append("materialXingh", getMaterialXingh())
.append("materialGuig", getMaterialGuig())
.append("materialJiem", getMaterialJiem())
.append("materialDiany", getMaterialDiany())
.append("materialTemp", getMaterialTemp())
.append("materialModel", getMaterialModel())
.append("materialMrbs", getMaterialMrbs())
.append("materialSfyx", getMaterialSfyx())
.toString();
}
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.sapMaterial.mapper;
import java.util.List;
import com.ruoyi.sapMaterial.domain.SapMaterial;
/**
* 物料管理Mapper接口
*
* @author ruoyi
* @date 2024-03-12
*/
public interface SapMaterialMapper
{
/**
* 查询物料管理
*
* @param materialId 物料管理主键
* @return 物料管理
*/
public SapMaterial selectSapMaterialByMaterialId(Long materialId);
/**
* 查询物料管理列表
*
* @param sapMaterial 物料管理
* @return 物料管理集合
*/
public List<SapMaterial> selectSapMaterialList(SapMaterial sapMaterial);
/**
* 新增物料管理
*
* @param sapMaterial 物料管理
* @return 结果
*/
public int insertSapMaterial(SapMaterial sapMaterial);
/**
* 修改物料管理
*
* @param sapMaterial 物料管理
* @return 结果
*/
public int updateSapMaterial(SapMaterial sapMaterial);
/**
* 删除物料管理
*
* @param materialId 物料管理主键
* @return 结果
*/
public int deleteSapMaterialByMaterialId(Long materialId);
/**
* 批量删除物料管理
*
* @param materialIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteSapMaterialByMaterialIds(Long[] materialIds);
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.sapMaterial.service;
import java.util.List;
import com.ruoyi.sapMaterial.domain.SapMaterial;
/**
* 物料管理Service接口
*
* @author ruoyi
* @date 2024-03-12
*/
public interface ISapMaterialService
{
/**
* 查询物料管理
*
* @param materialId 物料管理主键
* @return 物料管理
*/
public SapMaterial selectSapMaterialByMaterialId(Long materialId);
/**
* 查询物料管理列表
*
* @param sapMaterial 物料管理
* @return 物料管理集合
*/
public List<SapMaterial> selectSapMaterialList(SapMaterial sapMaterial);
/**
* 新增物料管理
*
* @param sapMaterial 物料管理
* @return 结果
*/
public int insertSapMaterial(SapMaterial sapMaterial);
/**
* 修改物料管理
*
* @param sapMaterial 物料管理
* @return 结果
*/
public int updateSapMaterial(SapMaterial sapMaterial);
/**
* 批量删除物料管理
*
* @param materialIds 需要删除的物料管理主键集合
* @return 结果
*/
public int deleteSapMaterialByMaterialIds(Long[] materialIds);
/**
* 删除物料管理信息
*
* @param materialId 物料管理主键
* @return 结果
*/
public int deleteSapMaterialByMaterialId(Long materialId);
}

View File

@ -0,0 +1,93 @@
package com.ruoyi.sapMaterial.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.sapMaterial.mapper.SapMaterialMapper;
import com.ruoyi.sapMaterial.domain.SapMaterial;
import com.ruoyi.sapMaterial.service.ISapMaterialService;
/**
* 物料管理Service业务层处理
*
* @author ruoyi
* @date 2024-03-12
*/
@Service
public class SapMaterialServiceImpl implements ISapMaterialService
{
@Autowired
private SapMaterialMapper sapMaterialMapper;
/**
* 查询物料管理
*
* @param materialId 物料管理主键
* @return 物料管理
*/
@Override
public SapMaterial selectSapMaterialByMaterialId(Long materialId)
{
return sapMaterialMapper.selectSapMaterialByMaterialId(materialId);
}
/**
* 查询物料管理列表
*
* @param sapMaterial 物料管理
* @return 物料管理
*/
@Override
public List<SapMaterial> selectSapMaterialList(SapMaterial sapMaterial)
{
return sapMaterialMapper.selectSapMaterialList(sapMaterial);
}
/**
* 新增物料管理
*
* @param sapMaterial 物料管理
* @return 结果
*/
@Override
public int insertSapMaterial(SapMaterial sapMaterial)
{
return sapMaterialMapper.insertSapMaterial(sapMaterial);
}
/**
* 修改物料管理
*
* @param sapMaterial 物料管理
* @return 结果
*/
@Override
public int updateSapMaterial(SapMaterial sapMaterial)
{
return sapMaterialMapper.updateSapMaterial(sapMaterial);
}
/**
* 批量删除物料管理
*
* @param materialIds 需要删除的物料管理主键
* @return 结果
*/
@Override
public int deleteSapMaterialByMaterialIds(Long[] materialIds)
{
return sapMaterialMapper.deleteSapMaterialByMaterialIds(materialIds);
}
/**
* 删除物料管理信息
*
* @param materialId 物料管理主键
* @return 结果
*/
@Override
public int deleteSapMaterialByMaterialId(Long materialId)
{
return sapMaterialMapper.deleteSapMaterialByMaterialId(materialId);
}
}

View File

@ -6,37 +6,49 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="SapAccount" id="SapAccountResult"> <resultMap type="SapAccount" id="SapAccountResult">
<result property="id" column="id" /> <result property="id" column="id" />
<result property="userName" column="user_name" />
<result property="nickName" column="nick_name" />
<result property="sapBm" column="sap_bm" /> <result property="sapBm" column="sap_bm" />
<result property="sapName" column="sap_name" /> <result property="sapName" column="sap_name" />
<result property="sapArea" column="sap_area" /> <result property="sapArea" column="sap_area" />
</resultMap> </resultMap>
<sql id="SapAccountJoins">
left join sys_user u on u.user_name = a.user_name
</sql>
<sql id="selectSapAccountVo"> <sql id="selectSapAccountVo">
select id, sap_bm, sap_name, sap_area from sap_account select a.id, a.user_name, case when u.status is null then a.user_name+'(登录账号不存在)' when u.status = '1' then u.nick_name+'(停用)' else u.nick_name end nick_name, a.sap_bm, a.sap_name, a.sap_area
from sap_account a
<include refid="SapAccountJoins"/>
</sql> </sql>
<select id="selectSapAccountList" parameterType="SapAccount" resultMap="SapAccountResult"> <select id="selectSapAccountList" parameterType="SapAccount" resultMap="SapAccountResult">
<include refid="selectSapAccountVo"/> <include refid="selectSapAccountVo"/>
<where> <where>
<if test="sapBm != null and sapBm != ''"> and sap_bm = #{sapBm}</if> <if test="userName != null and userName != ''"> and a.user_name = #{userName}</if>
<if test="sapName != null and sapName != ''"> and sap_name like concat('%', #{sapName}, '%')</if> <if test="sapBm != null and sapBm != ''"> and a.sap_bm = #{sapBm}</if>
<if test="sapArea != null and sapArea != ''"> and sap_area = #{sapArea}</if> <if test="sapName != null and sapName != ''"> and a.sap_name like concat('%', #{sapName}, '%')</if>
<if test="sapArea != null and sapArea != ''"> and a.sap_area = #{sapArea}</if>
</where> </where>
</select> </select>
<select id="selectSapAccountById" parameterType="Long" resultMap="SapAccountResult"> <select id="selectSapAccountById" parameterType="Long" resultMap="SapAccountResult">
<include refid="selectSapAccountVo"/> <include refid="selectSapAccountVo"/>
where id = #{id} where a.id = #{id}
</select> </select>
<insert id="insertSapAccount" parameterType="SapAccount" useGeneratedKeys="true" keyProperty="id"> <insert id="insertSapAccount" parameterType="SapAccount" useGeneratedKeys="true" keyProperty="id">
insert into sap_account insert into sap_account
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userName != null and userName != ''">user_name,</if>
<if test="sapBm != null and sapBm != ''">sap_bm,</if> <if test="sapBm != null and sapBm != ''">sap_bm,</if>
<if test="sapName != null and sapName != ''">sap_name,</if> <if test="sapName != null and sapName != ''">sap_name,</if>
<if test="sapArea != null and sapArea != ''">sap_area,</if> <if test="sapArea != null and sapArea != ''">sap_area,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userName != null and userName != ''">#{userName},</if>
<if test="sapBm != null and sapBm != ''">#{sapBm},</if> <if test="sapBm != null and sapBm != ''">#{sapBm},</if>
<if test="sapName != null and sapName != ''">#{sapName},</if> <if test="sapName != null and sapName != ''">#{sapName},</if>
<if test="sapArea != null and sapArea != ''">#{sapArea},</if> <if test="sapArea != null and sapArea != ''">#{sapArea},</if>
@ -47,7 +59,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update sap_account update sap_account
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="userName != null and userName != ''">user_name = #{userName},</if> <if test="userName != null and userName != ''">user_name = #{userName},</if>
<if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
<if test="sapBm != null and sapBm != ''">sap_bm = #{sapBm},</if> <if test="sapBm != null and sapBm != ''">sap_bm = #{sapBm},</if>
<if test="sapName != null and sapName != ''">sap_name = #{sapName},</if> <if test="sapName != null and sapName != ''">sap_name = #{sapName},</if>
<if test="sapArea != null and sapArea != ''">sap_area = #{sapArea},</if> <if test="sapArea != null and sapArea != ''">sap_area = #{sapArea},</if>

View File

@ -0,0 +1,141 @@
<?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.ruoyi.sapMaterial.mapper.SapMaterialMapper">
<resultMap type="SapMaterial" id="SapMaterialResult">
<result property="materialId" column="material_id" />
<result property="materialMatnr" column="material_matnr" />
<result property="materialMaktx" column="material_maktx" />
<result property="materialVkorg" column="material_vkorg" />
<result property="materialVtweg" column="material_vtweg" />
<result property="materialMeins" column="material_meins" />
<result property="materialSpart" column="material_spart" />
<result property="materialVtext" column="material_vtext" />
<result property="materialMatkl" column="material_matkl" />
<result property="materialWgbez" column="material_wgbez" />
<result property="materialDwjz" column="material_dwjz" />
<result property="materialChangj" column="material_changj" />
<result property="materialXingh" column="material_xingh" />
<result property="materialGuig" column="material_guig" />
<result property="materialJiem" column="material_jiem" />
<result property="materialDiany" column="material_diany" />
<result property="materialTemp" column="material_temp" />
<result property="materialModel" column="material_model" />
<result property="materialMrbs" column="material_mrbs" />
<result property="materialSfyx" column="material_sfyx" />
</resultMap>
<sql id="SapMaterialJoins">
left join Redbook.RedBook.dbo.sdmdm1 rdm on rdm.matnr='0000000000'+sm.material_matnr
</sql>
<sql id="selectSapMaterialVo">
select sm.material_id, sm.material_matnr, sm.material_maktx, sm.material_vkorg, sm.material_vtweg,
sm.material_meins, sm.material_spart, sm.material_vtext, sm.material_matkl, sm.material_wgbez, sm.material_dwjz,
case when rdm.当前厂价=0 then null else rdm.当前厂价 end material_changj, sm.material_xingh, sm.material_guig,
sm.material_jiem, sm.material_diany, sm.material_temp,
sm.material_model, material_mrbs, material_sfyx
from sap_material sm
<include refid="SapMaterialJoins"/>
</sql>
<select id="selectSapMaterialList" parameterType="SapMaterial" resultMap="SapMaterialResult">
<include refid="selectSapMaterialVo"/>
<where>
<if test="materialMatnr != null and materialMatnr != ''"> and sm.material_matnr = #{materialMatnr}</if>
<if test="materialMaktx != null and materialMaktx != ''"> and sm.material_maktx like concat('%', #{materialMaktx}, '%')</if>
<if test="materialMrbs != null and materialMrbs != ''"> and sm.material_mrbs = #{materialMrbs}</if>
<if test="materialSfyx != null and materialSfyx != ''"> and sm.material_sfyx = #{materialSfyx}</if>
</where>
</select>
<select id="selectSapMaterialByMaterialId" parameterType="Long" resultMap="SapMaterialResult">
<include refid="selectSapMaterialVo"/>
where sm.material_id = #{materialId}
</select>
<insert id="insertSapMaterial" parameterType="SapMaterial" useGeneratedKeys="true" keyProperty="materialId">
insert into sap_material
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="materialMatnr != null and materialMatnr != ''">material_matnr,</if>
<if test="materialMaktx != null and materialMaktx != ''">material_maktx,</if>
<if test="materialVkorg != null and materialVkorg != ''">material_vkorg,</if>
<if test="materialVtweg != null and materialVtweg != ''">material_vtweg,</if>
<if test="materialMeins != null and materialMeins != ''">material_meins,</if>
<if test="materialSpart != null and materialSpart != ''">material_spart,</if>
<if test="materialVtext != null and materialVtext != ''">material_vtext,</if>
<if test="materialMatkl != null and materialMatkl != ''">material_matkl,</if>
<if test="materialWgbez != null and materialWgbez != ''">material_wgbez,</if>
<if test="materialDwjz != null and materialDwjz != ''">material_dwjz,</if>
<if test="materialChangj != null">material_changj,</if>
<if test="materialXingh != null">material_xingh,</if>
<if test="materialGuig != null">material_guig,</if>
<if test="materialJiem != null">material_jiem,</if>
<if test="materialDiany != null">material_diany,</if>
<if test="materialTemp != null">material_temp,</if>
<if test="materialModel != null">material_model,</if>
<if test="materialMrbs != null">material_mrbs,</if>
<if test="materialSfyx != null">material_sfyx,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="materialMatnr != null and materialMatnr != ''">#{materialMatnr},</if>
<if test="materialMaktx != null and materialMaktx != ''">#{materialMaktx},</if>
<if test="materialVkorg != null and materialVkorg != ''">#{materialVkorg},</if>
<if test="materialVtweg != null and materialVtweg != ''">#{materialVtweg},</if>
<if test="materialMeins != null and materialMeins != ''">#{materialMeins},</if>
<if test="materialSpart != null and materialSpart != ''">#{materialSpart},</if>
<if test="materialVtext != null and materialVtext != ''">#{materialVtext},</if>
<if test="materialMatkl != null and materialMatkl != ''">#{materialMatkl},</if>
<if test="materialWgbez != null and materialWgbez != ''">#{materialWgbez},</if>
<if test="materialDwjz != null and materialDwjz != ''">#{materialDwjz},</if>
<if test="materialChangj != null">#{materialChangj},</if>
<if test="materialXingh != null">#{materialXingh},</if>
<if test="materialGuig != null">#{materialGuig},</if>
<if test="materialJiem != null">#{materialJiem},</if>
<if test="materialDiany != null">#{materialDiany},</if>
<if test="materialTemp != null">#{materialTemp},</if>
<if test="materialModel != null">#{materialModel},</if>
<if test="materialMrbs != null">#{materialMrbs},</if>
<if test="materialSfyx != null">#{materialSfyx},</if>
</trim>
</insert>
<update id="updateSapMaterial" parameterType="SapMaterial">
update sap_material
<trim prefix="SET" suffixOverrides=",">
<if test="materialMatnr != null and materialMatnr != ''">material_matnr = #{materialMatnr},</if>
<if test="materialMaktx != null and materialMaktx != ''">material_maktx = #{materialMaktx},</if>
<if test="materialVkorg != null and materialVkorg != ''">material_vkorg = #{materialVkorg},</if>
<if test="materialVtweg != null and materialVtweg != ''">material_vtweg = #{materialVtweg},</if>
<if test="materialMeins != null and materialMeins != ''">material_meins = #{materialMeins},</if>
<if test="materialSpart != null and materialSpart != ''">material_spart = #{materialSpart},</if>
<if test="materialVtext != null and materialVtext != ''">material_vtext = #{materialVtext},</if>
<if test="materialMatkl != null and materialMatkl != ''">material_matkl = #{materialMatkl},</if>
<if test="materialWgbez != null and materialWgbez != ''">material_wgbez = #{materialWgbez},</if>
<if test="materialDwjz != null and materialDwjz != ''">material_dwjz = #{materialDwjz},</if>
<if test="materialChangj != null">material_changj = #{materialChangj},</if>
<if test="materialXingh != null">material_xingh = #{materialXingh},</if>
<if test="materialGuig != null">material_guig = #{materialGuig},</if>
<if test="materialJiem != null">material_jiem = #{materialJiem},</if>
<if test="materialDiany != null">material_diany = #{materialDiany},</if>
<if test="materialTemp != null">material_temp = #{materialTemp},</if>
<if test="materialModel != null">material_model = #{materialModel},</if>
<if test="materialMrbs != null">material_mrbs = #{materialMrbs},</if>
<if test="materialSfyx != null">material_sfyx = #{materialSfyx},</if>
</trim>
where material_id = #{materialId}
</update>
<delete id="deleteSapMaterialByMaterialId" parameterType="Long">
delete from sap_material where material_id = #{materialId}
</delete>
<delete id="deleteSapMaterialByMaterialIds" parameterType="String">
delete from sap_material where material_id in
<foreach item="materialId" collection="array" open="(" separator="," close=")">
#{materialId}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询物料管理列表
export function listSapMaterial(query) {
return request({
url: '/sapMaterial/sapMaterial/list',
method: 'get',
params: query
})
}
// 查询物料管理详细
export function getSapMaterial(materialId) {
return request({
url: '/sapMaterial/sapMaterial/' + materialId,
method: 'get'
})
}
// 新增物料管理
export function addSapMaterial(data) {
return request({
url: '/sapMaterial/sapMaterial',
method: 'post',
data: data
})
}
// 修改物料管理
export function updateSapMaterial(data) {
return request({
url: '/sapMaterial/sapMaterial',
method: 'put',
data: data
})
}
// 删除物料管理
export function delSapMaterial(materialId) {
return request({
url: '/sapMaterial/sapMaterial/' + materialId,
method: 'delete'
})
}

View File

@ -1,6 +1,14 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="登录账号" prop="sapBm">
<el-input
v-model="queryParams.userName"
placeholder="请输入登录账号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="账户" prop="sapBm"> <el-form-item label="账户" prop="sapBm">
<el-input <el-input
v-model="queryParams.sapBm" v-model="queryParams.sapBm"
@ -83,6 +91,8 @@
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" align="center" prop="index" width="80"/> <el-table-column label="序号" align="center" prop="index" width="80"/>
<el-table-column label=" " align="center" prop="id" v-if="false"/> <el-table-column label=" " align="center" prop="id" v-if="false"/>
<el-table-column label="登录账号" align="center" prop="userName" />
<el-table-column label="登录名" align="center" prop="nickName" />
<el-table-column label="账户" align="center" prop="sapBm" /> <el-table-column label="账户" align="center" prop="sapBm" />
<el-table-column label="账户名" align="center" prop="sapName" /> <el-table-column label="账户名" align="center" prop="sapName" />
<el-table-column label="片区" align="center" prop="sapArea"> <el-table-column label="片区" align="center" prop="sapArea">
@ -122,6 +132,11 @@
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-row> <el-row>
<el-col :span="12">
<el-form-item label="登录账号" prop="userName">
<el-input v-model="form.userName" placeholder="请输入登录账号" />
</el-form-item>
</el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="账户" prop="sapBm"> <el-form-item label="账户" prop="sapBm">
<el-input v-model="form.sapBm" placeholder="请输入账户" /> <el-input v-model="form.sapBm" placeholder="请输入账户" />
@ -132,8 +147,6 @@
<el-input v-model="form.sapName" placeholder="请输入账户名" /> <el-input v-model="form.sapName" placeholder="请输入账户名" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row>
<el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="片区" prop="sapArea"> <el-form-item label="片区" prop="sapArea">
<el-select v-model="form.sapArea" placeholder="请选择片区"> <el-select v-model="form.sapArea" placeholder="请选择片区">
@ -186,6 +199,7 @@ export default {
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
userName: null,
sapBm: null, sapBm: null,
sapName: null, sapName: null,
sapArea: null sapArea: null
@ -194,6 +208,9 @@ export default {
form: {}, form: {},
// //
rules: { rules: {
userName: [
{ required: true, message: "登录账号不能为空", trigger: "blur" }
],
sapBm: [ sapBm: [
{ required: true, message: "账户不能为空", trigger: "blur" } { required: true, message: "账户不能为空", trigger: "blur" }
], ],
@ -228,6 +245,7 @@ export default {
reset() { reset() {
this.form = { this.form = {
id: null, id: null,
userName: null,
sapBm: null, sapBm: null,
sapName: null, sapName: null,
sapArea: null sapArea: null

View File

@ -131,14 +131,13 @@
<el-input v-model="form.customerName2" placeholder="请输入名称2" /> <el-input v-model="form.customerName2" placeholder="请输入名称2" />
</el-form-item> </el-form-item>
<el-form-item label="是否停用" prop="customerState"> <el-form-item label="是否停用" prop="customerState">
<el-select v-model="form.customerState" placeholder="请选择是否停用"> <el-radio-group v-model="form.customerState">
<el-option <el-radio
v-for="dict in dict.type.common_state" v-for="dict in dict.type.common_state"
:key="dict.value" :key="dict.value"
:label="dict.label" :label="dict.value"
:value="dict.value" >{{dict.label}}</el-radio>
></el-option> </el-radio-group>
</el-select>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">

View File

@ -0,0 +1,432 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="编码" prop="materialMatnr">
<el-input
v-model="queryParams.materialMatnr"
placeholder="请输入编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="名称" prop="materialMaktx">
<el-input
v-model="queryParams.materialMaktx"
placeholder="请输入名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="标识" prop="materialMrbs">
<el-select v-model="queryParams.materialMrbs" placeholder="请选择标识(100米/卷)" clearable>
<el-option
v-for="dict in dict.type.sap_segmentation"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="是否有效" prop="materialSfyx">
<el-select v-model="queryParams.materialSfyx" placeholder="请选择是否有效" clearable>
<el-option
v-for="dict in dict.type.sap_material_state"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</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="['sapMaterial:sapMaterial: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="['sapMaterial:sapMaterial: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="['sapMaterial:sapMaterial: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="['sapMaterial:sapMaterial:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="sapMaterialList" :row-class-name="rowSapMaterialIndex" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" align="center" prop="index" width="80"/>
<el-table-column label="物料id" align="center" prop="materialId" v-if="false"/>
<el-table-column label="编码" align="center" prop="materialMatnr" />
<el-table-column label="名称" width="250" prop="materialMaktx" />
<el-table-column label="销售组织" align="center" prop="materialVkorg" />
<el-table-column label="分销渠道" align="center" prop="materialVtweg" />
<el-table-column label="单位" align="center" prop="materialMeins" />
<el-table-column label="产品组" align="center" prop="materialSpart" />
<el-table-column label="产品组描述" align="center" prop="materialVtext" />
<el-table-column label="类别" align="center" prop="materialMatkl" />
<el-table-column label="类别描述" align="center" prop="materialWgbez" />
<el-table-column label="单位净重" align="center" prop="materialDwjz" />
<el-table-column label="厂价" align="center" prop="materialChangj" />
<el-table-column label="标识" align="center" prop="materialMrbs">
<template slot-scope="scope">
<dict-tag :options="dict.type.sap_segmentation" :value="scope.row.materialMrbs"/>
</template>
</el-table-column>
<el-table-column label="是否有效" align="center" prop="materialSfyx">
<template slot-scope="scope">
<dict-tag :options="dict.type.sap_material_state" :value="scope.row.materialSfyx"/>
</template>
</el-table-column>
<el-table-column fixed="right" label="操作" width="150" align="center">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['sapMaterial:sapMaterial:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['sapMaterial:sapMaterial:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改物料管理对话框 -->
<el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-row>
<el-col :span="8">
<el-form-item label="编码" prop="materialMatnr" label-width="100px">
<el-input v-model="form.materialMatnr" placeholder="请输入编码" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="名称" prop="materialMaktx" label-width="100px">
<el-input v-model="form.materialMaktx" placeholder="请输入名称" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="销售组织" prop="materialVkorg" label-width="100px">
<el-input v-model="form.materialVkorg" placeholder="请输入销售组织" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="分销渠道" prop="materialVtweg" label-width="100px">
<el-input v-model="form.materialVtweg" placeholder="请输入分销渠道" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="单位" prop="materialMeins" label-width="100px">
<el-input v-model="form.materialMeins" placeholder="请输入单位" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="产品组" prop="materialSpart" label-width="100px">
<el-input v-model="form.materialSpart" placeholder="请输入产品组" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="产品组描述" prop="materialVtext" label-width="100px">
<el-input v-model="form.materialVtext" placeholder="请输入产品组描述" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="类别" prop="materialMatkl" label-width="100px">
<el-input v-model="form.materialMatkl" placeholder="请输入类别" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="类别描述" prop="materialWgbez" label-width="100px">
<el-input v-model="form.materialWgbez" placeholder="请输入类别描述" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="单位净重" prop="materialDwjz" label-width="100px">
<el-input v-model="form.materialDwjz" placeholder="请输入单位净重" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="标识" prop="materialMrbs" label-width="100px">
<el-select v-model="form.materialMrbs" placeholder="请选择标识(100米/卷)">
<el-option
v-for="dict in dict.type.sap_segmentation"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="是否有效" prop="materialSfyx" label-width="100px">
<el-select v-model="form.materialSfyx" placeholder="请选择是否有效">
<el-option
v-for="dict in dict.type.sap_material_state"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
</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>
<script>
import { listSapMaterial, getSapMaterial, delSapMaterial, addSapMaterial, updateSapMaterial } from "@/api/sapMaterial/sapMaterial";
export default {
name: "SapMaterial",
dicts: ['sap_segmentation', 'sap_material_state'],
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
sapMaterialList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
materialMatnr: null,
materialMaktx: null,
materialMrbs: null,
materialSfyx: null
},
//
form: {},
//
rules: {
materialMatnr: [
{ required: true, message: "编码不能为空", trigger: "blur" }
],
materialMaktx: [
{ required: true, message: "名称不能为空", trigger: "blur" }
],
materialVkorg: [
{ required: true, message: "销售组织不能为空", trigger: "blur" }
],
materialVtweg: [
{ required: true, message: "分销渠道不能为空", trigger: "blur" }
],
materialMeins: [
{ required: true, message: "单位不能为空", trigger: "blur" }
],
materialSpart: [
{ required: true, message: "产品组不能为空", trigger: "blur" }
],
materialVtext: [
{ required: true, message: "产品组描述不能为空", trigger: "blur" }
],
materialMatkl: [
{ required: true, message: "类别不能为空", trigger: "blur" }
],
materialWgbez: [
{ required: true, message: "类别描述不能为空", trigger: "blur" }
],
materialDwjz: [
{ required: true, message: "单位净重不能为空", trigger: "blur" }
],
materialSfyx: [
{ required: true, message: "是否有效不能为空", trigger: "blur" }
],
}
};
},
created() {
this.getList();
},
methods: {
/** 查询物料管理列表 */
getList() {
this.loading = true;
listSapMaterial(this.queryParams).then(response => {
this.sapMaterialList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
materialId: null,
materialMatnr: null,
materialMaktx: null,
materialVkorg: null,
materialVtweg: null,
materialMeins: null,
materialSpart: null,
materialVtext: null,
materialMatkl: null,
materialWgbez: null,
materialDwjz: null,
materialChangj: null,
materialXingh: null,
materialGuig: null,
materialJiem: null,
materialDiany: null,
materialTemp: null,
materialModel: null,
materialMrbs: null,
materialSfyx: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.materialId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加物料管理";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const materialId = row.materialId || this.ids
getSapMaterial(materialId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改物料管理";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.materialId != null) {
updateSapMaterial(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addSapMaterial(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const materialIds = row.materialId || this.ids;
this.$modal.confirm('是否确认删除物料管理编号为"' + materialIds + '"的数据项?').then(function() {
return delSapMaterial(materialIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('sapMaterial/sapMaterial/export', {
...this.queryParams
}, `sapMaterial_${new Date().getTime()}.xlsx`)
},
/** 序号 */
rowSapMaterialIndex({ row, rowIndex }) {
row.index = rowIndex + 1;
},
}
};
</script>