Commit a43c781e LN

盘点功能修改

1 个父辈 d43f041b
......@@ -483,7 +483,7 @@ public class RobotBoxHandler extends BaseDeviceHandler {
errorMsg = ve.getMessage();
log.info("Failed to find empty storage space:" + errorMsg);
resultMap.put("result", "105");
errorMsg= MessageUtils.getText(ve.getMsgKey(),new Locale("en","US"),ve.getDefaultMsg());
errorMsg= MessageUtils.getText(ve.getMsgKey(),ve.getMsgParam(),new Locale("en","US"),ve.getDefaultMsg());
resultMap.put("msg", errorMsg);
} catch (Exception e) {
errorMsg = e.getMessage();
......
package com.neotel.smfcore.core.selfAudit.rest;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.exception.ValidateException;
......@@ -61,19 +62,37 @@ public class SelfAuditController {
String batchNo = dataCache.getCache(Constants.CACHE_SELFAUDIT_BATCHNO);
if (ObjectUtil.isNotEmpty(batchNo)) {
SelfAudit selfAudit = selfAuditManager.findByBatchNo(batchNo);
if (selfAudit.getStatus().equals(SELFAUDIT_STATUS.END) || selfAudit.getStatus().equals(SELFAUDIT_STATUS.FINISHED)) {
//如果当前是暂停,可以继续
if(selfAudit.getStatus().equals(SELFAUDIT_STATUS.PAUSE.name())){
//手动继续盘点
log.info("手动继续盘点:"+batchNo);
selfAudit.setStatus(SELFAUDIT_STATUS.EXECUTING.name());
selfAuditManager.save(selfAudit);
//更新缓存
SelfAuditUtil.updateShelfAudit(selfAudit);
return ResultBean.newOkResult("OK");
}
if (selfAudit.getStatus().equals(SELFAUDIT_STATUS.END.name()) || selfAudit.getStatus().equals(SELFAUDIT_STATUS.FINISHED.name())) {
log.info("从dataCache删除已完成的盘点批次号:" + batchNo + " ");
dataCache.updateCache(Constants.CACHE_SELFAUDIT_BATCHNO, "");
} else {
ResultBean.newErrorResult(99, "smfcore.selfAudit.preNotEnd", "上次盘点{0}还未完成", new String[]{batchNo});
throw new ValidateException( "smfcore.selfAudit.preNotEnd", "上次盘点{0}还未完成", new String[]{batchNo});
}
}
log.info("从dataCache删除已完成的盘点批次号:" + batchNo + " ");
dataCache.updateCache(Constants.CACHE_SELFAUDIT_BATCHNO, "");
//开始新的盘点
String[] storageIds = (String[]) mapValues.get("storageIds");
if (storageIds == null || storageIds.length <= 0) {
ResultBean.newErrorResult(99, "smfcore.selfAudit.noStorage", "请选择要盘点的设备");
Object object=mapValues.get("storageIds");
if(ObjectUtil.isEmpty(object)) {
throw new ValidateException( "smfcore.selfAudit.noStorage", "请选择要盘点的设备");
}
List<String> storageIds = JSON.parseArray(object.toString(),String.class);
if (storageIds == null || storageIds.size() <= 0) {
throw new ValidateException( "smfcore.selfAudit.noStorage", "请选择要盘点的设备");
}
log.info("开始盘点: 设备ID["+String.join( ",",storageIds)+"] 创建盘点数据");
List<SelfAuditItem> items=new ArrayList<>();
List<String> storageIdList=new ArrayList<>();
// List<StoragePos> allPosList=new ArrayList<>();
......@@ -98,12 +117,13 @@ public class SelfAuditController {
SelfAudit audit = new SelfAudit(no, SELFAUDIT_STATUS.NEW.name(), items.size(),0,storageIdList,new ArrayList<>() );
log.info("开始盘点: 批次号["+no+"] 设备ID["+String.join( ",",storageIdList)+"] 盘点库位数量:["+items.size()+"] ");
log.info("盘点数据创建完成: 批次号["+no+"] 设备ID["+String.join( ",",storageIdList)+"] 盘点库位数量:["+items.size()+"] ");
audit= selfAuditManager.createSelfAudit(audit,items);
SelfAuditDto dto=selfAuditMapper.toDto(audit);
//更新缓存
SelfAuditUtil.updateShelfAudit(audit);
dataCache.updateCache(Constants.CACHE_SELFAUDIT_BATCHNO, no);
return ResultBean.newOkResult(dto);
}
......@@ -112,8 +132,14 @@ public class SelfAuditController {
public ResultBean pause(@RequestBody Map<String, String> mapValues) {
String batchNo=mapValues.get("batchNo");
SelfAudit selfAudit =getInfoByBatchNo(batchNo);
if (selfAudit.getStatus().equals(SELFAUDIT_STATUS.END.name())
|| selfAudit.getStatus().equals(SELFAUDIT_STATUS.FINISHED.name())
|| selfAudit.getStatus().equals(SELFAUDIT_STATUS.PAUSE.name())) {
throw new ValidateException( "smfcore.micron.operationFailure", "操作失败" );
}
//结束盘点
log.info("手动暂停盘点,批次号:"+batchNo);
log.info("手动暂停盘点:"+batchNo);
selfAudit.setStatus(SELFAUDIT_STATUS.PAUSE.name());
selfAuditManager.save(selfAudit);
//更新缓存
......@@ -127,11 +153,11 @@ public class SelfAuditController {
SelfAudit selfAudit =getInfoByBatchNo(batchNo);
//结束盘点
log.info("手动结束盘点,批次号:"+batchNo);
log.info("手动结束盘点:"+batchNo);
selfAudit.setStatus(SELFAUDIT_STATUS.END.name());
selfAuditManager.save(selfAudit);
//清空dataCache
log.info("手动结束盘点,批次号:"+batchNo+" 完成,从dataCache删除批次号");
log.info("手动结束盘点:"+batchNo+" 完成,从dataCache删除批次号");
dataCache.updateCache(Constants.CACHE_SELFAUDIT_BATCHNO,"");
//更新缓存
SelfAuditUtil.updateShelfAudit(selfAudit);
......@@ -170,6 +196,11 @@ public class SelfAuditController {
if (selfAudit == null) {
selfAudit = selfAuditManager.findByBatchNo(batchNo);
}
if (selfAudit.getStatus().equals(SELFAUDIT_STATUS.END.name()) || selfAudit.getStatus().equals(SELFAUDIT_STATUS.FINISHED.name())) {
log.info("从dataCache删除已完成的盘点批次号:" + batchNo + " ");
dataCache.updateCache(Constants.CACHE_SELFAUDIT_BATCHNO, "");
return null;
}
if (selfAudit != null) {
return toSelfAuditDto(selfAudit);
}
......
......@@ -7,6 +7,7 @@ import com.neotel.smfcore.common.utils.Constants;
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.selfAudit.enums.SELFAUDIT_STATUS;
import com.neotel.smfcore.core.selfAudit.service.manager.ISelfAuditItemManager;
import com.neotel.smfcore.core.selfAudit.service.manager.ISelfAuditManager;
import com.neotel.smfcore.core.selfAudit.service.po.SelfAudit;
......@@ -59,6 +60,14 @@ public class SelfAuditDeviceController {
if (selfAudit == null) {
selfAudit = selfAuditManager.findByBatchNo(batchNo);
}
//如果已结束
if (selfAudit.getStatus().equals(SELFAUDIT_STATUS.END.name()) || selfAudit.getStatus().equals(SELFAUDIT_STATUS.FINISHED.name())) {
log.info("从dataCache删除已完成的盘点批次号:" + batchNo + " ");
dataCache.updateCache(Constants.CACHE_SELFAUDIT_BATCHNO, "");
return null;
}
return selfAudit;
}
return null;
......@@ -74,6 +83,10 @@ public class SelfAuditDeviceController {
return ResultBean.newErrorResult(99,"smfcore.selfAudit.notFind","未找到盘点信息");
}
if(selfAudit.getStatus().equals(SELFAUDIT_STATUS.PAUSE.name())) {
return ResultBean.newErrorResult(100, "smfcore.selfAudit.pause", "盘点{0}已暂停", new String[]{selfAudit.getBatchNo()});
}
String cid = request.getParameter("cid");
//根据CID 查找下一个
List<SelfAuditItem> items=selfAudit.getItems();
......
......@@ -7,6 +7,7 @@ import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Transient;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
@Data
@AllArgsConstructor
......@@ -19,12 +20,16 @@ public class SelfAuditDto implements Serializable {
@ApiModelProperty("状态")
private String status;
@ApiModelProperty("盘点选择的料仓ID列表")
private List<String> storageIds;
@ApiModelProperty("总库位数")
private Integer totalItemNum;
@ApiModelProperty("已结束库位数")
private Integer endItemNum;
private Date createDate;
private Date updateDate;
@Transient
private List<SelfAuditItemDto> items;
......
......@@ -28,4 +28,7 @@ public class SelfAuditItemDto implements Serializable {
@ApiModelProperty("实际条码")
private String actualBarcode;
@ApiModelProperty("0=等待中,1=出库完成,2=盘点完成")
private int itemStatus=0;
}
......@@ -8,7 +8,7 @@ import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
public class SelfAuditCriteria {
@QueryCondition(blurry = "barcode,posName,locInfo")
@QueryCondition(blurry = "batchNo")
private String blurry;
@QueryCondition(type = QueryCondition.Type.BETWEEN, propName = "updateDate")
......@@ -16,10 +16,8 @@ public class SelfAuditCriteria {
private BetweenData<Date> createDate;
@QueryCondition(blurry = "barcode")
private String barcode;
@QueryCondition(blurry = "posName")
private String posName;
@QueryCondition(blurry = "batchNo")
private String batchNo;
@ApiModelProperty("status")
@QueryCondition(blurry = "status")
......
......@@ -21,6 +21,7 @@ public class SelfAudit extends BasePo implements Serializable {
private String batchNo;
/**
* 状态
* NEW=新建,EXECUTING=执行中,PAUSE=暂停,FINISHED=已完成,END=已结束
*/
private String status;
/**
......
......@@ -52,12 +52,12 @@ public class SelfAuditItem extends BasePo implements Serializable {
public static SelfAuditItem newItem(String cid, String batchNo, StoragePos pos){
SelfAuditItem item=new SelfAuditItem();
item.setCid(cid);
item.setBarcode(batchNo);
item.setBatchNo(batchNo);
item.setCid(cid);
item.setPosId(pos.getId());
item.setPosName(pos.getPosName());
item.setStorageId(pos.getStorageId());
if(pos.getBarcode().getBarcode()!=null) {
if(pos.getBarcode()!=null&& pos.getBarcode().getBarcode()!=null) {
item.setBarcode(pos.getBarcode().getBarcode());
}else{
item.setBarcode("");
......
......@@ -338,6 +338,7 @@ smfcore.selfAudit.noStorage=\u8BF7\u9009\u62E9\u8981\u76D8\u70B9\u7684\u8BBE\u59
smfcore.selfAudit.notExist=\u672A\u627E\u5230\u6279\u6B21\u53F7[{0}]\u7684\u76D8\u70B9\u4FE1\u606F
smfcore.selfAudit.hasEnd=[{0}]\u76D8\u70B9\u5DF2\u5B8C\u6210
smfcore.selfAudit.notFind=\u672A\u627E\u5230\u76D8\u70B9\u4FE1\u606F
smfcore.selfAudit.pause=\u76D8\u70B9{0}\u5DF2\u6682\u505C
#smfclient.nlp.onlyOneTray=\u4E0D\u53EF\u540C\u65F6\u653E\u5165\u591A\u76D8\u7269\u6599:{0}
#smfclient.nlp.cannotFindPos={0}\u672A\u627E\u5230\u5E93\u4F4D:{1}
#smfclient.nlp.inputOk={0}\u5165\u5E93\u5230{1}\u6210\u529F
......
......@@ -336,4 +336,5 @@ smfcore.selfAudit.preNotEnd=The last self audit {0} is still incomplete
smfcore.selfAudit.noStorage=Please select the equipment to be self audit
smfcore.selfAudit.notExist= [{0}] self audit information not found
smfcore.selfAudit.hasEnd=[{0}] self audit is complete
smfcore.selfAudit.notFind=self audit is not found
\ No newline at end of file
smfcore.selfAudit.notFind=self audit is not found
smfcore.selfAudit.pause=self audit {0} has Paused
\ No newline at end of file
......@@ -333,4 +333,5 @@ smfcore.selfAudit.preNotEnd=\u6700\u5F8C\u306E\u30A4\u30F3\u30D9\u30F3\u30C8\u30
smfcore.selfAudit.noStorage=\u30A4\u30F3\u30D9\u30F3\u30C8\u30EA\u5316\u3059\u308B\u6A5F\u5668\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044
smfcore.selfAudit.notExist=\u30ED\u30C3\u30C8\u756A\u53F7[{0}]\u306E\u30A4\u30F3\u30D9\u30F3\u30C8\u30EA\u60C5\u5831\u304C\u898B\u3064\u304B\u3089\u306A\u3044
smfcore.selfAudit.hasEnd=[{0}]\u30A4\u30F3\u30D9\u30F3\u30C8\u30EA\u30FC\u5B8C\u6210
smfcore.selfAudit.notFind=\u30A4\u30F3\u30D9\u30F3\u30C8\u30EA\u60C5\u5831\u304C\u898B\u3064\u304B\u3089\u306A\u3044
smfcore.selfAudit.notFind=\u30A4\u30F3\u30D9\u30F3\u30C8\u30EA\u60C5\u5831\u304C\u898B\u3064\u304B\u3089\u306A\u3044
smfcore.selfAudit.pause=\u30BB\u30EB\u30D5\u30C6\u30B9\u30C8{0}\u304C\u4E2D\u65AD\u3055\u308C\u307E\u3057\u305F
\ No newline at end of file
......@@ -333,4 +333,5 @@ smfcore.selfAudit.preNotEnd=\u4E0A\u6B21\u76D8\u70B9{0}\u8FD8\u672A\u5B8C\u6210
smfcore.selfAudit.noStorage=\u8BF7\u9009\u62E9\u8981\u76D8\u70B9\u7684\u8BBE\u5907
smfcore.selfAudit.notExist=\u672A\u627E\u5230\u6279\u6B21\u53F7[{0}]\u7684\u76D8\u70B9\u4FE1\u606F
smfcore.selfAudit.hasEnd=[{0}]\u76D8\u70B9\u5DF2\u5B8C\u6210
smfcore.selfAudit.notFind=\u672A\u627E\u5230\u76D8\u70B9\u4FE1\u606F
\ No newline at end of file
smfcore.selfAudit.notFind=\u672A\u627E\u5230\u76D8\u70B9\u4FE1\u606F
smfcore.selfAudit.pause=\u76D8\u70B9{0}\u5DF2\u6682\u505C
\ No newline at end of file
......@@ -334,4 +334,5 @@ smfcore.selfAudit.preNotEnd=\u4E0A\u6B21\u76E4\u9EDE{0}\u9084\u672A\u5B8C\u6210
smfcore.selfAudit.noStorage=\u8ACB\u9078\u64C7\u8981\u76E4\u9EDE\u7684\u8A2D\u5099
smfcore.selfAudit.notExist=\u672A\u627E\u5230\u6279\u6B21\u865F[{0}]\u7684\u76E4\u9EDE\u4FE1\u606F
smfcore.selfAudit.hasEnd=[{0}]\u76E4\u9EDE\u5DF2\u5B8C\u6210
smfcore.selfAudit.notFind=\u672A\u627E\u5230\u76E4\u9EDE\u4FE1\u606F
\ No newline at end of file
smfcore.selfAudit.notFind=\u672A\u627E\u5230\u76E4\u9EDE\u4FE1\u606F
smfcore.selfAudit.pause=\u76E4\u9EDE{0}\u5DF2\u66AB\u505C
\ No newline at end of file
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!