@ -24,11 +24,14 @@ import org.nl.wms.basedata_manage.service.IMdPbStoragevehicleextService;
import org.nl.wms.basedata_manage.service.IStructattrService ;
import org.nl.wms.basedata_manage.service.IStructattrService ;
import org.nl.wms.basedata_manage.service.dao.BsrealStorattr ;
import org.nl.wms.basedata_manage.service.dao.BsrealStorattr ;
import org.nl.wms.basedata_manage.service.dao.MdPbStoragevehicleext ;
import org.nl.wms.basedata_manage.service.dao.MdPbStoragevehicleext ;
import org.nl.wms.basedata_manage.service.dao.Structattr ;
import org.nl.wms.basedata_manage.service.dao.mapper.MdPbStoragevehicleextMapper ;
import org.nl.wms.basedata_manage.service.dao.mapper.MdPbStoragevehicleextMapper ;
import org.nl.wms.basedata_manage.service.dto.MdPbStoragevehicleextDto ;
import org.nl.wms.basedata_manage.service.dto.MdPbStoragevehicleextDto ;
import org.nl.wms.sch_manage.service.dao.SchBasePoint ;
import org.nl.wms.sch_manage.service.dao.SchBasePoint ;
import org.nl.wms.sch_manage.service.dao.SchBaseTask ;
import org.nl.wms.sch_manage.service.dao.mapper.SchBasePointMapper ;
import org.nl.wms.sch_manage.service.dao.mapper.SchBasePointMapper ;
import org.nl.wms.sch_manage.service.util.tasks.StInTask ;
import org.nl.wms.sch_manage.service.util.tasks.StInTask ;
import org.nl.wms.sch_manage.service.util.tasks.StOutTask ;
import org.nl.wms.warehouse_management.enums.IOSConstant ;
import org.nl.wms.warehouse_management.enums.IOSConstant ;
import org.nl.wms.warehouse_management.enums.IOSEnum ;
import org.nl.wms.warehouse_management.enums.IOSEnum ;
import org.nl.wms.warehouse_management.service.IOutBillService ;
import org.nl.wms.warehouse_management.service.IOutBillService ;
@ -162,6 +165,81 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
whereJson ) ;
whereJson ) ;
}
}
@Override
public void update ( JSONObject whereJson ) {
String iostorinv_id = ( String ) whereJson . get ( "iostorinv_id" ) ;
IOStorInv ioStorInv = ioStorInvMapper . selectById ( iostorinv_id ) ;
if ( ! IOSEnum . BILL_STATUS . code ( "生成" ) . equals ( ioStorInv . getBill_status ( ) ) ) {
throw new BadRequestException ( "主表状态必须为生成!" ) ;
}
String currentUserId = SecurityUtils . getCurrentUserId ( ) ;
String nickName = SecurityUtils . getCurrentNickName ( ) ;
String now = DateUtil . now ( ) ;
JSONObject iostorinv_json = new JSONObject ( ) ;
iostorinv_json . put ( "iostorinv_id" , iostorinv_id ) ;
iostorinv_json . put ( "stor_id" , whereJson . get ( "stor_id" ) ) ;
iostorinv_json . put ( "stor_code" , whereJson . get ( "stor_code" ) ) ;
iostorinv_json . put ( "stor_name" , whereJson . get ( "stor_name" ) ) ;
iostorinv_json . put ( "total_qty" , whereJson . get ( "total_qty" ) ) ;
iostorinv_json . put ( "detail_count" , whereJson . get ( "detail_count" ) ) ;
iostorinv_json . put ( "biz_date" , whereJson . get ( "biz_date" ) ) ;
iostorinv_json . put ( "bill_type" , whereJson . get ( "bill_type" ) ) ;
iostorinv_json . put ( "remark" , whereJson . get ( "remark" ) ) ;
iostorinv_json . put ( "update_optid" , currentUserId ) ;
iostorinv_json . put ( "update_optname" , nickName ) ;
iostorinv_json . put ( "update_time" , now ) ;
ioStorInvMapper . updateById ( iostorinv_json . toJavaObject ( IOStorInv . class ) ) ;
//先删除该单据下的所有明细
ioStorInvDtlMapper . delete ( new LambdaQueryWrapper < > ( IOStorInvDtl . class ) . eq ( IOStorInvDtl : : getIostorinv_id , iostorinv_id ) ) ;
ioStorInvDisMapper . delete ( new LambdaQueryWrapper < > ( IOStorInvDis . class ) . eq ( IOStorInvDis : : getIostorinv_id , iostorinv_id ) ) ;
ArrayList < HashMap > rows = ( ArrayList < HashMap > ) whereJson . get ( "tableData" ) ;
for ( int i = 0 ; i < rows . size ( ) ; i + + ) {
HashMap < String , Object > row = rows . get ( i ) ;
JSONObject ioStorInvDtl = new JSONObject ( ) ;
ioStorInvDtl . putAll ( row ) ;
ioStorInvDtl . put ( "iostorinvdtl_id" , org . nl . common . utils . IdUtil . getStringId ( ) ) ;
ioStorInvDtl . put ( "iostorinv_id" , iostorinv_id ) ;
ioStorInvDtl . put ( "seq_no" , ( i + 1 ) + "" ) ;
ioStorInvDtl . put ( "material_id" , row . get ( "material_id" ) ) ;
ioStorInvDtl . put ( "Pcsn" , row . get ( "pcsn" ) ) ;
ioStorInvDtl . put ( "bill_status" , IOSEnum . BILL_STATUS . code ( "生成" ) ) ;
ioStorInvDtl . put ( "qty_unit_id" , row . get ( "qty_unit_id" ) ) ;
ioStorInvDtl . put ( "qty_unit_name" , row . get ( "qty_unit_name" ) ) ;
ioStorInvDtl . put ( "assign_qty" , 0 ) ;
ioStorInvDtl . put ( "plan_qty" , row . get ( "plan_qty" ) ) ;
ioStorInvDtl . put ( "unassign_qty" , row . get ( "plan_qty" ) ) ;
ioStorInvDtlMapper . insert ( ioStorInvDtl . toJavaObject ( IOStorInvDtl . class ) ) ;
}
}
@Override
public void deleteAll ( String [ ] ids ) {
String currentUserId = SecurityUtils . getCurrentUserId ( ) ;
String nickName = SecurityUtils . getCurrentNickName ( ) ;
String now = DateUtil . now ( ) ;
for ( String id : ids ) {
JSONObject param = new JSONObject ( ) ;
param . put ( "iostorinv_id" , id ) ;
param . put ( "is_delete" , BaseDataEnum . IS_YES_NOT . code ( "是" ) ) ;
param . put ( "update_optid" , currentUserId ) ;
param . put ( "update_optname" , nickName ) ;
param . put ( "update_time" , now ) ;
//暂时只软删除出入库单主表
ioStorInvMapper . updateById ( param . toJavaObject ( IOStorInv . class ) ) ;
}
}
@Override
@Override
@Transactional ( rollbackFor = Exception . class )
@Transactional ( rollbackFor = Exception . class )
public String insertDtl ( JSONObject map ) {
public String insertDtl ( JSONObject map ) {
@ -323,7 +401,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
ioStorInvDis . setIs_issued ( BaseDataEnum . IS_YES_NOT . code ( "否" ) ) ;
ioStorInvDis . setIs_issued ( BaseDataEnum . IS_YES_NOT . code ( "否" ) ) ;
ioStorInvDis . setQty_unit_id ( outAllocation . getQty_unit_id ( ) ) ;
ioStorInvDis . setQty_unit_id ( outAllocation . getQty_unit_id ( ) ) ;
ioStorInvDis . setQty_unit_name ( outAllocation . getQty_unit_name ( ) ) ;
ioStorInvDis . setQty_unit_name ( outAllocation . getQty_unit_name ( ) ) ;
ioStorInvDis . setWork_status ( IOSEnum . INBILL_DIS_STATUS . code ( "生成" ) ) ;
ioStorInvDis . setWork_status ( IOSEnum . INBILL_DIS_STATUS . code ( "未 生成" ) ) ;
// 未分配数量 - 该库位上的可用数量 < 0 目前做整出
// 未分配数量 - 该库位上的可用数量 < 0 目前做整出
// double canuse_qty = outAllocation.getCanuse_qty().doubleValue();
// double canuse_qty = outAllocation.getCanuse_qty().doubleValue();
@ -406,7 +484,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
String iostorinv_id = whereJson . getString ( "iostorinv_id" ) ;
String iostorinv_id = whereJson . getString ( "iostorinv_id" ) ;
List < IOStorInvDis > ioStorInvDisList = ioStorInvDisMapper . selectList ( new LambdaQueryWrapper < > ( IOStorInvDis . class )
List < IOStorInvDis > ioStorInvDisList = ioStorInvDisMapper . selectList ( new LambdaQueryWrapper < > ( IOStorInvDis . class )
. le ( IOStorInvDis : : getWork_status , IOSEnum . INBILL_DIS_STATUS . code ( "生成" ) )
. le ( IOStorInvDis : : getWork_status , IOSEnum . INBILL_DIS_STATUS . code ( "未 生成" ) )
. eq ( IOStorInvDis : : getIs_issued , BaseDataEnum . IS_YES_NOT . code ( "否" ) )
. eq ( IOStorInvDis : : getIs_issued , BaseDataEnum . IS_YES_NOT . code ( "否" ) )
. eq ( IOStorInvDis : : getIostorinv_id , iostorinv_id )
. eq ( IOStorInvDis : : getIostorinv_id , iostorinv_id )
) ;
) ;
@ -538,7 +616,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
ioStorInvDis . setIs_issued ( BaseDataEnum . IS_YES_NOT . code ( "否" ) ) ;
ioStorInvDis . setIs_issued ( BaseDataEnum . IS_YES_NOT . code ( "否" ) ) ;
ioStorInvDis . setQty_unit_id ( outAllocation . getQty_unit_id ( ) ) ;
ioStorInvDis . setQty_unit_id ( outAllocation . getQty_unit_id ( ) ) ;
ioStorInvDis . setQty_unit_name ( outAllocation . getQty_unit_name ( ) ) ;
ioStorInvDis . setQty_unit_name ( outAllocation . getQty_unit_name ( ) ) ;
ioStorInvDis . setWork_status ( IOSEnum . INBILL_DIS_STATUS . code ( "生成" ) ) ;
ioStorInvDis . setWork_status ( IOSEnum . INBILL_DIS_STATUS . code ( "未 生成" ) ) ;
// 未分配数量 - 该库位上的可用数量 < 0 目前做整出
// 未分配数量 - 该库位上的可用数量 < 0 目前做整出
// double canuse_qty = outAllocation.getCanuse_qty().doubleValue();
// double canuse_qty = outAllocation.getCanuse_qty().doubleValue();
@ -620,7 +698,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
String iostorinv_id = whereJson . getString ( "iostorinv_id" ) ;
String iostorinv_id = whereJson . getString ( "iostorinv_id" ) ;
List < IOStorInvDis > ioStorInvDisList = ioStorInvDisMapper . selectList ( new LambdaQueryWrapper < > ( IOStorInvDis . class )
List < IOStorInvDis > ioStorInvDisList = ioStorInvDisMapper . selectList ( new LambdaQueryWrapper < > ( IOStorInvDis . class )
. le ( IOStorInvDis : : getWork_status , IOSEnum . INBILL_DIS_STATUS . code ( "生成" ) )
. le ( IOStorInvDis : : getWork_status , IOSEnum . INBILL_DIS_STATUS . code ( "未 生成" ) )
. eq ( IOStorInvDis : : getIs_issued , BaseDataEnum . IS_YES_NOT . code ( "否" ) )
. eq ( IOStorInvDis : : getIs_issued , BaseDataEnum . IS_YES_NOT . code ( "否" ) )
. eq ( IOStorInvDis : : getIostorinv_id , iostorinv_id )
. eq ( IOStorInvDis : : getIostorinv_id , iostorinv_id )
. eq ( IOStorInvDis : : getIostorinvdtl_id , whereJson . getString ( "iostorinvdtl_id" ) )
. eq ( IOStorInvDis : : getIostorinvdtl_id , whereJson . getString ( "iostorinvdtl_id" ) )
@ -750,7 +828,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
ioStorInvDis . setIs_issued ( BaseDataEnum . IS_YES_NOT . code ( "否" ) ) ;
ioStorInvDis . setIs_issued ( BaseDataEnum . IS_YES_NOT . code ( "否" ) ) ;
ioStorInvDis . setQty_unit_id ( dtl . getQty_unit_id ( ) ) ;
ioStorInvDis . setQty_unit_id ( dtl . getQty_unit_id ( ) ) ;
ioStorInvDis . setQty_unit_name ( dtl . getQty_unit_name ( ) ) ;
ioStorInvDis . setQty_unit_name ( dtl . getQty_unit_name ( ) ) ;
ioStorInvDis . setWork_status ( IOSEnum . INBILL_DIS_STATUS . code ( "生成" ) ) ;
ioStorInvDis . setWork_status ( IOSEnum . INBILL_DIS_STATUS . code ( "未 生成" ) ) ;
// 未分配数量 - 该库位上的可用数量 < 0 目前做整出
// 未分配数量 - 该库位上的可用数量 < 0 目前做整出
// double canuse_qty = outAllocation.getCanuse_qty().doubleValue();
// double canuse_qty = outAllocation.getCanuse_qty().doubleValue();
@ -834,7 +912,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
String iostorinv_id = whereJson . getString ( "iostorinv_id" ) ;
String iostorinv_id = whereJson . getString ( "iostorinv_id" ) ;
List < IOStorInvDis > ioStorInvDisList = ioStorInvDisMapper . selectList ( new LambdaQueryWrapper < > ( IOStorInvDis . class )
List < IOStorInvDis > ioStorInvDisList = ioStorInvDisMapper . selectList ( new LambdaQueryWrapper < > ( IOStorInvDis . class )
. le ( IOStorInvDis : : getWork_status , IOSEnum . INBILL_DIS_STATUS . code ( "生成" ) )
. le ( IOStorInvDis : : getWork_status , IOSEnum . INBILL_DIS_STATUS . code ( "未 生成" ) )
. eq ( IOStorInvDis : : getIs_issued , BaseDataEnum . IS_YES_NOT . code ( "否" ) )
. eq ( IOStorInvDis : : getIs_issued , BaseDataEnum . IS_YES_NOT . code ( "否" ) )
. eq ( IOStorInvDis : : getIostorinv_id , iostorinv_id )
. eq ( IOStorInvDis : : getIostorinv_id , iostorinv_id )
. eq ( IOStorInvDis : : getIostorinvdis_id , whereJson . getString ( "iostorinvdis_id" ) )
. eq ( IOStorInvDis : : getIostorinvdis_id , whereJson . getString ( "iostorinvdis_id" ) )
@ -875,7 +953,13 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
double unassign_qty = ioStorInvDtl . getUnassign_qty ( ) . doubleValue ( ) + ( ioStorInvDtl . getPlan_qty ( ) . doubleValue ( ) - assign_qty ) ;
double unassign_qty = ioStorInvDtl . getUnassign_qty ( ) . doubleValue ( ) + ( ioStorInvDtl . getPlan_qty ( ) . doubleValue ( ) - assign_qty ) ;
ioStorInvDtl . setAssign_qty ( BigDecimal . valueOf ( assign_qty ) ) ;
ioStorInvDtl . setAssign_qty ( BigDecimal . valueOf ( assign_qty ) ) ;
ioStorInvDtl . setUnassign_qty ( BigDecimal . valueOf ( unassign_qty ) ) ;
ioStorInvDtl . setUnassign_qty ( BigDecimal . valueOf ( unassign_qty ) ) ;
if ( assign_qty = = 0 ) {
ioStorInvDtl . setBill_status ( IOSEnum . BILL_STATUS . code ( "生成" ) ) ;
ioStorInvDtl . setBill_status ( IOSEnum . BILL_STATUS . code ( "生成" ) ) ;
} else if ( unassign_qty = = 0 ) {
ioStorInvDtl . setBill_status ( IOSEnum . BILL_STATUS . code ( "分配完" ) ) ;
} else {
ioStorInvDtl . setBill_status ( IOSEnum . BILL_STATUS . code ( "分配中" ) ) ;
}
ioStorInvDtlMapper . updateById ( ioStorInvDtl ) ;
ioStorInvDtlMapper . updateById ( ioStorInvDtl ) ;
//删除出入库单分配表
//删除出入库单分配表
@ -929,20 +1013,20 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
for ( IOStorInvDis ioStorInvDis : ioStorInvDisList ) {
for ( IOStorInvDis ioStorInvDis : ioStorInvDisList ) {
//创建任务
//创建任务
JSONObject task_form = new JSONObject ( ) ;
JSONObject task_form = new JSONObject ( ) ;
task_form . put ( "task_type" , "STIn Task" ) ;
task_form . put ( "task_type" , "STOut Task" ) ;
task_form . put ( "TaskCode" , CodeUtil . getNewCode ( "TASK_CODE" ) ) ;
task_form . put ( "TaskCode" , CodeUtil . getNewCode ( "TASK_CODE" ) ) ;
task_form . put ( "PickingLocation" , point_code ) ;
task_form . put ( "PickingLocation" , ioStorInvDis . getStruct_code ( ) ) ;
task_form . put ( "PlacedLocation" , ioStorInvDis . getStruct_code ( ) ) ;
task_form . put ( "PlacedLocation" , point_code ) ;
task_form . put ( "vehicle_code" , ioStorInvDis . getStoragevehicle_code ( ) ) ;
task_form . put ( "vehicle_code" , ioStorInvDis . getStoragevehicle_code ( ) ) ;
StInTask stIn Task = SpringContextHolder . getBean ( "STIn Task" ) ;
StOutTask stOut Task = SpringContextHolder . getBean ( "STOut Task" ) ;
String task_id = stIn Task . create ( task_form ) ;
String task_id = stOut Task . create ( task_form ) ;
//分配明细表更新任务相关数据
//分配明细表更新任务相关数据
IOStorInvDis dis = new IOStorInvDis ( ) ;
IOStorInvDis dis = new IOStorInvDis ( ) ;
dis . setIostorinvdis_id ( ioStorInvDis . getIostorinvdis_id ( ) ) ;
dis . setIostorinvdis_id ( ioStorInvDis . getIostorinvdis_id ( ) ) ;
dis . setWork_status ( IOSEnum . INBILL_DIS_STATUS . code ( "执行中 " ) ) ;
dis . setWork_status ( IOSEnum . INBILL_DIS_STATUS . code ( "生成 " ) ) ;
dis . setTask_id ( task_id ) ;
dis . setTask_id ( task_id ) ;
dis . setIs_issued ( BaseDataEnum . IS_YES_NOT . code ( "是" ) ) ;
dis . setIs_issued ( BaseDataEnum . IS_YES_NOT . code ( "是" ) ) ;
dis . setPoint_code ( point_code ) ;
dis . setPoint_code ( point_code ) ;
@ -974,6 +1058,9 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
. eq ( IOStorInvDis : : getIostorinv_id , whereJson . get ( "iostorinv_id" ) )
. eq ( IOStorInvDis : : getIostorinv_id , whereJson . get ( "iostorinv_id" ) )
) ;
) ;
//需要更新的出入库单明细
Set < String > dtlSet = new HashSet < > ( ) ;
for ( IOStorInvDis ioStorInvDis : storInvDisList ) {
for ( IOStorInvDis ioStorInvDis : storInvDisList ) {
if ( StrUtil . isNotBlank ( ioStorInvDis . getStruct_code ( ) ) ) {
if ( StrUtil . isNotBlank ( ioStorInvDis . getStruct_code ( ) ) ) {
//解绑仓位
//解绑仓位
@ -995,7 +1082,13 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
//修改库存 减冻结加可用
//修改库存 减冻结加可用
List < JSONObject > updateIvtList = new ArrayList < > ( ) ;
List < JSONObject > updateIvtList = new ArrayList < > ( ) ;
JSONObject jsonIvt = new JSONObject ( ) ;
JSONObject jsonIvt = new JSONObject ( ) ;
//判断分配明细是否分配了出库点位和任务号 分配则恢复库存等待手持减扣 没分配则减扣库存
if ( StrUtil . isNotBlank ( ioStorInvDis . getPoint_code ( ) ) & & StrUtil . isNotBlank ( ioStorInvDis . getTask_id ( ) ) ) {
jsonIvt . put ( "type" , IOSConstant . UPDATE_IVT_TYPE_SUB_FROZEN_ADD_CANUSE ) ;
jsonIvt . put ( "type" , IOSConstant . UPDATE_IVT_TYPE_SUB_FROZEN_ADD_CANUSE ) ;
} else {
jsonIvt . put ( "type" , IOSConstant . UPDATE_IVT_TYPE_SUB_FROZEN ) ;
}
jsonIvt . put ( "storagevehicle_code" , ioStorInvDis . getStoragevehicle_code ( ) ) ;
jsonIvt . put ( "storagevehicle_code" , ioStorInvDis . getStoragevehicle_code ( ) ) ;
jsonIvt . put ( "material_id" , ioStorInvDis . getMaterial_id ( ) ) ;
jsonIvt . put ( "material_id" , ioStorInvDis . getMaterial_id ( ) ) ;
jsonIvt . put ( "pcsn" , ioStorInvDis . getPcsn ( ) ) ;
jsonIvt . put ( "pcsn" , ioStorInvDis . getPcsn ( ) ) ;
@ -1006,20 +1099,16 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
iMdPbStoragevehicleextService . updateIvt ( updateIvtList ) ;
iMdPbStoragevehicleextService . updateIvt ( updateIvtList ) ;
}
}
//更新详情 数据
//更新分配明细 数据
ioStorInvDisMapper . update ( ioStorInvDis , new LambdaUpdateWrapper < > ( IOStorInvDis . class )
ioStorInvDisMapper . update ( ioStorInvDis , new LambdaUpdateWrapper < > ( IOStorInvDis . class )
. set ( IOStorInvDis : : getWork_status , IOSEnum . INBILL_DIS_STATUS . code ( "完成" ) )
. set ( IOStorInvDis : : getWork_status , IOSEnum . INBILL_DIS_STATUS . code ( "完成" ) )
. set ( IOStorInvDis : : getReal_qty , ioStorInvDis . getPlan_qty ( ) )
. set ( IOStorInvDis : : getReal_qty , BigDecimal . ZERO )
. eq ( IOStorInvDis : : getIostorinvdis_id , ioStorInvDis . getIostorinvdis_id ( ) )
. eq ( IOStorInvDis : : getIostorinvdis_id , ioStorInvDis . getIostorinvdis_id ( ) )
. ne ( IOStorInvDis : : getWork_status , IOSEnum . INBILL_DIS_STATUS . code ( "完成" ) )
. ne ( IOStorInvDis : : getWork_status , IOSEnum . INBILL_DIS_STATUS . code ( "完成" ) )
) ;
) ;
ioStorInvDtlMapper . update ( new IOStorInvDtl ( ) , new LambdaUpdateWrapper < > ( IOStorInvDtl . class )
//添加需要更新的明细标识
. set ( IOStorInvDtl : : getBill_status , IOSEnum . BILL_STATUS . code ( "完成" ) )
dtlSet . add ( ioStorInvDis . getIostorinvdtl_id ( ) ) ;
. set ( IOStorInvDtl : : getReal_qty , ioStorInvDis . getPlan_qty ( ) )
. eq ( IOStorInvDtl : : getIostorinvdtl_id , ioStorInvDis . getIostorinvdtl_id ( ) )
. ne ( IOStorInvDtl : : getBill_status , IOSEnum . BILL_STATUS . code ( "完成" ) )
) ;
//更新组盘记录表
//更新组盘记录表
groupPlateMapper . update ( new GroupPlate ( ) , new LambdaUpdateWrapper < > ( GroupPlate . class )
groupPlateMapper . update ( new GroupPlate ( ) , new LambdaUpdateWrapper < > ( GroupPlate . class )
@ -1030,6 +1119,15 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
) ;
) ;
}
}
//更新出库明细单状态
for ( String dtlId : dtlSet ) {
ioStorInvDtlMapper . update ( new IOStorInvDtl ( ) , new LambdaUpdateWrapper < > ( IOStorInvDtl . class )
. set ( IOStorInvDtl : : getBill_status , IOSEnum . BILL_STATUS . code ( "完成" ) )
. set ( IOStorInvDtl : : getReal_qty , BigDecimal . ZERO )
. eq ( IOStorInvDtl : : getIostorinvdtl_id , dtlId )
) ;
}
//更新主表状态
//更新主表状态
ioStorInvMapper . update ( ioStorInv , new LambdaUpdateWrapper < > ( IOStorInv . class )
ioStorInvMapper . update ( ioStorInv , new LambdaUpdateWrapper < > ( IOStorInv . class )
. set ( IOStorInv : : getBill_status , IOSEnum . BILL_STATUS . code ( "完成" ) )
. set ( IOStorInv : : getBill_status , IOSEnum . BILL_STATUS . code ( "完成" ) )
@ -1040,4 +1138,107 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
) ;
) ;
}
}
@Override
public List < IOStorInvDisDto > getOutBillTask ( Map whereJson ) {
String iostorinvdtl_id = ( String ) whereJson . get ( "iostorinvdtl_id" ) ;
return ioStorInvDisMapper . getBillTaskDtl ( iostorinvdtl_id ) ;
}
@Override
@Transactional ( rollbackFor = Exception . class )
public void taskFinish ( SchBaseTask task ) {
String currentUserId = SecurityUtils . getCurrentUserId ( ) ;
String nickName = SecurityUtils . getCurrentNickName ( ) ;
String now = DateUtil . now ( ) ;
IOStorInvDis ioStorInvDis = ioStorInvDisMapper . selectOne ( new LambdaQueryWrapper < > ( IOStorInvDis . class )
. eq ( IOStorInvDis : : getTask_id , task . getTask_id ( ) )
) ;
if ( ObjectUtil . isEmpty ( ioStorInvDis ) ) {
throw new BadRequestException ( "未找到任务对应的分配明细" ) ;
}
// 完成当前分配明细
ioStorInvDisMapper . update ( ioStorInvDis , new LambdaUpdateWrapper < > ( IOStorInvDis . class )
. set ( IOStorInvDis : : getWork_status , IOSEnum . INBILL_DIS_STATUS . code ( "完成" ) )
. set ( IOStorInvDis : : getReal_qty , ioStorInvDis . getPlan_qty ( ) )
. eq ( IOStorInvDis : : getIostorinvdis_id , ioStorInvDis . getIostorinvdis_id ( ) )
) ;
//解锁库位
JSONObject finish_map = new JSONObject ( ) ;
finish_map . put ( "struct_code" , ioStorInvDis . getStruct_code ( ) ) ;
finish_map . put ( "storagevehicle_code" , null ) ;
finish_map . put ( "inv_type" , null ) ;
finish_map . put ( "inv_id" , null ) ;
finish_map . put ( "inv_code" , null ) ;
iStructattrService . updateStatusByCode ( "1" , finish_map ) ;
//修改库存 恢复库存 手持进行减扣
List < JSONObject > updateIvtList = new ArrayList < > ( ) ;
JSONObject jsonIvt = new JSONObject ( ) ;
jsonIvt . put ( "type" , IOSConstant . UPDATE_IVT_TYPE_SUB_FROZEN_ADD_CANUSE ) ;
jsonIvt . put ( "storagevehicle_code" , ioStorInvDis . getStoragevehicle_code ( ) ) ;
jsonIvt . put ( "material_id" , ioStorInvDis . getMaterial_id ( ) ) ;
jsonIvt . put ( "pcsn" , ioStorInvDis . getPcsn ( ) ) ;
jsonIvt . put ( "qty_unit_id" , ioStorInvDis . getQty_unit_id ( ) ) ;
jsonIvt . put ( "qty_unit_name" , ioStorInvDis . getQty_unit_name ( ) ) ;
jsonIvt . put ( "change_qty" , ioStorInvDis . getPlan_qty ( ) ) ;
updateIvtList . add ( jsonIvt ) ;
iMdPbStoragevehicleextService . updateIvt ( updateIvtList ) ;
//库存绑定到出库点。
schBasePointMapper . update ( new SchBasePoint ( ) , new LambdaUpdateWrapper < > ( SchBasePoint . class )
. set ( SchBasePoint : : getVehicle_code , ioStorInvDis . getStoragevehicle_code ( ) )
. set ( SchBasePoint : : getIos_id , ioStorInvDis . getIostorinvdis_id ( ) )
. eq ( SchBasePoint : : getPoint_code , ioStorInvDis . getPoint_code ( ) )
) ;
//更新组盘记录表
groupPlateMapper . update ( new GroupPlate ( ) , new LambdaUpdateWrapper < > ( GroupPlate . class )
. set ( GroupPlate : : getStatus , IOSEnum . GROUP_PLATE_STATUS . code ( "出库" ) )
. eq ( GroupPlate : : getPcsn , ioStorInvDis . getPcsn ( ) )
. eq ( GroupPlate : : getMaterial_id , ioStorInvDis . getMaterial_id ( ) )
. eq ( GroupPlate : : getStoragevehicle_code , ioStorInvDis . getStoragevehicle_code ( ) )
) ;
// 查询该明细下是否还有未完成的分配明细
int countDis = ioStorInvDisMapper . selectCount ( new LambdaQueryWrapper < > ( IOStorInvDis . class )
. eq ( IOStorInvDis : : getIostorinvdtl_id , ioStorInvDis . getIostorinvdtl_id ( ) )
. ne ( IOStorInvDis : : getWork_status , IOSEnum . INBILL_DIS_STATUS . code ( "完成" ) )
) ;
// 明细
IOStorInvDtl ioStorInvDtl = ioStorInvDtlMapper . selectById ( ioStorInvDis . getIostorinvdtl_id ( ) ) ;
if ( ObjectUtil . isEmpty ( ioStorInvDtl ) ) {
throw new BadRequestException ( "未找到明细" ) ;
}
// 如果分配明细全部完成则更新明细表状态
if ( countDis = = 0 ) {
// 更新明细表状态
ioStorInvDtl . setReal_qty ( ioStorInvDis . getPlan_qty ( ) ) ;
ioStorInvDtl . setBill_status ( IOSEnum . BILL_STATUS . code ( "完成" ) ) ;
ioStorInvDtlMapper . updateById ( ioStorInvDtl ) ;
// 查看明细是否全部完成
int countDtl = ioStorInvDtlMapper . selectCount ( new LambdaQueryWrapper < > ( IOStorInvDtl . class )
. eq ( IOStorInvDtl : : getIostorinv_id , ioStorInvDtl . getIostorinv_id ( ) )
. ne ( IOStorInvDtl : : getBill_status , IOSEnum . BILL_STATUS . code ( "完成" ) )
) ;
// 如果明细全部完成则更新主表状态
if ( countDtl = = 0 ) {
//更新主表状态
ioStorInvMapper . update ( new IOStorInv ( ) , new LambdaUpdateWrapper < > ( IOStorInv . class )
. set ( IOStorInv : : getBill_status , IOSEnum . BILL_STATUS . code ( "完成" ) )
. set ( IOStorInv : : getConfirm_optid , currentUserId )
. set ( IOStorInv : : getConfirm_optname , nickName )
. set ( IOStorInv : : getConfirm_time , now )
. eq ( IOStorInv : : getIostorinv_id , ioStorInvDtl . getIostorinv_id ( ) )
) ;
}
}
}
}
}