@ -19,7 +19,10 @@ import com.dreamchaser.depository_manage.utils.WordUtil;
import org.apache.http.protocol.HTTP ;
import org.apache.http.protocol.HTTP ;
import org.springframework.beans.Mergeable ;
import org.springframework.beans.Mergeable ;
import org.springframework.beans.factory.annotation.Autowired ;
import org.springframework.beans.factory.annotation.Autowired ;
import org.springframework.dao.DataAccessException ;
import org.springframework.data.redis.core.RedisOperations ;
import org.springframework.data.redis.core.RedisTemplate ;
import org.springframework.data.redis.core.RedisTemplate ;
import org.springframework.data.redis.core.SessionCallback ;
import org.springframework.stereotype.Service ;
import org.springframework.stereotype.Service ;
import org.springframework.transaction.annotation.Transactional ;
import org.springframework.transaction.annotation.Transactional ;
import cn.hutool.core.lang.Snowflake ;
import cn.hutool.core.lang.Snowflake ;
@ -28,6 +31,7 @@ import java.io.IOException;
import java.math.BigDecimal ;
import java.math.BigDecimal ;
import java.util.* ;
import java.util.* ;
import java.util.concurrent.TimeUnit ;
import java.util.concurrent.TimeUnit ;
import java.util.concurrent.atomic.AtomicInteger ;
/ * *
/ * *
* @author Dreamchaser
* @author Dreamchaser
@ -72,6 +76,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
/ * *
/ * *
* 插入一条入库记录
* 插入一条入库记录
*
* @param map
* @param map
* @return
* @return
* /
* /
@ -125,8 +130,10 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
}
}
return depositoryRecordMapper . insertApplicationInRecord ( map ) ;
return depositoryRecordMapper . insertApplicationInRecord ( map ) ;
}
}
/ * *
/ * *
* 插入一条出库记录
* 插入一条出库记录
*
* @param map
* @param map
* @return
* @return
* /
* /
@ -144,6 +151,10 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
map . put ( "depositoryId" , materialById . getDepositoryId ( ) ) ;
map . put ( "depositoryId" , materialById . getDepositoryId ( ) ) ;
map . put ( "state" , "待部门负责人审核" ) ;
map . put ( "state" , "待部门负责人审核" ) ;
map . put ( "istransfer" , 2 ) ;
map . put ( "istransfer" , 2 ) ;
Map < String , Object > update = new HashMap < > ( ) ;
update . put ( "id" , materialById . getId ( ) ) ;
update . put ( "numberOfTemporary" , materialById . getNumberOfTemporary ( ) + quantity ) ;
materialMapper . updateMaterial ( update ) ;
Depository depositoryRecordById = depositoryMapper . findDepositoryRecordById ( materialById . getDepositoryId ( ) ) ;
Depository depositoryRecordById = depositoryMapper . findDepositoryRecordById ( materialById . getDepositoryId ( ) ) ;
String code = createCode ( depositoryRecordById . getDname ( ) , "outOrderNumber" ) ;
String code = createCode ( depositoryRecordById . getDname ( ) , "outOrderNumber" ) ;
map . put ( "code" , code ) ;
map . put ( "code" , code ) ;
@ -162,6 +173,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
/ * *
/ * *
* 计算购入材料总数
* 计算购入材料总数
*
* @return
* @return
* /
* /
@Override
@Override
@ -176,6 +188,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
/ * *
/ * *
* 计算出库材料总数
* 计算出库材料总数
*
* @param state
* @param state
* @return
* @return
* /
* /
@ -256,8 +269,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
} else {
} else {
map . put ( "state" , "部门负责人审核未通过" ) ;
map . put ( "state" , "部门负责人审核未通过" ) ;
}
}
}
} else {
else {
String simpleTime = DateUtil . getSimpleTime ( new Date ( ) ) ;
String simpleTime = DateUtil . getSimpleTime ( new Date ( ) ) ;
map . put ( "depositoryManagerTime" , DateUtil . DateTimeToTimeStamp ( simpleTime ) ) ;
map . put ( "depositoryManagerTime" , DateUtil . DateTimeToTimeStamp ( simpleTime ) ) ;
map . put ( "depositoryManager" , userid ) ;
map . put ( "depositoryManager" , userid ) ;
@ -271,6 +283,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
Double sum = material . getPrice ( ) * record . getQuantity ( ) ;
Double sum = material . getPrice ( ) * record . getQuantity ( ) ;
material . setAmounts ( material . getAmounts ( ) - sum ) ;
material . setAmounts ( material . getAmounts ( ) - sum ) ;
material . setQuantity ( material . getQuantity ( ) - record . getQuantity ( ) ) ;
material . setQuantity ( material . getQuantity ( ) - record . getQuantity ( ) ) ;
material . setNumberOfTemporary ( material . getNumberOfTemporary ( ) - record . getQuantity ( ) ) ;
materialMapper . updateMaterial ( material ) ;
materialMapper . updateMaterial ( material ) ;
if ( record . getIstransfer ( ) = = 1 ) {
if ( record . getIstransfer ( ) = = 1 ) {
map . put ( "quantity" , record . getQuantity ( ) . toString ( ) ) ;
map . put ( "quantity" , record . getQuantity ( ) . toString ( ) ) ;
@ -281,6 +294,10 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
} else {
} else {
map . put ( "state" , "未出库" ) ;
map . put ( "state" , "未出库" ) ;
map . put ( "depositoryManagerMessage" , "当前仓位库存量不足" ) ;
map . put ( "depositoryManagerMessage" , "当前仓位库存量不足" ) ;
Map < String , Object > update = new HashMap < > ( ) ;
update . put ( "id" , material . getId ( ) ) ;
update . put ( "numberOfTemporary" , 0 ) ;
materialMapper . updateMaterial ( update ) ;
depositoryRecordMapper . updateApplicationOutRecord ( map ) ;
depositoryRecordMapper . updateApplicationOutRecord ( map ) ;
return - 1 ;
return - 1 ;
}
}
@ -294,6 +311,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
/ * *
/ * *
* 转移物品
* 转移物品
*
* @param map
* @param map
* /
* /
public void transferMaterial ( Map < String , Object > map ) {
public void transferMaterial ( Map < String , Object > map ) {
@ -388,6 +406,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
/ * *
/ * *
* 根据条件查询入库记录 , 同时支持分页查询
* 根据条件查询入库记录 , 同时支持分页查询
*
* @param map
* @param map
* @return
* @return
* /
* /
@ -416,8 +435,10 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
}
}
return list ;
return list ;
}
}
/ * *
/ * *
* 根据条件查询出库记录 , 同时支持分页查询
* 根据条件查询出库记录 , 同时支持分页查询
*
* @param map
* @param map
* @return
* @return
* /
* /
@ -449,6 +470,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
/ * *
/ * *
* 根据条件查询出库记录数目
* 根据条件查询出库记录数目
*
* @param map
* @param map
* @return
* @return
* /
* /
@ -459,6 +481,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
/ * *
/ * *
* 根据id查询出库记录
* 根据id查询出库记录
*
* @param id
* @param id
* @return
* @return
* /
* /
@ -469,6 +492,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
/ * *
/ * *
* 根据条件查询入库记录数目
* 根据条件查询入库记录数目
*
* @param map
* @param map
* @return
* @return
* /
* /
@ -539,6 +563,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
public Integer findMyTaskCount ( Map < String , Object > map ) {
public Integer findMyTaskCount ( Map < String , Object > map ) {
return depositoryRecordMapper . findMyTaskCount ( map ) ;
return depositoryRecordMapper . findMyTaskCount ( map ) ;
}
}
/ * *
/ * *
* 返回该我的任务数 ( 完成或者未完成 )
* 返回该我的任务数 ( 完成或者未完成 )
*
*
@ -617,6 +642,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
/ * *
/ * *
* 计算入库材料总额
* 计算入库材料总额
*
* @return
* @return
* /
* /
@Override
@Override
@ -634,6 +660,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
/ * *
/ * *
* 计算出库材料总额
* 计算出库材料总额
*
* @param state
* @param state
* @return
* @return
* /
* /
@ -784,6 +811,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
/ * *
/ * *
* 根据id查询入库记录
* 根据id查询入库记录
*
* @param id
* @param id
* @return
* @return
* /
* /
@ -794,8 +822,9 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
/ * *
/ * *
* 根据id删除入库记录
* 根据id删除入库记录
* @return 受影响的行数
*
* @param id
* @param id
* @return 受影响的行数
* /
* /
@Override
@Override
public Integer deleteApplicationInRecordById ( Integer id ) {
public Integer deleteApplicationInRecordById ( Integer id ) {
@ -804,6 +833,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
/ * *
/ * *
* 根据id集合删除多条入库记录
* 根据id集合删除多条入库记录
*
* @param list id集合
* @param list id集合
* @return 受影响的行数
* @return 受影响的行数
* /
* /
@ -813,7 +843,6 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
}
}
/ * *
/ * *
* 对查出来的记录进行包装 , 包装成前端需要的数据
* 对查出来的记录进行包装 , 包装成前端需要的数据
*
*
@ -881,6 +910,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
/ * *
/ * *
* 根据id获取对应用户
* 根据id获取对应用户
*
* @param id
* @param id
* @return
* @return
* /
* /
@ -904,10 +934,12 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
/ * *
/ * *
* 生成单号
* 生成单号
*
* @param depositoryName
* @param depositoryName
* @return
* @return
* /
* /
private String createCode ( String depositoryName , String key ) {
private String createCode ( String depositoryName , String key ) {
// 单号(公司简称+仓库简称+年月日+数字(位数设置>=9))
// 单号(公司简称+仓库简称+年月日+数字(位数设置>=9))
String code = "GK" ;
String code = "GK" ;
String nowTime = DateUtil . getNowTime ( ) ;
String nowTime = DateUtil . getNowTime ( ) ;