|
@ -1,8 +1,14 @@ |
|
|
package com.ruoyi.warehouse.service.impl; |
|
|
package com.ruoyi.warehouse.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
import java.text.DecimalFormat; |
|
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
|
|
import java.util.Date; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
import com.ruoyi.common.exception.BusinessException; |
|
|
import com.ruoyi.common.utils.DateUtils; |
|
|
import com.ruoyi.common.utils.DateUtils; |
|
|
import com.ruoyi.common.utils.ShiroUtils; |
|
|
import com.ruoyi.common.utils.ShiroUtils; |
|
|
|
|
|
import com.ruoyi.common.utils.StringUtils; |
|
|
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 com.ruoyi.warehouse.mapper.WarehouseInventoryCheckMapper; |
|
|
import com.ruoyi.warehouse.mapper.WarehouseInventoryCheckMapper; |
|
@ -55,6 +61,14 @@ public class WarehouseInventoryCheckServiceImpl implements IWarehouseInventoryCh |
|
|
@Override |
|
|
@Override |
|
|
public int insertWarehouseInventoryCheck(WarehouseInventoryCheck warehouseInventoryCheck) |
|
|
public int insertWarehouseInventoryCheck(WarehouseInventoryCheck warehouseInventoryCheck) |
|
|
{ |
|
|
{ |
|
|
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
|
|
String prefix = "KCPD" + simpleDateFormat.format(new Date()).replace("-", ""); |
|
|
|
|
|
|
|
|
|
|
|
String maxCode = warehouseInventoryCheckMapper.findMaxRoundCode(prefix); |
|
|
|
|
|
|
|
|
|
|
|
String newCode = generateCode(prefix,maxCode); |
|
|
|
|
|
|
|
|
|
|
|
warehouseInventoryCheck.setInventoryCheckCode(newCode); |
|
|
warehouseInventoryCheck.setCreateTime(DateUtils.getNowDate()); |
|
|
warehouseInventoryCheck.setCreateTime(DateUtils.getNowDate()); |
|
|
String loginName = ShiroUtils.getLoginName(); |
|
|
String loginName = ShiroUtils.getLoginName(); |
|
|
warehouseInventoryCheck.setCreateBy(loginName); |
|
|
warehouseInventoryCheck.setCreateBy(loginName); |
|
@ -76,51 +90,28 @@ public class WarehouseInventoryCheckServiceImpl implements IWarehouseInventoryCh |
|
|
return warehouseInventoryCheckMapper.updateWarehouseInventoryCheck(warehouseInventoryCheck); |
|
|
return warehouseInventoryCheckMapper.updateWarehouseInventoryCheck(warehouseInventoryCheck); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 删除仓库库存盘点对象 |
|
|
|
|
|
* |
|
|
|
|
|
* @param ids 需要删除的数据ID |
|
|
|
|
|
* @return 结果 |
|
|
|
|
|
*/ |
|
|
|
|
|
@Override |
|
|
|
|
|
public int deleteWarehouseInventoryCheckByIds(String ids) |
|
|
|
|
|
{ |
|
|
|
|
|
return warehouseInventoryCheckMapper.deleteWarehouseInventoryCheckByIds(Convert.toStrArray(ids)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 删除仓库库存盘点信息 |
|
|
|
|
|
* |
|
|
|
|
|
* @param inventoryCheckId 仓库库存盘点ID |
|
|
|
|
|
* @return 结果 |
|
|
|
|
|
*/ |
|
|
|
|
|
@Override |
|
|
|
|
|
public int deleteWarehouseInventoryCheckById(Long inventoryCheckId) |
|
|
|
|
|
{ |
|
|
|
|
|
return warehouseInventoryCheckMapper.deleteWarehouseInventoryCheckById(inventoryCheckId); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 作废仓库库存盘点 |
|
|
*库存盘点单号生成规则 |
|
|
|
|
|
*系统自动生成,按照特定编码,编码暂用【KCPD+年月日+001】, |
|
|
|
|
|
*自增长,如:KCPD20231111001,KCPD20231111002 |
|
|
* |
|
|
* |
|
|
* @param inventoryCheckId 仓库库存盘点ID |
|
|
|
|
|
* @return 结果 |
|
|
|
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
public static String generateCode(String prefix, String maxCode){ |
|
|
public int cancelWarehouseInventoryCheckById(Long inventoryCheckId) |
|
|
if (StringUtils.isEmpty(maxCode)){ |
|
|
{ |
|
|
return prefix + "001"; |
|
|
return warehouseInventoryCheckMapper.cancelWarehouseInventoryCheckById(inventoryCheckId); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
//解析并递增编号
|
|
|
* 恢复仓库库存盘点信息 |
|
|
int sequence = Integer.parseInt(maxCode.substring(4)) + 1; |
|
|
* |
|
|
|
|
|
* @param inventoryCheckId 仓库库存盘点ID |
|
|
//检查序列号是否溢出
|
|
|
* @return 结果 |
|
|
if (sequence > 999){ |
|
|
*/ |
|
|
throw new BusinessException("当前编号已达到最大值999,请检查或调整策略"); |
|
|
@Override |
|
|
} |
|
|
public int restoreWarehouseInventoryCheckById(Long inventoryCheckId) |
|
|
|
|
|
{ |
|
|
//格式化序列号,自动补零至三位
|
|
|
return warehouseInventoryCheckMapper.restoreWarehouseInventoryCheckById(inventoryCheckId); |
|
|
DecimalFormat df = new DecimalFormat("000"); |
|
|
|
|
|
return prefix + df.format(sequence); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|