Commit e0a86769 authored by 耿迪迪's avatar 耿迪迪

配件入库

parent c0c8f760
package com.zehong.web.controller.track;
import java.util.List;
import com.zehong.system.domain.vo.InHouseVo;
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.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.enums.BusinessType;
import com.zehong.system.domain.track.TProductStore;
import com.zehong.system.service.track.ITProductStoreService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;
/**
* 配件Controller
*
* @author zehong
* @date 2024-08-22
*/
@RestController
@RequestMapping("/track/store")
public class TProductStoreController extends BaseController
{
@Autowired
private ITProductStoreService tProductStoreService;
/**
* 查询配件列表
*/
// @PreAuthorize("@ss.hasPermi('system:store:list')")
@GetMapping("/list")
public TableDataInfo list(TProductStore tProductStore)
{
startPage();
List<TProductStore> list = tProductStoreService.selectTProductStoreList(tProductStore);
return getDataTable(list);
}
@GetMapping("/storeList")
public AjaxResult storeList(TProductStore tProductStore)
{
List<TProductStore> list = tProductStoreService.selectTProductStoreList(tProductStore);
return AjaxResult.success(list);
}
/**
* 导出配件列表
*/
//@PreAuthorize("@ss.hasPermi('system:store:export')")
@Log(title = "配件", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(TProductStore tProductStore)
{
List<TProductStore> list = tProductStoreService.selectTProductStoreList(tProductStore);
ExcelUtil<TProductStore> util = new ExcelUtil<TProductStore>(TProductStore.class);
return util.exportExcel(list, "配件数据");
}
/**
* 获取配件详细信息
*/
//@PreAuthorize("@ss.hasPermi('system:store:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(tProductStoreService.selectTProductStoreById(id));
}
/**
* 新增配件
*/
//@PreAuthorize("@ss.hasPermi('system:store:add')")
@Log(title = "配件", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TProductStore tProductStore)
{
return toAjax(tProductStoreService.insertTProductStore(tProductStore));
}
/**
* 修改配件
*/
//@PreAuthorize("@ss.hasPermi('system:store:edit')")
@Log(title = "配件", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TProductStore tProductStore)
{
return toAjax(tProductStoreService.updateTProductStore(tProductStore));
}
/**
* 删除配件
*/
//@PreAuthorize("@ss.hasPermi('system:store:remove')")
@Log(title = "配件", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(tProductStoreService.deleteTProductStoreByIds(ids));
}
/**
* 入库信息
* @param storeInfo
* @return
*/
@PostMapping("/inHouse")
public AjaxResult inHouse(@RequestBody List<InHouseVo> storeInfo){
return toAjax(tProductStoreService.inHouse(storeInfo));
}
}
package com.zehong.web.controller.track;
import java.util.List;
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.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.enums.BusinessType;
import com.zehong.system.domain.track.TProductStoreLog;
import com.zehong.system.service.track.ITProductStoreLogService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;
/**
* 配件入库记录Controller
*
* @author zehong
* @date 2024-08-22
*/
@RestController
@RequestMapping("/track/storeLog")
public class TProductStoreLogController extends BaseController
{
@Autowired
private ITProductStoreLogService tProductStoreLogService;
/**
* 查询配件入库记录列表
*/
// @PreAuthorize("@ss.hasPermi('system:log:list')")
@GetMapping("/list")
public TableDataInfo list(TProductStoreLog tProductStoreLog)
{
startPage();
List<TProductStoreLog> list = tProductStoreLogService.selectTProductStoreLogList(tProductStoreLog);
return getDataTable(list);
}
/**
* 导出配件入库记录列表
*/
//@PreAuthorize("@ss.hasPermi('system:log:export')")
@Log(title = "配件入库记录", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(TProductStoreLog tProductStoreLog)
{
List<TProductStoreLog> list = tProductStoreLogService.selectTProductStoreLogList(tProductStoreLog);
ExcelUtil<TProductStoreLog> util = new ExcelUtil<TProductStoreLog>(TProductStoreLog.class);
return util.exportExcel(list, "配件入库记录数据");
}
/**
* 获取配件入库记录详细信息
*/
//@PreAuthorize("@ss.hasPermi('system:log:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(tProductStoreLogService.selectTProductStoreLogById(id));
}
/**
* 新增配件入库记录
*/
//@PreAuthorize("@ss.hasPermi('system:log:add')")
@Log(title = "配件入库记录", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TProductStoreLog tProductStoreLog)
{
return toAjax(tProductStoreLogService.insertTProductStoreLog(tProductStoreLog));
}
/**
* 修改配件入库记录
*/
//@PreAuthorize("@ss.hasPermi('system:log:edit')")
@Log(title = "配件入库记录", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TProductStoreLog tProductStoreLog)
{
return toAjax(tProductStoreLogService.updateTProductStoreLog(tProductStoreLog));
}
/**
* 删除配件入库记录
*/
//@PreAuthorize("@ss.hasPermi('system:log:remove')")
@Log(title = "配件入库记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(tProductStoreLogService.deleteTProductStoreLogByIds(ids));
}
}
......@@ -7,6 +7,12 @@ import com.zehong.common.utils.DateUtils;
#break
#end
#end
#foreach ($column in $columns)
#if($column.javaField == 'createId')
import com.zehong.common.utils.SecurityUtils;
#break
#end
#end
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
#if($table.sub)
......
package com.zehong.system.domain.track;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zehong.common.annotation.Excel;
import com.zehong.common.core.domain.BaseEntity;
/**
* 配件对象 t_product_store
*
* @author zehong
* @date 2024-08-22
*/
public class TProductStore extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 配件名称 */
@Excel(name = "配件名称")
private String title;
/** 配件编号 */
@Excel(name = "配件编号")
private String planNo;
/** 规格参数 */
@Excel(name = "规格参数")
private String specs;
/** 库存数量 */
@Excel(name = "库存数量")
private Long total;
/** 配件描述 */
@Excel(name = "配件描述")
private String content;
/** 供货商 */
@Excel(name = "供货商")
private String supplier;
/** 联系人 */
@Excel(name = "联系人")
private String username;
/** 联系电话 */
@Excel(name = "联系电话")
private String tel;
/** 详细地址 */
@Excel(name = "详细地址")
private String address;
/** $column.columnComment */
private Long createId;
private String isDel;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setTitle(String title)
{
this.title = title;
}
public String getTitle()
{
return title;
}
public void setPlanNo(String planNo)
{
this.planNo = planNo;
}
public String getPlanNo()
{
return planNo;
}
public void setSpecs(String specs)
{
this.specs = specs;
}
public String getSpecs()
{
return specs;
}
public void setTotal(Long total)
{
this.total = total;
}
public Long getTotal()
{
return total;
}
public void setContent(String content)
{
this.content = content;
}
public String getContent()
{
return content;
}
public void setSupplier(String supplier)
{
this.supplier = supplier;
}
public String getSupplier()
{
return supplier;
}
public void setUsername(String username)
{
this.username = username;
}
public String getUsername()
{
return username;
}
public void setTel(String tel)
{
this.tel = tel;
}
public String getTel()
{
return tel;
}
public void setAddress(String address)
{
this.address = address;
}
public String getAddress()
{
return address;
}
public void setCreateId(Long createId)
{
this.createId = createId;
}
public Long getCreateId()
{
return createId;
}
public String getIsDel() {
return isDel;
}
public void setIsDel(String isDel) {
this.isDel = isDel;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("title", getTitle())
.append("planNo", getPlanNo())
.append("specs", getSpecs())
.append("total", getTotal())
.append("content", getContent())
.append("supplier", getSupplier())
.append("username", getUsername())
.append("tel", getTel())
.append("address", getAddress())
.append("createTime", getCreateTime())
.append("createId", getCreateId())
.toString();
}
}
package com.zehong.system.domain.track;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zehong.common.annotation.Excel;
import com.zehong.common.core.domain.BaseEntity;
/**
* 配件入库记录对象 t_product_store_log
*
* @author zehong
* @date 2024-08-22
*/
public class TProductStoreLog extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 配件编号 */
private Long storeId;
/** 数量 */
@Excel(name = "数量")
private Long number;
/** $column.columnComment */
private Long createId;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setStoreId(Long storeId)
{
this.storeId = storeId;
}
public Long getStoreId()
{
return storeId;
}
public void setNumber(Long number)
{
this.number = number;
}
public Long getNumber()
{
return number;
}
public void setCreateId(Long createId)
{
this.createId = createId;
}
public Long getCreateId()
{
return createId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("storeId", getStoreId())
.append("number", getNumber())
.append("createTime", getCreateTime())
.append("createId", getCreateId())
.toString();
}
}
package com.zehong.system.domain.vo;
public class InHouseVo {
/**配件id*/
private Long id;
/**配件数量*/
private Long num;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getNum() {
return num;
}
public void setNum(Long num) {
this.num = num;
}
}
package com.zehong.system.mapper.track;
import java.util.List;
import com.zehong.system.domain.track.TProductStoreLog;
/**
* 配件入库记录Mapper接口
*
* @author zehong
* @date 2024-08-22
*/
public interface TProductStoreLogMapper
{
/**
* 查询配件入库记录
*
* @param id 配件入库记录ID
* @return 配件入库记录
*/
public TProductStoreLog selectTProductStoreLogById(Long id);
/**
* 查询配件入库记录列表
*
* @param tProductStoreLog 配件入库记录
* @return 配件入库记录集合
*/
public List<TProductStoreLog> selectTProductStoreLogList(TProductStoreLog tProductStoreLog);
/**
* 新增配件入库记录
*
* @param tProductStoreLog 配件入库记录
* @return 结果
*/
public int insertTProductStoreLog(TProductStoreLog tProductStoreLog);
/**
* 修改配件入库记录
*
* @param tProductStoreLog 配件入库记录
* @return 结果
*/
public int updateTProductStoreLog(TProductStoreLog tProductStoreLog);
/**
* 删除配件入库记录
*
* @param id 配件入库记录ID
* @return 结果
*/
public int deleteTProductStoreLogById(Long id);
/**
* 批量删除配件入库记录
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteTProductStoreLogByIds(Long[] ids);
}
package com.zehong.system.mapper.track;
import java.util.List;
import com.zehong.system.domain.track.TProductStore;
/**
* 配件Mapper接口
*
* @author zehong
* @date 2024-08-22
*/
public interface TProductStoreMapper
{
/**
* 查询配件
*
* @param id 配件ID
* @return 配件
*/
public TProductStore selectTProductStoreById(Long id);
/**
* 查询配件列表
*
* @param tProductStore 配件
* @return 配件集合
*/
public List<TProductStore> selectTProductStoreList(TProductStore tProductStore);
/**
* 新增配件
*
* @param tProductStore 配件
* @return 结果
*/
public int insertTProductStore(TProductStore tProductStore);
/**
* 修改配件
*
* @param tProductStore 配件
* @return 结果
*/
public int updateTProductStore(TProductStore tProductStore);
/**
* 删除配件
*
* @param id 配件ID
* @return 结果
*/
public int deleteTProductStoreById(Long id);
/**
* 批量删除配件
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteTProductStoreByIds(Long[] ids);
}
package com.zehong.system.service.impl.track;
import java.util.List;
import com.zehong.common.utils.DateUtils;
import com.zehong.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zehong.system.mapper.track.TProductStoreLogMapper;
import com.zehong.system.domain.track.TProductStoreLog;
import com.zehong.system.service.track.ITProductStoreLogService;
/**
* 配件入库记录Service业务层处理
*
* @author zehong
* @date 2024-08-22
*/
@Service
public class TProductStoreLogServiceImpl implements ITProductStoreLogService
{
@Autowired
private TProductStoreLogMapper tProductStoreLogMapper;
/**
* 查询配件入库记录
*
* @param id 配件入库记录ID
* @return 配件入库记录
*/
@Override
public TProductStoreLog selectTProductStoreLogById(Long id)
{
return tProductStoreLogMapper.selectTProductStoreLogById(id);
}
/**
* 查询配件入库记录列表
*
* @param tProductStoreLog 配件入库记录
* @return 配件入库记录
*/
@Override
public List<TProductStoreLog> selectTProductStoreLogList(TProductStoreLog tProductStoreLog)
{
return tProductStoreLogMapper.selectTProductStoreLogList(tProductStoreLog);
}
/**
* 新增配件入库记录
*
* @param tProductStoreLog 配件入库记录
* @return 结果
*/
@Override
public int insertTProductStoreLog(TProductStoreLog tProductStoreLog)
{
tProductStoreLog.setCreateTime(DateUtils.getNowDate());
tProductStoreLog.setCreateId(SecurityUtils.getLoginUser().getUser().getUserId());
return tProductStoreLogMapper.insertTProductStoreLog(tProductStoreLog);
}
/**
* 修改配件入库记录
*
* @param tProductStoreLog 配件入库记录
* @return 结果
*/
@Override
public int updateTProductStoreLog(TProductStoreLog tProductStoreLog)
{
return tProductStoreLogMapper.updateTProductStoreLog(tProductStoreLog);
}
/**
* 批量删除配件入库记录
*
* @param ids 需要删除的配件入库记录ID
* @return 结果
*/
@Override
public int deleteTProductStoreLogByIds(Long[] ids)
{
return tProductStoreLogMapper.deleteTProductStoreLogByIds(ids);
}
/**
* 删除配件入库记录信息
*
* @param id 配件入库记录ID
* @return 结果
*/
@Override
public int deleteTProductStoreLogById(Long id)
{
return tProductStoreLogMapper.deleteTProductStoreLogById(id);
}
}
package com.zehong.system.service.impl.track;
import com.zehong.common.utils.DateUtils;
import com.zehong.common.utils.SecurityUtils;
import com.zehong.system.domain.track.TProductStore;
import com.zehong.system.domain.track.TProductStoreLog;
import com.zehong.system.domain.vo.InHouseVo;
import com.zehong.system.mapper.track.TProductStoreMapper;
import com.zehong.system.service.track.ITProductStoreLogService;
import com.zehong.system.service.track.ITProductStoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
/**
* 配件Service业务层处理
*
* @author zehong
* @date 2024-08-22
*/
@Service
public class TProductStoreServiceImpl implements ITProductStoreService
{
@Autowired
private TProductStoreMapper tProductStoreMapper;
@Resource
private ITProductStoreLogService itProductStoreLogService;
/**
* 查询配件
*
* @param id 配件ID
* @return 配件
*/
@Override
public TProductStore selectTProductStoreById(Long id)
{
return tProductStoreMapper.selectTProductStoreById(id);
}
/**
* 查询配件列表
*
* @param tProductStore 配件
* @return 配件
*/
@Override
public List<TProductStore> selectTProductStoreList(TProductStore tProductStore)
{
return tProductStoreMapper.selectTProductStoreList(tProductStore);
}
/**
* 新增配件
*
* @param tProductStore 配件
* @return 结果
*/
@Override
@Transactional(rollbackFor = Exception.class)
public int insertTProductStore(TProductStore tProductStore)
{
tProductStore.setCreateTime(DateUtils.getNowDate());
tProductStore.setCreateId(SecurityUtils.getLoginUser().getUser().getUserId());
tProductStoreMapper.insertTProductStore(tProductStore);
TProductStoreLog log = new TProductStoreLog();
log.setNumber(tProductStore.getTotal());
log.setStoreId(tProductStore.getId());
return itProductStoreLogService.insertTProductStoreLog(log);
}
/**
* 修改配件
*
* @param tProductStore 配件
* @return 结果
*/
@Override
public int updateTProductStore(TProductStore tProductStore)
{
return tProductStoreMapper.updateTProductStore(tProductStore);
}
/**
* 批量删除配件
*
* @param ids 需要删除的配件ID
* @return 结果
*/
@Override
public int deleteTProductStoreByIds(Long[] ids)
{
return tProductStoreMapper.deleteTProductStoreByIds(ids);
}
/**
* 删除配件信息
*
* @param id 配件ID
* @return 结果
*/
@Override
public int deleteTProductStoreById(Long id)
{
return tProductStoreMapper.deleteTProductStoreById(id);
}
/**
* 配件批量入库
* @param storeInfo 配件信息
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public int inHouse(List<InHouseVo> storeInfo){
for(InHouseVo house : storeInfo){
TProductStore store = tProductStoreMapper.selectTProductStoreById(house.getId());
store.setTotal(store.getTotal() + house.getNum());
tProductStoreMapper.updateTProductStore(store);
TProductStoreLog log = new TProductStoreLog();
log.setNumber(house.getNum());
log.setStoreId(house.getId());
itProductStoreLogService.insertTProductStoreLog(log);
}
return 1;
}
}
package com.zehong.system.service.track;
import java.util.List;
import com.zehong.system.domain.track.TProductStoreLog;
/**
* 配件入库记录Service接口
*
* @author zehong
* @date 2024-08-22
*/
public interface ITProductStoreLogService
{
/**
* 查询配件入库记录
*
* @param id 配件入库记录ID
* @return 配件入库记录
*/
public TProductStoreLog selectTProductStoreLogById(Long id);
/**
* 查询配件入库记录列表
*
* @param tProductStoreLog 配件入库记录
* @return 配件入库记录集合
*/
public List<TProductStoreLog> selectTProductStoreLogList(TProductStoreLog tProductStoreLog);
/**
* 新增配件入库记录
*
* @param tProductStoreLog 配件入库记录
* @return 结果
*/
public int insertTProductStoreLog(TProductStoreLog tProductStoreLog);
/**
* 修改配件入库记录
*
* @param tProductStoreLog 配件入库记录
* @return 结果
*/
public int updateTProductStoreLog(TProductStoreLog tProductStoreLog);
/**
* 批量删除配件入库记录
*
* @param ids 需要删除的配件入库记录ID
* @return 结果
*/
public int deleteTProductStoreLogByIds(Long[] ids);
/**
* 删除配件入库记录信息
*
* @param id 配件入库记录ID
* @return 结果
*/
public int deleteTProductStoreLogById(Long id);
}
package com.zehong.system.service.track;
import java.util.List;
import com.zehong.system.domain.track.TProductStore;
import com.zehong.system.domain.vo.InHouseVo;
/**
* 配件Service接口
*
* @author zehong
* @date 2024-08-22
*/
public interface ITProductStoreService
{
/**
* 查询配件
*
* @param id 配件ID
* @return 配件
*/
public TProductStore selectTProductStoreById(Long id);
/**
* 查询配件列表
*
* @param tProductStore 配件
* @return 配件集合
*/
public List<TProductStore> selectTProductStoreList(TProductStore tProductStore);
/**
* 新增配件
*
* @param tProductStore 配件
* @return 结果
*/
public int insertTProductStore(TProductStore tProductStore);
/**
* 修改配件
*
* @param tProductStore 配件
* @return 结果
*/
public int updateTProductStore(TProductStore tProductStore);
/**
* 批量删除配件
*
* @param ids 需要删除的配件ID
* @return 结果
*/
public int deleteTProductStoreByIds(Long[] ids);
/**
* 删除配件信息
*
* @param id 配件ID
* @return 结果
*/
public int deleteTProductStoreById(Long id);
/**
* 配件批量入库
* @param storeInfo 配件信息
* @return
*/
int inHouse(List<InHouseVo> storeInfo);
}
<?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.zehong.system.mapper.track.TProductStoreLogMapper">
<resultMap type="TProductStoreLog" id="TProductStoreLogResult">
<result property="id" column="id" />
<result property="storeId" column="store_id" />
<result property="number" column="number" />
<result property="createTime" column="create_time" />
<result property="createId" column="create_id" />
</resultMap>
<sql id="selectTProductStoreLogVo">
select id, store_id, `number`, create_time, create_id from t_product_store_log
</sql>
<select id="selectTProductStoreLogList" parameterType="TProductStoreLog" resultMap="TProductStoreLogResult">
<include refid="selectTProductStoreLogVo"/>
<where>
<if test="storeId != null "> and store_id = #{storeId}</if>
<if test="number != null "> and `number` = #{number}</if>
<if test="createId != null "> and create_id = #{createId}</if>
</where>
order by create_time desc
</select>
<select id="selectTProductStoreLogById" parameterType="Long" resultMap="TProductStoreLogResult">
<include refid="selectTProductStoreLogVo"/>
where id = #{id}
</select>
<insert id="insertTProductStoreLog" parameterType="TProductStoreLog" useGeneratedKeys="true" keyProperty="id">
insert into t_product_store_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="storeId != null">store_id,</if>
<if test="number != null">`number`,</if>
<if test="createTime != null">create_time,</if>
<if test="createId != null">create_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="storeId != null">#{storeId},</if>
<if test="number != null">#{number},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createId != null">#{createId},</if>
</trim>
</insert>
<update id="updateTProductStoreLog" parameterType="TProductStoreLog">
update t_product_store_log
<trim prefix="SET" suffixOverrides=",">
<if test="storeId != null">store_id = #{storeId},</if>
<if test="number != null">`number` = #{number},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createId != null">create_id = #{createId},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteTProductStoreLogById" parameterType="Long">
delete from t_product_store_log where id = #{id}
</delete>
<delete id="deleteTProductStoreLogByIds" parameterType="String">
delete from t_product_store_log where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
<?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.zehong.system.mapper.track.TProductStoreMapper">
<resultMap type="TProductStore" id="TProductStoreResult">
<result property="id" column="id" />
<result property="title" column="title" />
<result property="planNo" column="plan_no" />
<result property="specs" column="specs" />
<result property="total" column="total" />
<result property="content" column="content" />
<result property="supplier" column="supplier" />
<result property="username" column="username" />
<result property="tel" column="tel" />
<result property="address" column="address" />
<result property="createTime" column="create_time" />
<result property="createId" column="create_id" />
<result property="isDel" column="is_del" />
</resultMap>
<sql id="selectTProductStoreVo">
select id, title, plan_no, specs, total, content, supplier, username, tel, address, create_time, create_id from t_product_store
</sql>
<select id="selectTProductStoreList" parameterType="TProductStore" resultMap="TProductStoreResult">
<include refid="selectTProductStoreVo"/>
<where>
<if test="title != null and title != ''"> and title like concat('%', #{title}, '%')</if>
<if test="planNo != null and planNo != ''"> and plan_no like concat('%', #{planNo}, '%')</if>
and is_del = '0'
</where>
order by create_time desc
</select>
<select id="selectTProductStoreById" parameterType="Long" resultMap="TProductStoreResult">
<include refid="selectTProductStoreVo"/>
where id = #{id}
</select>
<insert id="insertTProductStore" parameterType="TProductStore" useGeneratedKeys="true" keyProperty="id">
insert into t_product_store
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="title != null and title != ''">title,</if>
<if test="planNo != null and planNo != ''">plan_no,</if>
<if test="specs != null">specs,</if>
<if test="total != null">total,</if>
<if test="content != null">content,</if>
<if test="supplier != null">supplier,</if>
<if test="username != null">username,</if>
<if test="tel != null and tel != ''">tel,</if>
<if test="address != null">address,</if>
<if test="createTime != null">create_time,</if>
<if test="createId != null">create_id,</if>
<if test="isDel != null">is_del,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="title != null and title != ''">#{title},</if>
<if test="planNo != null and planNo != ''">#{planNo},</if>
<if test="specs != null">#{specs},</if>
<if test="total != null">#{total},</if>
<if test="content != null">#{content},</if>
<if test="supplier != null">#{supplier},</if>
<if test="username != null">#{username},</if>
<if test="tel != null and tel != ''">#{tel},</if>
<if test="address != null">#{address},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createId != null">#{createId},</if>
<if test="isDel != null">#{isDel},</if>
</trim>
</insert>
<update id="updateTProductStore" parameterType="TProductStore">
update t_product_store
<trim prefix="SET" suffixOverrides=",">
<if test="title != null and title != ''">title = #{title},</if>
<if test="planNo != null and planNo != ''">plan_no = #{planNo},</if>
<if test="specs != null">specs = #{specs},</if>
<if test="total != null">total = #{total},</if>
<if test="content != null">content = #{content},</if>
<if test="supplier != null">supplier = #{supplier},</if>
<if test="username != null">username = #{username},</if>
<if test="tel != null and tel != ''">tel = #{tel},</if>
<if test="address != null">address = #{address},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createId != null">create_id = #{createId},</if>
<if test="isDel != null">is_del = #{isDel},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteTProductStoreById" parameterType="Long">
delete from t_product_store where id = #{id}
</delete>
<delete id="deleteTProductStoreByIds" parameterType="String">
update t_product_store set is_del = '1' where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
import request from '@/utils/request'
// 查询配件列表
export function listStore(query) {
return request({
url: '/track/store/list',
method: 'get',
params: query
})
}
//所有配件信息
export function getStores(query) {
return request({
url: '/track/store/storeList',
method: 'get',
params: query
})
}
// 查询配件详细
export function getStore(id) {
return request({
url: '/track/store/' + id,
method: 'get'
})
}
// 新增配件
export function addStore(data) {
return request({
url: '/track/store',
method: 'post',
data: data
})
}
// 修改配件
export function updateStore(data) {
return request({
url: '/track/store',
method: 'put',
data: data
})
}
// 删除配件
export function delStore(id) {
return request({
url: '/track/store/' + id,
method: 'delete'
})
}
// 导出配件
export function exportStore(query) {
return request({
url: '/track/store/export',
method: 'get',
params: query
})
}
//入库
export function inHouse(data) {
return request({
url: '/track/store/inHouse',
method: 'post',
data: data
})
}
import request from '@/utils/request'
// 查询配件入库记录列表
export function listLog(query) {
return request({
url: '/track/storeLog/list',
method: 'get',
params: query
})
}
// 查询配件入库记录详细
export function getLog(id) {
return request({
url: '/track/storeLog/' + id,
method: 'get'
})
}
// 新增配件入库记录
export function addLog(data) {
return request({
url: '/track/storeLog',
method: 'post',
data: data
})
}
// 修改配件入库记录
export function updateLog(data) {
return request({
url: '/track/storeLog',
method: 'put',
data: data
})
}
// 删除配件入库记录
export function delLog(id) {
return request({
url: '/track/storeLog/' + id,
method: 'delete'
})
}
// 导出配件入库记录
export function exportLog(query) {
return request({
url: '/track/storeLog/export',
method: 'get',
params: query
})
}
......@@ -312,7 +312,7 @@ export default {
trigger: 'blur',
transform(value) {
let phonereg = 11 && /^((13|14|15|16|17|18|19)[0-9]{1}\d{8})$/
if (!phonereg.test(value)) {
if (value && !phonereg.test(value)) {
return false
} else {
return Number(value)
......
<template>
<el-dialog title="详情" :visible.sync="detailOpen" width="800px" append-to-body destroy-on-close :close-on-click-modal="false">
<el-form label-width="90px">
<el-row class="el-row-table">
<el-col :span="12">
<el-form-item label="配件名称">
<span v-if="detailInfo.title">{{ detailInfo.title }}</span>
<span v-else>-</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="配件编号">
<span v-if="detailInfo.planNo">{{ detailInfo.planNo }}</span>
<span v-else>-</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="规格参数">
<span v-if="detailInfo.specs">{{ detailInfo.specs }}</span>
<span v-else>-</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="库存数量">
<span v-if="detailInfo.total">{{ detailInfo.total }}</span>
<span v-else>-</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="配件描述">
<span v-if="detailInfo.content">{{ detailInfo.content }}</span>
<span v-else>-</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="供货商">
<span v-if="detailInfo.supplier">{{ detailInfo.supplier }}</span>
<span v-else>-</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="联系人">
<span v-if="detailInfo.username">{{ detailInfo.username }}</span>
<span v-else>-</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="联系电话">
<span v-if="detailInfo.tel">{{ detailInfo.tel }}</span>
<span v-else>-</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="详细地址">
<span v-if="detailInfo.address">{{ detailInfo.address }}</span>
<span v-else>-</span>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-dialog>
</template>
<script>
import { getStore } from "@/api/track/store";
export default {
name: "detail-info",
data(){
return{
detailOpen: false,
detailInfo: {}
}
},
methods:{
getDetailInfo(id){
getStore(id).then(res =>{
if(res.code == 200){
this.detailInfo = res.data;
this.detailOpen = true;
}
})
}
}
}
</script>
<style scoped>
</style>
<template>
<!-- 入库 -->
<el-dialog title="入库" :visible.sync="houseOpen" width="500px" append-to-body destroy-on-close :close-on-click-modal="false">
<div class="store-form">
<div class="store-item" v-for="(item,index) in inHouseStore">
<div class="store-info">
<el-select v-model="item.id" placeholder="请选择配件" clearable size="small" @change="storeChange($event,index)">
<el-option
v-for="store in storeList"
:key="store.id"
:label="store.title"
:value="store.id"
/>
</el-select>
</div>
<div class="store-info">
<el-input type="number" v-model.number="item.num" placeholder="请输入数量" size="small"/>
</div>
<div class="store-operate">
<i style="color:#1890ff" class="el-icon-circle-plus-outline" v-if="index == 0" @click="addStore"></i>
<i style="color: #ff9292" class="el-icon-remove-outline" v-else @click="delStore(index)"></i>
</div>
</div>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitStore">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
</template>
<script>
import { getStores, inHouse } from "@/api/track/store";
export default {
name: "house",
data(){
return{
houseOpen: false,
storeList: [],
inHouseStore: [{}]
}
},
methods:{
openHouse(){
this.initInHouseStore();
getStores().then(res =>{
if(res.code == 200){
this.storeList = res.data;
this.houseOpen = true;
}
});
},
addStore(){
if(this.storeList.length == this.inHouseStore.length){
this.$message.error("当前没有更多可添加配件,只有" + this.storeList.length +"种配件可入库");
return
};
this.inHouseStore.push({});
},
delStore(index){
this.inHouseStore.splice(index, 1);
},
storeChange(val,index){
const store = this.inHouseStore.filter(item => item.id == val);
if(store.length > 1){
this.inHouseStore[index].id = "";
this.$message.error("此配件已被选中")
}
},
submitStore(){
console.log("gege=======",this.inHouseStore)
this.inHouseStore.forEach(item =>{
if(!(item.id && item.num)){
this.$message.error("请检查信息是否填完整");
return
}
inHouse(this.inHouseStore).then(res =>{
if(res.code == 200){
this.houseOpen = false;
this.$parent.getList();
}
})
})
},
cancel(){
this.houseOpen = false;
this.initInHouseStore();
},
initInHouseStore(){
this.inHouseStore = [{}];
}
}
}
</script>
<style scoped lang="scss">
.store-form{
height: 350px;
overflow-y: scroll;
&::-webkit-scrollbar {
/* 设置滚动条宽度 */
width: 4px;
/* 设置滚动条背景色 */
//background: black;
}
//滚动条轨道
&::-webkit-scrollbar-track {
background-color:transparent;
-webkit-border-radius: 2em;
-moz-border-radius: 2em;
border-radius:2em;
}
//滚动条滑块
&::-webkit-scrollbar-thumb {
background-color: rgb(147,147,153,0.5);
-webkit-border-radius: 2em;
-moz-border-radius: 2em;
border-radius:2em;
}
}
.store-item{
display: flex;
margin: 4px auto;
}
.store-info{
flex: 2;
}
.store-operate{
flex: 0.2;
text-align: center;
margin: auto
}
</style>
This diff is collapsed.
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="配件编号" prop="storeId">
<el-input
v-model="queryParams.storeId"
placeholder="请输入配件编号"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="数量" prop="number">
<el-input
v-model="queryParams.number"
placeholder="请输入数量"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="数量" prop="createId">
<el-input
v-model="queryParams.createId"
placeholder="请输入数量"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</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"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
:loading="exportLoading"
@click="handleExport"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="logList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="数量" align="center" prop="id" />
<el-table-column label="配件编号" align="center" prop="storeId" />
<el-table-column label="数量" align="center" prop="number" />
<el-table-column label="数量" align="center" prop="createId" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除</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="800px" append-to-body destroy-on-close :close-on-click-modal="false">
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="配件编号" prop="storeId">
<el-input v-model="form.storeId" placeholder="请输入配件编号" />
</el-form-item>
<el-form-item label="数量" prop="number">
<el-input v-model="form.number" placeholder="请输入数量" />
</el-form-item>
<el-form-item label="数量" prop="createId">
<el-input v-model="form.createId" 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>
<script>
import { listLog, getLog, delLog, addLog, updateLog, exportLog } from "@/api/track/storeLog";
export default {
name: "Log",
components: {
},
data() {
return {
// 遮罩层
loading: true,
// 导出遮罩层
exportLoading: false,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 配件入库记录表格数据
logList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
storeId: null,
number: null,
createId: null
},
// 表单参数
form: {},
// 表单校验
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询配件入库记录列表 */
getList() {
this.loading = true;
listLog(this.queryParams).then(response => {
this.logList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
storeId: null,
number: null,
createTime: null,
createId: 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.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加配件入库记录";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getLog(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改配件入库记录";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateLog(this.form).then(response => {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addLog(this.form).then(response => {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$confirm('是否确认删除配件入库记录编号为"' + ids + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return delLog(ids);
}).then(() => {
this.getList();
this.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有配件入库记录数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.exportLoading = true;
return exportLog(queryParams);
}).then(response => {
this.download(response.msg);
this.exportLoading = false;
}).catch(() => {});
}
}
};
</script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment