| | |
| | | List<AddProcurementDto> value = entry.getValue(); |
| | | TErpProcurement tErpProcurement = new TErpProcurement(); |
| | | tErpProcurement.setClinicId(clinicSupplierId); |
| | | tErpProcurement.setProcurementCode("C" + DateUtils.dateTimeNow()); |
| | | |
| | | tErpProcurement.setSupplierId(supplierClinicId); |
| | | |
| | | tErpProcurement.setTermNo(supplier.getTermNo()); |
| | |
| | | throw new RuntimeException("金额设置错误,请联系平台管理员"); |
| | | } |
| | | tErpProcurement.setSupplierMoney(supplierCommissionPrice); |
| | | this.save(tErpProcurement); |
| | | |
| | | |
| | | // 获取上一条最新的数据 |
| | | TErpProcurement tErpProcurement1 = this.baseMapper.selectOne(new QueryWrapper<TErpProcurement>().orderByDesc("create_time").orderByDesc("procurement_code").last("limit 1")); |
| | | if(tErpProcurement1==null){ |
| | | tErpProcurement.setProcurementCode("C" + DateUtils.dateTimeNow()+"00001"); |
| | | }else { |
| | | String lastProcurementCode = tErpProcurement1.getProcurementCode(); |
| | | String datePart = "C" + DateUtils.dateTimeNow(); |
| | | |
| | | // 直接获取后五位数字并+1,不考虑是否同一天 |
| | | try { |
| | | String numberPart = lastProcurementCode.substring(Math.max(0, lastProcurementCode.length() - 5)); |
| | | int number = Integer.parseInt(numberPart); |
| | | if (number < 99999) { |
| | | number++; |
| | | } else { |
| | | number = 2; // 达到99999后重置为00002 |
| | | } |
| | | tErpProcurement.setProcurementCode(datePart + String.format("%05d", number)); |
| | | } catch (NumberFormatException e) { |
| | | // 如果解析失败,默认从00001开始 |
| | | tErpProcurement.setProcurementCode(datePart + "00001"); |
| | | } |
| | | |
| | | } |
| | | try { |
| | | this.save(tErpProcurement); |
| | | }catch (Exception e){ |
| | | throw new RuntimeException("网络繁忙,请重试"); |
| | | } |
| | | tErpProcurementGoods1.forEach(e -> e.setProcurementId(tErpProcurement.getId())); |
| | | erpProcurementGoodsService.saveBatch(tErpProcurementGoods1); |
| | | } |
| | |
| | | TErpProcurement tErpProcurement = this.getById(id); |
| | | if (tErpProcurement.getWarehousingUserId()!=null && !tErpProcurement.getWarehousingUserId().isEmpty()) { |
| | | SysUser sysUser = sysUserMapper.selectUserById(Long.valueOf(tErpProcurement.getWarehousingUserId())); |
| | | detailProcurementVO.setWarehousingUserName(sysUser.getUserName()); |
| | | detailProcurementVO.setWarehousingUserName(sysUser.getNickName()); |
| | | } |
| | | detailProcurementVO.setWarehousingTime(tErpProcurement.getWarehousingTime()); |
| | | |
| | |
| | | detailProcurementVO.setSendTime(tErpProcurement.getSendTime()); |
| | | TCrmSupplier supplier = crmSupplierMapper.selectById(tErpProcurement.getSupplierId()); |
| | | detailProcurementVO.setSupplierName(supplier.getSupplierName()); |
| | | detailProcurementVO.setUserName(sysUserMapper.selectUserById(Long.valueOf(tErpProcurement.getCreateId())).getUserName()); |
| | | detailProcurementVO.setUserName(sysUserMapper.selectUserById(Long.valueOf(tErpProcurement.getCreateId())).getNickName()); |
| | | TCrmClinic tCrmClinic = crmClinicMapper.selectById(tErpProcurement.getClinicId()); |
| | | detailProcurementVO.setClinicName(tCrmClinic.getClinicName()); |
| | | detailProcurementVO.setClinicAddress(tCrmClinic.getClinicAddress()); |
| | |
| | | tErpSupplierOutbound.setOutboundType(7); |
| | | //TODO 确定这个是采购价还是销售价格 |
| | | tErpSupplierOutbound.setTotalMoney(tErpProcurementGoods.getPurchasePrice().multiply(new BigDecimal(purchaseCount))); |
| | | tErpSupplierOutbound.setOutboundNumber("G" + DateUtils.dateTimeNow()); |
| | | erpSupplierOutboundMapper.insert(tErpSupplierOutbound); |
| | | |
| | | TErpSupplierOutbound last = erpSupplierOutboundMapper.selectOne(new LambdaQueryWrapper<TErpSupplierOutbound>().orderByDesc(BaseModel::getCreateTime).orderByDesc(TErpSupplierOutbound::getOutboundNumber).last("limit 1")); |
| | | if(last==null){ |
| | | tErpSupplierOutbound.setOutboundNumber("G" + DateUtils.dateTimeNow()+"00001"); |
| | | }else { |
| | | String lastProcurementCode = last.getOutboundNumber(); |
| | | String datePart = "G" + DateUtils.dateTimeNow(); |
| | | |
| | | // 直接获取后五位数字并+1,不考虑是否同一天 |
| | | try { |
| | | String numberPart = lastProcurementCode.substring(Math.max(0, lastProcurementCode.length() - 5)); |
| | | int number = Integer.parseInt(numberPart); |
| | | if (number < 99999) { |
| | | number++; |
| | | } else { |
| | | number = 2; // 达到99999后重置为00002 |
| | | } |
| | | tErpSupplierOutbound.setOutboundNumber(datePart + String.format("%05d", number)); |
| | | } catch (NumberFormatException e) { |
| | | // 如果解析失败,默认从00001开始 |
| | | tErpSupplierOutbound.setOutboundNumber(datePart + "00001"); |
| | | } |
| | | } |
| | | try { |
| | | erpSupplierOutboundMapper.insert(tErpSupplierOutbound); |
| | | }catch (Exception e){ |
| | | throw new RuntimeException("网络繁忙,请重试"); |
| | | } |
| | | |
| | | TErpSupplierOutboundGoods tErpSupplierOutboundGoods = new TErpSupplierOutboundGoods(); |
| | | tErpSupplierOutboundGoods.setOutboundId(tErpSupplierOutbound.getId()); |
| | |
| | | tErpSupplierOutbound.setOutboundType(7); |
| | | //TODO 确定这个是采购价还是销售价格 |
| | | tErpSupplierOutbound.setTotalMoney(tErpProcurementGoods.getPurchasePrice().multiply(new BigDecimal(purchaseCount))); |
| | | tErpSupplierOutbound.setOutboundNumber("G" + DateUtils.dateTimeNow()); |
| | | erpSupplierOutboundMapper.insert(tErpSupplierOutbound); |
| | | TErpSupplierOutbound last = erpSupplierOutboundMapper.selectOne(new LambdaQueryWrapper<TErpSupplierOutbound>().orderByDesc(BaseModel::getCreateTime).orderByDesc(TErpSupplierOutbound::getOutboundNumber).last("limit 1")); |
| | | if(last==null){ |
| | | tErpSupplierOutbound.setOutboundNumber("G" + DateUtils.dateTimeNow()+"00001"); |
| | | }else { |
| | | String lastProcurementCode = last.getOutboundNumber(); |
| | | String datePart = "G" + DateUtils.dateTimeNow(); |
| | | |
| | | // 直接获取后五位数字并+1,不考虑是否同一天 |
| | | try { |
| | | String numberPart = lastProcurementCode.substring(Math.max(0, lastProcurementCode.length() - 5)); |
| | | int number = Integer.parseInt(numberPart); |
| | | if (number < 99999) { |
| | | number++; |
| | | } else { |
| | | number = 2; // 达到99999后重置为00002 |
| | | } |
| | | tErpSupplierOutbound.setOutboundNumber(datePart + String.format("%05d", number)); |
| | | } catch (NumberFormatException e) { |
| | | // 如果解析失败,默认从00001开始 |
| | | tErpSupplierOutbound.setOutboundNumber(datePart + "00001"); |
| | | } |
| | | } |
| | | |
| | | try { |
| | | |
| | | erpSupplierOutboundMapper.insert(tErpSupplierOutbound); |
| | | }catch (Exception e){ |
| | | throw new RuntimeException("网络繁忙,请重试"); |
| | | } |
| | | |
| | | TErpSupplierOutboundGoods tErpSupplierOutboundGoods = new TErpSupplierOutboundGoods(); |
| | | tErpSupplierOutboundGoods.setOutboundId(tErpSupplierOutbound.getId()); |