改造 下单不合并相同物料SKU的数量

This commit is contained in:
袁锋 2025-12-14 18:45:22 +08:00
parent b94515daef
commit 5d71511e22
3 changed files with 21 additions and 9 deletions

View File

@ -866,6 +866,7 @@ public class SaleOrderServiceImpl implements SaleOrderService {
saleOrderSkuDO.setRemark(saleOrderSkuDTO.getRemark());
saleOrderSkuDO.setSourceFile(saleOrderSkuDTO.getSourceFile());
saleOrderSkuDO.setId(FuncUtil.getNextId());
saleOrderSkuDO.setItemKey(saleOrderSkuDTO.getItemKey());
skuList.add(saleOrderSkuDO);
}
@ -1025,6 +1026,7 @@ public class SaleOrderServiceImpl implements SaleOrderService {
saleOrderSkuDO.setSpecInfo(JSONUtil.toJsonStr(saleOrderSkuDTO.getSpecInfo()));
saleOrderSkuDO.setRemark(saleOrderSkuDTO.getRemark());
saleOrderSkuDO.setId(FuncUtil.getNextId());
saleOrderSkuDO.setItemKey(saleOrderSkuDTO.getItemKey());
Long id1 = entry.getId();
if (FuncUtil.isNotEmpty(id1)) {
skuUpdateList.add(saleOrderSkuDO);
@ -1363,6 +1365,7 @@ public class SaleOrderServiceImpl implements SaleOrderService {
// sku list
LambdaQueryWrapper<SaleOrderSkuDO> skuWrapper = new LambdaQueryWrapper<>();
skuWrapper.eq(SaleOrderSkuDO::getSaleOrderId, saleOrderDO.getId());
skuWrapper.eq(SaleOrderSkuDO::getEntryId, entryDO.getId());
skuWrapper.eq(SaleOrderSkuDO::getDeleted, false);
List<SaleOrderSkuDO> sukList = skuOrderSkuMapper.selectList(skuWrapper);
List<SaleOrderSkuDTO> skus = new ArrayList<>();

View File

@ -117,7 +117,7 @@ const addProduct = () => {
}
const delProduct = () => {
useMessage().confirm(t("common.delDataMessage")).then(() => {
that.tableData = that.tableData.filter(item => item.productId !== that.selectRow.productId)
that.tableData = that.tableData.filter(item => item.itemKey !== that.selectRow.itemKey)
useMessage().notifySuccess(t("common.delSuccess"));
emit('delRow', that.selectRow);
emitter.emit(PRODUCT_DEL_ROW_EVENT, that.selectRow);
@ -138,12 +138,13 @@ const copyData = (str: string) => {
})
}
const addRow = (row) => {
for (let i = 0; i < that.tableData.length; i++) {
if (that.tableData[i].productId === row.id) {
useMessage().notifyError(t("createOrder.tipsDuplicateSkipped"))
return
}
}
//
// for (let i = 0; i < that.tableData.length; i++) {
// if (that.tableData[i].productId === row.id) {
// useMessage().notifyError(t("createOrder.tipsDuplicateSkipped"))
// return
// }
// }
if (!row.deliveryDate) {
row.deliveryDate = Date.now() + (24 * 60 * 60 * 1000)
@ -191,7 +192,7 @@ const setSelectRow = (row) => {
that.selectRow = row
for (let i = 0; i < that.tableData.length; i++) {
if (that.tableData[i].productId === that.selectRow.productId) {
if (that.tableData[i].itemKey === that.selectRow.itemKey) {
let orderQty = 0;
for (let j = 0; j < that.selectRow.productSkuList.length; j++) {
orderQty += that.selectRow.productSkuList[j].orderQty || 0
@ -212,7 +213,14 @@ const getTableData = () => {
}
const init = (data) => {
if (data && data.length > 0) {
that.tableData = data
that.tableData = []
for (let i = 0; i < data.length; i++) {
that.tableData.push({
itemKey: Math.random().toString(36).substring(2),
...data[i]
})
}
rowChange(data[0])
}

View File

@ -80,6 +80,7 @@ const addSku = () => {
//@ts-ignore
that.tableData.push({
key: Math.random().toString(36).substring(2),
itemKey: Math.random().toString(36).substring(2),
listKey: that.listKey,
orderQty: 1,
productId: that.productId,