Commit a5db80b8 LN

料盒操作功能

1 个父辈 1f8f5679
......@@ -515,7 +515,7 @@ public class BarcodeRule {
Barcode b = new Barcode();
b.setFullCode(codeStr);
String reelId = "";
if(whole_reelId_item.hasThisField()){
reelId = codeStr;
......
package com.neotel.smfcore.core.barcode.rest.bean.dto;
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.COMPONENT_TYPE;
import com.neotel.smfcore.core.barcode.enums.SOLDER_STATUS;
......@@ -13,6 +12,9 @@ import org.springframework.data.annotation.Transient;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;
@Getter
@Setter
public class BarcodeDto implements Serializable {
......@@ -205,5 +207,8 @@ public class BarcodeDto implements Serializable {
return (""+plateSize+"X"+height);
}
/**
* 料箱中的物料信息
*/
private Map<String, BarcodeDto> subCodeMap;
}
......@@ -3,7 +3,6 @@ package com.neotel.smfcore.core.barcode.service.po;
import com.google.common.collect.Lists;
import com.neotel.smfcore.common.base.BasePo;
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.COMPONENT_TYPE;
import com.neotel.smfcore.core.barcode.enums.SOLDER_STATUS;
......@@ -13,8 +12,7 @@ import org.springframework.data.annotation.Transient;
import org.springframework.data.mongodb.core.mapping.Document;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.*;
@Data
@Document
......@@ -23,6 +21,11 @@ public class Barcode extends BasePo implements Serializable {
* 条码编号
*/
private String barcode;
/**
* 扩展料盒的条码ID
*/
private String hostBarcodeId;
/**
* 物料类型:PCB,锡膏,或其他
*/
......@@ -42,9 +45,9 @@ public class Barcode extends BasePo implements Serializable {
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 {
/**
* 盘宽
*/
private int plateSize=0;
private int plateSize = 0;
/**
* 盘高
*/
private int height=0;
private int height = 0;
private String provider;
/**
* 批次
*/
private String batch;
private String batch="";
private String msl;
//备用字段1(配套单号))或 family
......@@ -156,19 +159,25 @@ public class Barcode extends BasePo implements Serializable {
*/
@Transient
private List<String> relationCodes;
/**
* 料盒条码:料盒内所有物料条码
*/
private Map<String, Barcode> subCodeMap;
/**
* 是否是锡膏
*/
public boolean isSolder(){
public boolean isSolder() {
return type == COMPONENT_TYPE.SOLDERPASTE;
}
public List<String> getRelationCodes() {
if (relationCodes == null) {
return Lists.newArrayList();
}
return relationCodes;
}
/**
* 上次使用时间(出入库时更改)
*/
......@@ -197,6 +206,7 @@ public class Barcode extends BasePo implements Serializable {
* 原始条码
*/
private String fullCode;
/**
* 添加相关联条码
*
......@@ -208,12 +218,13 @@ public class Barcode extends BasePo implements Serializable {
}
relationCodes.add(relationCode);
}
public long getPutInTime() {
return putInTime;
}
public void setPutInTime(long putInTime) {
if(this.putInTime == -1){
if (this.putInTime == -1) {
this.putInTime = putInTime;
this.putInDate = new Date(putInTime);
}
......@@ -229,8 +240,8 @@ public class Barcode extends BasePo implements Serializable {
return putInDate;
}
public String getPutInDateStr(){
if(putInDate == null){
public String getPutInDateStr() {
if (putInDate == null) {
return "";
}
return DateUtil.toDateTimeString(putInDate);
......@@ -240,13 +251,13 @@ public class Barcode extends BasePo implements Serializable {
this.putInDate = putInDate;
}
private void updateExpTime(){
if(expTime == null && maxStorageTime != 0F && putInTime != -1){
private void updateExpTime() {
if (expTime == null && maxStorageTime != 0F && putInTime != -1) {
Float maxStorageTimeMill = maxStorageTime * 60 * 60 * 1000;
expTime = new Date(putInTime + maxStorageTimeMill.longValue());
if(expireDate != null){
if (expireDate != null) {
//如果是在包装上的过期时间之前,使用包装上的过期时间
if(expireDate.getTime()< expTime.getTime()){
if (expireDate.getTime() < expTime.getTime()) {
expTime = expireDate;
}
}
......@@ -256,9 +267,9 @@ public class Barcode extends BasePo implements Serializable {
/**
* 到达回温的时间
*/
public long getReachWarmTime(){
public long getReachWarmTime() {
long reachWarmTime = System.currentTimeMillis();
if(COMPONENT_TYPE.SOLDERPASTE == type && putInTime != -1){
if (COMPONENT_TYPE.SOLDERPASTE == type && putInTime != -1) {
reachWarmTime = putInTime + warmTime * 60 * 60 * 1000;
}
return reachWarmTime;
......@@ -267,22 +278,22 @@ public class Barcode extends BasePo implements Serializable {
/**
* 是否达到回温时间,只有锡膏才需要判定
*/
public boolean isReachedWarmTime(){
public boolean isReachedWarmTime() {
return getReachWarmTime() <= System.currentTimeMillis();
}
public long getInStoreHour(){
if(putInTime != -1){
public long getInStoreHour() {
if (putInTime != -1) {
return (System.currentTimeMillis() - putInTime) / 60 / 60 / 1000;
}
return 0;
}
public long getInStoreMiniute(){
if(putInTime != -1){
public long getInStoreMiniute() {
if (putInTime != -1) {
long minutes = (System.currentTimeMillis() - getPutInTime()) / 60000 % 60;
if(minutes == 0){
if(getInStoreHour() == 0){
if (minutes == 0) {
if (getInStoreHour() == 0) {
minutes = 1;
}
}
......@@ -290,44 +301,47 @@ public class Barcode extends BasePo implements Serializable {
}
return 0;
}
public void setCheckOutDate(Date checkOutDate, String opor) {
this.checkOutDate = checkOutDate;
this.outOpor = opor;
if(checkOutDate != null){//出库时判断是否过期
if (checkOutDate != null) {//出库时判断是否过期
updateExpTime();
if(expTime != null && checkOutDate.after(expTime)){
if (expTime != null && checkOutDate.after(expTime)) {
//过期时间小于出库时间,说明出库的时候已经过期了
status = BARCODE_STATUS.OUT_EXPIRED;
}else{
} else {
status = BARCODE_STATUS.OUT_NORMAL;
}
}
}
public void setInOpor(String inOpor) {
if(putInTime == -1){
if (putInTime == -1) {
this.inOpor = inOpor;
}
}
public int getSolderStatus() {
if(solderStatus == SOLDER_STATUS.REWARMING){
if (solderStatus == SOLDER_STATUS.REWARMING) {
//如果状态是回温中,且回温时间已经大于warmTime,修改状态为待搅拌
long now = System.currentTimeMillis();
if(startWarmTime - now > warmTime * 60 * 60 * 1000){
if (startWarmTime - now > warmTime * 60 * 60 * 1000) {
solderStatus = SOLDER_STATUS.TO_BE_MIXED;
}
}
return solderStatus;
}
public String getNeedOutDateStr(){
if(needOutDate == null){
public String getNeedOutDateStr() {
if (needOutDate == null) {
return "";
}
return DateUtil.toDateTimeString(needOutDate);
}
public String getExpireDateStr(){
if(expireDate != null){
public String getExpireDateStr() {
if (expireDate != null) {
return DateUtil.toDateString(expireDate);
}
return "";
......@@ -336,8 +350,8 @@ public class Barcode extends BasePo implements Serializable {
/**
* 是否已过期
*/
public boolean isExpired(){
if(expireDate != null){
public boolean isExpired() {
if (expireDate != null) {
return expireDate.before(new Date());
}
return false;
......@@ -346,12 +360,12 @@ public class Barcode extends BasePo implements Serializable {
/**
* 是否即将(3天内)过期,已过期后,此字段变为false
*/
public boolean isWillExpired(){
if(isExpired()){
public boolean isWillExpired() {
if (isExpired()) {
return false;
}
if(expireDate != null){
return expireDate.before(DateUtil.addDays(new Date(),3));
if (expireDate != null) {
return expireDate.before(DateUtil.addDays(new Date(), 3));
}
return false;
}
......@@ -359,10 +373,33 @@ public class Barcode extends BasePo implements Serializable {
/**
* 是否是小料(7x8)的料
*/
public boolean isSmallReel(){
if(getPlateSize() == 7){
public boolean isSmallReel() {
if (getPlateSize() == 7) {
return getHeight() == 8 || getHeight() == 12;
}
return false;
}
public Barcode getSubCode(String pnStr) {
if (subCodeMap == null) {
return null;
}
return subCodeMap.get(pnStr);
}
public void UpdateSubCode(Barcode barcode) {
if (subCodeMap == null) {
subCodeMap = new HashMap<>();
}
if (barcode.getAmount() <= 0) {
if (subCodeMap.containsKey(barcode.getPartNumber())) {
subCodeMap.remove(barcode.getPartNumber());
}
} else {
subCodeMap.put(barcode.getPartNumber(), barcode);
}
}
}
......@@ -6,6 +6,7 @@ import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.DateUtil;
import com.neotel.smfcore.core.barcode.bean.BarcodeRule;
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.IComponentManager;
import com.neotel.smfcore.core.barcode.service.po.Barcode;
......@@ -13,6 +14,7 @@ import com.neotel.smfcore.core.barcode.service.po.Component;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.yaml.snakeyaml.comments.CommentType;
import java.util.Collection;
import java.util.Date;
......@@ -42,10 +44,13 @@ public class CodeResolve {
}
}
public CodeBean resolveSingleCode(String barcodeItemStr ){
return resolveSingleCode(barcodeItemStr, COMPONENT_TYPE.COMPONENT);
}
/**
* 解析条码为单个 Barcode,自动保存到数据库
*/
public CodeBean resolveSingleCode(String barcodeItemStr){
public CodeBean resolveSingleCode(String barcodeItemStr,int type){
if(barcodeRuleList == null || barcodeRuleList.isEmpty()){
CodeBean codeBean = new CodeBean();
......@@ -112,19 +117,19 @@ public class CodeResolve {
barcode.setLabelAmount(currentLabelAmount);
needUpdate = true;
}
// Date produceDate = barcodeFromRule.getProduceDate();
// if(produceDate != null){
// //抓取到了生产日期,未抓取到过期日期,重新设置过期日期
// if(barcode.getExpireDate() == null){
// if(validDay > 0){
// log.info("重新设置"+codeBeanFromRule.getCodeStr()+"生产日期和过期日期");
// Date expireDate = DateUtil.addDays(produceDate, validDay);
// barcode.setExpireDate(expireDate);
// barcode.setProduceDate(produceDate);
// needUpdate = true;
// }
// }
// }
Date produceDate = barcodeFromRule.getProduceDate();
if(produceDate != null){
//抓取到了生产日期,未抓取到过期日期,重新设置过期日期
if(barcode.getExpireDate() == null){
if(validDay > 0){
log.info("重新设置"+codeBeanFromRule.getCodeStr()+"生产日期和过期日期");
Date expireDate = DateUtil.addDays(produceDate, validDay);
barcode.setExpireDate(expireDate);
barcode.setProduceDate(produceDate);
needUpdate = true;
}
}
}
if(needUpdate){
try {
......@@ -141,7 +146,20 @@ public class CodeResolve {
return codeBeanFromRule;
}else if(codeBeanFromRule.isValid()){//数据库中不存在,但解析成功
Barcode barcodeFromRule = codeBeanFromRule.getBarcode();
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()){
//log.info("料盘["+barcode.getBarcode()+"]的尺寸信息从["+barcode.getPlateSize()+"x"+barcode.getHeight()+"]设置为["+codeBeanFromRule.getReelWidth()+"x"+codeBeanFromRule.getReelHeight()+"]");
......@@ -192,7 +210,9 @@ public class CodeResolve {
}
}
barcode = barcodeManager.save(barcodeFromRule);
codeBeanFromRule.setCodeStr(barcode.getBarcode());
codeBeanFromRule.setBarcode(barcode);
codeBeanFromRule.setError(null,null);
......@@ -221,7 +241,6 @@ public class CodeResolve {
}
/**
* 解析条码为单个 Barcode
*/
......
......@@ -293,7 +293,7 @@ public class BoxKanbanController {
}
}
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, "", "", "", "", "",storage.getType(),storage.getUsageMap(),new HashMap<>());
......
......@@ -920,4 +920,8 @@ public class TaskService {
}
}
public void moveTaskToFinished(DataLog task) {
taskMap.remove(task.getId());
theFinishedTaskMap.put(task.getId(), task);
}
}
......@@ -127,8 +127,8 @@ public class HellaServiceHandler extends IoHandlerAdapter implements ITaskListen
commandMap.put(command.getEventId(),command);
log.info("发送检查物料条码请求:" + command.toReqMsg());
ResultBean resultBean = HellaTcpClient.sendMsg(command.toReqMsg());
//ResultBean resultBean = testCheckOK(command);
// ResultBean resultBean = HellaTcpClient.sendMsg(command.toReqMsg());
ResultBean resultBean = testCheckOK(command);
resultBean.setMsg("Check Material result:"+resultBean.getMsg());
return resultBean;
}
......
......@@ -115,6 +115,12 @@ 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
......
......@@ -114,4 +114,10 @@ smfcode.order.cannotUpdateLine=Work order has been issued, can not modify the li
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
\ No newline at end of file
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}
......@@ -114,4 +114,10 @@ smfcode.order.cannotUpdateLine=\u4F5C\u696D\u6307\u793A\u66F8\u304C\u767A\u884C\
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
\ No newline at end of file
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}
\ No newline at end of file
......@@ -114,4 +114,10 @@ smfcode.order.cannotUpdateLine=\u5DE5\u5355\u5DF2\u51FA\u5E93\uFF0C\u4E0D\u80FD\
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
\ No newline at end of file
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
\ No newline at end of file
......@@ -114,4 +114,10 @@ smfcode.order.cannotUpdateLine=\u5DE5\u55AE\u5DF2\u51FA\u5EAB\uFF0C\u4E0D\u80FD\
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
\ No newline at end of file
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
\ No newline at end of file
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!