|
|
@ -2,7 +2,6 @@ package org.nl.wms.warehouse_management.service.impl; |
|
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
import cn.hutool.core.map.MapUtil; |
|
|
|
import cn.hutool.core.util.NumberUtil; |
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
@ -24,8 +23,6 @@ import org.nl.wms.basedata_manage.service.IBsrealStorattrService; |
|
|
|
import org.nl.wms.basedata_manage.service.IMdPbStoragevehicleextService; |
|
|
|
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.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.dto.MdPbStoragevehicleextDto; |
|
|
|
import org.nl.wms.sch_manage.enums.TaskStatus; |
|
|
@ -33,10 +30,10 @@ import org.nl.wms.sch_manage.service.ISchBaseTaskService; |
|
|
|
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.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.IOSEnum; |
|
|
|
import org.nl.wms.warehouse_management.service.IMdPbGroupplateService; |
|
|
|
import org.nl.wms.warehouse_management.service.IOutBillService; |
|
|
|
import org.nl.wms.warehouse_management.service.dao.GroupPlate; |
|
|
|
import org.nl.wms.warehouse_management.service.dao.IOStorInv; |
|
|
@ -99,10 +96,12 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i |
|
|
|
private IOStorInvDtlMapper ioStorInvDtlMapper; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
private SchBasePointMapper schBasePointMapper; |
|
|
|
|
|
|
|
@Resource |
|
|
|
private IMdPbGroupplateService iMdPbGroupPlateService; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public IPage<IOStorInv> pageQuery(Map whereJson, PageQuery page, String[] stor_id, String[] bill_status, String[] bill_type) { |
|
|
@ -934,7 +933,6 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i |
|
|
|
} |
|
|
|
|
|
|
|
for (IOStorInvDis ioStorInvDis:ioStorInvDisList){ |
|
|
|
|
|
|
|
//更新库存 减冻结加可用
|
|
|
|
List<JSONObject> updateIvtList = new ArrayList<>(); |
|
|
|
JSONObject jsonIvt = new JSONObject(); |
|
|
@ -1145,21 +1143,21 @@ 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) |
|
|
|
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) |
|
|
|
.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")) |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
@ -1169,27 +1167,31 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i |
|
|
|
return ioStorInvDisMapper.getBillTaskDtl(iostorinvdtl_id); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 任务完成,减库存 |
|
|
|
* 1.解锁库位 |
|
|
|
* 2.修改库存 |
|
|
|
* 3.完成当前分配明细 |
|
|
|
* 4.更新所有出库单明细及主表 |
|
|
|
*/ |
|
|
|
@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()) |
|
|
|
.eq(IOStorInvDis::getTask_id, task.getTask_id()) |
|
|
|
); |
|
|
|
if (ObjectUtil.isEmpty(ioStorInvDis)){ |
|
|
|
if (ObjectUtil.isEmpty(ioStorInvDis)) { |
|
|
|
throw new BadRequestException("未找到任务对应的分配明细"); |
|
|
|
} |
|
|
|
|
|
|
|
// 完成当前分配明细
|
|
|
|
ioStorInvDisMapper.update(ioStorInvDis,new LambdaUpdateWrapper<>(IOStorInvDis.class) |
|
|
|
.set(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("完成")) |
|
|
|
.eq(IOStorInvDis::getIostorinvdis_id,ioStorInvDis.getIostorinvdis_id()) |
|
|
|
); |
|
|
|
|
|
|
|
//解锁库位
|
|
|
|
JSONObject finish_map = new JSONObject(); |
|
|
|
finish_map.put("struct_code",ioStorInvDis.getStruct_code()); |
|
|
@ -1198,7 +1200,6 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i |
|
|
|
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(); |
|
|
@ -1210,29 +1211,12 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i |
|
|
|
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()) |
|
|
|
); |
|
|
|
|
|
|
|
//更新组盘记录表
|
|
|
|
mdPbGroupplateMapper.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()) |
|
|
|
); |
|
|
|
|
|
|
|
iMdPbGroupPlateService.updateIvt(updateIvtList); |
|
|
|
// 查询该明细下是否还有未完成的分配明细
|
|
|
|
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)){ |
|
|
@ -1243,13 +1227,11 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i |
|
|
|
// 更新明细表状态
|
|
|
|
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){ |
|
|
|
//更新主表状态
|
|
|
|