@ -134,6 +134,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
} else {
} else {
producedDate = DateUtil . DateTimeByDayToTimeStamp ( s . toString ( ) ) ;
producedDate = DateUtil . DateTimeByDayToTimeStamp ( s . toString ( ) ) ;
}
}
map . put ( "producedDate" , producedDate ) ;
}
}
Map < String , Object > param = new HashMap < > ( ) ;
Map < String , Object > param = new HashMap < > ( ) ;
param . put ( "depositoryId" , depositoryId ) ;
param . put ( "depositoryId" , depositoryId ) ;
@ -184,6 +185,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
/ * *
/ * *
* 用于入库申请时 , 更新物料库存计量
* 用于入库申请时 , 更新物料库存计量
*
* @param map 入库数据
* @param map 入库数据
* @param materialByCondition 当前仓库是否存在该物料
* @param materialByCondition 当前仓库是否存在该物料
* @param quantity 入库数量
* @param quantity 入库数量
@ -202,8 +204,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
mt . setProducedDate ( producedDate ) ;
mt . setProducedDate ( producedDate ) ;
materialMapper . updateInventory ( mt ) ;
materialMapper . updateInventory ( mt ) ;
newMid = mt . getId ( ) ;
newMid = mt . getId ( ) ;
}
} else {
else {
Map < String , Object > insert = new HashMap < > ( ) ;
Map < String , Object > insert = new HashMap < > ( ) ;
Material materialById = materialMapper . findMaterialById ( mid ) ;
Material materialById = materialMapper . findMaterialById ( mid ) ;
insert . put ( "depositoryId" , depositoryId ) ;
insert . put ( "depositoryId" , depositoryId ) ;
@ -692,6 +693,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
/ * *
/ * *
* 用于入库后修改相关数据信息
* 用于入库后修改相关数据信息
*
* @param map 入库数据
* @param map 入库数据
* @param quantity 数量
* @param quantity 数量
* @param materialById 入库物料
* @param materialById 入库物料
@ -726,8 +728,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
materialAndProducedDateByMidAndProducedDate . setInventory ( materialAndProducedDateByMidAndProducedDate . getInventory ( ) + quantity ) ;
materialAndProducedDateByMidAndProducedDate . setInventory ( materialAndProducedDateByMidAndProducedDate . getInventory ( ) + quantity ) ;
// 修改
// 修改
materialMapper . updateMaterialAndProducedDate ( materialAndProducedDateByMidAndProducedDate ) ;
materialMapper . updateMaterialAndProducedDate ( materialAndProducedDateByMidAndProducedDate ) ;
}
} else {
else {
insertProducedDate . put ( "quantity" , quantity ) ;
insertProducedDate . put ( "quantity" , quantity ) ;
insertProducedDate . put ( "inventory" , quantity ) ;
insertProducedDate . put ( "inventory" , quantity ) ;
insertProducedDate . put ( "expendnum" , 0 ) ;
insertProducedDate . put ( "expendnum" , 0 ) ;
@ -743,8 +744,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
param . put ( "mname" , materialById . getMname ( ) ) ;
param . put ( "mname" , materialById . getMname ( ) ) ;
if ( Integer . compare ( placeById . getId ( ) , 0 ) = = 0 ) {
if ( Integer . compare ( placeById . getId ( ) , 0 ) = = 0 ) {
param . put ( "depositoryId" , map . get ( "depositoryId" ) ) ;
param . put ( "depositoryId" , map . get ( "depositoryId" ) ) ;
}
} else {
else {
param . put ( "depositoryId" , placeById . getDid ( ) ) ;
param . put ( "depositoryId" , placeById . getDid ( ) ) ;
}
}
List < Inventory > inventory = materialMapper . findInventory ( param ) ;
List < Inventory > inventory = materialMapper . findInventory ( param ) ;
@ -761,8 +761,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
insert . put ( "quantity" , quantity ) ;
insert . put ( "quantity" , quantity ) ;
// 插入记录
// 插入记录
placeMapper . addMaterialOnPlace ( insert ) ;
placeMapper . addMaterialOnPlace ( insert ) ;
}
} else {
else {
placeAndMaterialByMidAndPid . setQuantity ( placeAndMaterialByMidAndPid . getQuantity ( ) + quantity ) ;
placeAndMaterialByMidAndPid . setQuantity ( placeAndMaterialByMidAndPid . getQuantity ( ) + quantity ) ;
// 修改数量
// 修改数量
placeMapper . updateMaterialAndPlace ( placeAndMaterialByMidAndPid ) ;
placeMapper . updateMaterialAndPlace ( placeAndMaterialByMidAndPid ) ;
@ -2045,6 +2044,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
/ * *
/ * *
* 用于企业微信的物料入库审批处理
* 用于企业微信的物料入库审批处理
*
* @param mainId 需要进行审批的单号
* @param mainId 需要进行审批的单号
* @param approvalInfo_details 审批详情
* @param approvalInfo_details 审批详情
* @param userAgent 加密后的user - agent
* @param userAgent 加密后的user - agent
@ -2065,11 +2065,16 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
Map < String , Object > map = new HashMap < > ( ) ;
Map < String , Object > map = new HashMap < > ( ) ;
map . put ( "approverId" , userByPort . getId ( ) ) ;
map . put ( "approverId" , userByPort . getId ( ) ) ;
map . put ( "approverTime" , System . currentTimeMillis ( ) ) ;
map . put ( "approverTime" , System . currentTimeMillis ( ) ) ;
if ( "2" . equals ( spStatus ) ) {
// 如果同意
// 如果同意
map . put ( "approverPass" , 1 ) ;
for ( String sid : split
for ( String sid : split
) {
) {
if ( "2" . equals ( spStatus ) ) {
map . put ( "approverPass" , 1 ) ;
} else {
// 如果驳回
map . put ( "approverPass" , 2 ) ;
}
if ( ! "" . equals ( sid ) ) {
if ( ! "" . equals ( sid ) ) {
Integer id = ObjectFormatUtil . toInteger ( sid ) ;
Integer id = ObjectFormatUtil . toInteger ( sid ) ;
// 获取具体入库订单
// 获取具体入库订单
@ -2078,17 +2083,84 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
Material materialById = materialMapper . findMaterialById ( recordP . getMid ( ) ) ;
Material materialById = materialMapper . findMaterialById ( recordP . getMid ( ) ) ;
if ( materialById . getUnit ( ) . equals ( recordP . getAirUnit ( ) ) ) {
if ( materialById . getUnit ( ) . equals ( recordP . getAirUnit ( ) ) ) {
// 如果是基础单位
// 如果是基础单位
Map < String , Object > param = new HashMap < > ( ) ;
param . put ( "depositoryId" , recordP . getDepositoryId ( ) ) ;
param . put ( "mcode" , materialById . getCode ( ) ) ;
// 判断该仓库中有无该物物料
List < Inventory > materialByCondition = materialMapper . findInventory ( param ) ;
// 用于调用入库方法而创建的
Map < String , Object > paramForUpdateInventory = new HashMap < > ( ) ;
Map < String , Object > paramForUpdateInventory = new HashMap < > ( ) ;
// paramForUpdateInventory.put("")
paramForUpdateInventory . put ( "mid" , recordP . getMid ( ) ) ;
// updateOrInsertInventory()
paramForUpdateInventory . put ( "quantity" , recordP . getQuantity ( ) ) ;
// 修改仓库库存
Long mproducedDate = recordP . getMproducedDate ( ) ;
if ( mproducedDate = = null ) {
mproducedDate = 0L ;
}
Integer newMid = updateOrInsertInventory ( paramForUpdateInventory , materialByCondition , ( double ) recordP . getQuantity ( ) , materialById . getId ( ) , recordP . getDepositoryId ( ) , mproducedDate ) ;
// 修改库位库存
paramForUpdateInventory . put ( "newInMid" , newMid ) ;
paramForUpdateInventory . put ( "id" , recordP . getId ( ) ) ;
paramForUpdateInventory . put ( "producedDate" , recordP . getMproducedDate ( ) ) ;
paramForUpdateInventory . put ( "depositoryId" , recordP . getDepositoryId ( ) ) ;
Place placeById = placeMapper . findPlaceById ( recordP . getPlaceId ( ) ) ;
updateInventoryInfoForApproval ( paramForUpdateInventory , recordP . getQuantity ( ) , materialById , placeById ) ;
} else {
} else {
// 如果是拆单单位
// 如果是拆单单位
// 查询拆单记录
Map < String , Object > paramForSplitInfo = new HashMap < > ( ) ;
paramForSplitInfo . put ( "newUnit" , recordP . getAirUnit ( ) ) ;
paramForSplitInfo . put ( "mid" , recordP . getMid ( ) ) ;
// 查询当前拆单是否存在
SplitInfo splitInfoForUnit = splitUnitMapper . findSplitInfoByMidAndUnit ( paramForSplitInfo ) ;
if ( splitInfoForUnit ! = null ) {
// 如果该拆单记录存在
// 定义库存拆单记录
SplitInventory splitInventory = null ;
// 定义对应的库存记录
Inventory inventory = null ;
// 定义对应库存所在库位
MaterialAndPlace placeAndMaterialByMidAndPid = null ;
// 用于存储拆单库存处理操作的数据
Map < String , Object > paramForInsertSplitInventory = new HashMap < > ( ) ;
Map < String , Object > paramForInventory = new HashMap < > ( ) ;
paramForInventory . put ( "depositoryId" , recordP . getDepositoryId ( ) ) ;
paramForInventory . put ( "mid" , recordP . getMid ( ) ) ;
// 判断该仓库中有无该物物料
List < Inventory > inventoryList = materialMapper . findInventory ( paramForInventory ) ;
if ( inventoryList . size ( ) > 0 ) {
inventory = inventoryList . get ( 0 ) ;
// 用于查找该库存对应库位
Map < String , Object > paramForInventoryToPlace = new HashMap < > ( ) ;
paramForInventoryToPlace . put ( "pid" , recordP . getPlaceId ( ) ) ;
paramForInventoryToPlace . put ( "mid" , inventory . getId ( ) ) ;
placeAndMaterialByMidAndPid = placeMapper . findPlaceAndMaterialByMidAndPid ( paramForInventoryToPlace ) ;
if ( placeAndMaterialByMidAndPid ! = null ) {
paramForInsertSplitInventory . put ( "iid" , placeAndMaterialByMidAndPid . getId ( ) ) ;
// 查询当前库存是否有该拆单的处理记录
splitInventory = splitUnitMapper . findSplitInventoryByIidAndSid ( paramForInsertSplitInventory ) ;
}
}
}
}
splitUnitService . realInInventoryToDepository ( ( double ) recordP . getQuantity ( ) , splitInventory , map , splitInfoForUnit , placeAndMaterialByMidAndPid ) ;
}
}
} else {
}
// 如果驳回
}
map . put ( "approverPass" , 2 ) ;
map . put ( "id" , sid ) ;
depositoryRecordMapper . updateApplicationInRecord ( map ) ;
}
}
}
}
@ -2407,8 +2479,6 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
}
}
// 开启流程通知其他人忽略审批流程
// 开启流程通知其他人忽略审批流程
new Thread ( new Runnable ( ) {
new Thread ( new Runnable ( ) {
@Override
@Override
@ -3609,8 +3679,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
Material materialById = materialMapper . findMaterialById ( mid ) ;
Material materialById = materialMapper . findMaterialById ( mid ) ;
if ( materialById . getPrice ( ) ! = null ) {
if ( materialById . getPrice ( ) ! = null ) {
sum + = ( materialById . getPrice ( ) / 100 ) * recordMin . getQuantity ( ) ;
sum + = ( materialById . getPrice ( ) / 100 ) * recordMin . getQuantity ( ) ;
}
} else {
else {
sum + = 0 ;
sum + = 0 ;
}
}
}
}