|
@@ -1,4 +1,5 @@
|
|
|
package com.jeeplus.modules.sg.managementcenter.materialplan.util;
|
|
|
+import com.jeeplus.common.utils.excel.ImportExcel;
|
|
|
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;
|
|
@@ -15,7 +16,6 @@ public class MaterialPlanInfo {
|
|
|
public static final Integer MATER_ONE = 1;
|
|
|
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_CODETWO = "批次编码";
|
|
|
public static final String MATER_NUMBER = "序号";
|
|
@@ -59,15 +59,6 @@ public class MaterialPlanInfo {
|
|
|
}
|
|
|
materialPlan.setUtil((String)importUtil.getCellValue(row,9));
|
|
|
materialPlan.setPlanToBatch((String)importUtil.getCellValue(row,10));
|
|
|
-// materialPlan.setFlagStorage((String)importUtil.getCellValue(row,12));
|
|
|
-// inventoryQuantity = (String)importUtil.getCellValue(row,13);
|
|
|
-// if (null!=inventoryQuantity&&!inventoryQuantity.equals("")){
|
|
|
-// materialPlan.setInventoryQuantity(new Double((String)importUtil.getCellValue(row,13)));
|
|
|
-// }
|
|
|
-// numberFrozen = (String)importUtil.getCellValue(row,14);
|
|
|
-// if (null!=numberFrozen&&!inventoryQuantity.equals("")){
|
|
|
-// materialPlan.setNumberFrozen(new Double((String)importUtil.getCellValue(row,14)));
|
|
|
-// }
|
|
|
// materialPlan.setSupplierName((String)importUtil.getCellValue(row,15));
|
|
|
list.add(materialPlan);
|
|
|
}
|
|
@@ -91,8 +82,8 @@ public class MaterialPlanInfo {
|
|
|
uniqueCode = (String)importUtil.getCellValue(row,3);
|
|
|
if (StringUtils.isNotBlank(uniqueCode)){
|
|
|
inventoryTable.setUniqueCode(uniqueCode);
|
|
|
- inventoryTable.setInventoryQuantity((String)importUtil.getCellValue(row,7));
|
|
|
- inventoryTable.setNumberFrozen((String)importUtil.getCellValue(row,9));
|
|
|
+ inventoryTable.setInventoryQuantity(new Double((String)importUtil.getCellValue(row,7)));
|
|
|
+ inventoryTable.setNumberFrozen(new Double((String)importUtil.getCellValue(row,9)));
|
|
|
inventoryTable.setSupplierName((String)importUtil.getCellValue(row,15));
|
|
|
list.add(inventoryTable);
|
|
|
}
|
|
@@ -101,26 +92,6 @@ 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
|
|
|
*/
|
|
@@ -134,68 +105,28 @@ public class MaterialPlanInfo {
|
|
|
if (basicTwoName.contains(MATER_MATERIAL)){
|
|
|
return MATER_ONE;
|
|
|
}
|
|
|
- if (twoName.contains(MATER_FLAG)){
|
|
|
- return MATER_THREE;
|
|
|
- }
|
|
|
}
|
|
|
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 (MaterialPlan materialPlan:materialPlanList){
|
|
|
- for (InventoryTable inventoryTable:inventoryTableList){
|
|
|
- if (materialPlan.getUniqueCode().equals(inventoryTable.getUniqueCode())){
|
|
|
- materialPlan.setInventoryQuantity(new Double(inventoryTable.getInventoryQuantity()));
|
|
|
- materialPlan.setNumberFrozen(new Double(inventoryTable.getNumberFrozen()));
|
|
|
- materialPlan.setSupplierName(inventoryTable.getSupplierName());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- return materialPlanList;
|
|
|
+ return MATER_THREE;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取是否入库数据
|
|
|
- * @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());
|
|
|
- }
|
|
|
+ public static List<InventoryTable> getUpdateMaterPlan(ImportUtil importUtil){
|
|
|
+ List<InventoryTable> inventoryTableList = MaterialPlanInfo.getInventoryTableUtil(importUtil);
|
|
|
+ for (InventoryTable inventoryTable:inventoryTableList){
|
|
|
+ if (inventoryTable.getInventoryQuantity()+inventoryTable.getNumberFrozen()>0){
|
|
|
+ inventoryTable.setFlagStorage("是");
|
|
|
+ }else {
|
|
|
+ inventoryTable.setFlagStorage("否");
|
|
|
}
|
|
|
}
|
|
|
- return materialPlanList;
|
|
|
+ return inventoryTableList;
|
|
|
}
|
|
|
/**
|
|
|
* 生成随机数
|
|
@@ -209,5 +140,4 @@ public class MaterialPlanInfo {
|
|
|
}
|
|
|
return (machineId+String.format("%015d",hashCodeV));
|
|
|
}
|
|
|
-
|
|
|
}
|