|
|
@ -8,6 +8,7 @@ import java.util.HashMap;
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
import com.os.common.exception.ServiceException;
|
|
|
|
import com.os.common.exception.ServiceException;
|
|
|
|
import com.os.common.utils.StringUtils;
|
|
|
|
import com.os.common.utils.StringUtils;
|
|
|
|
import com.os.ems.info.mapper.SparePartsInventoryMapper;
|
|
|
|
import com.os.ems.info.mapper.SparePartsInventoryMapper;
|
|
|
@ -16,6 +17,7 @@ import com.os.ems.info.domain.SparePartsInventory;
|
|
|
|
import com.os.ems.info.domain.SparePartsInventoryCheck;
|
|
|
|
import com.os.ems.info.domain.SparePartsInventoryCheck;
|
|
|
|
import com.os.ems.info.domain.SparePartsInventoryExportVO;
|
|
|
|
import com.os.ems.info.domain.SparePartsInventoryExportVO;
|
|
|
|
import com.os.ems.info.service.ISparePartsInventoryService;
|
|
|
|
import com.os.ems.info.service.ISparePartsInventoryService;
|
|
|
|
|
|
|
|
import com.os.ems.info.util.InventoryQuantityUpdater;
|
|
|
|
import com.os.common.utils.DateUtils;
|
|
|
|
import com.os.common.utils.DateUtils;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -33,6 +35,9 @@ public class SparePartsInventoryServiceImpl implements ISparePartsInventoryServi
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private SparePartsInventoryCheckMapper sparePartsInventoryCheckMapper;
|
|
|
|
private SparePartsInventoryCheckMapper sparePartsInventoryCheckMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private InventoryQuantityUpdater inventoryQuantityUpdater;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 查询备件库记录主
|
|
|
|
* 查询备件库记录主
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -262,15 +267,13 @@ public class SparePartsInventoryServiceImpl implements ISparePartsInventoryServi
|
|
|
|
check.setInventoryObjid(objid);
|
|
|
|
check.setInventoryObjid(objid);
|
|
|
|
check.setCheckName(entry.getKey());
|
|
|
|
check.setCheckName(entry.getKey());
|
|
|
|
check.setCheckQuantity(entry.getValue());
|
|
|
|
check.setCheckQuantity(entry.getValue());
|
|
|
|
check.setCheckDate(DateUtils.getNowDate().toString());
|
|
|
|
check.setCheckDate(DateUtils.dateTimeNow());
|
|
|
|
sparePartsInventoryCheckMapper.insertSparePartsInventoryCheck(check);
|
|
|
|
sparePartsInventoryCheckMapper.insertSparePartsInventoryCheck(check);
|
|
|
|
|
|
|
|
|
|
|
|
// 更新主表的剩余数量为最新盘点数量
|
|
|
|
|
|
|
|
main.setObjid(objid);
|
|
|
|
|
|
|
|
main.setRemainingQuantity(entry.getValue());
|
|
|
|
|
|
|
|
sparePartsInventoryMapper.updateSparePartsInventory(main);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 盘点记录插入后,更新主表的剩余数量为最新盘点数量
|
|
|
|
|
|
|
|
inventoryQuantityUpdater.updateRemainingQuantityByLatestCheck(objid);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
successNum++;
|
|
|
|
successNum++;
|
|
|
@ -382,6 +385,7 @@ public class SparePartsInventoryServiceImpl implements ISparePartsInventoryServi
|
|
|
|
* @return 结果
|
|
|
|
* @return 结果
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
|
|
|
|
@Transactional
|
|
|
|
public int insertSparePartsInventoryWithDynamicColumns(SparePartsInventoryExportVO sparePartsInventoryVO)
|
|
|
|
public int insertSparePartsInventoryWithDynamicColumns(SparePartsInventoryExportVO sparePartsInventoryVO)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// 创建主记录
|
|
|
|
// 创建主记录
|
|
|
@ -400,10 +404,13 @@ public class SparePartsInventoryServiceImpl implements ISparePartsInventoryServi
|
|
|
|
check.setInventoryObjid(objid);
|
|
|
|
check.setInventoryObjid(objid);
|
|
|
|
check.setCheckName(entry.getKey());
|
|
|
|
check.setCheckName(entry.getKey());
|
|
|
|
check.setCheckQuantity(entry.getValue());
|
|
|
|
check.setCheckQuantity(entry.getValue());
|
|
|
|
check.setCheckDate(DateUtils.getNowDate().toString());
|
|
|
|
check.setCheckDate(DateUtils.dateTimeNow());
|
|
|
|
sparePartsInventoryCheckMapper.insertSparePartsInventoryCheck(check);
|
|
|
|
sparePartsInventoryCheckMapper.insertSparePartsInventoryCheck(check);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 在盘点记录插入后,更新主表的剩余数量为最新盘点数量
|
|
|
|
|
|
|
|
inventoryQuantityUpdater.updateRemainingQuantityByLatestCheck(objid);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
return result;
|
|
|
@ -416,6 +423,7 @@ public class SparePartsInventoryServiceImpl implements ISparePartsInventoryServi
|
|
|
|
* @return 结果
|
|
|
|
* @return 结果
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
|
|
|
|
@Transactional
|
|
|
|
public int updateSparePartsInventoryWithDynamicColumns(SparePartsInventoryExportVO sparePartsInventoryVO)
|
|
|
|
public int updateSparePartsInventoryWithDynamicColumns(SparePartsInventoryExportVO sparePartsInventoryVO)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// 更新主记录
|
|
|
|
// 更新主记录
|
|
|
@ -443,11 +451,14 @@ public class SparePartsInventoryServiceImpl implements ISparePartsInventoryServi
|
|
|
|
check.setInventoryObjid(objid);
|
|
|
|
check.setInventoryObjid(objid);
|
|
|
|
check.setCheckName(entry.getKey());
|
|
|
|
check.setCheckName(entry.getKey());
|
|
|
|
check.setCheckQuantity(entry.getValue());
|
|
|
|
check.setCheckQuantity(entry.getValue());
|
|
|
|
check.setCheckDate(DateUtils.getNowDate().toString());
|
|
|
|
check.setCheckDate(DateUtils.dateTimeNow());
|
|
|
|
sparePartsInventoryCheckMapper.insertSparePartsInventoryCheck(check);
|
|
|
|
sparePartsInventoryCheckMapper.insertSparePartsInventoryCheck(check);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 在盘点记录更新后,同步更新主表的剩余数量为最新盘点数量
|
|
|
|
|
|
|
|
inventoryQuantityUpdater.updateRemainingQuantityByLatestCheck(objid);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
return result;
|
|
|
|