@@ -5,7 +5,6 @@ import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.ObjectUtil ;
import cn.hutool.core.util.StrUtil ;
import com.alibaba.fastjson.JSON ;
import com.alibaba.fastjson.JSONArray ;
import com.alibaba.fastjson.JSONObject ;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper ;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper ;
@@ -39,19 +38,19 @@ import org.nl.wms.sch_manage.service.util.tasks.jb.JbDownAgvTask;
import org.nl.wms.sch_manage.service.util.tasks.zw.InBillTask ;
import org.nl.wms.warehouse_manage.enums.IOSConstant ;
import org.nl.wms.warehouse_manage.enums.IOSEnum ;
import org.nl.wms.warehouse_manage.service.IMdPbGroupplateService ;
import org.nl.wms.warehouse_manage.service.impl.MdPbGroupplateServiceImpl ;
import org.nl.wms.warehouse_manage.inAndOut.service.IInBillService ;
import org.nl.wms.warehouse_manage.service.dao.GroupPlate ;
import org.nl.wms.warehouse_manage.inAndOut.service.dao.IOStorInv ;
import org.nl.wms.warehouse_manage.inAndOut.service.dao.IOStorInvDis ;
import org.nl.wms.warehouse_manage.inAndOut.service.dao.IOStorInvDtl ;
import org.nl.wms.warehouse_manage.service.dto.GroupPlateDto ;
import org.nl.wms.warehouse_manage.inAndOut.service.dao.mapper.IOStorInvDisMapper ;
import org.nl.wms.warehouse_manage.inAndOut.service.dao.mapper.IOStorInvDtlMapper ;
import org.nl.wms.warehouse_manage.inAndOut.service.dao.mapper.IOStorInvMapper ;
import org.nl.wms.warehouse_manage.inAndOut.service.dto.IOStorInvDisDto ;
import org.nl.wms.warehouse_manage.inAndOut.service.dto.IOStorInvDtlDto ;
import org.nl.wms.warehouse_manage.service.IMdPbGroupplateService ;
import org.nl.wms.warehouse_manage.service.dao.GroupPlate ;
import org.nl.wms.warehouse_manage.service.dto.GroupPlateDto ;
import org.nl.wms.warehouse_manage.service.impl.MdPbGroupplateServiceImpl ;
import org.springframework.stereotype.Service ;
import org.springframework.transaction.annotation.Transactional ;
import org.springframework.util.Assert ;
@@ -127,7 +126,7 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
String [ ] s = pcsn . split ( " " ) ;
String pcsn_in = String . join ( " ',' " , Arrays . asList ( s ) ) ;
map . put ( " pcsn_in " , " (' " + pcsn_in + " ') " ) ;
map . put ( " pcsn_in " , " (' " + pcsn_in + " ') " ) ;
} else {
map . put ( " pcsn " , " % " + pcsn + " % " ) ;
}
@@ -142,12 +141,12 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
if ( ! StrUtil . isEmpty ( end_time ) ) {
map . put ( " end_time " , end_time ) ;
}
return ioStorInvMapper . queryAllByPage ( new Page < > ( page . getPage ( ) + 1 , page . getSize ( ) ) , map ) ;
return ioStorInvMapper . queryAllByPage ( new Page < > ( page . getPage ( ) + 1 , page . getSize ( ) ) , map ) ;
}
@Override
public IPage < GroupPlateDto > getBillDtl ( Map whereJson , PageQuery page ) {
return ioStorInvMapper . getGroupPlate ( new Page < > ( page . getPage ( ) + 1 , page . getSize ( ) ) , whereJson ) ;
return ioStorInvMapper . getGroupPlate ( new Page < > ( page . getPage ( ) + 1 , page . getSize ( ) ) , whereJson ) ;
}
@Override
@@ -190,25 +189,25 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
HashMap < String , Object > row = rows . get ( i ) ;
JSONObject ioStorInvDtl = new JSONObject ( ) ;
ioStorInvDtl . putAll ( row ) ;
ioStorInvDtl . put ( " iostorinvdtl_id " , IdUtil . getStringId ( ) ) ;
ioStorInvDtl . put ( " iostorinv_id " , iostorinv_id ) ;
ioStorInvDtl . put ( " seq_no " , ( i + 1 ) + " " ) ;
ioStorInvDtl . put ( " material_id " , row . get ( " material_id " ) ) ;
ioStorInvDtl . put ( " material_code " , row . get ( " material_code " ) ) ;
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 ( " source_bill_type " , row . get ( " ext_type " ) ) ;
ioStorInvDtl . put ( " source_bill_code " , row . get ( " ext_code " ) ) ;
ioStorInvDtl . put ( " assign_qty " , " 0 " ) ;
ioStorInvDtl . put ( " unassign_qty " , row . get ( " qty " ) ) ;
ioStorInvDtl . put ( " plan_qty " , row . get ( " qty " ) ) ;
ioStorInvDtl . put ( " iostorinvdtl_id " , IdUtil . getStringId ( ) ) ;
ioStorInvDtl . put ( " iostorinv_id " , iostorinv_id ) ;
ioStorInvDtl . put ( " seq_no " , ( i + 1 ) + " " ) ;
ioStorInvDtl . put ( " material_id " , row . get ( " material_id " ) ) ;
ioStorInvDtl . put ( " material_code " , row . get ( " material_code " ) ) ;
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 ( " source_bill_type " , row . get ( " ext_type " ) ) ;
ioStorInvDtl . put ( " source_bill_code " , row . get ( " ext_code " ) ) ;
ioStorInvDtl . put ( " assign_qty " , " 0 " ) ;
ioStorInvDtl . put ( " unassign_qty " , row . get ( " qty " ) ) ;
ioStorInvDtl . put ( " plan_qty " , row . get ( " qty " ) ) ;
Double qty = new Double ( String . valueOf ( row . get ( " qty " ) ) ) ;
total_qty = total_qty . add ( new BigDecimal ( qty ) ) ;
//判断该载具编号是否已经存在库内
Structattr structattr = iStructattrService . getOne ( new LambdaQueryWrapper < > ( Structattr . class ) . eq ( Structattr : : getStoragevehicle_code , row . get ( " storagevehicle_code " ) ) ) ;
Structattr structattr = iStructattrService . getOne ( new LambdaQueryWrapper < > ( Structattr . class ) . eq ( Structattr : : getStoragevehicle_code , row . get ( " storagevehicle_code " ) ) ) ;
if ( ObjectUtil . isNotEmpty ( structattr ) ) {
throw new BadRequestException ( " 载具编码: " + row . get ( " storagevehicle_code " ) + " 已存在库内,请对数据进行核实! " ) ;
}
@@ -270,45 +269,45 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
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 ) ;
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 ) ) ;
ioStorInvDtlMapper . delete ( new LambdaQueryWrapper < > ( IOStorInvDtl . class ) . eq ( IOStorInvDtl : : getIostorinv_id , iostorinv_id ) ) ;
ioStorInvDisMapper . delete ( new LambdaQueryWrapper < > ( IOStorInvDis . class ) . eq ( IOStorInvDis : : 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 " , 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 ( " qty " ) ) ;
ioStorInvDtl . put ( " iostorinvdtl_id " , 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 ( " qty " ) ) ;
//判断该载具编号是否已经存在库内
Structattr structattr = iStructattrService . getOne ( new LambdaQueryWrapper < > ( Structattr . class ) . eq ( Structattr : : getStoragevehicle_code , row . get ( " storagevehicle_code " ) ) ) ;
Structattr structattr = iStructattrService . getOne ( new LambdaQueryWrapper < > ( Structattr . class ) . eq ( Structattr : : getStoragevehicle_code , row . get ( " storagevehicle_code " ) ) ) ;
if ( ObjectUtil . isNotEmpty ( structattr ) ) {
throw new BadRequestException ( " 载具编码: " + row . get ( " storagevehicle_code " ) + " 已存在库内,请对数据进行核实! " ) ;
}
@@ -341,15 +340,15 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
@Override
@Transactional ( rollbackFor = Exception . class )
public void divStruct ( JSONObject param ) {
Assert . noNullElements ( new Object [ ] { param . getString ( " stor_code " ) , param . getString ( " sect_code " ) } , " 参数异常 " ) ;
Assert . noNullElements ( new Object [ ] { param . getString ( " stor_code " ) , param . getString ( " sect_code " ) } , " 参数异常 " ) ;
ArrayList < HashMap > rows = ( ArrayList < HashMap > ) param . get ( " tableMater " ) ;
JSONObject mst = JSONObject . parseObject ( JSON . toJSONString ( param ) ) ;
HashMap < String , String > map = rows . get ( 0 ) ;
//判断该分配明细是否已经分配货位
IOStorInvDis ioStorInvDis = ioStorInvDisMapper . selectOne ( new LambdaQueryWrapper < > ( IOStorInvDis . class )
. eq ( IOStorInvDis : : getIostorinvdis_id , map . get ( " iostorinvdis_id " ) )
. eq ( IOStorInvDis : : getIostorinvdis_id , map . get ( " iostorinvdis_id " ) )
. isNull ( IOStorInvDis : : getStruct_code ) ) ;
if ( ioStorInvDis = = null ) {
if ( ioStorInvDis = = null ) {
throw new BadRequestException ( " 当前明细已经分配过库位 " ) ;
}
String currentUserId = SecurityUtils . getCurrentUserId ( ) ;
@@ -413,28 +412,28 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
lock_map . put ( " inv_code " , ioStorInv . getBill_code ( ) ) ;
lock_map . put ( " inv_type " , ioStorInv . getBill_type ( ) ) ;
lock_map . put ( " lock_type " , IOSEnum . LOCK_TYPE . code ( " 入库锁 " ) ) ;
iStructattrService . updateStatusByCode ( " 0 " , lock_map ) ;
iStructattrService . updateStatusByCode ( " 0 " , lock_map ) ;
//更新组盘表状态
mdPbGroupplateService . update ( new LambdaUpdateWrapper < GroupPlate > ( )
. set ( GroupPlate : : getStatus , IOSEnum . GROUP_PLATE_STATUS . code ( " 入库 " ) )
. eq ( GroupPlate : : getStoragevehicle_code , map . get ( " storagevehicle_code " ) )
. eq ( GroupPlate : : getStatus , IOSEnum . GROUP_PLATE_STATUS . code ( " 组盘 " ) ) ) ;
. eq ( GroupPlate : : getStatus , IOSEnum . GROUP_PLATE_STATUS . code ( " 组盘 " ) ) ) ;
// 更新分配明细表
ioStorInvDisMapper . update ( dis_map . toJavaObject ( IOStorInvDis . class ) , new LambdaUpdateWrapper < > ( IOStorInvDis . class )
. set ( IOStorInvDis : : getSect_id , dis_map . getString ( " sect_id " ) )
. set ( IOStorInvDis : : getSect_code , dis_map . getString ( " sect_code " ) )
. set ( IOStorInvDis : : getSect_name , dis_map . getString ( " sect_name " ) )
. set ( IOStorInvDis : : getStruct_id , dis_map . getString ( " struct_id " ) )
. set ( IOStorInvDis : : getStruct_code , dis_map . getString ( " struct_code " ) )
. set ( IOStorInvDis : : getStruct_name , dis_map . getString ( " struct_name " ) )
. eq ( IOStorInvDis : : getIostorinvdis_id , map . get ( " iostorinvdis_id " ) )
ioStorInvDisMapper . update ( dis_map . toJavaObject ( IOStorInvDis . class ) , new LambdaUpdateWrapper < > ( IOStorInvDis . class )
. set ( IOStorInvDis : : getSect_id , dis_map . getString ( " sect_id " ) )
. set ( IOStorInvDis : : getSect_code , dis_map . getString ( " sect_code " ) )
. set ( IOStorInvDis : : getSect_name , dis_map . getString ( " sect_name " ) )
. set ( IOStorInvDis : : getStruct_id , dis_map . getString ( " struct_id " ) )
. set ( IOStorInvDis : : getStruct_code , dis_map . getString ( " struct_code " ) )
. set ( IOStorInvDis : : getStruct_name , dis_map . getString ( " struct_name " ) )
. eq ( IOStorInvDis : : getIostorinvdis_id , map . get ( " iostorinvdis_id " ) )
) ;
//维护单据明细表里 分配数量
JSONObject jsonObject = new JSONObject ( ) ;
jsonObject . put ( " iostorinvdtl_id " , map . get ( " iostorinvdtl_id " ) ) ;
jsonObject . put ( " bill_status " , IOSEnum . BILL_STATUS . code ( " 分配完 " ) ) ;
jsonObject . put ( " assign_qty " , map . get ( " plan_qty " ) ) ;
jsonObject . put ( " unassign_qty " , " 0 " ) ;
jsonObject . put ( " iostorinvdtl_id " , map . get ( " iostorinvdtl_id " ) ) ;
jsonObject . put ( " bill_status " , IOSEnum . BILL_STATUS . code ( " 分配完 " ) ) ;
jsonObject . put ( " assign_qty " , map . get ( " plan_qty " ) ) ;
jsonObject . put ( " unassign_qty " , " 0 " ) ;
ioStorInvDtlMapper . updateById ( jsonObject . toJavaObject ( IOStorInvDtl . class ) ) ;
//根据单据标识判断分配明细是否都已经分配完成
int disCount = ioStorInvDisMapper . selectCount ( new LambdaQueryWrapper < > ( IOStorInvDis . class )
@@ -453,15 +452,15 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
@Override
@Transactional ( rollbackFor = Exception . class )
public void zwInDivStruct ( JSONObject param ) {
Assert . noNullElements ( new Object [ ] { param . getString ( " stor_code " ) , param . getString ( " sect_code " ) } , " 参数异常 " ) ;
Assert . noNullElements ( new Object [ ] { param . getString ( " stor_code " ) , param . getString ( " sect_code " ) } , " 参数异常 " ) ;
ArrayList < HashMap > rows = ( ArrayList < HashMap > ) param . get ( " tableMater " ) ;
JSONObject mst = JSONObject . parseObject ( JSON . toJSONString ( param ) ) ;
HashMap < String , String > map = rows . get ( 0 ) ;
//判断该分配明细是否已经分配货位
IOStorInvDis ioStorInvDis = ioStorInvDisMapper . selectOne ( new LambdaQueryWrapper < > ( IOStorInvDis . class )
. eq ( IOStorInvDis : : getIostorinvdis_id , map . get ( " iostorinvdis_id " ) )
. eq ( IOStorInvDis : : getIostorinvdis_id , map . get ( " iostorinvdis_id " ) )
. isNull ( IOStorInvDis : : getStruct_code ) ) ;
if ( ioStorInvDis = = null ) {
if ( ioStorInvDis = = null ) {
throw new BadRequestException ( " 当前明细已经分配过库位 " ) ;
}
String currentUserId = SecurityUtils . getCurrentUserId ( ) ;
@@ -529,29 +528,29 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
lock_map . put ( " inv_code " , ioStorInv . getBill_code ( ) ) ;
lock_map . put ( " inv_type " , ioStorInv . getBill_type ( ) ) ;
lock_map . put ( " lock_type " , IOSEnum . LOCK_TYPE . code ( " 入库锁 " ) ) ;
iStructattrService . updateStatusByCode ( " 0 " , lock_map ) ;
iStructattrService . updateStatusByCode ( " 0 " , lock_map ) ;
//更新组盘表状态
mdPbGroupplateService . update ( new LambdaUpdateWrapper < GroupPlate > ( )
. set ( GroupPlate : : getStatus , IOSEnum . GROUP_PLATE_STATUS . code ( " 入库 " ) )
. eq ( GroupPlate : : getStoragevehicle_code , map . get ( " storagevehicle_code " ) )
. eq ( GroupPlate : : getStatus , IOSEnum . GROUP_PLATE_STATUS . code ( " 组盘 " ) ) ) ;
. eq ( GroupPlate : : getStatus , IOSEnum . GROUP_PLATE_STATUS . code ( " 组盘 " ) ) ) ;
// 更新分配明细表
ioStorInvDisMapper . update ( dis_map . toJavaObject ( IOStorInvDis . class ) , new LambdaUpdateWrapper < > ( IOStorInvDis . class )
. set ( IOStorInvDis : : getSect_id , dis_map . getString ( " sect_id " ) )
. set ( IOStorInvDis : : getSect_code , dis_map . getString ( " sect_code " ) )
. set ( IOStorInvDis : : getSect_name , dis_map . getString ( " sect_name " ) )
. set ( IOStorInvDis : : getStruct_id , dis_map . getString ( " struct_id " ) )
. set ( IOStorInvDis : : getStoragevehicle_code , dis_map . getString ( " storagevehicle_code " ) )
. set ( IOStorInvDis : : getStruct_code , dis_map . getString ( " struct_code " ) )
. set ( IOStorInvDis : : getStruct_name , dis_map . getString ( " struct_name " ) )
. eq ( IOStorInvDis : : getIostorinvdis_id , map . get ( " iostorinvdis_id " ) )
ioStorInvDisMapper . update ( dis_map . toJavaObject ( IOStorInvDis . class ) , new LambdaUpdateWrapper < > ( IOStorInvDis . class )
. set ( IOStorInvDis : : getSect_id , dis_map . getString ( " sect_id " ) )
. set ( IOStorInvDis : : getSect_code , dis_map . getString ( " sect_code " ) )
. set ( IOStorInvDis : : getSect_name , dis_map . getString ( " sect_name " ) )
. set ( IOStorInvDis : : getStruct_id , dis_map . getString ( " struct_id " ) )
. set ( IOStorInvDis : : getStoragevehicle_code , dis_map . getString ( " storagevehicle_code " ) )
. set ( IOStorInvDis : : getStruct_code , dis_map . getString ( " struct_code " ) )
. set ( IOStorInvDis : : getStruct_name , dis_map . getString ( " struct_name " ) )
. eq ( IOStorInvDis : : getIostorinvdis_id , map . get ( " iostorinvdis_id " ) )
) ;
//维护单据明细表里 分配数量
JSONObject jsonObject = new JSONObject ( ) ;
jsonObject . put ( " iostorinvdtl_id " , map . get ( " iostorinvdtl_id " ) ) ;
jsonObject . put ( " bill_status " , IOSEnum . BILL_STATUS . code ( " 分配完 " ) ) ;
jsonObject . put ( " assign_qty " , map . get ( " plan_qty " ) ) ;
jsonObject . put ( " unassign_qty " , " 0 " ) ;
jsonObject . put ( " iostorinvdtl_id " , map . get ( " iostorinvdtl_id " ) ) ;
jsonObject . put ( " bill_status " , IOSEnum . BILL_STATUS . code ( " 分配完 " ) ) ;
jsonObject . put ( " assign_qty " , map . get ( " plan_qty " ) ) ;
jsonObject . put ( " unassign_qty " , " 0 " ) ;
ioStorInvDtlMapper . updateById ( jsonObject . toJavaObject ( IOStorInvDtl . class ) ) ;
//根据单据标识判断分配明细是否都已经分配完成
int disCount = ioStorInvDisMapper . selectCount ( new LambdaQueryWrapper < > ( IOStorInvDis . class )
@@ -568,7 +567,6 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
}
/**
* 根据库区策略获取仓位
* ioType 出入库类型
@@ -580,21 +578,21 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
*/
@Override
public Structattr getStructattr ( JSONObject param ) {
List < Structattr > structattrs = iStructattrService . inBoundSectDiv (
StrategyStructParam . builder ( )
. ioType ( param . getString ( " ioType " ) )
. sect_code ( param . getString ( " sect_code " ) )
. stor_code ( param . getString ( " stor_code " ) )
. material_code ( param . getString ( " material_code " ) )
. qty ( new BigDecimal ( param . getString ( " qty " ) ) )
. pcsn ( param . getString ( " pcsn " ) )
. stragegyType ( param . getString ( " stragegy_type " ) )
. is_empty_vehicle ( param . getBoolean ( " is_empty_vehicle " ) )
. build ( ) ) ;
if ( CollectionUtils . isEmpty ( structattrs ) ) {
throw new BadRequestException ( " 无可用货位 " ) ;
}
return structattrs . get ( 0 ) ;
List < Structattr > structattrs = iStructattrService . inBoundSectDiv (
StrategyStructParam . builder ( )
. ioType ( param . getString ( " ioType " ) )
. sect_code ( param . getString ( " sect_code " ) )
. stor_code ( param . getString ( " stor_code " ) )
. material_code ( param . getString ( " material_code " ) )
. qty ( new BigDecimal ( param . getString ( " qty " ) ) )
. pcsn ( param . getString ( " pcsn " ) )
. stragegyType ( param . getString ( " stragegy_type " ) )
. is_empty_vehicle ( param . getBoolean ( " is_empty_vehicle " ) )
. build ( ) ) ;
if ( CollectionUtils . isEmpty ( structattrs ) ) {
throw new BadRequestException ( " 无可用货位 " ) ;
}
return structattrs . get ( 0 ) ;
}
@@ -615,31 +613,31 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
unlock_map . put ( " inv_type " , null ) ;
unlock_map . put ( " inv_id " , null ) ;
unlock_map . put ( " inv_code " , null ) ;
iStructattrService . updateStatusByCode ( " 2 " , unlock_map ) ;
iStructattrService . updateStatusByCode ( " 2 " , unlock_map ) ;
// 修改分配明细表
ioStorInvDisMapper . update ( new IOStorInvDis ( ) , new LambdaUpdateWrapper < > ( IOStorInvDis . class )
. set ( IOStorInvDis : : getSect_id , null )
. set ( IOStorInvDis : : getSect_code , null )
. set ( IOStorInvDis : : getSect_name , null )
. set ( IOStorInvDis : : getStruct_id , null )
. set ( IOStorInvDis : : getStruct_code , null )
. set ( IOStorInvDis : : getStruct_name , null )
. eq ( IOStorInvDis : : getIostorinvdis_id , jo . get ( " iostorinvdis_id " ) )
ioStorInvDisMapper . update ( new IOStorInvDis ( ) , new LambdaUpdateWrapper < > ( IOStorInvDis . class )
. set ( IOStorInvDis : : getSect_id , null )
. set ( IOStorInvDis : : getSect_code , null )
. set ( IOStorInvDis : : getSect_name , null )
. set ( IOStorInvDis : : getStruct_id , null )
. set ( IOStorInvDis : : getStruct_code , null )
. set ( IOStorInvDis : : getStruct_name , null )
. eq ( IOStorInvDis : : getIostorinvdis_id , jo . get ( " iostorinvdis_id " ) )
) ;
//维护单据明细表里 分配数量
JSONObject jsonObject = new JSONObject ( ) ;
jsonObject . put ( " iostorinvdtl_id " , jo . get ( " iostorinvdtl_id " ) ) ;
jsonObject . put ( " bill_status " , IOSEnum . BILL_STATUS . code ( " 生成 " ) ) ;
jsonObject . put ( " assign_qty " , " 0 " ) ;
jsonObject . put ( " unassign_qty " , jo . get ( " plan_qty " ) ) ;
jsonObject . put ( " iostorinvdtl_id " , jo . get ( " iostorinvdtl_id " ) ) ;
jsonObject . put ( " bill_status " , IOSEnum . BILL_STATUS . code ( " 生成 " ) ) ;
jsonObject . put ( " assign_qty " , " 0 " ) ;
jsonObject . put ( " unassign_qty " , jo . get ( " plan_qty " ) ) ;
ioStorInvDtlMapper . updateById ( jsonObject . toJavaObject ( IOStorInvDtl . class ) ) ;
//根据单据标识判断分配明细是否都已经分配完成
int disCount = ioStorInvDisMapper . selectCount ( new LambdaQueryWrapper < > ( IOStorInvDis . class )
. eq ( IOStorInvDis : : getIostorinv_id , jo . get ( " iostorinv_id " ) )
. and ( wrapper - > wrapper . isNotNull ( IOStorInvDis : : getStruct_code ) . or ( ) . ne ( IOStorInvDis : : getStruct_code , " " ) ) ) ;
. eq ( IOStorInvDis : : getIostorinv_id , jo . get ( " iostorinv_id " ) )
. and ( wrapper - > wrapper . isNotNull ( IOStorInvDis : : getStruct_code ) . or ( ) . ne ( IOStorInvDis : : getStruct_code , " " ) ) ) ;
// 根据分配货位情况 更新主表单据状态
IOStorInv ios = new IOStorInv ( ) ;
@@ -647,7 +645,7 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
ios . setUpdate_optid ( currentUserId ) ;
ios . setUpdate_optname ( nickName ) ;
ios . setUpdate_time ( now ) ;
ios . setBill_status ( disCount > 0 ? IOSEnum . BILL_STATUS . code ( " 分配中 " ) : IOSEnum . BILL_STATUS . code ( " 生成 " ) ) ;
ios . setBill_status ( disCount > 0 ? IOSEnum . BILL_STATUS . code ( " 分配中 " ) : IOSEnum . BILL_STATUS . code ( " 生成 " ) ) ;
ioStorInvMapper . updateById ( ios ) ;
}
@@ -660,9 +658,9 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
//判断是否已经分配好货位
IOStorInvDis ioStorInvDis = ioStorInvDisMapper . selectOne ( new LambdaQueryWrapper < > ( IOStorInvDis . class )
. eq ( IOStorInvDis : : getIostorinvdis_id , map . get ( " iostorinvdis_id " ) )
. and ( wrapper - > wrapper . isNotNull ( IOStorInvDis : : getStruct_code ) . or ( ) . ne ( IOStorInvDis : : getStruct_code , " " ) ) ) ;
if ( ObjectUtil . isEmpty ( ioStorInvDis ) ) {
. eq ( IOStorInvDis : : getIostorinvdis_id , map . get ( " iostorinvdis_id " ) )
. and ( wrapper - > wrapper . isNotNull ( IOStorInvDis : : getStruct_code ) . or ( ) . ne ( IOStorInvDis : : getStruct_code , " " ) ) ) ;
if ( ObjectUtil . isEmpty ( ioStorInvDis ) ) {
throw new BadRequestException ( " 该明细还没分配货位,请先分配货位 " ) ;
}
IOStorInv invObj = this . getById ( map . get ( " iostorinv_id " ) ) ;
@@ -684,9 +682,9 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
SchBasePoint parentPoint = pointService . getById ( rkPoint . getParent_point_code ( ) ) ;
// 2、创建任务( 4条任务、优先级需要获取所有的任务中的最小值并且-1, 默认8)
// 获取工单对应的区域的出入点
SchBasePoint intoPoint = pointService . getNotTaskByRegion AndType ( parentPoint . getRegion _code ( ) , " 2 " ) ;
SchBasePoint emptyPoint = pointService . getNotTaskByRegion AndType ( parentPoint . getRegion _code ( ) , " 5 " ) ;
SchBasePoint fullPoint = pointService . getNotTaskByRegion AndType ( parentPoint . getRegion _code ( ) , " 6 " ) ;
SchBasePoint intoPoint = pointService . getNotTaskByDevice AndType ( parentPoint . getPoint _code ( ) , " 2 " ) ;
SchBasePoint emptyPoint = pointService . getNotTaskByDevice AndType ( parentPoint . getPoint _code ( ) , " 5 " ) ;
SchBasePoint fullPoint = pointService . getNotTaskByDevice AndType ( parentPoint . getPoint _code ( ) , " 6 " ) ;
// 获取无盖子的对应的点位
List < SchBasePoint > canUseCFGJs = pointService . getCanUseCFGJs ( parentPoint , " 1 " ) ;
if ( canUseCFGJs . size ( ) = = 0 ) {
@@ -769,8 +767,8 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
SchBasePoint rkPoint = pointService . getById ( point_code ) ;
// 父点位
SchBasePoint parentPoint = pointService . getById ( rkPoint . getParent_point_code ( ) ) ;
SchBasePoint fullPoint = pointService . getNotTaskByRegion AndType ( parentPoint . getRegion _code ( ) , " 3 " ) ;
SchBasePoint emptyPoint = pointService . getNotTaskByRegion AndType ( parentPoint . getRegion _code ( ) , " 4 " ) ;
SchBasePoint fullPoint = pointService . getNotTaskByDevice AndType ( parentPoint . getPoint _code ( ) , " 3 " ) ;
SchBasePoint emptyPoint = pointService . getNotTaskByDevice AndType ( parentPoint . getPoint _code ( ) , " 4 " ) ;
JSONObject task = new JSONObject ( ) ;
task . put ( " task_type " , " JbBackAgvTask " ) ;
task . put ( " group_id " , groupPlate . getGroup_id ( ) ) ;
@@ -780,13 +778,15 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
task . put ( " point_code2 " , emptyPoint . getPoint_code ( ) ) ;
task . put ( " point_code3 " , fullPoint . getPoint_code ( ) ) ;
task . put ( " point_code4 " , structCode ) ;
task . put ( " task_group_seq " , whereJson . get ( " task_group_seq " ) ) ;
task . put ( " task_group_id " , whereJson . get ( " task_group_id " ) ) ;
task . put ( " vehicle_code " , fullPoint . getVehicle_code ( ) ) ;
task . put ( " vehicle_code2 " , structattr . getStoragevehicle_code ( ) ) ;
task_id = jbBackAgvTask . create ( task ) ;
} else if ( StatusEnum . IOBILL_TYPE_IN . code ( " 来料入库 " ) . equals ( invObj . getBill_type ( ) ) ) {
// 获取组盘信息
GroupPlate groupPlate = mdPbGroupplateService . getOne ( new LambdaQueryWrapper < GroupPlate > ( )
. eq ( GroupPlate : : getStoragevehicle_code , whereJson . get ( " vehicle_code " ) )
. eq ( GroupPlate : : getStoragevehicle_code , whereJson . get ( " vehicle_code " ) )
. eq ( GroupPlate : : getStatus , IOSEnum . GROUP_PLATE_STATUS . code ( " 入库 " ) ) ) ;
if ( ObjectUtil . isEmpty ( groupPlate ) ) {
throw new BadRequestException ( " 托盘[ " + whereJson . get ( " vehicle_code " ) + " ]状态为组盘的信息不存在! " ) ;
@@ -794,16 +794,16 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
JSONObject task = new JSONObject ( ) ;
task . put ( " config_code " , IOSConstant . IN_BILL_TASK ) ;
task . put ( " group_id " , groupPlate . getGroup_id ( ) ) ;
task . put ( " priority " , whereJson . get ( " priority " ) ) ;
task . put ( " task_group_seq " , whereJson . get ( " task_group_seq " ) ) ;
task . put ( " task_group_id " , whereJson . get ( " task_group_id " ) ) ;
task . put ( " priority " , whereJson . get ( " priority " ) ) ;
task . put ( " task_group_seq " , whereJson . get ( " task_group_seq " ) ) ;
task . put ( " task_group_id " , whereJson . get ( " task_group_id " ) ) ;
task . put ( " task_code " , CodeUtil . getNewCode ( " TASK_CODE " ) ) ;
task . put ( " point_code1 " , ioStorInvDis . getStruct_code ( ) ) ;
task . put ( " point_code1 " , ioStorInvDis . getStruct_code ( ) ) ;
task . put ( " point_code2 " , whereJson . get ( " point_code2 " ) ) ;
task . put ( " point_code3 " , whereJson . get ( " point_code3 " ) ) ;
task . put ( " point_code4 " , ioStorInvDis . getStruct_code ( ) ) ;
task . put ( " form_data_code " , whereJson . get ( " form_data_code " ) ) ;
task . put ( " form_data_code " , whereJson . get ( " form_data_code " ) ) ;
//第一个载具为计算得到的,第二个载具为起始点载具
task . put ( " vehicle_code " , ioStorInvDis . getStoragevehicle_code ( ) ) ;
@@ -820,14 +820,14 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
JSONObject task = new JSONObject ( ) ;
task . put ( " config_code " , IOSConstant . BACK_IN_TASK ) ;
task . put ( " group_id " , groupPlate . getGroup_id ( ) ) ;
task . put ( " priority " , whereJson . get ( " priority " ) ) ;
task . put ( " task_group_seq " , whereJson . get ( " task_group_seq " ) ) ;
task . put ( " task_group_id " , whereJson . get ( " task_group_id " ) ) ;
task . put ( " priority " , whereJson . get ( " priority " ) ) ;
task . put ( " task_group_seq " , whereJson . get ( " task_group_seq " ) ) ;
task . put ( " task_group_id " , whereJson . get ( " task_group_id " ) ) ;
task . put ( " task_code " , CodeUtil . getNewCode ( " TASK_CODE " ) ) ;
task . put ( " point_code1 " , whereJson . get ( " point_code " ) ) ;
task . put ( " point_code1 " , whereJson . get ( " point_code " ) ) ;
task . put ( " point_code2 " , ioStorInvDis . getStruct_code ( ) ) ;
task . put ( " form_data_code " , whereJson . get ( " form_data_code " ) ) ;
task . put ( " form_data_code " , whereJson . get ( " form_data_code " ) ) ;
//第一个载具为计算得到的,第二个载具为起始点载具
task . put ( " vehicle_code " , ioStorInvDis . getStoragevehicle_code ( ) ) ;
@@ -884,27 +884,27 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
String now = DateUtil . now ( ) ;
IOStorInv ioStorInv = ioStorInvMapper . selectOne ( new LambdaQueryWrapper < > ( IOStorInv . class )
. eq ( IOStorInv : : getIostorinv_id , whereJson . get ( " iostorinv_id " ) )
. eq ( IOStorInv : : getIostorinv_id , whereJson . get ( " iostorinv_id " ) )
) ;
if ( ObjectUtil . isNotEmpty ( ioStorInv ) & & ! IOSEnum . BILL_STATUS . code ( " 分配完 " ) . equals ( ioStorInv . getBill_status ( ) ) ) {
if ( ObjectUtil . isNotEmpty ( ioStorInv ) & & ! IOSEnum . BILL_STATUS . code ( " 分配完 " ) . equals ( ioStorInv . getBill_status ( ) ) ) {
throw new BadRequestException ( " 主表状态必须为分配完! " ) ;
}
//解锁原货位点位
List < IOStorInvDis > storInvDisList = ioStorInvDisMapper . selectList ( new LambdaQueryWrapper < > ( IOStorInvDis . class )
. eq ( IOStorInvDis : : getIostorinv_id , whereJson . get ( " iostorinv_id " ) )
. eq ( IOStorInvDis : : getIostorinv_id , whereJson . get ( " iostorinv_id " ) )
) ;
for ( IOStorInvDis ioStorInvDis : storInvDisList ) {
if ( StrUtil . isNotBlank ( ioStorInvDis . getStruct_code ( ) ) ) {
for ( IOStorInvDis ioStorInvDis : storInvDisList ) {
if ( StrUtil . isNotBlank ( ioStorInvDis . getStruct_code ( ) ) ) {
JSONObject finish_map = new JSONObject ( ) ;
finish_map . put ( " struct_code " , ioStorInvDis . getStruct_code ( ) ) ;
finish_map . put ( " storagevehicle_code " , ioStorInvDis . getStoragevehicle_code ( ) ) ;
finish_map . put ( " struct_code " , ioStorInvDis . getStruct_code ( ) ) ;
finish_map . put ( " storagevehicle_code " , ioStorInvDis . getStoragevehicle_code ( ) ) ;
finish_map . put ( " inv_type " , null ) ;
finish_map . put ( " inv_id " , null ) ;
finish_map . put ( " inv_code " , null ) ;
iStructattrService . updateStatusByCode ( " 1 " , finish_map ) ;
iStructattrService . updateStatusByCode ( " 1 " , finish_map ) ;
//修改库存
List < JSONObject > updateIvtList = new ArrayList < > ( ) ;
@@ -921,35 +921,35 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
}
//更新详情数据
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 ( ) )
. ne ( IOStorInvDis : : getWork_status , IOSEnum . INBILL_DIS_STATUS . code ( " 完成 " ) )
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 ( ) )
. 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 ( " 完成 " ) )
. set ( IOStorInvDtl : : getReal_qty , ioStorInvDis . getPlan_qty ( ) )
. eq ( IOStorInvDtl : : getIostorinvdtl_id , ioStorInvDis . getIostorinvdtl_id ( ) )
. ne ( IOStorInvDtl : : getBill_status , IOSEnum . BILL_STATUS . code ( " 完成 " ) )
ioStorInvDtlMapper . update ( new IOStorInvDtl ( ) , new LambdaUpdateWrapper < > ( IOStorInvDtl . class )
. set ( IOStorInvDtl : : getBill_status , IOSEnum . BILL_STATUS . code ( " 完成 " ) )
. set ( IOStorInvDtl : : getReal_qty , ioStorInvDis . getPlan_qty ( ) )
. eq ( IOStorInvDtl : : getIostorinvdtl_id , ioStorInvDis . getIostorinvdtl_id ( ) )
. ne ( IOStorInvDtl : : getBill_status , IOSEnum . BILL_STATUS . code ( " 完成 " ) )
) ;
//更新组盘记录表
mdPbGroupplateService . 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 ( ) )
mdPbGroupplateService . 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 ( ) )
) ;
}
//更新主表状态
ioStorInvMapper . update ( 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 , whereJson . get ( " iostorinv_id " ) )
ioStorInvMapper . update ( 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 , whereJson . get ( " iostorinv_id " ) )
) ;
}
@@ -963,37 +963,37 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
String now = DateUtil . now ( ) ;
IOStorInvDis ioStorInvDis = ioStorInvDisMapper . selectOne ( new LambdaQueryWrapper < > ( IOStorInvDis . class )
. eq ( IOStorInvDis : : getTask_id , task . getTask_id ( ) )
. eq ( IOStorInvDis : : getTask_id , task . getTask_id ( ) )
) ;
if ( ObjectUtil . isEmpty ( ioStorInvDis ) ) {
if ( ObjectUtil . isEmpty ( ioStorInvDis ) ) {
throw new BadRequestException ( " 未找到任务对应的分配明细 " ) ;
}
// 明细
IOStorInvDtl ioStorInvDtl = ioStorInvDtlMapper . selectById ( ioStorInvDis . getIostorinvdtl_id ( ) ) ;
if ( ObjectUtil . isEmpty ( ioStorInvDtl ) ) {
if ( ObjectUtil . isEmpty ( ioStorInvDtl ) ) {
throw new BadRequestException ( " 未找到明细 " ) ;
}
// 明细
IOStorInv ioStorInv = ioStorInvMapper . selectById ( ioStorInvDis . getIostorinv_id ( ) ) ;
if ( ObjectUtil . isEmpty ( ioStorInv ) ) {
if ( ObjectUtil . isEmpty ( ioStorInv ) ) {
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 ( ) )
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 " , ioStorInvDis . getStoragevehicle_code ( ) ) ;
finish_map . put ( " struct_code " , ioStorInvDis . getStruct_code ( ) ) ;
finish_map . put ( " storagevehicle_code " , ioStorInvDis . getStoragevehicle_code ( ) ) ;
finish_map . put ( " inv_type " , null ) ;
finish_map . put ( " inv_id " , null ) ;
finish_map . put ( " inv_code " , null ) ;
finish_map . put ( " occupancy_state " , " 3 " ) ;
iStructattrService . updateStatusByCode ( " 1 " , finish_map ) ;
finish_map . put ( " occupancy_state " , " 3 " ) ;
iStructattrService . updateStatusByCode ( " 1 " , finish_map ) ;
//库存变动
StructattrChangeDto changeDto = StructattrChangeDto . builder ( )
. inv ( ioStorInv . getIostorinv_id ( ) )
@@ -1003,29 +1003,29 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
// 查询该明细下是否还有未完成的分配明细
int countDis = ioStorInvDisMapper . selectCount ( new LambdaQueryWrapper < > ( IOStorInvDis . class )
. eq ( IOStorInvDis : : getIostorinvdtl_id , ioStorInvDis . getIostorinvdtl_id ( ) )
. ne ( IOStorInvDis : : getWork_status , IOSEnum . INBILL_DIS_STATUS . code ( " 完成 " ) )
. eq ( IOStorInvDis : : getIostorinvdtl_id , ioStorInvDis . getIostorinvdtl_id ( ) )
. ne ( IOStorInvDis : : getWork_status , IOSEnum . INBILL_DIS_STATUS . code ( " 完成 " ) )
) ;
// 如果分配明细全部完成则更新明细表状态
if ( countDis = = 0 ) {
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 ( " 完成 " ) )
. eq ( IOStorInvDtl : : getIostorinv_id , ioStorInvDtl . getIostorinv_id ( ) )
. ne ( IOStorInvDtl : : getBill_status , IOSEnum . BILL_STATUS . code ( " 完成 " ) )
) ;
// 如果明细全部完成则更新主表状态
if ( countDtl = = 0 ) {
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 ( ) )
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 ( ) )
) ;
}
}
@@ -1044,17 +1044,17 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
String storagevehicle_code = whereJson . getString ( " storagevehicle_code " ) ;
// 查询没有任务的仓位号
List < Structattr > structattrList = iStructattrService . list ( new LambdaQueryWrapper < > ( Structattr . class )
. eq ( Structattr : : getSect_id , sect_id )
. eq ( Structattr : : getLock_type , IOSEnum . LOCK_TYPE . code ( " 未锁定 " ) )
. and ( wrapper - > wrapper . isNull ( Structattr : : getStoragevehicle_code ) . or ( ) . eq ( Structattr : : getStoragevehicle_code , " " ) )
. eq ( Structattr : : getSect_id , sect_id )
. eq ( Structattr : : getLock_type , IOSEnum . LOCK_TYPE . code ( " 未锁定 " ) )
. and ( wrapper - > wrapper . isNull ( Structattr : : getStoragevehicle_code ) . or ( ) . eq ( Structattr : : getStoragevehicle_code , " " ) )
) ;
if ( ObjectUtil . isEmpty ( structattrList ) ) {
if ( ObjectUtil . isEmpty ( structattrList ) ) {
throw new BadRequestException ( " 该库区没有仓位 " ) ;
}
MdPbStoragevehicleinfo mdPbStoragevehicleinfo = mdPbStoragevehicleinfoMapper . selectOne ( new LambdaQueryWrapper < > ( MdPbStoragevehicleinfo . class )
. eq ( MdPbStoragevehicleinfo : : getStoragevehicle_code , storagevehicle_code )
. eq ( MdPbStoragevehicleinfo : : getStoragevehicle_code , storagevehicle_code )
) ;
if ( ObjectUtil . isEmpty ( mdPbStoragevehicleinfo ) ) {
if ( ObjectUtil . isEmpty ( mdPbStoragevehicleinfo ) ) {
throw new BadRequestException ( " 没有该载具号信息 " ) ;
}
// 过滤掉不满足载具长宽高的仓位
@@ -1064,7 +1064,7 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
st . getZdepth ( ) > = 0
) . findAny ( ) . get ( ) ;
if ( ObjectUtil . isEmpty ( structattr ) ) {
if ( ObjectUtil . isEmpty ( structattr ) ) {
throw new BadRequestException ( " 未找到满足的仓位 " ) ;
}