Commit 74f29d24948c3e95081098aa5e0b7f0b15fe307d
Merge branch 'master_after0506' into master_after0506_report02_1
Showing
5 changed files
with
53 additions
and
6 deletions
| @@ -290,7 +290,7 @@ public class BusinessDataExportHandler implements ExportHandler { | @@ -290,7 +290,7 @@ public class BusinessDataExportHandler implements ExportHandler { | ||
| 290 | File pdfFile = ExcelUtil.convertExcelToPdf(tempExcel, "/usr/bin/libreoffice --headless --convert-to pdf --outdir %s %s"); | 290 | File pdfFile = ExcelUtil.convertExcelToPdf(tempExcel, "/usr/bin/libreoffice --headless --convert-to pdf --outdir %s %s"); |
| 291 | try (InputStream pdfIn = new FileInputStream(pdfFile)) { | 291 | try (InputStream pdfIn = new FileInputStream(pdfFile)) { |
| 292 | ZipEntry entry = new ZipEntry(orderInfo.getOrderNo() + "-" | 292 | ZipEntry entry = new ZipEntry(orderInfo.getOrderNo() + "-" |
| 293 | - + orderInfo.getOrderingUnitName() + "-" + orderInfo.getWorkshopName() + "-订货单打印" + ".pdf"); | 293 | + + orderInfo.getOrderingUnitName() + "-" + orderInfo.getWorkshopName() + "-订货单打印-" + createTime + ".pdf"); |
| 294 | zos.putNextEntry(entry); | 294 | zos.putNextEntry(entry); |
| 295 | byte[] buffer = new byte[8192]; | 295 | byte[] buffer = new byte[8192]; |
| 296 | int len; | 296 | int len; |
| @@ -310,7 +310,7 @@ public class BusinessDataExportHandler implements ExportHandler { | @@ -310,7 +310,7 @@ public class BusinessDataExportHandler implements ExportHandler { | ||
| 310 | ByteArrayOutputStream baos = new ByteArrayOutputStream(); | 310 | ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
| 311 | workbook.write(baos); | 311 | workbook.write(baos); |
| 312 | ZipEntry entry = new ZipEntry(orderInfo.getOrderNo() + "-" | 312 | ZipEntry entry = new ZipEntry(orderInfo.getOrderNo() + "-" |
| 313 | - + orderInfo.getOrderingUnitName() + "-" + orderInfo.getWorkshopName() + "-订货单打印" + ".xlsx"); | 313 | + + orderInfo.getOrderingUnitName() + "-" + orderInfo.getWorkshopName() + "-订货单打印-" + createTime + ".xlsx"); |
| 314 | zos.putNextEntry(entry); | 314 | zos.putNextEntry(entry); |
| 315 | zos.write(baos.toByteArray()); | 315 | zos.write(baos.toByteArray()); |
| 316 | zos.closeEntry(); | 316 | zos.closeEntry(); |
| @@ -215,8 +215,7 @@ public class ContractDistributorStandardServiceImpl extends | @@ -215,8 +215,7 @@ public class ContractDistributorStandardServiceImpl extends | ||
| 215 | public List<ContractDistributorStandard> query(QueryContractDistributorStandardVo vo) { | 215 | public List<ContractDistributorStandard> query(QueryContractDistributorStandardVo vo) { |
| 216 | 216 | ||
| 217 | List<ContractDistributorStandard> datas = getBaseMapper().query(vo); | 217 | List<ContractDistributorStandard> datas = getBaseMapper().query(vo); |
| 218 | - CollectionUtils.emptyIfNull(datas).forEach(data -> data.setCanSplit(isCanSplitByCode(data.getCode()) | ||
| 219 | - && !Boolean.TRUE.equals(data.getPriceSpecLocked()))); | 218 | + CollectionUtils.emptyIfNull(datas).forEach(data -> data.setCanSplit(isCanSplit(data))); |
| 220 | return datas; | 219 | return datas; |
| 221 | } | 220 | } |
| 222 | 221 | ||
| @@ -227,7 +226,7 @@ public class ContractDistributorStandardServiceImpl extends | @@ -227,7 +226,7 @@ public class ContractDistributorStandardServiceImpl extends | ||
| 227 | if (data == null) { | 226 | if (data == null) { |
| 228 | return null; | 227 | return null; |
| 229 | } | 228 | } |
| 230 | - data.setCanSplit(isCanSplitByCode(data.getCode()) && !Boolean.TRUE.equals(data.getPriceSpecLocked())); | 229 | + data.setCanSplit(isCanSplit(data)); |
| 231 | Wrapper<PurchaseOrderInfo> orderInfoWrapper = Wrappers.lambdaQuery(PurchaseOrderInfo.class) | 230 | Wrapper<PurchaseOrderInfo> orderInfoWrapper = Wrappers.lambdaQuery(PurchaseOrderInfo.class) |
| 232 | .eq(PurchaseOrderInfo::getContractId, data.getId()); | 231 | .eq(PurchaseOrderInfo::getContractId, data.getId()); |
| 233 | List<PurchaseOrderInfo> purchaseOrderInfoList = purchaseOrderInfoService.list(orderInfoWrapper); | 232 | List<PurchaseOrderInfo> purchaseOrderInfoList = purchaseOrderInfoService.list(orderInfoWrapper); |
| @@ -293,6 +292,19 @@ public class ContractDistributorStandardServiceImpl extends | @@ -293,6 +292,19 @@ public class ContractDistributorStandardServiceImpl extends | ||
| 293 | return !code.matches(".*_\\d{2}$"); | 292 | return !code.matches(".*_\\d{2}$"); |
| 294 | } | 293 | } |
| 295 | 294 | ||
| 295 | + private boolean isCanSplit(ContractDistributorStandard data) { | ||
| 296 | + if (data == null) { | ||
| 297 | + return false; | ||
| 298 | + } | ||
| 299 | + if (!isCanSplitByCode(data.getCode()) || Boolean.TRUE.equals(data.getPriceSpecLocked())) { | ||
| 300 | + return false; | ||
| 301 | + } | ||
| 302 | + if ("FORMAL".equals(data.getStatus())) { | ||
| 303 | + return "PASS".equals(data.getFormalApproved()); | ||
| 304 | + } | ||
| 305 | + return true; | ||
| 306 | + } | ||
| 307 | + | ||
| 296 | @OpLog(type = OtherOpLogType.class, name = "新增合同,ID:{}", params = {"#id"}) | 308 | @OpLog(type = OtherOpLogType.class, name = "新增合同,ID:{}", params = {"#id"}) |
| 297 | @Transactional(rollbackFor = Exception.class) | 309 | @Transactional(rollbackFor = Exception.class) |
| 298 | @Override | 310 | @Override |
| @@ -1314,7 +1326,15 @@ public class ContractDistributorStandardServiceImpl extends | @@ -1314,7 +1326,15 @@ public class ContractDistributorStandardServiceImpl extends | ||
| 1314 | contractDistributorLine.setAmountExcludingTax(lineVo.getAmountExcludingTax()); | 1326 | contractDistributorLine.setAmountExcludingTax(lineVo.getAmountExcludingTax()); |
| 1315 | contractDistributorLine.setTotalAmount(lineVo.getTotalAmount()); | 1327 | contractDistributorLine.setTotalAmount(lineVo.getTotalAmount()); |
| 1316 | contractDistributorLine.setDeliveryDate(lineVo.getDeliveryDate()); | 1328 | contractDistributorLine.setDeliveryDate(lineVo.getDeliveryDate()); |
| 1329 | + contractDistributorLine.setMaterialCode(lineVo.getMaterialCode()); | ||
| 1317 | contractDistributorLineService.getBaseMapper().insert(contractDistributorLine); | 1330 | contractDistributorLineService.getBaseMapper().insert(contractDistributorLine); |
| 1331 | + | ||
| 1332 | + //更新物料编码 | ||
| 1333 | + Wrapper<ContractDistributorLine> contractDistributorLineWrapper = Wrappers.lambdaUpdate(ContractDistributorLine.class) | ||
| 1334 | + .set(ContractDistributorLine::getMaterialCode, lineVo.getMaterialCode()) | ||
| 1335 | + .eq(ContractDistributorLine::getId, lineVo.getId()); | ||
| 1336 | + | ||
| 1337 | + contractDistributorLineService.update(contractDistributorLineWrapper); | ||
| 1318 | } | 1338 | } |
| 1319 | 1339 | ||
| 1320 | Wrapper<ContractDistributorStandard> changeLocked = Wrappers.lambdaUpdate(ContractDistributorStandard.class) | 1340 | Wrapper<ContractDistributorStandard> changeLocked = Wrappers.lambdaUpdate(ContractDistributorStandard.class) |
| @@ -108,6 +108,10 @@ public class ShipmentQuantityIndustryStatisticsServiceImpl implements ShipmentQu | @@ -108,6 +108,10 @@ public class ShipmentQuantityIndustryStatisticsServiceImpl implements ShipmentQu | ||
| 108 | } | 108 | } |
| 109 | 109 | ||
| 110 | private List<ShipmentQuantityIndustryStatisticsDto> buildFilledList(QueryShipmentQuantityIndustryStatisticsVo vo) { | 110 | private List<ShipmentQuantityIndustryStatisticsDto> buildFilledList(QueryShipmentQuantityIndustryStatisticsVo vo) { |
| 111 | + if (!hasAccessibleBaseData(vo)) { | ||
| 112 | + return new ArrayList<>(); | ||
| 113 | + } | ||
| 114 | + | ||
| 111 | LocalDate startDate = parse(vo.getShipmentDateStart()); | 115 | LocalDate startDate = parse(vo.getShipmentDateStart()); |
| 112 | LocalDate endDate = parse(vo.getShipmentDateEnd()); | 116 | LocalDate endDate = parse(vo.getShipmentDateEnd()); |
| 113 | LocalDate today = LocalDate.now(); | 117 | LocalDate today = LocalDate.now(); |
| @@ -220,6 +224,15 @@ public class ShipmentQuantityIndustryStatisticsServiceImpl implements ShipmentQu | @@ -220,6 +224,15 @@ public class ShipmentQuantityIndustryStatisticsServiceImpl implements ShipmentQu | ||
| 220 | return date + "|" + industry + "|" + workshopId; | 224 | return date + "|" + industry + "|" + workshopId; |
| 221 | } | 225 | } |
| 222 | 226 | ||
| 227 | + private boolean hasAccessibleBaseData(QueryShipmentQuantityIndustryStatisticsVo vo) { | ||
| 228 | + QueryShipmentQuantityIndustryStatisticsVo permissionCheckVo = new QueryShipmentQuantityIndustryStatisticsVo(); | ||
| 229 | + permissionCheckVo.setIndustry(vo.getIndustry()); | ||
| 230 | + permissionCheckVo.setWorkshopId(vo.getWorkshopId()); | ||
| 231 | + | ||
| 232 | + ShipmentQuantityStatisticsDateRangeDto dateRange = shipmentQuantityIndustryStatisticsMapper.queryDateRange(permissionCheckVo); | ||
| 233 | + return dateRange != null && dateRange.getStartDate() != null && dateRange.getEndDate() != null; | ||
| 234 | + } | ||
| 235 | + | ||
| 223 | private ShipmentQuantityStatisticsDateRangeDto queryDateRangeWithFallback(QueryShipmentQuantityIndustryStatisticsVo vo) { | 236 | private ShipmentQuantityStatisticsDateRangeDto queryDateRangeWithFallback(QueryShipmentQuantityIndustryStatisticsVo vo) { |
| 224 | ShipmentQuantityStatisticsDateRangeDto dateRange = shipmentQuantityIndustryStatisticsMapper.queryDateRange(vo); | 237 | ShipmentQuantityStatisticsDateRangeDto dateRange = shipmentQuantityIndustryStatisticsMapper.queryDateRange(vo); |
| 225 | if (dateRange != null && dateRange.getStartDate() != null && dateRange.getEndDate() != null) { | 238 | if (dateRange != null && dateRange.getStartDate() != null && dateRange.getEndDate() != null) { |
| @@ -109,6 +109,10 @@ public class ShipmentQuantityStatisticsServiceImpl implements ShipmentQuantitySt | @@ -109,6 +109,10 @@ public class ShipmentQuantityStatisticsServiceImpl implements ShipmentQuantitySt | ||
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | private List<ShipmentQuantityStatisticsDto> buildFilledList(QueryShipmentQuantityStatisticsVo vo) { | 111 | private List<ShipmentQuantityStatisticsDto> buildFilledList(QueryShipmentQuantityStatisticsVo vo) { |
| 112 | + if (!hasAccessibleBaseData(vo)) { | ||
| 113 | + return new ArrayList<>(); | ||
| 114 | + } | ||
| 115 | + | ||
| 112 | LocalDate startDate = parse(vo.getShipmentDateStart()); | 116 | LocalDate startDate = parse(vo.getShipmentDateStart()); |
| 113 | LocalDate endDate = parse(vo.getShipmentDateEnd()); | 117 | LocalDate endDate = parse(vo.getShipmentDateEnd()); |
| 114 | LocalDate today = LocalDate.now(); | 118 | LocalDate today = LocalDate.now(); |
| @@ -236,6 +240,15 @@ public class ShipmentQuantityStatisticsServiceImpl implements ShipmentQuantitySt | @@ -236,6 +240,15 @@ public class ShipmentQuantityStatisticsServiceImpl implements ShipmentQuantitySt | ||
| 236 | return date + "|" + deptId + "|" + workshopId; | 240 | return date + "|" + deptId + "|" + workshopId; |
| 237 | } | 241 | } |
| 238 | 242 | ||
| 243 | + private boolean hasAccessibleBaseData(QueryShipmentQuantityStatisticsVo vo) { | ||
| 244 | + QueryShipmentQuantityStatisticsVo permissionCheckVo = new QueryShipmentQuantityStatisticsVo(); | ||
| 245 | + permissionCheckVo.setDeptId(vo.getDeptId()); | ||
| 246 | + permissionCheckVo.setWorkshopId(vo.getWorkshopId()); | ||
| 247 | + | ||
| 248 | + ShipmentQuantityStatisticsDateRangeDto dateRange = shipmentQuantityStatisticsMapper.queryDateRange(permissionCheckVo); | ||
| 249 | + return dateRange != null && dateRange.getStartDate() != null && dateRange.getEndDate() != null; | ||
| 250 | + } | ||
| 251 | + | ||
| 239 | private ShipmentQuantityStatisticsDateRangeDto queryDateRangeWithFallback(QueryShipmentQuantityStatisticsVo vo) { | 252 | private ShipmentQuantityStatisticsDateRangeDto queryDateRangeWithFallback(QueryShipmentQuantityStatisticsVo vo) { |
| 240 | ShipmentQuantityStatisticsDateRangeDto dateRange = shipmentQuantityStatisticsMapper.queryDateRange(vo); | 253 | ShipmentQuantityStatisticsDateRangeDto dateRange = shipmentQuantityStatisticsMapper.queryDateRange(vo); |
| 241 | if (dateRange != null && dateRange.getStartDate() != null && dateRange.getEndDate() != null) { | 254 | if (dateRange != null && dateRange.getStartDate() != null && dateRange.getEndDate() != null) { |
| @@ -89,7 +89,8 @@ | @@ -89,7 +89,8 @@ | ||
| 89 | MAX(t.shipment_date) AS end_date | 89 | MAX(t.shipment_date) AS end_date |
| 90 | FROM ( | 90 | FROM ( |
| 91 | SELECT | 91 | SELECT |
| 92 | - ol.delivery_date AS shipment_date | 92 | + ol.delivery_date AS shipment_date, |
| 93 | + o.workshop_id AS workshop_id | ||
| 93 | FROM tbl_purchase_order_line ol | 94 | FROM tbl_purchase_order_line ol |
| 94 | INNER JOIN purchase_order_info o ON o.id = ol.purchase_order_id | 95 | INNER JOIN purchase_order_info o ON o.id = ol.purchase_order_id |
| 95 | WHERE | 96 | WHERE |