编号生成添加部门限制

This commit is contained in:
zhanghan11 2024-06-19 09:00:41 +08:00
parent ded7a06072
commit d4874ef05f
15 changed files with 20 additions and 15 deletions

View File

@ -73,7 +73,7 @@ public interface IpcSparePartsInboundMapper
* 获取最新入库单号
* @return
*/
public int getInboundNum();
public int getInboundNum(Long deptId);
/**
* 批量新增备件入库明细

View File

@ -73,5 +73,5 @@ public interface IpcSparePartsInfoMapper
*
* @return 结果
*/
public int getPartsNum();
public int getPartsNum(Long deptId);
}

View File

@ -64,5 +64,5 @@ public interface IpcSparePartsInventoryMapper
*
* @return 结果
*/
public int getInventoryNum();
public int getInventoryNum(Long deptId);
}

View File

@ -74,7 +74,7 @@ public interface IpcSparePartsOutboundMapper
* 获取最新出库单号
* @return
*/
public int getOutboundNum();
public int getOutboundNum(Long deptId);
/**
* 批量新增备件出库明细

View File

@ -50,7 +50,7 @@ public interface IpcSparePartsStockMapper
* @return 结果
*/
public int updateIpcSparePartsStockSafeQuantityBySparepartsId(IpcSparePartsStock ipcSparePartsStock);
/**
* 删除备件库存
*
@ -81,7 +81,7 @@ public interface IpcSparePartsStockMapper
*
* @return 结果
*/
public int getStockNum();
public int getStockNum(Long deptId);
/**
* 库存更新
*/

View File

