Commit 6adc0672 LN

手动出库功能

1 个父辈 94b2abde
......@@ -497,7 +497,7 @@ public class BarcodeRule {
}
codeBean.setCodeStr(codeStr);
if(!isValidRule()){
codeBean.setError("error.barcode.noRule","解析规则未定义");
codeBean.setError("smfcode.error.barcode.noRule","解析规则未定义");
return codeBean;
}
String[] codeArr = new String[]{codeStr};
......@@ -506,7 +506,7 @@ public class BarcodeRule {
//条码与规则长度对应不上
if(codeArr.length != length){
log.info("条码["+codeStr+"]与规则【"+ruleStr+"】长度不同");
codeBean.setError("error.barcode.wrongLength",new String[]{}, "条码["+codeStr+"]长度错误");
codeBean.setError("smfcode.error.barcode.wrongLength",new String[]{codeStr}, "条码[{0}]长度错误");
return codeBean;
}else{
codeArr = codeStr.split(separator,length);
......@@ -525,7 +525,7 @@ public class BarcodeRule {
if(Strings.isNullOrEmpty(reelId)){
log.info("条码解析失败,未找到RI字段");
codeBean.setError("error.barcode.noField",new String[]{"RI"},"条码解析失败,未找到RI字段");
codeBean.setError("smfcode.error.barcode.noField",new String[]{"RI"},"条码解析失败,未找到{0}字段");
return codeBean;
}
......@@ -533,7 +533,7 @@ public class BarcodeRule {
if(Strings.isNullOrEmpty(partNumber)){
log.info("条码解析失败,未找到PN字段");
codeBean.setError("error.barcode.noField",new String[]{"PN"}, "条码解析失败,未找到PN字段");
codeBean.setError("smfcode.error.barcode.noField",new String[]{"PN"}, "条码解析失败,未找到{0}字段");
return codeBean;
}
if(batch_item.hasThisField()){
......@@ -545,7 +545,7 @@ public class BarcodeRule {
quantity = quantity_item.getIntValue(codeArr);
if(quantity == -1){
log.info("条码解析失败,未找到QTY 字段");
codeBean.setError("error.barcode.noField",new String[]{"QTY"},"条码解析失败,未找到QTY 字段");
codeBean.setError("smfcode.error.barcode.noField",new String[]{"QTY"},"条码解析失败,未找到{0}字段");
return codeBean;
}
}
......@@ -553,7 +553,7 @@ public class BarcodeRule {
Date produceDate= produceDate_item.getDateValue(codeArr);
if(produceDate_item.hasThisField() && produceDate == null){
log.info("条码解析失败,PRODATE字段不合规则");
codeBean.setError("error.barcode.noField",new String[]{"PRODATE"},"条码解析失败,未找到PRODATE字段");
codeBean.setError("smfcode.error.barcode.noField",new String[]{"PRODATE"},"条码解析失败,未找到{0}字段");
return codeBean;
}
Date expireDate= expireDate_item.getDateValue(codeArr);
......
......@@ -4,7 +4,9 @@ import com.google.common.collect.Lists;
import com.neotel.smfcore.core.barcode.enums.BARCODE_STATUS;
import com.neotel.smfcore.core.barcode.enums.COMPONENT_TYPE;
import com.neotel.smfcore.core.barcode.enums.SOLDER_STATUS;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
......@@ -30,10 +32,16 @@ public class CodeDto implements Serializable {
@ApiModelProperty("高度")
private int height=0;
/**
* 原始条码
*/
@ApiModelProperty("原始条码")
private String fullCode;
@ApiModelProperty("库位信息/仓位")
private String posName;
@ApiModelProperty("数量")
private int amount;
@ApiModelProperty("错误提示")
private String error;
}
......@@ -50,7 +50,7 @@ public class CodeResolve {
if(barcodeRuleList == null || barcodeRuleList.isEmpty()){
CodeBean codeBean = new CodeBean();
codeBean.setBarcode(null);
codeBean.setError("error.barcode.noRules", "解析规则未定义");
codeBean.setError("smfcode.error.barcode.noRules", "解析规则未定义");
codeBean.setCodeStr(barcodeItemStr);
return codeBean;
}
......@@ -199,21 +199,21 @@ public class CodeResolve {
}
}catch (ValidateException ve){
//档案不存在
codeBeanFromRule.setError("error.barcode.pnNotExist",new String[]{barcodeFromRule.getPartNumber()},"x档案 "+barcodeFromRule.getPartNumber()+" 不存在");
log.warn("x档案"+barcodeFromRule.getPartNumber()+"不存在");
codeBeanFromRule.setError("smfcode.error.barcode.pnNotExist",new String[]{barcodeFromRule.getPartNumber()},"档案 {0} 不存在");
log.warn("档案"+barcodeFromRule.getPartNumber()+"不存在");
}
//解析成功了,直接返回
return codeBeanFromRule;
}else{
//在数据库中不存在,且未解析成功,用其他规则再解析
codeBeanFromRule.setError("error.barcode.invalid",new String[]{barcodeItemStr}, barcodeItemStr + "不是有效的条码");
codeBeanFromRule.setError("smfcode.error.barcode.invalid",new String[]{barcodeItemStr}, "{0}不是有效的条码");
}
}
if(codeBeanFromRule == null){
codeBeanFromRule = new CodeBean();
codeBeanFromRule.setBarcode(null);
codeBeanFromRule.setError("error.barcode.invalid",new String[]{barcodeItemStr}, barcodeItemStr + "不是有效的条码");
codeBeanFromRule.setError("smfcode.error.barcode.invalid",new String[]{barcodeItemStr}, "{0}不是有效的条码");
codeBeanFromRule.setCodeStr(barcodeItemStr);
return codeBeanFromRule;
}
......
......@@ -7,8 +7,11 @@ import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.QueryHelp;
import com.neotel.smfcore.common.utils.SecurityUtils;
import com.neotel.smfcore.common.utils.StorageConstants;
import com.neotel.smfcore.core.barcode.enums.COMPONENT_TYPE;
import com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager;
import com.neotel.smfcore.core.barcode.service.po.Barcode;
import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.core.storage.bean.InventoryItem;
import com.neotel.smfcore.core.storage.rest.dto.*;
......@@ -21,6 +24,7 @@ import com.neotel.smfcore.core.storage.service.manager.IStoragePosManager;
import com.neotel.smfcore.core.storage.service.po.Label;
import com.neotel.smfcore.core.storage.service.po.Storage;
import com.neotel.smfcore.core.storage.service.po.StoragePos;
import com.neotel.smfcore.core.system.service.po.DataLog;
import com.neotel.smfcore.core.system.util.TaskService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -61,6 +65,9 @@ public class MaterialController {
@Autowired
private final ILabelManager labelManager;
@Autowired
private final IBarcodeManager barcodeManager;
@ApiOperation("策略出库获取库存列表")
@GetMapping(value = "/inventory")
@PreAuthorize("@el.check('tacticsOuput')")
......@@ -153,20 +160,20 @@ public class MaterialController {
@PostMapping(value = "/labelOuput")
@PreAuthorize("@el.check('labelOuput')")
public ResultBean labelOuput(@RequestBody PosLabelDto params) {
List<String> posIds=params.getPosIds();
List<String> posIds = params.getPosIds();
if (posIds == null) {
throw new ValidateException("smfcode.valueCanotNull", "{0}不能为空", new String[]{"PN"});
}
for (String posId:posIds){
for (String posId : posIds) {
StoragePos pos = storagePosManager.get(posId);
if (pos == null) {
throw new ValidateException("smfcode.valueNotExist","{0}[{1}]不存在",new String[]{"posId",posId});
throw new ValidateException("smfcode.valueNotExist", "{0}[{1}]不存在", new String[]{"posId", posId});
}
Storage storage = dataCache.getStorageById(pos.getStorageId());
if (storage == null) {
throw new ValidateException("smfcode.valueNotExist","{0}[{1}]不存在",new String[]{"storageId",pos.getStorageId()});
throw new ValidateException("smfcode.valueNotExist", "{0}[{1}]不存在", new String[]{"storageId", pos.getStorageId()});
}
log.info("出库料仓【" + storage.getName() + "_" + storage.getCid() + "】位置仓位【" + pos.getPosName() + "】");
......@@ -187,17 +194,48 @@ public class MaterialController {
// List<String> posIds=(List<String>) params.get("posIds");
// String labelId = params.get("labelId").toString();
List<String> posIds=params.getPosIds();
String labelId =params.getLabelId();
if(posIds==null||posIds.size()<=0){
List<String> posIds = params.getPosIds();
String labelId = params.getLabelId();
if (posIds == null || posIds.size() <= 0) {
throw new ValidateException("smfcode.valueCanotNull", "{0}不能为空", new String[]{"ID"});
}
if(ObjectUtil.isEmpty(labelId)){
labelId="";
if (ObjectUtil.isEmpty(labelId)) {
labelId = "";
}
String[] array= posIds.toArray(new String[posIds.size()]) ;
storagePosManager.updatePosLabel(array,labelId);
String[] array = posIds.toArray(new String[posIds.size()]);
storagePosManager.updatePosLabel(array, labelId);
return ResultBean.newOkResult("");
}
@ApiOperation("手动出库")
@PostMapping(value = "/manualOut")
@PreAuthorize("@el.check('manualOut')")
public ResultBean manualOut(@RequestBody Map<String, String> paramMap) {
String code = paramMap.get("barcode");
Barcode barcode = barcodeManager.findByBarcode(code);
StoragePos storagePos = storagePosManager.getByBarcode(code);
if (storagePos != null) {
if (!ObjectUtil.isEmpty(storagePos.getBarcode().getLockId())) {
throw new ValidateException("smfcode.error.barcode.locked", "库位[{0}]已被锁定");
}
try {
if (barcode != null) {
String opUser = SecurityUtils.getCurrentUsername();
log.info(opUser + "清理库位[" + storagePos.getPosName() + "],条码[" + code + "]中的库存" + barcode.getBarcode());
taskService.addTaskToFinished(storagePos, null, opUser + "-manual");
} else {
log.info("清理库位[" + storagePos.getPosName() + "],条码[" + code + "],库位条码为空");
}
return ResultBean.newOkResult("smfcode.manualOut.ok", "手动出库成功", code);
} catch (Exception e) {
return ResultBean.newOkResult("smfcore.error", "出错{0}", new String[]{e.getMessage()}, code);
}
} else {
throw new ValidateException("smfcode.manualOut.notFound", "仓库中未找到料盘信息");
}
}
}
package com.neotel.smfcore.core.storage.rest;
import cn.hutool.core.util.ObjectUtil;
import com.google.common.base.Strings;
import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.bean.ResultBean;
......@@ -8,12 +9,14 @@ import com.neotel.smfcore.common.utils.Constants;
import com.neotel.smfcore.common.utils.QueryHelp;
import com.neotel.smfcore.common.utils.SecurityUtils;
import com.neotel.smfcore.common.utils.StorageConstants;
import com.neotel.smfcore.core.barcode.bean.CodeBean;
import com.neotel.smfcore.core.barcode.enums.COMPONENT_TYPE;
import com.neotel.smfcore.core.barcode.rest.bean.dto.CodeDto;
import com.neotel.smfcore.core.barcode.rest.bean.mapstruct.CodeMapper;
import com.neotel.smfcore.core.barcode.service.po.Barcode;
import com.neotel.smfcore.core.barcode.utils.CodeResolve;
import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.core.language.util.MessageUtils;
import com.neotel.smfcore.core.storage.rest.dto.CheckOutDto;
import com.neotel.smfcore.core.storage.rest.dto.StoragePosDto;
import com.neotel.smfcore.core.storage.rest.dto.StoragePosEnabledDto;
......@@ -25,11 +28,13 @@ import com.neotel.smfcore.core.storage.service.dao.IStoragePosDao;
import com.neotel.smfcore.core.storage.service.manager.IStoragePosManager;
import com.neotel.smfcore.core.storage.service.po.Storage;
import com.neotel.smfcore.core.storage.service.po.StoragePos;
import com.neotel.smfcore.core.system.service.po.DataLog;
import com.neotel.smfcore.core.system.util.TaskService;
import com.neotel.smfcore.security.annotation.AnonymousAccess;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import net.bytebuddy.asm.Advice;
......@@ -61,7 +66,7 @@ public class StoragePosController {
@Autowired
private final StoragePosMapper storagePosMapper;
@Autowired
private DataCache dataCache;
private DataCache dataCache;
@Autowired
private TaskService taskService;
......@@ -72,35 +77,34 @@ public class StoragePosController {
private CodeMapper codeMapper;
@ApiOperation("查询库位")
@GetMapping
@PreAuthorize("@el.check('storagePos:list')")
public PageData<StoragePosDto> query(StoragePosQueryCriteria criteria, Pageable pageable){
if(criteria.getStorageIdList()!=null&&criteria.getStorageIdList().contains("0")){
public PageData<StoragePosDto> query(StoragePosQueryCriteria criteria, Pageable pageable) {
if (criteria.getStorageIdList() != null && criteria.getStorageIdList().contains("0")) {
criteria.setStorageIdList(null);
}
Query query= QueryHelp.getQuery(criteria);
PageData<StoragePos> pages=storagePosManager.findByPage(query,pageable);
List<StoragePosDto> StoragePosDtos=storagePosMapper.toDto(pages.getContent());
return new PageData(StoragePosDtos,pages.getTotalElements());
Query query = QueryHelp.getQuery(criteria);
PageData<StoragePos> pages = storagePosManager.findByPage(query, pageable);
List<StoragePosDto> StoragePosDtos = storagePosMapper.toDto(pages.getContent());
return new PageData(StoragePosDtos, pages.getTotalElements());
}
@ApiOperation("删除指定料仓所有库位")
@PutMapping("/removeAllPos")
@PreAuthorize("@el.check('storagePos:edit')")
public ResultBean clearAllPos(@RequestBody Map<String,String> map) {
String cid="";
if(map.containsKey("cid")){
cid= map.get("cid");
public ResultBean clearAllPos(@RequestBody Map<String, String> map) {
String cid = "";
if (map.containsKey("cid")) {
cid = map.get("cid");
}
Storage storage=dataCache.getStorage(cid);
if(storage==null){
throw new ValidateException("smfcode.valueNotFind","未找到{0}[{1}]" ,new String[]{"cid", cid});
Storage storage = dataCache.getStorage(cid);
if (storage == null) {
throw new ValidateException("smfcode.valueNotFind", "未找到{0}[{1}]", new String[]{"cid", cid});
}
List<StoragePos> allPos=storagePosManager.findByStorage(storage.getId());
for (StoragePos storagePos:allPos
List<StoragePos> allPos = storagePosManager.findByStorage(storage.getId());
for (StoragePos storagePos : allPos
) {
if (storagePos != null) {
Barcode barcode = storagePos.getBarcode();
......@@ -110,29 +114,29 @@ public class StoragePosController {
}
}
log.info("开始删除料仓["+cid+"] 所有位置");
log.info("开始删除料仓[" + cid + "] 所有位置");
storagePosManager.removePosByStorageId(storage.getId());
log.info("删除料仓["+cid+"] 所有位置完成");
log.info("删除料仓[" + cid + "] 所有位置完成");
return ResultBean.newOkResult("");
}
@ApiOperation("清空指定料仓所有库位")
@PutMapping("/clearStoragePos")
@PreAuthorize("@el.check('storagePos:edit')")
public ResultBean clearStoragePos(@RequestBody Map<String,String> map) {
String cid="";
if(map.containsKey("cid")){
cid= map.get("cid");
public ResultBean clearStoragePos(@RequestBody Map<String, String> map) {
String cid = "";
if (map.containsKey("cid")) {
cid = map.get("cid");
}
Storage storage = dataCache.getStorage(cid);
if(storage==null){
throw new ValidateException("smfcode.valueNotFind","未找到{0}[{1}]" ,new String[]{"cid", cid});
if (storage == null) {
throw new ValidateException("smfcode.valueNotFind", "未找到{0}[{1}]", new String[]{"cid", cid});
}
log.info("开始手动清空料仓["+storage.getName()+"_"+storage.getCid()+"]的所有库位");
List<StoragePos> allPos=storagePosManager.findByStorage(storage.getId());
for (StoragePos storagePos:allPos
) {
log.info("开始手动清空料仓[" + storage.getName() + "_" + storage.getCid() + "]的所有库位");
List<StoragePos> allPos = storagePosManager.findByStorage(storage.getId());
for (StoragePos storagePos : allPos
) {
if (storagePos != null) {
try {
// QisdaApi.ClearStockBy(storagePos.getPosName());
......@@ -145,7 +149,7 @@ public class StoragePosController {
taskService.addTaskToFinished(storagePos, null, opUser + "-clear");
}
} catch (Exception e) {
throw new ValidateException("smfcore.error","出错{0}",new String[]{"["+storagePos.getPosName()+"]"+ e.toString()});
throw new ValidateException("smfcore.error", "出错{0}", new String[]{"[" + storagePos.getPosName() + "]" + e.toString()});
}
}
}
......@@ -158,7 +162,7 @@ public class StoragePosController {
@ApiOperation("清空指定库位")
@PutMapping("/clearPos")
@PreAuthorize("@el.check('storagePos:edit')")
public ResultBean clearPos(@RequestBody HashMap<String,String> map) {
public ResultBean clearPos(@RequestBody HashMap<String, String> map) {
if (map.containsKey("posName")) {
String posName = map.get("posName");
......@@ -178,7 +182,7 @@ public class StoragePosController {
return ResultBean.newOkResult("");
} catch (Exception e) {
// return e.getMessage();
throw new ValidateException("smfcore.error","出错{0}",new String[]{ e.toString()});
throw new ValidateException("smfcore.error", "出错{0}", new String[]{e.toString()});
}
}
}
......@@ -189,36 +193,35 @@ public class StoragePosController {
@PutMapping("/enabledPos")
@PreAuthorize("@el.check('storagePos:edit')")
public ResultBean enabledPos(@RequestBody StoragePosEnabledDto enabledDto) {
if(enabledDto.getId()==null){
throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} );
if (enabledDto.getId() == null) {
throw new ValidateException("smfcode.valueCanotNull", "{0}不能为空", new String[]{"ID"});
}
StoragePos pos=storagePosDao.findOneById(enabledDto.getId());
if(pos==null){
throw new ValidateException("smfcode.valueNotFind","未找到{0}[{1}]" ,new String[]{"PosId", enabledDto.getId()});
StoragePos pos = storagePosDao.findOneById(enabledDto.getId());
if (pos == null) {
throw new ValidateException("smfcode.valueNotFind", "未找到{0}[{1}]", new String[]{"PosId", enabledDto.getId()});
// throw new ValidateException("未找到库位 ");
}
pos.setEnabled(enabledDto.isEnabled());
storagePosDao.save(pos);
log.info("启用禁用库位:库位号["+pos.getId()+"]["+pos.getPosName()+"]="+enabledDto.isEnabled());
log.info("启用禁用库位:库位号[" + pos.getId() + "][" + pos.getPosName() + "]=" + enabledDto.isEnabled());
return ResultBean.newOkResult("");
}
@ApiOperation("修改库位")
@PutMapping
@PreAuthorize("@el.check('storagePos:edit')")
public ResponseEntity<Object> update(@Validated @RequestBody StoragePosSaveDto saveDto) {
if(saveDto.getId()==null){
throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} );
if (saveDto.getId() == null) {
throw new ValidateException("smfcode.valueCanotNull", "{0}不能为空", new String[]{"ID"});
}
if(saveDto.getPosName()==null){
throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} );
if (saveDto.getPosName() == null) {
throw new ValidateException("smfcode.valueCanotNull", "{0}不能为空", new String[]{"ID"});
}
StoragePos pos=storagePosDao.findOneById(saveDto.getId());
if(pos==null){
throw new ValidateException("smfcode.valueNotFind","未找到{0}[{1}]" ,new String[]{"PosId", saveDto.getId()});
StoragePos pos = storagePosDao.findOneById(saveDto.getId());
if (pos == null) {
throw new ValidateException("smfcode.valueNotFind", "未找到{0}[{1}]", new String[]{"PosId", saveDto.getId()});
// throw new ValidateException("未找到库位 ");
}
pos.setPosName(saveDto.getPosName());
......@@ -226,11 +229,11 @@ public class StoragePosController {
pos.setH(saveDto.getH());
pos.setW(saveDto.getW());
storagePosDao.save(pos);
log.info("修改库位:库位号["+pos.getId()+"]=["+saveDto.toString()+"]");
log.info("修改库位:库位号[" + pos.getId() + "]=[" + saveDto.toString() + "]");
return new ResponseEntity<>(HttpStatus.OK);
}
// @ApiOperation("新增库位")
// @ApiOperation("新增库位")
// @PostMapping
// @PreAuthorize("@el.check('storage:add')")
// public ResponseEntity<Object> create(@Validated @RequestBody StoragePosDto resources) {
......@@ -245,7 +248,7 @@ public class StoragePosController {
for (String id : ids) {
if (id == null) {
throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} );
throw new ValidateException("smfcode.valueCanotNull", "{0}不能为空", new String[]{"ID"});
}
}
storagePosManager.deletePoss(ids);
......@@ -255,22 +258,22 @@ public class StoragePosController {
@ApiOperation("查找出库列表")
@GetMapping("/find")
@PreAuthorize("@el.check('checkOut')")
public PageData<StoragePosDto> storagePosFind(StoragePosFindCriteria criteria, Pageable pageable,HttpServletRequest request){
if(criteria.getStorageId()!=null&&criteria.getStorageId().equals("0")){
public PageData<StoragePosDto> storagePosFind(StoragePosFindCriteria criteria, Pageable pageable, HttpServletRequest request) {
if (criteria.getStorageId() != null && criteria.getStorageId().equals("0")) {
criteria.setStorageId(null);
}
Query query= QueryHelp.getQuery(criteria);
Criteria baseCriteria= Criteria.where("used").is(true);
Query query = QueryHelp.getQuery(criteria);
Criteria baseCriteria = Criteria.where("used").is(true);
int componentType = criteria.getType();
String name="";
if(componentType != -1){
String name = "";
if (componentType != -1) {
int type = componentType;
request.setAttribute("type", componentType);
if(componentType == 41){//锡膏夹具
if (componentType == 41) {//锡膏夹具
type = COMPONENT_TYPE.FIXTURE;
name = StorageConstants.PACKAGE_TYPE.SOLDER_FIXTURE.getCode();
}else if(componentType == 42){//PCB夹具
} else if (componentType == 42) {//PCB夹具
type = COMPONENT_TYPE.FIXTURE;
name = StorageConstants.PACKAGE_TYPE.PCB_FIXTURE.getCode();
}
......@@ -279,20 +282,20 @@ public class StoragePosController {
String expire = criteria.getExpire();
if(!Strings.isNullOrEmpty(expire)){
if("solder".equalsIgnoreCase(expire)){
if (!Strings.isNullOrEmpty(expire)) {
if ("solder".equalsIgnoreCase(expire)) {
baseCriteria.and("barcode.expTime").lte(new Date());
}else if("pcb".equalsIgnoreCase(expire)){
} else if ("pcb".equalsIgnoreCase(expire)) {
baseCriteria.and("barcode.expireDate").lte(new Date());
}
request.setAttribute("expire",expire);
request.setAttribute("expire", expire);
}
query.addCriteria(baseCriteria);
PageData<StoragePos> pages=storagePosManager.findByPage(query,pageable);
List<StoragePosDto> StoragePosDtos=storagePosMapper.toDto(pages.getContent());
return new PageData(StoragePosDtos,pages.getTotalElements());
PageData<StoragePos> pages = storagePosManager.findByPage(query, pageable);
List<StoragePosDto> StoragePosDtos = storagePosMapper.toDto(pages.getContent());
return new PageData(StoragePosDtos, pages.getTotalElements());
}
@ApiOperation("查找出库")
......@@ -300,10 +303,10 @@ public class StoragePosController {
public ResultBean checkout(@Validated @RequestBody CheckOutDto checkOutDto) {
if (checkOutDto.getPids() == null) {
throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} );
throw new ValidateException("smfcode.valueCanotNull", "{0}不能为空", new String[]{"ID"});
}
if(checkOutDto.getSingleOut()==null){
checkOutDto.setSingleOut(true+"");
if (checkOutDto.getSingleOut() == null) {
checkOutDto.setSingleOut(true + "");
}
String isSingleOutStr = checkOutDto.getSingleOut();
boolean isSingleOut = Boolean.valueOf(isSingleOutStr);
......@@ -312,12 +315,12 @@ public class StoragePosController {
for (String pid : checkOutDto.getPids()) {
StoragePos pos = storagePosManager.get(pid);
if (pos == null) {
throw new ValidateException("smfcode.valueNotExist","{0}[{1}]不存在",new String[]{"pid",pid});
throw new ValidateException("smfcode.valueNotExist", "{0}[{1}]不存在", new String[]{"pid", pid});
// throw new ValidateException("位置[" + pid + "]不存在");
}
Storage storage = dataCache.getStorageById(pos.getStorageId());
if (storage == null) {
throw new ValidateException("smfcode.valueNotExist","{0}[{1}]不存在",new String[]{"storageId",pos.getStorageId()});
throw new ValidateException("smfcode.valueNotExist", "{0}[{1}]不存在", new String[]{"storageId", pos.getStorageId()});
// throw new ValidateException("料仓[" + pos.getStorageId() + "]不存在");
}
......@@ -333,17 +336,61 @@ public class StoragePosController {
@ApiOperation("解析出库条码")
@PutMapping("/resolveCode/{blurry}")
public CodeDto resolveCode(@PathVariable String blurry){
public CodeDto resolveCode(@PathVariable String blurry) {
String barcodeStr=blurry;
Barcode barcode=codeResolve.resolveCode(barcodeStr);
if(barcode==null){
String barcodeStr = blurry;
Barcode barcode = codeResolve.resolveCode(barcodeStr);
if (barcode == null) {
return null;
}else{
CodeDto dto=codeMapper.toDto(barcode);
log.info("resolveCode ["+barcodeStr+"]=["+dto.toString()+"]");
} else {
CodeDto dto = codeMapper.toDto(barcode);
log.info("resolveCode [" + barcodeStr + "]=[" + dto.toString() + "]");
return dto;
}
}
@ApiOperation("手动出库解析条码")
@PutMapping(value = "/resolveBarcode")
public CodeDto resolveBarcode(@RequestBody String code, HttpServletRequest servletRequest) {
// String code = paramMap.get("code");
CodeBean codeBean = new CodeBean();
try {
codeBean = codeResolve.resolveSingleCode(code);
} catch (ValidateException e) {
codeBean.setError(e.getMessage());
}
CodeDto dto = new CodeDto();
if (codeBean != null) {
dto.setFullCode(code);
dto.setHeight(codeBean.getReelHeight());
dto.setPlateSize(codeBean.getReelWidth());
if (codeBean.getBarcode() != null) {
dto.setBarcode(codeBean.getBarcode().getBarcode());
dto.setPartNumber(codeBean.getBarcode().getPartNumber());
dto.setPosName(codeBean.getBarcode().getPosName());
dto.setAmount(codeBean.getBarcode().getAmount());
if (!ObjectUtil.isEmpty(codeBean.getBarcode().getLockId())) {
codeBean.setError("smfcode.error.barcode.locked", "库位[{0}]已被锁定");
}
// StoragePos pos = storagePosManager.getByPosName(dto.getPosName());
// Storage storage = dataCache.getStorageById(pos.getStorageId());
// //判断是否已在出库中
// DataLog task = taskService.findExecutingTask(storage.getCid(), pos.getPosName());
// if (task == null) {
// codeBean.setError("smfcode.error.barcode.inQueue", new String[]{dto.getBarcode()}, "二维码[{0}]已在操作队列中");
// }
}
if (codeBean.getErrorCode() != null) {
String error = MessageUtils.getText(codeBean.getErrorCode(), codeBean.getParams(), servletRequest.getLocale(), codeBean.getError());
dto.setError(error);
}
} else {
String error = MessageUtils.getText("smfcode.error.barcode.invalid", new String[]{code}, servletRequest.getLocale(), "{0}不是有效的条码");
dto.setError(error);
}
return dto;
}
}
......@@ -100,7 +100,15 @@ smfcode.order.out.noTask=\u5DE5\u5355\u65E0\u53EF\u6267\u884C\u7684\u4EFB\u52A1
smfcode.cannotUpdateOrderNum=\u5DE5\u5355\u5DF2\u51FA\u5E93\uFF0C\u4E0D\u80FD\u4FEE\u6539\u6570\u91CF
smfcode.order.close.success=\u5DE5\u5355\u5173\u95ED\u6210\u529F
smfcode.order.close.taskNotEnd=\u5DE5\u5355\u8FD8\u6709\u672A\u5B8C\u6210\u7684\u4EFB\u52A1
smfcore.manualOut=\u624B\u52A8\u51FA\u5E93
smfcode.error.barcode.noRules=\u89E3\u6790\u89C4\u5219\u672A\u5B9A\u4E49
smfcode.error.barcode.wrongLength=\u6761\u7801[{0}]\u957F\u5EA6\u9519\u8BEF
smfcode.error.barcode.noField=\u6761\u7801\u89E3\u6790\u5931\u8D25,\u672A\u627E\u5230{0}\u5B57\u6BB5
smfcode.error.barcode.pnNotExist=x\u6863\u6848 {0} \u4E0D\u5B58\u5728
smfcode.error.barcode.invalid={0}\u4E0D\u662F\u6709\u6548\u7684\u6761\u7801
smfcode.error.barcode.locked=\u5E93\u4F4D[{0}]\u5DF2\u88AB\u9501\u5B9A
smfcode.manualOut.ok=\u624B\u52A8\u51FA\u5E93\u6210\u529F
smfcode.manualOut.notFound=\u4ED3\u5E93\u4E2D\u672A\u627E\u5230\u6599\u76D8\u4FE1\u606F
......
......@@ -99,4 +99,13 @@ smfcode.order.out.maxOrder=The maximum number of executable work orders has been
smfcode.order.out.noTask=Work order No executable tasks
smfcode.cannotUpdateOrderNum=The work order has been issued and the quantity cannot be modified
smfcode.order.close.success=Work order closed successfully
smfcode.order.close.taskNotEnd=Work orders with outstanding tasks
\ No newline at end of file
smfcode.order.close.taskNotEnd=Work orders with outstanding tasks
smfcore.manualOut=Manual outbound
smfcode.error.barcode.noRules=Parsing rules not defined
smfcode.error.barcode.wrongLength=The barcode [{0}] is of wrong length
smfcode.error.barcode.noField=Bar code parsing failed, {0} field not found
smfcode.error.barcode.pnNotExist=Material file {0} does not exist
smfcode.error.barcode.invalid={0} is not a valid barcode
smfcode.error.barcode.locked=Library bit [{0}] is locked
smfcode.manualOut.ok=Manual exit successful
smfcode.manualOut.notFound=No tray information found
\ No newline at end of file
......@@ -99,4 +99,13 @@ smfcode.order.out.maxOrder=\u5B9F\u884C\u53EF\u80FD\u306A\u30EF\u30FC\u30AF\u30A
smfcode.order.out.noTask=\u4F5C\u696D\u6307\u793A\u304C\u5B9F\u884C\u3067\u304D\u306A\u3044\u30BF\u30B9\u30AF
smfcode.cannotUpdateOrderNum=\u30EF\u30FC\u30AF\u30AA\u30FC\u30C0\u30FC\u304C\u5728\u5EAB\u5207\u308C\u3067\u6570\u91CF\u304C\u5909\u66F4\u3067\u304D\u306A\u3044
smfcode.order.close.success=\u30EF\u30FC\u30AF\u30AA\u30FC\u30C0\u30FC\u304C\u6B63\u5E38\u306B\u7D42\u4E86\u3057\u307E\u3057\u305F\u3002
smfcode.order.close.taskNotEnd=\u672A\u51E6\u7406\u306E\u30BF\u30B9\u30AF\u304C\u3042\u308B\u30EF\u30FC\u30AF\u30AA\u30FC\u30C0\u30FC
\ No newline at end of file
smfcode.order.close.taskNotEnd=\u672A\u51E6\u7406\u306E\u30BF\u30B9\u30AF\u304C\u3042\u308B\u30EF\u30FC\u30AF\u30AA\u30FC\u30C0\u30FC
smfcore.manualOut=\u30DE\u30CB\u30E5\u30A2\u30EB\u30A2\u30A6\u30C8\u30D0\u30A6\u30F3\u30C9
smfcode.error.barcode.noRules=\u69CB\u6587\u89E3\u6790\u30EB\u30FC\u30EB\u304C\u5B9A\u7FA9\u3055\u308C\u3066\u3044\u306A\u3044f
smfcode.error.barcode.wrongLength=\u30D0\u30FC\u30B3\u30FC\u30C9[{0}]\u306E\u9577\u3055\u304C\u4E0D\u6B63\u3067\u3059
smfcode.error.barcode.noField=\u30D0\u30FC\u30B3\u30FC\u30C9\u306E\u89E3\u6790\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3002\u30D5\u30A3\u30FC\u30EB\u30C9{0}\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093
smfcode.error.barcode.pnNotExist=\u30D5\u30A1\u30A4\u30EB{0}\u304C\u5B58\u5728\u3057\u306A\u3044
smfcode.error.barcode.invalid={0}\u306F\u6709\u52B9\u306A\u30D0\u30FC\u30B3\u30FC\u30C9\u3067\u306F\u3042\u308A\u307E\u305B\u3093
smfcode.error.barcode.locked=\u30E9\u30A4\u30D6\u30E9\u30EA\u30DD\u30B8\u30B7\u30E7\u30F3 [{0}] \u304C\u30ED\u30C3\u30AF\u3055\u308C\u3066\u3044\u308B
smfcode.manualOut.ok=\u624B\u52D5\u7D42\u4E86\u6210\u529F
smfcode.manualOut.notFound=\u5009\u5EAB\u3067\u30D1\u30EC\u30C3\u30C8\u60C5\u5831\u304C\u898B\u3064\u304B\u3089\u306A\u3044
\ No newline at end of file
......@@ -99,4 +99,13 @@ smfcode.order.out.maxOrder=\u5DF2\u8FBE\u6700\u5927\u53EF\u6267\u884C\u5DE5\u535
smfcode.order.out.noTask=\u5DE5\u5355\u65E0\u53EF\u6267\u884C\u7684\u4EFB\u52A1
smfcode.cannotUpdateOrderNum=\u5DE5\u5355\u5DF2\u51FA\u5E93\uFF0C\u4E0D\u80FD\u4FEE\u6539\u6570\u91CF
smfcode.order.close.success=\u5DE5\u5355\u5173\u95ED\u6210\u529F
smfcode.order.close.taskNotEnd=\u5DE5\u5355\u8FD8\u6709\u672A\u5B8C\u6210\u7684\u4EFB\u52A1
\ No newline at end of file
smfcode.order.close.taskNotEnd=\u5DE5\u5355\u8FD8\u6709\u672A\u5B8C\u6210\u7684\u4EFB\u52A1
smfcore.manualOut=\u624B\u52A8\u51FA\u5E93
smfcode.error.barcode.noRules=\u89E3\u6790\u89C4\u5219\u672A\u5B9A\u4E49
smfcode.error.barcode.wrongLength=\u6761\u7801[{0}]\u957F\u5EA6\u9519\u8BEF
smfcode.error.barcode.noField=\u6761\u7801\u89E3\u6790\u5931\u8D25,\u672A\u627E\u5230{0}\u5B57\u6BB5
smfcode.error.barcode.pnNotExist=x\u6863\u6848 {0} \u4E0D\u5B58\u5728
smfcode.error.barcode.invalid={0}\u4E0D\u662F\u6709\u6548\u7684\u6761\u7801
smfcode.error.barcode.locked=\u5E93\u4F4D[{0}]\u5DF2\u88AB\u9501\u5B9A
smfcode.manualOut.ok=\u624B\u52A8\u51FA\u5E93\u6210\u529F
smfcode.manualOut.notFound=\u4ED3\u5E93\u4E2D\u672A\u627E\u5230\u6599\u76D8\u4FE1\u606F
\ No newline at end of file
......@@ -99,4 +99,13 @@ smfcode.order.out.maxOrder=\u5DF2\u9054\u5230\u6700\u5927\u53EF\u57F7\u884C\u5DE
smfcode.order.out.noTask=\u5DE5\u55AE\u7121\u53EF\u57F7\u884C\u7684\u4EFB\u52D9
smfcode.cannotUpdateOrderNum=\u5DE5\u55AE\u5DF2\u51FA\u5EAB\uFF0C\u4E0D\u80FD\u4FEE\u6539\u6578\u91CF
smfcode.order.close.success=\u5DE5\u55AE\u95DC\u9589\u6210\u529F
smfcode.order.close.taskNotEnd=\u5DE5\u55AE\u9084\u6709\u672A\u5B8C\u6210\u7684\u4EFB\u52D9
\ No newline at end of file
smfcode.order.close.taskNotEnd=\u5DE5\u55AE\u9084\u6709\u672A\u5B8C\u6210\u7684\u4EFB\u52D9
smfcore.manualOut=\u624B\u52D5\u51FA\u5EAB
smfcode.error.barcode.noRules=\u89E3\u6790\u898F\u5247\u672A\u5B9A\u7FA9
smfcode.error.barcode.wrongLength=\u689D\u78BC[{0}]\u9577\u5EA6\u932F\u8AA4
smfcode.error.barcode.noField=\u689D\u78BC\u89E3\u6790\u5931\u6557\uFF0C\u672A\u627E\u5230{0}\u5B57\u6BB5
smfcode.error.barcode.pnNotExist=\u6A94\u6848 {0} \u4E0D\u5B58\u5728
smfcode.error.barcode.invalid={0}\u4E0D\u662F\u6709\u6548\u7684\u689D\u78BC
smfcode.error.barcode.locked=\u5EAB\u4F4D[{0}]\u5DF2\u88AB\u9396\u5B9A
smfcode.manualOut.ok=\u624B\u52D5\u51FA\u5EAB\u6210\u529F
smfcode.manualOut.notFound=\u5009\u5EAB\u4E2D\u672A\u627E\u5230\u6599\u76E4\u4FE1\u606F
\ No newline at end of file
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!