Commit e91fb981 sunke

Merge remote-tracking branch 'origin/master'

2 个父辈 2d5342eb 8d0266a7
正在显示 52 个修改的文件 包含 2375 行增加571 行删除
...@@ -15,9 +15,9 @@ ...@@ -15,9 +15,9 @@
<name>smf-core</name> <name>smf-core</name>
<description>SMF project for Spring Boot</description> <description>SMF project for Spring Boot</description>
<properties> <properties>
<maven.build.timestamp.format>M.dd</maven.build.timestamp.format> <maven.build.timestamp.format>MM.dd.HHmmss</maven.build.timestamp.format>
<main.version>1.${maven.build.timestamp}</main.version> <main.version>1.${maven.build.timestamp}</main.version>
<app.version>${main.version}${current.time}</app.version> <app.version>${main.version}</app.version>
<java.version>1.8</java.version> <java.version>1.8</java.version>
<jjwt.version>0.11.1</jjwt.version> <jjwt.version>0.11.1</jjwt.version>
<!-- oshi监控需要指定jna版本, 问题详见 https://github.com/oshi/oshi/issues/1040 --> <!-- oshi监控需要指定jna版本, 问题详见 https://github.com/oshi/oshi/issues/1040 -->
......
...@@ -41,13 +41,11 @@ public class DataInitManager { ...@@ -41,13 +41,11 @@ public class DataInitManager {
IRoleManager roleManager; IRoleManager roleManager;
@Autowired @Autowired
IMenuManager menuManager; IMenuManager menuManager;
// @Autowired
// IGroupManager groupManager;
@Autowired
TaskService taskService;
@Autowired @Autowired
IDataLogManager dataLogManager; MainTimer mainTimer;
@Autowired @Autowired
PermissionInitUtil annotationUtil; PermissionInitUtil annotationUtil;
...@@ -101,7 +99,7 @@ public class DataInitManager { ...@@ -101,7 +99,7 @@ public class DataInitManager {
} }
} }
initTask(); mainTimer.init();
allPermissionSet= annotationUtil.initPermission(); allPermissionSet= annotationUtil.initPermission();
} catch (Exception exception) { } catch (Exception exception) {
...@@ -109,20 +107,7 @@ public class DataInitManager { ...@@ -109,20 +107,7 @@ public class DataInitManager {
} }
} }
private void initTask() {
log.info("开始加载未完成的任务...");
List<DataLog> unExecuteTasks = dataLogManager.findUnFinishedTasks();
for (DataLog unExecuteTask : unExecuteTasks) {
if (unExecuteTask.isExecuting() || unExecuteTask.isWait()) {
try {
taskService.addTaskToExecute(unExecuteTask);
}catch (Exception e){
log.error("初始化任务["+unExecuteTask+"]出错:"+e);
}
}
}
log.info("加载未完成的任务完成,共[" + unExecuteTasks.size() + "]条数据...");
}
private int sortValue=0; private int sortValue=0;
...@@ -206,9 +191,12 @@ public class DataInitManager { ...@@ -206,9 +191,12 @@ public class DataInitManager {
Menu menuOut = new Menu(new ArrayList<Menu>(), 1, "checkOut", "查找出库", 1, "singleOuput", "neolight/singleOuput/index", "", 0, "export1"); Menu menuOut = new Menu(new ArrayList<Menu>(), 1, "checkOut", "查找出库", 1, "singleOuput", "neolight/singleOuput/index", "", 0, "export1");
Menu celueOut = new Menu(new ArrayList<Menu>(), 1, "tacticsOuput", "策略出库", 1, "tacticsOuput", "neolight/tacticsOuput/index", "", 0, "workOrder"); Menu celueOut = new Menu(new ArrayList<Menu>(), 1, "tacticsOuput", "策略出库", 1, "tacticsOuput", "neolight/tacticsOuput/index", "", 0, "workOrder");
Menu groupOut = new Menu(new ArrayList<Menu>(), 1, "labelOuput", "物料分组", 1, "labelOuput", "neolight/labelOuput/index", "", 0, "export1"); Menu groupOut = new Menu(new ArrayList<Menu>(), 1, "labelOuput", "物料分组", 1, "labelOuput", "neolight/labelOuput/index", "", 0, "export1");
Menu manualOut = new Menu(new ArrayList<Menu>(), 1, "manualOut", "手动出库", 1, "manualOut", "neolight/manualOut/index", "", 0, "export1");
Menu materialBox = new Menu(new ArrayList<Menu>(), 1, "materialBox", "料盒操作", 1, "materialBox", "neolight/materialBox/index", "", 0, "export1");
celueOut.setHidden(true); celueOut.setHidden(true);
groupOut.setHidden(true); groupOut.setHidden(true);
menus.addAll(createMenus(poutOut, menuOrder, menuOut,celueOut,groupOut)); manualOut.setHidden(true);
menus.addAll(createMenus(poutOut, menuOrder, menuOut,celueOut,groupOut,manualOut,materialBox));
//设置:料仓管理,菜单管理 //设置:料仓管理,菜单管理
Menu poutSet = Menu.CreatePMenu("设置", 30, "system", 2, "system"); Menu poutSet = Menu.CreatePMenu("设置", 30, "system", 2, "system");
......
package com.neotel.smfcore.common.init;
import com.neotel.smfcore.core.order.LiteOrderCache;
import com.neotel.smfcore.core.system.service.manager.IDataLogManager;
import com.neotel.smfcore.core.system.service.po.DataLog;
import com.neotel.smfcore.core.system.util.TaskService;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
@Service
public class MainTimer {
protected final transient Logger log = LogManager.getLogger(getClass());
ScheduledExecutorService scheduledThreadPool = Executors.newScheduledThreadPool(1);
@Autowired
TaskService taskService;
@Autowired
IDataLogManager dataLogManager;
@Autowired
LiteOrderCache liteOrderCache;
public void init(){
initTask();
liteOrderCache.loadUnEndOrderInfos();
log.info("主定时器开启,60秒后开始执行, 每10s执行一次");
//1 分钟之后执行,每秒钟执行一次
scheduledThreadPool.scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
timerTask();
}
}, 60, 10, TimeUnit.SECONDS);
}
private void initTask() {
log.info("开始加载未完成的任务...");
List<DataLog> unExecuteTasks = dataLogManager.findUnFinishedTasks();
for (DataLog unExecuteTask : unExecuteTasks) {
if (unExecuteTask.isExecuting() || unExecuteTask.isWait()) {
try {
taskService.addTaskToExecute(unExecuteTask);
}catch (Exception e){
log.error("初始化任务["+unExecuteTask+"]出错:"+e);
}
}
}
log.info("加载未完成的任务完成,共[" + unExecuteTasks.size() + "]条数据...");
}
private void timerTask(){
try{
liteOrderCache.runTimer();
}catch (Exception e){
log.error("定时器执行出错",e);
}finally {
}
}
}
...@@ -10,6 +10,8 @@ public class Constants { ...@@ -10,6 +10,8 @@ public class Constants {
* 超级管理员用户名 * 超级管理员用户名
*/ */
public static final String SUPER_USERNAME= "admin"; public static final String SUPER_USERNAME= "admin";
public static final String USER_DEFAULTP_PWD="123456";
/** /**
* Assets Version constant * Assets Version constant
*/ */
...@@ -97,5 +99,8 @@ public class Constants { ...@@ -97,5 +99,8 @@ public class Constants {
*/ */
public static final String CACHE_StopJob="stopJob"; public static final String CACHE_StopJob="stopJob";
/**
* 出库方式类型 出库策略配置
*/
public static final String CACHE_CheckOutType="checkoutType"; public static final String CACHE_CheckOutType="checkoutType";
} }
...@@ -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("error.barcode.noRule","解析规则未定义"); codeBean.setError("smfcode.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("error.barcode.wrongLength",new String[]{}, "条码["+codeStr+"]长度错误"); codeBean.setError("smfcode.error.barcode.wrongLength",new String[]{codeStr}, "条码[{0}]长度错误");
return codeBean; return codeBean;
}else{ }else{
codeArr = codeStr.split(separator,length); codeArr = codeStr.split(separator,length);
...@@ -515,7 +515,7 @@ public class BarcodeRule { ...@@ -515,7 +515,7 @@ public class BarcodeRule {
Barcode b = new Barcode(); Barcode b = new Barcode();
b.setFullCode(codeStr);
String reelId = ""; String reelId = "";
if(whole_reelId_item.hasThisField()){ if(whole_reelId_item.hasThisField()){
reelId = codeStr; reelId = codeStr;
...@@ -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("error.barcode.noField",new String[]{"RI"},"条码解析失败,未找到RI字段"); codeBean.setError("smfcode.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("error.barcode.noField",new String[]{"PN"}, "条码解析失败,未找到PN字段"); codeBean.setError("smfcode.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("error.barcode.noField",new String[]{"QTY"},"条码解析失败,未找到QTY 字段"); codeBean.setError("smfcode.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("error.barcode.noField",new String[]{"PRODATE"},"条码解析失败,未找到PRODATE字段"); codeBean.setError("smfcode.error.barcode.noField",new String[]{"PRODATE"},"条码解析失败,未找到{0}字段");
return codeBean; return codeBean;
} }
Date expireDate= expireDate_item.getDateValue(codeArr); Date expireDate= expireDate_item.getDateValue(codeArr);
...@@ -700,6 +700,10 @@ public class BarcodeRule { ...@@ -700,6 +700,10 @@ public class BarcodeRule {
codeStr = "327203324369301963"; codeStr = "327203324369301963";
rule = "PN[-1_32:0:-1_3]RI[-1:0:-1]"; rule = "PN[-1_32:0:-1_3]RI[-1:0:-1]";
codeStr="TJM210215000771&10446507326&15000&2021-01-18&NAUK11263MAB&&10446&&R107920210124A13OG";
rule="RI&PN&QTY&PRODATEyyyy-MM-dd&5&6&7&8&9";
BarcodeRule br = BarcodeRule.newRule(rule); BarcodeRule br = BarcodeRule.newRule(rule);
Barcode b = br.toCodeBean(codeStr).getBarcode(); Barcode b = br.toCodeBean(codeStr).getBarcode();
if(b != null){ if(b != null){
......
...@@ -90,4 +90,18 @@ public class ComponentController { ...@@ -90,4 +90,18 @@ public class ComponentController {
return new ResponseEntity<>(HttpStatus.OK); return new ResponseEntity<>(HttpStatus.OK);
} }
@ApiOperation("搜索框匹配元器件")
@GetMapping(value = "/searchMatching")
@PreAuthorize("@el.check('component:list')")
public List<String> searchMatching(ComponentQueryCriteria criteria) {
Query query = QueryHelp.getQuery(criteria);
query.limit(20);
List<Component> list = componentManager.findByQuery(query);
List<String> array = new ArrayList<>();
for (Component com :
list) {
array.add(com.getPartNumber());
}
return array;
}
} }
package com.neotel.smfcore.core.barcode.rest.bean.dto; package com.neotel.smfcore.core.barcode.rest.bean.dto;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.neotel.smfcore.common.utils.DateUtil;
import com.neotel.smfcore.core.barcode.enums.BARCODE_STATUS; 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.COMPONENT_TYPE;
import com.neotel.smfcore.core.barcode.enums.SOLDER_STATUS; import com.neotel.smfcore.core.barcode.enums.SOLDER_STATUS;
...@@ -13,6 +12,9 @@ import org.springframework.data.annotation.Transient; ...@@ -13,6 +12,9 @@ import org.springframework.data.annotation.Transient;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Set;
@Getter @Getter
@Setter @Setter
public class BarcodeDto implements Serializable { public class BarcodeDto implements Serializable {
...@@ -205,5 +207,8 @@ public class BarcodeDto implements Serializable { ...@@ -205,5 +207,8 @@ public class BarcodeDto implements Serializable {
return (""+plateSize+"X"+height); return (""+plateSize+"X"+height);
} }
/**
* 料箱中的物料信息
*/
private Map<String, BarcodeDto> subCodeMap;
} }
...@@ -4,7 +4,9 @@ import com.google.common.collect.Lists; ...@@ -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.BARCODE_STATUS;
import com.neotel.smfcore.core.barcode.enums.COMPONENT_TYPE; import com.neotel.smfcore.core.barcode.enums.COMPONENT_TYPE;
import com.neotel.smfcore.core.barcode.enums.SOLDER_STATUS; import com.neotel.smfcore.core.barcode.enums.SOLDER_STATUS;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import lombok.ToString; import lombok.ToString;
...@@ -30,10 +32,16 @@ public class CodeDto implements Serializable { ...@@ -30,10 +32,16 @@ public class CodeDto implements Serializable {
@ApiModelProperty("高度") @ApiModelProperty("高度")
private int height=0; private int height=0;
/**
* 原始条码
*/
@ApiModelProperty("原始条码") @ApiModelProperty("原始条码")
private String fullCode; private String fullCode;
@ApiModelProperty("库位信息/仓位")
private String posName;
@ApiModelProperty("数量")
private int amount;
@ApiModelProperty("错误提示")
private String error;
} }
...@@ -189,7 +189,7 @@ public class BarcodeManagerImpl implements IBarcodeManager { ...@@ -189,7 +189,7 @@ public class BarcodeManagerImpl implements IBarcodeManager {
// throw new ValidateException("批次不能为空"); // throw new ValidateException("批次不能为空");
} }
if (barcode.getAmount() < 0) { if (barcode.getAmount() < 0) {
throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"batch"} ); throw new ValidateException("smfcode.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)) {
......
...@@ -60,7 +60,7 @@ public class ComponentManagerImpl implements IComponentManager { ...@@ -60,7 +60,7 @@ public class ComponentManagerImpl implements IComponentManager {
@Override @Override
public List<Component> findByQuery(Query query) { public List<Component> findByQuery(Query query) {
return componentDao.findOne(query); return componentDao.findByQuery(query);
} }
@Override @Override
...@@ -71,6 +71,9 @@ public class ComponentManagerImpl implements IComponentManager { ...@@ -71,6 +71,9 @@ public class ComponentManagerImpl implements IComponentManager {
Component component = componentDao.findOneByCondition(new String[]{"partNumber", "provider"}, new String[]{partNumber, provider}); Component component = componentDao.findOneByCondition(new String[]{"partNumber", "provider"}, new String[]{partNumber, provider});
if (component == null) { if (component == null) {
component = componentDao.findOneByCondition(new String[]{"partNumber", "provider"}, new String[]{partNumber, null}); component = componentDao.findOneByCondition(new String[]{"partNumber", "provider"}, new String[]{partNumber, null});
if(component==null){
component = componentDao.findOneByCondition(new String[]{"partNumber", "provider"}, new String[]{partNumber, ""});
}
if (component != null) { if (component != null) {
component.setProvider(provider); component.setProvider(provider);
component = componentDao.save(component); component = componentDao.save(component);
......
...@@ -3,7 +3,6 @@ package com.neotel.smfcore.core.barcode.service.po; ...@@ -3,7 +3,6 @@ package com.neotel.smfcore.core.barcode.service.po;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.neotel.smfcore.common.base.BasePo; import com.neotel.smfcore.common.base.BasePo;
import com.neotel.smfcore.common.utils.DateUtil; import com.neotel.smfcore.common.utils.DateUtil;
import com.neotel.smfcore.common.utils.StorageConstants;
import com.neotel.smfcore.core.barcode.enums.BARCODE_STATUS; 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.COMPONENT_TYPE;
import com.neotel.smfcore.core.barcode.enums.SOLDER_STATUS; import com.neotel.smfcore.core.barcode.enums.SOLDER_STATUS;
...@@ -13,8 +12,7 @@ import org.springframework.data.annotation.Transient; ...@@ -13,8 +12,7 @@ import org.springframework.data.annotation.Transient;
import org.springframework.data.mongodb.core.mapping.Document; import org.springframework.data.mongodb.core.mapping.Document;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.*;
import java.util.List;
@Data @Data
@Document @Document
...@@ -23,6 +21,11 @@ public class Barcode extends BasePo implements Serializable { ...@@ -23,6 +21,11 @@ public class Barcode extends BasePo implements Serializable {
* 条码编号 * 条码编号
*/ */
private String barcode; private String barcode;
/**
* 扩展料盒的条码ID
*/
private String hostBarcodeId;
/** /**
* 物料类型:PCB,锡膏,或其他 * 物料类型:PCB,锡膏,或其他
*/ */
...@@ -42,9 +45,9 @@ public class Barcode extends BasePo implements Serializable { ...@@ -42,9 +45,9 @@ public class Barcode extends BasePo implements Serializable {
private Date expTime; private Date expTime;
/** /**
* 过期状态,-1未入库0在库,1已出库正常,2已出库且已过期 * 过期状态,-1未入库0在库,1已出库正常,2已出库且已过期
*/ */
private int status = BARCODE_STATUS.NEW; private int status = BARCODE_STATUS.NEW;
/** /**
* 锡膏状态 * 锡膏状态
...@@ -73,16 +76,16 @@ public class Barcode extends BasePo implements Serializable { ...@@ -73,16 +76,16 @@ public class Barcode extends BasePo implements Serializable {
/** /**
* 盘宽 * 盘宽
*/ */
private int plateSize=0; private int plateSize = 0;
/** /**
* 盘高 * 盘高
*/ */
private int height=0; private int height = 0;
private String provider; private String provider;
/** /**
* 批次 * 批次
*/ */
private String batch; private String batch="";
private String msl; private String msl;
//备用字段1(配套单号))或 family //备用字段1(配套单号))或 family
...@@ -156,19 +159,25 @@ public class Barcode extends BasePo implements Serializable { ...@@ -156,19 +159,25 @@ public class Barcode extends BasePo implements Serializable {
*/ */
@Transient @Transient
private List<String> relationCodes; private List<String> relationCodes;
/**
* 料盒条码:料盒内所有物料条码,key=barcode
*/
private Map<String, Barcode> subCodeMap;
/** /**
* 是否是锡膏 * 是否是锡膏
*/ */
public boolean isSolder(){ public boolean isSolder() {
return type == COMPONENT_TYPE.SOLDERPASTE; return type == COMPONENT_TYPE.SOLDERPASTE;
} }
public List<String> getRelationCodes() { public List<String> getRelationCodes() {
if (relationCodes == null) { if (relationCodes == null) {
return Lists.newArrayList(); return Lists.newArrayList();
} }
return relationCodes; return relationCodes;
} }
/** /**
* 上次使用时间(出入库时更改) * 上次使用时间(出入库时更改)
*/ */
...@@ -197,6 +206,7 @@ public class Barcode extends BasePo implements Serializable { ...@@ -197,6 +206,7 @@ public class Barcode extends BasePo implements Serializable {
* 原始条码 * 原始条码
*/ */
private String fullCode; private String fullCode;
/** /**
* 添加相关联条码 * 添加相关联条码
* *
...@@ -208,12 +218,13 @@ public class Barcode extends BasePo implements Serializable { ...@@ -208,12 +218,13 @@ public class Barcode extends BasePo implements Serializable {
} }
relationCodes.add(relationCode); relationCodes.add(relationCode);
} }
public long getPutInTime() { public long getPutInTime() {
return putInTime; return putInTime;
} }
public void setPutInTime(long putInTime) { public void setPutInTime(long putInTime) {
if(this.putInTime == -1){ if (this.putInTime == -1) {
this.putInTime = putInTime; this.putInTime = putInTime;
this.putInDate = new Date(putInTime); this.putInDate = new Date(putInTime);
} }
...@@ -229,8 +240,8 @@ public class Barcode extends BasePo implements Serializable { ...@@ -229,8 +240,8 @@ public class Barcode extends BasePo implements Serializable {
return putInDate; return putInDate;
} }
public String getPutInDateStr(){ public String getPutInDateStr() {
if(putInDate == null){ if (putInDate == null) {
return ""; return "";
} }
return DateUtil.toDateTimeString(putInDate); return DateUtil.toDateTimeString(putInDate);
...@@ -240,13 +251,13 @@ public class Barcode extends BasePo implements Serializable { ...@@ -240,13 +251,13 @@ public class Barcode extends BasePo implements Serializable {
this.putInDate = putInDate; this.putInDate = putInDate;
} }
private void updateExpTime(){ private void updateExpTime() {
if(expTime == null && maxStorageTime != 0F && putInTime != -1){ if (expTime == null && maxStorageTime != 0F && putInTime != -1) {
Float maxStorageTimeMill = maxStorageTime * 60 * 60 * 1000; Float maxStorageTimeMill = maxStorageTime * 60 * 60 * 1000;
expTime = new Date(putInTime + maxStorageTimeMill.longValue()); expTime = new Date(putInTime + maxStorageTimeMill.longValue());
if(expireDate != null){ if (expireDate != null) {
//如果是在包装上的过期时间之前,使用包装上的过期时间 //如果是在包装上的过期时间之前,使用包装上的过期时间
if(expireDate.getTime()< expTime.getTime()){ if (expireDate.getTime() < expTime.getTime()) {
expTime = expireDate; expTime = expireDate;
} }
} }
...@@ -256,9 +267,9 @@ public class Barcode extends BasePo implements Serializable { ...@@ -256,9 +267,9 @@ public class Barcode extends BasePo implements Serializable {
/** /**
* 到达回温的时间 * 到达回温的时间
*/ */
public long getReachWarmTime(){ public long getReachWarmTime() {
long reachWarmTime = System.currentTimeMillis(); long reachWarmTime = System.currentTimeMillis();
if(COMPONENT_TYPE.SOLDERPASTE == type && putInTime != -1){ if (COMPONENT_TYPE.SOLDERPASTE == type && putInTime != -1) {
reachWarmTime = putInTime + warmTime * 60 * 60 * 1000; reachWarmTime = putInTime + warmTime * 60 * 60 * 1000;
} }
return reachWarmTime; return reachWarmTime;
...@@ -267,22 +278,22 @@ public class Barcode extends BasePo implements Serializable { ...@@ -267,22 +278,22 @@ public class Barcode extends BasePo implements Serializable {
/** /**
* 是否达到回温时间,只有锡膏才需要判定 * 是否达到回温时间,只有锡膏才需要判定
*/ */
public boolean isReachedWarmTime(){ public boolean isReachedWarmTime() {
return getReachWarmTime() <= System.currentTimeMillis(); return getReachWarmTime() <= System.currentTimeMillis();
} }
public long getInStoreHour(){ public long getInStoreHour() {
if(putInTime != -1){ if (putInTime != -1) {
return (System.currentTimeMillis() - putInTime) / 60 / 60 / 1000; return (System.currentTimeMillis() - putInTime) / 60 / 60 / 1000;
} }
return 0; return 0;
} }
public long getInStoreMiniute(){ public long getInStoreMiniute() {
if(putInTime != -1){ if (putInTime != -1) {
long minutes = (System.currentTimeMillis() - getPutInTime()) / 60000 % 60; long minutes = (System.currentTimeMillis() - getPutInTime()) / 60000 % 60;
if(minutes == 0){ if (minutes == 0) {
if(getInStoreHour() == 0){ if (getInStoreHour() == 0) {
minutes = 1; minutes = 1;
} }
} }
...@@ -290,44 +301,47 @@ public class Barcode extends BasePo implements Serializable { ...@@ -290,44 +301,47 @@ public class Barcode extends BasePo implements Serializable {
} }
return 0; return 0;
} }
public void setCheckOutDate(Date checkOutDate, String opor) { public void setCheckOutDate(Date checkOutDate, String opor) {
this.checkOutDate = checkOutDate; this.checkOutDate = checkOutDate;
this.outOpor = opor; this.outOpor = opor;
if(checkOutDate != null){//出库时判断是否过期 if (checkOutDate != null) {//出库时判断是否过期
updateExpTime(); updateExpTime();
if(expTime != null && checkOutDate.after(expTime)){ if (expTime != null && checkOutDate.after(expTime)) {
//过期时间小于出库时间,说明出库的时候已经过期了 //过期时间小于出库时间,说明出库的时候已经过期了
status = BARCODE_STATUS.OUT_EXPIRED; status = BARCODE_STATUS.OUT_EXPIRED;
}else{ } else {
status = BARCODE_STATUS.OUT_NORMAL; status = BARCODE_STATUS.OUT_NORMAL;
} }
} }
} }
public void setInOpor(String inOpor) { public void setInOpor(String inOpor) {
if(putInTime == -1){ if (putInTime == -1) {
this.inOpor = inOpor; this.inOpor = inOpor;
} }
} }
public int getSolderStatus() { public int getSolderStatus() {
if(solderStatus == SOLDER_STATUS.REWARMING){ if (solderStatus == SOLDER_STATUS.REWARMING) {
//如果状态是回温中,且回温时间已经大于warmTime,修改状态为待搅拌 //如果状态是回温中,且回温时间已经大于warmTime,修改状态为待搅拌
long now = System.currentTimeMillis(); long now = System.currentTimeMillis();
if(startWarmTime - now > warmTime * 60 * 60 * 1000){ if (startWarmTime - now > warmTime * 60 * 60 * 1000) {
solderStatus = SOLDER_STATUS.TO_BE_MIXED; solderStatus = SOLDER_STATUS.TO_BE_MIXED;
} }
} }
return solderStatus; return solderStatus;
} }
public String getNeedOutDateStr(){
if(needOutDate == null){ public String getNeedOutDateStr() {
if (needOutDate == null) {
return ""; return "";
} }
return DateUtil.toDateTimeString(needOutDate); return DateUtil.toDateTimeString(needOutDate);
} }
public String getExpireDateStr(){ public String getExpireDateStr() {
if(expireDate != null){ if (expireDate != null) {
return DateUtil.toDateString(expireDate); return DateUtil.toDateString(expireDate);
} }
return ""; return "";
...@@ -336,8 +350,8 @@ public class Barcode extends BasePo implements Serializable { ...@@ -336,8 +350,8 @@ public class Barcode extends BasePo implements Serializable {
/** /**
* 是否已过期 * 是否已过期
*/ */
public boolean isExpired(){ public boolean isExpired() {
if(expireDate != null){ if (expireDate != null) {
return expireDate.before(new Date()); return expireDate.before(new Date());
} }
return false; return false;
...@@ -346,12 +360,12 @@ public class Barcode extends BasePo implements Serializable { ...@@ -346,12 +360,12 @@ public class Barcode extends BasePo implements Serializable {
/** /**
* 是否即将(3天内)过期,已过期后,此字段变为false * 是否即将(3天内)过期,已过期后,此字段变为false
*/ */
public boolean isWillExpired(){ public boolean isWillExpired() {
if(isExpired()){ if (isExpired()) {
return false; return false;
} }
if(expireDate != null){ if (expireDate != null) {
return expireDate.before(DateUtil.addDays(new Date(),3)); return expireDate.before(DateUtil.addDays(new Date(), 3));
} }
return false; return false;
} }
...@@ -359,10 +373,38 @@ public class Barcode extends BasePo implements Serializable { ...@@ -359,10 +373,38 @@ public class Barcode extends BasePo implements Serializable {
/** /**
* 是否是小料(7x8)的料 * 是否是小料(7x8)的料
*/ */
public boolean isSmallReel(){ public boolean isSmallReel() {
if(getPlateSize() == 7){ if (getPlateSize() == 7) {
return getHeight() == 8 || getHeight() == 12; return getHeight() == 8 || getHeight() == 12;
} }
return false; return false;
} }
public Barcode getSubCode(String pnStr) {
if (subCodeMap == null) {
return null;
}
for (Barcode barcode :subCodeMap.values()
) {
if (barcode.getPartNumber().equals(pnStr)) {
return barcode;
}
}
return null;
}
public void UpdateSubCode(Barcode barcode) {
if (subCodeMap == null) {
subCodeMap = new HashMap<>();
}
if (barcode.getAmount() <= 0) {
if (subCodeMap.containsKey(barcode.getBarcode())) {
subCodeMap.remove(barcode.getBarcode());
}
} else {
subCodeMap.put(barcode.getBarcode(), barcode);
}
}
} }
...@@ -6,6 +6,7 @@ import com.neotel.smfcore.common.exception.ValidateException; ...@@ -6,6 +6,7 @@ import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.DateUtil; import com.neotel.smfcore.common.utils.DateUtil;
import com.neotel.smfcore.core.barcode.bean.BarcodeRule; import com.neotel.smfcore.core.barcode.bean.BarcodeRule;
import com.neotel.smfcore.core.barcode.bean.CodeBean; import com.neotel.smfcore.core.barcode.bean.CodeBean;
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.manager.IBarcodeManager;
import com.neotel.smfcore.core.barcode.service.manager.IComponentManager; import com.neotel.smfcore.core.barcode.service.manager.IComponentManager;
import com.neotel.smfcore.core.barcode.service.po.Barcode; import com.neotel.smfcore.core.barcode.service.po.Barcode;
...@@ -13,6 +14,7 @@ import com.neotel.smfcore.core.barcode.service.po.Component; ...@@ -13,6 +14,7 @@ import com.neotel.smfcore.core.barcode.service.po.Component;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.yaml.snakeyaml.comments.CommentType;
import java.util.Collection; import java.util.Collection;
import java.util.Date; import java.util.Date;
...@@ -42,15 +44,18 @@ public class CodeResolve { ...@@ -42,15 +44,18 @@ public class CodeResolve {
} }
} }
public CodeBean resolveSingleCode(String barcodeItemStr ){
return resolveSingleCode(barcodeItemStr, COMPONENT_TYPE.COMPONENT);
}
/** /**
* 解析条码为单个 Barcode,自动保存到数据库 * 解析条码为单个 Barcode,自动保存到数据库
*/ */
public CodeBean resolveSingleCode(String barcodeItemStr){ public CodeBean resolveSingleCode(String barcodeItemStr,int type){
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("error.barcode.noRules", "解析规则未定义"); codeBean.setError("smfcode.error.barcode.noRules", "解析规则未定义");
codeBean.setCodeStr(barcodeItemStr); codeBean.setCodeStr(barcodeItemStr);
return codeBean; return codeBean;
} }
...@@ -112,19 +117,19 @@ public class CodeResolve { ...@@ -112,19 +117,19 @@ public class CodeResolve {
barcode.setLabelAmount(currentLabelAmount); barcode.setLabelAmount(currentLabelAmount);
needUpdate = true; needUpdate = true;
} }
// Date produceDate = barcodeFromRule.getProduceDate(); Date produceDate = barcodeFromRule.getProduceDate();
// if(produceDate != null){ if(produceDate != null){
// //抓取到了生产日期,未抓取到过期日期,重新设置过期日期 //抓取到了生产日期,未抓取到过期日期,重新设置过期日期
// if(barcode.getExpireDate() == null){ if(barcode.getExpireDate() == null){
// if(validDay > 0){ if(validDay > 0){
// log.info("重新设置"+codeBeanFromRule.getCodeStr()+"生产日期和过期日期"); log.info("重新设置"+codeBeanFromRule.getCodeStr()+"生产日期和过期日期");
// Date expireDate = DateUtil.addDays(produceDate, validDay); Date expireDate = DateUtil.addDays(produceDate, validDay);
// barcode.setExpireDate(expireDate); barcode.setExpireDate(expireDate);
// barcode.setProduceDate(produceDate); barcode.setProduceDate(produceDate);
// needUpdate = true; needUpdate = true;
// } }
// } }
// } }
if(needUpdate){ if(needUpdate){
try { try {
...@@ -141,7 +146,20 @@ public class CodeResolve { ...@@ -141,7 +146,20 @@ public class CodeResolve {
return codeBeanFromRule; return codeBeanFromRule;
}else if(codeBeanFromRule.isValid()){//数据库中不存在,但解析成功 }else if(codeBeanFromRule.isValid()){//数据库中不存在,但解析成功
Barcode barcodeFromRule = codeBeanFromRule.getBarcode(); Barcode barcodeFromRule = codeBeanFromRule.getBarcode();
try{ try{
if(type== COMPONENT_TYPE.FIXTURE||type==COMPONENT_TYPE.OTHERS){
//夹具类型,默认设置尺寸,数量
if(!codeBeanFromRule.hasReelSizeInfo()){
codeBeanFromRule.setReelHeight(1);
codeBeanFromRule.setReelWidth(1);
barcodeFromRule.setAmount(1);
barcodeFromRule.setHeight(1);
barcodeFromRule.setPlateSize(1);
}
}
//如果有料盘尺寸,重新设置料盘尺寸信息,没有档案时自动添加档案 //如果有料盘尺寸,重新设置料盘尺寸信息,没有档案时自动添加档案
if(codeBeanFromRule.hasReelSizeInfo()){ if(codeBeanFromRule.hasReelSizeInfo()){
//log.info("料盘["+barcode.getBarcode()+"]的尺寸信息从["+barcode.getPlateSize()+"x"+barcode.getHeight()+"]设置为["+codeBeanFromRule.getReelWidth()+"x"+codeBeanFromRule.getReelHeight()+"]"); //log.info("料盘["+barcode.getBarcode()+"]的尺寸信息从["+barcode.getPlateSize()+"x"+barcode.getHeight()+"]设置为["+codeBeanFromRule.getReelWidth()+"x"+codeBeanFromRule.getReelHeight()+"]");
...@@ -192,28 +210,30 @@ public class CodeResolve { ...@@ -192,28 +210,30 @@ public class CodeResolve {
} }
} }
barcode = barcodeManager.save(barcodeFromRule); barcode = barcodeManager.save(barcodeFromRule);
codeBeanFromRule.setCodeStr(barcode.getBarcode()); codeBeanFromRule.setCodeStr(barcode.getBarcode());
codeBeanFromRule.setBarcode(barcode); codeBeanFromRule.setBarcode(barcode);
codeBeanFromRule.setError(null,null); codeBeanFromRule.setError(null,null);
} }
}catch (ValidateException ve){ }catch (ValidateException ve){
//档案不存在 //档案不存在
codeBeanFromRule.setError("error.barcode.pnNotExist",new String[]{barcodeFromRule.getPartNumber()},"x档案 "+barcodeFromRule.getPartNumber()+" 不存在"); codeBeanFromRule.setError("smfcode.error.barcode.pnNotExist",new String[]{barcodeFromRule.getPartNumber()},"档案 {0} 不存在");
log.warn("x档案"+barcodeFromRule.getPartNumber()+"不存在"); log.warn("档案"+barcodeFromRule.getPartNumber()+"不存在");
} }
//解析成功了,直接返回 //解析成功了,直接返回
return codeBeanFromRule; return codeBeanFromRule;
}else{ }else{
//在数据库中不存在,且未解析成功,用其他规则再解析 //在数据库中不存在,且未解析成功,用其他规则再解析
codeBeanFromRule.setError("error.barcode.invalid",new String[]{barcodeItemStr}, barcodeItemStr + "不是有效的条码"); codeBeanFromRule.setError("smfcode.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("error.barcode.invalid",new String[]{barcodeItemStr}, barcodeItemStr + "不是有效的条码"); codeBeanFromRule.setError("smfcode.error.barcode.invalid",new String[]{barcodeItemStr}, "{0}不是有效的条码");
codeBeanFromRule.setCodeStr(barcodeItemStr); codeBeanFromRule.setCodeStr(barcodeItemStr);
return codeBeanFromRule; return codeBeanFromRule;
} }
...@@ -221,7 +241,6 @@ public class CodeResolve { ...@@ -221,7 +241,6 @@ public class CodeResolve {
} }
/** /**
* 解析条码为单个 Barcode * 解析条码为单个 Barcode
*/ */
......
...@@ -136,10 +136,10 @@ public class StatusBean { ...@@ -136,10 +136,10 @@ public class StatusBean {
} }
/** /**
* 是否超时(3秒) * 是否超时(10秒)
*/ */
public boolean timeOut(){ public boolean timeOut(){
return System.currentTimeMillis() - time > 10 * 1000; return (System.currentTimeMillis() - time) >( 10 * 1000);
} }
/** /**
......
package com.neotel.smfcore.core.device.handler.impl;
import com.neotel.smfcore.core.device.api.IOpAuthApi;
import com.neotel.smfcore.core.device.bean.StatusBean;
import com.neotel.smfcore.core.device.enums.OP_STATUS;
import com.neotel.smfcore.core.order.enums.ORDER_COLOR;
import com.neotel.smfcore.core.storage.enums.DeviceType;
import com.neotel.smfcore.core.system.service.po.DataLog;
import lombok.extern.slf4j.Slf4j;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
@Slf4j
public class AccShelfHandler extends BaseDeviceHandler{
public AccShelfHandler(List<IOpAuthApi> apiList) {
super(apiList);
}
@Override
public StatusBean handleClientRequest(StatusBean statusBean, HttpServletRequest request) {
handleMsg(statusBean);
statusBean = saveAlarmAndHumidity(statusBean);
//亮灯
Collection<DataLog> queueTasks = taskService.getQueueTasks(statusBean.getCid());
for (DataLog queueTask : queueTasks) {
if(queueTask.isWait()){
queueTask.setStatus(OP_STATUS.EXECUTING.name());
taskService.updateQueueTask(queueTask);
String rgb = queueTask.getLightColor();
ORDER_COLOR color = ORDER_COLOR.fromRgb(rgb);
if(color == null){
if(queueTask.isPutInTask()){
color = ORDER_COLOR.DARKGREEN;
}else{
color = ORDER_COLOR.BLUE;
}
}
statusBean.addData("open",queueTask.getPosName()+"="+color.name());
log.info("库位["+queueTask.getPosName()+"]+亮灯:" + color.name());
}
}
return statusBean;
}
@Override
public DeviceType getDeviceType() {
return DeviceType.ACCSHELF;
}
}
package com.neotel.smfcore.core.device.handler.impl; package com.neotel.smfcore.core.device.handler.impl;
import cn.hutool.core.util.ObjectUtil;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.exception.ValidateException; import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.ReelLockPosUtil; import com.neotel.smfcore.common.utils.ReelLockPosUtil;
import com.neotel.smfcore.common.utils.SecurityUtils;
import com.neotel.smfcore.common.utils.StorageConstants; import com.neotel.smfcore.common.utils.StorageConstants;
import com.neotel.smfcore.core.barcode.bean.CodeBean; import com.neotel.smfcore.core.barcode.bean.CodeBean;
import com.neotel.smfcore.core.barcode.enums.COMPONENT_TYPE; import com.neotel.smfcore.core.barcode.enums.COMPONENT_TYPE;
...@@ -515,10 +518,10 @@ public class BaseDeviceHandler implements IDeviceHandler { ...@@ -515,10 +518,10 @@ public class BaseDeviceHandler implements IDeviceHandler {
protected void finishedOutPos(String cid, String posName,int executeTime) throws ValidateException { protected void finishedOutPos(String cid, String posName,int executeTime) throws ValidateException {
DataLog task = taskService.findExecutingTask(cid, posName); DataLog task = taskService.findExecutingTask(cid, posName);
if (task != null && task.isCheckOutTask()) { if (task != null && task.isCheckOutTask()) {
if(executeTime>0){ if (executeTime > 0) {
task.setExecuteTime(executeTime); task.setExecuteTime(executeTime);
} }
log.info(task.getBarcode() + "出仓位[" + task.getPosName() + "]完成,执行时间["+executeTime+"]秒"); log.info(task.getBarcode() + "出仓位[" + task.getPosName() + "]完成,执行时间[" + executeTime + "]秒");
DataLog cancelTask = taskService.findFinishedTask(cid, posName); DataLog cancelTask = taskService.findFinishedTask(cid, posName);
if (cancelTask != null && cancelTask.isCancel()) { if (cancelTask != null && cancelTask.isCancel()) {
//将相同库位已经取消的任务从完成队列里删除 //将相同库位已经取消的任务从完成队列里删除
...@@ -532,14 +535,27 @@ public class BaseDeviceHandler implements IDeviceHandler { ...@@ -532,14 +535,27 @@ public class BaseDeviceHandler implements IDeviceHandler {
task = taskService.findFinishedTask(cid, posName); task = taskService.findFinishedTask(cid, posName);
if (task != null && task.isCheckOutTask()) { if (task != null && task.isCheckOutTask()) {
if (task.isCancel()) {//被取消的任务,客户端发完成信号过来,修改取消状态为已完成 if (task.isCancel()) {//被取消的任务,客户端发完成信号过来,修改取消状态为已完成
if(executeTime>0){ if (executeTime > 0) {
task.setExecuteTime(executeTime); task.setExecuteTime(executeTime);
} }
log.info(task.getBarcode() + "出仓位[" + task.getPosName() + "]完成,但任务已被取消,修改为完成,执行时间["+executeTime+"]秒"); log.info(task.getBarcode() + "出仓位[" + task.getPosName() + "]完成,但任务已被取消,修改为完成,执行时间[" + executeTime + "]秒");
updateCheckoutData(task); updateCheckoutData(task);
} }
} else { } else {
log.warn(cid + "出仓位[" + posName + "]完成时任务不存在"); StoragePos storagePos = storagePosManager.getByPosName(posName);
if (storagePos != null && storagePos.isUsed()) {
String barcode = storagePos.getBarcode().getBarcode();
//查找库位是否为空,如果库位有料,调用清理手动出库的方法清理库存
if (ObjectUtil.isNotEmpty(barcode)) {
log.info(cid + "出仓位[" + posName + "]完成时任务不存在,清理库位中的库存[" + barcode + "]");
taskService.addTaskToFinished(storagePos, null, cid + "-clear");
}else{
log.info(cid + "出仓位[" + posName + "]完成时任务不存在,清理库位失败,条码为空");
}
} else {
log.warn(cid + "出仓位[" + posName + "]完成时任务不存在");
}
} }
} }
} }
......
package com.neotel.smfcore.core.device.handler.impl;
import com.neotel.smfcore.core.device.api.IOpAuthApi;
import com.neotel.smfcore.core.device.bean.StatusBean;
import com.neotel.smfcore.core.device.enums.OP;
import com.neotel.smfcore.core.storage.enums.DeviceType;
import com.neotel.smfcore.core.storage.service.po.Storage;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
@Service
@Slf4j
public class LineBoxHandler extends BaseDeviceHandler {
public LineBoxHandler(List<IOpAuthApi> apiList) {
super(apiList);
}
@Override
public StatusBean handleClientRequest(StatusBean statusBean, HttpServletRequest request) {
String cid = statusBean.getCid();
Storage storage = dataCache.getStorage(cid);
if (storage == null) {
log.error("料仓cid: [" + cid + "]不存在");
return null;
}
handleMsg(statusBean);
statusBean = saveAlarmAndHumidity(statusBean);
statusBean = handleInOutFinished(statusBean);
StatusBean humidityResult = handleHumidity(statusBean);
if (humidityResult != null) {
return humidityResult;
}
if (statusBean.getOp() == OP.PUT_IN) {
log.debug("入库:" + statusBean.toString());
statusBean = putInLine(storage, statusBean);
} else {
//查看是否有要出库的操作
statusBean =taskService.checkOut(storage, statusBean);
}
return statusBean;
}
@Override
public DeviceType getDeviceType() {
return DeviceType.LINE;
}
}
package com.neotel.smfcore.core.device.handler.impl; package com.neotel.smfcore.core.device.handler.impl;
import cn.hutool.core.util.ObjectUtil;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.neotel.smfcore.common.bean.ResultBean; import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.exception.ValidateException; import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.SecurityUtils; import com.neotel.smfcore.common.utils.SecurityUtils;
...@@ -20,6 +22,7 @@ import com.neotel.smfcore.core.storage.enums.DeviceType; ...@@ -20,6 +22,7 @@ import com.neotel.smfcore.core.storage.enums.DeviceType;
import com.neotel.smfcore.core.storage.service.po.Storage; import com.neotel.smfcore.core.storage.service.po.Storage;
import com.neotel.smfcore.core.storage.service.po.StoragePos; import com.neotel.smfcore.core.storage.service.po.StoragePos;
import com.neotel.smfcore.core.system.service.po.DataLog; import com.neotel.smfcore.core.system.service.po.DataLog;
import com.neotel.smfcore.core.system.util.DevicesStatusUtil;
import com.neotel.smfcore.core.system.websocket.MsgType; import com.neotel.smfcore.core.system.websocket.MsgType;
import com.neotel.smfcore.core.system.websocket.SocketMsg; import com.neotel.smfcore.core.system.websocket.SocketMsg;
import com.neotel.smfcore.core.system.websocket.WebSocketServer; import com.neotel.smfcore.core.system.websocket.WebSocketServer;
...@@ -175,6 +178,14 @@ public class SensorShelfHandler extends BaseDeviceHandler { ...@@ -175,6 +178,14 @@ public class SensorShelfHandler extends BaseDeviceHandler {
String[] hasReelPosList = request.getParameterValues("hasReelPosList"); String[] hasReelPosList = request.getParameterValues("hasReelPosList");
String[] noReelPosList = request.getParameterValues("noReelPosList"); String[] noReelPosList = request.getParameterValues("noReelPosList");
String[] hasReelPosErrorList = request.getParameterValues("hasReelPosErrorList");
String[] noReelPosErrorList = request.getParameterValues("noReelPosErrorList");
List<List<String>> data=new ArrayList<>();
data.add(Arrays.asList(hasReelPosErrorList) );
data.add(Arrays.asList(noReelPosErrorList));
DevicesStatusUtil.updateDeviceData(cid,data);
List<String> inOkList = new ArrayList<>(); List<String> inOkList = new ArrayList<>();
List<String> inNgList = new ArrayList<>(); List<String> inNgList = new ArrayList<>();
List<String> outOkList = new ArrayList<>(); List<String> outOkList = new ArrayList<>();
...@@ -198,25 +209,34 @@ public class SensorShelfHandler extends BaseDeviceHandler { ...@@ -198,25 +209,34 @@ public class SensorShelfHandler extends BaseDeviceHandler {
}else{ }else{
Collection<DataLog> queueTasks = taskService.getQueueTasks(); Collection<DataLog> queueTasks = taskService.getQueueTasks();
for (DataLog queueTask : queueTasks) { for (DataLog queueTask : queueTasks) {
if(queueTask.isPutInTask() && queueTask.getGroupId().equals(groupId)){ boolean isPutInTask=false;
queueTask.setCid(cid); if(ObjectUtil.isNotEmpty(queueTask.getStorageId()) ){
queueTask.setPosId(pos.getId()); if(queueTask.isPutInTask()&&queueTask.getStorageId().equals(storage.getId())){
queueTask.setPosName(pos.getPosName()); isPutInTask=true;
queueTask.setStorageId(pos.getStorageId());
queueTask.setStorageName(storage.getName());
try {
//入库完成,发送入库完成请求
super.finishedPutIn(cid,pos.getPosName());
inOkList.add(hasReelPosList[0]);
String msg = queueTask.getBarcode()+ "入库到"+ pos.getPosName()+"成功";
log.error(msg);
WebSocketServer.sendGroupMsg(groupId,new SocketMsg(msg, MsgType.INFO));
break;
} catch (Exception e) {
log.error("入库出错",e);
return ResultBean.newErrorResult(-1,"smfcore.inputError","入库出错:{0}" ,new String[]{ e.getMessage()});
} }
} }
else if(queueTask.isPutInTask() && queueTask.getGroupId().equals(groupId)) {
isPutInTask = true;
}
if(isPutInTask) {
queueTask.setCid(cid);
queueTask.setPosId(pos.getId());
queueTask.setPosName(pos.getPosName());
queueTask.setStorageId(pos.getStorageId());
queueTask.setStorageName(storage.getName());
try {
//入库完成,发送入库完成请求
super.finishedPutIn(cid, pos.getPosName());
inOkList.add(hasReelPosList[0]);
String msg = queueTask.getBarcode() + "入库到" + pos.getPosName() + "成功";
log.error(msg);
WebSocketServer.sendGroupMsg(groupId, new SocketMsg(msg, MsgType.INFO));
break;
} catch (Exception e) {
log.error("入库出错", e);
return ResultBean.newErrorResult(-1, "smfcore.inputError", "入库出错:{0}", new String[]{e.getMessage()});
}
}
} }
if(inOkList.size() == 0){ if(inOkList.size() == 0){
inNgList.add(hasReelPosList[0]); inNgList.add(hasReelPosList[0]);
......
package com.neotel.smfcore.core.device.handler.impl;
import com.google.common.base.Strings;
import com.neotel.smfcore.common.utils.StorageConstants;
import com.neotel.smfcore.core.device.api.IOpAuthApi;
import com.neotel.smfcore.core.device.bean.BoxStatusBean;
import com.neotel.smfcore.core.device.bean.StatusBean;
import com.neotel.smfcore.core.device.enums.BOX_STATUS;
import com.neotel.smfcore.core.device.enums.OP;
import com.neotel.smfcore.core.device.enums.OP_STATUS;
import com.neotel.smfcore.core.storage.enums.DeviceType;
import com.neotel.smfcore.core.storage.service.po.StoragePos;
import com.neotel.smfcore.core.system.service.po.DataLog;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@Service
@Slf4j
public class XLCBoxHandler extends BaseDeviceHandler {
public XLCBoxHandler(List<IOpAuthApi> apiList) {
super(apiList);
}
/**
* 当前出入库操作的库位(key为cid, value为当前执行的任务)
*/
private Map<String,DataLog> operateTaskMap = new ConcurrentHashMap<>();
/**
* 获取当前正在执行的任务
*/
public DataLog getCurrentTask(String cid){
return operateTaskMap.get(cid);
}
/**
* 更新或清理(task为null)当前正在执行的任务
*/
public void updateCurrentTask(String cid, DataLog task){
if(task == null){
operateTaskMap.remove(cid);
}else{
operateTaskMap.put(cid, task);
}
}
@Override
public StatusBean handleClientRequest(StatusBean statusBean, HttpServletRequest request) {
handleMsg(statusBean);
statusBean = saveAlarmAndHumidity(statusBean);
statusBean = handleXLCStatusBean(statusBean);
statusBean = handleInOutFinished(statusBean);
StatusBean humidityResult = handleHumidity(statusBean);
if(humidityResult != null){
return humidityResult;
}
return statusBean;
}
private StatusBean handleXLCStatusBean(StatusBean statusBean){
String cid = statusBean.getCid();
Collection<DataLog> queueTasks = taskService.getQueueTasks(cid);
Map<String, BoxStatusBean> statusOfBoxes = statusBean.getBoxStatus();
if (statusOfBoxes != null) {
for (BoxStatusBean boxStatus : statusOfBoxes.values()) {
try {
//出库入库动作完成处理
int status = boxStatus.getStatus();
String posName = boxStatus.getPosId();
if(!Strings.isNullOrEmpty(posName)){//客户端发一次完成之后,会发空的 posName,不需要处理
if (BOX_STATUS.OUT_FINISHED == status) {//出仓完成,设置当前任务
DataLog currentTask = null;
for (DataLog queueTask : queueTasks) {
if(queueTask.isExecuting() && queueTask.getPosName().equals(posName)){
currentTask = queueTask;
String doorInfo = statusBean.getFromData("door");
if(doorInfo == null){
doorInfo = "1";
}
currentTask.setSubSourceId(doorInfo);
taskService.updateQueueTask(currentTask);
break;
}
}
DataLog cacheTask = operateTaskMap.get(cid);
if(currentTask != null){
if(cacheTask == null || !cacheTask.getId().equals(currentTask.getId())){
updateCurrentTask(currentTask.getCid(),currentTask);
}
}
}
}
} catch (Exception e) {
log.error("方仓到位时出错",e);
}
}
}
if(statusBean.getStatus() == StorageConstants.STATUS.READY){
DataLog currentTask = getCurrentTask(cid);
if(currentTask != null){
//当前有任务未完成,暂不执行其他任务
return statusBean;
}
for (DataLog task : queueTasks) {
if (cid.equals(task.getCid()) && task.isWait()) {
StoragePos pos = storagePosManager.getByPosName(task.getPosName());
if(pos.isExpandPos()){
continue;
}
if(task.isPutInTask()){
statusBean.setOp(OP.PUT_IN);
statusBean.addData("door",task.getSubSourceId());
}else if(task.isCheckOutTask()){
statusBean.setOp(OP.CHECKOUT);
}
statusBean.addPosInfo("",pos.getPosName(),pos.getW(),pos.getH(),false);
log.info("发送["+task.getType()+"]任务["+pos.getPosName()+"]到客户端door="+task.getSubSourceId());
task.setStatus(OP_STATUS.EXECUTING.name());
taskService.updateQueueTask(task);
return statusBean;
}
}
}
return statusBean;
}
@Override
public DeviceType getDeviceType() {
return DeviceType.SMD_XLC;
}
}
...@@ -214,20 +214,21 @@ public class DeviceController { ...@@ -214,20 +214,21 @@ public class DeviceController {
resultMap.put("result","0"); resultMap.put("result","0");
resultMap.put("msg",""); resultMap.put("msg","");
okMsg = "["+rfid+"]["+barcode.getBarcode()+"]锁定库位["+pos.getPosName()+"]";
okMsg = "["+rfid+"]["+barcode.getBarcode()+"]锁定库位["+pos.getPosName()+"]优先级["+pos.getPriority()+"] 上个库位号["+lastPosId+"]";
ReelLockPosInfo oldLockInfo = ReelLockPosUtil.getLockPosInfoByCode(barcode.getBarcode()); ReelLockPosInfo oldLockInfo = ReelLockPosUtil.getLockPosInfoByCode(barcode.getBarcode());
if(oldLockInfo != null){ if(oldLockInfo != null) {
if(!oldLockInfo.getBarcode().equals(barcode.getBarcode())){ if (!oldLockInfo.getBarcode().equals(barcode.getBarcode())) {
String result = "-1"; String result = "-1";
okMsg = rfid+"["+ rfidLoc +"]["+barcode.getBarcode()+"]锁定库位["+pos.getPosName()+"],清理旧有锁定信息"; okMsg = rfid + "[" + rfidLoc + "][" + barcode.getBarcode() + "]锁定库位[" + pos.getPosName() + "],清理旧有锁定信息";
resultMap.put("result",result); resultMap.put("result", result);
resultMap.put("msg",okMsg); resultMap.put("msg", okMsg);
//已经锁定过库位,但不是同一个条码,需要把对应位置的锁定信息清理掉 //已经锁定过库位,但不是同一个条码,需要把对应位置的锁定信息清理掉
ReelLockPosUtil.removeReelLockPosInfo(oldLockInfo.getBarcode()); ReelLockPosUtil.removeReelLockPosInfo(oldLockInfo.getBarcode());
log.info("清理锁定库位:库位号["+oldLockInfo.getLockPosName()+"]上物料["+oldLockInfo.getBarcode()+"]锁定的库位"); log.info("清理锁定库位:库位号[" + oldLockInfo.getLockPosName() + "]上物料[" + oldLockInfo.getBarcode() + "]锁定的库位");
} }
} }
......
...@@ -527,4 +527,17 @@ public class DataCache { ...@@ -527,4 +527,17 @@ public class DataCache {
} }
return cidList; return cidList;
} }
public List<String> getAvailableStorageIds(){
List<String> availableStorageIds = new ArrayList<>();
for (Storage storage : getAllStorage().values()) {
//默认所有料仓可用
// StatusBean statusBean =dataCache. getStatus(storage.getCid());
// if (statusBean.isAvailable())
{
availableStorageIds.add(storage.getId());
}
}
return availableStorageIds;
}
} }
...@@ -4,22 +4,24 @@ import cn.hutool.core.util.ObjectUtil; ...@@ -4,22 +4,24 @@ import cn.hutool.core.util.ObjectUtil;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.neotel.smfcore.common.bean.PageData; 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.exception.ValidateException;
import com.neotel.smfcore.common.utils.QueryHelp; import com.neotel.smfcore.common.utils.QueryHelp;
import com.neotel.smfcore.common.utils.SecurityUtils; import com.neotel.smfcore.common.utils.SecurityUtils;
import com.neotel.smfcore.common.utils.StringUtils; import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.barcode.service.po.Barcode;
import com.neotel.smfcore.core.device.bean.BoxStatusBean; import com.neotel.smfcore.core.device.bean.BoxStatusBean;
import com.neotel.smfcore.core.device.bean.StatusBean; import com.neotel.smfcore.core.device.bean.StatusBean;
import com.neotel.smfcore.core.device.enums.OP_STATUS; import com.neotel.smfcore.core.device.enums.OP_STATUS;
import com.neotel.smfcore.core.device.util.DataCache; import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.core.kanban.rest.bean.dto.BoxKanbanDto; import com.neotel.smfcore.core.kanban.rest.bean.dto.*;
import com.neotel.smfcore.core.kanban.rest.bean.dto.BoxStatusDto;
import com.neotel.smfcore.core.kanban.rest.bean.dto.BoxTaskDto;
import com.neotel.smfcore.core.kanban.rest.bean.dto.GroupStatusDto;
import com.neotel.smfcore.core.kanban.rest.bean.mapstruct.BoxTaskMapper; import com.neotel.smfcore.core.kanban.rest.bean.mapstruct.BoxTaskMapper;
import com.neotel.smfcore.core.kanban.rest.bean.query.BoxTaskQueryCriter; import com.neotel.smfcore.core.kanban.rest.bean.query.BoxTaskQueryCriter;
import com.neotel.smfcore.core.storage.enums.DeviceType; import com.neotel.smfcore.core.storage.enums.DeviceType;
import com.neotel.smfcore.core.storage.service.manager.IStoragePosManager;
import com.neotel.smfcore.core.storage.service.manager.impl.StoragePosManagerImpl;
import com.neotel.smfcore.core.storage.service.po.Storage; 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.manager.impl.DataLogManagerImpl; import com.neotel.smfcore.core.system.service.manager.impl.DataLogManagerImpl;
import com.neotel.smfcore.core.system.service.po.DataLog; import com.neotel.smfcore.core.system.service.po.DataLog;
import com.neotel.smfcore.core.system.service.po.Humiture; import com.neotel.smfcore.core.system.service.po.Humiture;
...@@ -42,9 +44,7 @@ import org.springframework.data.mongodb.core.query.Criteria; ...@@ -42,9 +44,7 @@ import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query; import org.springframework.data.mongodb.core.query.Query;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.*; import java.util.*;
import java.util.regex.Matcher; import java.util.regex.Matcher;
...@@ -70,6 +70,8 @@ public class BoxKanbanController { ...@@ -70,6 +70,8 @@ public class BoxKanbanController {
UserManagerImpl userManager; UserManagerImpl userManager;
@Autowired @Autowired
IGroupManager groupManager; IGroupManager groupManager;
@Autowired
IStoragePosManager storagePosManager;
@ApiOperation("获取看板数据") @ApiOperation("获取看板数据")
...@@ -170,7 +172,6 @@ public class BoxKanbanController { ...@@ -170,7 +172,6 @@ public class BoxKanbanController {
continue; continue;
} }
dtos.add(boxTaskMapper.toDto(datalog));
boolean blurryOk = false; boolean blurryOk = false;
// 如果是多字段 // 如果是多字段
String blurry = criteria.getBlurry(); String blurry = criteria.getBlurry();
...@@ -178,17 +179,26 @@ public class BoxKanbanController { ...@@ -178,17 +179,26 @@ public class BoxKanbanController {
String[] blurrys = blurry.split(","); String[] blurrys = blurry.split(",");
String[] valueArray = new String[]{datalog.getPosName(), datalog.getStorageName(), datalog.getCid(), datalog.getPartNumber(), datalog.getBarcode(), datalog.getSourceName()}; String[] valueArray = new String[]{datalog.getPosName(), datalog.getStorageName(), datalog.getCid(), datalog.getPartNumber(), datalog.getBarcode(), datalog.getSourceName()};
for (String s : blurrys) { for (String s : blurrys) {
for (String v : if(ObjectUtil.isNotEmpty(s)){
valueArray) { for (String v :
Pattern pattern = Pattern.compile(QueryHelp.escapeExprSpecialWord(s), Pattern.CASE_INSENSITIVE); valueArray) {
Matcher m = pattern.matcher(v); try {
while (m.find()) { Pattern pattern = Pattern.compile(QueryHelp.escapeExprSpecialWord(s), Pattern.CASE_INSENSITIVE);
blurryOk = true; Matcher m = pattern.matcher(v);
break; while (m.find()) {
blurryOk = true;
break;
}
if (blurryOk) break;
}catch (Exception ex){
log.error(ex.toString());
}
} }
if (blurryOk) break; if (blurryOk) break;
} }
if (blurryOk) break; else{
blurryOk=true;
}
} }
...@@ -234,6 +244,123 @@ public class BoxKanbanController { ...@@ -234,6 +244,123 @@ public class BoxKanbanController {
} }
@ApiOperation("料仓详情")
@GetMapping("/boxView")
@PreAuthorize("@el.check('boxkanban:boxView')")
public BoxStatusDto boxView(String id) {
List<DataLog> allTasks=taskService.getAllTasks();
Storage storage=dataCache.getStorageById(id);
BoxStatusDto dto=getBoxDto(storage,allTasks);
return dto;
}
@ApiOperation("获取料架库位报警列表")
@GetMapping("/shelfPosErrors")
@PreAuthorize("@el.check('boxkanban:list')")
public List<ShelfPosErrorDto> shelfPosErrors(String storageId,String groupId) {
// String storageId=map.get("storageId");
// String groupId=map.get("groupId");
List<String> cids=new ArrayList<>();
if(ObjectUtil.isNotEmpty(storageId)){
Storage storage=dataCache.getStorageById(storageId);
cids.add(storage.getCid());
}else{
cids =dataCache. getCidsByGroupId(groupId, false);
}
List<ShelfPosErrorDto> dtos=new ArrayList<>();
List<String> allhasReelPosErrorList=new ArrayList<>();
List<String> allnoReelPosErrorList = new ArrayList<>();
for (String cid :
cids) {
List<List<String>> objects = DevicesStatusUtil.getDeviceData(cid);
// List<String> hasReelPosErrorList =new ArrayList<>();
// List<String> noReelPosErrorList =new ArrayList<>();
List<String> hasReelPosErrorList =Arrays.asList(new String[]{"4D1112AA0014","4D0603BB0012","4D0303AA0015"});
List<String> noReelPosErrorList =Arrays.asList(new String[]{"4D0601AA0002","4D0601BB0001","4D0601BB0003"});
if(objects!=null&&objects.size()==2){
hasReelPosErrorList = objects.get(0);
noReelPosErrorList = objects.get(1);
}
if (hasReelPosErrorList != null && hasReelPosErrorList.size() > 0) {
allhasReelPosErrorList.addAll(hasReelPosErrorList);
}
if (noReelPosErrorList != null && noReelPosErrorList.size() > 0) {
allnoReelPosErrorList.addAll(noReelPosErrorList);
}
}
if(allhasReelPosErrorList.size()>0){
Query query=new Query(Criteria.where("posName").in(allhasReelPosErrorList.toArray()));
List<StoragePos> posList= storagePosManager.findByQuery(query);
for (StoragePos pos:posList
) {
if(!pos.isUsed()){
continue;
}
ShelfPosErrorDto posDto=new ShelfPosErrorDto();
posDto.setPosId(pos.getId());
posDto.setBarcode(pos.getBarcode().getBarcode());
posDto.setPartNumber(pos.getBarcode().getPartNumber());
posDto.setPosName(pos.getPosName());
posDto.setSignalState(0);
dtos.add(posDto);
}
}
if(allnoReelPosErrorList.size()>0){
Query query=new Query(Criteria.where("posName").in(allnoReelPosErrorList.toArray()));
List<StoragePos> posList= storagePosManager.findByQuery(query);
for (StoragePos pos:posList
) {
if(pos.isUsed()){
continue;
}
ShelfPosErrorDto posDto=new ShelfPosErrorDto();
posDto.setPosId(pos.getId());
posDto.setBarcode("");
posDto.setPartNumber("");
posDto.setPosName(pos.getPosName());
posDto.setSignalState(1);
dtos.add(posDto);
}
}
return dtos;
}
@ApiOperation("清除报警库位物料")
@PutMapping("/clearPos")
@PreAuthorize("@el.check('storagePos:edit')")
public ResultBean clearPos(@RequestBody String posName) {
StoragePos storagePos = storagePosManager.getByPosName(posName);
if (storagePos != null) {
try {
log.info("开始手动清除报警库位[" + storagePos.getPosName() + "]");
Barcode barcode = storagePos.getBarcode();
if (barcode != null) {
log.info("清除报警库位[" + storagePos.getPosName() + "]中的库存" + barcode.getBarcode());
String opUser = SecurityUtils.getCurrentUsername();
log.info(opUser + "清除报警库位[" + storagePos.getPosName() + "]中的库存" + barcode.getBarcode());
taskService.addTaskToFinished(storagePos, null, opUser + "-clear");
}
return ResultBean.newOkResult("");
} catch (Exception e) {
throw new ValidateException("smfcore.error", "出错{0}", new String[]{e.toString()});
}
}
throw new ValidateException("smfcore.posNotExist", "仓位不存在");
}
private BoxKanbanDto getKanBan(List<DataLog> allTasks) { private BoxKanbanDto getKanBan(List<DataLog> allTasks) {
...@@ -275,9 +402,9 @@ public class BoxKanbanController { ...@@ -275,9 +402,9 @@ public class BoxKanbanController {
} }
} }
int allCount = inTask + outTask; int allCount = inTask + outTask;
BoxStatusDto boxDto = new BoxStatusDto(storage.getId(), storage.getCid(), storage.getName(), false, 0, BoxStatusDto boxDto = new BoxStatusDto(storage.getId(), storage.getName(), storage.getCid(), false, 0,
"0", "0", "", allCount, inTask, outTask, "0", "0", "", allCount, inTask, outTask,
0, "", "", "", "", "",storage.getType()); 0, "", "", "", "", "",storage.getType(),storage.getUsageMap(),new HashMap<>());
//获取设备状态,设置状态和当前任务信息 //获取设备状态,设置状态和当前任务信息
StatusBean bean = DevicesStatusUtil.getStatusBean(storage.getCid()); StatusBean bean = DevicesStatusUtil.getStatusBean(storage.getCid());
...@@ -289,29 +416,31 @@ public class BoxKanbanController { ...@@ -289,29 +416,31 @@ public class BoxKanbanController {
boxDto.setOnLine(false); boxDto.setOnLine(false);
} else { } else {
boxDto.setOnLine(true); boxDto.setOnLine(true);
} for (BoxStatusBean boxStatus : bean.getBoxStatus().values()) {
for (BoxStatusBean boxStatus : bean.getBoxStatus().values()) { String humidity = boxStatus.getHumidity();
String humidity = boxStatus.getHumidity(); String temperature = boxStatus.getTemperature();
String temperature = boxStatus.getTemperature(); boxDto.setHumidity(humidity);
boxDto.setHumidity(humidity); boxDto.setTemperature(temperature);
boxDto.setTemperature(temperature); boxDto.setStatus(bean.getStatus());
boxDto.setStatus(bean.getStatus()); boxDto.setMsg(bean.getMsg());
boxDto.setMsg(bean.getMsg()); boxDto.setBarcode(bean.getCode());
boxDto.setBarcode(bean.getCode()); boxDto.setPosName(bean.getPosId());
boxDto.setPosName(bean.getPosId()); boxDto.setData(bean.getData());
if(!StringUtils.isEmpty(bean.getPosId())) {
DataLog task = taskService.findExecutingTask(storage.getCid(), bean.getPosId()); if (!StringUtils.isEmpty(bean.getPosId())) {
if (task != null) { DataLog task = taskService.findExecutingTask(storage.getCid(), bean.getPosId());
boxDto.setPartNumber(task.getPartNumber()); if (task != null) {
boxDto.setSourceName(task.getSourceName()); boxDto.setPartNumber(task.getPartNumber());
boxDto.setCurrTaskType(task.getType()); boxDto.setSourceName(task.getSourceName());
boxDto.setCurrTaskStatus(task.getStatus()); boxDto.setCurrTaskType(task.getType());
boxDto.setCurrTaskStatus(task.getStatus());
}
} }
}
break; break;
}
} }
} }
return boxDto; return boxDto;
......
package com.neotel.smfcore.core.kanban.rest.bean.dto; package com.neotel.smfcore.core.kanban.rest.bean.dto;
import com.neotel.smfcore.core.device.enums.OP_STATUS; import com.neotel.smfcore.core.device.enums.OP_STATUS;
import com.neotel.smfcore.core.storage.bean.UsageItem;
import com.neotel.smfcore.core.storage.enums.DeviceType; import com.neotel.smfcore.core.storage.enums.DeviceType;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@Data @Data
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
...@@ -24,13 +29,6 @@ public class BoxStatusDto { ...@@ -24,13 +29,6 @@ public class BoxStatusDto {
@ApiModelProperty("是否在线") @ApiModelProperty("是否在线")
private boolean onLine=false; private boolean onLine=false;
/// <summary>
/// 单台BOX状态
///1=正常运行中
/// 2=急停,3=故障,4=警告,5=调试中
/// 6入库执行中,7入仓位完成,8入库失败
/// 9出库执行中,10出仓位完成,11出库失败
/// </summary>
@ApiModelProperty("单台BOX状态,0=离线,1=正常运行中, 2=急停,3=故障,4=警告,5=调试中,6入库执行中,7入仓位完成,8入库失败, 9出库执行中,10出仓位完成,11出库失败") @ApiModelProperty("单台BOX状态,0=离线,1=正常运行中, 2=急停,3=故障,4=警告,5=调试中,6入库执行中,7入仓位完成,8入库失败, 9出库执行中,10出仓位完成,11出库失败")
private int status=0; private int status=0;
@ApiModelProperty("温度") @ApiModelProperty("温度")
...@@ -51,10 +49,6 @@ public class BoxStatusDto { ...@@ -51,10 +49,6 @@ public class BoxStatusDto {
@ApiModelProperty("当前执行任务的,0=无,1=入库,2=出库") @ApiModelProperty("当前执行任务的,0=无,1=入库,2=出库")
private int currTaskType=0; private int currTaskType=0;
/**
* 当前执行任务的 任务状态:OP_STATUS:NONE,WAIT=等待,EXECUTING=正在执行,PAUSE=已暂停,FINISHED=已完成,CANCEL=已取消,END=已结束
*/
@ApiModelProperty("当前执行任务的 任务状态:OP_STATUS:NONE,WAIT=等待,EXECUTING=正在执行,PAUSE=已暂停,FINISHED=已完成,CANCEL=已取消,END=已结束") @ApiModelProperty("当前执行任务的 任务状态:OP_STATUS:NONE,WAIT=等待,EXECUTING=正在执行,PAUSE=已暂停,FINISHED=已完成,CANCEL=已取消,END=已结束")
private String currTaskStatus; private String currTaskStatus;
...@@ -70,4 +64,10 @@ public class BoxStatusDto { ...@@ -70,4 +64,10 @@ public class BoxStatusDto {
@ApiModelProperty("料仓类型") @ApiModelProperty("料仓类型")
private String type = DeviceType.AUTO.name(); private String type = DeviceType.AUTO.name();
@ApiModelProperty("使用情况")
private Map<String, UsageItem> usageMap = new ConcurrentHashMap<>();
@ApiModelProperty("操作信息")
private Map<String, String> data = new HashMap<>();
} }
package com.neotel.smfcore.core.kanban.rest.bean.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public class ShelfPosErrorDto {
@ApiModelProperty("库位号ID")
private String posId;
@ApiModelProperty("库位号")
private String posName;
@ApiModelProperty("条码信息")
private String barcode;
@ApiModelProperty("物料编号")
private String partNumber;
@ApiModelProperty("信号状态")
private int signalState;
}
...@@ -17,6 +17,10 @@ import java.util.Locale; ...@@ -17,6 +17,10 @@ import java.util.Locale;
@Slf4j @Slf4j
public class MessageUtils { public class MessageUtils {
public static Locale getDefaultLocal(){
return new Locale("zh-CH");
}
private static MessageSource messageSource; private static MessageSource messageSource;
public MessageUtils(MessageSource messageSource) { public MessageUtils(MessageSource messageSource) {
......
package com.neotel.smfcore.core.order; package com.neotel.smfcore.core.order;
import cn.hutool.core.util.ObjectUtil;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import com.neotel.smfcore.common.bean.ResultBean; import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.exception.ValidateException; import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.Constants; import com.neotel.smfcore.common.utils.Constants;
import com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager;
import com.neotel.smfcore.core.barcode.service.po.Barcode; import com.neotel.smfcore.core.barcode.service.po.Barcode;
import com.neotel.smfcore.core.device.bean.StatusBean; import com.neotel.smfcore.core.device.bean.StatusBean;
import com.neotel.smfcore.core.device.enums.OP; import com.neotel.smfcore.core.device.enums.OP;
import com.neotel.smfcore.core.device.enums.OP_STATUS; import com.neotel.smfcore.core.device.enums.OP_STATUS;
import com.neotel.smfcore.core.device.util.DataCache; import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.core.language.util.MessageUtils;
import com.neotel.smfcore.core.order.enums.LITEORDER_STATUS; import com.neotel.smfcore.core.order.enums.LITEORDER_STATUS;
import com.neotel.smfcore.core.order.enums.ORDER_COLOR; import com.neotel.smfcore.core.order.enums.ORDER_COLOR;
import com.neotel.smfcore.core.order.service.dao.ILiteOrderDao; import com.neotel.smfcore.core.order.service.dao.ILiteOrderDao;
...@@ -23,8 +26,10 @@ import com.neotel.smfcore.core.storage.service.po.StoragePos; ...@@ -23,8 +26,10 @@ import com.neotel.smfcore.core.storage.service.po.StoragePos;
import com.neotel.smfcore.core.system.listener.ITaskListener; import com.neotel.smfcore.core.system.listener.ITaskListener;
import com.neotel.smfcore.core.system.service.po.DataLog; import com.neotel.smfcore.core.system.service.po.DataLog;
import com.neotel.smfcore.core.system.util.TaskService; import com.neotel.smfcore.core.system.util.TaskService;
import javafx.concurrent.Task;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.*; import java.util.*;
...@@ -51,28 +56,99 @@ public class LiteOrderCache implements ITaskListener { ...@@ -51,28 +56,99 @@ public class LiteOrderCache implements ITaskListener {
@Autowired @Autowired
private IStoragePosManager storagePosManager; private IStoragePosManager storagePosManager;
@Autowired
private IBarcodeManager barcodeManager;
/** /**
* 正在执行的liteOrderMap, key 为orderNo,value 为order * 正在执行的liteOrderMap, key 为orderNo,value 为order
*/ */
public static Map<String, LiteOrder> liteOrderMap = new ConcurrentHashMap<>(); public static Map<String, LiteOrder> liteOrderMap = new ConcurrentHashMap<>();
public void loadUnEndOrderInfos() {
log.info("开始加载未完成的需求单");
List<LiteOrder> unEndOutInfoList = liteOrderManager.findUnEndOrdersList();
long now = System.currentTimeMillis();
for (LiteOrder order : unEndOutInfoList) {
if (now - order.getCreateDate().getTime() > 7 * 24 * 60 * 60 * 1000) {
//7天前的需求单,关闭,并解绑
log.info("需求单 =[" + order.getOrderNo() + "]为7天前,关闭并解绑工单");
closeOrder(order.getOrderNo());
} else {
addOrderToMap(order);
}
}
}
public void addOrderToMap(LiteOrder order ){
if(order==null|| order.getOrderNo()==null){
return;
}
if(liteOrderMap.containsKey(order.getOrderNo())){
liteOrderMap.remove(order.getOrderNo());
}
liteOrderMap.put(order.getOrderNo(), order);
}
private boolean isProcessTimer = false;
public void runTimer(){
if(!isProcessTimer){
isProcessTimer = true;
try {
boolean stopJob = dataCache.getCache(Constants.CACHE_StopJob);
if(!stopJob){
//定时执行工单任务
executeOrderTask();
}
}catch (Exception e){
log.error("需求单定时器执行出错:",e);
}finally {
isProcessTimer = false;
}
}
}
@Override @Override
public void onTaskStatusChange(DataLog task) { public void onTaskStatusChange(DataLog task) {
try { try {
finishedOrderTask(task); //只有任务完成或取消时才处理,任务未完成直接返回
if (task.isFinished() || task.isCancel()) {
finishedOrderTask(task);
}
} catch (Exception e) { } catch (Exception e) {
log.error("更新工单状态出错",e); log.error("更新工单状态出错", e);
} }
} }
public ResultBean checkOutOrder(LiteOrder liteOrder) throws ValidateException { public void executeOrderTask(){
//设置颜色 for (LiteOrder order :
Set<String> currentColors = new HashSet<>(); liteOrderMap.values()) {
for (DataLog dataLog : taskService.getQueueTasks()) { if(order.isNew()||order.isTaskFinished()){
currentColors.add(dataLog.getLightColor()); //判断是否到达时间
Date curr=new Date();
if(order.getSDate().before(curr)){
//开始自动出库
String result= checkOutLiteOrder(order.getOrderNo(),false);
if(!ObjectUtil.isEmpty(result)){
String msg= MessageUtils.getText(result,MessageUtils.getDefaultLocal(),"");
log.info("自动执行工单 【"+order.getOrderNo()+"】 失败:"+msg);
}else{
log.info("自动执行工单 【"+order.getOrderNo()+"】 成功");
}
break;
}
}
} }
ORDER_COLOR nextColor = ORDER_COLOR.nextColor(currentColors); }
public ResultBean checkOutOrder(LiteOrder liteOrder) throws ValidateException {
ORDER_COLOR nextColor = getNextColor();
if (nextColor == null) { if (nextColor == null) {
log.info("执行工单[" + liteOrder.getOrderNo() + "] 时,已达最大可执行工单数"); log.info("执行工单[" + liteOrder.getOrderNo() + "] 时,已达最大可执行工单数");
throw new ValidateException("order.out.maxOrder","已达最大可执行工单数"); throw new ValidateException("order.out.maxOrder","已达最大可执行工单数");
...@@ -102,6 +178,7 @@ public class LiteOrderCache implements ITaskListener { ...@@ -102,6 +178,7 @@ public class LiteOrderCache implements ITaskListener {
} }
liteOrder.setTaskReelCount(taskReelCount); liteOrder.setTaskReelCount(taskReelCount);
liteOrder.setTotalTaskReelCount(liteOrder.getTotalTaskReelCount()+taskReelCount);
log.info("工单[" + liteOrder.getOrderNo() + "]任务分配结束,任务数[" + taskReelCount + "]"); log.info("工单[" + liteOrder.getOrderNo() + "]任务分配结束,任务数[" + taskReelCount + "]");
//有需要出库的 //有需要出库的
if (taskReelCount <= 0) { if (taskReelCount <= 0) {
...@@ -120,6 +197,7 @@ public class LiteOrderCache implements ITaskListener { ...@@ -120,6 +197,7 @@ public class LiteOrderCache implements ITaskListener {
*/ */
private synchronized void finishedOrderTask(DataLog task) throws ValidateException { private synchronized void finishedOrderTask(DataLog task) throws ValidateException {
if (OP.CHECKOUT == task.getType()) { if (OP.CHECKOUT == task.getType()) {
//更新工单状态 //更新工单状态
String orderNo = task.getSourceName(); String orderNo = task.getSourceName();
if (!Strings.isNullOrEmpty(orderNo)) { if (!Strings.isNullOrEmpty(orderNo)) {
...@@ -136,9 +214,12 @@ public class LiteOrderCache implements ITaskListener { ...@@ -136,9 +214,12 @@ public class LiteOrderCache implements ITaskListener {
//任务是取消的,需要将总待出库数量-1 //任务是取消的,需要将总待出库数量-1
if (task.isCancel()) { if (task.isCancel()) {
order.setTaskReelCount(order.getTaskReelCount() - 1); order.setTaskReelCount(order.getTaskReelCount() - 1);
order.setTotalTaskReelCount(order.getTotalTaskReelCount()-1);
log.info("工单[" + orderNo + "]的任务" + task.getPartNumber() + "[" + task.getBarcode() + "]已取消,任务数-1=" + order.getFinishedReelCount() + "/" + order.getTaskReelCount()); log.info("工单[" + orderNo + "]的任务" + task.getPartNumber() + "[" + task.getBarcode() + "]已取消,任务数-1=" + order.getFinishedReelCount() + "/" + order.getTaskReelCount());
} else if (task.isFinished()) { }
else if (task.isFinished()) {
order.setFinishedReelCount(order.getFinishedReelCount() + 1); order.setFinishedReelCount(order.getFinishedReelCount() + 1);
order.setTotalFinishedReelCount(order.getTotalFinishedReelCount()+1);
String orderItemId = task.getSubSourceId(); String orderItemId = task.getSubSourceId();
List<LiteOrderItem> items = new ArrayList<>(); List<LiteOrderItem> items = new ArrayList<>();
for (LiteOrderItem liteOrderItem : order.getOrderItems()) { for (LiteOrderItem liteOrderItem : order.getOrderItems()) {
...@@ -147,22 +228,24 @@ public class LiteOrderCache implements ITaskListener { ...@@ -147,22 +228,24 @@ public class LiteOrderCache implements ITaskListener {
//更新对应条目的已出库数量和出库盘数 //更新对应条目的已出库数量和出库盘数
liteOrderItem.setOutNum(liteOrderItem.getOutNum() + task.getNum()); liteOrderItem.setOutNum(liteOrderItem.getOutNum() + task.getNum());
liteOrderItem.setOutReelCount(liteOrderItem.getOutReelCount() + 1); liteOrderItem.setOutReelCount(liteOrderItem.getOutReelCount() + 1);
liteOrderItem.setTotalOutNum(liteOrderItem.getTotalOutNum()+task.getNum());
liteOrderItem.setTotalOutReelCount(liteOrderItem.getTotalOutReelCount()+1);
liteOrderItem = liteOrderItemManager.save(liteOrderItem); liteOrderItem = liteOrderItemManager.save(liteOrderItem);
// Barcode barcode = barcodeManager.findByBarcode(task.getBarcode()); Barcode barcode = barcodeManager.findByBarcode(task.getBarcode());
// if (barcode != null) { if (barcode != null) {
// Float totalNeedNum = liteOrderItem.getNeedNum() * order.getOrderTimes(); Float totalNeedNum = liteOrderItem.getNeedNum() * order.getOrderTimes();
// int barcodeRemainNum = liteOrderItem.getOutNum() - totalNeedNum.intValue(); int barcodeRemainNum = liteOrderItem.getOutNum() - totalNeedNum.intValue();
// if (barcodeRemainNum < 0) { if (barcodeRemainNum < 0) {
// barcodeRemainNum = 0; barcodeRemainNum = 0;
// } }
// barcode.setAmount(barcodeRemainNum); barcode.setAmount(barcodeRemainNum);
// log.info("条码[" + task.getBarcode() + "]从工单出库,更改数量为:" + barcodeRemainNum); log.info("条码[" + task.getBarcode() + "]从工单出库,更改数量为:" + barcodeRemainNum);
// try { try {
// barcodeManager.save(barcode); barcodeManager.save(barcode);
// } catch (ValidateException e) { } catch (ValidateException e) {
// e.printStackTrace(); e.printStackTrace();
// } }
// } }
} }
items.add(liteOrderItem); items.add(liteOrderItem);
} }
...@@ -176,7 +259,9 @@ public class LiteOrderCache implements ITaskListener { ...@@ -176,7 +259,9 @@ public class LiteOrderCache implements ITaskListener {
break; break;
} }
} }
order.setClosed(closed); if(closed){
order.setClosed(closed);
}
} }
} else { } else {
log.error("工单[" + orderNo + "]的任务[" + task.getBarcode() + "]完成时,状态为:" + task.getStatus()); log.error("工单[" + orderNo + "]的任务[" + task.getBarcode() + "]完成时,状态为:" + task.getStatus());
...@@ -195,34 +280,42 @@ public class LiteOrderCache implements ITaskListener { ...@@ -195,34 +280,42 @@ public class LiteOrderCache implements ITaskListener {
} }
} }
public ORDER_COLOR getNextColor() {
//设置颜色
Set<String> currentColors = new HashSet<>();
for (DataLog dataLog :taskService. getQueueTasks()) {
currentColors.add(dataLog.getLightColor());
}
ORDER_COLOR nextColor = ORDER_COLOR.nextColor(currentColors);
return nextColor;
}
/** /**
* 锁定物料 * 锁定物料
*/ */
public synchronized String checkOutLiteOrder(String orderNo, boolean outBom) { public synchronized String checkOutLiteOrder(String orderNo, boolean outBom) {
LiteOrder cacheOrder = liteOrderMap.get(orderNo); LiteOrder cacheOrder = liteOrderMap.get(orderNo);
if (cacheOrder != null && !cacheOrder.isTaskFinished() && !cacheOrder.isNew()) {
log.info("工单[" + orderNo + "]正在执行");
return "order.out.executing";
}
if (cacheOrder == null) { if (cacheOrder == null) {
cacheOrder = liteOrderManager.findByOrderNo(orderNo); cacheOrder = liteOrderManager.findByOrderNo(orderNo);
} }
if (cacheOrder == null) { if (cacheOrder == null) {
return "order.out.notFound"; return "smfcode.order.out.notFound";
} }
if ( !cacheOrder.isTaskFinished() && !cacheOrder.isNew()) {
//设置颜色 log.info("工单[" + orderNo + "]正在执行");
Set<String> currentColors = new HashSet<>(); return "smfcode.order.out.executing";
for (DataLog dataLog : taskService.getQueueTasks()) { }
currentColors.add(dataLog.getLightColor()); if(cacheOrder.isClosed()) {
log.info("工单[" + orderNo + "]已关闭,无法出库");
return "smfcode.order.hasClose";
} }
ORDER_COLOR nextColor = ORDER_COLOR.nextColor(currentColors); ORDER_COLOR nextColor = getNextColor();
if (nextColor == null) { if (nextColor == null) {
log.info("执行工单[" + orderNo + "] outBom=" + outBom + "时,已达最大可执行工单数"); log.info("执行工单[" + orderNo + "] outBom=" + outBom + "时,已达最大可执行工单数");
return "order.out.maxOrder"; return "smfcode.order.out.maxOrder";
} }
log.info("开始执行工单[" + orderNo + "] outBom=" + outBom); log.info("开始执行工单[" + orderNo + "] outBom=" + outBom);
...@@ -237,22 +330,19 @@ public class LiteOrderCache implements ITaskListener { ...@@ -237,22 +330,19 @@ public class LiteOrderCache implements ITaskListener {
//liteOrderMap.put(cacheOrder.getOrderNo(), cacheOrder); //liteOrderMap.put(cacheOrder.getOrderNo(), cacheOrder);
int taskReelCount = 0; int taskReelCount = 0;
CHECKOUT_TYPE checkoutType = dataCache.getCheckOutType(); CHECKOUT_TYPE checkoutType = dataCache.getCheckOutType();
List<String> availableStorageIds = new ArrayList<>(); List<String> availableStorageIds = dataCache.getAvailableStorageIds();
for (Storage storage : dataCache.getAllStorage().values()) {
//默认所有料仓可用
// StatusBean statusBean =dataCache. getStatus(storage.getCid());
// if (statusBean.isAvailable())
{
availableStorageIds.add(storage.getId());
}
}
//其他出库模式一次性全部生成任务 //其他出库模式一次性全部生成任务
for (LiteOrderItem orderItem : cacheOrder.getOrderItems()) { for (LiteOrderItem orderItem : cacheOrder.getOrderItems()) {
orderItem.setOutNum(0);
orderItem.setOutReelCount(0);
liteOrderItemManager.save(orderItem);
//剩余未出数量 //剩余未出数量
Float totalNum = orderItem.getNeedNum() * cacheOrder.getOrderTimes(); Float totalNum = orderItem.getNeedNum() * cacheOrder.getOrderTimes();
int remainNum = totalNum.intValue() - orderItem.getOutNum(); int remainNum = totalNum.intValue() - orderItem.getOutNum();
//此PN未完成 //此PN未完成
if (remainNum > 0) { if (remainNum > 0) {
if (outBom) { if (outBom) {
...@@ -263,9 +353,21 @@ public class LiteOrderCache implements ITaskListener { ...@@ -263,9 +353,21 @@ public class LiteOrderCache implements ITaskListener {
while (assignNum < remainNum) { while (assignNum < remainNum) {
Collection<String> excludePosIds = excludePosIds(); Collection<String> excludePosIds = excludePosIds();
String partNumber = orderItem.getPn(); String partNumber = orderItem.getPn();
StoragePos pos = storagePosManager.findPartNumberInStorages(availableStorageIds, partNumber, excludePosIds, checkoutType);
StoragePos pos = null;
if(cacheOrder.getType()==2){
//RI
pos=storagePosManager.getByBarcode(orderItem.getRi());
if(excludePosIds.contains(pos.getId())) {
log.info("工单[" + orderNo + "]RI出库,任务数[" + taskReelCount + "]出库位置仓位【" + pos.getPosName() + "】RI=[" + pos.getBarcode().getBarcode() + "]已在操作队列中,跳过不处理");
break;
}
}else{
//PN
pos=storagePosManager.findPartNumberInStorages(availableStorageIds, partNumber, excludePosIds, checkoutType);
}
if (pos == null) { if (pos == null) {
log.error("未找到可以出库的物料[" + partNumber + "]"); // log.error("未找到可以出库的物料[" + partNumber + "]");
break; break;
} else { } else {
assignNum = assignNum + pos.getBarcode().getAmount(); assignNum = assignNum + pos.getBarcode().getAmount();
...@@ -283,11 +385,17 @@ public class LiteOrderCache implements ITaskListener { ...@@ -283,11 +385,17 @@ public class LiteOrderCache implements ITaskListener {
// task = dataLogDao.save(task); // task = dataLogDao.save(task);
taskService.addTaskToExecute(task); taskService.addTaskToExecute(task);
} }
//如果是RI出库,只有一盘,出完就结束
if(cacheOrder.getType()==2){
break;
}
} }
} }
} }
cacheOrder.setTaskReelCount(taskReelCount); cacheOrder.setTaskReelCount(taskReelCount);
cacheOrder.setTotalTaskReelCount(cacheOrder.getTotalTaskReelCount()+taskReelCount);
log.info("工单[" + orderNo + "]任务分配结束,任务数[" + taskReelCount + "]"); log.info("工单[" + orderNo + "]任务分配结束,任务数[" + taskReelCount + "]");
//有需要出库的 //有需要出库的
if (taskReelCount <= 0) { if (taskReelCount <= 0) {
...@@ -295,10 +403,11 @@ public class LiteOrderCache implements ITaskListener { ...@@ -295,10 +403,11 @@ public class LiteOrderCache implements ITaskListener {
} }
liteOrderManager.save(cacheOrder); liteOrderManager.save(cacheOrder);
liteOrderMap.put(cacheOrder.getOrderNo(), cacheOrder); liteOrderMap.put(cacheOrder.getOrderNo(), cacheOrder);
if (taskReelCount <= 0) { if (taskReelCount <= 0) {
//return "工单无可执行的任务"; //return "工单无可执行的任务";
return "order.out.noTask"; return "smfcode.order.out.noTask";
} }
return ""; return "";
} }
...@@ -339,4 +448,98 @@ public class LiteOrderCache implements ITaskListener { ...@@ -339,4 +448,98 @@ public class LiteOrderCache implements ITaskListener {
return task; return task;
} }
/**
* 关闭工单
* @param orderNo
*/
public String closeOrder(String orderNo) {
LiteOrder liteOrder = liteOrderMap.get(orderNo);
if (liteOrder == null) {
liteOrder=liteOrderManager.findByOrderNo(orderNo);
if(liteOrder==null){
return "smfcode.order.out.notFound";
}
}
//有任务的工单不能关闭
List<DataLog> allTask=taskService.getAllTasks();
for (DataLog task:allTask
) {
if (OP.CHECKOUT == task.getType()&&(!task.isEnd())) {
//更新工单状态
String taskSourceName = task.getSourceName();
if (!Strings.isNullOrEmpty(taskSourceName) && orderNo.equals(taskSourceName)) {
log.info("关闭工单[" + orderNo + "]失败,有未完成的出库任务:"+task.getPosName());
return "smfcode.order.close.taskNotEnd";
}
}
}
//绑定料需要解绑
storagePosManager.clearLockPos(liteOrder.getOrderNo());
log.info("关闭工单[" + orderNo + "]成功");
liteOrder.setClosed(true);
liteOrderManager.save(liteOrder);
return "smfcode.order.close.success";
}
/**
* 工单详情补料出库
* @param orderNo
* @param orderItemId
* @return
*/
public String orderItemSupplementOut(String orderNo, String orderItemId) {
LiteOrder cacheOrder = liteOrderMap.get(orderNo);
if (cacheOrder == null) {
cacheOrder=liteOrderManager.findByOrderNo(orderNo);
if(cacheOrder==null){
return "smfcode.order.out.notFound";
}
}
if(cacheOrder.isClosed()){
return "smfcode.order.hasClose";
}
for (LiteOrderItem orderItem:cacheOrder.getOrderItems()
) {
if(orderItem.getId().equals(orderItemId)){
CHECKOUT_TYPE checkoutType = dataCache.getCheckOutType();
List<String> availableStorageIds = dataCache.getAvailableStorageIds();
Collection<String> excludePosIds = excludePosIds();
String partNumber = orderItem.getPn();
StoragePos pos = null;
if(cacheOrder.getType()==2){
//RI
pos=storagePosManager.getByBarcode(orderItem.getRi());
if(excludePosIds.contains(pos.getId())) {
log.info("工单[" + orderNo + "]RI出库,仓位【" + pos.getPosName() + "】RI=[" + pos.getBarcode().getBarcode() + "]已在操作队列中,跳过不处理");
}
}else {
//PN
pos = storagePosManager.findPartNumberInStorages(availableStorageIds, partNumber, excludePosIds, checkoutType);
}
if (pos == null) {
return "smfcode.order.supplementOutFail";
} else {
log.info("工单[" + orderNo + "]["+partNumber+"]补料出库:仓位[" + pos.getPosName() + "]RI=[" + pos.getBarcode().getBarcode() + "] PN=[" + partNumber + "] num:" + pos.getBarcode().getAmount());
DataLog task = newTask(pos) ;
task.setSourceId(cacheOrder.getId());
task.setSourceName(cacheOrder.getOrderNo());
task.setSubSourceId(orderItem.getId());
task.setSubSourceInfo(orderItem.getFeederInfo());
task.setType(OP.CHECKOUT);
// task.setLightColor(nextColor.getRgb());
task.setStatus(OP_STATUS.WAIT.name());
// task = dataLogDao.save(task);
taskService.addTaskToExecute(task);
return "";
}
}
}
return "smfcode.order.supplementOutFail";
}
} }
package com.neotel.smfcore.core.order.rest; package com.neotel.smfcore.core.order.rest;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.db.sql.Order; import cn.hutool.db.sql.Order;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.neotel.smfcore.common.annotation.QueryCondition; import com.neotel.smfcore.common.annotation.QueryCondition;
...@@ -21,6 +22,7 @@ import com.neotel.smfcore.core.order.service.po.LiteOrder; ...@@ -21,6 +22,7 @@ import com.neotel.smfcore.core.order.service.po.LiteOrder;
import com.neotel.smfcore.core.order.service.po.LiteOrderItem; import com.neotel.smfcore.core.order.service.po.LiteOrderItem;
import com.neotel.smfcore.core.storage.service.po.Storage; import com.neotel.smfcore.core.storage.service.po.Storage;
import com.neotel.smfcore.core.storage.service.po.StoragePos; import com.neotel.smfcore.core.storage.service.po.StoragePos;
import com.neotel.smfcore.core.system.rest.bean.dto.TaskDto;
import com.neotel.smfcore.core.system.rest.bean.mapstruct.TaskMapper; import com.neotel.smfcore.core.system.rest.bean.mapstruct.TaskMapper;
import com.neotel.smfcore.security.annotation.AnonymousAccess; import com.neotel.smfcore.security.annotation.AnonymousAccess;
import com.neotel.smfcore.security.bean.FileProperties; import com.neotel.smfcore.security.bean.FileProperties;
...@@ -33,6 +35,7 @@ import com.neotel.smfcore.security.service.po.Role; ...@@ -33,6 +35,7 @@ import com.neotel.smfcore.security.service.po.Role;
import com.neotel.smfcore.security.service.po.User; import com.neotel.smfcore.security.service.po.User;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import javafx.concurrent.Task;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.logging.log4j.util.Strings; import org.apache.logging.log4j.util.Strings;
...@@ -53,6 +56,7 @@ import org.springframework.web.multipart.MultipartFile; ...@@ -53,6 +56,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
...@@ -99,12 +103,13 @@ public class OrderController { ...@@ -99,12 +103,13 @@ public class OrderController {
String image = "csv"; String image = "csv";
String fileType = FileUtil.getExtensionName(orderFile.getOriginalFilename()); String fileType = FileUtil.getExtensionName(orderFile.getOriginalFilename());
String fileName= FileUtil.getFileNameNoEx(orderFile.getOriginalFilename());
if (fileType != null && !image.contains(fileType)) { if (fileType != null && !image.contains(fileType)) {
throw new ValidateException("smfcore.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 localFile = FileUtil.upload(orderFile, folder.getAbsolutePath()); File localFile = FileUtil.upload(orderFile, folder.getAbsolutePath());
Map<String, List<LiteOrderItem>> itemMap = handleOrderCsv(localFile.getName(),localFile.getAbsolutePath()); Map<String, List<LiteOrderItem>> itemMap = handleOrderCsv(fileName,localFile.getAbsolutePath());
if (itemMap == null || itemMap.size() <= 0) { if (itemMap == null || itemMap.size() <= 0) {
throw new ValidateException("smfcore.fileError", "文件解析失败"); throw new ValidateException("smfcore.fileError", "文件解析失败");
...@@ -132,38 +137,97 @@ public class OrderController { ...@@ -132,38 +137,97 @@ public class OrderController {
liteOrder.setSource(localFile.getName()); liteOrder.setSource(localFile.getName());
liteOrder.setStatus(LITEORDER_STATUS.NEW); liteOrder.setStatus(LITEORDER_STATUS.NEW);
LiteOrder dbOrder = liteOrderManager.findByOrderNo(liteOrder.getOrderNo()); LiteOrder dbOrder = liteOrderManager.findByOrderNo(liteOrder.getOrderNo());
if (dbOrder == null) { if (dbOrder != null) {
log.info("新增加订单:" + liteOrder.getOrderNo() + ",共" + liteOrderItems.size() + "条工单详情");
liteOrder = liteOrderManager.createWithItems(liteOrder); SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
// TaskService.liteOrderMap.put(liteOrder.getOrderNo(), liteOrder); //把名字改为带时间的
} else { String newOrderNo = liteOrder.getOrderNo() + "-" + format.format(new Date());
log.info("数据库中已存在工单号为[" + liteOrder.getOrderNo() + "],忽略文件:" + localFile.getAbsolutePath()); dbOrder = liteOrderManager.findByOrderNo(newOrderNo);
if (dbOrder == null) {
// throw new ValidateException("smfcode.valueAlreadyExist", "{0}[{1}]已存在", new String[]{"orderNo", liteOrder.getOrderNo()}); liteOrder.setOrderNo(newOrderNo);
// throw new ValidateException("工单号[" + liteOrder.getOrderNo() + "]已存在"); } else {
log.info("数据库中已存在工单号为[" + liteOrder.getOrderNo() + "],忽略文件:" + localFile.getAbsolutePath());
return ResultBean.newErrorResult(-1, "smfcode.order.ameExists", "工单名称[{0}]已存在", new String[]{liteOrder.getOrderNo()});
}
} }
log.info("新增加订单:" + liteOrder.getOrderNo() + ",共" + liteOrderItems.size() + "条工单详情");
liteOrder = liteOrderManager.createWithItems(liteOrder);
liteOrderCache.addOrderToMap(liteOrder);
} }
return ResultBean.newOkResult("smfcode.order.uploadOK","工单上传成功","");
return ResultBean.newOkResult("工单上传成功");
} }
@ApiOperation("工单出库") @ApiOperation("工单出库")
@PostMapping(value = "/out") @PostMapping(value = "/out")
@PreAuthorize("@el.check('workOrder')") @PreAuthorize("@el.check('workOrder')")
public ResultBean delete(@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("工单号不能为空");
throw new ValidateException("smfcode.valueCanotNull", "{0}不能为空", new String[]{"orderNo"}); throw new ValidateException("smfcode.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("smfcode.valueNotFind", "未找到{0}[{1}]", new String[]{"orderNo", orderNo});
} }
// ResultBean resultBean = liteOrderCache.checkOutOrder(liteOrder); String result= liteOrderCache.checkOutLiteOrder(liteOrder.getOrderNo(),false);
return liteOrderCache.checkOutOrder(liteOrder); if(ObjectUtil.isEmpty(result)){
return ResultBean.newOkResult(result);
}else{
return ResultBean.newErrorResult(-1,result,result);
}
}
@ApiOperation("套料出库")
@PostMapping(value = "/outBom")
@PreAuthorize("@el.check('workOrder')")
public ResultBean outBom(@RequestBody Map<String, String> mapValues) {
String orderNo = mapValues.get("orderNo");
if (orderNo == null) {
throw new ValidateException("smfcode.valueCanotNull", "{0}不能为空", new String[]{"orderNo"});
}
String result= liteOrderCache.checkOutLiteOrder(orderNo,true);
if(ObjectUtil.isEmpty(result)){
return ResultBean.newOkResult(result);
}else{
return ResultBean.newErrorResult(-1,result,result);
}
}
@ApiOperation("尾料出库")
@PostMapping(value = "/outTails")
@PreAuthorize("@el.check('workOrder')")
public ResultBean outTails(@RequestBody Map<String, String> mapValues) {
String orderNo = mapValues.get("orderNo");
if (orderNo == null) {
throw new ValidateException("smfcode.valueCanotNull", "{0}不能为空", new String[]{"orderNo"});
}
String result= liteOrderCache.checkOutLiteOrder(orderNo,false);
if(ObjectUtil.isEmpty(result)){
return ResultBean.newOkResult(result);
}else{
return ResultBean.newErrorResult(-1,result,result);
}
}
@ApiOperation("补料出库")
@PostMapping(value = "/supplementOut")
@PreAuthorize("@el.check('workOrder')")
public ResultBean supplementOut(@RequestBody Map<String, String> mapValues) {
String orderNo = mapValues.get("orderNo");
String orderItemId = mapValues.get("orderItemId");
if (orderNo == null) {
throw new ValidateException("smfcode.valueCanotNull", "{0}不能为空", new String[]{"orderNo"});
}
String result= liteOrderCache.orderItemSupplementOut(orderNo,orderItemId);
if(ObjectUtil.isEmpty(result)){
return ResultBean.newOkResult(result);
}else{
return ResultBean.newErrorResult(-1,result,result);
}
} }
@ApiOperation("查询工单") @ApiOperation("查询工单")
...@@ -208,6 +272,7 @@ public class OrderController { ...@@ -208,6 +272,7 @@ public class OrderController {
protected Map<String ,List<LiteOrderItem>> handleOrderCsv(String fileName,String fileURL) { protected Map<String ,List<LiteOrderItem>> handleOrderCsv(String fileName,String fileURL) {
try { try {
fileName=fileName.replace(".csv","");
log.info("开始更解析上传的工单"); log.info("开始更解析上传的工单");
Map<String ,List<LiteOrderItem>> itemMap=new HashMap<>(); Map<String ,List<LiteOrderItem>> itemMap=new HashMap<>();
List<LiteOrderItem> items = Lists.newArrayList(); List<LiteOrderItem> items = Lists.newArrayList();
...@@ -222,13 +287,17 @@ public class OrderController { ...@@ -222,13 +287,17 @@ public class OrderController {
int row = 1; int row = 1;
int newRowCount = 0; int newRowCount = 0;
int updateRowCount = 0; int updateRowCount = 0;
while (csvRead.readRecord()) { while (csvRead.readRecord()) {
row++; row++;
String[] lineValues = csvRead.getValues(); String[] lineValues = csvRead.getValues();
String partNumber = lineValues[partNumberIndex]; String partNumber = lineValues[partNumberIndex];
String ri="";
if (partNumber.isEmpty()) { if(riIndex!=-1){
log.warn("行[partNumber=" + partNumber + "]中PN 为空,此行忽略"); ri=lineValues[riIndex];
}
if (partNumber.isEmpty()&&ri.isEmpty()) {
log.warn("行[partNumber=" + partNumber + "]中PN和RI都 为空,此行忽略");
} else { } else {
int num = 1; int num = 1;
if (qtyIndex != -1) { if (qtyIndex != -1) {
...@@ -245,17 +314,21 @@ public class OrderController { ...@@ -245,17 +314,21 @@ public class OrderController {
if (feederIndex != -1) { if (feederIndex != -1) {
feeder = lineValues[feederIndex]; feeder = lineValues[feederIndex];
} }
String ri="";
String so=fileName; String so=fileName;
if(riIndex!=-1){
ri=lineValues[riIndex];
}
if(soIndex!=-1){ if(soIndex!=-1){
so=lineValues[soIndex]; so=lineValues[soIndex];
} }
if(!ObjectUtil.isNotEmpty(so)){
so=fileName;
}
LiteOrderItem item = new LiteOrderItem(); LiteOrderItem item = new LiteOrderItem();
item.setPn(partNumber); item.setPn(partNumber);
item.setNeedNum(num); if(partNumber.isEmpty()){
item.setNeedReelCount(1);
}
item.setNeedNum(num);
item.setFeederInfo(feeder); item.setFeederInfo(feeder);
item.setRi(ri); item.setRi(ri);
if(!itemMap.containsKey(so)){ if(!itemMap.containsKey(so)){
...@@ -298,4 +371,75 @@ public class OrderController { ...@@ -298,4 +371,75 @@ public class OrderController {
throw new ValidateException("smfcode.valueCanotNull", "{0}不能为空", new String[]{"orderNo"}); throw new ValidateException("smfcode.valueCanotNull", "{0}不能为空", new String[]{"orderNo"});
} }
@ApiOperation("修改工单数量")
@PostMapping(value = "/updateNum")
@PreAuthorize("@el.check('workOrder')")
public ResultBean updateNum(@RequestBody OrderDto param) {
String orderNo = param.getOrderNo();
float orderTimes= param.getOrderTimes();
if (orderNo == null) {
// throw new ValidateException("工单号不能为空");
throw new ValidateException("smfcode.valueCanotNull", "{0}不能为空", new String[]{"orderNo"});
}
LiteOrder liteOrder = liteOrderManager.findByOrderNo(orderNo);
if (liteOrder == null) {
throw new ValidateException("smfcode.valueNotFind", "未找到{0}[{1}]", new String[]{"orderNo", orderNo});
}
if(!liteOrder.isNew()){
throw new ValidateException("smfcode.cannotUpdateOrderNum", "工单已出库,不能修改数量" );
}
if(orderTimes<1){
orderTimes=1;
}
liteOrder.setOrderTimes(orderTimes);
liteOrderManager.save(liteOrder );
liteOrderCache.addOrderToMap(liteOrder);
return ResultBean.newOkResult(orderMapper.toDto(liteOrder) );
}
@ApiOperation("关闭工单")
@PostMapping(value = "/closeOrder")
@PreAuthorize("@el.check('workOrder')")
public ResultBean closeOrder(@RequestBody Map<String, String> mapValues) {
String orderNo = mapValues.get("orderNo");
if (orderNo == null) {
throw new ValidateException("smfcode.valueCanotNull", "{0}不能为空", new String[]{"orderNo"});
}
String result=liteOrderCache.closeOrder(orderNo);
if(ObjectUtil.isEmpty(result)){
return ResultBean.newOkResult(result);
}else{
return ResultBean.newErrorResult(-1,result,result);
}
}
@ApiOperation("修改工单线别")
@PostMapping(value = "/updateLine")
@PreAuthorize("@el.check('workOrder')")
public ResultBean updateLine(@RequestBody OrderDto param) {
if (param.getId() == null) {
throw new ValidateException("smfcode.valueCanotNull", "{0}不能为空", new String[]{"orderNo"});
}
if (param.getLine() == null) {
throw new ValidateException("smfcode.order.lineCanotNull", "线别不能为空");
}
LiteOrder order = liteOrderManager.get(param.getId());
if (order == null) {
throw new ValidateException("smfcode.valueCanotNull", "{0}不能为空", new String[]{"orderNo"});
}
if (!order.isNew()) {
throw new ValidateException("smfcode.order.cannotUpdateLine", "工单已出库,不能修改线别");
}
order.setLine(param.getLine());
liteOrderManager.save(order);
liteOrderCache.addOrderToMap(order);
return ResultBean.newOkResult(orderMapper.toDto(order));
}
} }
...@@ -33,6 +33,11 @@ public class OrderDto implements Serializable { ...@@ -33,6 +33,11 @@ public class OrderDto implements Serializable {
@ApiModelProperty("当前任务已完成盘数") @ApiModelProperty("当前任务已完成盘数")
private int finishedReelCount = 0; private int finishedReelCount = 0;
@ApiModelProperty("累计任务盘数")
private int totalTaskReelCount = 0;
@ApiModelProperty("累计任务已完成盘数")
private int totalFinishedReelCount = 0;
/** /**
* 订单状态 * 订单状态
* 0=新建工单 * 0=新建工单
...@@ -52,28 +57,18 @@ public class OrderDto implements Serializable { ...@@ -52,28 +57,18 @@ public class OrderDto implements Serializable {
@ApiModelProperty("出库状态, 2表示已完成") @ApiModelProperty("出库状态, 2表示已完成")
private boolean closed = false; private boolean closed = false;
/**
* 工单来源
*/
@ApiModelProperty("工单来源") @ApiModelProperty("工单来源")
private String source = ""; private String source = "";
/**
* 任务完成时间(用于关闭页面显示)
*/
@ApiModelProperty("任务完成时间(用于关闭页面显示)") @ApiModelProperty("任务完成时间(用于关闭页面显示)")
@Transient @Transient
private long taskFinishedTime = -1; private long taskFinishedTime = -1;
/**
* 套(倍)数
*/
@ApiModelProperty("套(倍)数") @ApiModelProperty("套(倍)数")
private float orderTimes = 1f; private float orderTimes = 1f;
/**
* 订单的详细信息
*/
@Transient @Transient
@ApiModelProperty("订单的详细信息") @ApiModelProperty("订单的详细信息")
private List<OrderItemDto> orderItems; private List<OrderItemDto> orderItems;
...@@ -84,4 +79,8 @@ public class OrderDto implements Serializable { ...@@ -84,4 +79,8 @@ public class OrderDto implements Serializable {
@ApiModelProperty("创建时间") @ApiModelProperty("创建时间")
private Date createDate = new Date(); private Date createDate = new Date();
@ApiModelProperty("工单线别")
private String line = "";
} }
...@@ -5,7 +5,11 @@ import com.neotel.smfcore.common.exception.ValidateException; ...@@ -5,7 +5,11 @@ import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.core.barcode.service.po.Barcode; import com.neotel.smfcore.core.barcode.service.po.Barcode;
import com.neotel.smfcore.core.order.service.po.LiteOrder; import com.neotel.smfcore.core.order.service.po.LiteOrder;
import java.util.List;
public interface ILiteOrderManager extends IBaseManager<LiteOrder> { public interface ILiteOrderManager extends IBaseManager<LiteOrder> {
LiteOrder findByOrderNo(String orderNo); LiteOrder findByOrderNo(String orderNo);
LiteOrder createWithItems(LiteOrder liteOrder) throws ValidateException; LiteOrder createWithItems(LiteOrder liteOrder) throws ValidateException;
List<LiteOrder> findUnEndOrdersList();
} }
...@@ -6,6 +6,7 @@ import com.neotel.smfcore.common.exception.ValidateException; ...@@ -6,6 +6,7 @@ import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.core.barcode.service.dao.IBarcodeDao; import com.neotel.smfcore.core.barcode.service.dao.IBarcodeDao;
import com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager; import com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager;
import com.neotel.smfcore.core.barcode.service.po.Barcode; import com.neotel.smfcore.core.barcode.service.po.Barcode;
import com.neotel.smfcore.core.order.enums.LITEORDER_STATUS;
import com.neotel.smfcore.core.order.service.dao.ILiteOrderDao; import com.neotel.smfcore.core.order.service.dao.ILiteOrderDao;
import com.neotel.smfcore.core.order.service.manager.ILiteOrderItemManager; import com.neotel.smfcore.core.order.service.manager.ILiteOrderItemManager;
import com.neotel.smfcore.core.order.service.manager.ILiteOrderManager; import com.neotel.smfcore.core.order.service.manager.ILiteOrderManager;
...@@ -15,6 +16,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -15,6 +16,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query; import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -76,6 +78,22 @@ public class LiteOrderManagerImpl implements ILiteOrderManager { ...@@ -76,6 +78,22 @@ public class LiteOrderManagerImpl implements ILiteOrderManager {
} }
@Override @Override
public List<LiteOrder> findUnEndOrdersList() {
Criteria c = new Criteria();
c.and("status").nin(LITEORDER_STATUS.CLOSED);
Query query = new Query(c);
List<LiteOrder> orders = findByQuery(query);
for (LiteOrder order : orders
) {
if (order != null && order.getOrderItems() == null) {
List<LiteOrderItem> items = liteOrderItemManager.findOrderItems(order.getOrderNo());
order.setOrderItems(items);
}
}
return orders;
}
@Override
public PageData<LiteOrder> findByPage(Query query, Pageable pageable) { public PageData<LiteOrder> findByPage(Query query, Pageable pageable) {
int totalCount = liteOrderDao.countByQuery(query); int totalCount = liteOrderDao.countByQuery(query);
List<LiteOrder> list = liteOrderDao.findByQuery(query, pageable); List<LiteOrder> list = liteOrderDao.findByQuery(query, pageable);
......
...@@ -25,10 +25,14 @@ public class LiteOrder extends BasePo implements Serializable { ...@@ -25,10 +25,14 @@ public class LiteOrder extends BasePo implements Serializable {
} }
/** /**
* 单号 * 需求单号
*/ */
private String orderNo; private String orderNo;
/** /**
* 工单号
*/
private String so;
/**
* 当前任务盘数 * 当前任务盘数
*/ */
private int taskReelCount = 0; private int taskReelCount = 0;
...@@ -39,6 +43,16 @@ public class LiteOrder extends BasePo implements Serializable { ...@@ -39,6 +43,16 @@ public class LiteOrder extends BasePo implements Serializable {
private int finishedReelCount = 0; private int finishedReelCount = 0;
/** /**
* 累计任务盘数
*/
private int totalTaskReelCount = 0;
/**
* 累计任务已完成盘数
*/
private int totalFinishedReelCount = 0;
/**
* 订单状态 * 订单状态
*/ */
private int status = LITEORDER_STATUS.NEW; private int status = LITEORDER_STATUS.NEW;
...@@ -48,13 +62,6 @@ public class LiteOrder extends BasePo implements Serializable { ...@@ -48,13 +62,6 @@ public class LiteOrder extends BasePo implements Serializable {
*/ */
private boolean closed = false; private boolean closed = false;
public void setClosed(boolean value){
this.closed=value;
if(value){
setStatus(LITEORDER_STATUS.CLOSED);
}
}
/** /**
* 工单来源 * 工单来源
...@@ -62,6 +69,11 @@ public class LiteOrder extends BasePo implements Serializable { ...@@ -62,6 +69,11 @@ public class LiteOrder extends BasePo implements Serializable {
private String source = ""; private String source = "";
/** /**
* 线别,AGV运送时使用此值做为目的地
*/
private String line = "";
/**
* 任务完成时间(用于关闭页面显示) * 任务完成时间(用于关闭页面显示)
*/ */
@Transient @Transient
...@@ -88,16 +100,25 @@ public class LiteOrder extends BasePo implements Serializable { ...@@ -88,16 +100,25 @@ public class LiteOrder extends BasePo implements Serializable {
*/ */
private Date sdate=new Date(); private Date sdate=new Date();
public void setClosed(boolean value){
this.closed=value;
if(value){
setStatus(LITEORDER_STATUS.CLOSED);
}
}
/** /**
* 结束当前的任务 * 结束当前的任务
*/ */
public void finishedTasks(){ public void finishedTasks(){
if(isOutOne()){ if(isOutOne()){
setStatus(LITEORDER_STATUS.ONE_FINISHED); // setStatus(LITEORDER_STATUS.ONE_FINISHED);
setClosed(true);
}else if(isOutBom()){ }else if(isOutBom()){
setStatus(LITEORDER_STATUS.BOM_FINISHED); setStatus(LITEORDER_STATUS.BOM_FINISHED);
}else if(isOutTails()){ }else if(isOutTails()){
setStatus(LITEORDER_STATUS.TAILS_FINISHED); // setStatus(LITEORDER_STATUS.TAILS_FINISHED);
setClosed(true);
} }
setTaskFinishedTime(System.currentTimeMillis()); setTaskFinishedTime(System.currentTimeMillis());
...@@ -150,6 +171,13 @@ public class LiteOrder extends BasePo implements Serializable { ...@@ -150,6 +171,13 @@ public class LiteOrder extends BasePo implements Serializable {
this.taskReelCount = taskReelCount; this.taskReelCount = taskReelCount;
} }
public void setTotalTaskReelCount(int totalReelCount){
if(totalReelCount<0){
totalReelCount=0;
}
this.totalTaskReelCount=totalReelCount;
}
/** /**
* 是否需要展示(已完成的,过20 秒自动清除) * 是否需要展示(已完成的,过20 秒自动清除)
......
...@@ -20,24 +20,44 @@ public class LiteOrderItem extends BasePo implements Serializable { ...@@ -20,24 +20,44 @@ public class LiteOrderItem extends BasePo implements Serializable {
private String ri; private String ri;
//需求数量 /**
* 总需求数量
*/
private int needNum = 0; private int needNum = 0;
/** /**
* 需求料盘数 * 需求料盘数
*/ */
private int needReelCount = 0; private int needReelCount = 0;
//已出数量 /**
* 当前任务已出数量
*/
private int outNum = 0; private int outNum = 0;
//已出盘数 /**
* 当前任务已出盘数
*/
private int outReelCount = 0; private int outReelCount = 0;
/** /**
* 累计已出数量
*/
private int totalOutNum = 0;
/**
* 累计已出盘数
*/
private int totalOutReelCount = 0;
/**
* 订单信息 * 订单信息
*/ */
private String orderNo = ""; private String orderNo = "";
/**
* 站位编号
*/
private String slotNum="";
/** /**
* 站位信息 * 站位信息
......
...@@ -89,9 +89,18 @@ public enum DeviceType { ...@@ -89,9 +89,18 @@ public enum DeviceType {
* 13 SMD-DUO(DUO料仓) * 13 SMD-DUO(DUO料仓)
*/ */
SMD_DUO("storage.type.smdDuo"), SMD_DUO("storage.type.smdDuo"),
/**
* 14 放料箱的方仓
*/
SMD_XLC("storage.type.smdXlc"),
/**
* 15 放料盘的方仓
*/
SMD_XLR("storage.type.smdXlr"),
/** /**
* 14 (默认料仓) * 15 (默认料仓)
*/ */
DEFAULT("storage.type.default") DEFAULT("storage.type.default")
; ;
......
package com.neotel.smfcore.core.storage.rest;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.SecurityUtils;
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.BarcodeDto;
import com.neotel.smfcore.core.barcode.rest.bean.mapstruct.BarcodeMapper;
import com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager;
import com.neotel.smfcore.core.barcode.service.manager.IComponentManager;
import com.neotel.smfcore.core.barcode.service.po.Barcode;
import com.neotel.smfcore.core.barcode.service.po.Component;
import com.neotel.smfcore.core.barcode.utils.CodeResolve;
import com.neotel.smfcore.core.device.enums.OP;
import com.neotel.smfcore.core.device.enums.OP_STATUS;
import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.core.storage.service.manager.IStoragePosManager;
import com.neotel.smfcore.core.storage.service.po.StoragePos;
import com.neotel.smfcore.core.system.service.manager.IDataLogManager;
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;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.*;
@Slf4j
@RestController
@RequiredArgsConstructor
@Api(tags = "物料管理:料盒操作")
@RequestMapping("api/materialBox")
public class MaterialBoxController {
@Autowired
IBarcodeManager barcodeManager;
@Autowired
IComponentManager componentManager;
@Autowired
IStoragePosManager storagePosManager;
@Autowired
private CodeResolve codeResolve;
@Autowired
private TaskService taskService;
@Autowired
private IDataLogManager dataLogManager;
@Autowired
private BarcodeMapper barcodeMapper;
@ApiOperation("查询料盒信息")
@PostMapping
@PreAuthorize("@el.check('materialBox')")
public BarcodeDto manualOut(@RequestBody String code) {
// String code = paramMap.get("barcode");
CodeBean codeBean = new CodeBean();
try {
codeBean = codeResolve.resolveSingleCode(code.trim(), COMPONENT_TYPE.FIXTURE);
} catch (ValidateException e) {
codeBean.setError(e.getMessage());
}
if (codeBean == null || codeBean.getBarcode() == null) {
throw new ValidateException("smfcode.error.barcode.invalid", "{0}不是有效的条码", new String[]{code});
}
if (codeBean.getErrorCode() != null) {
throw new ValidateException(codeBean.getErrorCode(), codeBean.getError(), codeBean.getParams());
}
List<BarcodeDto> codeDtos = new ArrayList<BarcodeDto>();
Barcode barcode = codeBean.getBarcode();
//此处需要判断是否是料盒
Component component=componentManager.findOneByPN(barcode.getPartNumber() );
if(component==null||(component.getType()!=COMPONENT_TYPE.FIXTURE)){
throw new ValidateException("smfcode.materialBox.invalid", "未找到料盒信息{0}", new String[]{code});
}
BarcodeDto barcodeDto=barcodeMapper.toDto(barcode);
if(barcodeDto.getSubCodeMap()==null){
barcodeDto.setSubCodeMap(new HashMap<>());
}
return barcodeDto;
}
@ApiOperation("取出物料")
@PostMapping("exeOut")
@PreAuthorize("@el.check('materialBox')")
public ResultBean exeOut(@RequestBody Map<String, String> paramMap) {
String code = paramMap.get("barcode");//料盒条码
String subPN = paramMap.get("subPN");//物料条码
String qtyStr = paramMap.get("qty");//数量
Barcode barcode = barcodeManager.findByBarcode(code);
if (barcode == null) {
throw new ValidateException("smfcode.materialBox.invalid", "未找到料盒信息{0}", new String[]{code});
}
Barcode subBarcode = barcode.getSubCode(subPN);
if (subBarcode == null) {
throw new ValidateException("smfcode.materialBox.noReel", "料盒中未找到对应物料");
}
int opQty = Integer.valueOf(qtyStr);
int oldAmount = subBarcode.getAmount();
if (oldAmount < opQty) {
throw new ValidateException("smfcode.materialBox.quantityshort", "物料数量不足");
}
int newAmount = oldAmount - opQty;
subBarcode.setAmount(newAmount);
subBarcode = barcodeManager.save(subBarcode);
finishTask(barcode, OP.CHECKOUT, null, subBarcode, opQty);
log.info(subBarcode.getPartNumber() + "从料盒[" + barcode.getPosName() + "]出库,物料数量:" + oldAmount + " - " + opQty + " = " + newAmount);
return ResultBean.newOkResult("");
}
@ApiOperation("取出全部物料")
@PostMapping("exeOutAll")
@PreAuthorize("@el.check('materialBox')")
public ResultBean exeOutAll(@RequestBody Map<String, String> paramMap){
String code = paramMap.get("barcode");//料盒条码
Barcode barcode=barcodeManager.findByBarcode(code);
if(barcode==null){
//料盒不存在
throw new ValidateException("smfcode.materialBox.invalid", "未找到料盒信息{0}", new String[]{code});
}
if(barcode.getSubCodeMap()==null||barcode.getSubCodeMap().size()<=0){
//料盒中未找到对应物料
throw new ValidateException("smfcode.materialBox.boxNoReel","料盒中无物料");
}
List<Barcode> barcodes=new ArrayList<>(barcode.getSubCodeMap().values()) ;
for (Barcode subBarcode :
barcodes) {
int opQty=subBarcode.getAmount();
subBarcode.setAmount(0);
subBarcode = barcodeManager.save(subBarcode);
finishTask(barcode, OP.CHECKOUT, null,subBarcode, opQty);
log.info(subBarcode.getPartNumber() + "从料盒["+barcode.getPosName()+"]全部出库,物料数量:" + opQty);
}
return ResultBean.newOkResult("");
}
@ApiOperation("操作料盒内的物料信息")
@PostMapping(value = "/operatePos")
@PreAuthorize("@el.check('materialBox')")
public ResultBean operatePos(@RequestBody Map<String, String> paramMap) {
try{
String code = paramMap.get("barcode");//料盒条码
String operageStr = paramMap.get("operatePN");//操作信息
DataLog currentTask=null;
Barcode barcode=barcodeManager.findByBarcode(code);
if(barcode==null){
throw new ValidateException("smfcode.materialBox.invalid", "未找到料盒信息{0}", new String[]{code});
}
//用+或-分割,如果最后几位是数量,按手动输入处理
String[] codeArray = operageStr.split("-");
String pnStr = "";
int opQty = 0;
int opType = OP.NON_OP;
if(codeArray.length == 2){
try{
opQty = Integer.valueOf(codeArray[1]);
pnStr = codeArray[0];
opType = OP .CHECKOUT;
}catch (Exception e){
}
}
if(opType == OP.NON_OP){
codeArray = operageStr.split("\\+");
if(codeArray.length == 2){
try{
opQty = Integer.valueOf(codeArray[1]);
pnStr = codeArray[0];
opType = OP.PUT_IN;
}catch (Exception e){
}
}
}
if(opType != OP.NON_OP){
//手动输入,按PN来处理
//先查找是否有相同的PN,没有创建一个
Component component = autoGetComponent(pnStr,opQty);
//查看该库位中是否有相同的物料,有的话,数量累加
Barcode subBarcode=barcode.getSubCode(pnStr);
if(opType == OP.PUT_IN) {
//入库
if (subBarcode != null) {
int oldAmount = subBarcode.getAmount();
subBarcode.setHostBarcodeId(barcode.getId());
subBarcode.setAmount(oldAmount + opQty);
subBarcode = barcodeManager.save(subBarcode);
finishTask(barcode, opType, currentTask, subBarcode, opQty);
log.info(subBarcode.getPartNumber() + "入库到料盒[" + barcode.getBarcode() + "],物料数量:" + oldAmount + " + " + opQty + " = " + subBarcode.getAmount());
} else {
subBarcode=autoGetBarcode(barcode,component,pnStr,opQty);
finishTask(barcode, opType, currentTask, subBarcode, opQty);
log.info(barcode.getPartNumber() + "入库到料盒[" + barcode.getBarcode() + "],物料数量:" + barcode.getAmount());
}
}else {
//出库
if(subBarcode != null){
int oldAmount = subBarcode.getAmount();
if(oldAmount < opQty){
throw new ValidateException("smfcode.materialBox.quantityshort","物料数量不足");
}
int newAmount = oldAmount - opQty;
subBarcode.setHostBarcodeId(barcode.getId());
subBarcode.setAmount(newAmount);
subBarcode = barcodeManager.save(subBarcode);
finishTask(barcode, opType, currentTask,subBarcode, opQty);
log.info(subBarcode.getPartNumber() + "从料盒["+barcode.getPosName()+"]出库,物料数量:" + oldAmount + " - " + opQty + " = " + newAmount);
}else{
//无库存
throw new ValidateException("smfcode.materialBox.noReel","料盒中未找到对应物料");
}
}
}else {
String newCodeStr = "=1x1=" + operageStr;
CodeBean codeBean = codeResolve.resolveSingleCode(newCodeStr );
if (codeBean.isValid()) {
Barcode subBarcode = codeBean.getBarcode();
StoragePos pos = storagePosManager.getByBarcode(subBarcode.getBarcode());
if (pos != null) {
throw new ValidateException("smfcode.materialBox.inPos", "物料已在库位{0}中", new String[]{pos.getPosName()});
}
if (subBarcode.getHostBarcodeId() == null) {
//不存在,入库
opQty = OP.PUT_IN;
int newCount = subBarcode.getAmount() ;
if(newCount<=0){
newCount=1;
}
subBarcode.setHostBarcodeId(barcode.getId());
subBarcode.setAmount(newCount);
barcodeManager.saveBarcode(subBarcode);
finishTask(barcode, opQty, currentTask, subBarcode, subBarcode.getAmount());
log.info("条码" + subBarcode.getBarcode() + "[" + subBarcode.getPartNumber() + "]入库到料盒[" + barcode.getBarcode() + "]数量:" + barcode.getAmount());
}
else if (subBarcode.getHostBarcodeId().equals(barcode.getId())) {
int qty = subBarcode.getAmount();
//出库
subBarcode.setAmount(0);
opQty = OP.CHECKOUT;
finishTask(barcode, opQty, currentTask, subBarcode, qty);
log.info("条码" + subBarcode.getBarcode() + "[" + subBarcode.getPartNumber() + "]从料盒[" + barcode.getBarcode() + "]出库,数量:" + qty);
} else {
//在别的料盒中
Barcode hostBarcode = barcodeManager.get(subBarcode.getHostBarcodeId());
if (hostBarcode != null) {
throw new ValidateException("smfcode.materialBox.inOtherBox", "物料已在料盒{0}中", new String[]{hostBarcode.getBarcode()});
}
}
} else {
return ResultBean.newErrorResult(1, codeBean.getErrorCode(), codeBean.getError(), codeBean.getParams());
}
}
}catch (Exception e){
// return "出入库操作出错:" + e.getMessage();
log.error(e.toString());
throw new ValidateException("smfcore.error","出错{0}",new String[]{e.toString()});
}
return ResultBean.newOkResult("");
}
private Component autoGetComponent(String pnStr,int opQty){
Component component = componentManager.findOneByPN(pnStr);
if(component == null){
component = new Component();
component.setHeight(1);
component.setPartNumber(pnStr);
component.setPlateSize(1);
component.setType(COMPONENT_TYPE.OTHERS);
component.setAmount(opQty);
component = componentManager.save(component);
}
return component;
}
private Barcode autoGetBarcode(Barcode barcode,Component component, String pnStr,int opQty){
//条码设置为P+PosId+C+ComponentId
String barcodeStr = "P" + barcode.getId() + "C" + component.getId();
Barcode subBarcode = barcodeManager.findByBarcode(barcodeStr);
if (subBarcode == null) {
//不存在,需要创建条码和库位
subBarcode = new Barcode();
subBarcode.setBarcode(barcodeStr);
subBarcode.setPlateSize(1);
subBarcode.setHeight(1);
subBarcode.setPartNumber(pnStr);
}
subBarcode.setAmount(opQty);
subBarcode.setUsedDate(new Date());
subBarcode.setPutInTime(System.currentTimeMillis());
subBarcode.setCheckOutDate(null, "");
subBarcode.setHostBarcodeId(barcode.getId());
subBarcode = barcodeManager.save(subBarcode);
return subBarcode;
}
/**
* 完成出入库任务
* @param pidBarcode 料箱
* @param currentTask 当前任务
* @param subBarcode 箱内物料
* @param opQty 数量
* @throws ValidateException
*/
private void finishTask(Barcode pidBarcode, int opType, DataLog currentTask, Barcode subBarcode, int opQty) throws ValidateException {
//更新barcode缓存
pidBarcode.UpdateSubCode(subBarcode);
if(opType==OP.CHECKOUT&&subBarcode.getAmount()<=0){
//数量为0直接删除
barcodeManager.delete(subBarcode);
}
barcodeManager.saveBarcode(pidBarcode);
DataLog task = null;
//先查看是否有相同类型且库位相同的任务
if(currentTask!=null) {
Collection<DataLog> queueTasks = taskService.getQueueTasks();
for (DataLog queueTask : queueTasks) {
if (queueTask.getType() == currentTask.getType()) {
if (queueTask.getPosName().equals(pidBarcode.getBarcode())) {
task = queueTask;
break;
}
}
}
}
if (task == null) {
task = new DataLog();
}
task.setStatus(OP_STATUS.FINISHED.name());
task.setPartNumber(subBarcode.getPartNumber());
task.setBarcode(subBarcode.getBarcode());
task.setNum(opQty);
task.setType(opType);
if (task.isCheckOutTask()) {
opQty = -opQty;
}
// Storage storage = dataCache.getStorage(currentTask.getCid());
// task.setCid(storage.getCid());
// task.setStorageId(storage.getId());
// task.setStorageName(storage.getName());
//
// task.setPosId(operatePos.getId());
// task.setPosName(operatePos.getPosName());
task.setCid(pidBarcode.getPartNumber());
// task.setStorageId(storage.getId());
task.setStorageName(pidBarcode.getBarcode());
// task.setPosId(operatePos.getId());
task.setPosName(pidBarcode.getBarcode());
task.setSourceName(SecurityUtils.getLoginUsername());
task = dataLogManager.save(task);
taskService.moveTaskToFinished(task);
// dataCache.updateInventoryAmount(task.getCid(), subBarcode.getPartNumber(), opQty);
}
}
...@@ -7,8 +7,11 @@ import com.neotel.smfcore.common.bean.PageData; ...@@ -7,8 +7,11 @@ import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.bean.ResultBean; import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.exception.ValidateException; import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.QueryHelp; 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.common.utils.StorageConstants;
import com.neotel.smfcore.core.barcode.enums.COMPONENT_TYPE; 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.device.util.DataCache;
import com.neotel.smfcore.core.storage.bean.InventoryItem; import com.neotel.smfcore.core.storage.bean.InventoryItem;
import com.neotel.smfcore.core.storage.rest.dto.*; import com.neotel.smfcore.core.storage.rest.dto.*;
...@@ -21,6 +24,7 @@ import com.neotel.smfcore.core.storage.service.manager.IStoragePosManager; ...@@ -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.Label;
import com.neotel.smfcore.core.storage.service.po.Storage; import com.neotel.smfcore.core.storage.service.po.Storage;
import com.neotel.smfcore.core.storage.service.po.StoragePos; 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.core.system.util.TaskService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -61,6 +65,9 @@ public class MaterialController { ...@@ -61,6 +65,9 @@ public class MaterialController {
@Autowired @Autowired
private final ILabelManager labelManager; private final ILabelManager labelManager;
@Autowired
private final IBarcodeManager barcodeManager;
@ApiOperation("策略出库获取库存列表") @ApiOperation("策略出库获取库存列表")
@GetMapping(value = "/inventory") @GetMapping(value = "/inventory")
@PreAuthorize("@el.check('tacticsOuput')") @PreAuthorize("@el.check('tacticsOuput')")
...@@ -153,24 +160,24 @@ public class MaterialController { ...@@ -153,24 +160,24 @@ public class MaterialController {
@PostMapping(value = "/labelOuput") @PostMapping(value = "/labelOuput")
@PreAuthorize("@el.check('labelOuput')") @PreAuthorize("@el.check('labelOuput')")
public ResultBean labelOuput(@RequestBody PosLabelDto params) { public ResultBean labelOuput(@RequestBody PosLabelDto params) {
List<String> posIds=params.getPosIds(); List<String> posIds = params.getPosIds();
if (posIds == null) { if (posIds == null) {
throw new ValidateException("smfcode.valueCanotNull", "{0}不能为空", new String[]{"PN"}); throw new ValidateException("smfcode.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("smfcode.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("smfcode.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); 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("smfcode.error", outResult);
} }
...@@ -187,17 +194,48 @@ public class MaterialController { ...@@ -187,17 +194,48 @@ public class MaterialController {
// List<String> posIds=(List<String>) params.get("posIds"); // List<String> posIds=(List<String>) params.get("posIds");
// String labelId = params.get("labelId").toString(); // String labelId = params.get("labelId").toString();
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("smfcode.valueCanotNull", "{0}不能为空", new String[]{"ID"});
} }
if(ObjectUtil.isEmpty(labelId)){ if (ObjectUtil.isEmpty(labelId)) {
labelId=""; labelId = "";
} }
String[] array= posIds.toArray(new String[posIds.size()]) ; String[] array = posIds.toArray(new String[posIds.size()]);
storagePosManager.updatePosLabel(array,labelId); storagePosManager.updatePosLabel(array, labelId);
return ResultBean.newOkResult(""); 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; package com.neotel.smfcore.core.storage.rest;
import cn.hutool.core.util.ObjectUtil;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import com.neotel.smfcore.common.bean.PageData; import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.bean.ResultBean; import com.neotel.smfcore.common.bean.ResultBean;
...@@ -8,12 +9,14 @@ import com.neotel.smfcore.common.utils.Constants; ...@@ -8,12 +9,14 @@ import com.neotel.smfcore.common.utils.Constants;
import com.neotel.smfcore.common.utils.QueryHelp; import com.neotel.smfcore.common.utils.QueryHelp;
import com.neotel.smfcore.common.utils.SecurityUtils; import com.neotel.smfcore.common.utils.SecurityUtils;
import com.neotel.smfcore.common.utils.StorageConstants; 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.enums.COMPONENT_TYPE;
import com.neotel.smfcore.core.barcode.rest.bean.dto.CodeDto; 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.rest.bean.mapstruct.CodeMapper;
import com.neotel.smfcore.core.barcode.service.po.Barcode; import com.neotel.smfcore.core.barcode.service.po.Barcode;
import com.neotel.smfcore.core.barcode.utils.CodeResolve; import com.neotel.smfcore.core.barcode.utils.CodeResolve;
import com.neotel.smfcore.core.device.util.DataCache; 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.CheckOutDto;
import com.neotel.smfcore.core.storage.rest.dto.StoragePosDto; import com.neotel.smfcore.core.storage.rest.dto.StoragePosDto;
import com.neotel.smfcore.core.storage.rest.dto.StoragePosEnabledDto; import com.neotel.smfcore.core.storage.rest.dto.StoragePosEnabledDto;
...@@ -25,11 +28,13 @@ import com.neotel.smfcore.core.storage.service.dao.IStoragePosDao; ...@@ -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.manager.IStoragePosManager;
import com.neotel.smfcore.core.storage.service.po.Storage; import com.neotel.smfcore.core.storage.service.po.Storage;
import com.neotel.smfcore.core.storage.service.po.StoragePos; 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.core.system.util.TaskService;
import com.neotel.smfcore.security.annotation.AnonymousAccess; import com.neotel.smfcore.security.annotation.AnonymousAccess;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.Data;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.bytebuddy.asm.Advice; import net.bytebuddy.asm.Advice;
...@@ -61,7 +66,7 @@ public class StoragePosController { ...@@ -61,7 +66,7 @@ public class StoragePosController {
@Autowired @Autowired
private final StoragePosMapper storagePosMapper; private final StoragePosMapper storagePosMapper;
@Autowired @Autowired
private DataCache dataCache; private DataCache dataCache;
@Autowired @Autowired
private TaskService taskService; private TaskService taskService;
...@@ -72,35 +77,34 @@ public class StoragePosController { ...@@ -72,35 +77,34 @@ public class StoragePosController {
private CodeMapper codeMapper; private CodeMapper codeMapper;
@ApiOperation("查询库位") @ApiOperation("查询库位")
@GetMapping @GetMapping
@PreAuthorize("@el.check('storagePos:list')") @PreAuthorize("@el.check('storagePos:list')")
public PageData<StoragePosDto> query(StoragePosQueryCriteria criteria, Pageable pageable){ public PageData<StoragePosDto> query(StoragePosQueryCriteria criteria, Pageable pageable) {
if(criteria.getStorageIdList()!=null&&criteria.getStorageIdList().contains("0")){ if (criteria.getStorageIdList() != null && criteria.getStorageIdList().contains("0")) {
criteria.setStorageIdList(null); criteria.setStorageIdList(null);
} }
Query query= QueryHelp.getQuery(criteria); Query query = QueryHelp.getQuery(criteria);
PageData<StoragePos> pages=storagePosManager.findByPage(query,pageable); PageData<StoragePos> pages = storagePosManager.findByPage(query, pageable);
List<StoragePosDto> StoragePosDtos=storagePosMapper.toDto(pages.getContent()); List<StoragePosDto> StoragePosDtos = storagePosMapper.toDto(pages.getContent());
return new PageData(StoragePosDtos,pages.getTotalElements()); return new PageData(StoragePosDtos, pages.getTotalElements());
} }
@ApiOperation("删除指定料仓所有库位") @ApiOperation("删除指定料仓所有库位")
@PutMapping("/removeAllPos") @PutMapping("/removeAllPos")
@PreAuthorize("@el.check('storagePos:edit')") @PreAuthorize("@el.check('storagePos:edit')")
public ResultBean clearAllPos(@RequestBody Map<String,String> map) { public ResultBean clearAllPos(@RequestBody Map<String, String> map) {
String cid=""; String cid = "";
if(map.containsKey("cid")){ if (map.containsKey("cid")) {
cid= map.get("cid"); cid = map.get("cid");
} }
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("smfcode.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
) { ) {
if (storagePos != null) { if (storagePos != null) {
Barcode barcode = storagePos.getBarcode(); Barcode barcode = storagePos.getBarcode();
...@@ -110,29 +114,29 @@ public class StoragePosController { ...@@ -110,29 +114,29 @@ public class StoragePosController {
} }
} }
log.info("开始删除料仓["+cid+"] 所有位置"); log.info("开始删除料仓[" + cid + "] 所有位置");
storagePosManager.removePosByStorageId(storage.getId()); storagePosManager.removePosByStorageId(storage.getId());
log.info("删除料仓["+cid+"] 所有位置完成"); log.info("删除料仓[" + cid + "] 所有位置完成");
return ResultBean.newOkResult(""); return ResultBean.newOkResult("");
} }
@ApiOperation("清空指定料仓所有库位") @ApiOperation("清空指定料仓所有库位")
@PutMapping("/clearStoragePos") @PutMapping("/clearStoragePos")
@PreAuthorize("@el.check('storagePos:edit')") @PreAuthorize("@el.check('storagePos:edit')")
public ResultBean clearStoragePos(@RequestBody Map<String,String> map) { public ResultBean clearStoragePos(@RequestBody Map<String, String> map) {
String cid=""; String cid = "";
if(map.containsKey("cid")){ if (map.containsKey("cid")) {
cid= map.get("cid"); cid = map.get("cid");
} }
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("smfcode.valueNotFind", "未找到{0}[{1}]", new String[]{"cid", cid});
} }
log.info("开始手动清空料仓["+storage.getName()+"_"+storage.getCid()+"]的所有库位"); log.info("开始手动清空料仓[" + storage.getName() + "_" + storage.getCid() + "]的所有库位");
List<StoragePos> allPos=storagePosManager.findByStorage(storage.getId()); List<StoragePos> allPos = storagePosManager.findByStorage(storage.getId());
for (StoragePos storagePos:allPos for (StoragePos storagePos : allPos
) { ) {
if (storagePos != null) { if (storagePos != null) {
try { try {
// QisdaApi.ClearStockBy(storagePos.getPosName()); // QisdaApi.ClearStockBy(storagePos.getPosName());
...@@ -145,7 +149,7 @@ public class StoragePosController { ...@@ -145,7 +149,7 @@ public class StoragePosController {
taskService.addTaskToFinished(storagePos, null, opUser + "-clear"); taskService.addTaskToFinished(storagePos, null, opUser + "-clear");
} }
} catch (Exception e) { } 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 { ...@@ -158,7 +162,7 @@ public class StoragePosController {
@ApiOperation("清空指定库位") @ApiOperation("清空指定库位")
@PutMapping("/clearPos") @PutMapping("/clearPos")
@PreAuthorize("@el.check('storagePos:edit')") @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")) { if (map.containsKey("posName")) {
String posName = map.get("posName"); String posName = map.get("posName");
...@@ -178,7 +182,7 @@ public class StoragePosController { ...@@ -178,7 +182,7 @@ public class StoragePosController {
return ResultBean.newOkResult(""); return ResultBean.newOkResult("");
} catch (Exception e) { } catch (Exception e) {
// return e.getMessage(); // 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 { ...@@ -189,36 +193,35 @@ public class StoragePosController {
@PutMapping("/enabledPos") @PutMapping("/enabledPos")
@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("smfcode.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("smfcode.valueNotFind", "未找到{0}[{1}]", new String[]{"PosId", enabledDto.getId()});
// throw new ValidateException("未找到库位 "); // throw new ValidateException("未找到库位 ");
} }
pos.setEnabled(enabledDto.isEnabled()); pos.setEnabled(enabledDto.isEnabled());
storagePosDao.save(pos); storagePosDao.save(pos);
log.info("启用禁用库位:库位号["+pos.getId()+"]["+pos.getPosName()+"]="+enabledDto.isEnabled()); log.info("启用禁用库位:库位号[" + pos.getId() + "][" + pos.getPosName() + "]=" + enabledDto.isEnabled());
return ResultBean.newOkResult(""); return ResultBean.newOkResult("");
} }
@ApiOperation("修改库位") @ApiOperation("修改库位")
@PutMapping @PutMapping
@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("smfcode.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("smfcode.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("smfcode.valueNotFind", "未找到{0}[{1}]", new String[]{"PosId", saveDto.getId()});
// throw new ValidateException("未找到库位 "); // throw new ValidateException("未找到库位 ");
} }
pos.setPosName(saveDto.getPosName()); pos.setPosName(saveDto.getPosName());
...@@ -226,11 +229,11 @@ public class StoragePosController { ...@@ -226,11 +229,11 @@ public class StoragePosController {
pos.setH(saveDto.getH()); pos.setH(saveDto.getH());
pos.setW(saveDto.getW()); pos.setW(saveDto.getW());
storagePosDao.save(pos); storagePosDao.save(pos);
log.info("修改库位:库位号["+pos.getId()+"]=["+saveDto.toString()+"]"); log.info("修改库位:库位号[" + pos.getId() + "]=[" + saveDto.toString() + "]");
return new ResponseEntity<>(HttpStatus.OK); return new ResponseEntity<>(HttpStatus.OK);
} }
// @ApiOperation("新增库位") // @ApiOperation("新增库位")
// @PostMapping // @PostMapping
// @PreAuthorize("@el.check('storage:add')") // @PreAuthorize("@el.check('storage:add')")
// public ResponseEntity<Object> create(@Validated @RequestBody StoragePosDto resources) { // public ResponseEntity<Object> create(@Validated @RequestBody StoragePosDto resources) {
...@@ -245,7 +248,7 @@ public class StoragePosController { ...@@ -245,7 +248,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("smfcode.valueCanotNull", "{0}不能为空", new String[]{"ID"});
} }
} }
storagePosManager.deletePoss(ids); storagePosManager.deletePoss(ids);
...@@ -255,22 +258,22 @@ public class StoragePosController { ...@@ -255,22 +258,22 @@ public class StoragePosController {
@ApiOperation("查找出库列表") @ApiOperation("查找出库列表")
@GetMapping("/find") @GetMapping("/find")
@PreAuthorize("@el.check('checkOut')") @PreAuthorize("@el.check('checkOut')")
public PageData<StoragePosDto> storagePosFind(StoragePosFindCriteria criteria, Pageable pageable,HttpServletRequest request){ public PageData<StoragePosDto> storagePosFind(StoragePosFindCriteria criteria, Pageable pageable, HttpServletRequest request) {
if(criteria.getStorageId()!=null&&criteria.getStorageId().equals("0")){ if (criteria.getStorageId() != null && criteria.getStorageId().equals("0")) {
criteria.setStorageId(null); criteria.setStorageId(null);
} }
Query query= QueryHelp.getQuery(criteria); Query query = QueryHelp.getQuery(criteria);
Criteria baseCriteria= Criteria.where("used").is(true); Criteria baseCriteria = Criteria.where("used").is(true);
int componentType = criteria.getType(); int componentType = criteria.getType();
String name=""; String name = "";
if(componentType != -1){ if (componentType != -1) {
int type = componentType; int type = componentType;
request.setAttribute("type", componentType); request.setAttribute("type", componentType);
if(componentType == 41){//锡膏夹具 if (componentType == 41) {//锡膏夹具
type = COMPONENT_TYPE.FIXTURE; type = COMPONENT_TYPE.FIXTURE;
name = StorageConstants.PACKAGE_TYPE.SOLDER_FIXTURE.getCode(); name = StorageConstants.PACKAGE_TYPE.SOLDER_FIXTURE.getCode();
}else if(componentType == 42){//PCB夹具 } else if (componentType == 42) {//PCB夹具
type = COMPONENT_TYPE.FIXTURE; type = COMPONENT_TYPE.FIXTURE;
name = StorageConstants.PACKAGE_TYPE.PCB_FIXTURE.getCode(); name = StorageConstants.PACKAGE_TYPE.PCB_FIXTURE.getCode();
} }
...@@ -279,20 +282,20 @@ public class StoragePosController { ...@@ -279,20 +282,20 @@ public class StoragePosController {
String expire = criteria.getExpire(); String expire = criteria.getExpire();
if(!Strings.isNullOrEmpty(expire)){ if (!Strings.isNullOrEmpty(expire)) {
if("solder".equalsIgnoreCase(expire)){ if ("solder".equalsIgnoreCase(expire)) {
baseCriteria.and("barcode.expTime").lte(new Date()); baseCriteria.and("barcode.expTime").lte(new Date());
}else if("pcb".equalsIgnoreCase(expire)){ } else if ("pcb".equalsIgnoreCase(expire)) {
baseCriteria.and("barcode.expireDate").lte(new Date()); baseCriteria.and("barcode.expireDate").lte(new Date());
} }
request.setAttribute("expire",expire); request.setAttribute("expire", expire);
} }
query.addCriteria(baseCriteria); query.addCriteria(baseCriteria);
PageData<StoragePos> pages=storagePosManager.findByPage(query,pageable); PageData<StoragePos> pages = storagePosManager.findByPage(query, pageable);
List<StoragePosDto> StoragePosDtos=storagePosMapper.toDto(pages.getContent()); List<StoragePosDto> StoragePosDtos = storagePosMapper.toDto(pages.getContent());
return new PageData(StoragePosDtos,pages.getTotalElements()); return new PageData(StoragePosDtos, pages.getTotalElements());
} }
@ApiOperation("查找出库") @ApiOperation("查找出库")
...@@ -300,29 +303,28 @@ public class StoragePosController { ...@@ -300,29 +303,28 @@ 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("smfcode.valueCanotNull", "{0}不能为空", new String[]{"ID"});
} }
if(checkOutDto.getSingleOut()==null){ if (checkOutDto.getSingleOut() == null) {
checkOutDto.setSingleOut(true+""); checkOutDto.setSingleOut(true + "");
} }
String isSingleOutStr = checkOutDto.getSingleOut(); String isSingleOutStr = checkOutDto.getSingleOut();
boolean isSingleOut = Boolean.valueOf(isSingleOutStr); boolean isSingleOut = Boolean.valueOf(isSingleOutStr);
// String pids = checkOutDto.getPids();
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("smfcode.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("smfcode.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); 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("smfcode.error", outResult);
} }
...@@ -333,17 +335,61 @@ public class StoragePosController { ...@@ -333,17 +335,61 @@ public class StoragePosController {
@ApiOperation("解析出库条码") @ApiOperation("解析出库条码")
@PutMapping("/resolveCode/{blurry}") @PutMapping("/resolveCode/{blurry}")
public CodeDto resolveCode(@PathVariable String blurry){ public CodeDto resolveCode(@PathVariable String blurry) {
String barcodeStr=blurry; String barcodeStr = blurry;
Barcode barcode=codeResolve.resolveCode(barcodeStr); Barcode barcode = codeResolve.resolveCode(barcodeStr);
if(barcode==null){ if (barcode == null) {
return null; return null;
}else{ } else {
CodeDto dto=codeMapper.toDto(barcode); CodeDto dto = codeMapper.toDto(barcode);
log.info("resolveCode ["+barcodeStr+"]=["+dto.toString()+"]"); log.info("resolveCode [" + barcodeStr + "]=[" + dto.toString() + "]");
return dto; 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;
}
} }
...@@ -2,6 +2,7 @@ package com.neotel.smfcore.core.storage.rest.query; ...@@ -2,6 +2,7 @@ package com.neotel.smfcore.core.storage.rest.query;
import com.neotel.smfcore.common.annotation.QueryCondition; import com.neotel.smfcore.common.annotation.QueryCondition;
import com.neotel.smfcore.common.bean.BetweenData; import com.neotel.smfcore.common.bean.BetweenData;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
...@@ -27,4 +28,8 @@ public class StoragePosQueryCriteria { ...@@ -27,4 +28,8 @@ public class StoragePosQueryCriteria {
@QueryCondition(type = QueryCondition.Type.IN, propName = "storageId") @QueryCondition(type = QueryCondition.Type.IN, propName = "storageId")
private List<String> storageIdList; private List<String> storageIdList;
@ApiModelProperty("是否启用")
@QueryCondition
private Boolean enabled;
} }
...@@ -17,8 +17,10 @@ import java.util.Set; ...@@ -17,8 +17,10 @@ import java.util.Set;
public interface IStoragePosManager extends IBaseManager<StoragePos> { public interface IStoragePosManager extends IBaseManager<StoragePos> {
List<PlateSizeBean> getStoragePosUsage(String storageId); List<PlateSizeBean> getStoragePosUsage(String storageId);
StoragePos getByPosName(String posName); StoragePos getByPosName(String posName);
Map<String,InventoryItem> getInventory(String id);
Map<String, InventoryItem> getInventory(String id);
StoragePos getByBarcode(String barcode); StoragePos getByBarcode(String barcode);
...@@ -32,7 +34,7 @@ public interface IStoragePosManager extends IBaseManager<StoragePos> { ...@@ -32,7 +34,7 @@ public interface IStoragePosManager extends IBaseManager<StoragePos> {
void deletePoss(Set<String> ids); void deletePoss(Set<String> ids);
StoragePos getEmptyPosByStorage(Storage storage, Barcode barcode, Collection<String> excludePosIds) throws ValidateException ; StoragePos getEmptyPosByStorage(Storage storage, Barcode barcode, Collection<String> excludePosIds) throws ValidateException;
StoragePos getEmptyPosByStorage(Storage storage, Barcode barcode, Collection<String> excludePosIds, String lastPosId) throws ValidateException; StoragePos getEmptyPosByStorage(Storage storage, Barcode barcode, Collection<String> excludePosIds, String lastPosId) throws ValidateException;
...@@ -48,5 +50,7 @@ public interface IStoragePosManager extends IBaseManager<StoragePos> { ...@@ -48,5 +50,7 @@ public interface IStoragePosManager extends IBaseManager<StoragePos> {
void clearStoragePosLabel(String id); void clearStoragePosLabel(String id);
void updatePosLabel( String[] posIds, String labelId); void updatePosLabel(String[] posIds, String labelId);
void clearLockPos(String lockId);
} }
package com.neotel.smfcore.core.storage.service.manager.impl; package com.neotel.smfcore.core.storage.service.manager.impl;
import cn.hutool.core.util.ObjectUtil;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.neotel.smfcore.common.bean.PageData; import com.neotel.smfcore.common.bean.PageData;
...@@ -217,8 +218,13 @@ public class StoragePosManagerImpl implements IStoragePosManager { ...@@ -217,8 +218,13 @@ public class StoragePosManagerImpl implements IStoragePosManager {
Query q = new Query(c); Query q = new Query(c);
Sort sort = getSortByCheckOutType(checkOutType); Sort sort = getSortByCheckOutType(checkOutType);
q.with(sort); q.with(sort);
log.info("使用"+checkOutType+"策略出库partNumber="+pn); StoragePos pos=storagePosDao.findOne(q);
return storagePosDao.findOne(q); if(pos==null){
log.info("使用"+checkOutType+" 策略出库 partNumber="+pn+",未找到可以出库的物料 ");
}else{
log.info("使用"+checkOutType+" 策略出库 partNumber="+pn+",找到出仓位置【"+ pos.getPosName()+"】,RI【"+pos.getBarcode().getBarcode()+"】 ");
}
return pos;
} }
...@@ -325,12 +331,12 @@ public class StoragePosManagerImpl implements IStoragePosManager { ...@@ -325,12 +331,12 @@ public class StoragePosManagerImpl implements IStoragePosManager {
COMPATIBLE_TYPE compatibleType = storage.getCompatibleType(); COMPATIBLE_TYPE compatibleType = storage.getCompatibleType();
if(compatibleType == COMPATIBLE_TYPE.EXACT_MATCH){//完全匹配 if (compatibleType == COMPATIBLE_TYPE.EXACT_MATCH) {//完全匹配
c = c.and("w").is(barcode.getPlateSize()).and("h").is(barcode.getHeight()); c = c.and("w").is(barcode.getPlateSize()).and("h").is(barcode.getHeight());
}else if(compatibleType == COMPATIBLE_TYPE.FULLY_COMPATIBLE){//同厚度兼容 } else if (compatibleType == COMPATIBLE_TYPE.FULLY_COMPATIBLE) {//同厚度兼容
c = c.and("w").gte(barcode.getPlateSize()).and("h").gte(barcode.getHeight());//除7寸外,完全兼容 c = c.and("w").gte(barcode.getPlateSize()).and("h").gte(barcode.getHeight());//除7寸外,完全兼容
}else if(compatibleType == COMPATIBLE_TYPE.SIZE_COMPATIBLE){//同尺寸兼容 } else if (compatibleType == COMPATIBLE_TYPE.SIZE_COMPATIBLE) {//同尺寸兼容
c = c.and("w").is(barcode.getPlateSize()).and("h").gte(barcode.getHeight());//宽度等于料盘宽度,高度大于等于料盘高度 c = c.and("w").is(barcode.getPlateSize()).and("h").gte(barcode.getHeight());//宽度等于料盘宽度,高度大于等于料盘高度
} }
...@@ -338,18 +344,25 @@ public class StoragePosManagerImpl implements IStoragePosManager { ...@@ -338,18 +344,25 @@ public class StoragePosManagerImpl implements IStoragePosManager {
.and("used").is(false);//未使用 .and("used").is(false);//未使用
//去除的仓位 //去除的仓位
if(excludePosIds != null && !excludePosIds.isEmpty()){ if (excludePosIds != null && !excludePosIds.isEmpty()) {
c = c.and("id").nin(excludePosIds); c = c.and("id").nin(excludePosIds);
} }
Query query = new Query(c); Query query = new Query(c);
if(lastPosId==null||lastPosId.equals("")){ String msg = "";
// if (lastPosId == null || lastPosId.equals("")) {
//优先放入最合适的位置(根据尺寸),相同尺寸按优先级排序 //优先放入最合适的位置(根据尺寸),相同尺寸按优先级排序
query.with(Sort.by(Sort.Direction.ASC, "w").and(Sort.by(Sort.Direction.ASC, "h")).and(Sort.by(Sort.Direction.DESC, "priority"))); query.with(Sort.by(Sort.Direction.ASC, "w").and(Sort.by(Sort.Direction.ASC, "h")).and(Sort.by(Sort.Direction.DESC, "priority")));
}else{ // } else {
Point point= PointUtil.getPosPoint(lastPosId,false); // Point point = PointUtil.getPosPoint(lastPosId, false);
query.addCriteria(Criteria.where("coordinate").nearSphere(point)); // query.addCriteria(Criteria.where("coordinate").nearSphere(point));
} // msg += "getEmptyPosByStorage 根据就近坐标查询[" + lastPosId + "][" + point.getX() + "," + point.getY() + "]";
// }
StoragePos pos = storagePosDao.findOne(query); StoragePos pos = storagePosDao.findOne(query);
if ((!ObjectUtil.isNotEmpty(msg) )&& (pos != null)) {
Point targetP = PointUtil.getPosPoint(lastPosId, false);
log.info(msg + "结果:[" + pos.getPosName() + "][" + targetP.getX() + "," + targetP.getY() + "]");
}
return pos; return pos;
} }
@Override @Override
...@@ -388,4 +401,10 @@ public class StoragePosManagerImpl implements IStoragePosManager { ...@@ -388,4 +401,10 @@ public class StoragePosManagerImpl implements IStoragePosManager {
storagePosDao.updateMulti(query, Update.update("labelId",labelId)); storagePosDao.updateMulti(query, Update.update("labelId",labelId));
} }
@Override
public void clearLockPos(String lockId) {
Query query = new Query( Criteria.where("barcode.lockId").is(lockId));
storagePosDao.updateMulti(query, Update.update("barcode.lockId",""));
}
} }
...@@ -36,6 +36,7 @@ public class DataLog extends BasePo implements Serializable { ...@@ -36,6 +36,7 @@ public class DataLog extends BasePo implements Serializable {
setPosId(pos.getId()); setPosId(pos.getId());
setPosName(pos.getPosName()); setPosName(pos.getPosName());
setStatus(OP_STATUS.WAIT.name());
} }
/** /**
...@@ -181,7 +182,7 @@ public class DataLog extends BasePo implements Serializable { ...@@ -181,7 +182,7 @@ public class DataLog extends BasePo implements Serializable {
/** /**
* 亮灯料架颜色 * 亮灯料架颜色
*/ */
private String lightColor = "FF0000"; private String lightColor = "";
/** /**
* 出入库执行时间,秒 * 出入库执行时间,秒
*/ */
...@@ -273,7 +274,7 @@ public class DataLog extends BasePo implements Serializable { ...@@ -273,7 +274,7 @@ public class DataLog extends BasePo implements Serializable {
*/ */
public boolean needRemoveFromCache(){ public boolean needRemoveFromCache(){
if(isFinished() || isCancel()){ if(isFinished() || isCancel()){
if(System.currentTimeMillis() - super.getUpdateDate().getTime() > 3 * 60 * 1000){ if(System.currentTimeMillis() - super.getUpdateDate().getTime() > 5 * 60 * 1000){
return true; return true;
} }
} }
......
package com.neotel.smfcore.core.system.util; package com.neotel.smfcore.core.system.util;
import cn.hutool.core.util.ObjectUtil;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.neotel.smfcore.core.device.bean.StatusBean; import com.neotel.smfcore.core.device.bean.StatusBean;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
...@@ -27,15 +29,15 @@ public class DevicesStatusUtil { ...@@ -27,15 +29,15 @@ public class DevicesStatusUtil {
/** /**
* 获取设备状态Bean * 获取设备状态Bean
*/ */
public static StatusBean getStatusBean(String cid){ public static StatusBean getStatusBean(String cid) {
return statusMap.get(cid); return statusMap.get(cid);
} }
/** /**
* 更新设备状态信息 * 更新设备状态信息
*/ */
public static void updateStatusBean(StatusBean statusBean){ public static void updateStatusBean(StatusBean statusBean) {
statusMap.put(statusBean.getCid(),statusBean); statusMap.put(statusBean.getCid(), statusBean);
} }
/** /**
...@@ -53,4 +55,15 @@ public class DevicesStatusUtil { ...@@ -53,4 +55,15 @@ public class DevicesStatusUtil {
return statusBean; return statusBean;
} }
private static Map<String, List<List<String>>> deviceDataMap = Maps.newConcurrentMap();
public static void updateDeviceData(String cid, List<List<String>> data) {
deviceDataMap.put(cid, data);
}
public static List<List<String>> getDeviceData(String cid) {
return deviceDataMap.get(cid);
}
} }
package com.neotel.smfcore.core.system.util; package com.neotel.smfcore.core.system.util;
import cn.hutool.core.util.ObjectUtil;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
...@@ -64,24 +65,24 @@ public class TaskService { ...@@ -64,24 +65,24 @@ public class TaskService {
/** /**
* 完成的任务列表Key 为dataLog的ID, Value 为 Datalog * 完成的任务列表Key 为dataLog的ID, Value 为 Datalog
*/ */
private static Map<String,DataLog> theFinishedTaskMap = Maps.newConcurrentMap(); private static Map<String, DataLog> theFinishedTaskMap = Maps.newConcurrentMap();
// public TaskService(List<ITaskListener> listenerList){ // public TaskService(List<ITaskListener> listenerList){
// for (ITaskListener taskListener: listenerList) { // for (ITaskListener taskListener: listenerList) {
// taskListenerList.add(taskListener); // taskListenerList.add(taskListener);
// } // }
// } // }
private void check(String barcode, String posName) throws ValidateException { private void check(String barcode, String posName) throws ValidateException {
} }
/** /**
* 条码入库,加入要执行的任务 * 条码入库,加入要执行的任务
*/ */
public synchronized DataLog addPutInTaskToExecute(Storage storage, Barcode barcode, StoragePos storagePos) throws ValidateException { public synchronized DataLog addPutInTaskToExecute(Storage storage, Barcode barcode, StoragePos storagePos) throws ValidateException {
DataLog task = new DataLog(storage, barcode, storagePos); DataLog task = new DataLog(storage, barcode, storagePos);
task.setType(OP.PUT_IN); task.setType(OP.PUT_IN);
task.setStatus(OP_STATUS.EXECUTING.name()); task.setStatus(OP_STATUS.EXECUTING.name());
...@@ -95,33 +96,35 @@ public class TaskService { ...@@ -95,33 +96,35 @@ public class TaskService {
/** /**
* 库位出库 * 库位出库
* @param storage 料仓 *
* @param pos 库位 * @param storage 料仓
* @param pos 库位
* @param isSingleOut 是否是单盘出库 * @param isSingleOut 是否是单盘出库
* @return * @return
* @throws ValidateException * @throws ValidateException
*/ */
public synchronized String checkout(Storage storage, StoragePos pos, boolean isSingleOut) throws ValidateException { public synchronized String checkout(Storage storage, StoragePos pos, boolean isSingleOut, String opUserName) throws ValidateException {
if (pos.getBarcode() == null) { if (pos.getBarcode() == null) {
String msg = "库位[" + pos.getPosName() + "]中已无物料,忽略"; String msg = "库位[" + pos.getPosName() + "]中已无物料,忽略";
log.info(msg); log.info(msg);
throw new ValidateException("smfcore.allBoxView.noReel","库位中无物料"); throw new ValidateException("smfcore.allBoxView.noReel", "库位{0}中无物料",new String[]{pos.getPosName()});
} }
DataLog task = new DataLog(storage, pos.getBarcode(), pos); DataLog task = new DataLog(storage, pos.getBarcode(), pos);
task.setType(OP.CHECKOUT); task.setType(OP.CHECKOUT);
task.setStatus(OP_STATUS.WAIT.name()); task.setStatus(OP_STATUS.WAIT.name());
task.setSingleOut(isSingleOut); task.setSingleOut(isSingleOut);
task.setOperator(opUserName);
addTaskToExecute(task); addTaskToExecute(task);
return ""; return "";
} }
/** /**
* 触发任务状态改变事件 * 触发任务状态改变事件
*
* @param task * @param task
*/ */
private void tiggerTaskChangeListener(DataLog task){ private void tiggerTaskChangeListener(DataLog task) {
for (ITaskListener taskListener : taskListenerList) { for (ITaskListener taskListener : taskListenerList) {
taskListener.onTaskStatusChange(task); taskListener.onTaskStatusChange(task);
} }
...@@ -129,6 +132,7 @@ public class TaskService { ...@@ -129,6 +132,7 @@ public class TaskService {
/** /**
* 更新队列中的任务状态 * 更新队列中的任务状态
*
* @param task * @param task
*/ */
public DataLog updateQueueTask(DataLog task) { public DataLog updateQueueTask(DataLog task) {
...@@ -140,9 +144,10 @@ public class TaskService { ...@@ -140,9 +144,10 @@ public class TaskService {
/** /**
* 更新完成列表中的任务状态 * 更新完成列表中的任务状态
*
* @param task * @param task
*/ */
public void updateFinishedTask(DataLog task){ public void updateFinishedTask(DataLog task) {
dataLogDao.save(task); dataLogDao.save(task);
theFinishedTaskMap.put(task.getId(), task); theFinishedTaskMap.put(task.getId(), task);
tiggerTaskChangeListener(task); tiggerTaskChangeListener(task);
...@@ -155,10 +160,10 @@ public class TaskService { ...@@ -155,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("smfcode.error.barcode.inQueue", "二维码[{0}]已在操作队列中,操作失败", new String[]{barcode});
} else if (task.getPosName().equals(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("smfcode.error.pos.inQueue", "位置:[{0}}]已在操作队列中,操作失败", new String[]{posName});
} }
} }
updateQueueTask(taskToExecute); updateQueueTask(taskToExecute);
...@@ -174,10 +179,10 @@ public class TaskService { ...@@ -174,10 +179,10 @@ public class TaskService {
/** /**
* 获取所有任务 * 获取所有任务
*/ */
public List<DataLog> getAllTasks(){ public List<DataLog> getAllTasks() {
List<DataLog> allTasks = getFinishedTasks(); List<DataLog> allTasks = getFinishedTasks();
Collection<DataLog> queueTasks = getQueueTasks(); Collection<DataLog> queueTasks = getQueueTasks();
if(!queueTasks.isEmpty()){ if (!queueTasks.isEmpty()) {
allTasks.addAll(queueTasks); allTasks.addAll(queueTasks);
} }
return allTasks; return allTasks;
...@@ -202,6 +207,7 @@ public class TaskService { ...@@ -202,6 +207,7 @@ public class TaskService {
//从正在执行和等待列表中移除 //从正在执行和等待列表中移除
removeQueueTask(task); removeQueueTask(task);
task.setStatus(OP_STATUS.CANCEL.name()); task.setStatus(OP_STATUS.CANCEL.name());
task.setUpdateDate(new Date());
updateFinishedTask(task); updateFinishedTask(task);
log.info("任务[" + task.getId() + "] posName[" + task.getPosName() + "] Reel Id[" + task.getBarcode() + "]取消成功"); log.info("任务[" + task.getId() + "] posName[" + task.getPosName() + "] Reel Id[" + task.getBarcode() + "]取消成功");
return true; return true;
...@@ -218,14 +224,14 @@ public class TaskService { ...@@ -218,14 +224,14 @@ public class TaskService {
/** /**
* 清除某个已经完成或取消的任务 * 清除某个已经完成或取消的任务
*/ */
public void removeFinishedTask(DataLog task){ public void removeFinishedTask(DataLog task) {
theFinishedTaskMap.remove(task.getId()); theFinishedTaskMap.remove(task.getId());
} }
/** /**
* 清除队列中等待执行或正在执行的任务 * 清除队列中等待执行或正在执行的任务
*/ */
public void removeQueueTask(DataLog task){ public void removeQueueTask(DataLog task) {
taskMap.remove(task.getId()); taskMap.remove(task.getId());
} }
...@@ -247,6 +253,7 @@ public class TaskService { ...@@ -247,6 +253,7 @@ public class TaskService {
/** /**
* 根据料仓编号和库位获取已完成/取消的任务 * 根据料仓编号和库位获取已完成/取消的任务
*
* @param cid * @param cid
* @param posName * @param posName
* @return * @return
...@@ -272,6 +279,7 @@ public class TaskService { ...@@ -272,6 +279,7 @@ public class TaskService {
} }
return null; return null;
} }
/** /**
* 是否有正在执行的任务 * 是否有正在执行的任务
* *
...@@ -290,7 +298,7 @@ public class TaskService { ...@@ -290,7 +298,7 @@ public class TaskService {
* 为 box 分配出库任务 * 为 box 分配出库任务
*/ */
private DataLog findCheckoutBoxTask(Storage storage) { private DataLog findCheckoutBoxTask(Storage storage) {
String cid=storage.getCid(); String cid = storage.getCid();
int checkoutSize = 0; int checkoutSize = 0;
Collection<DataLog> allTasks = taskMap.values(); Collection<DataLog> allTasks = taskMap.values();
for (DataLog task : allTasks) { for (DataLog task : allTasks) {
...@@ -348,10 +356,11 @@ public class TaskService { ...@@ -348,10 +356,11 @@ public class TaskService {
return outTask; return outTask;
} }
/** /**
* 出库处理 * 出库处理
*/ */
public StatusBean checkOut(Storage storage,StatusBean statusBean ) { public StatusBean checkOut(Storage storage, StatusBean statusBean) {
try { try {
String cid = storage.getCid(); String cid = storage.getCid();
...@@ -401,6 +410,7 @@ public class TaskService { ...@@ -401,6 +410,7 @@ public class TaskService {
/** /**
* 已分配的库位号 * 已分配的库位号
*
* @return * @return
*/ */
public Collection<String> excludePosIds() { public Collection<String> excludePosIds() {
...@@ -501,6 +511,7 @@ public class TaskService { ...@@ -501,6 +511,7 @@ public class TaskService {
addTaskToExecute(task); addTaskToExecute(task);
return ""; return "";
} }
public DataLog newTask(StoragePos pos) { public DataLog newTask(StoragePos pos) {
DataLog task = new DataLog(); DataLog task = new DataLog();
...@@ -521,17 +532,19 @@ public class TaskService { ...@@ -521,17 +532,19 @@ public class TaskService {
task.setPosId(pos.getId()); task.setPosId(pos.getId());
task.setPosName(pos.getPosName()); task.setPosName(pos.getPosName());
task.setStatus(OP_STATUS.WAIT.name());
return task; return task;
} }
/** /**
* 查找可以入库的空位 * 查找可以入库的空位
*
* @param storageList * @param storageList
* @param barcode * @param barcode
* @return * @return
*/ */
public StoragePos findEmptyPosForPutIn(List<Storage> storageList, Barcode barcode, String inRFID,String lastPosId) throws ValidateException { public StoragePos findEmptyPosForPutIn(List<Storage> storageList, Barcode barcode, String inRFID, String lastPosId) throws ValidateException {
verifyBarcodePutIn(storageList, barcode, inRFID); verifyBarcodePutIn(storageList, barcode, inRFID);
//查找任务数最少的料仓 //查找任务数最少的料仓
...@@ -566,27 +579,27 @@ public class TaskService { ...@@ -566,27 +579,27 @@ public class TaskService {
String lockPosId = ReelLockPosUtil.getReelLockPosId(barcode.getBarcode()); String lockPosId = ReelLockPosUtil.getReelLockPosId(barcode.getBarcode());
StoragePos pos = null; StoragePos pos = null;
if(!Strings.isNullOrEmpty(lockPosId)){ if (!Strings.isNullOrEmpty(lockPosId)) {
//已有锁定库位 //已有锁定库位
pos = storagePosManager.get(lockPosId); pos = storagePosManager.get(lockPosId);
if(pos != null ){ if (pos != null) {
if(pos.getW() < barcode.getPlateSize() || pos.getH() < barcode.getHeight()){ if (pos.getW() < barcode.getPlateSize() || pos.getH() < barcode.getHeight()) {
log.info("条码["+barcode.getBarcode()+"]尺寸已改变,无法放入已锁定库位["+pos.getPosName()+"],重新查找库位"); log.info("条码[" + barcode.getBarcode() + "]尺寸已改变,无法放入已锁定库位[" + pos.getPosName() + "],重新查找库位");
pos = null; pos = null;
}else{ } else {
Barcode posBarcode = pos.getBarcode(); Barcode posBarcode = pos.getBarcode();
if(posBarcode == null){ if (posBarcode == null) {
log.info("条码["+barcode.getBarcode()+"]已锁定库位["+pos.getPosName()+"],返回锁定中的库位"); log.info("条码[" + barcode.getBarcode() + "]已锁定库位[" + pos.getPosName() + "],返回锁定中的库位");
}else{ } else {
log.info("条码["+barcode.getBarcode()+"]已锁定库位["+pos.getPosName()+"]中已有物料["+posBarcode.getBarcode()+"],重新查找库位"); log.info("条码[" + barcode.getBarcode() + "]已锁定库位[" + pos.getPosName() + "]中已有物料[" + posBarcode.getBarcode() + "],重新查找库位");
pos = null; pos = null;
} }
} }
} }
} }
if(pos != null){ if (pos != null) {
return pos; return pos;
} }
...@@ -615,81 +628,83 @@ public class TaskService { ...@@ -615,81 +628,83 @@ public class TaskService {
return findEmptyPosInStorages(barcode, availbleStorageList, storageTaskCountMap, lastPosId); return findEmptyPosInStorages(barcode, availbleStorageList, storageTaskCountMap, lastPosId);
} }
private synchronized StoragePos findEmptyPosInStorages(Barcode barcode, List<Storage> availbleStorageList, final Map<String,Integer> executingTaskCountMap,String lastPosId){
private synchronized StoragePos findEmptyPosInStorages(Barcode barcode, List<Storage> availbleStorageList, final Map<String, Integer> executingTaskCountMap, String lastPosId) {
for (Storage storage : availbleStorageList) { for (Storage storage : availbleStorageList) {
try{ try {
Collection<String> operatingPosIds = excludePosIds(); Collection<String> operatingPosIds = excludePosIds();
log.debug("尝试从["+storage.getCid()+"]中为["+barcode.getBarcode()+"]查找空位"); log.debug("尝试从[" + storage.getCid() + "]中为[" + barcode.getBarcode() + "]查找空位");
StoragePos pos = storagePosManager.getEmptyPosByStorage(storage, barcode , operatingPosIds,lastPosId); StoragePos pos = storagePosManager.getEmptyPosByStorage(storage, barcode, operatingPosIds, lastPosId);
if(pos != null){ if (pos != null) {
return pos; return pos;
} }
}catch(Exception e){ } catch (Exception e) {
log.error("尝试从["+storage.getCid()+"]中为["+barcode.getBarcode()+"]查找空位失败:" + e.getMessage()); log.error("尝试从[" + storage.getCid() + "]中为[" + barcode.getBarcode() + "]查找空位失败:" + e.getMessage());
} }
} }
try{ try {
String cids = ""; String cids = "";
for (Storage storage : availbleStorageList) { for (Storage storage : availbleStorageList) {
cids =cids + storage.getCid() + ","; cids = cids + storage.getCid() + ",";
} }
log.info(barcode.getBarcode()+ " 未找到可用库位,可用料仓:"+cids); log.info(barcode.getBarcode() + " 未找到可用库位,可用料仓:" + cids);
}catch (Exception e){ } catch (Exception e) {
log.error("打印可用料仓出错",e); log.error("打印可用料仓出错", e);
} }
return null; return null;
} }
/** /**
* 检查二维码是否合法并且可以入库,没问题的话存入到数据库 * 检查二维码是否合法并且可以入库,没问题的话存入到数据库
*/ */
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("smfcode.error.barcode.invalid", "条码无效");
} }
StoragePos pos; StoragePos pos;
//夹具,查询 relationCode //夹具,查询 relationCode
if(COMPONENT_TYPE.FIXTURE == barcodeSave.getType()){ if (COMPONENT_TYPE.FIXTURE == barcodeSave.getType()) {
pos = storagePosManager.getByFixtureCode(barcodeSave.getBarcode()); pos = storagePosManager.getByFixtureCode(barcodeSave.getBarcode());
}else { } else {
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("smfcode.error.barcode.wrongQty", "条码[{0}]对应的数量<=0为: {1}", new String[]{barcodeSave.getBarcode(), barcodeSave.getAmount() + ""});
} }
} }
if (pos != null) { if (pos != null) {
//如果已在库位中,那么自动将该库位的物料出库 //如果已在库位中,那么自动将该库位的物料出库
log.info("出库已在库位中的物料["+barcodeSave.getBarcode()+"]"); log.info("出库已在库位中的物料[" + barcodeSave.getBarcode() + "]");
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("smfcode.error.barcode.exist", "[{0}}]已在{1}}[{2}}]中", new String[]{barcodeSave.getBarcode(), storage.getName(), pos.getPosName()});
} }
Collection<DataLog> queueTasks = getQueueTasks(); Collection<DataLog> queueTasks = getQueueTasks();
List<DataLog> allTasks = getFinishedTasks(); List<DataLog> allTasks = getFinishedTasks();
if(!queueTasks.isEmpty()){ if (!queueTasks.isEmpty()) {
allTasks.addAll(queueTasks); allTasks.addAll(queueTasks);
} }
for (DataLog task : allTasks) { for (DataLog task : allTasks) {
if(task.isPutInTask()){ if (task.isPutInTask()) {
if(task.getBarcode().equals(barcodeSave.getBarcode())){ if (task.getBarcode().equals(barcodeSave.getBarcode())) {
//同一个条码的入库任务 //同一个条码的入库任务
for (Storage storage : storageList) { for (Storage storage : storageList) {
if(task.getStorageId().equals(storage.getId()) && task.isPutInTask()){ if (task.getStorageId().equals(storage.getId()) && task.isPutInTask()) {
return barcodeSave; return barcodeSave;
} }
} }
throw new ValidateException("smfcode.error.barcode.taskNotEnd", "料盘[{0}}]的操作未完成,无法执行入库操作",new String[]{ barcodeSave.getBarcode()}); throw new ValidateException("smfcode.error.barcode.taskNotEnd", "料盘[{0}}]的操作未完成,无法执行入库操作", new String[]{barcodeSave.getBarcode()});
} }
} }
} }
...@@ -700,28 +715,28 @@ public class TaskService { ...@@ -700,28 +715,28 @@ public class TaskService {
} }
public void addTaskToFinished(StoragePos pos, Barcode barcode, String opUser){ public void addTaskToFinished(StoragePos pos, Barcode barcode, String opUser) {
try{ try {
Collection<DataLog> allTasks = taskMap.values(); Collection<DataLog> allTasks = taskMap.values();
if(pos.getBarcode() != null){ if (pos.getBarcode() != null) {
barcode = pos.getBarcode(); barcode = pos.getBarcode();
for(DataLog task : allTasks){ for (DataLog task : allTasks) {
if(task.isCheckOutTask()){ if (task.isCheckOutTask()) {
String executeBarcode = task.getBarcode(); String executeBarcode = task.getBarcode();
String executePosId = task.getPosId(); String executePosId = task.getPosId();
boolean isSameTask = false; boolean isSameTask = false;
if(executeBarcode != null && barcode.getBarcode().equals(executeBarcode)){ if (executeBarcode != null && barcode.getBarcode().equals(executeBarcode)) {
isSameTask = true; isSameTask = true;
} }
if(executePosId != null && pos.getId().equals(executePosId)){ if (executePosId != null && pos.getId().equals(executePosId)) {
isSameTask = true; isSameTask = true;
} }
if(isSameTask){ if (isSameTask) {
log.info(executeBarcode + "找到正在执行的出库任务["+pos.getPosName()+"],直接完成"); log.info(executeBarcode + "找到正在执行的出库任务[" + pos.getPosName() + "],直接完成");
if(task.isWait()){ if (task.isWait()) {
taskMap.put(task.getId(),task); taskMap.put(task.getId(), task);
} }
task.setOperator(opUser); task.setOperator(opUser);
checkoutFinished(task); checkoutFinished(task);
...@@ -732,18 +747,16 @@ public class TaskService { ...@@ -732,18 +747,16 @@ public class TaskService {
} }
//没有正在执行的任务,直接添加一条已完成的任务 //没有正在执行的任务,直接添加一条已完成的任务
DataLog task = newTask(pos); DataLog task = newTask(pos);
if(pos.getBarcode() == null){ if (pos.getBarcode() == null) {
log.info(opUser + "入库【"+barcode.getBarcode()+"】到【"+pos.getPosName()+"】"); log.info(opUser + "入库【" + barcode.getBarcode() + "】到【" + pos.getPosName() + "】");
task.setType(OP.PUT_IN); task.setType(OP.PUT_IN);
barcode.setUsedCount(barcode.getUsedCount() + 1); barcode.setUsedCount(barcode.getUsedCount() + 1);
barcode.setUsedDate(new Date()); barcode.setUsedDate(new Date());
barcode.setPutInTime(System.currentTimeMillis()); barcode.setPutInTime(System.currentTimeMillis());
barcode.setInOpor(opUser); barcode.setInOpor(opUser);
barcode.setCheckOutDate(null,""); barcode.setCheckOutDate(null, "");
barcode.setPosName(task.getPosName()); barcode.setPosName(task.getPosName());
barcodeManager.save(barcode); barcodeManager.save(barcode);
...@@ -758,17 +771,17 @@ public class TaskService { ...@@ -758,17 +771,17 @@ public class TaskService {
task.setBarcode(barcode.getBarcode()); task.setBarcode(barcode.getBarcode());
task.setNum(barcode.getInitialAmount()); task.setNum(barcode.getInitialAmount());
dataCache.updateInventory(pos,barcode); dataCache.updateInventory(pos, barcode);
//dataCache.updateStorage(task.getCid()); //dataCache.updateStorage(task.getCid());
}else{ } else {
barcode = pos.getBarcode(); barcode = pos.getBarcode();
log.info(opUser + "将【"+barcode.getBarcode()+"】从【"+pos.getPosName()+"】出库"); log.info(opUser + "将【" + barcode.getBarcode() + "】从【" + pos.getPosName() + "】出库");
task.setType(OP.CHECKOUT); task.setType(OP.CHECKOUT);
barcode.setUsed(true); barcode.setUsed(true);
barcode.setUsedDate(new Date()); barcode.setUsedDate(new Date());
//仓位状态 //仓位状态
barcode.setCheckOutDate(new Date(),task.getOperator()); barcode.setCheckOutDate(new Date(), task.getOperator());
barcode.setPosName(""); barcode.setPosName("");
barcodeManager.save(barcode); barcodeManager.save(barcode);
...@@ -784,11 +797,12 @@ public class TaskService { ...@@ -784,11 +797,12 @@ public class TaskService {
task.setStatus(OP_STATUS.FINISHED.name()); task.setStatus(OP_STATUS.FINISHED.name());
task = dataLogDao.save(task); task = dataLogDao.save(task);
theFinishedTaskMap.put(task.getBarcode(),task); theFinishedTaskMap.put(task.getBarcode(), task);
}catch (Exception e){ } catch (Exception e) {
log.error("addTaskToFinished Error:",e); log.error("addTaskToFinished Error:", e);
} }
} }
/** /**
* 出库完成 * 出库完成
*/ */
...@@ -798,30 +812,30 @@ public class TaskService { ...@@ -798,30 +812,30 @@ public class TaskService {
StoragePos storagePos = storagePosManager.get(task.getPosId()); StoragePos storagePos = storagePosManager.get(task.getPosId());
Barcode barcode = storagePos.getBarcode(); Barcode barcode = storagePos.getBarcode();
if(barcode == null){ if (barcode == null) {
//记录日志 //记录日志
task.setStatus(OP_STATUS.CANCEL.name()); task.setStatus(OP_STATUS.CANCEL.name());
taskMap.remove(task.getId()); taskMap.remove(task.getId());
theFinishedTaskMap.put(task.getBarcode(),task); theFinishedTaskMap.put(task.getBarcode(), task);
log.warn("任务:"+task.getBarcode() +" 仓位:"+task.getPosName()+" 的 Barcode 为null, 之前可能处理过直接返回"); log.warn("任务:" + task.getBarcode() + " 仓位:" + task.getPosName() + " 的 Barcode 为null, 之前可能处理过直接返回");
return; return;
} }
//记录在库时长 //记录在库时长
task.setInStoreTime(barcode.getInStoreMiniute()); task.setInStoreTime(barcode.getInStoreMiniute());
barcode = barcodeManager.get(barcode.getId()); barcode = barcodeManager.get(barcode.getId());
if(barcode != null){ if (barcode != null) {
//二维码状态 //二维码状态
barcode.setUsed(true); barcode.setUsed(true);
barcode.setUsedDate(new Date()); barcode.setUsedDate(new Date());
//仓位状态 //仓位状态
barcode.setCheckOutDate(new Date(),task.getOperator()); barcode.setCheckOutDate(new Date(), task.getOperator());
barcode.setPosName(""); barcode.setPosName("");
barcodeManager.save(barcode); barcodeManager.save(barcode);
String specifiedBatchId = barcode.getLockId(); String specifiedBatchId = barcode.getLockId();
if(!Strings.isNullOrEmpty(specifiedBatchId)){ if (!Strings.isNullOrEmpty(specifiedBatchId)) {
task.setBatchId(specifiedBatchId); task.setBatchId(specifiedBatchId);
task.setBatchInfo(barcode.getLockName()); task.setBatchInfo(barcode.getLockName());
} }
...@@ -834,25 +848,25 @@ public class TaskService { ...@@ -834,25 +848,25 @@ public class TaskService {
log.info(task.getBarcode() + "出库完成,清空仓位: " + storagePos.getId() + "[" + storagePos.getPosName() + "]"); log.info(task.getBarcode() + "出库完成,清空仓位: " + storagePos.getId() + "[" + storagePos.getPosName() + "]");
//更新缓存中的库存信息 //更新缓存中的库存信息
dataCache.updateInventory(storagePos,barcode); dataCache.updateInventory(storagePos, barcode);
//记录日志 //记录日志
task.setStatus(OP_STATUS.FINISHED.name()); task.setStatus(OP_STATUS.FINISHED.name());
if(isCancelTask){ if (isCancelTask) {
task.setStatus(OP_STATUS.CANCEL.name()); task.setStatus(OP_STATUS.CANCEL.name());
} }
dataLogDao.save(task); dataLogDao.save(task);
//从队列里面移除操作 //从队列里面移除操作
DataLog removeTask = taskMap.remove(task.getId()); DataLog removeTask = taskMap.remove(task.getId());
try{ try {
if(removeTask == null){ if (removeTask == null) {
log.error(task.getBarcode()+"的出库任务["+task.getId()+"]清除失败"); log.error(task.getBarcode() + "的出库任务[" + task.getId() + "]清除失败");
} }
}catch (Exception e){ } catch (Exception e) {
log.error(e.getMessage()); log.error(e.getMessage());
} }
theFinishedTaskMap.put(task.getBarcode(),task); theFinishedTaskMap.put(task.getBarcode(), task);
// //任务已经被取消就不再更新需求单信息 // //任务已经被取消就不再更新需求单信息
...@@ -865,22 +879,13 @@ public class TaskService { ...@@ -865,22 +879,13 @@ public class TaskService {
} }
/** /**
* 策略出库 * 策略出库
*/ */
public synchronized void tacticsCheckOut(Set<TacticsOutDto> tacticsOutDtos) { public synchronized void tacticsCheckOut(Set<TacticsOutDto> tacticsOutDtos) {
CHECKOUT_TYPE checkoutType = dataCache.getCheckOutType(); CHECKOUT_TYPE checkoutType = dataCache.getCheckOutType();
List<String> availableStorageIds = new ArrayList<>(); List<String> availableStorageIds = dataCache.getAvailableStorageIds();
for (Storage storage : dataCache.getAllStorage().values()) {
//默认所有料仓可用
// StatusBean statusBean =dataCache. getStatus(storage.getCid());
// if (statusBean.isAvailable())
{
availableStorageIds.add(storage.getId());
}
}
Collection<String> excludePosIds = excludePosIds(); Collection<String> excludePosIds = excludePosIds();
...@@ -904,14 +909,19 @@ public class TaskService { ...@@ -904,14 +909,19 @@ public class TaskService {
} else { } else {
log.info("策略出库,PN[" + item.getPartNumber() + "]第[" + i + "]盘, 出库位置仓位【" + pos.getPosName() + "】RI=[" + pos.getBarcode().getBarcode() + "] PN=[" + partNumber + "] num:" + pos.getBarcode().getAmount()); log.info("策略出库,PN[" + item.getPartNumber() + "]第[" + i + "]盘, 出库位置仓位【" + pos.getPosName() + "】RI=[" + pos.getBarcode().getBarcode() + "] PN=[" + partNumber + "] num:" + pos.getBarcode().getAmount());
DataLog task = newTask(pos); DataLog task = newTask(pos);
task.setType(OP.CHECKOUT);
task.setOperator(SecurityUtils.getCurrentUsername());
task.setSingleOut(true);
task.setSourceId(null); task.setSourceId(null);
task.setSourceName("策略出库"); task.setSourceName("策略出库");
task.setType(OP.CHECKOUT);
addTaskToExecute(task); addTaskToExecute(task);
} }
} }
} }
} }
public void moveTaskToFinished(DataLog task) {
taskMap.remove(task.getId());
theFinishedTaskMap.put(task.getId(), task);
}
} }
package com.neotel.smfcore.hella.handler; package com.neotel.smfcore.hella.handler;
import cn.hutool.core.util.ObjectUtil;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.neotel.smfcore.common.bean.ResultBean; import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.exception.ValidateException; import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.core.barcode.bean.CodeBean;
import com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager; import com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager;
import com.neotel.smfcore.core.barcode.service.manager.IComponentManager; import com.neotel.smfcore.core.barcode.service.manager.IComponentManager;
import com.neotel.smfcore.core.barcode.service.po.Barcode; import com.neotel.smfcore.core.barcode.service.po.Barcode;
import com.neotel.smfcore.core.barcode.service.po.Component; import com.neotel.smfcore.core.barcode.service.po.Component;
import com.neotel.smfcore.core.barcode.utils.CodeResolve;
import com.neotel.smfcore.core.device.enums.OP; import com.neotel.smfcore.core.device.enums.OP;
import com.neotel.smfcore.core.device.enums.OP_STATUS; import com.neotel.smfcore.core.device.enums.OP_STATUS;
import com.neotel.smfcore.core.device.util.DataCache; import com.neotel.smfcore.core.device.util.DataCache;
...@@ -76,6 +79,9 @@ public class HellaServiceHandler extends IoHandlerAdapter implements ITaskListen ...@@ -76,6 +79,9 @@ public class HellaServiceHandler extends IoHandlerAdapter implements ITaskListen
@Autowired @Autowired
private IGroupManager groupManager; private IGroupManager groupManager;
@Autowired
private CodeResolve codeResolve;
protected final static Logger log = LogManager.getLogger(); protected final static Logger log = LogManager.getLogger();
private AtomicLong eventId = new AtomicLong(0); private AtomicLong eventId = new AtomicLong(0);
...@@ -91,21 +97,38 @@ public class HellaServiceHandler extends IoHandlerAdapter implements ITaskListen ...@@ -91,21 +97,38 @@ public class HellaServiceHandler extends IoHandlerAdapter implements ITaskListen
HellaReqCommand command = HellaReqCommand.newCheckMaterialCmd(eventId.incrementAndGet(),scannedCode); HellaReqCommand command = HellaReqCommand.newCheckMaterialCmd(eventId.incrementAndGet(),scannedCode);
command.setGroupId(groupId); command.setGroupId(groupId);
boolean storageCheckMaterial=false;
if(ObjectUtil.isNotEmpty(storageId)){
Storage storage=dataCache.getStorageById(storageId);
if(storage!=null){
storageCheckMaterial=true;
command.setGroupId(storage.getGroupId());
command.setStorageId(storageId);
}
}
command.setLoginUser(loginUser); command.setLoginUser(loginUser);
for (HellaReqCommand hellaReqCommand : commandMap.values()) { for (HellaReqCommand hellaReqCommand : commandMap.values()) {
if(hellaReqCommand.getGroupId().equals(groupId) && hellaReqCommand.isCheckMaterialReq()){ if(storageCheckMaterial) {
//有未完成的入库请求 if(ObjectUtil.isNotEmpty(hellaReqCommand.getStorageId())&&hellaReqCommand.getStorageId().equals(storageId)&&hellaReqCommand.isCheckMaterialReq()){
commandMap.remove(hellaReqCommand.getEventId()); //有未完成的入库请求
log.info("清理未完成的入库检查请求["+hellaReqCommand.getEventId()+"]:" + hellaReqCommand.getData()); commandMap.remove(hellaReqCommand.getEventId());
//return ResultBean.newErrorResult(-1,"["+hellaReqCommand.getData()+"]入库任务未完成,无法入库"); log.info("清理未完成的入库检查请求[" + hellaReqCommand.getEventId() + "]:" + hellaReqCommand.getData());
}
}else {
if (hellaReqCommand.getGroupId().equals(groupId) && hellaReqCommand.isCheckMaterialReq()) {
//有未完成的入库请求
commandMap.remove(hellaReqCommand.getEventId());
log.info("清理未完成的入库检查请求[" + hellaReqCommand.getEventId() + "]:" + hellaReqCommand.getData());
//return ResultBean.newErrorResult(-1,"["+hellaReqCommand.getData()+"]入库任务未完成,无法入库");
}
} }
} }
commandMap.put(command.getEventId(),command); commandMap.put(command.getEventId(),command);
log.info("发送检查物料条码请求:" + command.toReqMsg()); log.info("发送检查物料条码请求:" + command.toReqMsg());
ResultBean resultBean = HellaTcpClient.sendMsg(command.toReqMsg()); ResultBean resultBean = HellaTcpClient.sendMsg(command.toReqMsg());
//testCheckOK(command); // ResultBean resultBean = testCheckOK(command);
resultBean.setMsg("Check Material result:"+resultBean.getMsg()); resultBean.setMsg("Check Material result:"+resultBean.getMsg());
return resultBean; return resultBean;
} }
...@@ -136,7 +159,8 @@ public class HellaServiceHandler extends IoHandlerAdapter implements ITaskListen ...@@ -136,7 +159,8 @@ public class HellaServiceHandler extends IoHandlerAdapter implements ITaskListen
String msg = message.toString(); String msg = message.toString();
msg= msg.replace("\u0002",""); msg= msg.replace("\u0002","");
log.info("Received Tcp Server msg:" + msg); log.info("Received Tcp Server msg:" + msg);
String[] resposArr = msg.split(";"); //getInventory;21296;
String[] resposArr = msg.split(";",-1);
String cmd = resposArr[0]; String cmd = resposArr[0];
String eventId = resposArr[1]; String eventId = resposArr[1];
...@@ -186,7 +210,7 @@ public class HellaServiceHandler extends IoHandlerAdapter implements ITaskListen ...@@ -186,7 +210,7 @@ public class HellaServiceHandler extends IoHandlerAdapter implements ITaskListen
}else{ }else{
Storage storage = dataCache.getStorageById(storagePos.getStorageId()); Storage storage = dataCache.getStorageById(storagePos.getStorageId());
try{ try{
taskService.checkout(storage,storagePos,false); taskService.checkout(storage,storagePos,false,"");
}catch(ValidateException ve){ }catch(ValidateException ve){
resultCode = "-3"; resultCode = "-3";
resultMsg = ve.getMessage(); resultMsg = ve.getMessage();
...@@ -203,23 +227,29 @@ public class HellaServiceHandler extends IoHandlerAdapter implements ITaskListen ...@@ -203,23 +227,29 @@ public class HellaServiceHandler extends IoHandlerAdapter implements ITaskListen
//<STX>getInventory;eventId;shelfNumber<CR><LF> //<STX>getInventory;eventId;shelfNumber<CR><LF>
String shelfNumber = resposArr[2]; String shelfNumber = resposArr[2];
Storage shelf = null; Storage shelf = null;
Collection<Storage> allStorages = dataCache.getAllStorage().values(); if(ObjectUtil.isNotEmpty(shelfNumber)) {
for (Storage storage : allStorages) { Collection<Storage> allStorages = dataCache.getAllStorage().values();
if(storage.getName().equals(shelfNumber)){ for (Storage storage : allStorages) {
shelf = storage; if (storage.getName().equals(shelfNumber)) {
shelf = storage;
}
} }
} }
String resultCode = "0"; String resultCode = "0";
String resultMsg = "OK"; String resultMsg = "OK";
String dataStr = ""; String dataStr = "";
if(shelf == null){ if(ObjectUtil.isNotEmpty(shelfNumber)&&shelf == null){
//<STX>getInventoryResp;eventId;returnCode;messageText;numberofResults;partNumber1;containerNumber;remainQuantity;MSL;lightClass;SelfPosition;reserved;…;partNumberN;containerNumberN;remainQuantityN;MSLN;lightClassN;SelfPositionN;reservedN;<CR><LF> //<STX>getInventoryResp;eventId;returnCode;messageText;numberofResults;partNumber1;containerNumber;remainQuantity;MSL;lightClass;SelfPosition;reserved;…;partNumberN;containerNumberN;remainQuantityN;MSLN;lightClassN;SelfPositionN;reservedN;<CR><LF>
resultCode = "-1"; resultCode = "-1";
resultMsg = "Shelf is not found"; resultMsg = "Shelf is not found";
dataStr = "0"; dataStr = "0";
}else{ }else{
List<StoragePos> posList = storagePosManager.findNotEmptyByStorageId(shelf.getId()); String shelfId="";
if(!(shelf==null)){
shelfId=shelf.getId();
}
List<StoragePos> posList = storagePosManager.findNotEmptyByStorageId(shelfId);
int numberOfResult = posList.size(); int numberOfResult = posList.size();
dataStr = "" + numberOfResult; dataStr = "" + numberOfResult;
for (StoragePos storagePos : posList) { for (StoragePos storagePos : posList) {
...@@ -248,16 +278,28 @@ public class HellaServiceHandler extends IoHandlerAdapter implements ITaskListen ...@@ -248,16 +278,28 @@ public class HellaServiceHandler extends IoHandlerAdapter implements ITaskListen
private void testCheckOK(HellaReqCommand command) { private ResultBean testCheckOK(HellaReqCommand command) {
HellaRespCommand respCommand = new HellaRespCommand(); HellaRespCommand respCommand = new HellaRespCommand();
respCommand.setCmd("TestCheckMaterial"); respCommand.setCmd("TestCheckMaterial");
respCommand.setEventId(command.getEventId()); respCommand.setEventId(command.getEventId());
String reelId = command.getData().toString(); String codeStr = command.getData().toString();
String[] resposArr = new String[]{"TestCheckMaterial",command.getEventId(),"0","OK","PN001",reelId,"1000","1","LC01"}; CodeBean codeBean = codeResolve.resolveSingleCode(codeStr);
if(codeBean==null||codeBean.getBarcode()==null){
return ResultBean.newErrorResult(1,"smfcode.error.barcode.invalid","条码无效");
}
if(ObjectUtil.isNotEmpty(codeBean.getErrorCode()) ){
return ResultBean.newErrorResult(1,codeBean.getErrorCode(),codeBean.getError(),codeBean.getParams());
}
String pn=codeBean.getBarcode().getPartNumber();
String reelId=codeBean.getBarcode().getBarcode();
String num=codeBean.getBarcode().getAmount()+"";
String[] resposArr = new String[]{"TestCheckMaterial",command.getEventId(),"0","OK",pn,reelId,num,"1","LC01"};
try { try {
handleCheckMaterialResp(respCommand,resposArr); handleCheckMaterialResp(respCommand,resposArr);
return ResultBean.newOkResult("");
} catch (ValidateException e) { } catch (ValidateException e) {
log.error(e); log.error(e);
return ResultBean.newErrorResult(1,e.getMsgKey(),e.getDefaultMsg());
} }
} }
...@@ -277,6 +319,7 @@ public class HellaServiceHandler extends IoHandlerAdapter implements ITaskListen ...@@ -277,6 +319,7 @@ public class HellaServiceHandler extends IoHandlerAdapter implements ITaskListen
return; return;
} }
String groupId = requestCommand.getGroupId(); String groupId = requestCommand.getGroupId();
String storageId=requestCommand.getStorageId();
String loginUser = requestCommand.getLoginUser(); String loginUser = requestCommand.getLoginUser();
String fullCode = requestCommand.getData().toString(); String fullCode = requestCommand.getData().toString();
if(respCommand.isOkResp()){ if(respCommand.isOkResp()){
...@@ -326,8 +369,16 @@ public class HellaServiceHandler extends IoHandlerAdapter implements ITaskListen ...@@ -326,8 +369,16 @@ public class HellaServiceHandler extends IoHandlerAdapter implements ITaskListen
dataLog.setNum(barcode.getAmount()); dataLog.setNum(barcode.getAmount());
dataLog.setStatus(OP_STATUS.WAIT.name()); dataLog.setStatus(OP_STATUS.WAIT.name());
dataLog.setGroupId(groupId); dataLog.setGroupId(groupId);
dataLog.setStorageId(storageId);
dataLog.setMemo(barcode.getMemo()); dataLog.setMemo(barcode.getMemo());
dataLog.setOperator(loginUser); dataLog.setOperator(loginUser);
if(ObjectUtil.isNotEmpty(storageId)){
Storage storage=dataCache.getStorageById(storageId);
if(storage!=null){
dataLog.setCid(storage.getCid());
dataLog.setStorageName(storage.getName());
}
}
try{ try{
taskService.addTaskToExecute(dataLog); taskService.addTaskToExecute(dataLog);
ResultBean okResult = ResultBean.newOkResult("checking material is ok: " + messageText); ResultBean okResult = ResultBean.newOkResult("checking material is ok: " + messageText);
...@@ -377,6 +428,7 @@ public class HellaServiceHandler extends IoHandlerAdapter implements ITaskListen ...@@ -377,6 +428,7 @@ public class HellaServiceHandler extends IoHandlerAdapter implements ITaskListen
liteOrder.setSource(groupName); liteOrder.setSource(groupName);
log.info("新增加订单:" + liteOrder.getOrderNo()); log.info("新增加订单:" + liteOrder.getOrderNo());
liteOrder = liteOrderManager.createWithItems(liteOrder); liteOrder = liteOrderManager.createWithItems(liteOrder);
liteOrderCache.addOrderToMap(liteOrder);
//对工单进行锁定 //对工单进行锁定
List<String> storageIdList = new ArrayList<>(); List<String> storageIdList = new ArrayList<>();
......
package com.neotel.smfcore.hella.rest; package com.neotel.smfcore.hella.rest;
import cn.hutool.core.util.ObjectUtil;
import com.neotel.smfcore.common.bean.ResultBean; import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.exception.ValidateException; import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.SecurityUtils; import com.neotel.smfcore.common.utils.SecurityUtils;
...@@ -91,7 +92,7 @@ public class HellaSensorShelfController { ...@@ -91,7 +92,7 @@ public class HellaSensorShelfController {
for (DataLog queueTask : queueTasks) { for (DataLog queueTask : queueTasks) {
if (queueTask.isPutInTask() && queueTask.isWait()) { if (queueTask.isPutInTask() && queueTask.isWait()) {
if (groupId != null && queueTask.getGroupId().equals(groupId)) { if (ObjectUtil.isEmpty(storageId)&& groupId != null && queueTask.getGroupId().equals(groupId)) {
log.info("codeIn [" + code + "][" + groupId + "]入库失败:条码[" + queueTask.getBarcode() + "]的任务还未结束 "); log.info("codeIn [" + code + "][" + groupId + "]入库失败:条码[" + queueTask.getBarcode() + "]的任务还未结束 ");
throw new ValidateException("smfcore.unfinished", "the task of [{0}] is unfinished", new String[]{queueTask.getBarcode()}); throw new ValidateException("smfcore.unfinished", "the task of [{0}] is unfinished", new String[]{queueTask.getBarcode()});
} }
......
package com.neotel.smfcore.hella.tcp; package com.neotel.smfcore.hella.tcp;
import cn.hutool.core.util.ObjectUtil;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import com.neotel.smfcore.common.bean.ResultBean; import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.utils.StringUtils; import com.neotel.smfcore.common.utils.StringUtils;
...@@ -65,7 +66,11 @@ public class HellaTcpClient { ...@@ -65,7 +66,11 @@ public class HellaTcpClient {
host=dataCache.GetConfigCache("hella.host","hella.host",host); host=dataCache.GetConfigCache("hella.host","hella.host",host);
port=Integer.parseInt(dataCache.GetConfigCache("hella.port","hella.port",port+"")) ; port=Integer.parseInt(dataCache.GetConfigCache("hella.port","hella.port",port+"")) ;
updateServerInfo(host, port); updateServerInfo(host, port);
start(); if(ObjectUtil.isEmpty(host)||ObjectUtil.isEmpty(port)){
log.info("配置不完整,不需要连接");
}else{
start();
}
} }
public static void updateServerInfo(String serverHost, int serverPort){ public static void updateServerInfo(String serverHost, int serverPort){
......
...@@ -11,9 +11,13 @@ public class HellaReqCommand extends HellaCommand { ...@@ -11,9 +11,13 @@ public class HellaReqCommand extends HellaCommand {
private String groupId; private String groupId;
/** /**
* 料仓Id; * 用户名;
*/ */
private String loginUser; private String loginUser;
/**
* 料仓ID
*/
private String storageId;
/** /**
* 检查物料条码 * 检查物料条码
...@@ -65,4 +69,12 @@ public class HellaReqCommand extends HellaCommand { ...@@ -65,4 +69,12 @@ public class HellaReqCommand extends HellaCommand {
public void setGroupId(String groupId) { public void setGroupId(String groupId) {
this.groupId = groupId; this.groupId = groupId;
} }
public String getStorageId() {
return storageId;
}
public void setStorageId(String storageId) {
this.storageId = storageId;
}
} }
...@@ -90,7 +90,6 @@ public class UserController { ...@@ -90,7 +90,6 @@ public class UserController {
@ApiOperation("查询用户") @ApiOperation("查询用户")
@GetMapping @GetMapping
@PreAuthorize("@el.check('user:list')") @PreAuthorize("@el.check('user:list')")
// public ResponseEntity<Object> query(UserQueryCriteria criteria, Pageable pageable){
public PageData<UserDto> query(UserQueryCriteria criteria, Pageable pageable) { public PageData<UserDto> query(UserQueryCriteria criteria, Pageable pageable) {
Query query = QueryHelp.getQuery(criteria); Query query = QueryHelp.getQuery(criteria);
PageData<User> userPageData = userManager.findByPage(query, pageable); PageData<User> userPageData = userManager.findByPage(query, pageable);
...@@ -127,7 +126,7 @@ public class UserController { ...@@ -127,7 +126,7 @@ public class UserController {
if(resources.getCheckCode()==null){ if(resources.getCheckCode()==null){
resources.setCheckCode(""); resources.setCheckCode("");
} }
resources.setPassword(passwordEncoder.encode("123456")); resources.setPassword(passwordEncoder.encode("Constants.USER_DEFAULTP_PWD"));
resources.setUpdateDate(new Date()); resources.setUpdateDate(new Date());
resources.setPwdResetTime(new Date()); resources.setPwdResetTime(new Date());
userManager.save(resources); userManager.save(resources);
...@@ -137,20 +136,16 @@ public class UserController { ...@@ -137,20 +136,16 @@ public class UserController {
@ApiOperation("修改用户") @ApiOperation("修改用户")
@PutMapping @PutMapping
@PreAuthorize("@el.check('user:edit')") @PreAuthorize("@el.check('user:edit')")
// public ResponseEntity<Object> update(@Validated(User.Update.class) @RequestBody User resources) throws Exception {
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("smfcode.valueCanotNull","{0}不能为空",new String[]{"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("smfcode.valueCanotNull","{0}不能为空",new String[]{"username"} );
// throw new ValidateException("修改用户:用户名不能为空");
} }
if(resources.getRoleId()==null){ if(resources.getRoleId()==null){
throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"roleId"} ); throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"roleId"} );
// throw new ValidateException("修改用户:角色ID不能为空");
} }
userManager.update(resources); userManager.update(resources);
...@@ -158,19 +153,54 @@ public class UserController { ...@@ -158,19 +153,54 @@ public class UserController {
return new ResponseEntity<>(HttpStatus.NO_CONTENT); return new ResponseEntity<>(HttpStatus.NO_CONTENT);
} }
@ApiOperation("修改用户:个人中心") @ApiOperation("重置密码")
@PutMapping(value = "center") @PutMapping(value = "/resetPass")
// public ResponseEntity<Object> center(@Validated(User.Update.class) @RequestBody User resources){ @PreAuthorize("@el.check('user:edit')")
public ResponseEntity<Object> center(@Validated @RequestBody UserDto userDto) { public ResultBean resetPass( @RequestBody String id) {
if (id == null) {
throw new ValidateException("smfcode.valueCanotNull","{0}不能为空",new String[]{"ID"} );
}
User resources=userManager.get(id);
resources.setPassword(passwordEncoder.encode(Constants.USER_DEFAULTP_PWD));
resources.setPwdResetTime(new Date());
userManager.update(resources);
return ResultBean.newOkResult("");
}
@ApiOperation("个人中心:获取个人资料")
@GetMapping(value = "/center")
public UserDto getCenter() {
User user = userManager.get(SecurityUtils.getCurrentUserId());
return userMapper.toDto(user);
}
@ApiOperation("个人中心:修改个人资料")
@PutMapping(value = "/center")
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("smfcode.hasNoAccess","无权限修改此用户信息" );
// throw new ValidateException("不能修改他人资料"); // throw new ValidateException("不能修改他人资料");
} }
userManager.updateCenter(resources); userManager.updateCenter(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT); return ResultBean.newOkResult("");
} }
@ApiOperation("个人中心:修改密码")
@PostMapping(value = "/updatePass")
public ResultBean updatePass(@RequestBody UserPassVo passVo) throws Exception {
User user = userManager.get(SecurityUtils.getCurrentUserId());
String oldPass = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey, passVo.getOldPass());
String newPass = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey, passVo.getNewPass());
if (!passwordEncoder.matches(oldPass, user.getPassword())) {
throw new ValidateException("smfcode.oldPwdError","修改失败,旧密码错误");
}
if (passwordEncoder.matches(newPass, user.getPassword())) {
throw new ValidateException("smfcode.newPwdError","新密码不能与旧密码相同");
}
userManager.updatePass(user.getUsername(), passwordEncoder.encode(newPass));
return ResultBean.newOkResult("");
}
@ApiOperation("删除用户") @ApiOperation("删除用户")
@DeleteMapping @DeleteMapping
...@@ -194,35 +224,21 @@ public class UserController { ...@@ -194,35 +224,21 @@ public class UserController {
return new ResponseEntity<>(HttpStatus.OK); return new ResponseEntity<>(HttpStatus.OK);
} }
@ApiOperation("修改密码")
@PostMapping(value = "/updatePass")
public ResponseEntity<Object> updatePass(@RequestBody UserPassVo passVo) throws Exception {
User user = userManager.get(SecurityUtils.getCurrentUserId());
if (!passwordEncoder.matches(passVo.getOldPass(), user.getPassword())) {
throw new ValidateException("smfcode.oldPwdError","修改失败,旧密码错误");
}
if (passwordEncoder.matches(passVo.getNewPass(), user.getPassword())) {
throw new ValidateException("smfcode.newPwdError","新密码不能与旧密码相同");
}
userManager.updatePass(user.getUsername(), passwordEncoder.encode(passVo.getNewPass()));
return new ResponseEntity<>(HttpStatus.OK);
}
@ApiOperation("修改邮箱") // @ApiOperation("修改邮箱")
@PostMapping(value = "/updateEmail/{code}") // @PostMapping(value = "/updateEmail/{code}")
public ResponseEntity<Object> updateEmail(@PathVariable String code, @RequestBody UserDto userDto) throws Exception { // public ResponseEntity<Object> updateEmail(@PathVariable String code, @RequestBody UserDto userDto) throws Exception {
User user=userMapper.toEntity(userDto); // User user=userMapper.toEntity(userDto);
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("smfcode.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());
return new ResponseEntity<>(HttpStatus.OK); // return new ResponseEntity<>(HttpStatus.OK);
} // }
@ApiOperation("修改用户组") @ApiOperation("修改用户组")
@PutMapping(value = "/updateGroup") @PutMapping(value = "/updateGroup")
@PreAuthorize("@el.check('user:edit')") @PreAuthorize("@el.check('user:edit')")
...@@ -236,6 +252,8 @@ public class UserController { ...@@ -236,6 +252,8 @@ public class UserController {
userManager.updateGroups(resources); userManager.updateGroups(resources);
return new ResponseEntity<>(HttpStatus.OK); return new ResponseEntity<>(HttpStatus.OK);
} }
@ApiOperation("上传用户列表:激活用户") @ApiOperation("上传用户列表:激活用户")
@PostMapping(value = "/upload") @PostMapping(value = "/upload")
public ResultBean upload( @RequestParam MultipartFile uploadFile) throws Exception { public ResultBean upload( @RequestParam MultipartFile uploadFile) throws Exception {
......
...@@ -50,7 +50,7 @@ public class UserManagerImpl implements IUserManager { ...@@ -50,7 +50,7 @@ public class UserManagerImpl implements IUserManager {
public void updatePass(String username, String encryptPassword) { public void updatePass(String username, String encryptPassword) {
Criteria c = Criteria.where("username").is(username); Criteria c = Criteria.where("username").is(username);
Query query = Query.query(c); Query query = Query.query(c);
Update update = Update.update("password",encryptPassword); Update update = Update.update("password",encryptPassword).addToSet("pwdResetTime",new Date());
userDao.updateFirst(query,update); userDao.updateFirst(query,update);
} }
@Override @Override
...@@ -102,6 +102,7 @@ public class UserManagerImpl implements IUserManager { ...@@ -102,6 +102,7 @@ public class UserManagerImpl implements IUserManager {
dataUser.setRoleId(user.getRoleId()); dataUser.setRoleId(user.getRoleId());
dataUser.setGroups(user.getGroups()); dataUser.setGroups(user.getGroups());
dataUser.setLanguage(user.getLanguage()); dataUser.setLanguage(user.getLanguage());
dataUser.setPwdResetTime(user.getPwdResetTime());
userDao.save(dataUser); userDao.save(dataUser);
} }
} }
...@@ -109,10 +110,11 @@ public class UserManagerImpl implements IUserManager { ...@@ -109,10 +110,11 @@ public class UserManagerImpl implements IUserManager {
public void updateCenter(User resources) { public void updateCenter(User resources) {
User dataUser=this.get(resources.getId()); User dataUser=this.get(resources.getId());
if(dataUser!=null){ if(dataUser!=null){
//用户名admin不能修改 // //用户名admin不能修改
if(!dataUser.equals(Constants.SUPER_USERNAME)){ // if(!dataUser.equals(Constants.SUPER_USERNAME)){
dataUser.setUsername(resources.getUsername()); // dataUser.setUsername(resources.getUsername());
} // }
//只能修改邮箱和语言
dataUser.setEmail(resources.getEmail()); dataUser.setEmail(resources.getEmail());
dataUser.setLanguage(resources.getLanguage()); dataUser.setLanguage(resources.getLanguage());
......
...@@ -29,7 +29,7 @@ smfcore.notFindPos=\u672A\u627E\u5230\u9501\u5B9A\u5E93\u4F4D ...@@ -29,7 +29,7 @@ smfcore.notFindPos=\u672A\u627E\u5230\u9501\u5B9A\u5E93\u4F4D
smfcore.error.barcode.empty=\u672A\u626B\u5230\u6761\u7801 smfcore.error.barcode.empty=\u672A\u626B\u5230\u6761\u7801
smfcore.error.barcode.many=\u627E\u5230\u591A\u4E2A\u6709\u6548\u6761\u7801,\u65E0\u6CD5\u5165\u5E93 smfcore.error.barcode.many=\u627E\u5230\u591A\u4E2A\u6709\u6548\u6761\u7801,\u65E0\u6CD5\u5165\u5E93
smfcore.error.barcode.expired=\u7269\u6599\u5DF2\u8FC7\u671F,\u65E0\u6CD5\u5165\u5E93. smfcore.error.barcode.expired=\u7269\u6599\u5DF2\u8FC7\u671F,\u65E0\u6CD5\u5165\u5E93.
smfcore.allBoxView.noReel=\u5E93\u4F4D\u4E2D\u65E0\u7269\u6599 smfcore.allBoxView.noReel=\u5E93\u4F4D{0}\u4E2D\u65E0\u7269\u6599
smfcode.error.barcode.many=\u627E\u5230\u591A\u4E2A\u6709\u6548\u7684\u6761\u7801 smfcode.error.barcode.many=\u627E\u5230\u591A\u4E2A\u6709\u6548\u7684\u6761\u7801
smfcode.error.barcode.noValidCode=\u65E0\u6548\u7684\u6761\u7801 smfcode.error.barcode.noValidCode=\u65E0\u6548\u7684\u6761\u7801
smfcore.error.barcode.noValidCode={0}\u4E0D\u662F\u6709\u6548\u7684\u6761\u7801 smfcore.error.barcode.noValidCode={0}\u4E0D\u662F\u6709\u6548\u7684\u6761\u7801
...@@ -93,7 +93,35 @@ smfcore.instruction=\u8BF4\u660E\u4E66 ...@@ -93,7 +93,35 @@ smfcore.instruction=\u8BF4\u660E\u4E66
smfcore.about=\u5173\u4E8E smfcore.about=\u5173\u4E8E
smfcore.tacticsOuput=\u7B56\u7565\u51FA\u5E93 smfcore.tacticsOuput=\u7B56\u7565\u51FA\u5E93
smfcore.labelOuput=\u7269\u6599\u5206\u7EC4 smfcore.labelOuput=\u7269\u6599\u5206\u7EC4
smfcode.order.out.executing=\u5DE5\u5355\u6B63\u5728\u6267\u884C
smfcode.order.out.notFound=\u5DE5\u5355\u672A\u627E\u5230
smfcode.order.out.maxOrder=\u5DF2\u8FBE\u5230\u6700\u5927\u53EF\u6267\u884C\u5DE5\u5355\u6570
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
smfcode.order.lineCanotNull=\u7EBF\u522B\u4E0D\u80FD\u4E3A\u7A7A
smfcode.order.cannotUpdateLine=\u5DE5\u5355\u5DF2\u51FA\u5E93\uFF0C\u4E0D\u80FD\u4FEE\u6539\u7EBF\u522B
smfcode.order.uploadOK=\u5DE5\u5355\u4E0A\u4F20\u6210\u529F
smfcode.order.ameExists=\u5DE5\u5355\u540D\u79F0[{0}]\u5DF2\u5B58\u5728
smfcode.order.hasClose=\u5DE5\u5355\u5DF2\u5173\u95ED
smfcode.order.supplementOutFail=\u672A\u627E\u5230\u53EF\u4EE5\u51FA\u5E93\u7684\u8865\u6599
smfcode.materialBox.quantityshort=\u7269\u6599\u6570\u91CF\u4E0D\u8DB3
smfcode.materialBox.invalid=\u672A\u627E\u5230\u6599\u76D2\u4FE1\u606F{0}
smfcode.materialBox.noReel=\u6599\u76D2\u4E2D\u672A\u627E\u5230\u5BF9\u5E94\u7269\u6599
smfcode.materialBox.boxNoReel=\u6599\u76D2\u4E2D\u65E0\u7269\u6599
smfcode.materialBox.inPos=\u7269\u6599\u5DF2\u5728\u5E93\u4F4D{0}\u4E2D
smfcode.materialBox.inOtherBox=\u7269\u6599\u5DF2\u5728\u6599\u76D2{0}\u4E2D
smfcore.materialBox=\u6599\u76D2\u64CD\u4F5C
......
...@@ -29,7 +29,7 @@ smfcore.notFindPos=Locked position not found ...@@ -29,7 +29,7 @@ smfcore.notFindPos=Locked position not found
smfcore.error.barcode.empty=Barcode empty smfcore.error.barcode.empty=Barcode empty
smfcore.error.barcode.many=Found several barcodes, storage failed smfcore.error.barcode.many=Found several barcodes, storage failed
smfcore.error.barcode.expired=Reel expired, storage failed smfcore.error.barcode.expired=Reel expired, storage failed
smfcore.allBoxView.noReel=No reel in position smfcore.allBoxView.noReel=No reel in position {0}
smfcode.error.barcode.many=Found several barcodes smfcode.error.barcode.many=Found several barcodes
smfcode.error.barcode.noValidCode=Invalid barcode smfcode.error.barcode.noValidCode=Invalid barcode
smfcore.error.barcode.noValidCode=Invalid barcode {0} smfcore.error.barcode.noValidCode=Invalid barcode {0}
...@@ -92,4 +92,33 @@ smfcore.help=Help ...@@ -92,4 +92,33 @@ smfcore.help=Help
smfcore.instruction=Instruction manual smfcore.instruction=Instruction manual
smfcore.about=About smfcore.about=About
smfcore.tacticsOuput=Strategies Retrival smfcore.tacticsOuput=Strategies Retrival
smfcore.labelOuput=Material grouping
\ No newline at end of file \ No newline at end of file
smfcore.labelOuput=Material grouping
smfcode.order.out.executing=Work orders are being executed
smfcode.order.out.notFound=Work order not found
smfcode.order.out.maxOrder=The maximum number of executable work orders has been reached
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
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
smfcode.order.lineCanotNull=Line cannot be empty
smfcode.order.cannotUpdateLine=Work order has been issued, can not modify the line
smfcode.order.uploadOK=Work order uploaded successfully
smfcode.order.ameExists=Work order name [{0}] already exists
smfcode.order.hasClose=The work order is closed
smfcode.order.supplementOutFail=No replenishment material found that can be discharged
smfcode.materialBox.quantityshort=Insufficient quantity of materials
smfcode.materialBox.invalid=No information found for cartridge {0}
smfcode.materialBox.noReel=The corresponding material is not found in the material box
smfcode.materialBox.boxNoReel=No material in the cassette
smfcode.materialBox.inPos=The material is already in the storage space {0}
smfcode.materialBox.inOtherBox=The material is already in the cassette {0}
smfcore.materialBox=Cassette operation
...@@ -29,7 +29,7 @@ smfcore.notFindPos=\u30ED\u30C3\u30AF\u3055\u308C\u305F\u30B9\u30C8\u30EC\u30FC\ ...@@ -29,7 +29,7 @@ smfcore.notFindPos=\u30ED\u30C3\u30AF\u3055\u308C\u305F\u30B9\u30C8\u30EC\u30FC\
smfcore.error.barcode.empty=\u30D0\u30FC\u30B3\u30FC\u30C9\u304C\u30B9\u30AD\u30E3\u30F3\u3055\u308C\u306A\u3044 smfcore.error.barcode.empty=\u30D0\u30FC\u30B3\u30FC\u30C9\u304C\u30B9\u30AD\u30E3\u30F3\u3055\u308C\u306A\u3044
smfcore.error.barcode.many=\u8907\u6570\u306E\u6709\u52B9\u306A\u30D0\u30FC\u30B3\u30FC\u30C9\u304C\u898B\u3064\u304B\u308A\u307E\u3057\u305F\u304C\u3001\u5728\u5EAB\u306F\u3042\u308A\u307E\u305B\u3093 smfcore.error.barcode.many=\u8907\u6570\u306E\u6709\u52B9\u306A\u30D0\u30FC\u30B3\u30FC\u30C9\u304C\u898B\u3064\u304B\u308A\u307E\u3057\u305F\u304C\u3001\u5728\u5EAB\u306F\u3042\u308A\u307E\u305B\u3093
smfcore.error.barcode.expired=\u6750\u6599\u304C\u53E4\u304F\u3066\u5728\u5EAB\u304C\u306A\u3044 smfcore.error.barcode.expired=\u6750\u6599\u304C\u53E4\u304F\u3066\u5728\u5EAB\u304C\u306A\u3044
smfcore.allBoxView.noReel=\u4FDD\u7BA1\u4E2D\u306E\u7D20\u6750\u304C\u306A\u3044 smfcore.allBoxView.noReel=\u4FDD\u7BA1\u4E2D\u306E\u7D20\u6750\u304C\u306A\u3044{0}
smfcode.error.barcode.many=\u8907\u6570\u306E\u6709\u52B9\u306A\u30D0\u30FC\u30B3\u30FC\u30C9\u306E\u691C\u7D22 smfcode.error.barcode.many=\u8907\u6570\u306E\u6709\u52B9\u306A\u30D0\u30FC\u30B3\u30FC\u30C9\u306E\u691C\u7D22
smfcode.error.barcode.noValidCode=\u7121\u52B9\u306A\u30D0\u30FC\u30B3\u30FC\u30C9 smfcode.error.barcode.noValidCode=\u7121\u52B9\u306A\u30D0\u30FC\u30B3\u30FC\u30C9
smfcore.error.barcode.noValidCode={0}\u306F\u6709\u52B9\u306A\u30D0\u30FC\u30B3\u30FC\u30C9\u3067\u306F\u3042\u308A\u307E\u305B\u3093 smfcore.error.barcode.noValidCode={0}\u306F\u6709\u52B9\u306A\u30D0\u30FC\u30B3\u30FC\u30C9\u3067\u306F\u3042\u308A\u307E\u305B\u3093
...@@ -92,4 +92,33 @@ smfcore.help=\u30D8\u30EB\u30D7 ...@@ -92,4 +92,33 @@ smfcore.help=\u30D8\u30EB\u30D7
smfcore.instruction=\u53D6\u6271\u8AAC\u660E\u66F8 smfcore.instruction=\u53D6\u6271\u8AAC\u660E\u66F8
smfcore.about=\u306B\u3064\u3044\u3066 smfcore.about=\u306B\u3064\u3044\u3066
smfcore.tacticsOuput=\u30B9\u30C8\u30E9\u30C6\u30B8\u30FC\u306F\u5728\u5EAB\u5207\u308C\u3067\u3059 smfcore.tacticsOuput=\u30B9\u30C8\u30E9\u30C6\u30B8\u30FC\u306F\u5728\u5EAB\u5207\u308C\u3067\u3059
smfcore.labelOuput=\u6750\u6599\u306E\u30B0\u30EB\u30FC\u30D7\u5316
\ No newline at end of file \ No newline at end of file
smfcore.labelOuput=\u6750\u6599\u306E\u30B0\u30EB\u30FC\u30D7\u5316
smfcode.order.out.executing=\u4F5C\u696D\u6307\u793A\u304C\u5B9F\u884C\u3055\u308C\u3066\u3044\u308B
smfcode.order.out.notFound=\u4F5C\u696D\u6307\u793A\u66F8\u304C\u898B\u3064\u304B\u3089\u306A\u3044
smfcode.order.out.maxOrder=\u5B9F\u884C\u53EF\u80FD\u306A\u30EF\u30FC\u30AF\u30AA\u30FC\u30C0\u30FC\u306E\u6700\u5927\u6570\u306B\u9054\u3057\u3066\u3044\u308B
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
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
smfcode.order.lineCanotNull=\u30E9\u30A4\u30F3\u304C\u7A7A\u304F\u3053\u3068\u306F\u306A\u3044
smfcode.order.cannotUpdateLine=\u4F5C\u696D\u6307\u793A\u66F8\u304C\u767A\u884C\u3055\u308C\u3001\u30E9\u30A4\u30F3\u306E\u5909\u66F4\u304C\u3067\u304D\u306A\u3044\u72B6\u614B\u306B\u306A\u3063\u3066\u3044\u308B
smfcode.order.uploadOK=\u4F5C\u696D\u6307\u793A\u66F8\u306E\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u6210\u529F
smfcode.order.ameExists=\u4F5C\u696D\u30AA\u30FC\u30C0\u30FC\u540D\u300C{0}\u300D\u306F\u65E2\u306B\u5B58\u5728\u3057\u3066\u3044\u307E\u3059
smfcode.order.hasClose=\u30EF\u30FC\u30AF\u30AA\u30FC\u30C0\u30FC\u306E\u7D42\u4E86
smfcode.order.supplementOutFail=\u6392\u51FA\u53EF\u80FD\u306A\u88DC\u5145\u54C1\u304C\u898B\u3064\u304B\u3089\u306A\u3044
smfcode.materialBox.quantityshort=\u7269\u6599\u6570\u91CF\u4E0D\u8DB3
smfcode.materialBox.invalid=\u96D1\u8A8C\u306E\u60C5\u5831\u306F\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3067\u3057\u305F{0}
smfcode.materialBox.noReel=\u30AB\u30BB\u30C3\u30C8\u5185\u306B\u8A72\u5F53\u3059\u308B\u7D20\u6750\u304C\u898B\u3064\u304B\u3089\u306A\u3044
smfcode.materialBox.boxNoReel=\u30AB\u30BB\u30C3\u30C8\u306B\u7D20\u6750\u304C\u306A\u3044
smfcode.materialBox.inPos=\u3059\u3067\u306B\u5728\u5EAB\u306E\u3042\u308B\u7D20\u6750 {0}
smfcode.materialBox.inOtherBox=\u30AB\u30BB\u30C3\u30C8\u306B\u65E2\u306B\u5165\u3063\u3066\u3044\u308B\u7D20\u6750 {0}
smfcore.materialBox=\u30AB\u30BB\u30C3\u30C8\u64CD\u4F5C
\ No newline at end of file \ No newline at end of file
...@@ -29,7 +29,7 @@ smfcore.notFindPos=\u672A\u627E\u5230\u9501\u5B9A\u5E93\u4F4D ...@@ -29,7 +29,7 @@ smfcore.notFindPos=\u672A\u627E\u5230\u9501\u5B9A\u5E93\u4F4D
smfcore.error.barcode.empty=\u672A\u626B\u5230\u6761\u7801 smfcore.error.barcode.empty=\u672A\u626B\u5230\u6761\u7801
smfcore.error.barcode.many=\u627E\u5230\u591A\u4E2A\u6709\u6548\u6761\u7801,\u65E0\u6CD5\u5165\u5E93 smfcore.error.barcode.many=\u627E\u5230\u591A\u4E2A\u6709\u6548\u6761\u7801,\u65E0\u6CD5\u5165\u5E93
smfcore.error.barcode.expired=\u7269\u6599\u5DF2\u8FC7\u671F,\u65E0\u6CD5\u5165\u5E93. smfcore.error.barcode.expired=\u7269\u6599\u5DF2\u8FC7\u671F,\u65E0\u6CD5\u5165\u5E93.
smfcore.allBoxView.noReel=\u5E93\u4F4D\u4E2D\u65E0\u7269\u6599 smfcore.allBoxView.noReel=\u5E93\u4F4D{0}\u4E2D\u65E0\u7269\u6599
smfcode.error.barcode.many=\u627E\u5230\u591A\u4E2A\u6709\u6548\u7684\u6761\u7801 smfcode.error.barcode.many=\u627E\u5230\u591A\u4E2A\u6709\u6548\u7684\u6761\u7801
smfcode.error.barcode.noValidCode=\u65E0\u6548\u7684\u6761\u7801 smfcode.error.barcode.noValidCode=\u65E0\u6548\u7684\u6761\u7801
smfcore.error.barcode.noValidCode={0}\u4E0D\u662F\u6709\u6548\u7684\u6761\u7801 smfcore.error.barcode.noValidCode={0}\u4E0D\u662F\u6709\u6548\u7684\u6761\u7801
...@@ -92,4 +92,33 @@ smfcore.help=\u5E2E\u52A9 ...@@ -92,4 +92,33 @@ smfcore.help=\u5E2E\u52A9
smfcore.instruction=\u8BF4\u660E\u4E66 smfcore.instruction=\u8BF4\u660E\u4E66
smfcore.about=\u5173\u4E8E smfcore.about=\u5173\u4E8E
smfcore.tacticsOuput=\u7B56\u7565\u51FA\u5E93 smfcore.tacticsOuput=\u7B56\u7565\u51FA\u5E93
smfcore.labelOuput=\u7269\u6599\u5206\u7EC4
\ No newline at end of file \ No newline at end of file
smfcore.labelOuput=\u7269\u6599\u5206\u7EC4
smfcode.order.out.executing=\u5DE5\u5355\u6B63\u5728\u6267\u884C
smfcode.order.out.notFound=\u5DE5\u5355\u672A\u627E\u5230
smfcode.order.out.maxOrder=\u5DF2\u8FBE\u6700\u5927\u53EF\u6267\u884C\u5DE5\u5355\u6570
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
smfcode.order.lineCanotNull=\u7EBF\u522B\u4E0D\u80FD\u4E3A\u7A7A
smfcode.order.cannotUpdateLine=\u5DE5\u5355\u5DF2\u51FA\u5E93\uFF0C\u4E0D\u80FD\u4FEE\u6539\u7EBF\u522B
smfcode.order.uploadOK=\u5DE5\u5355\u4E0A\u4F20\u6210\u529F
smfcode.order.ameExists=\u5DE5\u5355\u540D\u79F0[{0}]\u5DF2\u5B58\u5728
smfcode.order.hasClose=\u5DE5\u5355\u5DF2\u5173\u95ED
smfcode.order.supplementOutFail=\u672A\u627E\u5230\u53EF\u4EE5\u51FA\u5E93\u7684\u8865\u6599
smfcode.materialBox.quantityshort=\u7269\u6599\u6570\u91CF\u4E0D\u8DB3
smfcode.materialBox.invalid=\u672A\u627E\u5230\u6599\u76D2\u4FE1\u606F{0}
smfcode.materialBox.noReel=\u6599\u76D2\u4E2D\u672A\u627E\u5230\u5BF9\u5E94\u7269\u6599
smfcode.materialBox.boxNoReel=\u6599\u76D2\u4E2D\u65E0\u7269\u6599
smfcode.materialBox.inPos=\u7269\u6599\u5DF2\u5728\u5E93\u4F4D{0}\u4E2D
smfcode.materialBox.inOtherBox=\u7269\u6599\u5DF2\u5728\u6599\u76D2{0}\u4E2D
smfcore.materialBox=\u6599\u76D2\u64CD\u4F5C
\ No newline at end of file \ No newline at end of file
...@@ -29,7 +29,7 @@ smfcore.notFindPos=\u672A\u627E\u5230\u9396\u5B9A\u5EAB\u4F4D ...@@ -29,7 +29,7 @@ smfcore.notFindPos=\u672A\u627E\u5230\u9396\u5B9A\u5EAB\u4F4D
smfcore.error.barcode.empty=\u672A\u6383\u5230\u689D\u78BC smfcore.error.barcode.empty=\u672A\u6383\u5230\u689D\u78BC
smfcore.error.barcode.many=\u627E\u5230\u591A\u500B\u6709\u6548\u689D\u78BC,\u7121\u6CD5\u5165\u5EAB smfcore.error.barcode.many=\u627E\u5230\u591A\u500B\u6709\u6548\u689D\u78BC,\u7121\u6CD5\u5165\u5EAB
smfcore.error.barcode.expired=\u7269\u6599\u5DF2\u904E\u671F,\u7121\u6CD5\u5165\u5EAB. smfcore.error.barcode.expired=\u7269\u6599\u5DF2\u904E\u671F,\u7121\u6CD5\u5165\u5EAB.
smfcore.allBoxView.noReel=\u5EAB\u4F4D\u4E2D\u7121\u7269\u6599 smfcore.allBoxView.noReel=\u5EAB\u4F4D{0}\u4E2D\u7121\u7269\u6599
smfcode.error.barcode.many=\u627E\u5230\u591A\u500B\u6709\u6548\u7684\u689D\u78BC smfcode.error.barcode.many=\u627E\u5230\u591A\u500B\u6709\u6548\u7684\u689D\u78BC
smfcode.error.barcode.noValidCode=\u7121\u6548\u7684\u689D\u78BC smfcode.error.barcode.noValidCode=\u7121\u6548\u7684\u689D\u78BC
smfcore.error.barcode.noValidCode={0}\u4E0D\u662F\u6709\u6548\u7684\u689D\u78BC smfcore.error.barcode.noValidCode={0}\u4E0D\u662F\u6709\u6548\u7684\u689D\u78BC
...@@ -92,4 +92,33 @@ smfcore.help=\u5E6B\u52A9 ...@@ -92,4 +92,33 @@ smfcore.help=\u5E6B\u52A9
smfcore.instruction=\u8AAA\u660E\u66F8 smfcore.instruction=\u8AAA\u660E\u66F8
smfcore.about=\u95DC\u65BC smfcore.about=\u95DC\u65BC
smfcore.tacticsOuput=\u7B56\u7565\u51FA\u5EAB smfcore.tacticsOuput=\u7B56\u7565\u51FA\u5EAB
smfcore.labelOuput=\u7269\u6599\u5206\u7D44
\ No newline at end of file \ No newline at end of file
smfcore.labelOuput=\u7269\u6599\u5206\u7D44
smfcode.order.out.executing=\u5DE5\u55AE\u6B63\u5728\u57F7\u884C
smfcode.order.out.notFound=\u5DE5\u55AE\u672A\u627E\u5230
smfcode.order.out.maxOrder=\u5DF2\u9054\u5230\u6700\u5927\u53EF\u57F7\u884C\u5DE5\u55AE\u6578
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
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
smfcode.order.lineCanotNull=\u7DDA\u5225\u4E0D\u80FD\u70BA\u7A7A
smfcode.order.cannotUpdateLine=\u5DE5\u55AE\u5DF2\u51FA\u5EAB\uFF0C\u4E0D\u80FD\u4FEE\u6539\u7DDA\u5225
smfcode.order.uploadOK=\u5DE5\u55AE\u4E0A\u50B3\u6210\u529F
smfcode.order.ameExists=\u5DE5\u55AE\u540D\u7A31[{0}]\u5DF2\u5B58\u5728
smfcode.order.hasClose=\u5DE5\u55AE\u5DF2\u95DC\u9589
smfcode.order.supplementOutFail=\u672A\u627E\u5230\u53EF\u4EE5\u51FA\u5EAB\u7684\u88DC\u6599
smfcode.materialBox.quantityshort=\u7269\u6599\u6570\u91CF\u4E0D\u8DB3
smfcode.materialBox.invalid=\u672A\u627E\u5230\u6599\u76D2\u4FE1\u606F{0}
smfcode.materialBox.noReel=\u6599\u76D2\u4E2D\u672A\u627E\u5230\u5C0D\u61C9\u7269\u6599
smfcode.materialBox.boxNoReel=\u6599\u76D2\u4E2D\u7121\u7269\u6599
smfcode.materialBox.inPos=\u7269\u6599\u5DF2\u5728\u5EAB\u4F4D{0}\u4E2D
smfcode.materialBox.inOtherBox=\u7269\u6599\u5DF2\u5728\u6599\u76D2{0}\u4E2D
smfcore.materialBox=\u6599\u76D2\u64CD\u4F5C
\ No newline at end of file \ No newline at end of file
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!