|
@@ -1,13 +1,17 @@
|
|
|
package com.imcs.admin.common.wmspolicy.impl;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.imcs.admin.common.BeanCopyUtil;
|
|
|
+import com.imcs.admin.common.ListUtils;
|
|
|
import com.imcs.admin.common.Result;
|
|
|
import com.imcs.admin.common.wmspolicy.ImportOrExportPolicy;
|
|
|
-import com.imcs.admin.entity.assemble.PolicyInputPar;
|
|
|
-import com.imcs.admin.entity.assemble.PolicyMovePar;
|
|
|
-import com.imcs.admin.entity.assemble.PolicyOutPar;
|
|
|
+import com.imcs.admin.entity.assemble.*;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
/**
|
|
|
* 先进后出
|
|
|
*/
|
|
@@ -33,6 +37,33 @@ public class ImportOrExportXjhc implements ImportOrExportPolicy {
|
|
|
@Override
|
|
|
public Result exportPolicy(PolicyOutPar outPar) {
|
|
|
log.info("======================wms先进后出出库策略======================");
|
|
|
- return null;
|
|
|
+ Integer materialNumber = ListUtils.isEmpty(outPar.getRequiredMaterialDetailDtoList())?0 : outPar.getRequiredMaterialDetailDtoList().get(0).getMaterialNumber() ==null ? 0:outPar.getRequiredMaterialDetailDtoList().get(0).getMaterialNumber();
|
|
|
+
|
|
|
+ List<WInventoryManagementGroup> wInventoryManagementGroupList = outPar.getWInventoryManagementGroupList();
|
|
|
+
|
|
|
+ // 排序优先出内道- 增加这个使用在空托盘时候,下面按照时间排序的不生效
|
|
|
+ wInventoryManagementGroupList.sort(((a,b)->{
|
|
|
+ return a.getDistanceRoadwayNumber()-b.getDistanceRoadwayNumber();
|
|
|
+ }));
|
|
|
+
|
|
|
+ wInventoryManagementGroupList.sort(((a,b)->{
|
|
|
+ long l = (b.getCreatedAtSub() == null ? new Date() : b.getCreatedAtSub()).getTime() - (a.getCreatedAtSub() == null ? new Date() : a.getCreatedAtSub()).getTime();
|
|
|
+ if(l>0)return 1 ;else return -1;
|
|
|
+ }));
|
|
|
+
|
|
|
+ List<PolicyOutResult> manZu = ListUtils.newArrayList();
|
|
|
+ List<PolicyOutResult> noManZu = ListUtils.newArrayList();
|
|
|
+
|
|
|
+ for (WInventoryManagementGroup wInventoryManagementGroup : wInventoryManagementGroupList) {
|
|
|
+ PolicyOutResult policyOutResult = BeanCopyUtil.copyPropertiesSet(wInventoryManagementGroup, PolicyOutResult::new);
|
|
|
+ wInventoryManagementGroup.setAmount(wInventoryManagementGroup.getAmount() == null ? 0 : wInventoryManagementGroup.getAmount());
|
|
|
+ if(wInventoryManagementGroup.getAmount()>= materialNumber){
|
|
|
+ manZu.add(policyOutResult);
|
|
|
+ }else {
|
|
|
+ noManZu.add(policyOutResult);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return Result.success(manZu, noManZu, "第一个data为满足需求,第二个为不满足需求");
|
|
|
}
|
|
|
}
|