skyouc
2 天以前 d36f413965c4ef2ea35a7e0ecefd32001a1e66f8
rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/PdaOutStockServiceImpl.java
@@ -248,7 +248,7 @@
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public R wavePickItems(WavePickItemsParams params) {
    public synchronized R wavePickItems(WavePickItemsParams params) {
        if (Objects.isNull(params.getBarcode())) {
            return R.error("托盘码不能为空!!");
        }
@@ -326,19 +326,26 @@
                TaskItem item = taskItemService.getById(taskItem.getId());
                //判断是否允许超收,不允许超收添加拒收判断
                if (!Objects.isNull(config)) {
                    LocItemWorking serviceOne = locItemWorkingService.getOne(new LambdaQueryWrapper<LocItemWorking>().eq(LocItemWorking::getFieldsIndex, item.getFieldsIndex()));
                    TaskItem serviceOne = taskItemService.getOne(new LambdaQueryWrapper<TaskItem>()
                            .eq(TaskItem::getTaskId, task.getId())
                            .eq(TaskItem::getFieldsIndex, item.getFieldsIndex()));
                    if (Objects.isNull(serviceOne)) {
                        throw new CoolException("缓存数据丢失!!");
                    }
                    LocItemWorking workItem = locItemWorkingService.getOne(new LambdaQueryWrapper<LocItemWorking>()
                            .eq(LocItemWorking::getTaskId, task.getId())
                            .eq(LocItemWorking::getFieldsIndex, item.getFieldsIndex()));
                    if (Objects.isNull(workItem)) {
                        throw new CoolException("缓存数据丢失!!");
                    }
                    Double v1 = Math.round((workItem.getAnfme() - serviceOne.getQty()) * 1000000) / 1000000.0;
                    //不管是否允许超收,都需判断是否超出库存范围
                    if (taskItem.getAnfme().compareTo(serviceOne.getAnfme()) > 0) {
                    if (taskItem.getAnfme().compareTo(v1) > 0) {
                        throw new CoolException("拣货数量超出当前票号库存数量!!");
                    }
                    if (!Boolean.parseBoolean(config.getVal())) {
                        Double v = Math.round((item.getQty() + taskItem.getAnfme()) * 1000000) / 1000000.0;
                        if (item.getAnfme().compareTo(v) < 0.0) {
                            throw new CoolException("前当物料已超出可拣范围,请核对后再操作!!");
                        }
                    }
@@ -442,13 +449,15 @@
               throw new CoolException("任务明细修改失败");
            }
            LocItemWorking oldOne = locItemWorkingService.getOne(new LambdaQueryWrapper<LocItemWorking>()
                    .eq(LocItemWorking::getTaskId, byId.getTaskId())
                    .eq(LocItemWorking::getMatnrCode, byId.getMatnrCode())
                    .eq(LocItemWorking::getFieldsIndex, byId.getFieldsIndex()));
            if (Objects.isNull(oldOne)) {
                throw new CoolException("明细不存在或已出库!!");
            }
            LocItemWorking one = locItemWorkingService.getOne(new LambdaQueryWrapper<LocItemWorking>()
                            .eq(LocItemWorking::getMatnrCode, byId.getMatnrCode())
                    .eq(LocItemWorking::getTaskId, byId.getTaskId())
                    .eq(LocItemWorking::getMatnrCode, byId.getMatnrCode())
                    .eq(LocItemWorking::getFieldsIndex, uuid));
            if (Objects.isNull(one)) {
                throw new CoolException("明细不存在或已出库!!");