Commit 733890f5 zshaohui

1.按入库时间进行先进先出

1 个父辈 6c4790d3
...@@ -266,12 +266,29 @@ public class MaterialBoxController { ...@@ -266,12 +266,29 @@ public class MaterialBoxController {
} }
} }
//设置barcode的入库时间
long putInTime = barcode.getPutInTime();
if (putInTime == -1){
putInTime = System.currentTimeMillis();
}
barcode.setPutInTime(putInTime);
barcodeManager.save(barcode);
//设置料盒的数量 //设置料盒的数量
int amount = barcode.getAmount(); int amount = barcode.getAmount();
String partNumber = barcode.getPartNumber(); String partNumber = barcode.getPartNumber();
boxBarcode.setPartNumber(partNumber); boxBarcode.setPartNumber(partNumber);
boxBarcode.setAmount(amount+boxBarcode.getAmount()); boxBarcode.setAmount(amount+boxBarcode.getAmount());
//设置治具盒的入库时间
long boxPutInTime = boxBarcode.getPutInTime();
if (boxPutInTime == -1){
boxPutInTime = System.currentTimeMillis();
}
if (boxPutInTime > putInTime){
boxPutInTime = putInTime;
}
boxBarcode.setPutInTime(boxPutInTime);
barcodeManager.save(boxBarcode); barcodeManager.save(boxBarcode);
......
...@@ -365,19 +365,19 @@ public class StoragePosManagerImpl implements IStoragePosManager { ...@@ -365,19 +365,19 @@ public class StoragePosManagerImpl implements IStoragePosManager {
public Sort getSortByCheckOutType(CHECKOUT_TYPE checkoutType){ public Sort getSortByCheckOutType(CHECKOUT_TYPE checkoutType){
Sort sort = null; Sort sort = null;
if(CHECKOUT_TYPE.EXPIRE_FIRST.equals(checkoutType)){//先过期先出 if(CHECKOUT_TYPE.EXPIRE_FIRST.equals(checkoutType)){//先过期先出
sort = Sort.by(Sort.Direction.ASC, "barcode.expTime","barcode.expireDate","barcode.putInDate"); sort = Sort.by(Sort.Direction.ASC, "barcode.expTime","barcode.expireDate","barcode.putInTime");
}else if(CHECKOUT_TYPE.FIFO.equals(checkoutType)){//严格的先进先出 }else if(CHECKOUT_TYPE.FIFO.equals(checkoutType)){//严格的先进先出
sort = Sort.by(Sort.Direction.ASC, "barcode.putInDate", "barcode.usedCount"); sort = Sort.by(Sort.Direction.ASC, "barcode.putInTime", "barcode.usedCount");
}else if(CHECKOUT_TYPE.USED_FIRST.equals(checkoutType)){//尾料优先 }else if(CHECKOUT_TYPE.USED_FIRST.equals(checkoutType)){//尾料优先
sort = Sort.by(Sort.Direction.ASC, "barcode.amount", "barcode.putInDate"); sort = Sort.by(Sort.Direction.ASC, "barcode.amount", "barcode.putInTime");
}else if(CHECKOUT_TYPE.PRODUCE_DATE.equals(checkoutType)){ }else if(CHECKOUT_TYPE.PRODUCE_DATE.equals(checkoutType)){
//先生产先出 //先生产先出
sort = Sort.by(Sort.Direction.ASC, "barcode.produceDate","barcode.amount", "barcode.putInDate"); sort = Sort.by(Sort.Direction.ASC, "barcode.produceDate","barcode.amount", "barcode.putInTime");
}else if(CHECKOUT_TYPE.BATCH_FIRST.equals(checkoutType)){ }else if(CHECKOUT_TYPE.BATCH_FIRST.equals(checkoutType)){
//批次优先 //批次优先
sort = Sort.by(Sort.Direction.ASC, "barcode.batch","barcode.produceDate","barcode.amount", "barcode.putInDate"); sort = Sort.by(Sort.Direction.ASC, "barcode.batch","barcode.produceDate","barcode.amount", "barcode.putInTime");
}else{//效率优先 }else{//效率优先
sort = Sort.by(Sort.Direction.ASC, "barcode.putInDate", "createDate"); sort = Sort.by(Sort.Direction.ASC, "barcode.putInTime", "createDate");
} }
return sort; return sort;
} }
......
...@@ -503,12 +503,26 @@ public class JkemController { ...@@ -503,12 +503,26 @@ public class JkemController {
if (barcode == null){ if (barcode == null){
return ResultBean.newErrorResult(-1,"smfcore.error.barcode.noValidCode", "无效的条码"); return ResultBean.newErrorResult(-1,"smfcore.error.barcode.noValidCode", "无效的条码");
} }
long putInTime = barcode.getPutInTime();
if (putInTime == -1){
putInTime = System.currentTimeMillis();
}
Barcode newBarcode = new Barcode();
newBarcode.setPutInTime(putInTime);
newBarcode.setAmount(barcode.getCheckingAmount());
newBarcode.setBarcode("RI"+System.currentTimeMillis());
newBarcode.setPartNumber(barcode.getPartNumber());
barcodeManager.save(newBarcode);
Map<String,Object> resultMap = new HashMap<>(); Map<String,Object> resultMap = new HashMap<>();
resultMap.put("barcode",barcode.getBarcode()); resultMap.put("barcode",barcode.getBarcode());
resultMap.put("partNumber",barcode.getPartNumber()); resultMap.put("partNumber",barcode.getPartNumber());
resultMap.put("amount",barcode.getAmount()); resultMap.put("amount",barcode.getAmount());
resultMap.put("checkingAmount",barcode.getCheckingAmount()); resultMap.put("checkingAmount",barcode.getCheckingAmount());
resultMap.put("orderNo",barcode.getOrderNo()); resultMap.put("orderNo",barcode.getOrderNo());
resultMap.put("checkingRi",newBarcode.getBarcode());
log.info("获取点料数量,barcode为:"+barcodeStr+",返回结果为:"+JSON.toJSONString(resultMap)); log.info("获取点料数量,barcode为:"+barcodeStr+",返回结果为:"+JSON.toJSONString(resultMap));
return ResultBean.newOkResult(resultMap); return ResultBean.newOkResult(resultMap);
} }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!