|
@@ -1,6 +1,7 @@
|
|
|
package com.jeeplus.modules.sg.managementcenter.materialplan.util;
|
|
|
import com.jeeplus.modules.sg.managementcenter.materialplan.entity.InventoryTable;
|
|
|
import com.jeeplus.modules.sg.managementcenter.materialplan.entity.MaterialPlan;
|
|
|
+import com.jeeplus.modules.sg.managementcenter.materialplan.entity.Storage;
|
|
|
import groovy.util.IFileNameFinder;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.poi.ss.formula.functions.T;
|
|
@@ -15,9 +16,13 @@ public class MaterialPlanInfo {
|
|
|
public static final Integer MATER_TWO = 2;
|
|
|
public static final Integer MATER_THREE = 3;
|
|
|
public static final Integer MATER_FOUR = 4;
|
|
|
- public static final String MATER_CODE = "物资唯一编码";
|
|
|
+ public static final String MATER_CODE = "物资唯一码";
|
|
|
public static final String MATER_CODETWO = "批次编码";
|
|
|
public static final String MATER_NUMBER = "序号";
|
|
|
+ public static final String MATER_FLAG = "入库";
|
|
|
+ public static final String MATER_MATERIAL="物料";
|
|
|
+ public static final String MATER_YES = "是";
|
|
|
+ public static final String MATER_NO = "否";
|
|
|
// public static final String MATER_STORAGE = "是否入库";
|
|
|
// public static final String MATER_COUNT = "库存数量";
|
|
|
// public static final String MATER_DONGCOUNT = "冻结数量";
|
|
@@ -84,30 +89,73 @@ public class MaterialPlanInfo {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 导入是否入库
|
|
|
+ */
|
|
|
+ public static List<Storage> getFlagStorage(ImportUtil importUtil) {
|
|
|
+ int lastRow = importUtil.getLastDataRowNum();
|
|
|
+ List<Storage> list = new ArrayList<Storage>();
|
|
|
+ Storage storage = null;
|
|
|
+ String uniqueCode="";//费用估算
|
|
|
+ for(int i=1; i<lastRow;i++){
|
|
|
+ storage = new Storage();
|
|
|
+ Row row = importUtil.getRow(i);
|
|
|
+ uniqueCode = (String)importUtil.getCellValue(row,0);
|
|
|
+ if (StringUtils.isNotBlank(uniqueCode)){
|
|
|
+ storage.setUniqueCode(uniqueCode);
|
|
|
+ storage.setFlagStorage((String)importUtil.getCellValue(row,1));
|
|
|
+ list.add(storage);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+ /**
|
|
|
* 判断excel是哪张表
|
|
|
* @return
|
|
|
*/
|
|
|
public static Integer getJudgeExcel(ImportUtil importUtil){
|
|
|
Row row = importUtil.getRow(0);
|
|
|
String firstName = (String) importUtil.getCellValue(row,0);
|
|
|
+ String basicTwoName = (String) importUtil.getCellValue(row,2);
|
|
|
+ String twoName = (String)importUtil.getCellValue(row,1);
|
|
|
+ String fourName = (String)importUtil.getCellValue(row,4);
|
|
|
if (firstName.contains(MATER_CODE)||firstName.contains(MATER_CODETWO)){
|
|
|
- return MATER_ONE;
|
|
|
+ if (basicTwoName.contains(MATER_MATERIAL)){
|
|
|
+ return MATER_ONE;
|
|
|
+ }
|
|
|
+ if (twoName.contains(MATER_FLAG)){
|
|
|
+ return MATER_THREE;
|
|
|
+ }
|
|
|
}
|
|
|
- if (firstName.contains(MATER_NUMBER)){
|
|
|
+ if (firstName.contains(MATER_NUMBER)&&fourName.contains(MATER_MATERIAL)){
|
|
|
return MATER_TWO;
|
|
|
}
|
|
|
return MATER_FOUR;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 获取新的数据系列
|
|
|
+ * 判断是否入库符合规范
|
|
|
+ * @param importUtil
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public static boolean getJudeStorage(ImportUtil importUtil){
|
|
|
+ boolean flag = false;
|
|
|
+ List<Storage> flagStorage = MaterialPlanInfo.getFlagStorage(importUtil);
|
|
|
+ if (null!=flagStorage&&flagStorage.size()>0){
|
|
|
+ for (Storage storage:flagStorage){
|
|
|
+ if (!storage.getFlagStorage().equals(MATER_YES)&&!storage.getFlagStorage().equals(MATER_NO)){
|
|
|
+ flag = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return flag;
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 获取库存数据
|
|
|
* @return
|
|
|
*/
|
|
|
public static List<MaterialPlan> getUpdateMaterPlan(List<MaterialPlan> materialPlanList,ImportUtil importUtil){
|
|
|
List<InventoryTable> inventoryTableList = MaterialPlanInfo.getInventoryTableUtil(importUtil);
|
|
|
- for (InventoryTable inventoryTable:inventoryTableList){
|
|
|
- System.out.println(inventoryTable);
|
|
|
- }
|
|
|
for (MaterialPlan materialPlan:materialPlanList){
|
|
|
for (InventoryTable inventoryTable:inventoryTableList){
|
|
|
if (materialPlan.getUniqueCode().equals(inventoryTable.getUniqueCode())){
|
|
@@ -116,12 +164,28 @@ public class MaterialPlanInfo {
|
|
|
materialPlan.setSupplierName(inventoryTable.getSupplierName());
|
|
|
}
|
|
|
}
|
|
|
- System.out.println("qweqweqw====="+materialPlan);
|
|
|
}
|
|
|
return materialPlanList;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 获取是否入库数据
|
|
|
+ * @param materialPlanList
|
|
|
+ * @param importUtil
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public static List<MaterialPlan> getUpdateMaterPlanStorage(List<MaterialPlan> materialPlanList,ImportUtil importUtil){
|
|
|
+ List<Storage> flagStorage = MaterialPlanInfo.getFlagStorage(importUtil);
|
|
|
+ for (MaterialPlan materialPlan:materialPlanList){
|
|
|
+ for (Storage storage:flagStorage){
|
|
|
+ if (materialPlan.getUniqueCode().equals(storage.getUniqueCode())){
|
|
|
+ materialPlan.setFlagStorage(storage.getFlagStorage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return materialPlanList;
|
|
|
+ }
|
|
|
+ /**
|
|
|
* 生成随机数
|
|
|
* @return
|
|
|
*/
|