Commit 9cf9c5d5 LN

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

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