赋码管理

This commit is contained in:
DESKTOP-J7ED0MB\yinjinlu 2022-10-22 16:35:57 +08:00
parent 2c2015ecf4
commit 631bf22bcd
6 changed files with 54 additions and 32 deletions

View File

@ -1,27 +1,20 @@
package com.ktg.mes.wm.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ktg.common.constant.UserConstants;
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.ktg.common.annotation.Log;
import com.ktg.common.constant.UserConstants;
import com.ktg.common.core.controller.BaseController;
import com.ktg.common.core.domain.AjaxResult;
import com.ktg.common.core.page.TableDataInfo;
import com.ktg.common.enums.BusinessType;
import com.ktg.common.utils.poi.ExcelUtil;
import com.ktg.mes.wm.domain.WmBarcode;
import com.ktg.mes.wm.service.IWmBarcodeService;
import com.ktg.common.utils.poi.ExcelUtil;
import com.ktg.common.core.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 条码清单Controller

View File

@ -1,8 +1,9 @@
package com.ktg.mes.wm.mapper;
import java.util.List;
import com.ktg.mes.wm.domain.WmBarcode;
import java.util.List;
/**
* 条码清单Mapper接口
*

View File

@ -58,4 +58,13 @@ public interface IWmBarcodeConfigService
* @return 结果
*/
public int deleteWmBarcodeConfigByConfigId(Long configId);
/**
* 判断某种类型的业务是否需要自动生成赋码
* @param barcodeType
* @return
*/
public boolean isAutoGen(String barcodeType);
}

View File

@ -1,8 +1,9 @@
package com.ktg.mes.wm.service;
import java.util.List;
import com.ktg.mes.wm.domain.WmBarcode;
import java.util.List;
/**
* 条码清单Service接口
*

View File

@ -1,12 +1,15 @@
package com.ktg.mes.wm.service.impl;
import java.util.List;
import com.ktg.common.constant.UserConstants;
import com.ktg.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ktg.mes.wm.mapper.WmBarcodeConfigMapper;
import com.ktg.mes.wm.domain.WmBarcodeConfig;
import com.ktg.mes.wm.service.IWmBarcodeConfigService;
import org.springframework.util.CollectionUtils;
/**
* 条码配置Service业务层处理
@ -93,4 +96,20 @@ public class WmBarcodeConfigServiceImpl implements IWmBarcodeConfigService
{
return wmBarcodeConfigMapper.deleteWmBarcodeConfigByConfigId(configId);
}
/**
* 判断某种类型的业务是否需要自动生成赋码
* @param barcodeType
* @return
*/
@Override
public boolean isAutoGen(String barcodeType) {
WmBarcodeConfig param = new WmBarcodeConfig();
param.setBarcodeType(barcodeType);
List<WmBarcodeConfig> configs = wmBarcodeConfigMapper.selectWmBarcodeConfigList(param);
if(!CollectionUtils.isEmpty(configs)){
return configs.get(0).getAutoGenFlag() == UserConstants.YES ?true:false;
}
return false;
}
}

View File

@ -1,23 +1,22 @@
package com.ktg.mes.wm.service.impl;
import java.io.File;
import java.io.IOException;
import java.util.List;
import com.ktg.common.constant.UserConstants;
import com.ktg.common.core.domain.AjaxResult;
import com.ktg.common.utils.DateUtils;
import com.ktg.common.utils.StringUtils;
import com.ktg.common.utils.barcode.BarcodeUtil;
import com.ktg.common.utils.file.FileUploadUtils;
import com.ktg.common.utils.file.FileUtils;
import com.ktg.mes.wm.domain.WmBarcode;
import com.ktg.mes.wm.mapper.WmBarcodeMapper;
import com.ktg.mes.wm.service.IWmBarcodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ktg.mes.wm.mapper.WmBarcodeMapper;
import com.ktg.mes.wm.domain.WmBarcode;
import com.ktg.mes.wm.service.IWmBarcodeService;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.IOException;
import java.util.List;
/**
* 条码清单Service业务层处理
*
@ -116,8 +115,8 @@ public class WmBarcodeServiceImpl implements IWmBarcodeService
@Override
public String generateBarcode(WmBarcode wmBarcode) {
File buf = BarcodeUtil.generateBarCode(wmBarcode.getBarcodeContent(), wmBarcode.getBarcodeFormart(),
"./tmp/barcode/" + wmBarcode.getBarcodeContent() + ".png");
File buf = BarcodeUtil.generateBarCode(wmBarcode.getBarcodeContent(), wmBarcode.getBarcodeFormart(),
"./tmp/barcode/" + wmBarcode.getBarcodeContent() + ".png");
MultipartFile file = FileUtils.getMultipartFile(buf);
String fileName = null;
try {
@ -126,10 +125,10 @@ public class WmBarcodeServiceImpl implements IWmBarcodeService
e.printStackTrace();
return null;
}finally{
//删除掉临时文件
if(buf!=null && buf.exists()){
FileUtils.deleteFile(buf.getAbsolutePath());
}
//删除掉临时文件
if(buf!=null && buf.exists()){
FileUtils.deleteFile(buf.getAbsolutePath());
}
}
return fileName;
}