Merge branch 'master' of http://git.unissense.tech/mula/unis_sip
commit
2836b3c18a
|
@ -227,7 +227,7 @@
|
|||
align: 'center',
|
||||
title: '产品名称',
|
||||
formatter: function (value, row, index) {
|
||||
var html = $.common.sprintf("<p class='form-control-static'>%s</p>", value);
|
||||
var html = $.common.sprintf("<input readonly class='form-control' type='text' name='orderListList[%s].productName' value='%s'>", index, value);
|
||||
return html;
|
||||
}
|
||||
},
|
||||
|
@ -253,9 +253,9 @@
|
|||
field: 'discount',
|
||||
align: 'center',
|
||||
title: '折扣',
|
||||
width: 70,
|
||||
width: 90,
|
||||
formatter: function (value, row, index) {
|
||||
var html = $.common.sprintf("<input readonly class='form-control discount' type='number' name='orderListList[%s].discount' value='%s' step='0.1' max='1' min='0'>", index, value);
|
||||
var html = $.common.sprintf("<input readonly class='form-control discount' type='number' name='orderListList[%s].discount' value='%s' step='0.0001' max='1' min='0'>", index, value);
|
||||
return html;
|
||||
}
|
||||
},
|
||||
|
@ -298,10 +298,11 @@
|
|||
|
||||
function addRow(row) {
|
||||
var count = $("#" + table.options.id).bootstrapTable('getData').length;
|
||||
var row = {
|
||||
var newRow = {
|
||||
index: $.table.serialNumber(count),
|
||||
productId: row.productId,
|
||||
productCode: row.productCode,
|
||||
productName: row.productName,
|
||||
quantity: row.quantity,
|
||||
price: row.price,
|
||||
amount: row.amount,
|
||||
|
@ -311,7 +312,7 @@
|
|||
deletedAt: row.deletedAt,
|
||||
discount: row.discount,
|
||||
}
|
||||
sub.addRow(row);
|
||||
sub.addRow(newRow);
|
||||
|
||||
}
|
||||
|
||||
|
@ -421,6 +422,7 @@
|
|||
let data = JSON.parse(res.currentTarget.response)
|
||||
if (data.code === 0) {
|
||||
$.modal.msgSuccess('导入成功');
|
||||
|
||||
data.data.forEach((row) => {
|
||||
addRow(row)
|
||||
})
|
||||
|
|
|
@ -425,8 +425,9 @@
|
|||
field: 'discount',
|
||||
align: 'center',
|
||||
title: '折扣',
|
||||
width:90,
|
||||
formatter: function (value, row, index) {
|
||||
var html = $.common.sprintf("<input readonly class='form-control discount' type='number' name='orderListList[%s].discount' value='%s' step='0.1' max='1' min='0'>", index, value);
|
||||
var html = $.common.sprintf("<input readonly class='form-control discount' type='number' name='orderListList[%s].discount' value='%s' step='0.0001' max='1' min='0'>", index, value);
|
||||
return html;
|
||||
}
|
||||
},
|
||||
|
|
|
@ -2,8 +2,10 @@ package com.ruoyi.sip.controller;
|
|||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
|
@ -218,9 +220,16 @@ public class OrderInfoController extends BaseController
|
|||
}
|
||||
//只处理当前产品表有的数据
|
||||
List<ProductInfo> productInfos = productInfoService.selectProductInfoList(new ProductInfo());
|
||||
Set<String> productSet = productInfos.stream().map(ProductInfo::getProductCode).collect(Collectors.toSet());
|
||||
Map<String, ProductInfo> productInfoMap = productInfos.stream().collect(Collectors.toMap(ProductInfo::getProductCode, Function.identity(), (v1, v2) -> v1));
|
||||
orderListList = orderListList.stream().filter(item -> item != null && StringUtils.isNotEmpty(item.getProductCode())
|
||||
&& productSet.contains(item.getProductCode())).collect(Collectors.toList());
|
||||
&& productInfoMap.containsKey(item.getProductCode()))
|
||||
.collect(Collectors.toList());
|
||||
for (OrderList orderList : orderListList) {
|
||||
ProductInfo productInfo = productInfoMap.get(orderList.getProductCode());
|
||||
if (productInfo != null) {
|
||||
orderList.setProductName(productInfo.getProductName());
|
||||
}
|
||||
}
|
||||
if (CollUtil.isEmpty(orderListList)){
|
||||
throw new ServiceException("导入excel的产品均未在产品库中,导入失败");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue