From bbd4981bc49f907aeeef664cb853456515c33bb8 Mon Sep 17 00:00:00 2001 From: 17602169347 Date: Mon, 20 Feb 2023 17:46:36 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A3=85=E5=8D=95=E4=B8=8A=E4=BC=A0=E5=AE=A1?= =?UTF-8?q?=E6=A0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/TradeuploadController.java | 284 +++---- .../basicInformation/contractfile/Form.vue | 12 +- .../scm/basicInformation/tradeupload/Form.vue | 7 +- .../basicInformation/tradeupload/Form2.vue | 745 ++++++++++++++++++ .../basicInformation/tradeupload/index.vue | 51 +- 5 files changed, 947 insertions(+), 152 deletions(-) create mode 100644 SC-web/src/views/scm/basicInformation/tradeupload/Form2.vue diff --git a/SC-boot/linkage-scm/src/main/java/jnpf/tradeupload/controller/TradeuploadController.java b/SC-boot/linkage-scm/src/main/java/jnpf/tradeupload/controller/TradeuploadController.java index 114fb13c..5294c201 100644 --- a/SC-boot/linkage-scm/src/main/java/jnpf/tradeupload/controller/TradeuploadController.java +++ b/SC-boot/linkage-scm/src/main/java/jnpf/tradeupload/controller/TradeuploadController.java @@ -479,29 +479,29 @@ public class TradeuploadController { * @param tradeuploadPagination * @return */ - @PostMapping("/getList") + @PostMapping("/getList") public ActionResult list(@RequestBody TradeuploadPagination tradeuploadPagination)throws IOException{ List list= tradeuploadService.getList(tradeuploadPagination); //处理id字段转名称,若无需转或者为空可删除 - for(TradeuploadEntity entity:list){ + for(TradeuploadEntity entity:list){ entity.setPoundPictures(generaterSwapUtil.getFileNameInJson(entity.getPoundPictures())); - Map materialIdMap = new HashMap<>(); + Map materialIdMap = new HashMap<>(); entity.setMaterialId(generaterSwapUtil.getPopupSelectValue("381037852907038533","id","item_name",entity.getMaterialId(),materialIdMap)); - Map customerIdMap = new HashMap<>(); + Map customerIdMap = new HashMap<>(); entity.setCustomerId(generaterSwapUtil.getPopupSelectValue("395936123471343749","id","supplier_nm",entity.getCustomerId(),customerIdMap)); - Map salesIdMap = new HashMap<>(); + Map salesIdMap = new HashMap<>(); entity.setSalesId(generaterSwapUtil.getPopupSelectValue("381037852907038533","id","contract_name",entity.getSalesId(),salesIdMap)); - Map vehicleIdMap = new HashMap<>(); + Map vehicleIdMap = new HashMap<>(); entity.setVehicleId(generaterSwapUtil.getPopupSelectValue("381432451370615173","id","ticketno",entity.getVehicleId(),vehicleIdMap)); entity.setVehiclePictures(generaterSwapUtil.getFileNameInJson(entity.getVehiclePictures())); - Map creatorUserNameMap = new HashMap<>(); - entity.setCreatorUserName(generaterSwapUtil.getPopupSelectValue("ebcc44be142e43b795c0d769abd6d25a","F_Id","F_RealName",entity.getCreatorUserName(),creatorUserNameMap)); - Map naturalIdMap = new HashMap<>(); + Map businessIdMap = new HashMap<>(); + entity.setBusinessId(generaterSwapUtil.getPopupSelectValue("ebcc44be142e43b795c0d769abd6d25a","F_Id","F_RealName",entity.getBusinessId(),businessIdMap)); + Map naturalIdMap = new HashMap<>(); entity.setNaturalId(generaterSwapUtil.getPopupSelectValue("395933800510599301","id","name",entity.getNaturalId(),naturalIdMap)); - } - List listVO=JsonUtil.getJsonToList(list,TradeuploadListVO.class); - for(TradeuploadListVO tradeuploadVO:listVO){ - } + } + List listVO=JsonUtil.getJsonToList(list,TradeuploadListVO.class); + for(TradeuploadListVO tradeuploadVO:listVO){ + } PageListVO vo=new PageListVO(); @@ -535,15 +535,15 @@ public class TradeuploadController { entity.setId(mainId); tradeuploadService.save(entity); return ActionResult.success("创建成功"); -} + } /** - * 模板下载 - * - * @return - */ + * 模板下载 + * + * @return + */ @ApiOperation("模板下载") @GetMapping("/templateDownload") public ActionResult TemplateDownload(){ @@ -558,10 +558,10 @@ public class TradeuploadController { return ActionResult.success(vo); } /** - * 导出Excel - * - * @return - */ + * 导出Excel + * + * @return + */ @ApiOperation("导出Excel") @GetMapping("/Actions/Export") public ActionResult Export(TradeuploadPaginationExportModel tradeuploadPaginationExportModel) throws IOException { @@ -571,25 +571,25 @@ public class TradeuploadController { TradeuploadPagination tradeuploadPagination=JsonUtil.getJsonToBean(tradeuploadPaginationExportModel, TradeuploadPagination.class); List list= tradeuploadService.getTypeList(tradeuploadPagination,tradeuploadPaginationExportModel.getDataType()); //处理id字段转名称,若无需转或者为空可删除 - for(TradeuploadEntity entity:list){ + for(TradeuploadEntity entity:list){ entity.setPoundPictures(generaterSwapUtil.getFileNameInJson(entity.getPoundPictures())); - Map materialIdMap = new HashMap<>(); + Map materialIdMap = new HashMap<>(); entity.setMaterialId(generaterSwapUtil.getPopupSelectValue("381037852907038533","id","item_name",entity.getMaterialId(),materialIdMap)); - Map customerIdMap = new HashMap<>(); + Map customerIdMap = new HashMap<>(); entity.setCustomerId(generaterSwapUtil.getPopupSelectValue("395936123471343749","id","supplier_nm",entity.getCustomerId(),customerIdMap)); - Map salesIdMap = new HashMap<>(); + Map salesIdMap = new HashMap<>(); entity.setSalesId(generaterSwapUtil.getPopupSelectValue("381037852907038533","id","contract_name",entity.getSalesId(),salesIdMap)); - Map vehicleIdMap = new HashMap<>(); + Map vehicleIdMap = new HashMap<>(); entity.setVehicleId(generaterSwapUtil.getPopupSelectValue("381432451370615173","id","ticketno",entity.getVehicleId(),vehicleIdMap)); entity.setVehiclePictures(generaterSwapUtil.getFileNameInJson(entity.getVehiclePictures())); - Map creatorUserNameMap = new HashMap<>(); - entity.setCreatorUserName(generaterSwapUtil.getPopupSelectValue("ebcc44be142e43b795c0d769abd6d25a","F_Id","F_RealName",entity.getCreatorUserName(),creatorUserNameMap)); - Map naturalIdMap = new HashMap<>(); + Map businessIdMap = new HashMap<>(); + entity.setBusinessId(generaterSwapUtil.getPopupSelectValue("ebcc44be142e43b795c0d769abd6d25a","F_Id","F_RealName",entity.getBusinessId(),businessIdMap)); + Map naturalIdMap = new HashMap<>(); entity.setNaturalId(generaterSwapUtil.getPopupSelectValue("395933800510599301","id","name",entity.getNaturalId(),naturalIdMap)); - } - List listVO=JsonUtil.getJsonToList(list,TradeuploadListVO.class); - for(TradeuploadListVO tradeuploadVO:listVO){ - } + } + List listVO=JsonUtil.getJsonToList(list,TradeuploadListVO.class); + for(TradeuploadListVO tradeuploadVO:listVO){ + } //转换为map输出 List>mapList=JsonUtil.getJsonToListMap(JsonUtil.getObjectToStringDateFormat(listVO,"yyyy-MM-dd HH:mm:ss")); @@ -601,96 +601,96 @@ public class TradeuploadController { //导出表格 public DownloadVO creatModelExcel(String path,List>list,String[]keys,UserInfo userInfo){ DownloadVO vo=DownloadVO.builder().build(); - List entitys=new ArrayList<>(); - if(keys.length>0){ - for(String key:keys){ - switch(key){ + List entitys=new ArrayList<>(); + if(keys.length>0){ + for(String key:keys){ + switch(key){ case "poundPictures" : - entitys.add(new ExcelExportEntity("磅单上传" ,"poundPictures")); - break; + entitys.add(new ExcelExportEntity("磅单上传" ,"poundPictures")); + break; case "materialId" : - entitys.add(new ExcelExportEntity("物料名称" ,"materialId")); - break; + entitys.add(new ExcelExportEntity("物料名称" ,"materialId")); + break; case "customerId" : - entitys.add(new ExcelExportEntity("客户名称" ,"customerId")); - break; + entitys.add(new ExcelExportEntity("客户名称" ,"customerId")); + break; case "salesId" : - entitys.add(new ExcelExportEntity("销售合同" ,"salesId")); - break; + entitys.add(new ExcelExportEntity("销售合同" ,"salesId")); + break; case "vehicleId" : - entitys.add(new ExcelExportEntity("车牌号" ,"vehicleId")); - break; + entitys.add(new ExcelExportEntity("车牌号" ,"vehicleId")); + break; case "vehiclePictures" : - entitys.add(new ExcelExportEntity("车辆图片" ,"vehiclePictures")); - break; + entitys.add(new ExcelExportEntity("车辆图片" ,"vehiclePictures")); + break; case "poundDate" : - entitys.add(new ExcelExportEntity("磅单时间" ,"poundDate")); - break; + entitys.add(new ExcelExportEntity("磅单时间" ,"poundDate")); + break; case "poundlistNo" : - entitys.add(new ExcelExportEntity("磅单号" ,"poundlistNo")); - break; + entitys.add(new ExcelExportEntity("磅单号" ,"poundlistNo")); + break; case "tareWeight" : - entitys.add(new ExcelExportEntity("皮重" ,"tareWeight")); - break; + entitys.add(new ExcelExportEntity("皮重" ,"tareWeight")); + break; case "grossWeight" : - entitys.add(new ExcelExportEntity("毛重" ,"grossWeight")); - break; + entitys.add(new ExcelExportEntity("毛重" ,"grossWeight")); + break; case "buckleWeight" : - entitys.add(new ExcelExportEntity("扣重" ,"buckleWeight")); - break; + entitys.add(new ExcelExportEntity("扣重" ,"buckleWeight")); + break; case "netWeight" : - entitys.add(new ExcelExportEntity("净重" ,"netWeight")); - break; + entitys.add(new ExcelExportEntity("净重" ,"netWeight")); + break; case "unit" : - entitys.add(new ExcelExportEntity("单位 " ,"unit")); - break; + entitys.add(new ExcelExportEntity("单位 " ,"unit")); + break; case "transportType" : - entitys.add(new ExcelExportEntity("运输类型" ,"transportType")); - break; + entitys.add(new ExcelExportEntity("运输类型" ,"transportType")); + break; case "advance" : - entitys.add(new ExcelExportEntity("是否垫资" ,"advance")); - break; + entitys.add(new ExcelExportEntity("是否垫资" ,"advance")); + break; case "transportPrice" : - entitys.add(new ExcelExportEntity("运费" ,"transportPrice")); - break; + entitys.add(new ExcelExportEntity("运费" ,"transportPrice")); + break; case "salesPrice" : - entitys.add(new ExcelExportEntity("销售价格" ,"salesPrice")); - break; - case "creatorUserName" : - entitys.add(new ExcelExportEntity("业务员" ,"creatorUserName")); - break; + entitys.add(new ExcelExportEntity("销售价格" ,"salesPrice")); + break; + case "businessId" : + entitys.add(new ExcelExportEntity("业务员" ,"businessId")); + break; case "naturalId" : - entitys.add(new ExcelExportEntity("自然人" ,"naturalId")); - break; + entitys.add(new ExcelExportEntity("自然人" ,"naturalId")); + break; case "remark" : - entitys.add(new ExcelExportEntity("备注" ,"remark")); - break; + entitys.add(new ExcelExportEntity("备注" ,"remark")); + break; case "creatorTime" : - entitys.add(new ExcelExportEntity("磅单日期" ,"creatorTime")); - break; - default: - break; - } + entitys.add(new ExcelExportEntity("磅单日期" ,"creatorTime")); + break; + default: + break; } } + } ExportParams exportParams = new ExportParams(null, "表单信息"); exportParams.setType(ExcelType.XSSF); try{ - @Cleanup Workbook workbook = new HSSFWorkbook(); - if (entitys.size()>0){ - workbook = ExcelExportUtil.exportExcel(exportParams, entitys, list); - } - String name = "表单信息" + DateUtil.dateNow("yyyyMMdd") + "_" + RandomUtil.uuId() + ".xlsx"; + @Cleanup Workbook workbook = new HSSFWorkbook(); + if (entitys.size()>0){ + workbook = ExcelExportUtil.exportExcel(exportParams, entitys, list); + } + String name = "表单信息" + DateUtil.dateNow("yyyyMMdd") + "_" + RandomUtil.uuId() + ".xlsx"; - String fileName = configValueUtil.getTemporaryFilePath() + name; - @Cleanup FileOutputStream output = new FileOutputStream(XSSEscape.escapePath(fileName)); - workbook.write(output); - //上传文件 - UploadUtil.uploadFile(configValueUtil.getFileType(), fileName, FileTypeEnum.TEMPORARY, name); + String fileName = configValueUtil.getTemporaryFilePath() + name; + @Cleanup FileOutputStream output = new FileOutputStream(XSSEscape.escapePath(fileName)); + workbook.write(output); + //上传文件 + UploadUtil.uploadFile(configValueUtil.getFileType(), fileName, FileTypeEnum.TEMPORARY, name); - vo.setName(name); - vo.setUrl(UploaderUtil.uploaderFile(userInfo.getId() + "#" + name + "#" + "Temporary")); + vo.setName(name); + vo.setUrl(UploaderUtil.uploaderFile(userInfo.getId() + "#" + name + "#" + "Temporary")); } catch (Exception e) { log.error("信息导出Excel错误:{}", e.getMessage()); e.printStackTrace(); @@ -709,7 +709,7 @@ public class TradeuploadController { @Transactional public ActionResult batchRemove(@PathVariable("ids") String ids){ String[] idList = ids.split(","); - int i =0; + int i =0; for (String allId : idList){ this.delete(allId); i++; @@ -717,16 +717,16 @@ public class TradeuploadController { if (i == 0 ){ return ActionResult.fail("删除失败"); } - return ActionResult.success("删除成功"); + return ActionResult.success("删除成功"); } /** - * 信息 - * - * @param id - * @return - */ + * 信息 + * + * @param id + * @return + */ @GetMapping("/{id}") public ActionResult info(@PathVariable("id") String id){ TradeuploadEntity entity= tradeuploadService.getInfo(id); @@ -735,54 +735,54 @@ public class TradeuploadController { vo.setCreatorTime(vo.getCreatorTime()); } - //子表 - //副表 + //子表 + //副表 return ActionResult.success(vo); } /** - * 表单信息(详情页) - * - * @param id - * @return - */ + * 表单信息(详情页) + * + * @param id + * @return + */ @GetMapping("/detail/{id}") public ActionResult detailInfo(@PathVariable("id") String id){ TradeuploadEntity entity= tradeuploadService.getInfo(id); TradeuploadInfoVO vo=JsonUtil.getJsonToBean(entity, TradeuploadInfoVO.class); - //子表数据转换 + //子表数据转换 - //附表数据转换 + //附表数据转换 //添加到详情表单对象中 - vo.setPoundPictures(generaterSwapUtil.getFileNameInJson(vo.getPoundPictures())); - Map materialIdMap = new HashMap<>(); - vo.setMaterialId(generaterSwapUtil.getPopupSelectValue("381037852907038533","id","item_name",vo.getMaterialId(),materialIdMap)); - Map customerIdMap = new HashMap<>(); - vo.setCustomerId(generaterSwapUtil.getPopupSelectValue("395936123471343749","id","supplier_nm",vo.getCustomerId(),customerIdMap)); - Map salesIdMap = new HashMap<>(); - vo.setSalesId(generaterSwapUtil.getPopupSelectValue("381037852907038533","id","contract_name",vo.getSalesId(),salesIdMap)); - Map vehicleIdMap = new HashMap<>(); - vo.setVehicleId(generaterSwapUtil.getPopupSelectValue("381432451370615173","id","ticketno",vo.getVehicleId(),vehicleIdMap)); - vo.setVehiclePictures(generaterSwapUtil.getFileNameInJson(vo.getVehiclePictures())); - Map creatorUserNameMap = new HashMap<>(); - vo.setBusinessId(generaterSwapUtil.getPopupSelectValue("ebcc44be142e43b795c0d769abd6d25a","F_Id","F_RealName",vo.getBusinessId(),creatorUserNameMap)); - Map naturalIdMap = new HashMap<>(); - vo.setNaturalId(generaterSwapUtil.getPopupSelectValue("395933800510599301","id","name",vo.getNaturalId(),naturalIdMap)); + vo.setPoundPictures(generaterSwapUtil.getFileNameInJson(vo.getPoundPictures())); + Map materialIdMap = new HashMap<>(); + vo.setMaterialId(generaterSwapUtil.getPopupSelectValue("381037852907038533","id","item_name",vo.getMaterialId(),materialIdMap)); + Map customerIdMap = new HashMap<>(); + vo.setCustomerId(generaterSwapUtil.getPopupSelectValue("395936123471343749","id","supplier_nm",vo.getCustomerId(),customerIdMap)); + Map salesIdMap = new HashMap<>(); + vo.setSalesId(generaterSwapUtil.getPopupSelectValue("381037852907038533","id","contract_name",vo.getSalesId(),salesIdMap)); + Map vehicleIdMap = new HashMap<>(); + vo.setVehicleId(generaterSwapUtil.getPopupSelectValue("381432451370615173","id","ticketno",vo.getVehicleId(),vehicleIdMap)); + vo.setVehiclePictures(generaterSwapUtil.getFileNameInJson(vo.getVehiclePictures())); + Map businessIdMap = new HashMap<>(); + vo.setBusinessId(generaterSwapUtil.getPopupSelectValue("ebcc44be142e43b795c0d769abd6d25a","F_Id","F_RealName",vo.getBusinessId(),businessIdMap)); + Map naturalIdMap = new HashMap<>(); + vo.setNaturalId(generaterSwapUtil.getPopupSelectValue("395933800510599301","id","name",vo.getNaturalId(),naturalIdMap)); return ActionResult.success(vo); - } + } - /** - * 更新 - * - * @param id - * @return - */ + /** + * 更新 + * + * @param id + * @return + */ @PutMapping("/{id}") @Transactional public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid TradeuploadUpForm tradeuploadUpForm) throws DataException { @@ -790,16 +790,16 @@ public class TradeuploadController { TradeuploadEntity entity= tradeuploadService.getInfo(id); if(entity!=null){ TradeuploadEntity subentity=JsonUtil.getJsonToBean(tradeuploadUpForm, TradeuploadEntity.class); - subentity.setCreatorTime(entity.getCreatorTime()); + subentity.setCreatorTime(entity.getCreatorTime()); QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.lambda().eq(TradeuploadEntity::getPoundlistNo,entity.getPoundlistNo()); queryWrapper.lambda().eq(TradeuploadEntity::getCustomerId,entity.getCustomerId()); List list = tradeuploadService.list(queryWrapper); - if (list != null && list.size()>0 && !ObjectUtil.equal("id", list.get(0).getId())){ + if (list != null && list.size()>0 && !ObjectUtil.equal(id, list.get(0).getId())){ return ActionResult.fail("磅单重复"); } tradeuploadService.update(id, subentity); - return ActionResult.success("更新成功"); + return ActionResult.success("更新成功"); }else{ return ActionResult.fail("更新失败,数据不存在"); } @@ -807,12 +807,12 @@ public class TradeuploadController { - /** - * 删除 - * - * @param id - * @return - */ + /** + * 删除 + * + * @param id + * @return + */ @DeleteMapping("/{id}") @Transactional public ActionResult delete(@PathVariable("id") String id){ diff --git a/SC-web/src/views/scm/basicInformation/contractfile/Form.vue b/SC-web/src/views/scm/basicInformation/contractfile/Form.vue index 11ec7182..b79a2738 100644 --- a/SC-web/src/views/scm/basicInformation/contractfile/Form.vue +++ b/SC-web/src/views/scm/basicInformation/contractfile/Form.vue @@ -430,24 +430,24 @@ contractTypeOptions: [{ "fullName": "采购合同", - "id": "1" + "id": "0" }, { "fullName": "销售合同", - "id": "2" + "id": "1" }, { "fullName": "租赁合同", - "id": "3" + "id": "2" }, { "fullName": "仓储合同", - "id": "4" + "id": "3" }, { "fullName": "运输合同", - "id": "5" + "id": "4" }, { "fullName": "施工合同", - "id": "6" + "id": "5" } ], rateOptions:[ diff --git a/SC-web/src/views/scm/basicInformation/tradeupload/Form.vue b/SC-web/src/views/scm/basicInformation/tradeupload/Form.vue index a03d27ea..7b612206 100644 --- a/SC-web/src/views/scm/basicInformation/tradeupload/Form.vue +++ b/SC-web/src/views/scm/basicInformation/tradeupload/Form.vue @@ -114,8 +114,8 @@ - - + + @@ -517,6 +517,9 @@ var grossWeight = this.dataForm.grossWeight;//毛重 var buckleWeight = this.dataForm.buckleWeight;//扣重 var netWeight = this.dataForm.netWeight;//净重 + this.dataForm.unit = this.dataForm.unit ? this.dataForm.unit : 0; + this.dataForm.transportType = this.dataForm.transportType ? this.dataForm.transportType : 0; + this.dataForm.advance = this.dataForm.advance ? this.dataForm.advance : 0; if(grossWeight < tareWeight + buckleWeight + netWeight){ this.$message({ message: '毛重不得小于皮重+扣重+净重', diff --git a/SC-web/src/views/scm/basicInformation/tradeupload/Form2.vue b/SC-web/src/views/scm/basicInformation/tradeupload/Form2.vue new file mode 100644 index 00000000..b6ba1a52 --- /dev/null +++ b/SC-web/src/views/scm/basicInformation/tradeupload/Form2.vue @@ -0,0 +1,745 @@ + + + diff --git a/SC-web/src/views/scm/basicInformation/tradeupload/index.vue b/SC-web/src/views/scm/basicInformation/tradeupload/index.vue index 668b3877..b488b4b4 100644 --- a/SC-web/src/views/scm/basicInformation/tradeupload/index.vue +++ b/SC-web/src/views/scm/basicInformation/tradeupload/index.vue @@ -84,13 +84,46 @@ /> - + + + + + +