Commit 7bd8b587 authored by xiangjiaojunxp's avatar xiangjiaojunxp

Merge remote-tracking branch 'origin/master'

parents c4f5679a b53f790c
......@@ -57,19 +57,6 @@ public class ActSuppliesController extends BaseController
return getDataTable(list);
}
/**
* 查询物料总分类管理列表
*/
@PreAuthorize("@ss.hasPermi('Actsupplies:Actsupplies:listOne')")
@GetMapping("/listOne")
public TableDataInfo listOne(ActSupplies actSupplies)
{
startPage();
List<ActSupplies> list = actSuppliesService.selectActSuppliesListOne(actSupplies);;
return getDataTable(list);
}
/**
* 导出物料总分类管理列表
*/
......@@ -85,19 +72,6 @@ public class ActSuppliesController extends BaseController
return util.exportExcel(list, "二级分类数据");
}
/**
* 导出物料总分类管理列表
*/
@PreAuthorize("@ss.hasPermi('Actsupplies:Actsupplies:exportOne')")
@Log(title = "物料总分类管理", businessType = BusinessType.EXPORT)
@GetMapping("/exportOne")
public AjaxResult exportOne(ActSupplies actSupplies)
{
List<ActSupplies> list = actSuppliesService.selectActSuppliesListOne(actSupplies);
ExcelUtil<ActSupplies> util = new ExcelUtil<ActSupplies>(ActSupplies.class);
return util.exportExcel(list, "一级分类数据");
}
/**
* 获取物料总分类管理详细信息
*/
......@@ -116,12 +90,12 @@ public class ActSuppliesController extends BaseController
@PostMapping
public AjaxResult add(@RequestBody ActSupplies actSupplies)
{
SysUser user = SecurityUtils.getLoginUser().getUser();
actSupplies.setCreateBy(user.getUserName());
/*return toAjax(actSuppliesService.insertActSupplies(actSupplies));*/
int i = actSuppliesService.insertActSupplies(actSupplies);
if(i == 0){
return AjaxResult.error("添加名称失败,名称已被占用");
}else if (i==-1){
return AjaxResult.error("添加名称失败,物资编码已被占用");
}
return AjaxResult.success("添加成功");
}
......@@ -134,9 +108,6 @@ public class ActSuppliesController extends BaseController
@PutMapping
public AjaxResult edit(@RequestBody ActSupplies actSupplies)
{
SysUser user = SecurityUtils.getLoginUser().getUser();
actSupplies.setUpdateBy(user.getUserName());
// return toAjax(actSuppliesService.updateActSupplies(actSupplies));
int i = actSuppliesService.updateActSupplies(actSupplies);
if(i==0){
return AjaxResult.error("修改名称失败.名称已被占用");
......@@ -152,23 +123,21 @@ public class ActSuppliesController extends BaseController
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
int i = actSuppliesService.deleteActSuppliesByIds(ids);
if (actSuppliesService.findall(ids).size()>0 || actSuppliesService.findAllId(ids).size()>0){
if (i==0){
return AjaxResult.error("该物料下存在关联物料,请先删除关联物料!!!","操作失败");
}
return toAjax(actSuppliesService.deleteActSuppliesByIds(ids));
return toAjax(i);
}
/**
* 启用物料总分类管理
*/
/** 启用物料总分类管理
*/
@PreAuthorize("@ss.hasPermi('Actsupplies:Actsupplies:enable')")
@PutMapping("/{id}/enable")
public AjaxResult setEnable(@PathVariable("id") Long id, @RequestParam("status") Integer status)
{
actSuppliesService.setEnable(id,status);
if (status < 0){
return AjaxResult.error(ServiceCode.ERR_CODE+"","启用失败");
......@@ -181,25 +150,17 @@ public class ActSuppliesController extends BaseController
* 禁用物料总分类管理
*/
@PreAuthorize("@ss.hasPermi('Actsupplies:Actsupplies:Disable')")
@PutMapping("/{id}/disable")
public AjaxResult setDisable(@PathVariable("id") Long id, @RequestParam("status") Integer status)
{
if (actSuppliesService.find(id).size()>0 || actSuppliesService.findId(id).size()>0){
public AjaxResult setDisable(@PathVariable("id") Long id, @RequestParam("status") Integer status) {
return AjaxResult.success("该物料下存在关联物料,请先删除关联物料!!!","操作失败");
if (actSuppliesService.find(id).size() > 0 || actSuppliesService.findId(id).size() > 0) {
}
actSuppliesService.setDisable(id,status);
if(status > 1){
return AjaxResult.error(ServiceCode.ERR_CODE+"","禁用失败");
}
return AjaxResult.success("200","禁用成功");
actSuppliesService.setDisable(id, status);
if (status > 1) {
return AjaxResult.error(ServiceCode.ERR_CODE + "", "禁用失败");
}
return AjaxResult.success("200", "禁用成功");
}
}
......@@ -46,6 +46,20 @@ public class ActSuppliesDetailsController extends BaseController
}
/**
* 查询上级分类
* */
@PreAuthorize("@ss.hasPermi('ActSuppliesDetails:ActSuppliesDetails:getLevel')")
@GetMapping("/getLevel")
@ResponseBody
public TableDataInfo getLevel(){
List<ActSuppliesDetails> options = actSuppliesDetailsService.getLevel();
return getDataTable(options);
}
/**
* 查询物料细分类管理列表
*/
......@@ -89,12 +103,12 @@ public class ActSuppliesDetailsController extends BaseController
@PostMapping
public AjaxResult add(@RequestBody ActSuppliesDetails actSuppliesDetails)
{
SysUser user = SecurityUtils.getLoginUser().getUser();
actSuppliesDetails.setCreateBy(user.getUserName());
/*return toAjax(actSuppliesService.insertActSupplies(actSupplies));*/
int i = actSuppliesDetailsService.insertActSuppliesDetails(actSuppliesDetails);
if(i == 0){
return AjaxResult.error("添加名称失败,名称已被占用");
}else if (i==-1){
return AjaxResult.error("添加名称失败,物资编码已被占用");
}
return AjaxResult.success("添加成功");
}
......@@ -107,9 +121,6 @@ public class ActSuppliesDetailsController extends BaseController
@PutMapping
public AjaxResult edit(@RequestBody ActSuppliesDetails actSuppliesDetails)
{
SysUser user = SecurityUtils.getLoginUser().getUser();
actSuppliesDetails.setUpdateBy(user.getUserName());
// return toAjax(actSuppliesService.updateActSupplies(actSupplies));
int i = actSuppliesDetailsService.updateActSuppliesDetails(actSuppliesDetails);
if(i==0){
return AjaxResult.error("修改名称失败.名称已被占用");
......@@ -126,7 +137,14 @@ public class ActSuppliesDetailsController extends BaseController
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(actSuppliesDetailsService.deleteActSuppliesDetailsByIds(ids));
List<Long> ids1 = actSuppliesDetailsService.deleteActSuppliesDetailsByIds(ids);
if (ids1.size()>0){
String s = ids1.toString();
return AjaxResult.success("312",s);
}
return AjaxResult.success(200);
}
......
......@@ -56,7 +56,7 @@ public class ActSuppliesHistorydataController extends BaseController
{
List<ActSuppliesHistorydata> list = actSuppliesHistorydataService.selectActSuppliesHistorydataList(actSuppliesHistorydata);
ExcelUtil<ActSuppliesHistorydata> util = new ExcelUtil<ActSuppliesHistorydata>(ActSuppliesHistorydata.class);
return util.exportExcel(list, " 历史数据数据");
return util.exportExcel(list, " 历史数据");
}
/**
......@@ -102,7 +102,6 @@ public class ActSuppliesHistorydataController extends BaseController
return toAjax(actSuppliesHistorydataService.deleteActSuppliesHistorydataByIds(ids));
}
/**
* 添加 历史数据
*/
......@@ -111,11 +110,8 @@ public class ActSuppliesHistorydataController extends BaseController
@PostMapping("/addInsert")
public AjaxResult addInsert(@RequestBody List<ActSuppliesHistorydata> actSuppliesHistorydata)
{
actSuppliesHistorydataService.addInsertActSuppliesHistorydata(actSuppliesHistorydata);
return toAjax(1);
}
}
......@@ -195,7 +195,6 @@ public class ActSuppliesRoleController extends BaseController
return AjaxResult.error("该规则下存在关联规则,请先删除关联规则!!!","操作失败");
}
actSuppliesRoleService.setDisable(id,status);
if(status > 1){
......@@ -221,6 +220,7 @@ public class ActSuppliesRoleController extends BaseController
}else {
return AjaxResult.success(200);
}
}
/**
......@@ -230,7 +230,9 @@ public class ActSuppliesRoleController extends BaseController
@Log(title = "Excel模板", businessType = BusinessType.UPDATE)
@GetMapping("/offShelfRS/{ids}")
public AjaxResult offShelfRS(@PathVariable("ids") Long[] ids) {
return toAjax(actSuppliesRoleService.offShelfRS(ids));
}
}
......@@ -69,6 +69,7 @@ public class ActSuppliesTemplateController extends BaseController {
actSuppliesRole.setUpdateBy(user.getUserName());
return toAjax(actSuppliesTemplateService.updateActSuppliesRole(actSuppliesRole));
}
/**
* 导出Excel模板列表
*/
......@@ -114,7 +115,6 @@ public class ActSuppliesTemplateController extends BaseController {
}
/**
* 修改Excel模板
*/
......
......@@ -7,61 +7,101 @@ import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 用友物料管理对象 act_supplies
*
*
* @author ruoyi
* @date 2023-07-11
*/
public class ActSupplies extends BaseEntity
{
public class ActSupplies extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 物料ID */
/**
* 物料ID
*/
private Long id;
/** 父ID */
private Long pid;
@Excel(name = "一级分类名称")
private String fname;
/** 物料名称 */
@Excel(name = "二级分类名称")
/**
* 物料ID
*/
private Long level;
/**
* 一级编码
*/
@Excel(name = "一级编码")
private String oneLevel;
/**
* 二级编码
*/
@Excel(name = "二级编码")
private String twoLevel;
/**
* 三级编码
*/
@Excel(name = "三级编码")
private String threeLevel;
/**
* 物料名称
*/
@Excel(name = "物料名称")
private String suppliesName;
/** 显示排序 */
private Long orderNum;
/** 状态 */
@Excel(name = "状态",readConverterExp="0=启用,1=禁用")
/**
* 状态
*/
@Excel(name = "状态", readConverterExp = "0=启用,1=禁用")
private Integer status;
public Long getOrderNum() {
return orderNum;
}
public String getFname() {
return fname;
public void setOrderNum(Long orderNum) {
this.orderNum = orderNum;
}
public void setFname(String fname) {
this.fname = fname;
public Long getId() {
return id;
}
public void setId(Long id)
{
public void setId(Long id) {
this.id = id;
}
public Long getId()
{
return id;
public Long getLevel() {
return level;
}
public void setPid(Long pid)
{
this.pid = pid;
public void setLevel(Long level) {
this.level = level;
}
public String getOneLevel() {
return oneLevel;
}
public void setOneLevel(String oneLevel) {
this.oneLevel = oneLevel;
}
public String getTwoLevel() {
return twoLevel;
}
public Long getPid()
{
return pid;
public void setTwoLevel(String twoLevel) {
this.twoLevel = twoLevel;
}
public String getThreeLevel() {
return threeLevel;
}
public void setThreeLevel(String threeLevel) {
this.threeLevel = threeLevel;
}
public String getSuppliesName() {
......@@ -72,37 +112,29 @@ public class ActSupplies extends BaseEntity
this.suppliesName = suppliesName;
}
public void setOrderNum(Long orderNum)
{
this.orderNum = orderNum;
}
public Long getOrderNum()
{
return orderNum;
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Integer getStatus()
{
return status;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("pid", getPid())
.append("suppliesName", getSuppliesName())
.append("orderNum", getOrderNum())
.append("status", getStatus())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("oneLevel", getOneLevel())
.append("twoLevel", getTwoLevel())
.append("threeLevel", getThreeLevel())
.append("suppliesName", getSuppliesName())
.append("status", getStatus())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}
......@@ -21,6 +21,29 @@ public class ActSuppliesDetails extends BaseEntity
/** 父ID */
private Long sid;
/**
* 物料ID
*/
private Long level;
/**
* 一级编码
*/
@Excel(name = "一级编码")
private String oneLevel;
/**
* 二级编码
*/
@Excel(name = "二级编码")
private String twoLevel;
/**
* 三级编码
*/
@Excel(name = "三级编码")
private String threeLevel;
@Excel(name = "上级分类")
private String fname;
......@@ -90,6 +113,38 @@ public class ActSuppliesDetails extends BaseEntity
return status;
}
public Long getLevel() {
return level;
}
public void setLevel(Long level) {
this.level = level;
}
public String getOneLevel() {
return oneLevel;
}
public void setOneLevel(String oneLevel) {
this.oneLevel = oneLevel;
}
public String getTwoLevel() {
return twoLevel;
}
public void setTwoLevel(String twoLevel) {
this.twoLevel = twoLevel;
}
public String getThreeLevel() {
return threeLevel;
}
public void setThreeLevel(String threeLevel) {
this.threeLevel = threeLevel;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
......
......@@ -22,6 +22,13 @@ public class ActSuppliesHistorydata extends BaseEntity
@Excel(name = "模板")
private Long templateId;
/** 模板 */
@Excel(name = "模板Name")
private String templateName;
/** 模板 */
@Excel(name = "规则Name")
private String roleName;
/** 导入 */
@Excel(name = "导入")
private String importUuid;
......@@ -68,6 +75,26 @@ public class ActSuppliesHistorydata extends BaseEntity
{
return templateId;
}
public void setTemplateName(String templateName)
{
this.templateName = templateName;
}
public String getTemplateName()
{
return templateName;
}
public void setRoleName(String roleName)
{
this.roleName = roleName;
}
public String getRoleName()
{
return roleName;
}
public void setImportUuid(String importUuid)
{
this.importUuid = importUuid;
......
......@@ -69,11 +69,19 @@ public interface ActSuppliesDetailsMapper
* @param
* @return
*/
public int countByDetailsName(String detailsName);
public int countByDetailsName(ActSuppliesDetails actSuppliesDetails);
int updateActSuppliesDetails(Map<String, Object> paramMap);
int setEnable(Map<String, Object> paramMap);
int setDisable(Map<String, Object> paramMap);
List<ActSupplies> saveSid();
List<ActSuppliesDetails> getLevel();
int countBySuppliesLevel(ActSuppliesDetails actSuppliesDetails);
List<ActSuppliesDetails> findAllId(Long[] ids);
Long findAllIds(ActSuppliesDetails actSuppliesDetails);
}
......@@ -71,7 +71,7 @@ public interface ActSuppliesMapper
List<Integer> findall(Long[] ids);
List<Integer> findAllId(Long[] ids);
List<ActSupplies> findAllId(Long[] ids);
List<Integer> find(Long id);
......@@ -83,11 +83,15 @@ public interface ActSuppliesMapper
* @param suppliesName
* @return
*/
public int countBySuppliesName(String suppliesName);
public int countBySuppliesName(ActSupplies suppliesName);
int updateActSupplies(Map<String, Object> paramMap);
int setEnable(Map<String, Object> paramMap);
int setDisable(Map<String, Object> paramMap);
List<ActSupplies> selectActSuppliesListOne(ActSupplies actSupplies);
int countBySuppliesLevel(ActSupplies actSupplies);
Long findAllIds(ActSupplies allId);
}
......@@ -54,7 +54,7 @@ public interface IActSuppliesDetailsService
* @param ids 需要删除的物料细分类管理ID
* @return 结果
*/
public int deleteActSuppliesDetailsByIds(Long[] ids);
public List<Long> deleteActSuppliesDetailsByIds(Long[] ids);
/**
* 删除物料细分类管理信息
......@@ -81,4 +81,5 @@ public interface IActSuppliesDetailsService
*/
int setDisable(@Param("id") Long id, @Param("status") Integer status);
List<ActSuppliesDetails> getLevel();
}
......@@ -81,14 +81,8 @@ public interface IActSuppliesService
*/
int setDisable(@Param("id") Long id, @Param("status") Integer status);
List<Integer> findall(Long[] ids);
List<Integer> findAllId(Long[] ids);
List<Integer> find(Long id);
List<Integer> findId(Long id);
List<ActSupplies> selectActSuppliesListOne(ActSupplies actSupplies);
}
package com.ruoyi.system.service.impl;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.system.domain.ActSupplies;
import com.ruoyi.system.domain.ActSuppliesDetails;
import com.ruoyi.system.mapper.ActSuppliesDetailsMapper;
......@@ -10,6 +12,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -59,16 +62,27 @@ public class ActSuppliesDetailsServiceImpl implements IActSuppliesDetailsService
@Override
public int insertActSuppliesDetails(ActSuppliesDetails actSuppliesDetails)
{
String detailsName= actSuppliesDetails.getDetailsName();
int countByDetailsName = actSuppliesDetailsMapper.countByDetailsName(detailsName);
int countByDetailsName = actSuppliesDetailsMapper.countByDetailsName(actSuppliesDetails);
if(countByDetailsName > 0){
/* String message = "添加六矿物料失败,名称已被占用!";
System.out.println(message);*/
/*throw new ServiceException(ServiceCode.ERR_CONFLICT,message);*/
return 0;
}
SysUser user = SecurityUtils.getLoginUser().getUser();
actSuppliesDetails.setCreateBy(user.getUserName());
actSuppliesDetails.setCreateTime(DateUtils.getNowDate());
if (actSuppliesDetails.getLevel() == 2){
actSuppliesDetails.setTwoLevel(actSuppliesDetails.getOneLevel()+actSuppliesDetails.getTwoLevel());
}else if (actSuppliesDetails.getLevel()==3){
actSuppliesDetails.setTwoLevel(actSuppliesDetails.getTwoLevel()+actSuppliesDetails.getThreeLevel());
}
int countBySuppliesLevel = actSuppliesDetailsMapper.countBySuppliesLevel(actSuppliesDetails);
if (countBySuppliesLevel>0){
return -1;
}
return actSuppliesDetailsMapper.insertActSuppliesDetails(actSuppliesDetails);
}
......@@ -81,15 +95,19 @@ public class ActSuppliesDetailsServiceImpl implements IActSuppliesDetailsService
@Override
public int updateActSuppliesDetails(ActSuppliesDetails actSuppliesDetails)
{
String detailsName= actSuppliesDetails.getDetailsName();
int countByDetailsName = actSuppliesDetailsMapper.countByDetailsName(detailsName);
int countByDetailsName = actSuppliesDetailsMapper.countByDetailsName(actSuppliesDetails);
if(countByDetailsName > 0){
/* String message = "修改六矿物料失败,名称已被占用!";
System.out.println(message);*/
/*throw new ServiceException(ServiceCode.ERR_CONFLICT,message);*/
return 0;
}
if (actSuppliesDetails.getLevel() == 2){
actSuppliesDetails.setTwoLevel(actSuppliesDetails.getOneLevel()+actSuppliesDetails.getTwoLevel());
}else if (actSuppliesDetails.getLevel()==3){
actSuppliesDetails.setTwoLevel(actSuppliesDetails.getTwoLevel()+actSuppliesDetails.getThreeLevel());
}
SysUser user = SecurityUtils.getLoginUser().getUser();
actSuppliesDetails.setUpdateBy(user.getUserName());
actSuppliesDetails.setCreateTime(DateUtils.getNowDate());
return actSuppliesDetailsMapper.updateActSuppliesDetails(actSuppliesDetails);
......@@ -102,9 +120,27 @@ public class ActSuppliesDetailsServiceImpl implements IActSuppliesDetailsService
* @return 结果
*/
@Override
public int deleteActSuppliesDetailsByIds(Long[] ids)
public List<Long> deleteActSuppliesDetailsByIds(Long[] ids)
{
return actSuppliesDetailsMapper.deleteActSuppliesDetailsByIds(ids);
List<Long> idsl = new ArrayList<>();
List<ActSuppliesDetails> actSuppliesDetails = actSuppliesDetailsMapper.findAllId(ids);
for (int i=0;i<actSuppliesDetails.size();i++){
Long allIds = actSuppliesDetailsMapper.findAllIds(actSuppliesDetails.get(i));
if (allIds.intValue()>1){
idsl.add(actSuppliesDetails.get(i).getId());
}else {
actSuppliesDetailsMapper.deleteActSuppliesDetailsByIds(ids);
}
}
return idsl;
}
/**
......@@ -141,6 +177,10 @@ public class ActSuppliesDetailsServiceImpl implements IActSuppliesDetailsService
return actSuppliesDetailsMapper.setDisable(paramMap);
}
@Override
public List<ActSuppliesDetails> getLevel() {
return actSuppliesDetailsMapper.getLevel();
}
private int updateStatusById(Long id, Integer status){
......
......@@ -44,6 +44,8 @@ public class ActSuppliesHistorydataServiceImpl implements IActSuppliesHistorydat
@Override
public List<ActSuppliesHistorydata> selectActSuppliesHistorydataList(ActSuppliesHistorydata actSuppliesHistorydata)
{
SysUser user = SecurityUtils.getLoginUser().getUser();
actSuppliesHistorydata.setCreateBy(user.getUserName());
return actSuppliesHistorydataMapper.selectActSuppliesHistorydataList(actSuppliesHistorydata);
}
......
......@@ -92,9 +92,6 @@ public class ActSuppliesRoleServiceImpl implements IActSuppliesRoleService
{
int countByRoleName = actSuppliesRoleMapper.countByRoleName(actSuppliesRole);
if(countByRoleName > 0){
/*String message = "添加规则失败,规则名称已被占用";
System.out.println(message);*/
/* throw new ServiceException(ServiceCode.ERR_CONFLICT,message);*/
return 0;
}
......@@ -116,9 +113,6 @@ public class ActSuppliesRoleServiceImpl implements IActSuppliesRoleService
int countByRoleName = actSuppliesRoleMapper.countByRoleName(actSuppliesRole);
if(countByRoleName > 0){
/* String message = "修改规则失败,新的规则名称已被占用";
System.out.println(message);*/
/*throw new ServiceException(ServiceCode.ERR_CONFLICT,message);*/
return 0;
}
actSuppliesRole.setUpdateTime(DateUtils.getNowDate());
......@@ -129,14 +123,12 @@ public class ActSuppliesRoleServiceImpl implements IActSuppliesRoleService
public int updateActSuppliesRoleDetail(ActSuppliesRoleDetail actSuppliesRoleDetail) {
List<String> filteredList = new ArrayList<>();
for (int i =0 ;i<actSuppliesRoleDetail.getDetailMH().length; i++){
filteredList.add("{\"se\":\"0\",\"re\":\""+(Integer.parseInt((actSuppliesRoleDetail.getDetailYH()[i]))-1)+"\",\"ce\":\""+(Integer.parseInt((actSuppliesRoleDetail.getDetailYL()[i]))-1)+"\",\"st\":\"0\",\"rt\":\""+(Integer.parseInt((actSuppliesRoleDetail.getDetailMH()[i]))-1)+"\",\"ct\":\""+(Integer.parseInt((actSuppliesRoleDetail.getDetailML()[i]))-1)+"\",\"ys\":\""+actSuppliesRoleDetail.getConvertStatus()+"\"}") ;
}
String content = String.join(",",filteredList);
String content2 = "["+content+"]";
......
package com.ruoyi.system.service.impl;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.system.domain.ActSupplies;
import com.ruoyi.system.ex.ServiceException;
import com.ruoyi.system.mapper.ActSuppliesMapper;
......@@ -11,10 +13,12 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.sql.rowset.serial.SerialException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static jdk.nashorn.internal.runtime.regexp.joni.Config.USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE;
import static jdk.nashorn.internal.runtime.regexp.joni.Config.log;
/**
......@@ -63,18 +67,30 @@ public class ActSuppliesServiceImpl implements IActSuppliesService
@Override
public int insertActSupplies(ActSupplies actSupplies)
{
String suppliesName= actSupplies.getSuppliesName();
int countBySuppliesName = actSuppliesMapper.countBySuppliesName(suppliesName);
int countBySuppliesName = actSuppliesMapper.countBySuppliesName(actSupplies);
if (actSupplies.getLevel()==2){
actSupplies.setTwoLevel(actSupplies.getOneLevel()+actSupplies.getTwoLevel());
}else if (actSupplies.getLevel()==3){
actSupplies.setThreeLevel(actSupplies.getTwoLevel()+actSupplies.getThreeLevel());
}
int countBySuppliesLevel = actSuppliesMapper.countBySuppliesLevel(actSupplies);
if (countBySuppliesLevel>0){
return -1;
}
if(countBySuppliesName > 0){
/* String message = "添加物料总分类管理失败,名称已被占用!";
System.out.println(message);*/
/*throw new ServiceException(ServiceCode.ERR_CONFLICT,message);*/
return 0;
}
SysUser user = SecurityUtils.getLoginUser().getUser();
actSupplies.setCreateBy(user.getUserName());
actSupplies.setCreateTime(DateUtils.getNowDate());
return actSuppliesMapper.insertActSupplies(actSupplies);
return actSuppliesMapper.insertActSupplies(actSupplies);
}
/**
......@@ -86,14 +102,19 @@ public class ActSuppliesServiceImpl implements IActSuppliesService
@Override
public int updateActSupplies(ActSupplies actSupplies)
{
String suppliesName= actSupplies.getSuppliesName();
int countBySuppliesName = actSuppliesMapper.countBySuppliesName(suppliesName);
int countBySuppliesName = actSuppliesMapper.countBySuppliesName(actSupplies);
if(countBySuppliesName > 0) {
/* String message = "修改物料总分类管理失败,新的名称已被占用!";
System.out.println(message);*/
/* throw new ServiceException(ServiceCode.ERR_CONFLICT, message);*/
return 0;
}
if (actSupplies.getLevel()==2){
actSupplies.setTwoLevel(actSupplies.getOneLevel()+actSupplies.getTwoLevel());
}else if (actSupplies.getLevel()==3){
actSupplies.setThreeLevel(actSupplies.getTwoLevel()+actSupplies.getThreeLevel());
}
SysUser user = SecurityUtils.getLoginUser().getUser();
actSupplies.setUpdateBy(user.getUserName());
actSupplies.setUpdateTime(DateUtils.getNowDate());
return actSuppliesMapper.updateActSupplies(actSupplies);
......@@ -108,6 +129,28 @@ public class ActSuppliesServiceImpl implements IActSuppliesService
@Override
public int deleteActSuppliesByIds(Long[] ids)
{
List<Integer> findall = actSuppliesMapper.findall(ids);
List<ActSupplies> allId = actSuppliesMapper.findAllId(ids);
Map<Long,Long> map = new HashMap<>();
for (int i=0;i<allId.size();i++){
Long allIds = actSuppliesMapper.findAllIds(allId.get(i));
map.put(allId.get(i).getId(),allIds);
}
for (Long key : map.keySet()){
if (map.get(key)>1){
return 0;
}
}
if (findall.size()>0){
return 0;
}
return actSuppliesMapper.deleteActSuppliesByIds(ids);
}
......@@ -128,9 +171,6 @@ public class ActSuppliesServiceImpl implements IActSuppliesService
return actSuppliesMapper.options();
}
@Override
public int setEnable(Long id, Integer status) {
updateStatusById(id, status);
Map<String, Object> paramMap = new HashMap<>();
......@@ -139,7 +179,6 @@ public class ActSuppliesServiceImpl implements IActSuppliesService
return actSuppliesMapper.setEnable(paramMap);
}
@Override
public int setDisable(Long id, Integer status) {
updateStatusById(id, status);
Map<String, Object> paramMap = new HashMap<>();
......@@ -148,16 +187,6 @@ public class ActSuppliesServiceImpl implements IActSuppliesService
return actSuppliesMapper.setDisable(paramMap);
}
@Override
public List<Integer> findall(Long[] ids) {
return actSuppliesMapper.findall(ids);
}
@Override
public List<Integer> findAllId(Long[] ids) {
return actSuppliesMapper.findAllId(ids);
}
@Override
public List<Integer> find(Long id) {
return actSuppliesMapper.find(id);
......@@ -168,19 +197,11 @@ public class ActSuppliesServiceImpl implements IActSuppliesService
return actSuppliesMapper.findId(id);
}
@Override
public List<ActSupplies> selectActSuppliesListOne(ActSupplies actSupplies) {
return actSuppliesMapper.selectActSuppliesListOne(actSupplies);
}
private int updateStatusById(Long id, Integer status){
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("id", id);
paramMap.put("status", status);
return actSuppliesMapper.updateActSupplies(paramMap);
return actSuppliesMapper.updateActSupplies(paramMap);
}
}
......
......@@ -7,6 +7,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="ActSuppliesDetails" id="ActSuppliesDetailsResult">
<result property="id" column="id" />
<result property="sid" column="sid" />
<result property="oneLevel" column="one_level" />
<result property="twoLevel" column="two_level" />
<result property="threeLevel" column="three_level" />
<result property="level" column="level" />
<result property="detailsName" column="details_name" />
<result property="sysclassify" column="sysclassify" />
<result property="status" column="status" />
......@@ -18,10 +22,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="ActSupplies" id="ActSuppliesResult">
<result property="id" column="id" />
<result property="pid" column="pid" />
<result property="fname" column="fname"/>
<result property="oneLevel" column="one_level" />
<result property="twoLevel" column="two_level" />
<result property="threeLevel" column="three_level" />
<result property="suppliesName" column="supplies_name" />
<result property="orderNum" column="order_num" />
<result property="level" column="level" />
<result property="status" column="status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
......@@ -32,6 +37,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="ActSuppliesDetails" id="OneActSuppliesDetailsResult">
<result property="id" column="id" />
<result property="sid" column="sid" />
<result property="oneLevel" column="one_level" />
<result property="twoLevel" column="two_level" />
<result property="threeLevel" column="three_level" />
<result property="level" column="level" />
<result property="fname" column="supplies_name"/>
<result property="detailsName" column="details_name" />
<result property="sysclassify" column="sysclassify" />
......@@ -46,13 +55,47 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select id, sid, details_name, sysclassify, status, create_by, create_time, update_by, update_time from act_supplies_details
</sql>
<select id="countByDetailsName" resultType="int">
select count(*) from act_supplies_details where details_name=#{detailsName}
<select id="countByDetailsName" parameterType="ActSuppliesDetails" resultType="int">
select count(*) from act_supplies_details
<where>
<if test="detailsName!=null and detailsName!=''">and details_name = #{detailsName}</if>
<if test="oneLevel!=null and oneLevel!=''">and one_level = #{oneLevel}</if>
<if test="twoLevel!=null and twoLevel!=''">and two_level = #{twoLevel}</if>
<if test="threeLevel!=null and threeLevel!=''">and three_level = #{threeLevel}</if>
</where>
</select>
<select id="countBySuppliesLevel" parameterType="ActSuppliesDetails" resultType="int">
select count(*) from act_supplies_details
<where>
<if test="level == 1">and one_level = #{oneLevel}</if>
<if test="level == 2">and two_level = #{twoLevel}</if>
<if test="level == 3">and three_level = #{threeLevel}</if>
</where>
</select>
<select id="findAllId" parameterType="String" resultMap="ActSuppliesDetailsResult">
select id,one_level,two_level,three_level from act_supplies_details where id in
<foreach collection="array" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</select>
<select id="findAllIds" parameterType="ActSuppliesDetails" resultType="Long">
select count(id) from act_supplies_details
<where>
<if test="threeLevel !=null and threeLevel !=''">and three_level = #{threeLevel}</if>
<if test="(threeLevel ==null or threeLevel == '') and (twoLevel !=null and twoLevel != '') ">and two_level = #{twoLevel}</if>
<if test="(twoLevel ==null or twoLevel == '')">and one_level = #{oneLevel}</if>
</where>
</select>
<select id="saveSid" parameterType="com.ruoyi.system.domain.ActSupplies" resultMap="ActSuppliesResult">
-- select id,pid,supplies_name from act_supplies where status = 0;
select a.id,a.pid,b.supplies_name fname,a.supplies_name,a.status from act_supplies a LEFT JOIN act_supplies b on a.pid =b.id where a.status = 0
select id,one_level,two_level,three_level,supplies_name,level from act_supplies where status = 0
</select>
<select id="getLevel" parameterType="com.ruoyi.system.domain.ActSuppliesDetails" resultMap="ActSuppliesDetailsResult">
select id,sid,one_level,two_level,three_level,details_name,level from act_supplies_details where status = 0
</select>
<update id="setEnable" parameterType="java.util.Map">
......@@ -68,12 +111,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<select id="selectActSuppliesDetailsList" parameterType="ActSuppliesDetails" resultMap="OneActSuppliesDetailsResult">
select a.id, a.sid,b.supplies_name,a.details_name,a.sysclassify,a.status from act_supplies_details a left join act_supplies b on a.sid = b.id
select a.id, a.sid,a.one_level, a.two_level, a.three_level,b.supplies_name,a.details_name,a.sysclassify,a.status from act_supplies_details a left join act_supplies b on a.sid = b.id
<where>
<if test="id != null "> and a.id = #{id}</if>
<if test="detailsName != null and detailsName != ''"> and a.details_name like concat('%', #{detailsName}, '%')</if>
<if test="sysclassify != null and sysclassify != ''"> and a.sysclassify like concat('%', #{sysclassify},'%')</if>
<if test="status != null "> and a.status = #{status}</if>
<if test="oneLevel != null "> and a.one_level = #{oneLevel}</if>
<if test="twoLevel != null "> and a.two_level = #{twoLevel}</if>
<if test="threeLevel != null "> and a.three_level = #{threeLevel}</if>
<if test="sid != null "> and a.sid = #{sid}</if>
</where>
</select>
......@@ -87,6 +133,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
insert into act_supplies_details
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="sid != null">sid,</if>
<if test="oneLevel != null">one_level,</if>
<if test="twoLevel != null">two_level,</if>
<if test="threeLevel != null">three_level,</if>
<if test="level != null">level,</if>
<if test="detailsName != null">details_name,</if>
<if test="sysclassify != null">sysclassify,</if>
<if test="status != null">status,</if>
......@@ -97,6 +147,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="sid != null">#{sid},</if>
<if test="oneLevel != null">#{oneLevel},</if>
<if test="twoLevel != null">#{twoLevel},</if>
<if test="threeLevel != null">#{threeLevel},</if>
<if test="level != null">level,</if>
<if test="detailsName != null">#{detailsName},</if>
<if test="sysclassify != null">#{sysclassify},</if>
<if test="status != null">#{status},</if>
......@@ -111,6 +165,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update act_supplies_details
<trim prefix="SET" suffixOverrides=",">
<if test="sid != null">sid = #{sid},</if>
<if test="oneLevel != null">one_level = #{oneLevel},</if>
<if test="twoLevel != null">two_level = #{twoLevel},</if>
<if test="threeLevel != null">three_level = #{threeLevel},</if>
<if test="level != null">level = #{level},</if>
<if test="detailsName != null">details_name = #{detailsName},</if>
<if test="sysclassify != null">sysclassify = #{sysclassify},</if>
<if test="status != null">status = #{status},</if>
......
......@@ -8,6 +8,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="id" column="id" />
<result property="importUuid" column="import_uuid" />
<result property="templateId" column="template_id" />
<result property="templateName" column="template_name" />
<result property="roleName" column="role_name" />
<result property="exportUuid" column="export_uuid" />
<result property="roleId" column="role_id" />
<result property="historyName" column="history_name" />
......@@ -23,12 +25,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<select id="selectActSuppliesHistorydataList" parameterType="ActSuppliesHistorydata" resultMap="ActSuppliesHistorydataResult">
<include refid="selectActSuppliesHistorydataVo"/>
<where>
<if test="importUuid != null and importUuid != ''"> and import_uuid = #{importUuid}</if>
<if test="templateId != null "> and template_id = #{templateId}</if>
<if test="exportUuid != null and exportUuid != ''"> and export_uuid = #{exportUuid}</if>
<if test="roleId != null "> and role_id = #{roleId}</if>
<!--<include refid="selectActSuppliesHistorydataVo"/>-->
SELECT t1.id, t1.template_id, t2.template_name, t3.role_name, t1.import_uuid, t1.export_uuid, t1.role_id, t1.history_name, t1.history_content, t1.identifying_code, t1.status, t1.create_by, t1.create_time
FROM act_supplies_historydata t1
LEFT JOIN act_supplies_template t2 ON t1.template_id = t2.id
LEFT JOIN act_supplies_role t3 ON t1.role_id = t3.id
<where>
t1.create_by = #{createBy}
<if test="templateName != null and templateName != ''"> and t2.template_name like concat('%', #{templateName}, '%')</if>
<if test="roleName != null and roleName != ''"> and t3.role_name like concat('%', #{roleName}, '%')</if>
<if test="historyName != null and historyName != ''"> and history_name like concat('%', #{historyName}, '%')</if>
<if test="historyContent != null and historyContent != ''"> and history_content = #{historyContent}</if>
<if test="identifyingCode != null "> and identifying_code = #{identifyingCode}</if>
......
......@@ -6,8 +6,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="ActSupplies" id="ActSuppliesResult">
<result property="id" column="id" />
<result property="pid" column="pid" />
<result property="fname" column="fname"/>
<result property="oneLevel" column="one_level" />
<result property="twoLevel" column="two_level" />
<result property="threeLevel" column="three_level" />
<result property="suppliesName" column="supplies_name" />
<result property="orderNum" column="order_num" />
<result property="status" column="status" />
......@@ -19,52 +20,59 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectActSuppliesVo">
select id, pid, supplies_name, order_num, status, create_by, create_time, update_by, update_time from act_supplies
select id,one_level,two_level,three_level,supplies_name,status, create_by, create_time, update_by, update_time from act_supplies
</sql>
<select id="countBySuppliesName" resultType="int">
select count(*) from act_supplies where supplies_name=#{suppliesName}
<select id="countBySuppliesName" parameterType="ActSupplies" resultType="int">
select count(*) from act_supplies
<where>
<if test="suppliesName!=null and suppliesName!=''">and supplies_name = #{suppliesName}</if>
<if test="oneLevel!=null and oneLevel!=''">and one_level = #{oneLevel}</if>
<if test="twoLevel!=null and twoLevel!=''">and two_level = #{twoLevel}</if>
<if test="threeLevel!=null and threeLevel!=''">and three_level = #{threeLevel}</if>
</where>
</select>
<select id="selectActSuppliesList" parameterType="ActSupplies" resultMap="ActSuppliesResult">
select a.id,a.pid,b.supplies_name fname,a.supplies_name,a.status from act_supplies a , act_supplies b
<select id="countBySuppliesLevel" parameterType="ActSupplies" resultType="int">
select count(*) from act_supplies
<where>
and a.pid =b.id
<if test="id != null "> and a.id = #{id}</if>
<if test="pid != null">and a.pid = #{pid}</if>
<if test="fname != null "> and b.supplies_name like concat('%', #{fname}, '%')</if>
<if test="suppliesName != null and suppliesName != ''"> and a.supplies_name like concat('%', #{suppliesName}, '%')</if>
<if test="status != null "> and a.status = #{status}</if>
<if test="level == 1">and one_level = #{oneLevel}</if>
<if test="level == 2">and two_level = #{twoLevel}</if>
<if test="level == 3">and three_level = #{threeLevel}</if>
</where>
</select>
<select id="selectActSuppliesListOne" parameterType="ActSupplies" resultMap="ActSuppliesResult">
<include refid="selectActSuppliesVo"/>
<select id="selectActSuppliesList" parameterType="ActSupplies" resultMap="ActSuppliesResult">
select id,one_level,two_level,three_level,supplies_name,status from act_supplies
<where>
and pid = 0
<if test="id != null "> and id = #{id}</if>
<if test="oneLevel != null and oneLevel != ''">and one_level = #{oneLevel}</if>
<if test="twoLevel != null and twoLevel != ''">and two_level = #{twoLevel}</if>
<if test="threeLevel != null and threeLevel != ''">and three_level = #{threeLevel}</if>
<if test="suppliesName != null and suppliesName != ''"> and supplies_name like concat('%', #{suppliesName}, '%')</if>
<if test="status != null "> and status = #{status}</if>
</where>
</select>
<select id="selectActSuppliesById" parameterType="Long" resultMap="ActSuppliesResult">
<include refid="selectActSuppliesVo"/>
where id = #{id}
<select id="options" resultMap="ActSuppliesResult">
<include refid="selectActSuppliesVo"/> where status = 0;
</select>
<select id="options" parameterType="ActSupplies" resultMap="ActSuppliesResult">
<select id="selectActSuppliesById" parameterType="Long" resultMap="ActSuppliesResult">
<include refid="selectActSuppliesVo"/>
where pid = 0 and status = 0
where id = #{id}
</select>
<insert id="insertActSupplies" parameterType="ActSupplies" useGeneratedKeys="true" keyProperty="id">
insert into act_supplies
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="pid != null">pid,</if>
<if test="oneLevel != null">one_level,</if>
<if test="twoLevel != null">two_level,</if>
<if test="threeLevel != null">three_level,</if>
<if test="suppliesName != null">supplies_name,</if>
<if test="orderNum != null">order_num,</if>
<if test="level != null">level,</if>
<if test="status != null">status,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
......@@ -72,9 +80,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="pid != null">#{pid},</if>
<if test="oneLevel != null">#{oneLevel},</if>
<if test="twoLevel != null">#{twoLevel},</if>
<if test="threeLevel != null">#{threeLevel},</if>
<if test="suppliesName != null">#{suppliesName},</if>
<if test="orderNum != null">#{orderNum},</if>
<if test="level != null">#{level},</if>
<if test="status != null">#{status},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
......@@ -86,12 +96,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateActSupplies" parameterType="ActSupplies">
update act_supplies
<trim prefix="SET" suffixOverrides=",">
<if test="pid != null">pid = #{pid},</if>
<if test="oneLevel != null">one_level = #{oneLevel},</if>
<if test="twoLevel != null">two_level = #{twoLevel},</if>
<if test="threeLevel != null">three_level = #{threeLevel},</if>
<if test="suppliesName != null">supplies_name = #{suppliesName},</if>
<if test="orderNum != null">order_num = #{orderNum},</if>
<if test="level != null">level = #{level},</if>
<if test="status != null">status = #{status},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
......@@ -112,21 +122,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="findall" parameterType="String" resultType="Integer">
-- select sid from act_supplies_details GROUP BY sid
select sid from act_supplies_details where sid in
<foreach collection="array" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</select>
<select id="findAllId" parameterType="String" resultType="Integer">
-- select pid from act_supplies
select pid from act_supplies where pid in
<select id="findAllId" parameterType="String" resultMap="ActSuppliesResult">
select id,one_level,two_level,three_level from act_supplies where id in
<foreach collection="array" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</select>
<select id="findAllIds" parameterType="ActSupplies" resultType="Long">
select count(id) from act_supplies
<where>
<if test="threeLevel !=null and threeLevel !=''">and three_level = #{threeLevel}</if>
<if test="(threeLevel ==null or threeLevel == '') and (twoLevel !=null and twoLevel != '') ">and two_level = #{twoLevel}</if>
<if test="(twoLevel ==null or twoLevel == '')">and one_level = #{oneLevel}</if>
</where>
</select>
<select id="find" resultType="Integer">
-- select sid from act_supplies_details GROUP BY sid
select sid from act_supplies_details where sid = #{id}
......
......@@ -65,11 +65,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="countByRoleName" parameterType="ActSuppliesRole" resultType="int">
select count(*) from act_supplies_role where role_name=#{roleName} AND temp_id=#{tempId}
select count(*) from act_supplies_role
<where>
status = 1
<if test="roleName !=null and roleName !=''">and role_name=#{roleName}</if>
<if test="temp_id !=null and temp_id !=''">and temp_id=#{tempId}</if>
</where>
</select>
<sql id="selectActSuppliesRoleVo">
select id, temp_id, role_name, status, create_by, create_time, update_by, update_time from act_supplies_role
</sql>
......
......@@ -48,7 +48,7 @@
</select>
<sql id="selectActSuppliesRoleVo">
select id, temp_id, role_name, status, create_by, create_time, update_by, update_time from act_supplies_role
select id, temp_id, role_name, status from act_supplies_role
</sql>
<select id="selectActSuppliesRoleList" parameterType="Integer" resultMap="ActSuppliesRoleResult">
......
......@@ -25,6 +25,14 @@ export function saveSid() {
})
}
//查询三级
export function getLevel() {
return request({
url: '/ActSuppliesDetails/ActSuppliesDetails/getLevel',
method: 'get'
})
}
// 新增物料细分类管理
export function addActSuppliesDetails(data) {
return request({
......
......@@ -86,6 +86,10 @@
// method: 'get',
// })
// }
//
//
// export function findName(name) {
......
import request from '@/utils/request'
// 查询二级分类列表
// 查询用友物料列表
export function listSupplies(query) {
return request({
url: '/Actsupplies/Actsupplies/list',
......@@ -9,15 +9,6 @@ export function listSupplies(query) {
})
}
// 查询一级分类列表
export function listSuppliesOne(query) {
return request({
url: '/Actsupplies/Actsupplies/listOne',
method: 'get',
params: query
})
}
// 查询物料关系管理详细
export function getSupplies(id) {
return request({
......@@ -27,7 +18,7 @@ export function getSupplies(id) {
}
//查询上级ID
export function getPid() {
export function getLevel() {
return request({
url: '/Actsupplies/Actsupplies/options',
method: 'get'
......@@ -59,37 +50,23 @@ export function delSupplies(id) {
method: 'delete'
})
}
export function toggleEnable(id) {
return request({
url: `/Actsupplies/Actsupplies/${id}/enable?status=0`,
method: 'put',
})
}
/*//启用
//启用
export function toggleEnable(id) {
return request({
url: '/Actsupplies/Actsupplies/enable/' +id,
method: 'get',
})
}*/
export function toggleDisable(id) {
return request({
url: `/Actsupplies/Actsupplies/${id}/disable?status=1`,
method: 'put',
})
}
/*//禁用
}
//禁用
export function toggleDisable(id) {
return request({
url: '/Actsupplies/Actsupplies/disable/' +id,
method: 'get',
})
}*/
}
export function exportSupplies(query) {
return request({
......@@ -99,13 +76,6 @@ export function exportSupplies(query) {
})
}
export function exportSuppliesOne(query) {
return request({
url: '/Actsupplies/Actsupplies/exportOne',
method: 'get',
params: query
})
}
......
import request from '@/utils/request'
import LuckyExcel from "luckyexcel";
// 查询 历史数据列表
export function listHistorydata(query) {
......
......@@ -2,9 +2,9 @@
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="模板" prop="templateId">
<el-form-item label="模板" prop="templateName">
<el-input
v-model="queryParams.templateId"
v-model="queryParams.templateName"
placeholder="请输入模板"
clearable
size="small"
......@@ -12,9 +12,9 @@
/>
</el-form-item>
<el-form-item label="规则" prop="roleId">
<el-form-item label="规则" prop="roleName">
<el-input
v-model="queryParams.roleId"
v-model="queryParams.roleName"
placeholder="请输入规则"
clearable
size="small"
......@@ -58,25 +58,28 @@
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="historydataList" @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="templateId" />
<el-table-column label="规则" align="center" prop="roleId" />
<el-table-column label="标题" align="center" prop="historyName" />
<!--<el-table-column label="内容" align="center" prop="historyContent" />-->
<el-table-column label="导入导出" align="center" prop="identifyingCode" />
<el-table-column label="模板" align="center" prop="templateName" />
<el-table-column label="规则" align="center" prop="roleName" />
<el-table-column label="标题" align="center" prop="historyName" />
<el-table-column label="导入导出" align="center" prop="identifyingCode">
<template slot-scope="scope">
<span v-if="scope.row.identifyingCode==0">导入</span>
<span v-if="scope.row.identifyingCode==1">导出</span>
</template>
</el-table-column>
<el-table-column label="操作时间" align="center" prop="createTime" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<!--<el-button
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:historydata:edit']"
>详情</el-button>-->
@click="handleDetails(scope.row)"
v-hasPermi="['system:historydata']"
>详情</el-button>
<el-button
size="mini"
type="text"
......@@ -87,7 +90,7 @@
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
......@@ -95,13 +98,37 @@
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<div id="luckysheet" :style="{ position: positionValue, top: '0', left: '0', right: '0', bottom: '0' }"></div>
</div>
</template>
<style>
#luckysheet_info_detail_title {
display: none;
}
#luckysheet_info_detail_update {
display: none;
}
#luckysheet_info_detail_save {
display: none;
}
.luckysheet-share-logo {
display: none;
}
</style>
<script>
import { listHistorydata, getHistorydata, delHistorydata, addHistorydata, updateHistorydata, exportHistorydata } from "@/api/system/historydata";
import Editor from '@/components/Editor';
import $ from 'jquery';
import XLSX from 'xlsx';
import LuckyExcel from 'luckyexcel';
import { Loading } from 'element-ui';
export default {
name: "Historydata",
components: {
......@@ -109,7 +136,9 @@ export default {
},
data() {
return {
// 遮罩层
positionValue: 'static',
// 遮罩层
loading: true,
// 选中数组
ids: [],
......@@ -149,7 +178,14 @@ export default {
},
created() {
this.getList();
this.positionValue = "static";
},
mounted() {
window.handleReturnButtonClick = this.handleReturnButtonClick;
},
methods: {
/** 查询 历史数据列表 */
getList() {
......@@ -234,6 +270,30 @@ export default {
}
});
},
handleDetails(row) {
this.positionValue = 'absolute';
luckysheet.destroy();
luckysheet.create({
container: "luckysheet", // Luckysheet 的容器元素 ID
title: row.historyName, // Excel 文件名
data: JSON.parse(row.historyContent), // Excel 数据
showtoolbar: false, //是否第二列显示工具栏
showinfobar: true, //是否显示顶部名称栏
showsheetbar: false, //是否显示底部表格名称区域
pointEdit: false, //是否是编辑器插入表格模式
pointEditUpdate: null, //编辑器表格更新函数
allowEdit: false,//作用:是否允许前台编辑
functionButton: '<button id="exportButton" class="btn btn-primary" style=" padding:3px 6px; font-size: 16px;width: 100px;height: 27px; margin-right: 85px;" onclick="handleReturnButtonClick()">返回</button>',
});
},
/**详情返回按钮 */
handleReturnButtonClick() {
this.positionValue = 'static';
luckysheet.destroy();
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
......
......@@ -56,6 +56,10 @@
style="margin: 0px; padding: 0px; position: absolute; width: 100%;height: 78vh; z-index: 0"
>
</div>
<!-- 遮罩层组件 -->
<div v-if="uploading" class="overlay">
<div class="loader"></div>
</div>
</div>
</template>
......@@ -72,6 +76,7 @@ import LuckyExcel from 'luckyexcel'
//导入库export.js 这个文件是es6的,不能在普通的HTML文件直接引入js文件(虽然都是js文件,但是有区别,具体请百度es6与es5)!需要把es6转es5才可以直接引入使用!
import { exportExcel } from '../../../../public/exportExcel';
import {vueScript} from "@/utils/generator/html";
import { Loading } from 'element-ui';
var fileName="新建XLSX工作表"; //定义表名
......@@ -219,6 +224,9 @@ export default {
)
},
handleFileChange1(evt) {
this.uploading = true;
let name = evt.name
let suffixArr = name.split('.'),
suffix = suffixArr[suffixArr.length - 1];
......@@ -339,6 +347,8 @@ export default {
}
)
this.uploading = false;
},
/** 导出设置 */
handleExport: debounce(function() {
......
......@@ -551,6 +551,7 @@ export default {
this.instea='';
const id = row.id || this.ids
listSuppliesroledetail(id).then(response =>{
this.options1 = response.rows;
});
......
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