|
|
@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.nl.common.domain.query.PageQuery; |
|
|
|
import org.nl.common.exception.BadRequestException; |
|
|
|
import org.nl.common.utils.CodeUtil; |
|
|
@ -1178,6 +1179,15 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void taskFinish(SchBaseTask task) { |
|
|
|
//解锁库位
|
|
|
|
JSONObject finish_map = new JSONObject(); |
|
|
|
finish_map.put("struct_code", task.getPoint_code1()); |
|
|
|
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); |
|
|
|
if (StringUtils.isBlank(task.getHandle_status())) { |
|
|
|
String currentUserId = SecurityUtils.getCurrentUserId(); |
|
|
|
String nickName = SecurityUtils.getCurrentNickName(); |
|
|
|
String now = DateUtil.now(); |
|
|
@ -1188,62 +1198,57 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i |
|
|
|
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()) |
|
|
|
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()); |
|
|
|
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); |
|
|
|
iMdPbGroupPlateService.updateIvt(updateIvtList); |
|
|
|
//修改库存,恢复库存,手持进行减扣,无需修改,需要载具出库确认后更改
|
|
|
|
// 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);
|
|
|
|
// 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("完成")) |
|
|
|
.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)){ |
|
|
|
if (ObjectUtil.isEmpty(ioStorInvDtl)) { |
|
|
|
throw new BadRequestException("未找到明细"); |
|
|
|
} |
|
|
|
// 如果分配明细全部完成则更新明细表状态
|
|
|
|
if (countDis == 0){ |
|
|
|
if (countDis == 0) { |
|
|
|
// 更新明细表状态
|
|
|
|
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()) |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|