From b085cf19bd827305927e587cca18d0960e0108fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E4=B8=96=E5=BC=BA?= Date: Tue, 11 Apr 2023 17:16:49 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E5=AF=BC=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/PoundlistController.java | 69 ++++- .../poundlist/entity/PoundlistEntity.java | 12 + .../poundlist/entity/PoundlistImportVo.java | 35 +++ .../model/poundlist/PoundlistDTO.java | 64 +++++ .../poundlist/service/PoundlistService.java | 18 ++ .../service/impl/PoundlistServiceImpl.java | 222 ++++++++++++++++ SC-web/src/api/scm/poundlist.js | 25 ++ .../basicInformation/poundlist/ImportForm.vue | 243 ++++++++++++++++++ .../scm/basicInformation/poundlist/index.vue | 15 +- .../basicInformation/poundlist/salesForm.vue | 40 ++- 10 files changed, 738 insertions(+), 5 deletions(-) create mode 100644 SC-boot/linkage-scm/src/main/java/jnpf/poundlist/entity/PoundlistImportVo.java create mode 100644 SC-boot/linkage-scm/src/main/java/jnpf/poundlist/model/poundlist/PoundlistDTO.java create mode 100644 SC-web/src/api/scm/poundlist.js create mode 100644 SC-web/src/views/scm/basicInformation/poundlist/ImportForm.vue diff --git a/SC-boot/linkage-scm/src/main/java/jnpf/poundlist/controller/PoundlistController.java b/SC-boot/linkage-scm/src/main/java/jnpf/poundlist/controller/PoundlistController.java index da047834..f94be9b7 100644 --- a/SC-boot/linkage-scm/src/main/java/jnpf/poundlist/controller/PoundlistController.java +++ b/SC-boot/linkage-scm/src/main/java/jnpf/poundlist/controller/PoundlistController.java @@ -8,6 +8,7 @@ import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import jnpf.arinvoices.entity.Arinvoices_item0Entity; import jnpf.base.ActionResult; import jnpf.base.vo.PageListVO; import jnpf.base.vo.PaginationVO; @@ -21,6 +22,8 @@ import jnpf.customer.service.CustomerService; import jnpf.exception.DataException; import jnpf.materialvo.entity.MaterialEntity; import jnpf.materialvo.service.MaterialService; +import jnpf.purchaseorder.entity.PurchaseOrderImportVo; +import jnpf.purchaseorder.model.purchaseorder.PurchaseorderDTO; import jnpf.vehicle.entity.VehicleEntity; import jnpf.vehicle.service.VehicleService; import org.apache.commons.lang3.ObjectUtils; @@ -47,12 +50,14 @@ import org.springframework.web.bind.annotation.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.multipart.MultipartFile; import javax.validation.Valid; +import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import jnpf.util.GeneraterSwapUtil; import java.math.BigDecimal; +import java.text.ParseException; import java.util.*; import jnpf.util.file.UploadUtil; @@ -257,8 +262,8 @@ public class PoundlistController { UserInfo userInfo=userProvider.get(); DownloadVO vo=DownloadVO.builder().build(); try{ - vo.setName("职员信息.xlsx"); - vo.setUrl(UploaderUtil.uploaderFile("/api/Common/DownloadModel?encryption=" ,userInfo.getId()+"#"+"职员信息.xlsx"+"#"+"Temporary")); + vo.setName("订单数据模板.xlsx"); + vo.setUrl(UploaderUtil.uploaderFile("/api/Common/DownloadModel?encryption=" ,userInfo.getId()+"#"+"poundlist_import_template.xlsx"+"#"+"Temporary")); }catch(Exception e){ log.error("信息导出Excel错误:{}" ,e.getMessage()); } @@ -599,6 +604,66 @@ public class PoundlistController { } + /** + * 上传文件(excel) + * + * @return + */ + @ApiOperation("上传文件") + @PostMapping("/Uploader") + public ActionResult Uploader() { + List list = UpUtil.getFileAll(); + MultipartFile file = list.get(0); + if (file.getOriginalFilename().endsWith(".xlsx") || file.getOriginalFilename().endsWith(".xls")) { + String filePath = configValueUtil.getTemporaryFilePath(); + String fileName = RandomUtil.uuId() + "." + UpUtil.getFileType(file); + fileName = XSSEscape.escape(fileName); + //上传文件 + FileUtil.upFile(file, filePath, fileName); + DownloadVO vo = DownloadVO.builder().build(); + vo.setName(fileName); + return ActionResult.success(vo); + } else { + return ActionResult.fail("选择文件不符合导入"); + } + + } + + /** + * 导入预览 + * + * @return + */ + @ApiOperation("导入预览") + @GetMapping("/ImportPreview") + public ActionResult ImportPreview(String fileName) { + String filePath = configValueUtil.getTemporaryFilePath(); + File temporary = new File(XSSEscape.escapePath(filePath + fileName)); + //得到数据 + List personList = ExcelUtil.importExcel(temporary, 0, 1, PoundlistEntity.class); + //预览数据 + Map map = poundlistService.importPreview(personList); + return ActionResult.success(map); + } + + + /** + * 导入数据 + * + * @return + */ + @ApiOperation("导入数据") + @PostMapping("/ImportData") + public ActionResult ImportData(@RequestBody PoundlistDTO data) throws ParseException, DataException { + List dataList = JsonUtil.getJsonToList(data.getList(), PoundlistDTO.class); + //导入数据 + PoundlistImportVo result = poundlistService.importData(dataList); + System.out.println("这是错误的数据"+result); + Map stringObjectMap = JsonUtil.entityToMap(result); + return ActionResult.success(stringObjectMap); + } + + diff --git a/SC-boot/linkage-scm/src/main/java/jnpf/poundlist/entity/PoundlistEntity.java b/SC-boot/linkage-scm/src/main/java/jnpf/poundlist/entity/PoundlistEntity.java index c0b6d221..0021c0bd 100644 --- a/SC-boot/linkage-scm/src/main/java/jnpf/poundlist/entity/PoundlistEntity.java +++ b/SC-boot/linkage-scm/src/main/java/jnpf/poundlist/entity/PoundlistEntity.java @@ -1,5 +1,6 @@ package jnpf.poundlist.entity; +import cn.afterturn.easypoi.excel.annotation.Excel; import com.alibaba.fastjson.annotation.JSONField; import com.baomidou.mybatisplus.annotation.*; import lombok.Data; @@ -89,12 +90,15 @@ public class PoundlistEntity { @TableField("ADVANCE") private String advance; + @Excel(name = "单位") @TableField("UNIT") private String unit; + @Excel(name = "毛重") @TableField("GROSS_WEIGHT") private BigDecimal grossWeight; + @Excel(name = "皮重") @TableField("TARE_WEIGHT") private BigDecimal tareWeight; @@ -104,6 +108,7 @@ public class PoundlistEntity { @TableField("NET_WEIGHT") private BigDecimal netWeight; + @Excel(name = "结算重量") @TableField("SETTLEMENT") private BigDecimal settlement; @@ -113,6 +118,7 @@ public class PoundlistEntity { @TableField("COLLECT_PRICE") private BigDecimal collectPrice; + @Excel(name = "销售单价") @TableField("SALES_PRICE") private BigDecimal salesPrice; @@ -191,12 +197,14 @@ public class PoundlistEntity { @TableField(exist = false) private String materialName; + @Excel(name = "客户名称") @TableField(exist = false) private String customerName; @TableField(exist = false) private String salesName; + @Excel(name = "车号") @TableField(exist = false) private String vehicleName; @@ -247,4 +255,8 @@ public class PoundlistEntity { private String poundlistId; @TableField(exist = false) private String ContractName; + + @Excel(name = "销售金额") + @TableField(exist = false) + private String salesAmount; } diff --git a/SC-boot/linkage-scm/src/main/java/jnpf/poundlist/entity/PoundlistImportVo.java b/SC-boot/linkage-scm/src/main/java/jnpf/poundlist/entity/PoundlistImportVo.java new file mode 100644 index 00000000..293e3132 --- /dev/null +++ b/SC-boot/linkage-scm/src/main/java/jnpf/poundlist/entity/PoundlistImportVo.java @@ -0,0 +1,35 @@ +package jnpf.poundlist.entity; + +import jnpf.poundlist.model.poundlist.PoundlistDTO; +import jnpf.purchaseorder.model.purchaseorder.PurchaseorderDTO; +import lombok.Data; + +import java.util.List; + +/** + * @Author: WangChuang + * @Date: 2/3/2023 下午3:47 + * @Description //注释: + * @Version 1.0 + */ +@Data +public class PoundlistImportVo { + /** + * 导入成功条数 + */ + private int snum; + /** + * 导入失败条数 + */ + private int fnum; + /** + * 导入结果状态(0,成功 1,失败) + */ + private int resultType; + /** + * 失败结果 + */ + private List failResult; + + private List poundlistEntityList; +} diff --git a/SC-boot/linkage-scm/src/main/java/jnpf/poundlist/model/poundlist/PoundlistDTO.java b/SC-boot/linkage-scm/src/main/java/jnpf/poundlist/model/poundlist/PoundlistDTO.java new file mode 100644 index 00000000..48b0aa43 --- /dev/null +++ b/SC-boot/linkage-scm/src/main/java/jnpf/poundlist/model/poundlist/PoundlistDTO.java @@ -0,0 +1,64 @@ + +package jnpf.poundlist.model.poundlist; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonProperty; +import jnpf.purchaseorder.model.purchaseorder.PurchaseorderDTO; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +/** + * + * + * @版本: V3.2.0 + * @版权: LINKAGE-BOOT + * @作者: LINKAGE-BOOT研发团队 + * @日期: 2023-02-21 + */ +@Data +public class PoundlistDTO implements Cloneable{ + @Excel(name = "客户名称") + private String customerName; + + @Excel(name = "车号") + private String vehicleName; + + @Excel(name = "毛重") + private String grossWeight; + + @Excel(name = "皮重") + private String tareWeight; + + @Excel(name = "结算重量") + private String settlement; + + @Excel(name = "单位") + private String unit; + + @Excel(name = "销售单价") + private String salesPrice; + + @Excel(name = "销售金额") + private String salesAmount; + + @Excel(name = "错误原因") + private String causeError; + + private List list; + + @Override + public PoundlistDTO clone() throws CloneNotSupportedException { + try { + PoundlistDTO clone = (PoundlistDTO) super.clone(); + // TODO: copy mutable state here, so the clone can't change the internals of the original + return clone; + } catch (CloneNotSupportedException e) { + throw new AssertionError(); + } + } + +} \ No newline at end of file diff --git a/SC-boot/linkage-scm/src/main/java/jnpf/poundlist/service/PoundlistService.java b/SC-boot/linkage-scm/src/main/java/jnpf/poundlist/service/PoundlistService.java index 877226a0..f0abbae8 100644 --- a/SC-boot/linkage-scm/src/main/java/jnpf/poundlist/service/PoundlistService.java +++ b/SC-boot/linkage-scm/src/main/java/jnpf/poundlist/service/PoundlistService.java @@ -1,10 +1,18 @@ package jnpf.poundlist.service; +import jnpf.arinvoices.entity.Arinvoices_item0Entity; +import jnpf.exception.DataException; import jnpf.poundlist.entity.PoundlistEntity; import com.baomidou.mybatisplus.extension.service.IService; +import jnpf.poundlist.entity.PoundlistImportVo; import jnpf.poundlist.entity.PoundlistSEntity; import jnpf.poundlist.entity.PoundlistTwoEntity; +import jnpf.poundlist.model.poundlist.PoundlistDTO; import jnpf.poundlist.model.poundlist.PoundlistPagination; +import jnpf.purchaseorder.entity.PurchaseOrderImportVo; +import jnpf.purchaseorder.model.purchaseorder.PurchaseorderDTO; + +import java.text.ParseException; import java.util.*; /** * @@ -43,4 +51,14 @@ public interface PoundlistService extends IService { // 子表方法 //列表子表数据方法 + + /** + * 导入预览 + * + * @param personList 实体对象 + * @return + */ + Map importPreview(List personList); + + PoundlistImportVo importData(List dataList) throws ParseException, DataException; } diff --git a/SC-boot/linkage-scm/src/main/java/jnpf/poundlist/service/impl/PoundlistServiceImpl.java b/SC-boot/linkage-scm/src/main/java/jnpf/poundlist/service/impl/PoundlistServiceImpl.java index 5aa5f147..9b01f845 100644 --- a/SC-boot/linkage-scm/src/main/java/jnpf/poundlist/service/impl/PoundlistServiceImpl.java +++ b/SC-boot/linkage-scm/src/main/java/jnpf/poundlist/service/impl/PoundlistServiceImpl.java @@ -1,19 +1,34 @@ package jnpf.poundlist.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.incrementer.DefaultIdentifierGenerator; +import jnpf.Jg_natural.entity.Jg_naturalEntity; +import jnpf.arinvoices.entity.Arinvoices_item0Entity; +import jnpf.base.ActionResult; +import jnpf.base.UserInfo; +import jnpf.base.controller.BillRuleController; +import jnpf.base.entity.ProvinceEntity; import jnpf.contractfile.entity.ContractFileEntity; import jnpf.contractfile.service.ContractFileService; import jnpf.customer.entity.CustomerEntity; import jnpf.customer.service.CustomerService; +import jnpf.exception.DataException; import jnpf.materialvo.entity.MaterialEntity; import jnpf.materialvo.service.MaterialService; import jnpf.model.UserGetUserEntity; import jnpf.poundlist.entity.*; import jnpf.poundlist.mapper.PoundlistMapper; +import jnpf.poundlist.model.poundlist.PoundlistDTO; import jnpf.poundlist.model.poundlist.PoundlistListVO; import jnpf.poundlist.service.*; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import jnpf.purchaseorder.entity.PurchaseOrderImportVo; +import jnpf.purchaseorder.entity.Purchaseorder_item0Entity; +import jnpf.purchaseorder.entity.PurchaseorderitemEntity; +import jnpf.purchaseorder.model.purchaseorder.PurchaseorderDTO; import jnpf.supplier.entity.SupplierEntity; import jnpf.supplier.service.SupplierService; +import jnpf.supplyProcessAnalysis.entity.ContractMEntity; import jnpf.util.RandomUtil; import java.math.BigDecimal; @@ -30,11 +45,16 @@ import java.lang.reflect.Field; import com.baomidou.mybatisplus.annotation.TableField; +import java.math.RoundingMode; +import java.text.ParseException; import java.util.stream.Collectors; +import jnpf.util.context.SpringContext; import jnpf.vehicle.entity.VehicleEntity; import jnpf.vehicle.service.VehicleService; +import org.apache.commons.lang3.ObjectUtils; +import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.core.metadata.IPage; import org.springframework.beans.factory.annotation.Autowired; @@ -77,6 +97,9 @@ public class PoundlistServiceImpl extends ServiceImpl getList(PoundlistPagination poundlistPagination) { String userId = userProvider.get().getUserId(); @@ -295,6 +318,205 @@ public class PoundlistServiceImpl extends ServiceImpl importPreview(List personList) { + List> dataRow = new ArrayList<>(); + List> columns = new ArrayList<>(); + if(personList != null) { + for (int i = 0; i < personList.size(); i++) { + Map dataRowMap = new HashMap<>(); + PoundlistEntity model = personList.get(i); + dataRowMap.put("customerName", model.getCustomerName()); + dataRowMap.put("vehicleName", model.getVehicleName()); + dataRowMap.put("grossWeight", model.getGrossWeight()); + dataRowMap.put("tareWeight", model.getTareWeight()); + dataRowMap.put("settlement", model.getSettlement()); + dataRowMap.put("unit", model.getUnit()); + dataRowMap.put("salesPrice", model.getSalesPrice()); + dataRowMap.put("salesAmount", model.getSalesAmount()); + dataRow.add(dataRowMap); + } + for (int i = 1; i < 10; i++) { + Map columnsMap = new HashMap<>(); + columnsMap.put("AllowDBNull", true); + columnsMap.put("AutoIncrement", false); + columnsMap.put("AutoIncrementSeed", 0); + columnsMap.put("AutoIncrementStep", 1); + columnsMap.put("Caption", this.getColumns(i)); + columnsMap.put("ColumnMapping", 1); + columnsMap.put("ColumnName", this.getColumns(i)); + columnsMap.put("Container", null); + columnsMap.put("DataType", "System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"); + columnsMap.put("DateTimeMode", 3); + columnsMap.put("DefaultValue", null); + columnsMap.put("DesignMode", false); + columnsMap.put("Expression", ""); + columnsMap.put("ExtendedProperties", ""); + columnsMap.put("MaxLength", -1); + columnsMap.put("Namespace", ""); + columnsMap.put("Ordinal", 0); + columnsMap.put("Prefix", ""); + columnsMap.put("ReadOnly", false); + columnsMap.put("Site", null); + columnsMap.put("Table", personList); + columnsMap.put("Unique", false); + columns.add(columnsMap); + } + } + Map map = new HashMap<>(); + map.put("dataRow", dataRow); + map.put("columns", columns); + return map; + } + private String getColumns(Integer key) { + Map map = new HashMap<>(); + map.put(1, "客户名称"); + map.put(2, "车号"); + map.put(3, "毛重"); + map.put(4, "皮重"); + map.put(5, "结算重量"); + map.put(6, "单位"); + map.put(7, "销售单价"); + map.put(8, "销售金额"); + return map.get(key); + } + + + /** + * 导入 + * + * @param dataList + * @return + */ + @Transactional(rollbackFor = Exception.class) + @Override + public PoundlistImportVo importData(List dataList) throws ParseException, DataException { + //记录成功了几条 + int sum = 0; + //记录失败了几条 + int num = 0; + + List poundlistEntityList = new ArrayList<>(); + List errList = new ArrayList<>(); + for (int i = 0; i < dataList.size(); i++) { + PoundlistDTO model = dataList.get(i); + PoundlistDTO dto = null; + try { + dto = model.clone(); + } catch (CloneNotSupportedException e) { + throw new RuntimeException(e); + } + if (StringUtils.isNotEmpty(model.getCustomerName())) { + String userId = userProvider.get().getUserId(); + String departmentId = userProvider.getDepartmentId(userId); + LambdaQueryWrapper customerWrapper = new LambdaQueryWrapper<>(); + customerWrapper.eq(CustomerEntity::getDepartmentId,departmentId); + customerWrapper.eq(CustomerEntity::getSupplierNm,model.getCustomerName()); + CustomerEntity customerEntity = customerService.getOne(customerWrapper); + String customerId = ""; + if (ObjectUtils.isNotEmpty(customerEntity) && StringUtils.isNotEmpty(customerEntity.getId())){ + customerId = customerEntity.getId(); + }else{ + dto.setCauseError("未查询到客户,请检查客户名称是否正确"); + errList.add(dto); + continue; + } + if (StringUtils.isNotEmpty(model.getVehicleName())) { + LambdaQueryWrapper vehicleWrapper = new LambdaQueryWrapper<>(); + vehicleWrapper.eq(VehicleEntity::getTicketno,model.getVehicleName()); + vehicleWrapper.eq(VehicleEntity::getDepartmentId,departmentId); + List vehicleList = vehicleService.list(vehicleWrapper); + if (vehicleList == null || vehicleList.size() == 0){ + dto.setCauseError("未查询到车号,请检查车号是否正确"); + errList.add(dto); + continue; + } + if (StringUtils.isNotEmpty(model.getGrossWeight()) || StringUtils.isNotEmpty(model.getTareWeight()) || StringUtils.isNotEmpty(model.getSettlement()) || StringUtils.isNotEmpty(model.getUnit())) { + if (model.getUnit() != null) { + if (model.getUnit().equals("吨") || model.getUnit().equals("T")) { + model.setUnit("0"); + } + if (model.getUnit().equals("千克") || model.getUnit().equals("KG")) { + model.setUnit("1"); + } + } + List vehicleId = new ArrayList<>(); + for (VehicleEntity entity : vehicleList){ + vehicleId.add(entity.getId()); + } + LambdaQueryWrapper poundlistWrapper = new LambdaQueryWrapper<>(); + poundlistWrapper.eq(PoundlistEntity::getCustomerId,customerId); + poundlistWrapper.eq(PoundlistEntity::getGrossWeight,model.getGrossWeight()); + poundlistWrapper.eq(PoundlistEntity::getTareWeight,model.getTareWeight()); + poundlistWrapper.eq(PoundlistEntity::getSettlement,model.getSettlement()); + poundlistWrapper.eq(PoundlistEntity::getUnit,model.getUnit()); + poundlistWrapper.in(PoundlistEntity::getVehicleId,vehicleId); + List poundlistList = poundlistMapper.selectList(poundlistWrapper); + if (poundlistList != null && poundlistList.size() != 0){ + if (poundlistList.size() == 1){ + PoundlistEntity poundlistEntity = JsonUtil.getJsonToBean(poundlistList.get(0),PoundlistEntity.class); + poundlistEntity.setDocumentNo(generaterSwapUtil.getBillNumber("salesOrder", false)); + ContractFileEntity entity = contractFileService.getInfo(poundlistEntity.getSalesId()); + if (ObjectUtils.isNotEmpty(entity) && StringUtils.isNotEmpty(entity.getContractNo())) { + poundlistEntity.setContractNo(entity.getContractNo()); + poundlistEntity.setContractName(entity.getContractName()); + } + CustomerEntity customer = customerService.getInfo(poundlistEntity.getCustomerId()); + if (ObjectUtils.isNotEmpty(customer) && StringUtils.isNotEmpty(customerEntity.getSupplierNm())){ + poundlistEntity.setCustomerName(customer.getSupplierNm()); + } + VehicleEntity vehicleEntity = vehicleService.getInfo(poundlistEntity.getVehicleId()); + if (ObjectUtils.isNotEmpty(vehicleEntity) && StringUtils.isNotEmpty(vehicleEntity.getTicketno())){ + poundlistEntity.setVehicleName(vehicleEntity.getTicketno()); + } + MaterialEntity materialEntity = materialService.getInfo(poundlistEntity.getMaterialId()); + if (ObjectUtils.isNotEmpty(materialEntity) && StringUtils.isNotEmpty(materialEntity.getItemName())){ + poundlistEntity.setMaterialName(materialEntity.getItemName()); + } + poundlistEntity.setRate("0"); + poundlistEntity.setUnitPrice(new BigDecimal(model.getSalesPrice())); + poundlistEntity.setPrice(new BigDecimal(model.getSalesAmount())); + poundlistEntityList.add(poundlistEntity); + sum++; + }else{ + dto.setCauseError("【车号-"+model.getVehicleName()+"】出现重复数据,请查验"); + errList.add(dto); + } + }else{ + dto.setCauseError("未查询到磅单"); + errList.add(dto); + } + }else{ + dto.setCauseError("毛重或皮重或结算重量或单位不能为空"); + errList.add(dto); + } + }else{ + dto.setCauseError("车号不能为空"); + errList.add(dto); + } + }else{ + dto.setCauseError("客户名称不能为空"); + errList.add(dto); + } + } + PoundlistImportVo importVo = new PoundlistImportVo(); + + num = errList.size(); + + + importVo.setSnum(sum); + importVo.setFnum(num); + importVo.setFailResult(errList); + if (errList.size() > 0) { + importVo.setResultType(1); + } else { + importVo.setResultType(0); + importVo.setPoundlistEntityList(poundlistEntityList); + } + return importVo; + } + + @Override public void delete(PoundlistEntity entity) { if (entity != null) { diff --git a/SC-web/src/api/scm/poundlist.js b/SC-web/src/api/scm/poundlist.js new file mode 100644 index 00000000..4377822d --- /dev/null +++ b/SC-web/src/api/scm/poundlist.js @@ -0,0 +1,25 @@ +import request from '@/utils/request' + +// 导入 +export function ImportData(data) { + return request({ + url: '/api/poundlist/Poundlist/ImportData', + method: 'post', + data + }) +} +// 导入预览 +export function ImportPreview(data) { + return request({ + url: '/api/poundlist/Poundlist/ImportPreview', + method: 'get', + data + }) +} +//模板下载 +export function TemplateDownload() { + return request({ + url: '/api/poundlist/Poundlist/templateDownload', + method: 'get' + }) +} diff --git a/SC-web/src/views/scm/basicInformation/poundlist/ImportForm.vue b/SC-web/src/views/scm/basicInformation/poundlist/ImportForm.vue new file mode 100644 index 00000000..96502846 --- /dev/null +++ b/SC-web/src/views/scm/basicInformation/poundlist/ImportForm.vue @@ -0,0 +1,243 @@ + + + diff --git a/SC-web/src/views/scm/basicInformation/poundlist/index.vue b/SC-web/src/views/scm/basicInformation/poundlist/index.vue index 0f0809fb..c19ca913 100644 --- a/SC-web/src/views/scm/basicInformation/poundlist/index.vue +++ b/SC-web/src/views/scm/basicInformation/poundlist/index.vue @@ -120,6 +120,8 @@ 生成采购 生成销售 + + 订单导入
@@ -272,6 +274,7 @@ +
@@ -283,13 +286,13 @@ import JNPFForm from './Form' import JNPFForm2 from './PurchaseOrderForm' import JNPFForm4 from './salesForm' - import JNPFForm6 from './VechicleForm' import ExportBox from './ExportBox' import { getDataInterfaceRes } from '@/api/systemData/dataInterface' import Detail from './Detail' + import ImportForm from './ImportForm' export default { components: { @@ -298,10 +301,12 @@ JNPFForm4, JNPFForm6, ExportBox, - Detail + Detail, + ImportForm }, data() { return { + importFormVisible: false, showAll: false, detailVisible: false, query: { @@ -513,6 +518,12 @@ this.initData() }, methods: { + orderImport(){ + this.importFormVisible = true + this.$nextTick(() => { + this.$refs.importForm.init() + }) + }, getSummaries(param) { const { columns, data } = param; const sums = []; diff --git a/SC-web/src/views/scm/basicInformation/poundlist/salesForm.vue b/SC-web/src/views/scm/basicInformation/poundlist/salesForm.vue index 2cadd4b3..35d70640 100644 --- a/SC-web/src/views/scm/basicInformation/poundlist/salesForm.vue +++ b/SC-web/src/views/scm/basicInformation/poundlist/salesForm.vue @@ -186,7 +186,7 @@

- @@ -1029,6 +1029,44 @@ this.dataForm.price = amount this.$store.commit('generator/UPDATE_RELATION_DATA', {}) }, + init2(list) { + this.visible = true + this.dataForm.salesorder_item0List = list + this.dataForm.documentNo = list[0].documentNo + this.dataForm.contractId = list[0].salesId + this.dataForm.customerId = list[0].customerId + this.dataForm.contractNo = list[0].contractNo + this.dataForm.contractName = list[0].contractName + this.dataForm.customerName = list[0].customerName + this.dataForm.isTransfer = list.isTransfer + this.dataForm.purchaseOrderId = list.purchaseOrderId + debugger + var num = 0 + var amount = 0 + var advance = 0 + var notPrice = 0 + for (let i = 0; i < list.length; i++) { + // this.dataForm.salesorder_item0List[i].unitPrice = list[i].salesPrice; + this.dataForm.salesorder_item0List[i].poundlistId = list[i].id + this.dataForm.salesorder_item0List[i].price = list[i].price.toFixed(2) + this.rateOptions.find((item) => { + if (this.dataForm.salesorder_item0List[i].rate == item.id) { + this.dataForm.salesorder_item0List[i].noPrice = this.jnpf.floatDiv(this.dataForm.salesorder_item0List[i].price, this.jnpf.floatAdd(1, this.jnpf.floatDiv(item.fullName,100))).toFixed(2) + notPrice = this.jnpf.floatAdd(notPrice, this.dataForm.salesorder_item0List[i].noPrice) + } + }) + if (list[i].advance == 1) { + advance = this.jnpf.floatAdd(advance, this.jnpf.floatMul(list[i].salesPrice, list[i].settlement)).toFixed(2) + } + num = this.jnpf.floatAdd(num, list[i].settlement) + amount = this.jnpf.floatAdd(amount, list[i].price) + } + this.dataForm.notPrice = notPrice + this.dataForm.advanceAmount = advance + this.dataForm.num = num + this.dataForm.price = amount + this.$store.commit('generator/UPDATE_RELATION_DATA', {}) + }, // 表单提交 dataFormSubmit() { this.$refs['elForm'].validate((valid) => {