|
|
|
@ -243,6 +243,30 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
return packForMatieral(list); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 根据条件查询符合条件的物料信息(用于表格展示) |
|
|
|
* @param map 条件map |
|
|
|
* @return 符合条件的物料信息 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<Material> findMaterialPByConditionForTable(Map<String, Object> map) { |
|
|
|
Integer size = 10, page = 1; |
|
|
|
if (map.containsKey("size")) { |
|
|
|
size = ObjectFormatUtil.toInteger(map.get("size")); |
|
|
|
map.put("size", size); |
|
|
|
} |
|
|
|
if (map.containsKey("page")) { |
|
|
|
page = ObjectFormatUtil.toInteger(map.get("page")); |
|
|
|
map.put("begin", (page - 1) * size); |
|
|
|
} |
|
|
|
Object state = 1; |
|
|
|
if (map.containsKey("state")) { |
|
|
|
state = map.get("state"); |
|
|
|
} |
|
|
|
map.put("state", state); |
|
|
|
return materialMapper.findMaterialByCondition(map); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 根据物料名与物料规格型号查询对应的物料 |
|
|
|
* |
|
|
|
@ -786,48 +810,10 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
List<MaterialP> result = new ArrayList<>(list.size()); |
|
|
|
for (Material material : list) { |
|
|
|
MaterialP m = new MaterialP(material); |
|
|
|
Integer warningCount = 0; |
|
|
|
Integer depositoryId = material.getDepositoryId(); |
|
|
|
if (depositoryId != null) { |
|
|
|
m.setDepositoryName(depositoryMapper.findDepositoryNameById(depositoryId)); |
|
|
|
m.setWarehouseManager(depositoryMapper.findUserNameByDepositoryId(depositoryId)); |
|
|
|
} |
|
|
|
Long producedDate = material.getProducedDate(); |
|
|
|
if (producedDate != null) { |
|
|
|
m.setProducedDate(DateUtil.TimeStampToDateTimeForDay(producedDate)); |
|
|
|
} |
|
|
|
// 设置当前物料保质期的具体时间
|
|
|
|
Long calcShelfLife = 0L; |
|
|
|
|
|
|
|
String currentDate = DateUtil.getCurrentDate(); |
|
|
|
// 获取当天时间
|
|
|
|
Long nowDay = DateUtil.DateTimeByDayToTimeStamp(currentDate); |
|
|
|
Long life = material.getShelfLife(); |
|
|
|
if (life != null) { |
|
|
|
String shelfLife = String.valueOf(life); |
|
|
|
String dateType = shelfLife.substring(0, 1); |
|
|
|
String dateTime = shelfLife.substring(1); |
|
|
|
if ("1".equals(dateType)) { |
|
|
|
m.setShelfLife(dateTime + "年"); |
|
|
|
calcShelfLife = ObjectFormatUtil.toLong(dateTime) * 365 * DateUtil.dayTime; |
|
|
|
} else if ("2".equals(dateType)) { |
|
|
|
m.setShelfLife(dateTime + "月"); |
|
|
|
calcShelfLife = ObjectFormatUtil.toLong(dateTime) * 30 * DateUtil.dayTime; |
|
|
|
} else if ("3".equals(dateType)) { |
|
|
|
m.setShelfLife(dateTime + "天"); |
|
|
|
calcShelfLife = ObjectFormatUtil.toLong(dateTime) * DateUtil.dayTime; |
|
|
|
} |
|
|
|
// 获取当前没有使用完成的物料对应的生产日期对应
|
|
|
|
List<MaterialAndProducedDate> materialAndProducedDateByMid = materialMapper.findMaterialAndProducedDateByMid(m.getId()); |
|
|
|
for (MaterialAndProducedDate materialAndProducedDate : materialAndProducedDateByMid) { |
|
|
|
// 获取当前入库时的生产日期
|
|
|
|
Long producedDate1 = materialAndProducedDate.getProducedDate(); |
|
|
|
// 如果可使用时间(生产时间+保质期)减去当天时间 小于预警时间
|
|
|
|
if ((producedDate1 + calcShelfLife) - nowDay < DateUtil.warningTime) { |
|
|
|
warningCount += materialAndProducedDate.getInventory(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
List<SplitInfo> splitInfoByMid = splitUnitService.findSplitInfoByMid(m.getMid()); |
|
|
|
if(splitInfoByMid == null){ |
|
|
|
splitInfoByMid = new ArrayList<>(); |
|
|
|
@ -842,7 +828,6 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
MaterialType materialTypeByOldId = materialTypeMapper.findMaterialTypeByOldId(material.getMaterialTypeId()); |
|
|
|
m.setTypeName(materialTypeByOldId.getTname()); |
|
|
|
m.setTypeId(materialTypeByOldId.getOldId()); |
|
|
|
m.setWarningCount(warningCount); |
|
|
|
m.setQuantity(1); |
|
|
|
result.add(m); |
|
|
|
} |
|
|
|
@ -2920,10 +2905,12 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
if ("1".equals(type)) { |
|
|
|
// 如果是入库
|
|
|
|
materialByTypeIds = materialMapper.findMaterialByTypeIdsAndMname(paramForMnameAndMtid); |
|
|
|
} else if ("2".equals(type)) { |
|
|
|
} |
|
|
|
else if ("2".equals(type)) { |
|
|
|
// 如果是出库
|
|
|
|
inventoryByTypeIdsAndMname = materialMapper.findInventoryByTypeIdsAndMname(paramForMnameAndMtid); |
|
|
|
} else if ("3".equals(type)) { |
|
|
|
} |
|
|
|
else if ("3".equals(type)) { |
|
|
|
// 如果是盘点
|
|
|
|
List<Inventory> inventoryList = materialMapper.findInventoryByTypeIdsAndMname(paramForMnameAndMtid); |
|
|
|
|
|
|
|
|