Commit 9cf9c5d5 LN

料盒操作需要空格+-数量。料盒数据结构修改。

1 个父辈 76d9a30f
......@@ -5,6 +5,7 @@ import com.google.common.collect.Lists;
import com.neotel.smfcore.core.barcode.enums.BARCODE_STATUS;
import com.neotel.smfcore.core.barcode.enums.COMPONENT_TYPE;
import com.neotel.smfcore.core.barcode.enums.SOLDER_STATUS;
import com.neotel.smfcore.core.barcode.service.po.Barcode;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
......@@ -13,10 +14,7 @@ import org.springframework.data.annotation.Transient;
import java.io.Serializable;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
@Getter
@Setter
......@@ -218,10 +216,15 @@ public class BarcodeDto implements Serializable {
return (""+plateSize+"X"+height);
}
/**
* 料箱中的物料信息
*/
private Map<String, BarcodeDto> subCodeMap;
// /**
// * 料箱中的物料信息
// */
// private Map<String, BarcodeDto> subCodeMap;
@ApiModelProperty("料盒内所有物料条码")
private List<Barcode> subCodeList;
public String getPutInTimeStr() {
if (putInTime == -1) {
......
......@@ -163,10 +163,14 @@ public class Barcode extends BasePo implements Serializable {
*/
@Transient
private List<String> relationCodes;
// /**
// * 料盒条码:料盒内所有物料条码,key=barcode
// */
// private Map<String, Barcode> subCodeMap;
/**
* 料盒条码:料盒内所有物料条码,key=barcode
* 料盒条码:料盒内所有物料条码
*/
private Map<String, Barcode> subCodeMap;
private List<Barcode> subCodeList;
/**
* 是否是锡膏
......@@ -401,12 +405,38 @@ public class Barcode extends BasePo implements Serializable {
}
// 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);
// }
// }
public Barcode getSubCode(String pnStr) {
if (subCodeMap == null) {
if (subCodeList == null) {
return null;
}
for (Barcode barcode :subCodeMap.values()
) {
for (Barcode barcode : subCodeList
) {
if (barcode.getPartNumber().equals(pnStr)) {
return barcode;
}
......@@ -416,15 +446,26 @@ public class Barcode extends BasePo implements Serializable {
public void UpdateSubCode(Barcode barcode) {
if (subCodeMap == null) {
subCodeMap = new HashMap<>();
if (subCodeList == null) {
subCodeList = Lists.newArrayList();
}
if (barcode.getAmount() <= 0) {
if (subCodeMap.containsKey(barcode.getBarcode())) {
subCodeMap.remove(barcode.getBarcode());
int index=-1;
for (int i=0;i<subCodeList.size();i++){
if(subCodeList.get(i).getBarcode().equals(barcode.barcode)){
index=i;
break;
}
}
if (barcode.getAmount() <= 0) {
if(index>=0){
subCodeList.remove(index);
}
} else {
subCodeMap.put(barcode.getBarcode(), barcode);
if(index>=0){
subCodeList.set(index,barcode);
}else{
subCodeList.add(barcode);
}
}
}
}
......@@ -92,26 +92,27 @@ public class XLCBoxHandler extends BaseDeviceHandler {
boolean isEx=pos.isExpandPos();
if ((!pos.isExpandPos()) && (pos.getBarcode() != null)) {
List< XLCPosBarcodeDto> list = new ArrayList<>();
if (pos.getBarcode().getSubCodeMap() != null) {
Set<String> keys = pos.getBarcode().getSubCodeMap().keySet();
for (String key :
keys) {
Barcode barcode = pos.getBarcode().getSubCodeMap().get(key);
if (pos.getBarcode().getSubCodeList() != null) {
// Set<String> keys = pos.getBarcode().getSubCodeMap().keySet();
for (Barcode barcode :
pos.getBarcode().getSubCodeList()) {
// Barcode barcode = pos.getBarcode().getSubCodeMap().get(key);
list.add( toPosBarcodeDto(barcode));
}
}
if(list.size()<=0) {
Random r = new Random();
int num = r.nextInt(10) ;
for (int i = 1; i <= num; i++) {
XLCPosBarcodeDto dto1 = toPosBarcodeDto(pos.getBarcode());
dto1.setBarcode(i+ dto1.getBarcode());
dto1.setAmount(i * 1111);
list.add(dto1);
}
}
// if(list.size()<=0) {
// Random r = new Random();
// int num = r.nextInt(10) ;
// if(num>=3){
// for (int i = 1; i <= num; i++) {
// XLCPosBarcodeDto dto1 = toPosBarcodeDto(pos.getBarcode());
// dto1.setBarcode(i * 1111 + "-" + dto1.getBarcode());
// dto1.setPartNumber(i * 1111 + "-" + dto1.getPartNumber());
// dto1.setAmount(i * 1111);
// list.add(dto1);
// }
// }
// }
XLCPosBarcodeDto barcodeDto = toPosBarcodeDto(pos.getBarcode());
barcodeDto.setSubCodeList(list);
......
......@@ -83,8 +83,11 @@ public class MaterialBoxController {
}
BarcodeDto barcodeDto=barcodeMapper.toDto(barcode);
if(barcodeDto.getSubCodeMap()==null){
barcodeDto.setSubCodeMap(new HashMap<>());
// if(barcodeDto.getSubCodeMap()==null){
// barcodeDto.setSubCodeMap(new HashMap<>());
// }
if(barcodeDto.getSubCodeList()==null){
barcodeDto.setSubCodeList(new ArrayList<>());
}
return barcodeDto;
}
......@@ -154,11 +157,11 @@ public class MaterialBoxController {
//料盒不存在
throw new ValidateException("smfcore.materialBox.invalid", "未找到料盒信息{0}", new String[]{code});
}
if(barcode.getSubCodeMap()==null||barcode.getSubCodeMap().size()<=0){
if(barcode.getSubCodeList()==null||barcode.getSubCodeList().size()<=0){
//料盒中未找到对应物料
throw new ValidateException("smfcore.materialBox.boxNoReel","料盒中无物料");
}
List<Barcode> barcodes=new ArrayList<>(barcode.getSubCodeMap().values()) ;
List<Barcode> barcodes=new ArrayList<>(barcode.getSubCodeList() ) ;
for (Barcode subBarcode :
barcodes) {
......@@ -182,30 +185,29 @@ public class MaterialBoxController {
DataLog currentTask=null;
Barcode barcode=barcodeManager.findByBarcode(code);
if(barcode==null){
throw new ValidateException("smfcore.materialBox.invalid", "未找到料盒信息{0}", new String[]{code});
}
//用+或-分割,如果最后几位是数量,按手动输入处理
String[] codeArray = operageStr.split("-");
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];
opQty = Integer.valueOf(codeArray[1].trim());
pnStr = codeArray[0].trim();
opType = OP .CHECKOUT;
}catch (Exception e){
}
}
if(opType == OP.NON_OP){
codeArray = operageStr.split("\\+");
codeArray = operageStr.split(" \\+");
if(codeArray.length == 2){
try{
opQty = Integer.valueOf(codeArray[1]);
pnStr = codeArray[0];
opQty = Integer.valueOf(codeArray[1].trim());
pnStr = codeArray[0].trim();
opType = OP.PUT_IN;
}catch (Exception e){
......
......@@ -11,7 +11,7 @@ import java.util.List;
@Data
public class StoragePosQueryCriteria {
@QueryCondition(blurry = "barcode.partNumber,barcode.barcode,posName")
@QueryCondition(blurry = "barcode.partNumber,barcode.barcode,posName,barcode.subCodeList.barcode,barcode.subCodeList.partNumber")
private String blurry;
@QueryCondition(type = QueryCondition.Type.BETWEEN, propName = "updateDate")
......
......@@ -156,6 +156,10 @@ public class TaskController {
@PreAuthorize("@el.check('taskLog')")
public ResponseEntity<Object> cancel(@RequestBody Set<String> ids){
for (String taskId : ids) {
DataLog task = dataLogManager.get(taskId);
if(task.isCancel()||task.isFinished()||task.isEnd()){
throw new ValidateException("smfcore.taskHasEnd","任务{0}已取消或已结束",new String[]{task.getPosName()} );
}
taskService.cancelTask(taskId);
}
return new ResponseEntity<>(HttpStatus.OK);
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!