Commit 4b7908d5 LN

资源全部改为smfcore类型

1 个父辈 73e9a9ae
正在显示 47 个修改的文件 包含 247 行增加239 行删除
...@@ -266,7 +266,7 @@ public class CsvReader { ...@@ -266,7 +266,7 @@ public class CsvReader {
if(index == -1){ if(index == -1){
log.info("未包含【"+titleName+"】或【"+titleNameEn+"】列"); log.info("未包含【"+titleName+"】或【"+titleNameEn+"】列");
// throw new ValidateException("必须包含["+titleNameEn+"]列"); // throw new ValidateException("必须包含["+titleNameEn+"]列");
throw new ValidateException("smfcode.columnNotExist","必须包含[{0}列",new String[]{titleNameEn}); throw new ValidateException("smfcore.columnNotExist","必须包含[{0}列",new String[]{titleNameEn});
} }
return index; return index;
} }
......
...@@ -3,6 +3,8 @@ package com.neotel.smfcore.common.exception; ...@@ -3,6 +3,8 @@ package com.neotel.smfcore.common.exception;
import lombok.Data; import lombok.Data;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import java.text.MessageFormat;
import static org.springframework.http.HttpStatus.BAD_REQUEST; import static org.springframework.http.HttpStatus.BAD_REQUEST;
/** /**
...@@ -25,10 +27,10 @@ public class ValidateException extends RuntimeException{ ...@@ -25,10 +27,10 @@ public class ValidateException extends RuntimeException{
} }
public ValidateException(String msgKey, String defMsg,String[] msgParam){ public ValidateException(String msgKey, String defMsg,String[] msgParam){
super(defMsg); super( defMsg= MessageFormat.format(defMsg,msgParam));
this.msgKey=msgKey; this.msgKey=msgKey;
this.msgParam=msgParam; this.msgParam=msgParam;
this.defaultMsg=defMsg; this.defaultMsg= defMsg;
} }
public ValidateException(HttpStatus status, String msg){ public ValidateException(HttpStatus status, String msg){
......
...@@ -255,7 +255,7 @@ public class FileUtil extends cn.hutool.core.io.FileUtil { ...@@ -255,7 +255,7 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
// 1M // 1M
int len = 1024 * 1024; int len = 1024 * 1024;
if (size > (maxSize * len)) { if (size > (maxSize * len)) {
throw new ValidateException("smfcode.fileToLong", "文件超出规定大小"); throw new ValidateException("smfcore.fileToLong", "文件超出规定大小");
} }
} }
......
...@@ -62,7 +62,7 @@ public class UserCodeUtil { ...@@ -62,7 +62,7 @@ public class UserCodeUtil {
if(index == -1){ if(index == -1){
log.info("未包含【"+titleName+"】或【"+titleNameEn+"】列"); log.info("未包含【"+titleName+"】或【"+titleNameEn+"】列");
// throw new ValidateException("必须包含["+titleNameEn+"]列"); // throw new ValidateException("必须包含["+titleNameEn+"]列");
throw new ValidateException("smfcode.columnNotExist","必须包含[{0}列",new String[]{titleNameEn}); throw new ValidateException("smfcore.columnNotExist","必须包含[{0}列",new String[]{titleNameEn});
} }
return index; return index;
} }
......
...@@ -497,7 +497,7 @@ public class BarcodeRule { ...@@ -497,7 +497,7 @@ public class BarcodeRule {
} }
codeBean.setCodeStr(codeStr); codeBean.setCodeStr(codeStr);
if(!isValidRule()){ if(!isValidRule()){
codeBean.setError("smfcode.error.barcode.noRule","解析规则未定义"); codeBean.setError("smfcore.error.barcode.noRule","解析规则未定义");
return codeBean; return codeBean;
} }
String[] codeArr = new String[]{codeStr}; String[] codeArr = new String[]{codeStr};
...@@ -506,7 +506,7 @@ public class BarcodeRule { ...@@ -506,7 +506,7 @@ public class BarcodeRule {
//条码与规则长度对应不上 //条码与规则长度对应不上
if(codeArr.length != length){ if(codeArr.length != length){
log.info("条码["+codeStr+"]与规则【"+ruleStr+"】长度不同"); log.info("条码["+codeStr+"]与规则【"+ruleStr+"】长度不同");
codeBean.setError("smfcode.error.barcode.wrongLength",new String[]{codeStr}, "条码[{0}]长度错误"); codeBean.setError("smfcore.error.barcode.wrongLength",new String[]{codeStr}, "条码[{0}]长度错误");
return codeBean; return codeBean;
}else{ }else{
codeArr = codeStr.split(separator,length); codeArr = codeStr.split(separator,length);
...@@ -525,7 +525,7 @@ public class BarcodeRule { ...@@ -525,7 +525,7 @@ public class BarcodeRule {
if(Strings.isNullOrEmpty(reelId)){ if(Strings.isNullOrEmpty(reelId)){
log.info("条码解析失败,未找到RI字段"); log.info("条码解析失败,未找到RI字段");
codeBean.setError("smfcode.error.barcode.noField",new String[]{"RI"},"条码解析失败,未找到{0}字段"); codeBean.setError("smfcore.error.barcode.noField",new String[]{"RI"},"条码解析失败,未找到{0}字段");
return codeBean; return codeBean;
} }
...@@ -533,7 +533,7 @@ public class BarcodeRule { ...@@ -533,7 +533,7 @@ public class BarcodeRule {
if(Strings.isNullOrEmpty(partNumber)){ if(Strings.isNullOrEmpty(partNumber)){
log.info("条码解析失败,未找到PN字段"); log.info("条码解析失败,未找到PN字段");
codeBean.setError("smfcode.error.barcode.noField",new String[]{"PN"}, "条码解析失败,未找到{0}字段"); codeBean.setError("smfcore.error.barcode.noField",new String[]{"PN"}, "条码解析失败,未找到{0}字段");
return codeBean; return codeBean;
} }
if(batch_item.hasThisField()){ if(batch_item.hasThisField()){
...@@ -545,7 +545,7 @@ public class BarcodeRule { ...@@ -545,7 +545,7 @@ public class BarcodeRule {
quantity = quantity_item.getIntValue(codeArr); quantity = quantity_item.getIntValue(codeArr);
if(quantity == -1){ if(quantity == -1){
log.info("条码解析失败,未找到QTY 字段"); log.info("条码解析失败,未找到QTY 字段");
codeBean.setError("smfcode.error.barcode.noField",new String[]{"QTY"},"条码解析失败,未找到{0}字段"); codeBean.setError("smfcore.error.barcode.noField",new String[]{"QTY"},"条码解析失败,未找到{0}字段");
return codeBean; return codeBean;
} }
} }
...@@ -553,7 +553,7 @@ public class BarcodeRule { ...@@ -553,7 +553,7 @@ public class BarcodeRule {
Date produceDate= produceDate_item.getDateValue(codeArr); Date produceDate= produceDate_item.getDateValue(codeArr);
if(produceDate_item.hasThisField() && produceDate == null){ if(produceDate_item.hasThisField() && produceDate == null){
log.info("条码解析失败,PRODATE字段不合规则"); log.info("条码解析失败,PRODATE字段不合规则");
codeBean.setError("smfcode.error.barcode.noField",new String[]{"PRODATE"},"条码解析失败,未找到{0}字段"); codeBean.setError("smfcore.error.barcode.noField",new String[]{"PRODATE"},"条码解析失败,未找到{0}字段");
return codeBean; return codeBean;
} }
Date expireDate= expireDate_item.getDateValue(codeArr); Date expireDate= expireDate_item.getDateValue(codeArr);
......
...@@ -84,7 +84,7 @@ public class BarcodeController { ...@@ -84,7 +84,7 @@ public class BarcodeController {
public ResponseEntity<Object> update(@Validated @RequestBody BarcodeDto resources) { public ResponseEntity<Object> update(@Validated @RequestBody BarcodeDto resources) {
Barcode barcode=barcodeMapper.toEntity(resources); Barcode barcode=barcodeMapper.toEntity(resources);
if (barcode.getId() == null) { if (barcode.getId() == null) {
throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"}); throw new ValidateException("smfcore.valueCanotNull","{0}不能为空",new String[]{"ID"});
} }
barcodeManager.saveBarcode(barcode); barcodeManager.saveBarcode(barcode);
return new ResponseEntity<>(HttpStatus.OK); return new ResponseEntity<>(HttpStatus.OK);
...@@ -97,7 +97,7 @@ public class BarcodeController { ...@@ -97,7 +97,7 @@ public class BarcodeController {
List<Barcode> barcodes = new ArrayList<Barcode>(); List<Barcode> barcodes = new ArrayList<Barcode>();
for (String id : ids) { for (String id : ids) {
if (id == null) { if (id == null) {
throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} ); throw new ValidateException("smfcore.valueCanotNull","{0}不能为空",new String[]{"ID"} );
} }
} }
barcodeManager.deleteBarcodes(ids); barcodeManager.deleteBarcodes(ids);
...@@ -117,10 +117,10 @@ public class BarcodeController { ...@@ -117,10 +117,10 @@ public class BarcodeController {
@PreAuthorize("@el.check('barcode')") @PreAuthorize("@el.check('barcode')")
public ResponseEntity<Object> updateRules(@Validated @RequestBody List<String> codeRules) { public ResponseEntity<Object> updateRules(@Validated @RequestBody List<String> codeRules) {
if(codeRules.isEmpty()){ if(codeRules.isEmpty()){
throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"codeRuleList"} ); throw new ValidateException("smfcore.valueCanotNull","{0}不能为空",new String[]{"codeRuleList"} );
} }
if(codeRules.size()>10){ if(codeRules.size()>10){
throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"codeRuleList"} ); throw new ValidateException("smfcore.valueCanotNull","{0}不能为空",new String[]{"codeRuleList"} );
} }
Settings settings=dataCache.getSettings(); Settings settings=dataCache.getSettings();
settings.setCodeRuleList(codeRules); settings.setCodeRuleList(codeRules);
...@@ -135,7 +135,7 @@ public class BarcodeController { ...@@ -135,7 +135,7 @@ public class BarcodeController {
String image = "csv"; String image = "csv";
String fileType = FileUtil.getExtensionName(uploadFile.getOriginalFilename()); String fileType = FileUtil.getExtensionName(uploadFile.getOriginalFilename());
if(fileType != null && !image.contains(fileType)){ if(fileType != null && !image.contains(fileType)){
throw new ValidateException("smfcode.feleFormatError","文件格式错误!, 仅支持{0}格式",new String[]{image}); throw new ValidateException("smfcore.feleFormatError","文件格式错误!, 仅支持{0}格式",new String[]{image});
} }
File folder = new File(properties.getPath(),"pos"); File folder = new File(properties.getPath(),"pos");
File file = FileUtil.upload(uploadFile, folder.getAbsolutePath()); File file = FileUtil.upload(uploadFile, folder.getAbsolutePath());
......
...@@ -76,7 +76,7 @@ public class ComponentController { ...@@ -76,7 +76,7 @@ public class ComponentController {
public ResponseEntity<Object> update(@Validated @RequestBody ComponentDto resources) { public ResponseEntity<Object> update(@Validated @RequestBody ComponentDto resources) {
Component component=componentMapper.toEntity(resources); Component component=componentMapper.toEntity(resources);
if (component.getId() == null) { if (component.getId() == null) {
throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} ); throw new ValidateException("smfcore.valueCanotNull","{0}不能为空",new String[]{"ID"} );
} }
componentManager.saveComponent(component); componentManager.saveComponent(component);
// //修改元器件时更新storagePos中的数据 // //修改元器件时更新storagePos中的数据
...@@ -97,7 +97,7 @@ public class ComponentController { ...@@ -97,7 +97,7 @@ public class ComponentController {
List<Component> Components = new ArrayList<Component>(); List<Component> Components = new ArrayList<Component>();
for (String id : ids) { for (String id : ids) {
if (id == null) { if (id == null) {
throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} ); throw new ValidateException("smfcore.valueCanotNull","{0}不能为空",new String[]{"ID"} );
} }
} }
componentManager.deleteComponents(ids); componentManager.deleteComponents(ids);
......
...@@ -109,7 +109,7 @@ public class BarcodeManagerImpl implements IBarcodeManager { ...@@ -109,7 +109,7 @@ public class BarcodeManagerImpl implements IBarcodeManager {
//readID不能重复 //readID不能重复
Barcode data= barcodeDao.findOne(query); Barcode data= barcodeDao.findOne(query);
if(data!=null){ if(data!=null){
throw new ValidateException("smfcode.codeExist", "条码["+resources.getBarcode()+"]已存在"); throw new ValidateException("smfcore.codeExist", "条码["+resources.getBarcode()+"]已存在");
} }
if(resources.getProvider()==null){ if(resources.getProvider()==null){
...@@ -177,19 +177,19 @@ public class BarcodeManagerImpl implements IBarcodeManager { ...@@ -177,19 +177,19 @@ public class BarcodeManagerImpl implements IBarcodeManager {
protected void validateSave(Barcode barcode) throws ValidateException { protected void validateSave(Barcode barcode) throws ValidateException {
if (barcode.getBarcode()==null) { if (barcode.getBarcode()==null) {
throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"barcode"} ); throw new ValidateException("smfcore.valueCanotNull","{0}不能为空",new String[]{"barcode"} );
// throw new ValidateException("barcode.error.empty"); // throw new ValidateException("barcode.error.empty");
} }
if (barcode.getPartNumber()==null) { if (barcode.getPartNumber()==null) {
throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"partNumber"} ); throw new ValidateException("smfcore.valueCanotNull","{0}不能为空",new String[]{"partNumber"} );
// throw new ValidateException("["+barcode.getBarcode()+"]barcode.error.partNumber.empty"); // throw new ValidateException("["+barcode.getBarcode()+"]barcode.error.partNumber.empty");
} }
if (barcode.getBatch() == null) { if (barcode.getBatch() == null) {
throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"batch"} ); throw new ValidateException("smfcore.valueCanotNull","{0}不能为空",new String[]{"batch"} );
// throw new ValidateException("批次不能为空"); // throw new ValidateException("批次不能为空");
} }
if (barcode.getAmount() < 0) { if (barcode.getAmount() < 0) {
throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"amout"} ); throw new ValidateException("smfcore.valueCanotNull","{0}不能为空",new String[]{"amout"} );
// throw new ValidateException("["+barcode.getBarcode()+"]barcode.error.amount.negative" ); // throw new ValidateException("["+barcode.getBarcode()+"]barcode.error.amount.negative" );
} }
if (!validateUnique(barcode)) { if (!validateUnique(barcode)) {
......
...@@ -126,7 +126,7 @@ public class ComponentManagerImpl implements IComponentManager { ...@@ -126,7 +126,7 @@ public class ComponentManagerImpl implements IComponentManager {
public Component saveComponent(Component resources) { public Component saveComponent(Component resources) {
if(resources.getPartNumber()==null){ if(resources.getPartNumber()==null){
throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"partNumber"} ); throw new ValidateException("smfcore.valueCanotNull","{0}不能为空",new String[]{"partNumber"} );
// throw new BadRequestException("料号不能为空"); // throw new BadRequestException("料号不能为空");
} }
if(resources.getProvider()==null){ if(resources.getProvider()==null){
...@@ -153,7 +153,7 @@ public class ComponentManagerImpl implements IComponentManager { ...@@ -153,7 +153,7 @@ public class ComponentManagerImpl implements IComponentManager {
} }
Component com = componentDao.findOne(new Query(c)); Component com = componentDao.findOne(new Query(c));
if (com != null) { if (com != null) {
throw new ValidateException("smfcode.valueAlreadyExist","{0}[{1}]已存在",new String[]{"partNumber",resources.getPartNumber()}); throw new ValidateException("smfcore.valueAlreadyExist","{0}[{1}]已存在",new String[]{"partNumber",resources.getPartNumber()});
// throw new BadRequestException("料号["+resources.getPartNumber()+"]已存在"); // throw new BadRequestException("料号["+resources.getPartNumber()+"]已存在");
} }
......
...@@ -55,7 +55,7 @@ public class CodeResolve { ...@@ -55,7 +55,7 @@ public class CodeResolve {
if(barcodeRuleList == null || barcodeRuleList.isEmpty()){ if(barcodeRuleList == null || barcodeRuleList.isEmpty()){
CodeBean codeBean = new CodeBean(); CodeBean codeBean = new CodeBean();
codeBean.setBarcode(null); codeBean.setBarcode(null);
codeBean.setError("smfcode.error.barcode.noRules", "解析规则未定义"); codeBean.setError("smfcore.error.barcode.noRules", "解析规则未定义");
codeBean.setCodeStr(barcodeItemStr); codeBean.setCodeStr(barcodeItemStr);
return codeBean; return codeBean;
} }
...@@ -195,7 +195,7 @@ public class CodeResolve { ...@@ -195,7 +195,7 @@ public class CodeResolve {
if(component == null){ if(component == null){
log.info("档案["+barcodeFromRule.getPartNumber()+"]不存在"); log.info("档案["+barcodeFromRule.getPartNumber()+"]不存在");
// throw new ValidateException("component.error.notExist",new String[]{barcodeFromRule.getPartNumber()}); // throw new ValidateException("component.error.notExist",new String[]{barcodeFromRule.getPartNumber()});
throw new ValidateException("smfcode.valueNotExist","{0}[{1}]不存在",new String[]{"component",barcodeFromRule.getPartNumber()}); throw new ValidateException("smfcore.valueNotExist","{0}[{1}]不存在",new String[]{"component",barcodeFromRule.getPartNumber()});
} }
codeBeanFromRule.setShowImg(component.getShowImg()); codeBeanFromRule.setShowImg(component.getShowImg());
...@@ -219,21 +219,21 @@ public class CodeResolve { ...@@ -219,21 +219,21 @@ public class CodeResolve {
} }
}catch (ValidateException ve){ }catch (ValidateException ve){
//档案不存在 //档案不存在
codeBeanFromRule.setError("smfcode.error.barcode.pnNotExist",new String[]{barcodeFromRule.getPartNumber()},"档案 {0} 不存在"); codeBeanFromRule.setError("smfcore.error.barcode.pnNotExist",new String[]{barcodeFromRule.getPartNumber()},"档案 {0} 不存在");
log.warn("档案"+barcodeFromRule.getPartNumber()+"不存在"); log.warn("档案"+barcodeFromRule.getPartNumber()+"不存在");
} }
//解析成功了,直接返回 //解析成功了,直接返回
return codeBeanFromRule; return codeBeanFromRule;
}else{ }else{
//在数据库中不存在,且未解析成功,用其他规则再解析 //在数据库中不存在,且未解析成功,用其他规则再解析
codeBeanFromRule.setError("smfcode.error.barcode.invalid",new String[]{barcodeItemStr}, "{0}不是有效的条码"); codeBeanFromRule.setError("smfcore.error.barcode.invalid",new String[]{barcodeItemStr}, "{0}不是有效的条码");
} }
} }
if(codeBeanFromRule == null){ if(codeBeanFromRule == null){
codeBeanFromRule = new CodeBean(); codeBeanFromRule = new CodeBean();
codeBeanFromRule.setBarcode(null); codeBeanFromRule.setBarcode(null);
codeBeanFromRule.setError("smfcode.error.barcode.invalid",new String[]{barcodeItemStr}, "{0}不是有效的条码"); codeBeanFromRule.setError("smfcore.error.barcode.invalid",new String[]{barcodeItemStr}, "{0}不是有效的条码");
codeBeanFromRule.setCodeStr(barcodeItemStr); codeBeanFromRule.setCodeStr(barcodeItemStr);
return codeBeanFromRule; return codeBeanFromRule;
} }
...@@ -333,7 +333,7 @@ public class CodeResolve { ...@@ -333,7 +333,7 @@ public class CodeResolve {
if(barcode == null){ if(barcode == null){
barcode = barcodeFromRule; barcode = barcodeFromRule;
}else{ }else{
throw new ValidateException("smfcode.error.barcode.many","找到多个有效的条码",new String[]{codeStr}); throw new ValidateException("smfcore.error.barcode.many","找到多个有效的条码",new String[]{codeStr});
} }
}else{ }else{
errorMsg = codeBean.getError(); errorMsg = codeBean.getError();
...@@ -341,7 +341,7 @@ public class CodeResolve { ...@@ -341,7 +341,7 @@ public class CodeResolve {
} }
if(barcode == null){ if(barcode == null){
throw new ValidateException("smfcode.error.barcode.noValidCode", "无效的条码",new String[]{codeBeans.size()+":",codeStr}); throw new ValidateException("smfcore.error.barcode.noValidCode", "无效的条码",new String[]{codeBeans.size()+":",codeStr});
} }
return barcode; return barcode;
} }
......
...@@ -160,7 +160,7 @@ public class BaseDeviceHandler implements IDeviceHandler { ...@@ -160,7 +160,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
//同条码,但不是同料仓 //同条码,但不是同料仓
log.error("条码[" + barcodeSave.getBarcode() + "]任务正在执行,但任务料仓为:" + task.getStorageId() + " 请求料仓为:" + task.getStorageId()); log.error("条码[" + barcodeSave.getBarcode() + "]任务正在执行,但任务料仓为:" + task.getStorageId() + " 请求料仓为:" + task.getStorageId());
//throw new ValidateException("条码["+barcodeSave.getBarcode()+"]任务正在执行"); //throw new ValidateException("条码["+barcodeSave.getBarcode()+"]任务正在执行");
throw new ValidateException("smfcode.error.barcode.executing","条码[{0}}]任务正在执行", new String[]{barcodeSave.getBarcode()}); throw new ValidateException("smfcore.error.barcode.executing","条码[{0}}]任务正在执行", new String[]{barcodeSave.getBarcode()});
} }
} }
...@@ -176,19 +176,19 @@ public class BaseDeviceHandler implements IDeviceHandler { ...@@ -176,19 +176,19 @@ public class BaseDeviceHandler implements IDeviceHandler {
storagePos = storagePosManager.getByPosName(posName); storagePos = storagePosManager.getByPosName(posName);
if (storagePos == null) { if (storagePos == null) {
throw new ValidateException("smfcode.error.pos.notExist", "库位[{0}]不存在,无法入库", new String[]{posName}); throw new ValidateException("smfcore.error.pos.notExist", "库位[{0}]不存在,无法入库", new String[]{posName});
} }
if (!storage.getId().equals(storagePos.getStorageId())) { if (!storage.getId().equals(storagePos.getStorageId())) {
throw new ValidateException("smfcode.error.pos.wrong", "库位[{0}]与料仓[{1}}]不匹配,无法入库", new String[]{posName, storage.getCid()}); throw new ValidateException("smfcore.error.pos.wrong", "库位[{0}]与料仓[{1}}]不匹配,无法入库", new String[]{posName, storage.getCid()});
} }
if (storagePos.getBarcode() != null) { if (storagePos.getBarcode() != null) {
throw new ValidateException("smfcode.error.pos.hasReel", "库位[{0}]中已有物料,无法入库", new String[]{posName}); throw new ValidateException("smfcore.error.pos.hasReel", "库位[{0}]中已有物料,无法入库", new String[]{posName});
} }
if (!storage.canPutInPos(barcodeSave.getPlateSize(), barcodeSave.getHeight(), storagePos.getW(), storagePos.getH())) { if (!storage.canPutInPos(barcodeSave.getPlateSize(), barcodeSave.getHeight(), storagePos.getW(), storagePos.getH())) {
String reelSize = barcodeSave.getPlateSize() + "x" + barcodeSave.getHeight(); String reelSize = barcodeSave.getPlateSize() + "x" + barcodeSave.getHeight();
String posSize = storagePos.getW() + "x" + storagePos.getH(); String posSize = storagePos.getW() + "x" + storagePos.getH();
throw new ValidateException("smfcode.error.pos.sizeNotMatch", "料盘尺寸[{0}}]与库位{1}尺寸[{2}]不符,无法入库", new String[]{reelSize,posName,posSize}); throw new ValidateException("smfcore.error.pos.sizeNotMatch", "料盘尺寸[{0}}]与库位{1}尺寸[{2}]不符,无法入库", new String[]{reelSize,posName,posSize});
} }
} else { } else {
...@@ -265,7 +265,7 @@ public class BaseDeviceHandler implements IDeviceHandler { ...@@ -265,7 +265,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
//先查找空闲 BOX同尺寸的,如果找不到,再查找可入库 BOX 同尺寸或比盘尺寸大的仓位 //先查找空闲 BOX同尺寸的,如果找不到,再查找可入库 BOX 同尺寸或比盘尺寸大的仓位
StatusBean statusBean = DevicesStatusUtil.getStatusBean(storageCid); StatusBean statusBean = DevicesStatusUtil.getStatusBean(storageCid);
if (statusBean == null) {//当前料仓不可用 if (statusBean == null) {//当前料仓不可用
throw new ValidateException("smfcode.error.storage.offline", "料仓[{0}]离线", new String[]{storageCid}); throw new ValidateException("smfcore.error.storage.offline", "料仓[{0}]离线", new String[]{storageCid});
} }
//还需要排除掉正在队列里的仓位 //还需要排除掉正在队列里的仓位
StoragePos storagePos = null; StoragePos storagePos = null;
...@@ -312,7 +312,7 @@ public class BaseDeviceHandler implements IDeviceHandler { ...@@ -312,7 +312,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
public Barcode verifyBarcodePutIn(List<Storage> storageList, Barcode barcodeSave) throws ValidateException { public Barcode verifyBarcodePutIn(List<Storage> storageList, Barcode barcodeSave) throws ValidateException {
if (barcodeSave == null) { if (barcodeSave == null) {
throw new ValidateException("smfcode.error.barcode.invalid", "条码无效", new String[]{""}); throw new ValidateException("smfcore.error.barcode.invalid", "条码无效", new String[]{""});
} }
Date expireDate = barcodeSave.getExpireDate(); Date expireDate = barcodeSave.getExpireDate();
...@@ -332,11 +332,11 @@ public class BaseDeviceHandler implements IDeviceHandler { ...@@ -332,11 +332,11 @@ public class BaseDeviceHandler implements IDeviceHandler {
} }
if(!canPutIn){ if(!canPutIn){
throw new ValidateException("smfcode.error.barcode.wrongSize","尺寸[{0}]不符", new String[]{w + "x" + h}); throw new ValidateException("smfcore.error.barcode.wrongSize","尺寸[{0}]不符", new String[]{w + "x" + h});
} }
if (barcodeSave.getAmount() <= 0) { if (barcodeSave.getAmount() <= 0) {
throw new ValidateException("smfcode.error.barcode.wrongQty", "条码[{0}]对应的数量<=0为: {1}" , new String[]{barcodeSave.getBarcode(), barcodeSave.getAmount() + ""}); throw new ValidateException("smfcore.error.barcode.wrongQty", "条码[{0}]对应的数量<=0为: {1}" , new String[]{barcodeSave.getBarcode(), barcodeSave.getAmount() + ""});
} }
// if(barcodeSave.getPlateSize() <=0 || barcodeSave.getHeight() <= 0){ // if(barcodeSave.getPlateSize() <=0 || barcodeSave.getHeight() <= 0){
...@@ -359,7 +359,7 @@ public class BaseDeviceHandler implements IDeviceHandler { ...@@ -359,7 +359,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
return barcodeSave; return barcodeSave;
} }
} }
throw new ValidateException("smfcode.error.barcode.taskNotEnd", "料盘[{0}]的操作未完成,无法执行入库操作", new String[]{barcodeSave.getBarcode()}); throw new ValidateException("smfcore.error.barcode.taskNotEnd", "料盘[{0}]的操作未完成,无法执行入库操作", new String[]{barcodeSave.getBarcode()});
} }
} }
} }
......
...@@ -141,11 +141,11 @@ public class NLShelfHandler extends BaseDeviceHandler { ...@@ -141,11 +141,11 @@ public class NLShelfHandler extends BaseDeviceHandler {
private void canBarcodePutInPos(StoragePos pos, Barcode barcode) throws ValidateException { private void canBarcodePutInPos(StoragePos pos, Barcode barcode) throws ValidateException {
if(pos.getBarcode() != null){ if(pos.getBarcode() != null){
throw new ValidateException("smfcode.shelf.nextPos.hasReel", "库位[{0}]已有物料,请重新扫描库位码",new String[]{pos.getPosName()}); throw new ValidateException("smfcore.shelf.nextPos.hasReel", "库位[{0}]已有物料,请重新扫描库位码",new String[]{pos.getPosName()});
} }
Collection<String> excludePosIds = taskService.excludePosIds(); Collection<String> excludePosIds = taskService.excludePosIds();
if(excludePosIds.contains(pos.getId())){ if(excludePosIds.contains(pos.getId())){
throw new ValidateException("smfcode.shelf.nextPos.hasTask", "库位[{0}]已有任务,请重新扫描库位码",new String[]{pos.getPosName()}); throw new ValidateException("smfcore.shelf.nextPos.hasTask", "库位[{0}]已有任务,请重新扫描库位码",new String[]{pos.getPosName()});
} }
// if(barcode != null){ // if(barcode != null){
// Storage storage = dataCache.getStorageById(pos.getStorageId()); // Storage storage = dataCache.getStorageById(pos.getStorageId());
...@@ -155,7 +155,7 @@ public class NLShelfHandler extends BaseDeviceHandler { ...@@ -155,7 +155,7 @@ public class NLShelfHandler extends BaseDeviceHandler {
// if(!storage.canPutInPos(barcode.getPlateSize(),barcode.getHeight(), pos.getW(), pos.getH())){ // if(!storage.canPutInPos(barcode.getPlateSize(),barcode.getHeight(), pos.getW(), pos.getH())){
// String reelSize = barcode.getPlateSize() + "x" + barcode.getHeight(); // String reelSize = barcode.getPlateSize() + "x" + barcode.getHeight();
// String posSize = pos.getW() + "x" + pos.getH(); // String posSize = pos.getW() + "x" + pos.getH();
// throw new ValidateException("smfcode.shelf.nextPos.wrongSize","库位["+pos.getPosName()+"]尺寸["+posSize+"]与料盘尺寸["+reelSize+"]不符,请重新扫描库位码",new String[]{pos.getPosName(),posSize, reelSize}); // throw new ValidateException("smfcore.shelf.nextPos.wrongSize","库位["+pos.getPosName()+"]尺寸["+posSize+"]与料盘尺寸["+reelSize+"]不符,请重新扫描库位码",new String[]{pos.getPosName(),posSize, reelSize});
// } // }
// } // }
} }
...@@ -174,16 +174,16 @@ public class NLShelfHandler extends BaseDeviceHandler { ...@@ -174,16 +174,16 @@ public class NLShelfHandler extends BaseDeviceHandler {
String ptoken=token.substring(token.length()-10); String ptoken=token.substring(token.length()-10);
String loginUser = SecurityUtils.getLoginUsername(); String loginUser = SecurityUtils.getLoginUsername();
if (ObjectUtils.isEmpty(code)) { if (ObjectUtils.isEmpty(code)) {
throw new ValidateException("smfcode.valueCanotNull", "{0}不能为空", new String[]{"code"}); throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"code"});
} }
if (groupId == null && storageId == null) { if (groupId == null && storageId == null) {
throw new ValidateException("smfcode.valueCanotNull", "{0}不能为空", new String[]{"group"}); throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"group"});
} }
Storage currentStorage = null; Storage currentStorage = null;
if (groupId == null && storageId != null) { if (groupId == null && storageId != null) {
currentStorage = dataCache.getStorageById(storageId); currentStorage = dataCache.getStorageById(storageId);
if (currentStorage == null || !currentStorage.isNLShelf()) { if (currentStorage == null || !currentStorage.isNLShelf()) {
return ResultBean.newErrorResult(1, "smfcode.shelf.notFound", "未找到料架"); return ResultBean.newErrorResult(1, "smfcore.shelf.notFound", "未找到料架");
} }
if (currentStorage != null) { if (currentStorage != null) {
groupId = currentStorage.getGroupId(); groupId = currentStorage.getGroupId();
...@@ -201,21 +201,21 @@ public class NLShelfHandler extends BaseDeviceHandler { ...@@ -201,21 +201,21 @@ public class NLShelfHandler extends BaseDeviceHandler {
//判断库位是否是对应设备或者租 //判断库位是否是对应设备或者租
if (currentStorage != null) { if (currentStorage != null) {
if ( ! pos.getStorageId().equals(storageId)) { if ( ! pos.getStorageId().equals(storageId)) {
return ResultBean.newErrorResult(1, "smfcode.shelf.pos.notInStorage", "料架[{0}]中未找到库位[{1}]", new String[]{currentStorage.getName(), pos.getPosName()}); return ResultBean.newErrorResult(1, "smfcore.shelf.pos.notInStorage", "料架[{0}]中未找到库位[{1}]", new String[]{currentStorage.getName(), pos.getPosName()});
} }
} else { } else {
currentStorage = dataCache.getStorageById(pos.getStorageId()); currentStorage = dataCache.getStorageById(pos.getStorageId());
if (currentStorage == null || !currentStorage.isNLShelf()) { if (currentStorage == null || !currentStorage.isNLShelf()) {
return ResultBean.newErrorResult(1, "smfcode.shelf.notFound", "未找到料架"); return ResultBean.newErrorResult(1, "smfcore.shelf.notFound", "未找到料架");
} }
if (currentStorage.getGroupId() != groupId) { if (currentStorage.getGroupId() != groupId) {
return ResultBean.newErrorResult(1, "smfcode.shelf.pos.notInGroup", "组中未找到库位[{0}]", new String[]{pos.getPosName()}); return ResultBean.newErrorResult(1, "smfcore.shelf.pos.notInGroup", "组中未找到库位[{0}]", new String[]{pos.getPosName()});
} }
} }
//扫描的为库位条码,先关掉上一个库位灯, 当前库位中没有物料的话点亮库位灯 //扫描的为库位条码,先关掉上一个库位灯, 当前库位中没有物料的话点亮库位灯
closeLastPos(token); closeLastPos(token);
if (pos.getBarcode() != null) { if (pos.getBarcode() != null) {
return ResultBean.newErrorResult(1, "smfcode.shelf.msg.hasReel", "库位中[{0}]已有物料", new String[]{pos.getPosName()}); return ResultBean.newErrorResult(1, "smfcore.shelf.msg.hasReel", "库位中[{0}]已有物料", new String[]{pos.getPosName()});
} else { } else {
//设置上一个入库操作库位 //设置上一个入库操作库位
openAndCloseLights(token, pos, putInColor, delayCloseTime); openAndCloseLights(token, pos, putInColor, delayCloseTime);
...@@ -225,7 +225,7 @@ public class NLShelfHandler extends BaseDeviceHandler { ...@@ -225,7 +225,7 @@ public class NLShelfHandler extends BaseDeviceHandler {
operateBean.setNextPosId(null); operateBean.setNextPosId(null);
shelfPutInBeanMap.put(token, operateBean); shelfPutInBeanMap.put(token, operateBean);
log.info(ptoken + ":库位[" + pos.getPosName() + "]操作成功,请扫描要放入的物料"); log.info(ptoken + ":库位[" + pos.getPosName() + "]操作成功,请扫描要放入的物料");
return ResultBean.newOkResult("smfcode.shelf.msg.tipScanReel", "库位[" + pos.getPosName() + "]操作成功,请扫描要放入的物料", new String[]{pos.getPosName()},""); return ResultBean.newOkResult("smfcore.shelf.msg.tipScanReel", "库位[" + pos.getPosName() + "]操作成功,请扫描要放入的物料", new String[]{pos.getPosName()},"");
} }
} else { } else {
//扫的是物料条码 //扫的是物料条码
...@@ -246,7 +246,7 @@ public class NLShelfHandler extends BaseDeviceHandler { ...@@ -246,7 +246,7 @@ public class NLShelfHandler extends BaseDeviceHandler {
//5秒内同一个条码忽略 //5秒内同一个条码忽略
Date usedDate = barcode.getUsedDate(); Date usedDate = barcode.getUsedDate();
if (usedDate != null && now - usedDate.getTime() < 5000) { if (usedDate != null && now - usedDate.getTime() < 5000) {
return ResultBean.newErrorResult(1, "smfcode.shelf.msg.fastop", "条码操作频繁,请稍后再试"); return ResultBean.newErrorResult(1, "smfcore.shelf.msg.fastop", "条码操作频繁,请稍后再试");
} }
StoragePos inPos = storagePosManager.getByBarcodeId(barcode.getId()); StoragePos inPos = storagePosManager.getByBarcodeId(barcode.getId());
...@@ -256,15 +256,15 @@ public class NLShelfHandler extends BaseDeviceHandler { ...@@ -256,15 +256,15 @@ public class NLShelfHandler extends BaseDeviceHandler {
for (DataLog task : allTasks) { for (DataLog task : allTasks) {
if (task.isCheckOutTask() && task.getBarcode() != null && task.getBarcode().equals(barcode.getBarcode())) { if (task.isCheckOutTask() && task.getBarcode() != null && task.getBarcode().equals(barcode.getBarcode())) {
// if(!sourceName.equalsIgnoreCase("All") && !sourceName.equals(task.getSourceName())){ // if(!sourceName.equalsIgnoreCase("All") && !sourceName.equals(task.getSourceName())){
// return ResultBean.newErrorResult(1,"smfcode.shelf.error.orderError","任务与指定工单[{0}]不一致",new String[]{sourceName} ); // return ResultBean.newErrorResult(1,"smfcore.shelf.error.orderError","任务与指定工单[{0}]不一致",new String[]{sourceName} );
// } // }
taskService.addTaskToFinished(inPos, null, loginUser); taskService.addTaskToFinished(inPos, null, loginUser);
opPosLight("close", inPos, null); opPosLight("close", inPos, null);
log.info(barcode.getBarcode() + " 出库完成, 库位[" + inPos.getPosName() + "]灭灯"); log.info(barcode.getBarcode() + " 出库完成, 库位[" + inPos.getPosName() + "]灭灯");
return ResultBean.newErrorResult(1, "smfcode.shelf.msg.outConfirm", "出库完成, 库位[{0}]灭灯", new String[]{inPos.getPosName()} ); return ResultBean.newErrorResult(1, "smfcore.shelf.msg.outConfirm", "出库完成, 库位[{0}]灭灯", new String[]{inPos.getPosName()} );
} }
} }
return ResultBean.newErrorResult(1, "smfcode.shelf.msg.noTask", "操作失败,已在库位[{0}]中,未找到对应的出库任务", new String[]{inPos.getPosName()}); return ResultBean.newErrorResult(1, "smfcore.shelf.msg.noTask", "操作失败,已在库位[{0}]中,未找到对应的出库任务", new String[]{inPos.getPosName()});
} }
//入库 //入库
...@@ -275,7 +275,7 @@ public class NLShelfHandler extends BaseDeviceHandler { ...@@ -275,7 +275,7 @@ public class NLShelfHandler extends BaseDeviceHandler {
String operatePosId = operateBean.getNextPosId(); String operatePosId = operateBean.getNextPosId();
if (Strings.isNullOrEmpty(operatePosId)) { if (Strings.isNullOrEmpty(operatePosId)) {
log.info(ptoken + ":条码[" +code+ "],请先扫描库位码"); log.info(ptoken + ":条码[" +code+ "],请先扫描库位码");
return ResultBean.newErrorResult(1, "smfcode.shelf.msg.scanPos", "请先扫描库位码"); return ResultBean.newErrorResult(1, "smfcore.shelf.msg.scanPos", "请先扫描库位码");
} else { } else {
//有下一个库位 //有下一个库位
StoragePos currentPos = storagePosManager.get(String.valueOf(operatePosId)); StoragePos currentPos = storagePosManager.get(String.valueOf(operatePosId));
...@@ -301,7 +301,7 @@ public class NLShelfHandler extends BaseDeviceHandler { ...@@ -301,7 +301,7 @@ public class NLShelfHandler extends BaseDeviceHandler {
shelfPutInBeanMap.put(token, operateBean); shelfPutInBeanMap.put(token, operateBean);
log.info(ptoken + ":条码[" + code + "]入库操作成功,请放入库位 [" + currentPos.getPosName() + "],下一个库位号:" + nextPosId); log.info(ptoken + ":条码[" + code + "]入库操作成功,请放入库位 [" + currentPos.getPosName() + "],下一个库位号:" + nextPosId);
return ResultBean.newOkResult("smfcode.shelf.msg.inOk", "操作成功,请放入库位[" + currentPos.getPosName() + "]", new String[]{currentPos.getPosName()}, ""); return ResultBean.newOkResult("smfcore.shelf.msg.inOk", "操作成功,请放入库位[" + currentPos.getPosName() + "]", new String[]{currentPos.getPosName()}, "");
} }
} }
...@@ -327,7 +327,7 @@ public class NLShelfHandler extends BaseDeviceHandler { ...@@ -327,7 +327,7 @@ public class NLShelfHandler extends BaseDeviceHandler {
} }
shelfPutInBeanMap.put(token, operateBean); shelfPutInBeanMap.put(token, operateBean);
log.info(ptoken + ":条码["+code+"]入库操作成功,请放入库位 ["+opPos.getPosName()+"],下一个库位号:" + nextPosId); log.info(ptoken + ":条码["+code+"]入库操作成功,请放入库位 ["+opPos.getPosName()+"],下一个库位号:" + nextPosId);
return ResultBean.newOkResult("smfcode.shelf.msg.inOk", "操作成功,请放入库位["+opPos.getPosName()+"]", new String[]{opPos.getPosName()},""); return ResultBean.newOkResult("smfcore.shelf.msg.inOk", "操作成功,请放入库位["+opPos.getPosName()+"]", new String[]{opPos.getPosName()},"");
} }
} catch (ValidateException e) { } catch (ValidateException e) {
......
...@@ -71,10 +71,10 @@ public class SensorShelfHandler extends BaseDeviceHandler { ...@@ -71,10 +71,10 @@ public class SensorShelfHandler extends BaseDeviceHandler {
String groupId = mapValues.get("group"); String groupId = mapValues.get("group");
String storageId=mapValues.get("storageId"); String storageId=mapValues.get("storageId");
if(ObjectUtils.isEmpty(code)){ if(ObjectUtils.isEmpty(code)){
throw new ValidateException("smfcode.valueCanotNull", "{0}不能为空", new String[]{"code"}); throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"code"});
} }
if(groupId==null&&storageId==null){ if(groupId==null&&storageId==null){
throw new ValidateException("smfcode.valueCanotNull", "{0}不能为空", new String[]{"group"}); throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"group"});
} }
if(groupId==null&&storageId!=null){ if(groupId==null&&storageId!=null){
Storage storage=dataCache.getStorageById(storageId); Storage storage=dataCache.getStorageById(storageId);
...@@ -127,7 +127,7 @@ public class SensorShelfHandler extends BaseDeviceHandler { ...@@ -127,7 +127,7 @@ public class SensorShelfHandler extends BaseDeviceHandler {
// CodeBean codeBean = codeResolve.resolveSingleCode(codeStr); // CodeBean codeBean = codeResolve.resolveSingleCode(codeStr);
if (barcode == null || barcode.getBarcode() == null) { if (barcode == null || barcode.getBarcode() == null) {
return ResultBean.newErrorResult(1, "smfcode.error.barcode.invalid", "条码无效"); return ResultBean.newErrorResult(1, "smfcore.error.barcode.invalid", "条码无效");
} }
String pn = barcode.getPartNumber(); String pn = barcode.getPartNumber();
......
...@@ -133,7 +133,7 @@ public class SpBoxHandler extends BaseDeviceHandler { ...@@ -133,7 +133,7 @@ public class SpBoxHandler extends BaseDeviceHandler {
//同条码,但不是同料仓 //同条码,但不是同料仓
log.error("条码[" + barcodeSave.getBarcode() + "]任务正在执行,但任务料仓为:" + task.getStorageId() + " 请求料仓为:" + task.getStorageId()); log.error("条码[" + barcodeSave.getBarcode() + "]任务正在执行,但任务料仓为:" + task.getStorageId() + " 请求料仓为:" + task.getStorageId());
//throw new ValidateException("条码["+barcodeSave.getBarcode()+"]任务正在执行"); //throw new ValidateException("条码["+barcodeSave.getBarcode()+"]任务正在执行");
throw new ValidateException("smfcode.error.barcode.executing","条码[{0}}]任务正在执行" ,new String[]{barcodeSave.getBarcode()}); throw new ValidateException("smfcore.error.barcode.executing","条码[{0}}]任务正在执行" ,new String[]{barcodeSave.getBarcode()});
} }
} }
...@@ -150,19 +150,19 @@ public class SpBoxHandler extends BaseDeviceHandler { ...@@ -150,19 +150,19 @@ public class SpBoxHandler extends BaseDeviceHandler {
storagePos = storagePosManager.getByPosName(posName); storagePos = storagePosManager.getByPosName(posName);
if (storagePos == null) { if (storagePos == null) {
throw new ValidateException("smfcode.error.pos.notExist", "库位【{0}】不存在,无法入库", new String[]{posName}); throw new ValidateException("smfcore.error.pos.notExist", "库位【{0}】不存在,无法入库", new String[]{posName});
} }
if (!storage.getId().equals(storagePos.getStorageId())) { if (!storage.getId().equals(storagePos.getStorageId())) {
throw new ValidateException("smfcode.error.pos.wrong", "库位【{0}】与料仓[{1}]不匹配,无法入库", new String[]{posName, storage.getCid()}); throw new ValidateException("smfcore.error.pos.wrong", "库位【{0}】与料仓[{1}]不匹配,无法入库", new String[]{posName, storage.getCid()});
} }
if (storagePos.getBarcode() != null) { if (storagePos.getBarcode() != null) {
throw new ValidateException("smfcode.error.pos.hasReel", "库位【{0}】中已有物料,无法入库", new String[]{posName}); throw new ValidateException("smfcore.error.pos.hasReel", "库位【{0}】中已有物料,无法入库", new String[]{posName});
} }
if (!storage.canPutInPos(barcodeSave.getPlateSize(), barcodeSave.getHeight(), storagePos.getW(), storagePos.getH())) { if (!storage.canPutInPos(barcodeSave.getPlateSize(), barcodeSave.getHeight(), storagePos.getW(), storagePos.getH())) {
String reelSize = barcodeSave.getPlateSize() + "x" + barcodeSave.getHeight(); String reelSize = barcodeSave.getPlateSize() + "x" + barcodeSave.getHeight();
String posSize = storagePos.getW() + "x" + storagePos.getH(); String posSize = storagePos.getW() + "x" + storagePos.getH();
throw new ValidateException("smfcode.error.pos.sizeNotMatch", "料盘尺寸[{0}]与库位{1}尺寸[{2}]不符,无法入库", new String[]{reelSize,posName,posSize}); throw new ValidateException("smfcore.error.pos.sizeNotMatch", "料盘尺寸[{0}]与库位{1}尺寸[{2}]不符,无法入库", new String[]{reelSize,posName,posSize});
} }
} else { } else {
......
...@@ -80,10 +80,10 @@ public class LanguageMsgController { ...@@ -80,10 +80,10 @@ public class LanguageMsgController {
String csvType="csv"; String csvType="csv";
String fileType = FileUtil.getExtensionName(uploadFile.getOriginalFilename()); String fileType = FileUtil.getExtensionName(uploadFile.getOriginalFilename());
if (fileType == null) { if (fileType == null) {
throw new ValidateException("smfcode.feleFormatError", "文件格式错误!, 仅支持{0}格式", new String[]{csvType+"/"+smfclientType + "/" + smfcoreType}); throw new ValidateException("smfcore.feleFormatError", "文件格式错误!, 仅支持{0}格式", new String[]{csvType+"/"+smfclientType + "/" + smfcoreType});
} }
if ((!smfclientType.contains(fileType)) && !smfcoreType.contains(fileType) && !csvType.contains(fileType)) { if ((!smfclientType.contains(fileType)) && !smfcoreType.contains(fileType) && !csvType.contains(fileType)) {
throw new ValidateException("smfcode.feleFormatError", "文件格式错误!, 仅支持{0}格式", new String[]{csvType+"/"+smfclientType + "/" + smfcoreType}); throw new ValidateException("smfcore.feleFormatError", "文件格式错误!, 仅支持{0}格式", new String[]{csvType+"/"+smfclientType + "/" + smfcoreType});
} }
File folder = new File(properties.getPath(), "resource"); File folder = new File(properties.getPath(), "resource");
File file = FileUtil.upload(uploadFile, folder.getAbsolutePath()); File file = FileUtil.upload(uploadFile, folder.getAbsolutePath());
...@@ -168,7 +168,7 @@ public class LanguageMsgController { ...@@ -168,7 +168,7 @@ public class LanguageMsgController {
public ResponseEntity<Object> update( @RequestBody LanguageMsgDto resources) { public ResponseEntity<Object> update( @RequestBody LanguageMsgDto resources) {
LanguageMsg msg=languageMsgMapper.toEntity(resources); LanguageMsg msg=languageMsgMapper.toEntity(resources);
if (msg.getId() == null) { if (msg.getId() == null) {
throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"}); throw new ValidateException("smfcore.valueCanotNull","{0}不能为空",new String[]{"ID"});
} }
languageMsgManager.saveMsg(msg); languageMsgManager.saveMsg(msg);
return new ResponseEntity<>(HttpStatus.OK); return new ResponseEntity<>(HttpStatus.OK);
...@@ -180,7 +180,7 @@ public class LanguageMsgController { ...@@ -180,7 +180,7 @@ public class LanguageMsgController {
for (String id : ids) { for (String id : ids) {
if (id == null) { if (id == null) {
throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} ); throw new ValidateException("smfcore.valueCanotNull","{0}不能为空",new String[]{"ID"} );
} }
} }
languageMsgManager.deleteMsgs(ids); languageMsgManager.deleteMsgs(ids);
......
...@@ -58,11 +58,11 @@ public class LanguageSetController { ...@@ -58,11 +58,11 @@ public class LanguageSetController {
//判断是否是admin //判断是否是admin
String userName = SecurityUtils.getCurrentUsername(); String userName = SecurityUtils.getCurrentUsername();
if (!userName.equals(Constants.SUPER_USERNAME)) { if (!userName.equals(Constants.SUPER_USERNAME)) {
throw new ValidateException("smfcode.noLanguageSetAccess", "没有编辑语言的权限"); throw new ValidateException("smfcore.noLanguageSetAccess", "没有编辑语言的权限");
} }
if (newLan == null || ObjectUtil.isEmpty(newLan.getLanCode()) || ObjectUtil.isEmpty(newLan.getLanName())) { if (newLan == null || ObjectUtil.isEmpty(newLan.getLanCode()) || ObjectUtil.isEmpty(newLan.getLanName())) {
throw new ValidateException("smfcode.languageCanotNull", "语言类型不能为空"); throw new ValidateException("smfcore.languageCanotNull", "语言类型不能为空");
} }
List<LanguageInfo> languageTypeList = getAllLanList(); List<LanguageInfo> languageTypeList = getAllLanList();
...@@ -70,7 +70,7 @@ public class LanguageSetController { ...@@ -70,7 +70,7 @@ public class LanguageSetController {
for (LanguageInfo lan : for (LanguageInfo lan :
languageTypeList) { languageTypeList) {
if (lan.getLanCode().equals(newLan.getLanCode())) { if (lan.getLanCode().equals(newLan.getLanCode())) {
throw new ValidateException("smfcode.languageAlreadyExist ", "语言[{0}]已存在", new String[]{newLan.getLanCode()}); throw new ValidateException("smfcore.languageAlreadyExist ", "语言[{0}]已存在", new String[]{newLan.getLanCode()});
} }
} }
...@@ -88,12 +88,12 @@ public class LanguageSetController { ...@@ -88,12 +88,12 @@ public class LanguageSetController {
//判断是否是admin //判断是否是admin
String userName = SecurityUtils.getCurrentUsername(); String userName = SecurityUtils.getCurrentUsername();
if (!userName.equals(Constants.SUPER_USERNAME)) { if (!userName.equals(Constants.SUPER_USERNAME)) {
throw new ValidateException("smfcode.noLanguageSetAccess", "没有编辑语言的权限"); throw new ValidateException("smfcore.noLanguageSetAccess", "没有编辑语言的权限");
} }
List<LanguageInfo> languageTypeList = getAllLanList(); List<LanguageInfo> languageTypeList = getAllLanList();
for (String type : lanCodes) { for (String type : lanCodes) {
if (type == null) { if (type == null) {
throw new ValidateException("smfcode.languageCanotNull", "语言类型不能为空"); throw new ValidateException("smfcore.languageCanotNull", "语言类型不能为空");
} }
} }
...@@ -107,7 +107,7 @@ public class LanguageSetController { ...@@ -107,7 +107,7 @@ public class LanguageSetController {
lancode.equals(MessageUtils.JA_JP) || lancode.equals(MessageUtils.JA_JP) ||
lancode.equals(MessageUtils.EN_US) lancode.equals(MessageUtils.EN_US)
) { ) {
throw new ValidateException("smfcode.canotRemove", "不能删除此语言"); throw new ValidateException("smfcore.canotRemove", "不能删除此语言");
} }
} }
List<LanguageInfo> newList = new ArrayList<>(); List<LanguageInfo> newList = new ArrayList<>();
...@@ -120,7 +120,7 @@ public class LanguageSetController { ...@@ -120,7 +120,7 @@ public class LanguageSetController {
} }
} }
if (newList == null || newList.size() <= 0) { if (newList == null || newList.size() <= 0) {
throw new ValidateException("smfcode.languageCanotRemoveAll", "不能删除所有语言"); throw new ValidateException("smfcore.languageCanotRemoveAll", "不能删除所有语言");
} }
dataCache.updateCache(Constants.CACHE_languageType, newList); dataCache.updateCache(Constants.CACHE_languageType, newList);
......
...@@ -90,13 +90,13 @@ public class LanguageMsgManagerImpl implements ILanguageMsgManager { ...@@ -90,13 +90,13 @@ public class LanguageMsgManagerImpl implements ILanguageMsgManager {
@Override @Override
public LanguageMsg saveMsg(LanguageMsg resources) { public LanguageMsg saveMsg(LanguageMsg resources) {
if (resources.getCode() == null) { if (resources.getCode() == null) {
throw new ValidateException("smfcode.valueCanotNull", "{0}不能为空", new String[]{"code"}); throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"code"});
} }
if (resources.getMsg() == null) { if (resources.getMsg() == null) {
throw new ValidateException("smfcode.valueCanotNull", "{0}不能为空", new String[]{"msg"}); throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"msg"});
} }
if (resources.getType() == null) { if (resources.getType() == null) {
throw new ValidateException("smfcode.valueCanotNull", "{0}不能为空", new String[]{"type"}); throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"type"});
} }
if (resources.getContentList() == null) { if (resources.getContentList() == null) {
resources.setContentList(new ArrayList<>()); resources.setContentList(new ArrayList<>());
...@@ -109,7 +109,7 @@ public class LanguageMsgManagerImpl implements ILanguageMsgManager { ...@@ -109,7 +109,7 @@ public class LanguageMsgManagerImpl implements ILanguageMsgManager {
} //code不能重复 } //code不能重复
LanguageMsg result = languageMsgDao.findOne(new Query(c)); LanguageMsg result = languageMsgDao.findOne(new Query(c));
if (result != null) { if (result != null) {
throw new ValidateException("smfcode.resourcesExist", "资源[" + resources.getCode() + "]已存在"); throw new ValidateException("smfcore.resourcesExist", "资源[" + resources.getCode() + "]已存在");
} }
Query query = new Query(c); Query query = new Query(c);
......
...@@ -112,7 +112,7 @@ public class MessageUtils { ...@@ -112,7 +112,7 @@ public class MessageUtils {
msg.getContentList()) { msg.getContentList()) {
String lanT = con.getLanCode(); String lanT = con.getLanCode();
if (lanT.equals(lanType)) { if (lanT.equals(lanType)&& ObjectUtil.isNotEmpty(con.getMsg())) {
return con.getMsg(); return con.getMsg();
} }
} }
...@@ -151,6 +151,12 @@ public class MessageUtils { ...@@ -151,6 +151,12 @@ public class MessageUtils {
List<LanguageMsg> msgs = languageMsgManager.findByQuery(new Query()); List<LanguageMsg> msgs = languageMsgManager.findByQuery(new Query());
for (LanguageMsg msg : for (LanguageMsg msg :
msgs) { msgs) {
if(msg.getCode().startsWith("smfcode.")||msg.getType().equals("smfcode")){
String newCode=msg.getCode().replace("smfcode.","smfcore.");
msg.setCode(newCode);
msg.setType("smfcore");
languageMsgManager.save(msg);
}
msgMap.put(msg.getCode(), msg); msgMap.put(msg.getCode(), msg);
} }
log.info("MessageCache共加载到" + msgMap.size() + "条Msg"); log.info("MessageCache共加载到" + msgMap.size() + "条Msg");
......
...@@ -116,11 +116,11 @@ public class MSDController { ...@@ -116,11 +116,11 @@ public class MSDController {
MSDSettiings settiings = msdSettingsMapper.toEntity(msdSettiingsDto); MSDSettiings settiings = msdSettingsMapper.toEntity(msdSettiingsDto);
if (settiings.getMaxHumidity() <= settiings.getMinHumidity()) { if (settiings.getMaxHumidity() <= settiings.getMinHumidity()) {
throw new ValidateException("smfcode.humidityValueError", "温度范围数据错误"); throw new ValidateException("smfcore.humidityValueError", "温度范围数据错误");
} }
if (settiings.getMaxTemperature() <= settiings.getMinTemperature()) { if (settiings.getMaxTemperature() <= settiings.getMinTemperature()) {
throw new ValidateException("smfcode.temperatureValueError", "湿度范围数据错误"); throw new ValidateException("smfcore.temperatureValueError", "湿度范围数据错误");
} }
dataCache.updateCache(Constants.CACHE_msdSetting, settiings); dataCache.updateCache(Constants.CACHE_msdSetting, settiings);
log.info("更改MSD:CACHE_msdSetting=" + settiings.toString()); log.info("更改MSD:CACHE_msdSetting=" + settiings.toString());
...@@ -193,11 +193,11 @@ public class MSDController { ...@@ -193,11 +193,11 @@ public class MSDController {
String posName = paramsMap.get("posName"); String posName = paramsMap.get("posName");
StoragePos pos = storagePosManager.getByPosName(posName); StoragePos pos = storagePosManager.getByPosName(posName);
if (pos == null || (pos.isUsed() == false) || pos.getBarcode() == null) { if (pos == null || (pos.isUsed() == false) || pos.getBarcode() == null) {
throw new ValidateException("smfcode.msd.noPos", "未找到可开封的物料"); throw new ValidateException("smfcore.msd.noPos", "未找到可开封的物料");
} }
Barcode barcode = barcodeManager.findByBarcode(pos.getBarcode().getBarcode()); Barcode barcode = barcodeManager.findByBarcode(pos.getBarcode().getBarcode());
if (barcode == null) { if (barcode == null) {
throw new ValidateException("smfcode.msd.noPos", "未找到可开封的物料"); throw new ValidateException("smfcore.msd.noPos", "未找到可开封的物料");
} }
DateTime dateTime = new DateTime(); DateTime dateTime = new DateTime();
pos.getBarcode().setOpenTime(dateTime); pos.getBarcode().setOpenTime(dateTime);
......
...@@ -302,22 +302,22 @@ public class LiteOrderCache implements ITaskListener { ...@@ -302,22 +302,22 @@ public class LiteOrderCache implements ITaskListener {
} }
if (cacheOrder == null) { if (cacheOrder == null) {
return "smfcode.order.out.notFound"; return "smfcore.order.out.notFound";
} }
if ( !cacheOrder.isTaskFinished() && !cacheOrder.isNew()) { if ( !cacheOrder.isTaskFinished() && !cacheOrder.isNew()) {
log.info("工单[" + orderNo + "]正在执行"); log.info("工单[" + orderNo + "]正在执行");
return "smfcode.order.out.executing"; return "smfcore.order.out.executing";
} }
if(cacheOrder.isClosed()) { if(cacheOrder.isClosed()) {
log.info("工单[" + orderNo + "]已关闭,无法出库"); log.info("工单[" + orderNo + "]已关闭,无法出库");
return "smfcode.order.hasClose"; return "smfcore.order.hasClose";
} }
ORDER_COLOR nextColor = getNextColor(); ORDER_COLOR nextColor = getNextColor();
if (nextColor == null) { if (nextColor == null) {
log.info("执行工单[" + orderNo + "] outBom=" + outBom + "时,已达最大可执行工单数"); log.info("执行工单[" + orderNo + "] outBom=" + outBom + "时,已达最大可执行工单数");
return "smfcode.order.out.maxOrder"; return "smfcore.order.out.maxOrder";
} }
log.info("开始执行工单[" + orderNo + "] outBom=" + outBom); log.info("开始执行工单[" + orderNo + "] outBom=" + outBom);
...@@ -409,7 +409,7 @@ public class LiteOrderCache implements ITaskListener { ...@@ -409,7 +409,7 @@ public class LiteOrderCache implements ITaskListener {
liteOrderMap.put(cacheOrder.getOrderNo(), cacheOrder); liteOrderMap.put(cacheOrder.getOrderNo(), cacheOrder);
if (taskReelCount <= 0) { if (taskReelCount <= 0) {
//return "工单无可执行的任务"; //return "工单无可执行的任务";
return "smfcode.order.out.noTask"; return "smfcore.order.out.noTask";
} }
return ""; return "";
} }
...@@ -445,7 +445,7 @@ public class LiteOrderCache implements ITaskListener { ...@@ -445,7 +445,7 @@ public class LiteOrderCache implements ITaskListener {
if (liteOrder == null) { if (liteOrder == null) {
liteOrder=liteOrderManager.findByOrderNo(orderNo); liteOrder=liteOrderManager.findByOrderNo(orderNo);
if(liteOrder==null){ if(liteOrder==null){
return "smfcode.order.out.notFound"; return "smfcore.order.out.notFound";
} }
} }
//有任务的工单不能关闭 //有任务的工单不能关闭
...@@ -457,7 +457,7 @@ public class LiteOrderCache implements ITaskListener { ...@@ -457,7 +457,7 @@ public class LiteOrderCache implements ITaskListener {
String taskSourceName = task.getSourceName(); String taskSourceName = task.getSourceName();
if (!Strings.isNullOrEmpty(taskSourceName) && orderNo.equals(taskSourceName)) { if (!Strings.isNullOrEmpty(taskSourceName) && orderNo.equals(taskSourceName)) {
log.info("关闭工单[" + orderNo + "]失败,有未完成的出库任务:"+task.getPosName()); log.info("关闭工单[" + orderNo + "]失败,有未完成的出库任务:"+task.getPosName());
return "smfcode.order.close.taskNotEnd"; return "smfcore.order.close.taskNotEnd";
} }
} }
} }
...@@ -467,7 +467,7 @@ public class LiteOrderCache implements ITaskListener { ...@@ -467,7 +467,7 @@ public class LiteOrderCache implements ITaskListener {
log.info("关闭工单[" + orderNo + "]成功"); log.info("关闭工单[" + orderNo + "]成功");
liteOrder.setClosed(true); liteOrder.setClosed(true);
liteOrderManager.save(liteOrder); liteOrderManager.save(liteOrder);
return "smfcode.order.close.success"; return "smfcore.order.close.success";
} }
/** /**
...@@ -481,11 +481,11 @@ public class LiteOrderCache implements ITaskListener { ...@@ -481,11 +481,11 @@ public class LiteOrderCache implements ITaskListener {
if (cacheOrder == null) { if (cacheOrder == null) {
cacheOrder=liteOrderManager.findByOrderNo(orderNo); cacheOrder=liteOrderManager.findByOrderNo(orderNo);
if(cacheOrder==null){ if(cacheOrder==null){
return "smfcode.order.out.notFound"; return "smfcore.order.out.notFound";
} }
} }
if(cacheOrder.isClosed()){ if(cacheOrder.isClosed()){
return "smfcode.order.hasClose"; return "smfcore.order.hasClose";
} }
for (LiteOrderItem orderItem:cacheOrder.getOrderItems() for (LiteOrderItem orderItem:cacheOrder.getOrderItems()
...@@ -508,7 +508,7 @@ public class LiteOrderCache implements ITaskListener { ...@@ -508,7 +508,7 @@ public class LiteOrderCache implements ITaskListener {
pos = storagePosManager.findPartNumberInStorages(availableStorageIds, partNumber, excludePosIds, checkoutType); pos = storagePosManager.findPartNumberInStorages(availableStorageIds, partNumber, excludePosIds, checkoutType);
} }
if (pos == null) { if (pos == null) {
return "smfcode.order.supplementOutFail"; return "smfcore.order.supplementOutFail";
} else { } else {
log.info("工单[" + orderNo + "]["+partNumber+"]补料出库:仓位[" + pos.getPosName() + "]RI=[" + pos.getBarcode().getBarcode() + "] PN=[" + partNumber + "] num:" + pos.getBarcode().getAmount()); log.info("工单[" + orderNo + "]["+partNumber+"]补料出库:仓位[" + pos.getPosName() + "]RI=[" + pos.getBarcode().getBarcode() + "] PN=[" + partNumber + "] num:" + pos.getBarcode().getAmount());
DataLog task = newTask(pos) ; DataLog task = newTask(pos) ;
...@@ -527,6 +527,6 @@ public class LiteOrderCache implements ITaskListener { ...@@ -527,6 +527,6 @@ public class LiteOrderCache implements ITaskListener {
} }
} }
} }
return "smfcode.order.supplementOutFail"; return "smfcore.order.supplementOutFail";
} }
} }
...@@ -147,7 +147,7 @@ public class OrderController { ...@@ -147,7 +147,7 @@ public class OrderController {
liteOrder.setOrderNo(newOrderNo); liteOrder.setOrderNo(newOrderNo);
} else { } else {
log.info("数据库中已存在工单号为[" + liteOrder.getOrderNo() + "],忽略文件:" + localFile.getAbsolutePath()); log.info("数据库中已存在工单号为[" + liteOrder.getOrderNo() + "],忽略文件:" + localFile.getAbsolutePath());
return ResultBean.newErrorResult(-1, "smfcode.order.ameExists", "工单名称[{0}]已存在", new String[]{liteOrder.getOrderNo()}); return ResultBean.newErrorResult(-1, "smfcore.order.ameExists", "工单名称[{0}]已存在", new String[]{liteOrder.getOrderNo()});
} }
} }
log.info("新增加订单:" + liteOrder.getOrderNo() + ",共" + liteOrderItems.size() + "条工单详情"); log.info("新增加订单:" + liteOrder.getOrderNo() + ",共" + liteOrderItems.size() + "条工单详情");
...@@ -155,7 +155,7 @@ public class OrderController { ...@@ -155,7 +155,7 @@ public class OrderController {
liteOrderCache.addOrderToMap(liteOrder); liteOrderCache.addOrderToMap(liteOrder);
} }
return ResultBean.newOkResult("smfcode.order.uploadOK","工单上传成功",""); return ResultBean.newOkResult("smfcore.order.uploadOK","工单上传成功","");
} }
@ApiOperation("工单出库") @ApiOperation("工单出库")
...@@ -164,11 +164,11 @@ public class OrderController { ...@@ -164,11 +164,11 @@ public class OrderController {
public ResultBean checkOut(@RequestBody Map<String, String> mapValues) { public ResultBean checkOut(@RequestBody Map<String, String> mapValues) {
String orderNo = mapValues.get("orderNo"); String orderNo = mapValues.get("orderNo");
if (orderNo == null) { if (orderNo == null) {
throw new ValidateException("smfcode.valueCanotNull", "{0}不能为空", new String[]{"orderNo"}); throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"orderNo"});
} }
LiteOrder liteOrder = liteOrderManager.findByOrderNo(orderNo); LiteOrder liteOrder = liteOrderManager.findByOrderNo(orderNo);
if (liteOrder == null) { if (liteOrder == null) {
throw new ValidateException("smfcode.valueNotFind", "未找到{0}[{1}]", new String[]{"orderNo", orderNo}); throw new ValidateException("smfcore.valueNotFind", "未找到{0}[{1}]", new String[]{"orderNo", orderNo});
} }
String result= liteOrderCache.checkOutLiteOrder(liteOrder.getOrderNo(),false); String result= liteOrderCache.checkOutLiteOrder(liteOrder.getOrderNo(),false);
if(ObjectUtil.isEmpty(result)){ if(ObjectUtil.isEmpty(result)){
...@@ -185,7 +185,7 @@ public class OrderController { ...@@ -185,7 +185,7 @@ public class OrderController {
public ResultBean outBom(@RequestBody Map<String, String> mapValues) { public ResultBean outBom(@RequestBody Map<String, String> mapValues) {
String orderNo = mapValues.get("orderNo"); String orderNo = mapValues.get("orderNo");
if (orderNo == null) { if (orderNo == null) {
throw new ValidateException("smfcode.valueCanotNull", "{0}不能为空", new String[]{"orderNo"}); throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"orderNo"});
} }
String result= liteOrderCache.checkOutLiteOrder(orderNo,true); String result= liteOrderCache.checkOutLiteOrder(orderNo,true);
if(ObjectUtil.isEmpty(result)){ if(ObjectUtil.isEmpty(result)){
...@@ -202,7 +202,7 @@ public class OrderController { ...@@ -202,7 +202,7 @@ public class OrderController {
public ResultBean outTails(@RequestBody Map<String, String> mapValues) { public ResultBean outTails(@RequestBody Map<String, String> mapValues) {
String orderNo = mapValues.get("orderNo"); String orderNo = mapValues.get("orderNo");
if (orderNo == null) { if (orderNo == null) {
throw new ValidateException("smfcode.valueCanotNull", "{0}不能为空", new String[]{"orderNo"}); throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"orderNo"});
} }
String result= liteOrderCache.checkOutLiteOrder(orderNo,false); String result= liteOrderCache.checkOutLiteOrder(orderNo,false);
...@@ -220,7 +220,7 @@ public class OrderController { ...@@ -220,7 +220,7 @@ public class OrderController {
String orderNo = mapValues.get("orderNo"); String orderNo = mapValues.get("orderNo");
String orderItemId = mapValues.get("orderItemId"); String orderItemId = mapValues.get("orderItemId");
if (orderNo == null) { if (orderNo == null) {
throw new ValidateException("smfcode.valueCanotNull", "{0}不能为空", new String[]{"orderNo"}); throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"orderNo"});
} }
String result= liteOrderCache.orderItemSupplementOut(orderNo,orderItemId); String result= liteOrderCache.orderItemSupplementOut(orderNo,orderItemId);
if(ObjectUtil.isEmpty(result)){ if(ObjectUtil.isEmpty(result)){
...@@ -369,7 +369,7 @@ public class OrderController { ...@@ -369,7 +369,7 @@ public class OrderController {
} }
} }
throw new ValidateException("smfcode.valueCanotNull", "{0}不能为空", new String[]{"orderNo"}); throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"orderNo"});
} }
...@@ -381,14 +381,14 @@ public class OrderController { ...@@ -381,14 +381,14 @@ public class OrderController {
float orderTimes= param.getOrderTimes(); float orderTimes= param.getOrderTimes();
if (orderNo == null) { if (orderNo == null) {
// throw new ValidateException("工单号不能为空"); // throw new ValidateException("工单号不能为空");
throw new ValidateException("smfcode.valueCanotNull", "{0}不能为空", new String[]{"orderNo"}); throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"orderNo"});
} }
LiteOrder liteOrder = liteOrderManager.findByOrderNo(orderNo); LiteOrder liteOrder = liteOrderManager.findByOrderNo(orderNo);
if (liteOrder == null) { if (liteOrder == null) {
throw new ValidateException("smfcode.valueNotFind", "未找到{0}[{1}]", new String[]{"orderNo", orderNo}); throw new ValidateException("smfcore.valueNotFind", "未找到{0}[{1}]", new String[]{"orderNo", orderNo});
} }
if(!liteOrder.isNew()){ if(!liteOrder.isNew()){
throw new ValidateException("smfcode.cannotUpdateOrderNum", "工单已出库,不能修改数量" ); throw new ValidateException("smfcore.cannotUpdateOrderNum", "工单已出库,不能修改数量" );
} }
if(orderTimes<1){ if(orderTimes<1){
orderTimes=1; orderTimes=1;
...@@ -405,7 +405,7 @@ public class OrderController { ...@@ -405,7 +405,7 @@ public class OrderController {
public ResultBean closeOrder(@RequestBody Map<String, String> mapValues) { public ResultBean closeOrder(@RequestBody Map<String, String> mapValues) {
String orderNo = mapValues.get("orderNo"); String orderNo = mapValues.get("orderNo");
if (orderNo == null) { if (orderNo == null) {
throw new ValidateException("smfcode.valueCanotNull", "{0}不能为空", new String[]{"orderNo"}); throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"orderNo"});
} }
String result=liteOrderCache.closeOrder(orderNo); String result=liteOrderCache.closeOrder(orderNo);
...@@ -422,19 +422,19 @@ public class OrderController { ...@@ -422,19 +422,19 @@ public class OrderController {
@PreAuthorize("@el.check('workOrder')") @PreAuthorize("@el.check('workOrder')")
public ResultBean updateLine(@RequestBody OrderDto param) { public ResultBean updateLine(@RequestBody OrderDto param) {
if (param.getId() == null) { if (param.getId() == null) {
throw new ValidateException("smfcode.valueCanotNull", "{0}不能为空", new String[]{"orderNo"}); throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"orderNo"});
} }
if (param.getLine() == null) { if (param.getLine() == null) {
throw new ValidateException("smfcode.order.lineCanotNull", "线别不能为空"); throw new ValidateException("smfcore.order.lineCanotNull", "线别不能为空");
} }
LiteOrder order = liteOrderManager.get(param.getId()); LiteOrder order = liteOrderManager.get(param.getId());
if (order == null) { if (order == null) {
throw new ValidateException("smfcode.valueCanotNull", "{0}不能为空", new String[]{"orderNo"}); throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"orderNo"});
} }
if (!order.isNew()) { if (!order.isNew()) {
throw new ValidateException("smfcode.order.cannotUpdateLine", "工单已出库,不能修改线别"); throw new ValidateException("smfcore.order.cannotUpdateLine", "工单已出库,不能修改线别");
} }
order.setLine(param.getLine()); order.setLine(param.getLine());
liteOrderManager.save(order); liteOrderManager.save(order);
......
...@@ -66,7 +66,7 @@ public class LabelController { ...@@ -66,7 +66,7 @@ public class LabelController {
public ResponseEntity<Object> update(@RequestBody LabelDto labelDto) { public ResponseEntity<Object> update(@RequestBody LabelDto labelDto) {
Label resources=labelMapper.toEntity(labelDto); Label resources=labelMapper.toEntity(labelDto);
if (resources.getId() == null) { if (resources.getId() == null) {
throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} ); throw new ValidateException("smfcore.valueCanotNull","{0}不能为空",new String[]{"ID"} );
} }
labelManager.saveLabel(resources); labelManager.saveLabel(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT); return new ResponseEntity<>(HttpStatus.NO_CONTENT);
...@@ -79,18 +79,18 @@ public class LabelController { ...@@ -79,18 +79,18 @@ public class LabelController {
Set<Group> menuSet = new HashSet<>(); Set<Group> menuSet = new HashSet<>();
for (String id : ids) { for (String id : ids) {
if (id == null) { if (id == null) {
throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} ); throw new ValidateException("smfcore.valueCanotNull","{0}不能为空",new String[]{"ID"} );
} }
Label label = labelManager.get(id); Label label = labelManager.get(id);
if(label==null){ if(label==null){
throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"group"} ); throw new ValidateException("smfcore.valueCanotNull","{0}不能为空",new String[]{"group"} );
} }
//查找组下是否有设备 //查找组下是否有设备
Query query = new Query(Criteria.where("labelId").is(id)); Query query = new Query(Criteria.where("labelId").is(id));
List<StoragePos> storagePosList = storagePosManager.findByQuery(query); List<StoragePos> storagePosList = storagePosManager.findByQuery(query);
if (storagePosList != null && storagePosList.size() >= 1) { if (storagePosList != null && storagePosList.size() >= 1) {
throw new ValidateException("smfcode.labelWithStoragePos","标签[{0}]已和库位关联",new String[]{label.getLabelName()}); throw new ValidateException("smfcore.labelWithStoragePos","标签[{0}]已和库位关联",new String[]{label.getLabelName()});
} }
//删除关联 //删除关联
......
...@@ -68,7 +68,7 @@ public class MaterialBoxController { ...@@ -68,7 +68,7 @@ public class MaterialBoxController {
codeBean.setError(e.getMessage()); codeBean.setError(e.getMessage());
} }
if (codeBean == null || codeBean.getBarcode() == null) { if (codeBean == null || codeBean.getBarcode() == null) {
throw new ValidateException("smfcode.error.barcode.invalid", "{0}不是有效的条码", new String[]{code}); throw new ValidateException("smfcore.error.barcode.invalid", "{0}不是有效的条码", new String[]{code});
} }
if (codeBean.getErrorCode() != null) { if (codeBean.getErrorCode() != null) {
throw new ValidateException(codeBean.getErrorCode(), codeBean.getError(), codeBean.getParams()); throw new ValidateException(codeBean.getErrorCode(), codeBean.getError(), codeBean.getParams());
...@@ -79,7 +79,7 @@ public class MaterialBoxController { ...@@ -79,7 +79,7 @@ public class MaterialBoxController {
//此处需要判断是否是料盒 //此处需要判断是否是料盒
Component component=componentManager.findOneByPN(barcode.getPartNumber() ); Component component=componentManager.findOneByPN(barcode.getPartNumber() );
if(component==null||(component.getType()!=COMPONENT_TYPE.FIXTURE)){ if(component==null||(component.getType()!=COMPONENT_TYPE.FIXTURE)){
throw new ValidateException("smfcode.materialBox.invalid", "未找到料盒信息{0}", new String[]{code}); throw new ValidateException("smfcore.materialBox.invalid", "未找到料盒信息{0}", new String[]{code});
} }
BarcodeDto barcodeDto=barcodeMapper.toDto(barcode); BarcodeDto barcodeDto=barcodeMapper.toDto(barcode);
...@@ -98,10 +98,10 @@ public class MaterialBoxController { ...@@ -98,10 +98,10 @@ public class MaterialBoxController {
Barcode barcode = barcodeManager.findByBarcode(code); Barcode barcode = barcodeManager.findByBarcode(code);
if (barcode == null) { if (barcode == null) {
throw new ValidateException("smfcode.materialBox.invalid", "未找到料盒信息{0}", new String[]{code}); throw new ValidateException("smfcore.materialBox.invalid", "未找到料盒信息{0}", new String[]{code});
} }
if(describe==null){ if(describe==null){
throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"describe"} ); throw new ValidateException("smfcore.valueCanotNull","{0}不能为空",new String[]{"describe"} );
} }
barcode.setDescribe(describe); barcode.setDescribe(describe);
barcodeManager.saveBarcode(barcode); barcodeManager.saveBarcode(barcode);
...@@ -121,18 +121,18 @@ public class MaterialBoxController { ...@@ -121,18 +121,18 @@ public class MaterialBoxController {
Barcode barcode = barcodeManager.findByBarcode(code); Barcode barcode = barcodeManager.findByBarcode(code);
if (barcode == null) { if (barcode == null) {
throw new ValidateException("smfcode.materialBox.invalid", "未找到料盒信息{0}", new String[]{code}); throw new ValidateException("smfcore.materialBox.invalid", "未找到料盒信息{0}", new String[]{code});
} }
Barcode subBarcode = barcode.getSubCode(subPN); Barcode subBarcode = barcode.getSubCode(subPN);
if (subBarcode == null) { if (subBarcode == null) {
throw new ValidateException("smfcode.materialBox.noReel", "料盒中未找到对应物料"); throw new ValidateException("smfcore.materialBox.noReel", "料盒中未找到对应物料");
} }
int opQty = Integer.valueOf(qtyStr); int opQty = Integer.valueOf(qtyStr);
int oldAmount = subBarcode.getAmount(); int oldAmount = subBarcode.getAmount();
if (oldAmount < opQty) { if (oldAmount < opQty) {
throw new ValidateException("smfcode.materialBox.quantityshort", "物料数量不足"); throw new ValidateException("smfcore.materialBox.quantityshort", "物料数量不足");
} }
int newAmount = oldAmount - opQty; int newAmount = oldAmount - opQty;
subBarcode.setAmount(newAmount); subBarcode.setAmount(newAmount);
...@@ -152,11 +152,11 @@ public class MaterialBoxController { ...@@ -152,11 +152,11 @@ public class MaterialBoxController {
Barcode barcode=barcodeManager.findByBarcode(code); Barcode barcode=barcodeManager.findByBarcode(code);
if(barcode==null){ if(barcode==null){
//料盒不存在 //料盒不存在
throw new ValidateException("smfcode.materialBox.invalid", "未找到料盒信息{0}", new String[]{code}); throw new ValidateException("smfcore.materialBox.invalid", "未找到料盒信息{0}", new String[]{code});
} }
if(barcode.getSubCodeMap()==null||barcode.getSubCodeMap().size()<=0){ if(barcode.getSubCodeMap()==null||barcode.getSubCodeMap().size()<=0){
//料盒中未找到对应物料 //料盒中未找到对应物料
throw new ValidateException("smfcode.materialBox.boxNoReel","料盒中无物料"); throw new ValidateException("smfcore.materialBox.boxNoReel","料盒中无物料");
} }
List<Barcode> barcodes=new ArrayList<>(barcode.getSubCodeMap().values()) ; List<Barcode> barcodes=new ArrayList<>(barcode.getSubCodeMap().values()) ;
...@@ -183,7 +183,7 @@ public class MaterialBoxController { ...@@ -183,7 +183,7 @@ public class MaterialBoxController {
Barcode barcode=barcodeManager.findByBarcode(code); Barcode barcode=barcodeManager.findByBarcode(code);
if(barcode==null){ if(barcode==null){
throw new ValidateException("smfcode.materialBox.invalid", "未找到料盒信息{0}", new String[]{code}); throw new ValidateException("smfcore.materialBox.invalid", "未找到料盒信息{0}", new String[]{code});
} }
//用+或-分割,如果最后几位是数量,按手动输入处理 //用+或-分割,如果最后几位是数量,按手动输入处理
...@@ -243,7 +243,7 @@ public class MaterialBoxController { ...@@ -243,7 +243,7 @@ public class MaterialBoxController {
int oldAmount = subBarcode.getAmount(); int oldAmount = subBarcode.getAmount();
if(oldAmount < opQty){ if(oldAmount < opQty){
throw new ValidateException("smfcode.materialBox.quantityshort","物料数量不足"); throw new ValidateException("smfcore.materialBox.quantityshort","物料数量不足");
} }
int newAmount = oldAmount - opQty; int newAmount = oldAmount - opQty;
...@@ -255,7 +255,7 @@ public class MaterialBoxController { ...@@ -255,7 +255,7 @@ public class MaterialBoxController {
log.info(subBarcode.getPartNumber() + "从料盒["+barcode.getPosName()+"]出库,物料数量:" + oldAmount + " - " + opQty + " = " + newAmount); log.info(subBarcode.getPartNumber() + "从料盒["+barcode.getPosName()+"]出库,物料数量:" + oldAmount + " - " + opQty + " = " + newAmount);
}else{ }else{
//无库存 //无库存
throw new ValidateException("smfcode.materialBox.noReel","料盒中未找到对应物料"); throw new ValidateException("smfcore.materialBox.noReel","料盒中未找到对应物料");
} }
} }
...@@ -267,7 +267,7 @@ public class MaterialBoxController { ...@@ -267,7 +267,7 @@ public class MaterialBoxController {
Barcode subBarcode = codeBean.getBarcode(); Barcode subBarcode = codeBean.getBarcode();
StoragePos pos = storagePosManager.getByBarcode(subBarcode.getBarcode()); StoragePos pos = storagePosManager.getByBarcode(subBarcode.getBarcode());
if (pos != null) { if (pos != null) {
throw new ValidateException("smfcode.materialBox.inPos", "物料已在库位{0}中", new String[]{pos.getPosName()}); throw new ValidateException("smfcore.materialBox.inPos", "物料已在库位{0}中", new String[]{pos.getPosName()});
} }
if (subBarcode.getHostBarcodeId() == null) { if (subBarcode.getHostBarcodeId() == null) {
...@@ -295,7 +295,7 @@ public class MaterialBoxController { ...@@ -295,7 +295,7 @@ public class MaterialBoxController {
//在别的料盒中 //在别的料盒中
Barcode hostBarcode = barcodeManager.get(subBarcode.getHostBarcodeId()); Barcode hostBarcode = barcodeManager.get(subBarcode.getHostBarcodeId());
if (hostBarcode != null) { if (hostBarcode != null) {
throw new ValidateException("smfcode.materialBox.inOtherBox", "物料已在料盒{0}中", new String[]{hostBarcode.getBarcode()}); throw new ValidateException("smfcore.materialBox.inOtherBox", "物料已在料盒{0}中", new String[]{hostBarcode.getBarcode()});
} }
} }
} else { } else {
......
...@@ -85,15 +85,15 @@ public class MaterialController { ...@@ -85,15 +85,15 @@ public class MaterialController {
public ResultBean tacticsOuput(@RequestBody Set<TacticsOutDto> outDtoSet) { public ResultBean tacticsOuput(@RequestBody Set<TacticsOutDto> outDtoSet) {
if (outDtoSet == null) { if (outDtoSet == null) {
throw new ValidateException("smfcode.valueCanotNull", "{0}不能为空", new String[]{"PN"}); throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"PN"});
} }
for (TacticsOutDto dto : for (TacticsOutDto dto :
outDtoSet) { outDtoSet) {
if (dto.getPartNumber() == null) { if (dto.getPartNumber() == null) {
throw new ValidateException("smfcode.valueCanotNull", "{0}不能为空", new String[]{"PN"}); throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"PN"});
} else if (dto.getPlateNumber() == null) { } else if (dto.getPlateNumber() == null) {
throw new ValidateException("smfcode.valueCanotNull", "{0}不能为空", new String[]{"Num"}); throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"Num"});
} }
} }
...@@ -173,23 +173,23 @@ public class MaterialController { ...@@ -173,23 +173,23 @@ public class MaterialController {
String labelId = params.getLabelId(); String labelId = params.getLabelId();
if (Objects.isNull(labelId)) { if (Objects.isNull(labelId)) {
if (posIds == null) { if (posIds == null) {
throw new ValidateException("smfcode.valueCanotNull", "{0}不能为空", new String[]{"PN"}); throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"PN"});
} }
for (String posId : posIds) { for (String posId : posIds) {
StoragePos pos = storagePosManager.get(posId); StoragePos pos = storagePosManager.get(posId);
if (pos == null) { if (pos == null) {
throw new ValidateException("smfcode.valueNotExist", "{0}[{1}]不存在", new String[]{"posId", posId}); throw new ValidateException("smfcore.valueNotExist", "{0}[{1}]不存在", new String[]{"posId", posId});
} }
Storage storage = dataCache.getStorageById(pos.getStorageId()); Storage storage = dataCache.getStorageById(pos.getStorageId());
if (storage == null) { if (storage == null) {
throw new ValidateException("smfcode.valueNotExist", "{0}[{1}]不存在", new String[]{"storageId", pos.getStorageId()}); throw new ValidateException("smfcore.valueNotExist", "{0}[{1}]不存在", new String[]{"storageId", pos.getStorageId()});
} }
log.info("出库料仓【" + storage.getName() + "_" + storage.getCid() + "】位置仓位【" + pos.getPosName() + "】"); log.info("出库料仓【" + storage.getName() + "_" + storage.getCid() + "】位置仓位【" + pos.getPosName() + "】");
String outResult = taskService.checkout(storage, pos, true, SecurityUtils.getCurrentUsername()); String outResult = taskService.checkout(storage, pos, true, SecurityUtils.getCurrentUsername());
if (!Strings.isNullOrEmpty(outResult)) { if (!Strings.isNullOrEmpty(outResult)) {
throw new ValidateException("smfcode.error", outResult); throw new ValidateException("smfcore.error", outResult);
} }
} }
} else { } else {
...@@ -200,19 +200,19 @@ public class MaterialController { ...@@ -200,19 +200,19 @@ public class MaterialController {
List<StoragePos> posList = storagePosManager.findByQuery(query); List<StoragePos> posList = storagePosManager.findByQuery(query);
if (posList.size() <= 0) { if (posList.size() <= 0) {
//未找到出库信息 //未找到出库信息
throw new ValidateException("smfcode.label.noReel","未找到可出库的物料"); throw new ValidateException("smfcore.label.noReel","未找到可出库的物料");
} }
for (StoragePos pos : posList for (StoragePos pos : posList
) { ) {
Storage storage = dataCache.getStorageById(pos.getStorageId()); Storage storage = dataCache.getStorageById(pos.getStorageId());
if (storage == null) { if (storage == null) {
throw new ValidateException("smfcode.valueNotExist", "{0}[{1}]不存在", new String[]{"storageId", pos.getStorageId()}); throw new ValidateException("smfcore.valueNotExist", "{0}[{1}]不存在", new String[]{"storageId", pos.getStorageId()});
} }
log.info("出库料仓【" + storage.getName() + "_" + storage.getCid() + "】位置仓位【" + pos.getPosName() + "】"); log.info("出库料仓【" + storage.getName() + "_" + storage.getCid() + "】位置仓位【" + pos.getPosName() + "】");
String outResult = taskService.checkout(storage, pos, true, SecurityUtils.getCurrentUsername()); String outResult = taskService.checkout(storage, pos, true, SecurityUtils.getCurrentUsername());
if (!Strings.isNullOrEmpty(outResult)) { if (!Strings.isNullOrEmpty(outResult)) {
throw new ValidateException("smfcode.error", outResult); throw new ValidateException("smfcore.error", outResult);
} }
} }
} }
...@@ -232,7 +232,7 @@ public class MaterialController { ...@@ -232,7 +232,7 @@ public class MaterialController {
List<String> posIds = params.getPosIds(); List<String> posIds = params.getPosIds();
String labelId = params.getLabelId(); String labelId = params.getLabelId();
if (posIds == null || posIds.size() <= 0) { if (posIds == null || posIds.size() <= 0) {
throw new ValidateException("smfcode.valueCanotNull", "{0}不能为空", new String[]{"ID"}); throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"ID"});
} }
String labelName=""; String labelName="";
if (ObjectUtil.isEmpty(labelId)) { if (ObjectUtil.isEmpty(labelId)) {
...@@ -258,7 +258,7 @@ public class MaterialController { ...@@ -258,7 +258,7 @@ public class MaterialController {
if (storagePos != null) { if (storagePos != null) {
if (!ObjectUtil.isEmpty(storagePos.getBarcode().getLockId())) { if (!ObjectUtil.isEmpty(storagePos.getBarcode().getLockId())) {
throw new ValidateException("smfcode.error.barcode.locked", "库位[{0}]已被锁定"); throw new ValidateException("smfcore.error.barcode.locked", "库位[{0}]已被锁定");
} }
try { try {
if (barcode != null) { if (barcode != null) {
...@@ -269,12 +269,12 @@ public class MaterialController { ...@@ -269,12 +269,12 @@ public class MaterialController {
log.info("清理库位[" + storagePos.getPosName() + "],条码[" + code + "],库位条码为空"); log.info("清理库位[" + storagePos.getPosName() + "],条码[" + code + "],库位条码为空");
} }
return ResultBean.newOkResult("smfcode.manualOut.ok", "手动出库成功", code); return ResultBean.newOkResult("smfcore.manualOut.ok", "手动出库成功", code);
} catch (Exception e) { } catch (Exception e) {
return ResultBean.newErrorResult(1,"smfcore.error", "出错{0}", new String[]{e.getMessage()}, true); return ResultBean.newErrorResult(1,"smfcore.error", "出错{0}", new String[]{e.getMessage()}, true);
} }
} else { } else {
throw new ValidateException("smfcode.manualOut.notFound", "仓库中未找到料盘信息"); throw new ValidateException("smfcore.manualOut.notFound", "仓库中未找到料盘信息");
} }
} }
......
...@@ -143,7 +143,7 @@ public class StorageController { ...@@ -143,7 +143,7 @@ public class StorageController {
public ResponseEntity<Object> update(@Validated @RequestBody StorageDto resources) { public ResponseEntity<Object> update(@Validated @RequestBody StorageDto resources) {
Storage Storage=storageMapper.toEntity(resources); Storage Storage=storageMapper.toEntity(resources);
if (Storage.getId() == null) { if (Storage.getId() == null) {
throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} ); throw new ValidateException("smfcore.valueCanotNull","{0}不能为空",new String[]{"ID"} );
} }
saveStorage(Storage); saveStorage(Storage);
return new ResponseEntity<>(HttpStatus.OK); return new ResponseEntity<>(HttpStatus.OK);
...@@ -158,7 +158,7 @@ public class StorageController { ...@@ -158,7 +158,7 @@ public class StorageController {
for (String id : ids) { for (String id : ids) {
if (id == null) { if (id == null) {
throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} ); throw new ValidateException("smfcore.valueCanotNull","{0}不能为空",new String[]{"ID"} );
} }
} }
deleteStorages(ids); deleteStorages(ids);
...@@ -180,7 +180,7 @@ public class StorageController { ...@@ -180,7 +180,7 @@ public class StorageController {
if (pos.getBarcode() == null || pos.getBarcode().equals("")) { if (pos.getBarcode() == null || pos.getBarcode().equals("")) {
} else { } else {
throw new ValidateException("smfcode.posIsused","料仓[{0}]的库位[{1}}]有料[{2}],删除失败",new String[]{ storage.getName() ,pos.getPosName(),pos.getBarcode().getBarcode()}); throw new ValidateException("smfcore.posIsused","料仓[{0}]的库位[{1}}]有料[{2}],删除失败",new String[]{ storage.getName() ,pos.getPosName(),pos.getBarcode().getBarcode()});
// throw new BadRequestException("料仓[" + storage.getName() + "]的库位[" + pos.getPosName() + "]有料[" + pos.getBarcode() + "],删除失败"); // throw new BadRequestException("料仓[" + storage.getName() + "]的库位[" + pos.getPosName() + "]有料[" + pos.getBarcode() + "],删除失败");
} }
} }
...@@ -195,16 +195,16 @@ public class StorageController { ...@@ -195,16 +195,16 @@ public class StorageController {
} }
private Storage saveStorage(Storage storage) { private Storage saveStorage(Storage storage) {
if(storage.getName()==null){ if(storage.getName()==null){
throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"name"} ); throw new ValidateException("smfcore.valueCanotNull","{0}不能为空",new String[]{"name"} );
// throw new BadRequestException("料仓名称不能为空"); // throw new BadRequestException("料仓名称不能为空");
} if(storage.getCid()==null){ } if(storage.getCid()==null){
throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"cid"} ); throw new ValidateException("smfcore.valueCanotNull","{0}不能为空",new String[]{"cid"} );
// throw new BadRequestException("料仓编号不能为空"); // throw new BadRequestException("料仓编号不能为空");
} if(storage.getType()==null){ } if(storage.getType()==null){
throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"type"} ); throw new ValidateException("smfcore.valueCanotNull","{0}不能为空",new String[]{"type"} );
// throw new BadRequestException("料仓类型不能为空"); // throw new BadRequestException("料仓类型不能为空");
} if(storage.getCompatibleType()==null){ } if(storage.getCompatibleType()==null){
throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"compatibleType"} ); throw new ValidateException("smfcore.valueCanotNull","{0}不能为空",new String[]{"compatibleType"} );
// throw new BadRequestException("料仓兼容性不能为空"); // throw new BadRequestException("料仓兼容性不能为空");
} }
String oldCid=""; String oldCid="";
...@@ -215,11 +215,11 @@ public class StorageController { ...@@ -215,11 +215,11 @@ public class StorageController {
) { ) {
if(isNew || (!storage.getId().equals(s.getId()))) { if(isNew || (!storage.getId().equals(s.getId()))) {
if(s.getName().equals(storage.getName())){ if(s.getName().equals(storage.getName())){
throw new ValidateException("smfcode.valueAlreadyExist","{0}[{1}]已存在",new String[]{"name",storage.getName()}); throw new ValidateException("smfcore.valueAlreadyExist","{0}[{1}]已存在",new String[]{"name",storage.getName()});
// throw new BadRequestException("料仓名称["+storage.getCid()+"]已存在"); // throw new BadRequestException("料仓名称["+storage.getCid()+"]已存在");
} }
if(s.getCid().equals(storage.getCid())){ if(s.getCid().equals(storage.getCid())){
throw new ValidateException("smfcode.valueAlreadyExist","{0}[{1}]已存在",new String[]{"cid",storage.getCid()}); throw new ValidateException("smfcore.valueAlreadyExist","{0}[{1}]已存在",new String[]{"cid",storage.getCid()});
// throw new BadRequestException("料仓cid["+storage.getCid()+"]已存在"); // throw new BadRequestException("料仓cid["+storage.getCid()+"]已存在");
} }
} }
...@@ -248,7 +248,7 @@ public class StorageController { ...@@ -248,7 +248,7 @@ public class StorageController {
String image = "csv"; String image = "csv";
String fileType = FileUtil.getExtensionName(uploadFile.getOriginalFilename()); String fileType = FileUtil.getExtensionName(uploadFile.getOriginalFilename());
if(fileType != null && !image.contains(fileType)){ if(fileType != null && !image.contains(fileType)){
throw new ValidateException("smfcode.feleFormatError","文件格式错误!, 仅支持{0}格式",new String[]{image}); throw new ValidateException("smfcore.feleFormatError","文件格式错误!, 仅支持{0}格式",new String[]{image});
} }
File folder = new File(properties.getPath(),"pos"); File folder = new File(properties.getPath(),"pos");
File file = FileUtil.upload(uploadFile, folder.getAbsolutePath()); File file = FileUtil.upload(uploadFile, folder.getAbsolutePath());
...@@ -262,7 +262,7 @@ public class StorageController { ...@@ -262,7 +262,7 @@ public class StorageController {
log.info("开始更新料仓【"+storageId+"】的位置信息"); log.info("开始更新料仓【"+storageId+"】的位置信息");
if (Strings.isNullOrEmpty(storageId)) { if (Strings.isNullOrEmpty(storageId)) {
log.error("Storage id is null"); log.error("Storage id is null");
throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"storageId"} ); throw new ValidateException("smfcore.valueCanotNull","{0}不能为空",new String[]{"storageId"} );
} }
Storage storage = storageManager.get(storageId); Storage storage = storageManager.get(storageId);
if (storage == null) { if (storage == null) {
......
...@@ -102,7 +102,7 @@ public class StoragePosController { ...@@ -102,7 +102,7 @@ public class StoragePosController {
} }
Storage storage = dataCache.getStorage(cid); Storage storage = dataCache.getStorage(cid);
if (storage == null) { if (storage == null) {
throw new ValidateException("smfcode.valueNotFind", "未找到{0}[{1}]", new String[]{"cid", cid}); throw new ValidateException("smfcore.valueNotFind", "未找到{0}[{1}]", new String[]{"cid", cid});
} }
List<StoragePos> allPos = storagePosManager.findByStorage(storage.getId()); List<StoragePos> allPos = storagePosManager.findByStorage(storage.getId());
for (StoragePos storagePos : allPos for (StoragePos storagePos : allPos
...@@ -110,7 +110,7 @@ public class StoragePosController { ...@@ -110,7 +110,7 @@ public class StoragePosController {
if (storagePos != null) { if (storagePos != null) {
Barcode barcode = storagePos.getBarcode(); Barcode barcode = storagePos.getBarcode();
if (barcode != null) { if (barcode != null) {
throw new ValidateException("smfcode.cannotRemove", "删除库位失败,库位[{0}]中有料", new String[]{storagePos.getPosName()}); throw new ValidateException("smfcore.cannotRemove", "删除库位失败,库位[{0}]中有料", new String[]{storagePos.getPosName()});
} }
} }
} }
...@@ -131,7 +131,7 @@ public class StoragePosController { ...@@ -131,7 +131,7 @@ public class StoragePosController {
} }
Storage storage = dataCache.getStorage(cid); Storage storage = dataCache.getStorage(cid);
if (storage == null) { if (storage == null) {
throw new ValidateException("smfcode.valueNotFind", "未找到{0}[{1}]", new String[]{"cid", cid}); throw new ValidateException("smfcore.valueNotFind", "未找到{0}[{1}]", new String[]{"cid", cid});
} }
log.info("开始手动清空料仓[" + storage.getName() + "_" + storage.getCid() + "]的所有库位"); log.info("开始手动清空料仓[" + storage.getName() + "_" + storage.getCid() + "]的所有库位");
...@@ -195,11 +195,11 @@ public class StoragePosController { ...@@ -195,11 +195,11 @@ public class StoragePosController {
@PreAuthorize("@el.check('storagePos:edit')") @PreAuthorize("@el.check('storagePos:edit')")
public ResultBean enabledPos(@RequestBody StoragePosEnabledDto enabledDto) { public ResultBean enabledPos(@RequestBody StoragePosEnabledDto enabledDto) {
if (enabledDto.getId() == null) { if (enabledDto.getId() == null) {
throw new ValidateException("smfcode.valueCanotNull", "{0}不能为空", new String[]{"ID"}); throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"ID"});
} }
StoragePos pos = storagePosDao.findOneById(enabledDto.getId()); StoragePos pos = storagePosDao.findOneById(enabledDto.getId());
if (pos == null) { if (pos == null) {
throw new ValidateException("smfcode.valueNotFind", "未找到{0}[{1}]", new String[]{"PosId", enabledDto.getId()}); throw new ValidateException("smfcore.valueNotFind", "未找到{0}[{1}]", new String[]{"PosId", enabledDto.getId()});
// throw new ValidateException("未找到库位 "); // throw new ValidateException("未找到库位 ");
} }
pos.setEnabled(enabledDto.isEnabled()); pos.setEnabled(enabledDto.isEnabled());
...@@ -215,14 +215,14 @@ public class StoragePosController { ...@@ -215,14 +215,14 @@ public class StoragePosController {
@PreAuthorize("@el.check('storagePos:edit')") @PreAuthorize("@el.check('storagePos:edit')")
public ResponseEntity<Object> update(@Validated @RequestBody StoragePosSaveDto saveDto) { public ResponseEntity<Object> update(@Validated @RequestBody StoragePosSaveDto saveDto) {
if (saveDto.getId() == null) { if (saveDto.getId() == null) {
throw new ValidateException("smfcode.valueCanotNull", "{0}不能为空", new String[]{"ID"}); throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"ID"});
} }
if (saveDto.getPosName() == null) { if (saveDto.getPosName() == null) {
throw new ValidateException("smfcode.valueCanotNull", "{0}不能为空", new String[]{"ID"}); throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"ID"});
} }
StoragePos pos = storagePosDao.findOneById(saveDto.getId()); StoragePos pos = storagePosDao.findOneById(saveDto.getId());
if (pos == null) { if (pos == null) {
throw new ValidateException("smfcode.valueNotFind", "未找到{0}[{1}]", new String[]{"PosId", saveDto.getId()}); throw new ValidateException("smfcore.valueNotFind", "未找到{0}[{1}]", new String[]{"PosId", saveDto.getId()});
// throw new ValidateException("未找到库位 "); // throw new ValidateException("未找到库位 ");
} }
pos.setPosName(saveDto.getPosName()); pos.setPosName(saveDto.getPosName());
...@@ -249,7 +249,7 @@ public class StoragePosController { ...@@ -249,7 +249,7 @@ public class StoragePosController {
for (String id : ids) { for (String id : ids) {
if (id == null) { if (id == null) {
throw new ValidateException("smfcode.valueCanotNull", "{0}不能为空", new String[]{"ID"}); throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"ID"});
} }
} }
storagePosManager.deletePoss(ids); storagePosManager.deletePoss(ids);
...@@ -304,7 +304,7 @@ public class StoragePosController { ...@@ -304,7 +304,7 @@ public class StoragePosController {
public ResultBean checkout(@Validated @RequestBody CheckOutDto checkOutDto) { public ResultBean checkout(@Validated @RequestBody CheckOutDto checkOutDto) {
if (checkOutDto.getPids() == null) { if (checkOutDto.getPids() == null) {
throw new ValidateException("smfcode.valueCanotNull", "{0}不能为空", new String[]{"ID"}); throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"ID"});
} }
if (checkOutDto.getSingleOut() == null) { if (checkOutDto.getSingleOut() == null) {
checkOutDto.setSingleOut(true + ""); checkOutDto.setSingleOut(true + "");
...@@ -315,19 +315,19 @@ public class StoragePosController { ...@@ -315,19 +315,19 @@ public class StoragePosController {
for (String pid : checkOutDto.getPids()) { for (String pid : checkOutDto.getPids()) {
StoragePos pos = storagePosManager.get(pid); StoragePos pos = storagePosManager.get(pid);
if (pos == null) { if (pos == null) {
throw new ValidateException("smfcode.valueNotExist", "{0}[{1}]不存在", new String[]{"pid", pid}); throw new ValidateException("smfcore.valueNotExist", "{0}[{1}]不存在", new String[]{"pid", pid});
// throw new ValidateException("位置[" + pid + "]不存在"); // throw new ValidateException("位置[" + pid + "]不存在");
} }
Storage storage = dataCache.getStorageById(pos.getStorageId()); Storage storage = dataCache.getStorageById(pos.getStorageId());
if (storage == null) { if (storage == null) {
throw new ValidateException("smfcode.valueNotExist", "{0}[{1}]不存在", new String[]{"storageId", pos.getStorageId()}); throw new ValidateException("smfcore.valueNotExist", "{0}[{1}]不存在", new String[]{"storageId", pos.getStorageId()});
// throw new ValidateException("料仓[" + pos.getStorageId() + "]不存在"); // throw new ValidateException("料仓[" + pos.getStorageId() + "]不存在");
} }
log.info("出库料仓【" + storage.getName() + "_" + storage.getCid() + "】位置仓位【" + pos.getPosName() + "】"); log.info("出库料仓【" + storage.getName() + "_" + storage.getCid() + "】位置仓位【" + pos.getPosName() + "】");
String outResult = taskService.checkout(storage, pos, isSingleOut,SecurityUtils.getCurrentUsername()); String outResult = taskService.checkout(storage, pos, isSingleOut,SecurityUtils.getCurrentUsername());
if (!Strings.isNullOrEmpty(outResult)) { if (!Strings.isNullOrEmpty(outResult)) {
throw new ValidateException("smfcode.error", outResult); throw new ValidateException("smfcore.error", outResult);
} }
} }
return ResultBean.newOkResult(""); return ResultBean.newOkResult("");
...@@ -372,14 +372,14 @@ public class StoragePosController { ...@@ -372,14 +372,14 @@ public class StoragePosController {
dto.setAmount(codeBean.getBarcode().getAmount()); dto.setAmount(codeBean.getBarcode().getAmount());
if (!ObjectUtil.isEmpty(codeBean.getBarcode().getLockId())) { if (!ObjectUtil.isEmpty(codeBean.getBarcode().getLockId())) {
codeBean.setError("smfcode.error.barcode.locked", "库位[{0}]已被锁定"); codeBean.setError("smfcore.error.barcode.locked", "库位[{0}]已被锁定");
} }
// StoragePos pos = storagePosManager.getByPosName(dto.getPosName()); // StoragePos pos = storagePosManager.getByPosName(dto.getPosName());
// Storage storage = dataCache.getStorageById(pos.getStorageId()); // Storage storage = dataCache.getStorageById(pos.getStorageId());
// //判断是否已在出库中 // //判断是否已在出库中
// DataLog task = taskService.findExecutingTask(storage.getCid(), pos.getPosName()); // DataLog task = taskService.findExecutingTask(storage.getCid(), pos.getPosName());
// if (task == null) { // if (task == null) {
// codeBean.setError("smfcode.error.barcode.inQueue", new String[]{dto.getBarcode()}, "二维码[{0}]已在操作队列中"); // codeBean.setError("smfcore.error.barcode.inQueue", new String[]{dto.getBarcode()}, "二维码[{0}]已在操作队列中");
// } // }
} }
if (codeBean.getErrorCode() != null) { if (codeBean.getErrorCode() != null) {
...@@ -387,7 +387,7 @@ public class StoragePosController { ...@@ -387,7 +387,7 @@ public class StoragePosController {
dto.setError(error); dto.setError(error);
} }
} else { } else {
String error = MessageUtils.getText("smfcode.error.barcode.invalid", new String[]{code}, servletRequest.getLocale(), "{0}不是有效的条码"); String error = MessageUtils.getText("smfcore.error.barcode.invalid", new String[]{code}, servletRequest.getLocale(), "{0}不是有效的条码");
dto.setError(error); dto.setError(error);
} }
return dto; return dto;
......
...@@ -34,12 +34,12 @@ public class LabelManagerImpl implements ILabelManager { ...@@ -34,12 +34,12 @@ public class LabelManagerImpl implements ILabelManager {
logName = "修改标签:"; logName = "修改标签:";
} }
if (resources.getLabelName() == null) { if (resources.getLabelName() == null) {
throw new ValidateException("smfcode.valueCanotNull", "{0}不能为空", new String[]{"labelName"}); throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"labelName"});
} }
Query que = new Query(c); Query que = new Query(c);
List<Label> groups = findByQuery(que); List<Label> groups = findByQuery(que);
if (groups != null && groups.size() > 0) { if (groups != null && groups.size() > 0) {
throw new ValidateException("smfcode.valueAlreadyExist", "{0}[{1}]已存在", new String[]{"labelName", resources.getLabelName()}); throw new ValidateException("smfcore.valueAlreadyExist", "{0}[{1}]已存在", new String[]{"labelName", resources.getLabelName()});
} }
Label label = labelDao.save(resources); Label label = labelDao.save(resources);
return label; return label;
......
...@@ -277,7 +277,7 @@ public class StoragePosManagerImpl implements IStoragePosManager { ...@@ -277,7 +277,7 @@ public class StoragePosManagerImpl implements IStoragePosManager {
if(pos.getBarcode()==null||pos.getBarcode().equals("")) { if(pos.getBarcode()==null||pos.getBarcode().equals("")) {
}else{ }else{
throw new ValidateException("smfcode.thePosIsused"," 库位[{0}]有料[{1}],不能删除",new String[]{ pos.getPosName(),pos.getBarcode().getBarcode()}); throw new ValidateException("smfcore.thePosIsused"," 库位[{0}]有料[{1}],不能删除",new String[]{ pos.getPosName(),pos.getBarcode().getBarcode()});
// throw new BadRequestException("库位[" + pos.getPosName() + "]中有料[" + pos.getBarcode() + "],不能删除"); // throw new BadRequestException("库位[" + pos.getPosName() + "]中有料[" + pos.getBarcode() + "],不能删除");
} }
delPosName+="["+pos.getId()+"_"+pos.getPosName()+"]"; delPosName+="["+pos.getId()+"_"+pos.getPosName()+"]";
......
...@@ -34,7 +34,7 @@ public class ClientSettingsController { ...@@ -34,7 +34,7 @@ public class ClientSettingsController {
public ClientSettingDto getSettings(ClientSettingDto settingDto) { public ClientSettingDto getSettings(ClientSettingDto settingDto) {
if (settingDto == null || ObjectUtil.isEmpty(settingDto.getKey()) ) { if (settingDto == null || ObjectUtil.isEmpty(settingDto.getKey()) ) {
throw new ValidateException("smfcode.valueCanotNull", "{0}不能为空", new String[]{"key"}); throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"key"});
} }
//先查找自己的用户名,没找到时再找admin //先查找自己的用户名,没找到时再找admin
String userName = SecurityUtils.getCurrentUsername(); String userName = SecurityUtils.getCurrentUsername();
...@@ -58,7 +58,7 @@ public class ClientSettingsController { ...@@ -58,7 +58,7 @@ public class ClientSettingsController {
public ResultBean updateSettings(@RequestBody ClientSettingDto settingDto) { public ResultBean updateSettings(@RequestBody ClientSettingDto settingDto) {
if (settingDto == null || ObjectUtil.isEmpty(settingDto.getKey()) || ObjectUtil.isEmpty(settingDto.getValue())) { if (settingDto == null || ObjectUtil.isEmpty(settingDto.getKey()) || ObjectUtil.isEmpty(settingDto.getValue())) {
throw new ValidateException("smfcode.valueCanotNull", "{0}不能为空", new String[]{"key"}); throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"key"});
} }
String userName = SecurityUtils.getCurrentUsername(); String userName = SecurityUtils.getCurrentUsername();
String key = Constants.CACHE_clientSetting + "_" + userName + "_" + settingDto.getKey(); String key = Constants.CACHE_clientSetting + "_" + userName + "_" + settingDto.getKey();
......
...@@ -54,19 +54,19 @@ public class SettingsController { ...@@ -54,19 +54,19 @@ public class SettingsController {
// //
// if(settingsDto.getMaxHumidity()<=settingsDto.getMinHumidity()){ // if(settingsDto.getMaxHumidity()<=settingsDto.getMinHumidity()){
// //
// throw new ValidateException("smfcode.humidityValueError","温度范围数据错误" ); // throw new ValidateException("smfcore.humidityValueError","温度范围数据错误" );
//// throw new BadRequestException("温度范围数据错误"); //// throw new BadRequestException("温度范围数据错误");
// } // }
// if(settingsDto.getMaxHumidityShow()<=settingsDto.getMinHumidityShow()){ // if(settingsDto.getMaxHumidityShow()<=settingsDto.getMinHumidityShow()){
// throw new ValidateException("smfcode.humidityShowValueError","温度显示范围数据错误" ); // throw new ValidateException("smfcore.humidityShowValueError","温度显示范围数据错误" );
//// throw new BadRequestException("温度显示范围数据错误"); //// throw new BadRequestException("温度显示范围数据错误");
// } // }
// if(settingsDto.getMaxTemperature()<=settingsDto.getMinTemperature()){ // if(settingsDto.getMaxTemperature()<=settingsDto.getMinTemperature()){
// throw new ValidateException("smfcode.temperatureValueError","湿度范围数据错误" ); // throw new ValidateException("smfcore.temperatureValueError","湿度范围数据错误" );
//// throw new BadRequestException("湿度范围数据错误"); //// throw new BadRequestException("湿度范围数据错误");
// } // }
// if(settingsDto.getMaxTemperatureShow()<=settingsDto.getMinTemperatureShow()){ // if(settingsDto.getMaxTemperatureShow()<=settingsDto.getMinTemperatureShow()){
// throw new ValidateException("smfcode.temperatureShowValueError","湿度显示范围数据错误" ); // throw new ValidateException("smfcore.temperatureShowValueError","湿度显示范围数据错误" );
//// throw new BadRequestException("湿度显示范围数据错误"); //// throw new BadRequestException("湿度显示范围数据错误");
// } // }
// //
......
...@@ -95,7 +95,7 @@ public class TaskController { ...@@ -95,7 +95,7 @@ public class TaskController {
} }
User curruser = userManager.get(SecurityUtils.getCurrentUserId()); User curruser = userManager.get(SecurityUtils.getCurrentUserId());
if(!curruser.getGroups().contains(groupId)){ if(!curruser.getGroups().contains(groupId)){
throw new ValidateException("smfcode.nogroupaccess","没有组[{0}]的操作权限",new String[] {groupId}); throw new ValidateException("smfcore.nogroupaccess","没有组[{0}]的操作权限",new String[] {groupId});
} }
return getTaskList(groupId,null); return getTaskList(groupId,null);
} }
......
...@@ -160,10 +160,10 @@ public class TaskService { ...@@ -160,10 +160,10 @@ public class TaskService {
String posName = taskToExecute.getPosName(); String posName = taskToExecute.getPosName();
if (!Strings.isNullOrEmpty(barcode) && task.getBarcode().equals(barcode)) { if (!Strings.isNullOrEmpty(barcode) && task.getBarcode().equals(barcode)) {
log.info("二维码:[" + barcode + "]已在操作队列中,操作失败"); log.info("二维码:[" + barcode + "]已在操作队列中,操作失败");
throw new ValidateException("smfcode.error.barcode.inQueue", "二维码[{0}]已在操作队列中,操作失败", new String[]{barcode}); throw new ValidateException("smfcore.error.barcode.inQueue", "二维码[{0}]已在操作队列中,操作失败", new String[]{barcode});
} else if (task.getPosName().equals(posName)&& ObjectUtil.isNotEmpty(posName)) { } else if (task.getPosName().equals(posName)&& ObjectUtil.isNotEmpty(posName)) {
log.info("位置:[" + posName + "]已在操作队列中,操作失败"); log.info("位置:[" + posName + "]已在操作队列中,操作失败");
throw new ValidateException("smfcode.error.pos.inQueue", "位置:[{0}}]已在操作队列中,操作失败", new String[]{posName}); throw new ValidateException("smfcore.error.pos.inQueue", "位置:[{0}}]已在操作队列中,操作失败", new String[]{posName});
} }
} }
updateQueueTask(taskToExecute); updateQueueTask(taskToExecute);
...@@ -608,7 +608,7 @@ public class TaskService { ...@@ -608,7 +608,7 @@ public class TaskService {
} }
if (availbleStorageList.isEmpty()) { if (availbleStorageList.isEmpty()) {
throw new ValidateException("smfcode.noValidStorage", "料仓列表中未找到可用的料仓"); throw new ValidateException("smfcore.noValidStorage", "料仓列表中未找到可用的料仓");
} }
availbleStorageList.sort(new Comparator<Storage>() { availbleStorageList.sort(new Comparator<Storage>() {
...@@ -658,7 +658,7 @@ public class TaskService { ...@@ -658,7 +658,7 @@ public class TaskService {
private Barcode verifyBarcodePutIn(List<Storage> storageList, Barcode barcodeSave, String inRFID) throws ValidateException { private Barcode verifyBarcodePutIn(List<Storage> storageList, Barcode barcodeSave, String inRFID) throws ValidateException {
if (barcodeSave == null) { if (barcodeSave == null) {
throw new ValidateException("smfcode.error.barcode.invalid", "条码无效"); throw new ValidateException("smfcore.error.barcode.invalid", "条码无效");
} }
StoragePos pos; StoragePos pos;
...@@ -670,7 +670,7 @@ public class TaskService { ...@@ -670,7 +670,7 @@ public class TaskService {
pos = storagePosManager.getByBarcodeId(barcodeSave.getId()); pos = storagePosManager.getByBarcodeId(barcodeSave.getId());
if (barcodeSave.getAmount() <= 0) { if (barcodeSave.getAmount() <= 0) {
throw new ValidateException("smfcode.error.barcode.wrongQty", "条码[{0}]对应的数量<=0为: {1}", new String[]{barcodeSave.getBarcode(), barcodeSave.getAmount() + ""}); throw new ValidateException("smfcore.error.barcode.wrongQty", "条码[{0}]对应的数量<=0为: {1}", new String[]{barcodeSave.getBarcode(), barcodeSave.getAmount() + ""});
} }
} }
...@@ -680,7 +680,7 @@ public class TaskService { ...@@ -680,7 +680,7 @@ public class TaskService {
Storage storage = dataCache.getStorageById(pos.getStorageId()); Storage storage = dataCache.getStorageById(pos.getStorageId());
checkout(storage, pos, true, ""); checkout(storage, pos, true, "");
throw new ValidateException("smfcode.error.barcode.exist", "[{0}}]已在{1}}[{2}}]中", new String[]{barcodeSave.getBarcode(), storage.getName(), pos.getPosName()}); throw new ValidateException("smfcore.error.barcode.exist", "[{0}}]已在{1}}[{2}}]中", new String[]{barcodeSave.getBarcode(), storage.getName(), pos.getPosName()});
} }
Collection<DataLog> queueTasks = getQueueTasks(); Collection<DataLog> queueTasks = getQueueTasks();
...@@ -698,7 +698,7 @@ public class TaskService { ...@@ -698,7 +698,7 @@ public class TaskService {
return barcodeSave; return barcodeSave;
} }
} }
throw new ValidateException("smfcode.error.barcode.taskNotEnd", "料盘[{0}}]的操作未完成,无法执行入库操作", new String[]{barcodeSave.getBarcode()}); throw new ValidateException("smfcore.error.barcode.taskNotEnd", "料盘[{0}}]的操作未完成,无法执行入库操作", new String[]{barcodeSave.getBarcode()});
} }
} }
} }
......
...@@ -285,7 +285,7 @@ public class HellaServiceHandler extends IoHandlerAdapter implements ITaskListen ...@@ -285,7 +285,7 @@ public class HellaServiceHandler extends IoHandlerAdapter implements ITaskListen
String codeStr = command.getData().toString(); String codeStr = command.getData().toString();
CodeBean codeBean = codeResolve.resolveSingleCode(codeStr); CodeBean codeBean = codeResolve.resolveSingleCode(codeStr);
if(codeBean==null||codeBean.getBarcode()==null){ if(codeBean==null||codeBean.getBarcode()==null){
return ResultBean.newErrorResult(1,"smfcode.error.barcode.invalid","条码无效"); return ResultBean.newErrorResult(1,"smfcore.error.barcode.invalid","条码无效");
} }
if(ObjectUtil.isNotEmpty(codeBean.getErrorCode()) ){ if(ObjectUtil.isNotEmpty(codeBean.getErrorCode()) ){
return ResultBean.newErrorResult(1,codeBean.getErrorCode(),codeBean.getError(),codeBean.getParams()); return ResultBean.newErrorResult(1,codeBean.getErrorCode(),codeBean.getError(),codeBean.getParams());
......
...@@ -131,11 +131,11 @@ public class GroupController { ...@@ -131,11 +131,11 @@ public class GroupController {
public ResponseEntity<Object> update(@RequestBody GroupDto groupDto) { public ResponseEntity<Object> update(@RequestBody GroupDto groupDto) {
Group resources=groupMapper.toEntity(groupDto); Group resources=groupMapper.toEntity(groupDto);
if (resources.getId() == null) { if (resources.getId() == null) {
throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} ); throw new ValidateException("smfcore.valueCanotNull","{0}不能为空",new String[]{"ID"} );
} }
User curruser = userManager.get(SecurityUtils.getCurrentUserId()); User curruser = userManager.get(SecurityUtils.getCurrentUserId());
if(!curruser.hasGroup(resources.getId())){ if(!curruser.hasGroup(resources.getId())){
throw new ValidateException("smfcode.nogroupaccess","没有组[{0}]的操作权限",new String[] {resources.getGroupName()}); throw new ValidateException("smfcore.nogroupaccess","没有组[{0}]的操作权限",new String[] {resources.getGroupName()});
} }
groupManager.saveGroup(resources); groupManager.saveGroup(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT); return new ResponseEntity<>(HttpStatus.NO_CONTENT);
...@@ -148,27 +148,27 @@ public class GroupController { ...@@ -148,27 +148,27 @@ public class GroupController {
Set<Group> menuSet = new HashSet<>(); Set<Group> menuSet = new HashSet<>();
for (String id : ids) { for (String id : ids) {
if (id == null) { if (id == null) {
throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} ); throw new ValidateException("smfcore.valueCanotNull","{0}不能为空",new String[]{"ID"} );
} }
Group group = groupManager.get(id); Group group = groupManager.get(id);
if(group==null){ if(group==null){
throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"group"} ); throw new ValidateException("smfcore.valueCanotNull","{0}不能为空",new String[]{"group"} );
} }
User curruser = userManager.get(SecurityUtils.getCurrentUserId()); User curruser = userManager.get(SecurityUtils.getCurrentUserId());
if(!curruser.hasGroup(group.getId())){ if(!curruser.hasGroup(group.getId())){
throw new ValidateException("smfcode.nogroupaccess","没有组[{0}]的操作权限",new String[] {group.getGroupName()}); throw new ValidateException("smfcore.nogroupaccess","没有组[{0}]的操作权限",new String[] {group.getGroupName()});
} }
// //查找组下是否有设备 // //查找组下是否有设备
// Query query = new Query(Criteria.where("groupId").is(id)); // Query query = new Query(Criteria.where("groupId").is(id));
// List<Storage> storages = storageManager.findByQuery(query); // List<Storage> storages = storageManager.findByQuery(query);
// if (storages != null && storages.size() >= 1) { // if (storages != null && storages.size() >= 1) {
// throw new ValidateException("smfcode.groupWithStorage","组[{0}]已和设备关联",new String[]{group.getGroupName()}); // throw new ValidateException("smfcore.groupWithStorage","组[{0}]已和设备关联",new String[]{group.getGroupName()});
// } // }
// //
// Query userQuery = new Query(Criteria.where("groups").all(id)); // Query userQuery = new Query(Criteria.where("groups").all(id));
// List<User> users = userManager.findByQuery(userQuery); // List<User> users = userManager.findByQuery(userQuery);
// if (users != null && users.size() >= 1) { // if (users != null && users.size() >= 1) {
// throw new ValidateException("smfcode.groupWithUser","组[{0}]已和用户关联",new String[]{group.getGroupName()}); // throw new ValidateException("smfcore.groupWithUser","组[{0}]已和用户关联",new String[]{group.getGroupName()});
//// throw new ValidateException("删除失败,组[" + group.getGroupName() + "]已和用户关联"); //// throw new ValidateException("删除失败,组[" + group.getGroupName() + "]已和用户关联");
// } // }
//删除关联 //删除关联
......
...@@ -164,7 +164,7 @@ public class MenuController { ...@@ -164,7 +164,7 @@ public class MenuController {
public ResponseEntity<Object> update(@Validated @RequestBody MenuDto menuDto) { public ResponseEntity<Object> update(@Validated @RequestBody MenuDto menuDto) {
Menu resources=menuMapper.toEntity(menuDto); Menu resources=menuMapper.toEntity(menuDto);
if (resources.getId() == null) { if (resources.getId() == null) {
throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} ); throw new ValidateException("smfcore.valueCanotNull","{0}不能为空",new String[]{"ID"} );
} }
menuManager.saveMenu(resources); menuManager.saveMenu(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT); return new ResponseEntity<>(HttpStatus.NO_CONTENT);
...@@ -176,7 +176,7 @@ public class MenuController { ...@@ -176,7 +176,7 @@ public class MenuController {
@PreAuthorize("@el.check('menu:del')") @PreAuthorize("@el.check('menu:del')")
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) { public ResponseEntity<Object> delete(@RequestBody Set<String> ids) {
if(!SecurityUtils.getCurrentUsername().equals(Constants.SUPER_USERNAME)){ if(!SecurityUtils.getCurrentUsername().equals(Constants.SUPER_USERNAME)){
throw new ValidateException("smfcode.noAccessUpdate","没有删除菜单的权限"); throw new ValidateException("smfcore.noAccessUpdate","没有删除菜单的权限");
} }
Set<Menu> menuSet = new HashSet<>(); Set<Menu> menuSet = new HashSet<>();
for (String id : ids) { for (String id : ids) {
......
...@@ -109,7 +109,7 @@ public class RoleController { ...@@ -109,7 +109,7 @@ public class RoleController {
Role resources=roleMapper.toEntity(roleDto); Role resources=roleMapper.toEntity(roleDto);
Role role = roleManager.get(resources.getId()); Role role = roleManager.get(resources.getId());
if (resources.getId() == null) { if (resources.getId() == null) {
throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} ); throw new ValidateException("smfcore.valueCanotNull","{0}不能为空",new String[]{"ID"} );
} }
resources.setMenus(role.getMenus()); resources.setMenus(role.getMenus());
roleManager.saveRole(resources); roleManager.saveRole(resources);
...@@ -122,9 +122,9 @@ public class RoleController { ...@@ -122,9 +122,9 @@ public class RoleController {
public ResponseEntity<Object> updateMenu(@RequestBody RoleDto roleDto) { public ResponseEntity<Object> updateMenu(@RequestBody RoleDto roleDto) {
Role resources=roleMapper.toEntity(roleDto); Role resources=roleMapper.toEntity(roleDto);
if (resources.getId() == null) { if (resources.getId() == null) {
throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} ); throw new ValidateException("smfcore.valueCanotNull","{0}不能为空",new String[]{"ID"} );
} }
// throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} ); // throw new ValidateException("smfcore.valueCanotNull","{0}不能为空",new String[]{"ID"} );
Role role = roleManager.get(resources.getId()); Role role = roleManager.get(resources.getId());
//判断ID是否存在 //判断ID是否存在
...@@ -133,7 +133,7 @@ public class RoleController { ...@@ -133,7 +133,7 @@ public class RoleController {
Query query=new Query(Criteria.where("id").in(menuIds)); Query query=new Query(Criteria.where("id").in(menuIds));
List<Menu> menus=menuManager.findByQuery(query); List<Menu> menus=menuManager.findByQuery(query);
if(menus==null&&(menus.size()!=menuIds.size())){ if(menus==null&&(menus.size()!=menuIds.size())){
throw new ValidateException("smfcode.menuNotExist","菜单{0}不存在",new String[]{"ID"} ); throw new ValidateException("smfcore.menuNotExist","菜单{0}不存在",new String[]{"ID"} );
} }
roleManager.updateMenu(resources); roleManager.updateMenu(resources);
return new ResponseEntity<>(HttpStatus.OK); return new ResponseEntity<>(HttpStatus.OK);
...@@ -147,13 +147,13 @@ public class RoleController { ...@@ -147,13 +147,13 @@ public class RoleController {
List<Role> roles = new ArrayList<Role>(); List<Role> roles = new ArrayList<Role>();
for (String id : ids) { for (String id : ids) {
if (id == null) { if (id == null) {
throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} ); throw new ValidateException("smfcore.valueCanotNull","{0}不能为空",new String[]{"ID"} );
} }
Role role = roleManager.get(id); Role role = roleManager.get(id);
// 验证是否被用户关联 // 验证是否被用户关联
List<User> users = userManager.findByRoleId(role.getId()); List<User> users = userManager.findByRoleId(role.getId());
if (users != null && users.size() > 0) { if (users != null && users.size() > 0) {
throw new ValidateException("smfcode.roleCannotDel","角色[{0}]有[{1}]个用户关联改角色,不能删除",new String[]{role.getName(),users.size()+"" }); throw new ValidateException("smfcore.roleCannotDel","角色[{0}]有[{1}]个用户关联改角色,不能删除",new String[]{role.getName(),users.size()+"" });
} }
roles.add(role); roles.add(role);
} }
......
...@@ -103,15 +103,15 @@ public class UserController { ...@@ -103,15 +103,15 @@ public class UserController {
public ResponseEntity<Object> create(@Validated @RequestBody UserDto userDto) { public ResponseEntity<Object> create(@Validated @RequestBody UserDto userDto) {
User resources=userMapper.toEntity(userDto); User resources=userMapper.toEntity(userDto);
if (resources.getId() != null) { if (resources.getId() != null) {
throw new ValidateException("smfcode.valueAlreadyExist","{0}[{1}]已存在",new String[]{"ID",resources.getId()}); throw new ValidateException("smfcore.valueAlreadyExist","{0}[{1}]已存在",new String[]{"ID",resources.getId()});
// throw new ValidateException("新增用户:ID已存在"); // throw new ValidateException("新增用户:ID已存在");
} }
if(resources.getUsername()==null){ if(resources.getUsername()==null){
throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"username"} ); throw new ValidateException("smfcore.valueCanotNull","{0}不能为空",new String[]{"username"} );
// throw new ValidateException("新增用户:用户名不能为空"); // throw new ValidateException("新增用户:用户名不能为空");
} }
if(resources.getRoleId()==null){ if(resources.getRoleId()==null){
throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"roleId"} ); throw new ValidateException("smfcore.valueCanotNull","{0}不能为空",new String[]{"roleId"} );
// throw new ValidateException("新增用户:角色ID不能为空"); // throw new ValidateException("新增用户:角色ID不能为空");
} }
//判断用户名是否存在 //判断用户名是否存在
...@@ -139,13 +139,13 @@ public class UserController { ...@@ -139,13 +139,13 @@ public class UserController {
public ResponseEntity<Object> update(@Validated @RequestBody UserDto userDto) { public ResponseEntity<Object> update(@Validated @RequestBody UserDto userDto) {
User resources=userMapper.toEntity(userDto); User resources=userMapper.toEntity(userDto);
if (resources.getId() == null) { if (resources.getId() == null) {
throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} ); throw new ValidateException("smfcore.valueCanotNull","{0}不能为空",new String[]{"ID"} );
} }
if(resources.getUsername()==null){ if(resources.getUsername()==null){
throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"username"} ); throw new ValidateException("smfcore.valueCanotNull","{0}不能为空",new String[]{"username"} );
} }
if(resources.getRoleId()==null){ if(resources.getRoleId()==null){
throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"roleId"} ); throw new ValidateException("smfcore.valueCanotNull","{0}不能为空",new String[]{"roleId"} );
} }
userManager.update(resources); userManager.update(resources);
...@@ -158,7 +158,7 @@ public class UserController { ...@@ -158,7 +158,7 @@ public class UserController {
@PreAuthorize("@el.check('user:edit')") @PreAuthorize("@el.check('user:edit')")
public ResultBean resetPass( @RequestBody String id) { public ResultBean resetPass( @RequestBody String id) {
if (id == null) { if (id == null) {
throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} ); throw new ValidateException("smfcore.valueCanotNull","{0}不能为空",new String[]{"ID"} );
} }
User resources=userManager.get(id); User resources=userManager.get(id);
resources.setPassword(passwordEncoder.encode(Constants.USER_DEFAULTP_PWD)); resources.setPassword(passwordEncoder.encode(Constants.USER_DEFAULTP_PWD));
...@@ -178,7 +178,7 @@ public class UserController { ...@@ -178,7 +178,7 @@ public class UserController {
public ResultBean center(@Validated @RequestBody UserDto userDto) { public ResultBean center(@Validated @RequestBody UserDto userDto) {
User resources=userMapper.toEntity(userDto); User resources=userMapper.toEntity(userDto);
if (!resources.getId().equals(SecurityUtils.getCurrentUserId())) { if (!resources.getId().equals(SecurityUtils.getCurrentUserId())) {
throw new ValidateException("smfcode.hasNoAccess","无权限修改此用户信息" ); throw new ValidateException("smfcore.hasNoAccess","无权限修改此用户信息" );
// throw new ValidateException("不能修改他人资料"); // throw new ValidateException("不能修改他人资料");
} }
userManager.updateCenter(resources); userManager.updateCenter(resources);
...@@ -193,10 +193,10 @@ public class UserController { ...@@ -193,10 +193,10 @@ public class UserController {
String oldPass = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey, passVo.getOldPass()); String oldPass = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey, passVo.getOldPass());
String newPass = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey, passVo.getNewPass()); String newPass = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey, passVo.getNewPass());
if (!passwordEncoder.matches(oldPass, user.getPassword())) { if (!passwordEncoder.matches(oldPass, user.getPassword())) {
throw new ValidateException("smfcode.oldPwdError","修改失败,旧密码错误"); throw new ValidateException("smfcore.oldPwdError","修改失败,旧密码错误");
} }
if (passwordEncoder.matches(newPass, user.getPassword())) { if (passwordEncoder.matches(newPass, user.getPassword())) {
throw new ValidateException("smfcode.newPwdError","新密码不能与旧密码相同"); throw new ValidateException("smfcore.newPwdError","新密码不能与旧密码相同");
} }
userManager.updatePass(user.getUsername(), passwordEncoder.encode(newPass)); userManager.updatePass(user.getUsername(), passwordEncoder.encode(newPass));
return ResultBean.newOkResult(""); return ResultBean.newOkResult("");
...@@ -210,13 +210,13 @@ public class UserController { ...@@ -210,13 +210,13 @@ public class UserController {
//不能删除自己 //不能删除自己
String currId = SecurityUtils.getCurrentUserId(); String currId = SecurityUtils.getCurrentUserId();
if (currId == id) { if (currId == id) {
throw new ValidateException("smfcode.canotDelSelf","删除用户:不能删除自己"); throw new ValidateException("smfcore.canotDelSelf","删除用户:不能删除自己");
} }
User user = userManager.get(id); User user = userManager.get(id);
//admin的用户不让删除 //admin的用户不让删除
if ( user.getUsername().equals(Constants.SUPER_USERNAME)) { if ( user.getUsername().equals(Constants.SUPER_USERNAME)) {
throw new ValidateException("smfcode.canotDelUser","删除用户:此用户不能删除"); throw new ValidateException("smfcore.canotDelUser","删除用户:此用户不能删除");
// throw new ValidateException("删除用户:此用户不能删除"); // throw new ValidateException("删除用户:此用户不能删除");
} }
} }
...@@ -233,7 +233,7 @@ public class UserController { ...@@ -233,7 +233,7 @@ public class UserController {
// String password = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey, user.getPassword()); // String password = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey, user.getPassword());
// User myUser = userManager.findByUserName(SecurityUtils.getCurrentUsername()); // User myUser = userManager.findByUserName(SecurityUtils.getCurrentUsername());
// if (!passwordEncoder.matches(password, myUser.getPassword())) { // if (!passwordEncoder.matches(password, myUser.getPassword())) {
// throw new ValidateException("smfcode.pwdError","修改邮箱失败,密码错误"); // throw new ValidateException("smfcore.pwdError","修改邮箱失败,密码错误");
// } // }
//// verificationCodeService.validated(CodeEnum.EMAIL_RESET_EMAIL_CODE.getKey() + user.getEmail(), code); //// verificationCodeService.validated(CodeEnum.EMAIL_RESET_EMAIL_CODE.getKey() + user.getEmail(), code);
// userManager.updateEmail(myUser.getUsername(), myUser.getEmail()); // userManager.updateEmail(myUser.getUsername(), myUser.getEmail());
...@@ -245,7 +245,7 @@ public class UserController { ...@@ -245,7 +245,7 @@ public class UserController {
public ResponseEntity<Object> updateGroup(@RequestBody UserDto userDto) { public ResponseEntity<Object> updateGroup(@RequestBody UserDto userDto) {
User resources=userMapper.toEntity(userDto); User resources=userMapper.toEntity(userDto);
if (resources.getId() == null) { if (resources.getId() == null) {
throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} ); throw new ValidateException("smfcore.valueCanotNull","{0}不能为空",new String[]{"ID"} );
// throw new ValidateException("修改用户组:ID不能为空"); // throw new ValidateException("修改用户组:ID不能为空");
} }
User user = userManager.get(resources.getId()); User user = userManager.get(resources.getId());
...@@ -261,7 +261,7 @@ public class UserController { ...@@ -261,7 +261,7 @@ public class UserController {
String image = "csv"; String image = "csv";
String fileType = FileUtil.getExtensionName(uploadFile.getOriginalFilename()); String fileType = FileUtil.getExtensionName(uploadFile.getOriginalFilename());
if(fileType != null && !image.contains(fileType)){ if(fileType != null && !image.contains(fileType)){
throw new ValidateException("smfcode.feleFormatError","文件格式错误!, 仅支持{0}格式",new String[]{image}); throw new ValidateException("smfcore.feleFormatError","文件格式错误!, 仅支持{0}格式",new String[]{image});
} }
File folder = new File(properties.getPath(),"user"); File folder = new File(properties.getPath(),"user");
File file = FileUtil.upload(uploadFile, folder.getAbsolutePath()); File file = FileUtil.upload(uploadFile, folder.getAbsolutePath());
......
...@@ -76,16 +76,16 @@ public class UserDetailsServiceImpl implements UserDetailsService { ...@@ -76,16 +76,16 @@ public class UserDetailsServiceImpl implements UserDetailsService {
user = userManager.findByUserName(username); user = userManager.findByUserName(username);
} catch (EntityNotFoundException e) { } catch (EntityNotFoundException e) {
// SpringSecurity会自动转换UsernameNotFoundException为BadCredentialsException // SpringSecurity会自动转换UsernameNotFoundException为BadCredentialsException
throw new ValidateException("smfcode.valueNotExist","{0}[{1}]不存在",new String[]{"username",username}); throw new ValidateException("smfcore.valueNotExist","{0}[{1}]不存在",new String[]{"username",username});
} }
if (user == null) { if (user == null) {
throw new ValidateException("smfcode.valueNotExist","{0}[{1}]不存在",new String[]{"username",username}); throw new ValidateException("smfcore.valueNotExist","{0}[{1}]不存在",new String[]{"username",username});
} else { } else {
if(user.getEnabled()==null){ if(user.getEnabled()==null){
throw new ValidateException("smfcode.notActivated","账号未激活"); throw new ValidateException("smfcore.notActivated","账号未激活");
} }
if (!user.getEnabled()) { if (!user.getEnabled()) {
throw new ValidateException("smfcode.notActivated","账号未激活"); throw new ValidateException("smfcore.notActivated","账号未激活");
} }
if(user.getUsername().equals(Constants.SUPER_USERNAME)){ if(user.getUsername().equals(Constants.SUPER_USERNAME)){
...@@ -93,7 +93,7 @@ public class UserDetailsServiceImpl implements UserDetailsService { ...@@ -93,7 +93,7 @@ public class UserDetailsServiceImpl implements UserDetailsService {
//判断激活码是否正确 //判断激活码是否正确
String code = Md5Utls.getMd5(user.getId(), user.getCreateDate()); String code = Md5Utls.getMd5(user.getId(), user.getCreateDate());
if (!code.equals(user.getCheckCode())) { if (!code.equals(user.getCheckCode())) {
throw new ValidateException("smfcode.notActivated","账号未激活"); throw new ValidateException("smfcore.notActivated","账号未激活");
} }
} }
List<Long> dataScopes = new ArrayList<>(); List<Long> dataScopes = new ArrayList<>();
......
...@@ -54,14 +54,14 @@ public class GroupManagerImpl implements IGroupManager { ...@@ -54,14 +54,14 @@ public class GroupManagerImpl implements IGroupManager {
logName = "修改分组:"; logName = "修改分组:";
} }
if (resources.getGroupName() == null) { if (resources.getGroupName() == null) {
throw new ValidateException("smfcode.valueCanotNull", "{0}不能为空", new String[]{"groupName"}); throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"groupName"});
// throw new BadRequestException(logName+"组名称不能为空"); // throw new BadRequestException(logName+"组名称不能为空");
} }
Query que = new Query(c); Query que = new Query(c);
List<Group> groups = findByQuery(que); List<Group> groups = findByQuery(que);
if (groups != null && groups.size() > 0) { if (groups != null && groups.size() > 0) {
// throw new ValidateException(logName+"组名称[" + resources.getGroupName() + "]已存在"); // throw new ValidateException(logName+"组名称[" + resources.getGroupName() + "]已存在");
throw new ValidateException("smfcode.valueAlreadyExist", "{0}[{1}]已存在", new String[]{"groupname", resources.getGroupName()}); throw new ValidateException("smfcore.valueAlreadyExist", "{0}[{1}]已存在", new String[]{"groupname", resources.getGroupName()});
} }
Group group = groupDao.save(resources); Group group = groupDao.save(resources);
//同时将组添加到超级管理员用户的权限中 //同时将组添加到超级管理员用户的权限中
......
...@@ -266,11 +266,11 @@ public class MenuManagerImpl implements IMenuManager { ...@@ -266,11 +266,11 @@ public class MenuManagerImpl implements IMenuManager {
if(menu.getType()==null){ if(menu.getType()==null){
throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"Type"} ); throw new ValidateException("smfcore.valueCanotNull","{0}不能为空",new String[]{"Type"} );
// throw new BadRequestException("菜单类型不能为空"); // throw new BadRequestException("菜单类型不能为空");
} }
if(menu.getTitle()==null){ if(menu.getTitle()==null){
throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"Title"} ); throw new ValidateException("smfcore.valueCanotNull","{0}不能为空",new String[]{"Title"} );
// throw new BadRequestException( "菜单标题不能为空"); // throw new BadRequestException( "菜单标题不能为空");
} }
if(menu.getChildren()==null){ if(menu.getChildren()==null){
...@@ -307,7 +307,7 @@ public class MenuManagerImpl implements IMenuManager { ...@@ -307,7 +307,7 @@ public class MenuManagerImpl implements IMenuManager {
//菜单path不能重复 //菜单path不能重复
Menu pathMenu=menuDao.findOne(quer); Menu pathMenu=menuDao.findOne(quer);
if(pathMenu!=null){ if(pathMenu!=null){
throw new ValidateException("smfcode.valueAlreadyExist","{0}[{1}]已存在",new String[]{"path",pathMenu.getPath()}); throw new ValidateException("smfcore.valueAlreadyExist","{0}[{1}]已存在",new String[]{"path",pathMenu.getPath()});
// throw new BadRequestException("路径["+pathMenu+"]已存在"); // throw new BadRequestException("路径["+pathMenu+"]已存在");
} }
......
...@@ -80,7 +80,7 @@ public class RoleManagerImpl implements IRoleManager { ...@@ -80,7 +80,7 @@ public class RoleManagerImpl implements IRoleManager {
@Override @Override
public Role saveRole(Role role) throws ValidateException { public Role saveRole(Role role) throws ValidateException {
if(role.getName()==null){ if(role.getName()==null){
throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"name"} ); throw new ValidateException("smfcore.valueCanotNull","{0}不能为空",new String[]{"name"} );
// throw new BadRequestException("角色名称不能为空"); // throw new BadRequestException("角色名称不能为空");
} }
if (role.getMenus() == null) { if (role.getMenus() == null) {
...@@ -102,7 +102,7 @@ public class RoleManagerImpl implements IRoleManager { ...@@ -102,7 +102,7 @@ public class RoleManagerImpl implements IRoleManager {
log.error(logName+"[" + role.toString() + "]出错:角色名[" + role.getName() + "]已存在"); log.error(logName+"[" + role.toString() + "]出错:角色名[" + role.getName() + "]已存在");
// throw new ValidateException(logName+"角色名[" + role.getName() + "]已存在"); // throw new ValidateException(logName+"角色名[" + role.getName() + "]已存在");
throw new ValidateException("smfcode.valueAlreadyExist","{0}[{1}]已存在",new String[]{"name",role.getName()}); throw new ValidateException("smfcore.valueAlreadyExist","{0}[{1}]已存在",new String[]{"name",role.getName()});
} }
return roleDao.save(role); return roleDao.save(role);
} }
...@@ -111,12 +111,12 @@ public class RoleManagerImpl implements IRoleManager { ...@@ -111,12 +111,12 @@ public class RoleManagerImpl implements IRoleManager {
Role role=this.get(resources.getId()); Role role=this.get(resources.getId());
if(role==null){ if(role==null){
throw new ValidateException("smfcode.notSelRole","请要修改的选择角色"); throw new ValidateException("smfcore.notSelRole","请要修改的选择角色");
// throw new BadRequestException("请要修改的选择角色"); // throw new BadRequestException("请要修改的选择角色");
} }
if(role.getName().equals("admin")){ if(role.getName().equals("admin")){
if(!SecurityUtils.getCurrentUsername().equals(Constants.SUPER_USERNAME)){ if(!SecurityUtils.getCurrentUsername().equals(Constants.SUPER_USERNAME)){
throw new ValidateException("smfcode.noaccess","无权限修改此角色的菜单"); throw new ValidateException("smfcore.noaccess","无权限修改此角色的菜单");
// throw new BadRequestException("只有超级管理员才能修改此角色的菜单"); // throw new BadRequestException("只有超级管理员才能修改此角色的菜单");
} }
} }
......
...@@ -61,7 +61,7 @@ public class UserManagerImpl implements IUserManager { ...@@ -61,7 +61,7 @@ public class UserManagerImpl implements IUserManager {
} }
List<User> users=userDao.findByQuery(query); List<User> users=userDao.findByQuery(query);
if(users!=null&&users.size()>0){ if(users!=null&&users.size()>0){
throw new ValidateException("smfcode.valueAlreadyExist","{0}[{1}]已存在",new String[]{"userName",username}); throw new ValidateException("smfcore.valueAlreadyExist","{0}[{1}]已存在",new String[]{"userName",username});
} }
} }
@Override @Override
...@@ -84,7 +84,7 @@ public class UserManagerImpl implements IUserManager { ...@@ -84,7 +84,7 @@ public class UserManagerImpl implements IUserManager {
} }
if (user.getUsername().equals(Constants.SUPER_USERNAME)) { if (user.getUsername().equals(Constants.SUPER_USERNAME)) {
if (!user.getId().equals(SecurityUtils.getCurrentUserId())) { if (!user.getId().equals(SecurityUtils.getCurrentUserId())) {
throw new ValidateException("smfcode.hasNoAccess","无权限修改此用户信息" ); throw new ValidateException("smfcore.hasNoAccess","无权限修改此用户信息" );
// throw new ValidateException("无权限修改此用户信息"); // throw new ValidateException("无权限修改此用户信息");
} }
} }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!