条码打印相关功能
This commit is contained in:
@@ -0,0 +1,104 @@
|
|||||||
|
package com.ruoyi.bas.traycode.controller;
|
||||||
|
|
||||||
|
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.bas.traycode.domain.BasTraycode;
|
||||||
|
import com.ruoyi.bas.traycode.service.IBasTraycodeService;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 条码信息Controller
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-07-28
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/bas/traycode")
|
||||||
|
public class BasTraycodeController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private IBasTraycodeService basTraycodeService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询条码信息列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('bas:traycode:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(BasTraycode basTraycode)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<BasTraycode> list = basTraycodeService.selectBasTraycodeList(basTraycode);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出条码信息列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('bas:traycode:export')")
|
||||||
|
@Log(title = "条码信息", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, BasTraycode basTraycode)
|
||||||
|
{
|
||||||
|
List<BasTraycode> list = basTraycodeService.selectBasTraycodeList(basTraycode);
|
||||||
|
ExcelUtil<BasTraycode> util = new ExcelUtil<BasTraycode>(BasTraycode.class);
|
||||||
|
util.exportExcel(response, list, "条码信息数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取条码信息详细信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('bas:traycode:query')")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||||
|
{
|
||||||
|
return success(basTraycodeService.selectBasTraycodeById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增条码信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('bas:traycode:add')")
|
||||||
|
@Log(title = "条码信息", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody BasTraycode basTraycode)
|
||||||
|
{
|
||||||
|
return toAjax(basTraycodeService.insertBasTraycode(basTraycode));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改条码信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('bas:traycode:edit')")
|
||||||
|
@Log(title = "条码信息", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@RequestBody BasTraycode basTraycode)
|
||||||
|
{
|
||||||
|
return toAjax(basTraycodeService.updateBasTraycode(basTraycode));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除条码信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('bas:traycode:remove')")
|
||||||
|
@Log(title = "条码信息", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] ids)
|
||||||
|
{
|
||||||
|
return toAjax(basTraycodeService.deleteBasTraycodeByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,114 @@
|
|||||||
|
package com.ruoyi.bas.traycode.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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 条码信息对象 bas_traycode
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-07-28
|
||||||
|
*/
|
||||||
|
public class BasTraycode extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** id */
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 条码类型id */
|
||||||
|
@Excel(name = "条码类型id")
|
||||||
|
private Long formatId;
|
||||||
|
|
||||||
|
/** 条码 */
|
||||||
|
@Excel(name = "条码")
|
||||||
|
private String trayCode;
|
||||||
|
|
||||||
|
/** 备用字段1 */
|
||||||
|
@Excel(name = "备用字段1")
|
||||||
|
private String spare1;
|
||||||
|
|
||||||
|
/** 备用字段2 */
|
||||||
|
@Excel(name = "备用字段2")
|
||||||
|
private String spare2;
|
||||||
|
|
||||||
|
/** 备用字段3 */
|
||||||
|
@Excel(name = "备用字段3")
|
||||||
|
private String spare3;
|
||||||
|
|
||||||
|
public void setId(Long id)
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getId()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFormatId(Long formatId)
|
||||||
|
{
|
||||||
|
this.formatId = formatId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getFormatId()
|
||||||
|
{
|
||||||
|
return formatId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTrayCode(String trayCode)
|
||||||
|
{
|
||||||
|
this.trayCode = trayCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTrayCode()
|
||||||
|
{
|
||||||
|
return trayCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSpare1(String spare1)
|
||||||
|
{
|
||||||
|
this.spare1 = spare1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSpare1()
|
||||||
|
{
|
||||||
|
return spare1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSpare2(String spare2)
|
||||||
|
{
|
||||||
|
this.spare2 = spare2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSpare2()
|
||||||
|
{
|
||||||
|
return spare2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSpare3(String spare3)
|
||||||
|
{
|
||||||
|
this.spare3 = spare3;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSpare3()
|
||||||
|
{
|
||||||
|
return spare3;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("id", getId())
|
||||||
|
.append("formatId", getFormatId())
|
||||||
|
.append("trayCode", getTrayCode())
|
||||||
|
.append("createTime", getCreateTime())
|
||||||
|
.append("updateTime", getUpdateTime())
|
||||||
|
.append("spare1", getSpare1())
|
||||||
|
.append("spare2", getSpare2())
|
||||||
|
.append("spare3", getSpare3())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
package com.ruoyi.bas.traycode.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.bas.traycode.domain.BasTraycode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 条码信息Mapper接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-07-28
|
||||||
|
*/
|
||||||
|
public interface BasTraycodeMapper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询条码信息
|
||||||
|
*
|
||||||
|
* @param id 条码信息主键
|
||||||
|
* @return 条码信息
|
||||||
|
*/
|
||||||
|
public BasTraycode selectBasTraycodeById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询条码信息列表
|
||||||
|
*
|
||||||
|
* @param basTraycode 条码信息
|
||||||
|
* @return 条码信息集合
|
||||||
|
*/
|
||||||
|
public List<BasTraycode> selectBasTraycodeList(BasTraycode basTraycode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增条码信息
|
||||||
|
*
|
||||||
|
* @param basTraycode 条码信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertBasTraycode(BasTraycode basTraycode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改条码信息
|
||||||
|
*
|
||||||
|
* @param basTraycode 条码信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateBasTraycode(BasTraycode basTraycode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除条码信息
|
||||||
|
*
|
||||||
|
* @param id 条码信息主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteBasTraycodeById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除条码信息
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteBasTraycodeByIds(Long[] ids);
|
||||||
|
|
||||||
|
void insertBasTraycodeList(List<BasTraycode> list);
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
package com.ruoyi.bas.traycode.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.bas.traycode.domain.BasTraycode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 条码信息Service接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-07-28
|
||||||
|
*/
|
||||||
|
public interface IBasTraycodeService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询条码信息
|
||||||
|
*
|
||||||
|
* @param id 条码信息主键
|
||||||
|
* @return 条码信息
|
||||||
|
*/
|
||||||
|
public BasTraycode selectBasTraycodeById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询条码信息列表
|
||||||
|
*
|
||||||
|
* @param basTraycode 条码信息
|
||||||
|
* @return 条码信息集合
|
||||||
|
*/
|
||||||
|
public List<BasTraycode> selectBasTraycodeList(BasTraycode basTraycode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增条码信息
|
||||||
|
*
|
||||||
|
* @param basTraycode 条码信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertBasTraycode(BasTraycode basTraycode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改条码信息
|
||||||
|
*
|
||||||
|
* @param basTraycode 条码信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateBasTraycode(BasTraycode basTraycode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除条码信息
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的条码信息主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteBasTraycodeByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除条码信息信息
|
||||||
|
*
|
||||||
|
* @param id 条码信息主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteBasTraycodeById(Long id);
|
||||||
|
|
||||||
|
void insertBasTraycodeList(List<BasTraycode> traycodeList);
|
||||||
|
}
|
||||||
@@ -0,0 +1,106 @@
|
|||||||
|
package com.ruoyi.bas.traycode.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.ruoyi.bas.traycode.mapper.BasTraycodeMapper;
|
||||||
|
import com.ruoyi.bas.traycode.domain.BasTraycode;
|
||||||
|
import com.ruoyi.bas.traycode.service.IBasTraycodeService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 条码信息Service业务层处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-07-28
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class BasTraycodeServiceImpl implements IBasTraycodeService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private BasTraycodeMapper basTraycodeMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询条码信息
|
||||||
|
*
|
||||||
|
* @param id 条码信息主键
|
||||||
|
* @return 条码信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public BasTraycode selectBasTraycodeById(Long id)
|
||||||
|
{
|
||||||
|
return basTraycodeMapper.selectBasTraycodeById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询条码信息列表
|
||||||
|
*
|
||||||
|
* @param basTraycode 条码信息
|
||||||
|
* @return 条码信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<BasTraycode> selectBasTraycodeList(BasTraycode basTraycode)
|
||||||
|
{
|
||||||
|
return basTraycodeMapper.selectBasTraycodeList(basTraycode);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增条码信息
|
||||||
|
*
|
||||||
|
* @param basTraycode 条码信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertBasTraycode(BasTraycode basTraycode)
|
||||||
|
{
|
||||||
|
basTraycode.setCreateTime(DateUtils.getNowDate());
|
||||||
|
return basTraycodeMapper.insertBasTraycode(basTraycode);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改条码信息
|
||||||
|
*
|
||||||
|
* @param basTraycode 条码信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateBasTraycode(BasTraycode basTraycode)
|
||||||
|
{
|
||||||
|
basTraycode.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
return basTraycodeMapper.updateBasTraycode(basTraycode);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除条码信息
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的条码信息主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteBasTraycodeByIds(Long[] ids)
|
||||||
|
{
|
||||||
|
return basTraycodeMapper.deleteBasTraycodeByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除条码信息信息
|
||||||
|
*
|
||||||
|
* @param id 条码信息主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteBasTraycodeById(Long id)
|
||||||
|
{
|
||||||
|
return basTraycodeMapper.deleteBasTraycodeById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void insertBasTraycodeList(List<BasTraycode> traycodeList) {
|
||||||
|
List<List<BasTraycode>> split = CollUtil.split(traycodeList, 300);
|
||||||
|
for (List<BasTraycode> list : split) {
|
||||||
|
basTraycodeMapper.insertBasTraycodeList(list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
package com.ruoyi.bas.traycodeformat.controller;
|
||||||
|
|
||||||
|
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.bas.traycodeformat.domain.BasTraycodeFormat;
|
||||||
|
import com.ruoyi.bas.traycodeformat.service.IBasTraycodeFormatService;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 条码生成规则Controller
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-07-28
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/bas/traycodeFormat")
|
||||||
|
public class BasTraycodeFormatController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private IBasTraycodeFormatService basTraycodeFormatService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询条码生成规则列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('bas:traycodeFormat:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(BasTraycodeFormat basTraycodeFormat)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<BasTraycodeFormat> list = basTraycodeFormatService.selectBasTraycodeFormatList(basTraycodeFormat);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出条码生成规则列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('bas:traycodeFormat:export')")
|
||||||
|
@Log(title = "条码生成规则", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, BasTraycodeFormat basTraycodeFormat)
|
||||||
|
{
|
||||||
|
List<BasTraycodeFormat> list = basTraycodeFormatService.selectBasTraycodeFormatList(basTraycodeFormat);
|
||||||
|
ExcelUtil<BasTraycodeFormat> util = new ExcelUtil<BasTraycodeFormat>(BasTraycodeFormat.class);
|
||||||
|
util.exportExcel(response, list, "条码生成规则数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取条码生成规则详细信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('bas:traycodeFormat:query')")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||||
|
{
|
||||||
|
return success(basTraycodeFormatService.selectBasTraycodeFormatById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增条码生成规则
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('bas:traycodeFormat:add')")
|
||||||
|
@Log(title = "条码生成规则", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody BasTraycodeFormat basTraycodeFormat)
|
||||||
|
{
|
||||||
|
return toAjax(basTraycodeFormatService.insertBasTraycodeFormat(basTraycodeFormat));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改条码生成规则
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('bas:traycodeFormat:edit')")
|
||||||
|
@Log(title = "条码生成规则", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@RequestBody BasTraycodeFormat basTraycodeFormat)
|
||||||
|
{
|
||||||
|
return toAjax(basTraycodeFormatService.updateBasTraycodeFormat(basTraycodeFormat));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除条码生成规则
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('bas:traycodeFormat:remove')")
|
||||||
|
@Log(title = "条码生成规则", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] ids)
|
||||||
|
{
|
||||||
|
return toAjax(basTraycodeFormatService.deleteBasTraycodeFormatByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,174 @@
|
|||||||
|
package com.ruoyi.bas.traycodeformat.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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 条码生成规则对象 bas_traycode_format
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-07-28
|
||||||
|
*/
|
||||||
|
public class BasTraycodeFormat extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** id */
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 条码前缀 */
|
||||||
|
@Excel(name = "条码前缀")
|
||||||
|
private String barcodeFormat;
|
||||||
|
|
||||||
|
/** 流水号 */
|
||||||
|
@Excel(name = "流水号")
|
||||||
|
private String serialRule;
|
||||||
|
|
||||||
|
/** 条码样例 */
|
||||||
|
@Excel(name = "条码样例")
|
||||||
|
private String serialExample;
|
||||||
|
|
||||||
|
/** 描述 */
|
||||||
|
@Excel(name = "描述")
|
||||||
|
private String remarks;
|
||||||
|
|
||||||
|
/** 最小流水号 */
|
||||||
|
@Excel(name = "最小流水号")
|
||||||
|
private Long minNum;
|
||||||
|
|
||||||
|
/** 最大流水号 */
|
||||||
|
@Excel(name = "最大流水号")
|
||||||
|
private Long maxNum;
|
||||||
|
|
||||||
|
/** 备用字段1 */
|
||||||
|
@Excel(name = "备用字段1")
|
||||||
|
private String spare1;
|
||||||
|
|
||||||
|
/** 备用字段2 */
|
||||||
|
@Excel(name = "备用字段2")
|
||||||
|
private String spare2;
|
||||||
|
|
||||||
|
/** 备用字段3 */
|
||||||
|
@Excel(name = "备用字段3")
|
||||||
|
private String spare3;
|
||||||
|
|
||||||
|
public void setId(Long id)
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getId()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBarcodeFormat(String barcodeFormat)
|
||||||
|
{
|
||||||
|
this.barcodeFormat = barcodeFormat;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBarcodeFormat()
|
||||||
|
{
|
||||||
|
return barcodeFormat;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSerialRule(String serialRule)
|
||||||
|
{
|
||||||
|
this.serialRule = serialRule;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSerialRule()
|
||||||
|
{
|
||||||
|
return serialRule;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSerialExample(String serialExample)
|
||||||
|
{
|
||||||
|
this.serialExample = serialExample;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSerialExample()
|
||||||
|
{
|
||||||
|
return serialExample;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRemarks(String remarks)
|
||||||
|
{
|
||||||
|
this.remarks = remarks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRemarks()
|
||||||
|
{
|
||||||
|
return remarks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMinNum(Long minNum)
|
||||||
|
{
|
||||||
|
this.minNum = minNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getMinNum()
|
||||||
|
{
|
||||||
|
return minNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaxNum(Long maxNum)
|
||||||
|
{
|
||||||
|
this.maxNum = maxNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getMaxNum()
|
||||||
|
{
|
||||||
|
return maxNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSpare1(String spare1)
|
||||||
|
{
|
||||||
|
this.spare1 = spare1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSpare1()
|
||||||
|
{
|
||||||
|
return spare1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSpare2(String spare2)
|
||||||
|
{
|
||||||
|
this.spare2 = spare2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSpare2()
|
||||||
|
{
|
||||||
|
return spare2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSpare3(String spare3)
|
||||||
|
{
|
||||||
|
this.spare3 = spare3;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSpare3()
|
||||||
|
{
|
||||||
|
return spare3;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("id", getId())
|
||||||
|
.append("barcodeFormat", getBarcodeFormat())
|
||||||
|
.append("serialRule", getSerialRule())
|
||||||
|
.append("serialExample", getSerialExample())
|
||||||
|
.append("remarks", getRemarks())
|
||||||
|
.append("minNum", getMinNum())
|
||||||
|
.append("maxNum", getMaxNum())
|
||||||
|
.append("createTime", getCreateTime())
|
||||||
|
.append("updateTime", getUpdateTime())
|
||||||
|
.append("spare1", getSpare1())
|
||||||
|
.append("spare2", getSpare2())
|
||||||
|
.append("spare3", getSpare3())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package com.ruoyi.bas.traycodeformat.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.bas.traycodeformat.domain.BasTraycodeFormat;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 条码生成规则Mapper接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-07-28
|
||||||
|
*/
|
||||||
|
public interface BasTraycodeFormatMapper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询条码生成规则
|
||||||
|
*
|
||||||
|
* @param id 条码生成规则主键
|
||||||
|
* @return 条码生成规则
|
||||||
|
*/
|
||||||
|
public BasTraycodeFormat selectBasTraycodeFormatById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询条码生成规则列表
|
||||||
|
*
|
||||||
|
* @param basTraycodeFormat 条码生成规则
|
||||||
|
* @return 条码生成规则集合
|
||||||
|
*/
|
||||||
|
public List<BasTraycodeFormat> selectBasTraycodeFormatList(BasTraycodeFormat basTraycodeFormat);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增条码生成规则
|
||||||
|
*
|
||||||
|
* @param basTraycodeFormat 条码生成规则
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertBasTraycodeFormat(BasTraycodeFormat basTraycodeFormat);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改条码生成规则
|
||||||
|
*
|
||||||
|
* @param basTraycodeFormat 条码生成规则
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateBasTraycodeFormat(BasTraycodeFormat basTraycodeFormat);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除条码生成规则
|
||||||
|
*
|
||||||
|
* @param id 条码生成规则主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteBasTraycodeFormatById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除条码生成规则
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteBasTraycodeFormatByIds(Long[] ids);
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package com.ruoyi.bas.traycodeformat.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.bas.traycodeformat.domain.BasTraycodeFormat;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 条码生成规则Service接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-07-28
|
||||||
|
*/
|
||||||
|
public interface IBasTraycodeFormatService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询条码生成规则
|
||||||
|
*
|
||||||
|
* @param id 条码生成规则主键
|
||||||
|
* @return 条码生成规则
|
||||||
|
*/
|
||||||
|
public BasTraycodeFormat selectBasTraycodeFormatById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询条码生成规则列表
|
||||||
|
*
|
||||||
|
* @param basTraycodeFormat 条码生成规则
|
||||||
|
* @return 条码生成规则集合
|
||||||
|
*/
|
||||||
|
public List<BasTraycodeFormat> selectBasTraycodeFormatList(BasTraycodeFormat basTraycodeFormat);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增条码生成规则
|
||||||
|
*
|
||||||
|
* @param basTraycodeFormat 条码生成规则
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertBasTraycodeFormat(BasTraycodeFormat basTraycodeFormat);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改条码生成规则
|
||||||
|
*
|
||||||
|
* @param basTraycodeFormat 条码生成规则
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateBasTraycodeFormat(BasTraycodeFormat basTraycodeFormat);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除条码生成规则
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的条码生成规则主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteBasTraycodeFormatByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除条码生成规则信息
|
||||||
|
*
|
||||||
|
* @param id 条码生成规则主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteBasTraycodeFormatById(Long id);
|
||||||
|
}
|
||||||
@@ -0,0 +1,120 @@
|
|||||||
|
package com.ruoyi.bas.traycodeformat.service.impl;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.NumberUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.ruoyi.bas.traycode.domain.BasTraycode;
|
||||||
|
import com.ruoyi.bas.traycode.service.IBasTraycodeService;
|
||||||
|
import com.ruoyi.bas.traycode.service.impl.BasTraycodeServiceImpl;
|
||||||
|
import com.ruoyi.common.core.text.Convert;
|
||||||
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.ruoyi.bas.traycodeformat.mapper.BasTraycodeFormatMapper;
|
||||||
|
import com.ruoyi.bas.traycodeformat.domain.BasTraycodeFormat;
|
||||||
|
import com.ruoyi.bas.traycodeformat.service.IBasTraycodeFormatService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 条码生成规则Service业务层处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-07-28
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class BasTraycodeFormatServiceImpl implements IBasTraycodeFormatService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private BasTraycodeFormatMapper basTraycodeFormatMapper;
|
||||||
|
@Autowired
|
||||||
|
private IBasTraycodeService basTraycodeService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询条码生成规则
|
||||||
|
*
|
||||||
|
* @param id 条码生成规则主键
|
||||||
|
* @return 条码生成规则
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public BasTraycodeFormat selectBasTraycodeFormatById(Long id)
|
||||||
|
{
|
||||||
|
return basTraycodeFormatMapper.selectBasTraycodeFormatById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询条码生成规则列表
|
||||||
|
*
|
||||||
|
* @param basTraycodeFormat 条码生成规则
|
||||||
|
* @return 条码生成规则
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<BasTraycodeFormat> selectBasTraycodeFormatList(BasTraycodeFormat basTraycodeFormat)
|
||||||
|
{
|
||||||
|
return basTraycodeFormatMapper.selectBasTraycodeFormatList(basTraycodeFormat);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增条码生成规则
|
||||||
|
*
|
||||||
|
* @param basTraycodeFormat 条码生成规则
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertBasTraycodeFormat(BasTraycodeFormat basTraycodeFormat)
|
||||||
|
{
|
||||||
|
basTraycodeFormat.setCreateTime(DateUtils.getNowDate());
|
||||||
|
return basTraycodeFormatMapper.insertBasTraycodeFormat(basTraycodeFormat);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改条码生成规则
|
||||||
|
*
|
||||||
|
* @param basTraycodeFormat 条码生成规则
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateBasTraycodeFormat(BasTraycodeFormat basTraycodeFormat)
|
||||||
|
{
|
||||||
|
BasTraycodeFormat old = selectBasTraycodeFormatById(basTraycodeFormat.getId());
|
||||||
|
int oldSerialRule = Convert.toInt(old.getSerialRule());
|
||||||
|
int newSerialRule = Convert.toInt(basTraycodeFormat.getSerialRule());
|
||||||
|
|
||||||
|
List<BasTraycode> traycodeList = new ArrayList<>();
|
||||||
|
for (int i = oldSerialRule; i < newSerialRule; i++) {
|
||||||
|
BasTraycode basTraycode = new BasTraycode();
|
||||||
|
basTraycode.setFormatId(basTraycodeFormat.getId());
|
||||||
|
String traycode = old.getBarcodeFormat()+ StrUtil.padPre(Convert.toStr(i),5,'0');
|
||||||
|
basTraycode.setTrayCode(traycode);
|
||||||
|
traycodeList.add(basTraycode);
|
||||||
|
}
|
||||||
|
basTraycodeFormat.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
//插入条码信息
|
||||||
|
basTraycodeService.insertBasTraycodeList(traycodeList);
|
||||||
|
return basTraycodeFormatMapper.updateBasTraycodeFormat(basTraycodeFormat);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除条码生成规则
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的条码生成规则主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteBasTraycodeFormatByIds(Long[] ids)
|
||||||
|
{
|
||||||
|
return basTraycodeFormatMapper.deleteBasTraycodeFormatByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除条码生成规则信息
|
||||||
|
*
|
||||||
|
* @param id 条码生成规则主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteBasTraycodeFormatById(Long id)
|
||||||
|
{
|
||||||
|
return basTraycodeFormatMapper.deleteBasTraycodeFormatById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -248,8 +248,6 @@ public class TagTaskServiceImpl implements ITagTaskService {
|
|||||||
trayCodeMsg.setWarehouseId("02");
|
trayCodeMsg.setWarehouseId("02");
|
||||||
trayCodeMsg.setEntranceId(basTag.getPickAdd());
|
trayCodeMsg.setEntranceId(basTag.getPickAdd());
|
||||||
pdaService.emptyBoxIn(trayCodeMsg);
|
pdaService.emptyBoxIn(trayCodeMsg);
|
||||||
//推送空料箱入库作业 生成ctu队列
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,106 @@
|
|||||||
|
<?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.bas.traycodeformat.mapper.BasTraycodeFormatMapper">
|
||||||
|
|
||||||
|
<resultMap type="BasTraycodeFormat" id="BasTraycodeFormatResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="barcodeFormat" column="barcode_format" />
|
||||||
|
<result property="serialRule" column="serial_rule" />
|
||||||
|
<result property="serialExample" column="serial_example" />
|
||||||
|
<result property="remarks" column="remarks" />
|
||||||
|
<result property="minNum" column="min_num" />
|
||||||
|
<result property="maxNum" column="max_num" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
<result property="spare1" column="spare1" />
|
||||||
|
<result property="spare2" column="spare2" />
|
||||||
|
<result property="spare3" column="spare3" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectBasTraycodeFormatVo">
|
||||||
|
select id, barcode_format, serial_rule, serial_example, remarks, min_num, max_num, create_time, update_time, spare1, spare2, spare3 from bas_traycode_format
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectBasTraycodeFormatList" parameterType="BasTraycodeFormat" resultMap="BasTraycodeFormatResult">
|
||||||
|
<include refid="selectBasTraycodeFormatVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="barcodeFormat != null and barcodeFormat != ''"> and barcode_format = #{barcodeFormat}</if>
|
||||||
|
<if test="serialRule != null and serialRule != ''"> and serial_rule = #{serialRule}</if>
|
||||||
|
<if test="serialExample != null and serialExample != ''"> and serial_example = #{serialExample}</if>
|
||||||
|
<if test="remarks != null and remarks != ''"> and remarks = #{remarks}</if>
|
||||||
|
<if test="minNum != null "> and min_num = #{minNum}</if>
|
||||||
|
<if test="maxNum != null "> and max_num = #{maxNum}</if>
|
||||||
|
<if test="spare1 != null and spare1 != ''"> and spare1 = #{spare1}</if>
|
||||||
|
<if test="spare2 != null and spare2 != ''"> and spare2 = #{spare2}</if>
|
||||||
|
<if test="spare3 != null and spare3 != ''"> and spare3 = #{spare3}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectBasTraycodeFormatById" parameterType="Long" resultMap="BasTraycodeFormatResult">
|
||||||
|
<include refid="selectBasTraycodeFormatVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertBasTraycodeFormat" parameterType="BasTraycodeFormat">
|
||||||
|
insert into bas_traycode_format
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="id != null">id,</if>
|
||||||
|
<if test="barcodeFormat != null">barcode_format,</if>
|
||||||
|
<if test="serialRule != null">serial_rule,</if>
|
||||||
|
<if test="serialExample != null">serial_example,</if>
|
||||||
|
<if test="remarks != null">remarks,</if>
|
||||||
|
<if test="minNum != null">min_num,</if>
|
||||||
|
<if test="maxNum != null">max_num,</if>
|
||||||
|
<if test="createTime != null">create_time,</if>
|
||||||
|
<if test="updateTime != null">update_time,</if>
|
||||||
|
<if test="spare1 != null">spare1,</if>
|
||||||
|
<if test="spare2 != null">spare2,</if>
|
||||||
|
<if test="spare3 != null">spare3,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="id != null">#{id},</if>
|
||||||
|
<if test="barcodeFormat != null">#{barcodeFormat},</if>
|
||||||
|
<if test="serialRule != null">#{serialRule},</if>
|
||||||
|
<if test="serialExample != null">#{serialExample},</if>
|
||||||
|
<if test="remarks != null">#{remarks},</if>
|
||||||
|
<if test="minNum != null">#{minNum},</if>
|
||||||
|
<if test="maxNum != null">#{maxNum},</if>
|
||||||
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
|
<if test="spare1 != null">#{spare1},</if>
|
||||||
|
<if test="spare2 != null">#{spare2},</if>
|
||||||
|
<if test="spare3 != null">#{spare3},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateBasTraycodeFormat" parameterType="BasTraycodeFormat">
|
||||||
|
update bas_traycode_format
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="barcodeFormat != null">barcode_format = #{barcodeFormat},</if>
|
||||||
|
<if test="serialRule != null">serial_rule = #{serialRule},</if>
|
||||||
|
<if test="serialExample != null">serial_example = #{serialExample},</if>
|
||||||
|
<if test="remarks != null">remarks = #{remarks},</if>
|
||||||
|
<if test="minNum != null">min_num = #{minNum},</if>
|
||||||
|
<if test="maxNum != null">max_num = #{maxNum},</if>
|
||||||
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
|
<if test="spare1 != null">spare1 = #{spare1},</if>
|
||||||
|
<if test="spare2 != null">spare2 = #{spare2},</if>
|
||||||
|
<if test="spare3 != null">spare3 = #{spare3},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteBasTraycodeFormatById" parameterType="Long">
|
||||||
|
delete from bas_traycode_format where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteBasTraycodeFormatByIds" parameterType="String">
|
||||||
|
delete from bas_traycode_format where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,96 @@
|
|||||||
|
<?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.bas.traycode.mapper.BasTraycodeMapper">
|
||||||
|
|
||||||
|
<resultMap type="BasTraycode" id="BasTraycodeResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="formatId" column="format_id" />
|
||||||
|
<result property="trayCode" column="tray_code" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
<result property="spare1" column="spare1" />
|
||||||
|
<result property="spare2" column="spare2" />
|
||||||
|
<result property="spare3" column="spare3" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectBasTraycodeVo">
|
||||||
|
select id, format_id, tray_code, create_time, update_time, spare1, spare2, spare3 from bas_traycode
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectBasTraycodeList" parameterType="BasTraycode" resultMap="BasTraycodeResult">
|
||||||
|
<include refid="selectBasTraycodeVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="formatId != null "> and format_id = #{formatId}</if>
|
||||||
|
<if test="trayCode != null and trayCode != ''"> and tray_code = #{trayCode}</if>
|
||||||
|
<if test="spare1 != null and spare1 != ''"> and spare1 = #{spare1}</if>
|
||||||
|
<if test="spare2 != null and spare2 != ''"> and spare2 = #{spare2}</if>
|
||||||
|
<if test="spare3 != null and spare3 != ''"> and spare3 = #{spare3}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectBasTraycodeById" parameterType="Long" resultMap="BasTraycodeResult">
|
||||||
|
<include refid="selectBasTraycodeVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertBasTraycode" parameterType="BasTraycode">
|
||||||
|
insert into bas_traycode
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="id != null">id,</if>
|
||||||
|
<if test="formatId != null">format_id,</if>
|
||||||
|
<if test="trayCode != null">tray_code,</if>
|
||||||
|
<if test="createTime != null">create_time,</if>
|
||||||
|
<if test="updateTime != null">update_time,</if>
|
||||||
|
<if test="spare1 != null">spare1,</if>
|
||||||
|
<if test="spare2 != null">spare2,</if>
|
||||||
|
<if test="spare3 != null">spare3,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="id != null">#{id},</if>
|
||||||
|
<if test="formatId != null">#{formatId},</if>
|
||||||
|
<if test="trayCode != null">#{trayCode},</if>
|
||||||
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
|
<if test="spare1 != null">#{spare1},</if>
|
||||||
|
<if test="spare2 != null">#{spare2},</if>
|
||||||
|
<if test="spare3 != null">#{spare3},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
<insert id="insertBasTraycodeList">
|
||||||
|
insert into bas_traycode( format_id, tray_code) values
|
||||||
|
<foreach item="item" collection="list" separator=",">
|
||||||
|
(
|
||||||
|
|
||||||
|
<if test="item.formatId != null">#{item.formatId},</if>
|
||||||
|
<if test="item.trayCode != null">#{item.trayCode}</if>
|
||||||
|
)
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateBasTraycode" parameterType="BasTraycode">
|
||||||
|
update bas_traycode
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="formatId != null">format_id = #{formatId},</if>
|
||||||
|
<if test="trayCode != null">tray_code = #{trayCode},</if>
|
||||||
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
|
<if test="spare1 != null">spare1 = #{spare1},</if>
|
||||||
|
<if test="spare2 != null">spare2 = #{spare2},</if>
|
||||||
|
<if test="spare3 != null">spare3 = #{spare3},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteBasTraycodeById" parameterType="Long">
|
||||||
|
delete from bas_traycode where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteBasTraycodeByIds" parameterType="String">
|
||||||
|
delete from bas_traycode where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
||||||
44
ruoyi-ui/src/api/bas/traycode.js
Normal file
44
ruoyi-ui/src/api/bas/traycode.js
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询条码信息列表
|
||||||
|
export function listTraycode(query) {
|
||||||
|
return request({
|
||||||
|
url: '/bas/traycode/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询条码信息详细
|
||||||
|
export function getTraycode(id) {
|
||||||
|
return request({
|
||||||
|
url: '/bas/traycode/' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增条码信息
|
||||||
|
export function addTraycode(data) {
|
||||||
|
return request({
|
||||||
|
url: '/bas/traycode',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改条码信息
|
||||||
|
export function updateTraycode(data) {
|
||||||
|
return request({
|
||||||
|
url: '/bas/traycode',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除条码信息
|
||||||
|
export function delTraycode(id) {
|
||||||
|
return request({
|
||||||
|
url: '/bas/traycode/' + id,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
53
ruoyi-ui/src/api/bas/traycodeFormat.js
Normal file
53
ruoyi-ui/src/api/bas/traycodeFormat.js
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询条码生成规则列表
|
||||||
|
export function listTraycodeFormat(query) {
|
||||||
|
return request({
|
||||||
|
url: '/bas/traycodeFormat/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询条码生成规则详细
|
||||||
|
export function getTraycodeFormat(id) {
|
||||||
|
return request({
|
||||||
|
url: '/bas/traycodeFormat/' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增条码生成规则
|
||||||
|
export function addTraycodeFormat(data) {
|
||||||
|
return request({
|
||||||
|
url: '/bas/traycodeFormat',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改条码生成规则
|
||||||
|
export function updateTraycodeFormat(data) {
|
||||||
|
return request({
|
||||||
|
url: '/bas/traycodeFormat',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除条码生成规则
|
||||||
|
export function delTraycodeFormat(id) {
|
||||||
|
return request({
|
||||||
|
url: '/bas/traycodeFormat/' + id,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 打印条码
|
||||||
|
export function printTraycodeFormat(data) {
|
||||||
|
return request({
|
||||||
|
url: '/bas/traycodeFormat/print',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
351
ruoyi-ui/src/views/bas/traycode/index.vue
Normal file
351
ruoyi-ui/src/views/bas/traycode/index.vue
Normal file
@@ -0,0 +1,351 @@
|
|||||||
|
<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="条码类型id" prop="formatId">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.formatId"
|
||||||
|
placeholder="请输入条码类型id"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="条码" prop="trayCode">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.trayCode"
|
||||||
|
placeholder="请输入条码"
|
||||||
|
clearable
|
||||||
|
@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"
|
||||||
|
v-hasPermi="['bas:traycode: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="['bas:traycode: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="['bas:traycode: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="['bas:traycode:export']"
|
||||||
|
>导出</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="info"
|
||||||
|
plain
|
||||||
|
icon="el-icon-printer"
|
||||||
|
size="mini"
|
||||||
|
:disabled="multiple"
|
||||||
|
@click="handleBatchPrint"
|
||||||
|
v-hasPermi="['bas:traycode:print']"
|
||||||
|
>批量打印</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table ref="table" v-loading="loading" :data="traycodeList" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<el-table-column label="id" align="center" prop="id" />
|
||||||
|
<el-table-column label="条码类型id" align="center" prop="formatId" />
|
||||||
|
<el-table-column label="条码" align="center" prop="trayCode" />
|
||||||
|
<!-- <el-table-column label="备用字段1" align="center" prop="spare1" />
|
||||||
|
<el-table-column label="备用字段2" align="center" prop="spare2" />
|
||||||
|
<el-table-column label="备用字段3" align="center" prop="spare3" /> -->
|
||||||
|
<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)"
|
||||||
|
v-hasPermi="['bas:traycode:edit']"
|
||||||
|
>修改</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['bas:traycode:remove']"
|
||||||
|
>删除</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-printer"
|
||||||
|
@click="printBarcode(scope.row)"
|
||||||
|
v-hasPermi="['bas:traycode:print']"
|
||||||
|
>打印</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="500px" append-to-body>
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||||
|
<el-form-item label="条码类型id" prop="formatId">
|
||||||
|
<el-input v-model="form.formatId" placeholder="请输入条码类型id" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="条码" prop="trayCode">
|
||||||
|
<el-input v-model="form.trayCode" placeholder="请输入条码" />
|
||||||
|
</el-form-item>
|
||||||
|
<!-- <el-form-item label="备用字段1" prop="spare1">
|
||||||
|
<el-input v-model="form.spare1" placeholder="请输入备用字段1" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备用字段2" prop="spare2">
|
||||||
|
<el-input v-model="form.spare2" placeholder="请输入备用字段2" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备用字段3" prop="spare3">
|
||||||
|
<el-input v-model="form.spare3" placeholder="请输入备用字段3" />
|
||||||
|
</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 { listTraycode, getTraycode, delTraycode, addTraycode, updateTraycode } from "@/api/bas/traycode"
|
||||||
|
import { getLodop } from "@/plugins/LodopFuncs"
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "Traycode",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
// 选中数组
|
||||||
|
ids: [],
|
||||||
|
// 非单个禁用
|
||||||
|
single: true,
|
||||||
|
// 非多个禁用
|
||||||
|
multiple: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 条码信息表格数据
|
||||||
|
traycodeList: [],
|
||||||
|
// 弹出层标题
|
||||||
|
title: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
formatId: null,
|
||||||
|
trayCode: null,
|
||||||
|
spare1: null,
|
||||||
|
spare2: null,
|
||||||
|
spare3: null
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
// 表单校验
|
||||||
|
rules: {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/** 查询条码信息列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true
|
||||||
|
listTraycode(this.queryParams).then(response => {
|
||||||
|
this.traycodeList = response.rows
|
||||||
|
this.total = response.total
|
||||||
|
this.loading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 取消按钮
|
||||||
|
cancel() {
|
||||||
|
this.open = false
|
||||||
|
this.reset()
|
||||||
|
},
|
||||||
|
// 表单重置
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
id: null,
|
||||||
|
formatId: null,
|
||||||
|
trayCode: null,
|
||||||
|
createTime: null,
|
||||||
|
updateTime: null,
|
||||||
|
spare1: null,
|
||||||
|
spare2: null,
|
||||||
|
spare3: 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
|
||||||
|
getTraycode(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) {
|
||||||
|
updateTraycode(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("修改成功")
|
||||||
|
this.open = false
|
||||||
|
this.getList()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
addTraycode(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("新增成功")
|
||||||
|
this.open = false
|
||||||
|
this.getList()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
handleDelete(row) {
|
||||||
|
const ids = row.id || this.ids
|
||||||
|
this.$modal.confirm('是否确认删除条码信息编号为"' + ids + '"的数据项?').then(function() {
|
||||||
|
return delTraycode(ids)
|
||||||
|
}).then(() => {
|
||||||
|
this.getList()
|
||||||
|
this.$modal.msgSuccess("删除成功")
|
||||||
|
}).catch(() => {})
|
||||||
|
},
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
handleExport() {
|
||||||
|
this.download('bas/traycode/export', {
|
||||||
|
...this.queryParams
|
||||||
|
}, `traycode_${new Date().getTime()}.xlsx`)
|
||||||
|
},
|
||||||
|
/** 打印条码 */
|
||||||
|
printBarcode: function (row) {
|
||||||
|
try {
|
||||||
|
// 获取Lodop打印对象
|
||||||
|
let LODOP = getLodop()
|
||||||
|
if (!LODOP) {
|
||||||
|
this.$modal.msgError("打印控件未安装或启动失败")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
LODOP.SET_SHOW_MODE("LANGUAGE", 0);
|
||||||
|
LODOP.PRINT_INITA(0, 0, 400, 300, "条码打印");
|
||||||
|
LODOP.SET_PRINT_PAGESIZE(1, 400, 300, "");
|
||||||
|
LODOP.SET_PRINT_MODE("AUTO_CLOSE_PREWINDOW", 1);
|
||||||
|
|
||||||
|
if (Array.isArray(row)) {
|
||||||
|
// 批量打印
|
||||||
|
row.forEach(item => {
|
||||||
|
LODOP.NewPage();
|
||||||
|
// 居中打印二维码
|
||||||
|
LODOP.ADD_PRINT_BARCODE(50, 140, 120, 120, "QRCode", item.trayCode);
|
||||||
|
// 在二维码下方显示条码文本
|
||||||
|
LODOP.ADD_PRINT_TEXT(180, 100, 200, 30, item.trayCode);
|
||||||
|
LODOP.SET_PRINT_STYLEA(0, "Alignment", 2); // 文字居中
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// 单个打印
|
||||||
|
LODOP.NewPage();
|
||||||
|
// 居中打印二维码
|
||||||
|
LODOP.ADD_PRINT_BARCODE(50, 140, 120, 120, "QRCode", row.trayCode);
|
||||||
|
// 在二维码下方显示条码文本
|
||||||
|
LODOP.ADD_PRINT_TEXT(180, 100, 200, 30, row.trayCode);
|
||||||
|
LODOP.SET_PRINT_STYLEA(0, "Alignment", 2); // 文字居中
|
||||||
|
}
|
||||||
|
|
||||||
|
LODOP.PREVIEW();
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
console.error('打印失败:', error)
|
||||||
|
this.$modal.msgError("打印失败: " + error.message)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/** 批量打印按钮操作 */
|
||||||
|
handleBatchPrint() {
|
||||||
|
const selection = this.$refs.table.selection;
|
||||||
|
if (selection.length === 0) {
|
||||||
|
this.$modal.msgError("请选择要打印的条码");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
console.log(selection)
|
||||||
|
this.printBarcode(selection);
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
425
ruoyi-ui/src/views/bas/traycodeFormat/index.vue
Normal file
425
ruoyi-ui/src/views/bas/traycodeFormat/index.vue
Normal file
@@ -0,0 +1,425 @@
|
|||||||
|
<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="barcodeFormat">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.barcodeFormat"
|
||||||
|
placeholder="请输入条码前缀"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="流水号" prop="serialRule">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.serialRule"
|
||||||
|
placeholder="请输入流水号"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="条码样例" prop="serialExample">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.serialExample"
|
||||||
|
placeholder="请输入条码样例"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="描述" prop="remarks">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.remarks"
|
||||||
|
placeholder="请输入描述"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="最小流水号" prop="minNum">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.minNum"
|
||||||
|
placeholder="请输入最小流水号"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="最大流水号" prop="maxNum">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.maxNum"
|
||||||
|
placeholder="请输入最大流水号"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备用字段1" prop="spare1">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.spare1"
|
||||||
|
placeholder="请输入备用字段1"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备用字段2" prop="spare2">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.spare2"
|
||||||
|
placeholder="请输入备用字段2"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备用字段3" prop="spare3">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.spare3"
|
||||||
|
placeholder="请输入备用字段3"
|
||||||
|
clearable
|
||||||
|
@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"
|
||||||
|
v-hasPermi="['bas:traycodeFormat: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="['bas:traycodeFormat: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="['bas:traycodeFormat: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="['bas:traycodeFormat:export']"
|
||||||
|
>导出</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
icon="el-icon-printer"
|
||||||
|
size="mini"
|
||||||
|
:disabled="single"
|
||||||
|
@click="handlePrint"
|
||||||
|
v-hasPermi="['bas:traycodeFormat:print']"
|
||||||
|
>生成打印数据</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="traycodeFormatList" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<el-table-column label="id" align="center" prop="id" />
|
||||||
|
<el-table-column label="条码前缀" align="center" prop="barcodeFormat" />
|
||||||
|
<el-table-column label="流水号" align="center" prop="serialRule" />
|
||||||
|
<el-table-column label="条码样例" align="center" prop="serialExample" />
|
||||||
|
<el-table-column label="描述" align="center" prop="remarks" />
|
||||||
|
<el-table-column label="最小流水号" align="center" prop="minNum" />
|
||||||
|
<el-table-column label="最大流水号" align="center" prop="maxNum" />
|
||||||
|
<el-table-column label="备用字段1" align="center" prop="spare1" />
|
||||||
|
<el-table-column label="备用字段2" align="center" prop="spare2" />
|
||||||
|
<el-table-column label="备用字段3" align="center" prop="spare3" />
|
||||||
|
<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)"
|
||||||
|
v-hasPermi="['bas:traycodeFormat:edit']"
|
||||||
|
>修改</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['bas:traycodeFormat: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="500px" append-to-body>
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||||
|
<el-form-item label="条码前缀" prop="barcodeFormat">
|
||||||
|
<el-input v-model="form.barcodeFormat" placeholder="请输入条码前缀" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="流水号" prop="serialRule">
|
||||||
|
<el-input v-model="form.serialRule" placeholder="请输入流水号" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="条码样例" prop="serialExample">
|
||||||
|
<el-input v-model="form.serialExample" placeholder="请输入条码样例" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="描述" prop="remarks">
|
||||||
|
<el-input v-model="form.remarks" placeholder="请输入描述" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="最小流水号" prop="minNum">
|
||||||
|
<el-input v-model="form.minNum" placeholder="请输入最小流水号" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="最大流水号" prop="maxNum">
|
||||||
|
<el-input v-model="form.maxNum" placeholder="请输入最大流水号" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备用字段1" prop="spare1">
|
||||||
|
<el-input v-model="form.spare1" placeholder="请输入备用字段1" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备用字段2" prop="spare2">
|
||||||
|
<el-input v-model="form.spare2" placeholder="请输入备用字段2" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备用字段3" prop="spare3">
|
||||||
|
<el-input v-model="form.spare3" placeholder="请输入备用字段3" />
|
||||||
|
</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>
|
||||||
|
<!-- 打印条码数量输入对话框 -->
|
||||||
|
<el-dialog :title="'打印条码'" :visible.sync="printDialogVisible" width="400px" append-to-body>
|
||||||
|
<el-form ref="printForm" :model="printForm" label-width="100px">
|
||||||
|
<el-form-item label="打印数量" prop="printCount">
|
||||||
|
<el-input-number v-model="printForm.printCount" :min="1" :max="maxPrintCount" placeholder="请输入打印数量" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitPrint">确 定</el-button>
|
||||||
|
<el-button @click="cancelPrint">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { listTraycodeFormat, getTraycodeFormat, delTraycodeFormat, addTraycodeFormat, updateTraycodeFormat } from "@/api/bas/traycodeFormat"
|
||||||
|
import {getLodop} from "@/plugins/LodopFuncs.js"
|
||||||
|
export default {
|
||||||
|
name: "TraycodeFormat",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
// 选中数组
|
||||||
|
ids: [],
|
||||||
|
// 非单个禁用
|
||||||
|
single: true,
|
||||||
|
// 非多个禁用
|
||||||
|
multiple: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 条码生成规则表格数据
|
||||||
|
traycodeFormatList: [],
|
||||||
|
// 弹出层标题
|
||||||
|
title: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
barcodeFormat: null,
|
||||||
|
serialRule: null,
|
||||||
|
serialExample: null,
|
||||||
|
remarks: null,
|
||||||
|
minNum: null,
|
||||||
|
maxNum: null,
|
||||||
|
spare1: null,
|
||||||
|
spare2: null,
|
||||||
|
spare3: null
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
// 表单校验
|
||||||
|
rules: {
|
||||||
|
},
|
||||||
|
// 打印对话框显示状态
|
||||||
|
printDialogVisible: false,
|
||||||
|
// 打印表单参数
|
||||||
|
printForm: {
|
||||||
|
printCount: 1,
|
||||||
|
},
|
||||||
|
selectData:{
|
||||||
|
|
||||||
|
},
|
||||||
|
// 最大可打印数量
|
||||||
|
maxPrintCount: 1000,
|
||||||
|
// 当前选中的条码规则
|
||||||
|
currentRule: null,
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/** 查询条码生成规则列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true
|
||||||
|
listTraycodeFormat(this.queryParams).then(response => {
|
||||||
|
this.traycodeFormatList = response.rows
|
||||||
|
this.total = response.total
|
||||||
|
this.loading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 取消按钮
|
||||||
|
cancel() {
|
||||||
|
this.open = false
|
||||||
|
this.reset()
|
||||||
|
},
|
||||||
|
// 表单重置
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
id: null,
|
||||||
|
barcodeFormat: null,
|
||||||
|
serialRule: null,
|
||||||
|
serialExample: null,
|
||||||
|
remarks: null,
|
||||||
|
minNum: null,
|
||||||
|
maxNum: null,
|
||||||
|
createTime: null,
|
||||||
|
updateTime: null,
|
||||||
|
spare1: null,
|
||||||
|
spare2: null,
|
||||||
|
spare3: 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
|
||||||
|
this.selectData = selection
|
||||||
|
},
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
handleAdd() {
|
||||||
|
this.reset()
|
||||||
|
this.open = true
|
||||||
|
this.title = "添加条码生成规则"
|
||||||
|
},
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
handleUpdate(row) {
|
||||||
|
this.reset()
|
||||||
|
const id = row.id || this.ids
|
||||||
|
getTraycodeFormat(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) {
|
||||||
|
updateTraycodeFormat(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("修改成功")
|
||||||
|
this.open = false
|
||||||
|
this.getList()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
addTraycodeFormat(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("新增成功")
|
||||||
|
this.open = false
|
||||||
|
this.getList()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
handleDelete(row) {
|
||||||
|
const ids = row.id || this.ids
|
||||||
|
this.$modal.confirm('是否确认删除条码生成规则编号为"' + ids + '"的数据项?').then(function() {
|
||||||
|
return delTraycodeFormat(ids)
|
||||||
|
}).then(() => {
|
||||||
|
this.getList()
|
||||||
|
this.$modal.msgSuccess("删除成功")
|
||||||
|
}).catch(() => {})
|
||||||
|
},
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
handleExport() {
|
||||||
|
this.download('bas/traycodeFormat/export', {
|
||||||
|
...this.queryParams
|
||||||
|
}, `traycodeFormat_${new Date().getTime()}.xlsx`)
|
||||||
|
},
|
||||||
|
/** 打印按钮操作 */
|
||||||
|
handlePrint(row) {
|
||||||
|
this.printDialogVisible = true;
|
||||||
|
},
|
||||||
|
// 取消打印
|
||||||
|
cancelPrint() {
|
||||||
|
this.printDialogVisible = false;
|
||||||
|
this.printForm.printCount = 0;
|
||||||
|
},
|
||||||
|
// 提交打印
|
||||||
|
submitPrint() {
|
||||||
|
|
||||||
|
var printData = {
|
||||||
|
id: this.selectData[0].id,
|
||||||
|
serialRule: Number(this.selectData[0].serialRule) + Number(this.printForm.printCount),
|
||||||
|
};
|
||||||
|
|
||||||
|
if (Number(this.printForm.printCount)+Number(this.selectData[0].serialRule)-1>this.selectData[0].maxNum){
|
||||||
|
this.$modal.msgError("打印数量不能大于最大可打印数量")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
updateTraycodeFormat(printData).then(response => {
|
||||||
|
this.$modal.msgSuccess("修改成功")
|
||||||
|
this.printDialogVisible = false;
|
||||||
|
this.getList()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
Reference in New Issue
Block a user