@ -86,7 +86,7 @@ public class IpcSparePartsInboundServiceImpl implements IIpcSparePartsInboundSer
@Transactional
public int insertIpcSparePartsInbound(IpcSparePartsInbound ipcSparePartsInbound) {
ipcSparePartsInbound.setId(IdUtils.fastSimpleUUID());
ipcSparePartsInbound.setSparePartsInboundNum(StringUtils.getNextNum(Constants.SPARE_PART_INBOUND_PREFIX, SecurityUtils.getDeptId(), ipcSparePartsInboundMapper.getInboundNum()));
ipcSparePartsInbound.setSparePartsInboundNum(StringUtils.getNextNum(Constants.SPARE_PART_INBOUND_PREFIX, SecurityUtils.getDeptId(), getInboundNum()));
ipcSparePartsInbound.setSubmitTime(new Date());
ipcSparePartsInbound.setOperatorId(SecurityUtils.getUserId());
insertIpcSparePartsInboundDetail(ipcSparePartsInbound);
@ -166,7 +166,7 @@ public class IpcSparePartsInboundServiceImpl implements IIpcSparePartsInboundSer
*/
@Override
public int getInboundNum() {
return ipcSparePartsInboundMapper.getInboundNum();
return ipcSparePartsInboundMapper.getInboundNum(SecurityUtils.getDeptId());
}

View File

@ -60,7 +60,7 @@ public class IpcSparePartsInfoServiceImpl implements IIpcSparePartsInfoService {
@Transactional
public int insertIpcSparePartsInfo(IpcSparePartsInfo ipcSparePartsInfo) {
ipcSparePartsInfo.setId(IdUtils.fastSimpleUUID());
ipcSparePartsInfo.setPartsNum(StringUtils.getNextNum(Constants.SPARE_PART_NUM_PREFIX, SecurityUtils.getDeptId(), ipcSparePartsInfoMapper.getPartsNum()));
ipcSparePartsInfo.setPartsNum(StringUtils.getNextNum(Constants.SPARE_PART_NUM_PREFIX, SecurityUtils.getDeptId(), getPartsNum()));
ipcSparePartsInfo.setStatus(Constants.SPARE_PART_STATUS_NORMAL);
ipcSparePartsInfo.setCreateTime(DateUtils.getNowDate());
ipcSparePartsInfo.getIpcSparePartsStock().setSparePartsId(ipcSparePartsInfo.getId());
@ -112,7 +112,7 @@ public class IpcSparePartsInfoServiceImpl implements IIpcSparePartsInfoService {
*/
@Override
public int getPartsNum(){
return ipcSparePartsInfoMapper.getPartsNum();
return ipcSparePartsInfoMapper.getPartsNum(SecurityUtils.getDeptId());
}
/**

View File

@ -126,7 +126,7 @@ public class IpcSparePartsInventoryServiceImpl implements IIpcSparePartsInventor
*/
@Override
public int getInventoryNum() {
return ipcSparePartsInventoryMapper.getInventoryNum();
return ipcSparePartsInventoryMapper.getInventoryNum(SecurityUtils.getDeptId());
}
/**

View File

@ -84,7 +84,7 @@ public class IpcSparePartsOutboundServiceImpl implements IIpcSparePartsOutboundS
@Transactional
public int insertIpcSparePartsOutbound(IpcSparePartsOutbound ipcSparePartsOutbound) {
ipcSparePartsOutbound.setId(IdUtils.fastSimpleUUID());
ipcSparePartsOutbound.setSparePartsOutboundNum(StringUtils.getNextNum(Constants.SPARE_PART_OUTBOUND_PREFIX, SecurityUtils.getDeptId(), ipcSparePartsOutboundMapper.getOutboundNum()));
ipcSparePartsOutbound.setSparePartsOutboundNum(StringUtils.getNextNum(Constants.SPARE_PART_OUTBOUND_PREFIX, SecurityUtils.getDeptId(), getOutboundNum()));
ipcSparePartsOutbound.setSubmitTime(new Date());
ipcSparePartsOutbound.setOperatorId(SecurityUtils.getUserId());
insertIpcSparePartsOutboundDetail(ipcSparePartsOutbound);
@ -165,7 +165,7 @@ public class IpcSparePartsOutboundServiceImpl implements IIpcSparePartsOutboundS
*/
@Override
public int getOutboundNum() {
return ipcSparePartsOutboundMapper.getOutboundNum();
return ipcSparePartsOutboundMapper.getOutboundNum(SecurityUtils.getDeptId());
}
/**

View File

@ -58,7 +58,7 @@ public class IpcSparePartsStockServiceImpl implements IIpcSparePartsStockService
public int insertIpcSparePartsStock(IpcSparePartsStock ipcSparePartsStock)
{
ipcSparePartsStock.setId(IdUtils.fastSimpleUUID());
ipcSparePartsStock.setStockNum(StringUtils.getNextNum(Constants.SPARE_PART_STOCK_PREFIX, SecurityUtils.getDeptId(), ipcSparePartsStockMapper.getStockNum()));
ipcSparePartsStock.setStockNum(StringUtils.getNextNum(Constants.SPARE_PART_STOCK_PREFIX, SecurityUtils.getDeptId(), getStockNum()));
return ipcSparePartsStockMapper.insertIpcSparePartsStock(ipcSparePartsStock);
}
@ -125,7 +125,7 @@ public class IpcSparePartsStockServiceImpl implements IIpcSparePartsStockService
*/
@Override
public int getStockNum(){
return ipcSparePartsStockMapper.getStockNum();
return ipcSparePartsStockMapper.getStockNum(SecurityUtils.getDeptId());
}
/**
* 库存更新

View File

@ -197,6 +197,7 @@
SELECT IFNULL(MAX(RIGHT (spare_parts_inbound_num, 4)), 0) + 0
FROM ipc_spare_parts_inbound
WHERE DATE (SYSDATE()) = DATE (submit_time)
AND dept_id = #{deptId}
</select>
<delete id="deleteIpcSparePartsInboundDetailBySparePartsInboundId" parameterType="String">

View File

@ -190,6 +190,7 @@
FROM ipc_spare_parts_info
WHERE status &lt;> '2'
AND DATE (SYSDATE()) = DATE (create_time)
AND dept_id = #{deptId}
</select>
<select id="selectIpcSparePartsStockExportList" parameterType="com.inspur.spareparts.domain.IpcSparePartsInfo"

View File

@ -135,5 +135,6 @@
SELECT IFNULL(MAX(RIGHT(inventory_num,4)),0)+0
FROM ipc_spare_parts_inventory
WHERE DATE (SYSDATE()) = DATE (create_time)
AND dept_id = #{deptId}
</select>
</mapper>

View File

@ -221,6 +221,7 @@
SELECT IFNULL(MAX(RIGHT (spare_parts_outbound_num, 4)), 0) + 0
FROM ipc_spare_parts_outbound
WHERE DATE (SYSDATE()) = DATE (submit_time)
AND dept_id = #{deptId}
</select>
<delete id="deleteIpcSparePartsOutboundDetailBySparePartsOutboundId" parameterType="String">

View File

@ -103,6 +103,7 @@
inner join ipc_spare_parts_stock s on i.id = s.spare_parts_id
WHERE i.status &lt;> '2'
AND DATE (SYSDATE()) = DATE (i.create_time)
AND s.dept_id = #{deptId}
</select>
<update id="updateStock" parameterType="com.inspur.spareparts.domain.IpcSparePartsStock">
update ipc_spare_parts_stock