diff --git a/core/dao/src/main/java/com/wansenai/mappers/product/ProductStockKeepUnitMapper.java b/core/dao/src/main/java/com/wansenai/mappers/product/ProductStockKeepUnitMapper.java index 1f69d4df..e3644a86 100644 --- a/core/dao/src/main/java/com/wansenai/mappers/product/ProductStockKeepUnitMapper.java +++ b/core/dao/src/main/java/com/wansenai/mappers/product/ProductStockKeepUnitMapper.java @@ -29,5 +29,5 @@ public interface ProductStockKeepUnitMapper extends BaseMapper SELECT ps.id, p.id AS productId, p.product_category_id, p.product_name, p.product_model, p.product_standard, p.product_color, sku.product_bar_code, sku.multi_attribute, sku.product_unit, sku.retail_price, p.product_manufacturer,pc.category_name, - ps.current_stock_quantity, w.warehouse_name + ps.current_stock_quantity, w.warehouse_name, ps.warehouse_id FROM product_stock AS ps LEFT JOIN warehouse as w ON ps.warehouse_id = w.id LEFT JOIN product_sku AS sku ON sku.id = ps.product_sku_id @@ -49,7 +49,7 @@ - SELECT sku.id, p.id AS productId, p.product_category_id, p.product_name, p.product_model, p.product_standard, p.product_color, sku.product_bar_code, sku.multi_attribute, sku.product_unit, sku.retail_price, p.product_manufacturer, - pc.category_name, ps.current_stock_quantity + pc.category_name, ps.current_stock_quantity, ps.warehouse_id FROM product_stock AS ps LEFT JOIN product_sku AS sku ON sku.id = ps.product_sku_id LEFT JOIN product AS p ON sku.product_id = p.id LEFT JOIN product_category AS pc ON p.product_category_id = pc.id - WHERE p.id= #{productId} AND ps.warehouse_id = #{warehouseId} + WHERE p.id= #{productId} AND ps.warehouse_id = #{warehouseId} AND sku.product_bar_code = #{barCode} diff --git a/core/domain/src/main/java/com/wansenai/bo/ShipmentsDataBO.java b/core/domain/src/main/java/com/wansenai/bo/ShipmentsDataBO.java index 49fa17ca..33a5b6bb 100644 --- a/core/domain/src/main/java/com/wansenai/bo/ShipmentsDataBO.java +++ b/core/domain/src/main/java/com/wansenai/bo/ShipmentsDataBO.java @@ -20,10 +20,19 @@ public class ShipmentsDataBO { private String productCode; - private String barcode; + @JsonFormat(shape = JsonFormat.Shape.STRING) + private Long barCode; private Long productId; + private String productName; + + private String productUnit; + + private String productStandard; + + private Integer stock; + private Integer productNumber; @JsonSerialize(using = BigDecimalSerializerBO.class) @@ -31,6 +40,4 @@ public class ShipmentsDataBO { @JsonSerialize(using = BigDecimalSerializerBO.class) private BigDecimal amount; - - private String remark; } diff --git a/core/domain/src/main/java/com/wansenai/entities/receipt/ReceiptMain.java b/core/domain/src/main/java/com/wansenai/entities/receipt/ReceiptMain.java index 19c2a114..1dc2d626 100644 --- a/core/domain/src/main/java/com/wansenai/entities/receipt/ReceiptMain.java +++ b/core/domain/src/main/java/com/wansenai/entities/receipt/ReceiptMain.java @@ -53,8 +53,6 @@ public class ReceiptMain implements Serializable { private String receiptNumber; - private String receiptType; - private BigDecimal changeAmount; private BigDecimal backAmount; diff --git a/core/domain/src/main/java/com/wansenai/entities/receipt/ReceiptSub.java b/core/domain/src/main/java/com/wansenai/entities/receipt/ReceiptSub.java index c59dbe75..86664591 100644 --- a/core/domain/src/main/java/com/wansenai/entities/receipt/ReceiptSub.java +++ b/core/domain/src/main/java/com/wansenai/entities/receipt/ReceiptSub.java @@ -45,6 +45,10 @@ public class ReceiptSub implements Serializable { private Long productId; + private Long warehouseId; + + private Long productBarcode; + private Integer productNumber; private BigDecimal productPrice; @@ -55,8 +59,6 @@ public class ReceiptSub implements Serializable { private Long productExtendId; - private Long warehouseId; - private Long anotherWarehouseId; private Long correlationId; diff --git a/core/service/src/main/java/com/wansenai/service/receipt/impl/RetailServiceImpl.java b/core/service/src/main/java/com/wansenai/service/receipt/impl/RetailServiceImpl.java index 9534374f..44306dee 100644 --- a/core/service/src/main/java/com/wansenai/service/receipt/impl/RetailServiceImpl.java +++ b/core/service/src/main/java/com/wansenai/service/receipt/impl/RetailServiceImpl.java @@ -54,16 +54,13 @@ public class RetailServiceImpl extends ServiceImpl addOrUpdateRetailShipments(RetailShipmentsDTO shipmentsD .eq(ReceiptMain::getId, shipmentsDTO.getId()) .set(shipmentsDTO.getMemberId() != null, ReceiptMain::getMemberId, shipmentsDTO.getMemberId()) .set(shipmentsDTO.getAccountId() != null, ReceiptMain::getAccountId, shipmentsDTO.getAccountId()) - .set(StringUtils.hasText(shipmentsDTO.getPaymentType()), ReceiptMain::getReceiptType, shipmentsDTO.getPaymentType()) .set(shipmentsDTO.getCollectAmount() != null, ReceiptMain::getChangeAmount, shipmentsDTO.getCollectAmount()) .set(shipmentsDTO.getReceiptAmount() != null, ReceiptMain::getTotalPrice, shipmentsDTO.getReceiptAmount()) .set(shipmentsDTO.getBackAmount() != null, ReceiptMain::getBackAmount, shipmentsDTO.getBackAmount()) @@ -161,6 +157,7 @@ public Response addOrUpdateRetailShipments(RetailShipmentsDTO shipmentsD .productNumber(item.getProductNumber()) .productPrice(item.getUnitPrice()) .productTotalPrice(item.getAmount()) + .productBarcode(item.getBarCode()) .warehouseId(item.getWarehouseId()) .build()) .collect(Collectors.toList()); @@ -246,6 +243,7 @@ public Response addOrUpdateRetailShipments(RetailShipmentsDTO shipmentsD .productNumber(item.getProductNumber()) .productPrice(item.getUnitPrice()) .productTotalPrice(item.getAmount()) + .productBarcode(item.getBarCode()) .warehouseId(item.getWarehouseId()) .build()) .collect(Collectors.toList()); @@ -314,33 +312,24 @@ public Response getRetailShipmentsDetail(Long id) { var tableData = new ArrayList(receiptSubList.size() + 1); for (ReceiptSub item : receiptSubList) { - - var wrapper = new LambdaQueryWrapper() - .eq(ProductStockKeepUnit::getProductId, item.getProductId()); - var skuList = productStockKeepUnitMapper.selectList(wrapper); -// if(!skuList.isEmpty()) { -// var stocksWrapper = new LambdaQueryWrapper() -// .in(ProductStock::getProductSkuId, skuList.stream().map(ProductStockKeepUnit::getId).toList()) -// .eq(ProductStock::getWarehouseId, item.getWarehouseId()); -// -// var stocks = productStockMapper.selectList(stocksWrapper); -// for (ProductStock stock : stocks) { -// var data = productStockKeepUnitMapper.getProductSkuByProductId(item.getProductId(), item.getWarehouseId()); -// // System.err.println(data); -// } -// } - - var data = productStockKeepUnitMapper.getProductSkuByProductId(item.getProductId(), item.getWarehouseId()); - System.err.println(data); - var shipmentBo = ShipmentsDataBO.builder() .productId(item.getProductId()) + .barCode(item.getProductBarcode()) .productNumber(item.getProductNumber()) .unitPrice(item.getProductPrice()) .amount(item.getProductTotalPrice()) .warehouseId(item.getWarehouseId()) .build(); + var data = productStockKeepUnitMapper.getProductSkuByBarCode(item.getProductBarcode(), item.getWarehouseId()); + if(data != null) { + shipmentBo.setProductName(data.getProductName()); + shipmentBo.setProductStandard(data.getProductStandard()); + shipmentBo.setProductUnit(data.getProductUnit()); + shipmentBo.setStock(data.getStock()); + + } + tableData.add(shipmentBo); } diff --git a/web/src/api/product/model/productModel.ts b/web/src/api/product/model/productModel.ts index e1606aa8..2b9db54b 100644 --- a/web/src/api/product/model/productModel.ts +++ b/web/src/api/product/model/productModel.ts @@ -138,6 +138,7 @@ export interface ProductExtendPriceResp { id: number | string; productId: number | string; productCategoryId: number | string; + warehouseId: number | string; barCode: string; productName: string; productStandard: string; diff --git a/web/src/views/retail/shipments/components/AddEditModal.vue b/web/src/views/retail/shipments/components/AddEditModal.vue index 40f62a0c..6003196a 100644 --- a/web/src/views/retail/shipments/components/AddEditModal.vue +++ b/web/src/views/retail/shipments/components/AddEditModal.vue @@ -88,7 +88,7 @@ @@ -302,6 +302,7 @@ export default defineComponent({ const fileList = ref([]); const payTypeList = ref([]); const minWidth = ref(1100); + const backAmount = ref('¥0.00'); const model = ref({}); const labelCol = ref({ xs: {span: 24}, @@ -406,6 +407,10 @@ export default defineComponent({ warehouseId: item.warehouseId, productId: item.productId, barCode: item.barCode, + productName: item.productName, + productStandard: item.productStandard, + productUnit: item.productUnit, + stock: item.stock, productNumber: item.productNumber, amount: item.amount, retailPrice: item.unitPrice, @@ -416,7 +421,6 @@ export default defineComponent({ } } - const backAmount = ref('¥0.00'); function onChangePaymentAmount() { const sum = receiptAmount.value const collect = collectAmount.value @@ -445,9 +449,7 @@ export default defineComponent({ if (table) { //根据productExtendPrice.id判断表格中如果是同一个商品,数量加1 否则新增一行 const tableData = table.getTableData().tableData - const index = tableData.findIndex(item => item.id === productExtendPrice.id) - const defaultWarehouse = warehouseList.value.find(item => item.isDefault === 1) - const warehouseId = defaultWarehouse ? defaultWarehouse.id : warehouseList.value[0].id + const index = tableData.findIndex(item => item.barCode === productExtendPrice.barCode && item.warehouseId === productExtendPrice.warehouseId) if (index > -1) { const row = tableData[index] row.productNumber = row.productNumber + 1 @@ -456,7 +458,7 @@ export default defineComponent({ } else { table.insert({ id: productExtendPrice.id, - warehouseId: warehouseId, + warehouseId: productExtendPrice.warehouseId, productId: productExtendPrice.productId, barCode: productExtendPrice.barCode, productName: productExtendPrice.productName, @@ -473,6 +475,7 @@ export default defineComponent({ }) // 清除扫码框的值 formState.scanBarCode = '' + onChangePaymentAmount() } function scanEnter() { @@ -553,7 +556,7 @@ export default defineComponent({ table.getInsertRecords().forEach(item => { const data: ShipmentsData = { warehouseId: item.warehouseId, - barcode: item.barCode, + barCode: item.barCode, productId: item.productId, productNumber: item.productNumber, unitPrice: item.retailPrice, @@ -596,7 +599,7 @@ export default defineComponent({ formState.scanBarCode = '' receiptAmount.value = '' collectAmount.value = '' - backAmount.value = '' + backAmount.value = '¥0.00' fileList.value = [] const table = xGrid.value if(table) { @@ -642,11 +645,8 @@ export default defineComponent({ function handleCheckSuccess(data) { const table = xGrid.value if(table) { - const defaultWarehouse = warehouseList.value.find(item => item.isDefault === 1) - const warehouseId = defaultWarehouse ? defaultWarehouse.id : warehouseList.value[0].id data.forEach(item => { - item.productNumber = 1, - item.warehouseId = warehouseId + item.productNumber = 1 }) table.insert(data) } diff --git a/web/src/views/retail/shipments/model/addEditModel.ts b/web/src/views/retail/shipments/model/addEditModel.ts index 05346067..dfee359c 100644 --- a/web/src/views/retail/shipments/model/addEditModel.ts +++ b/web/src/views/retail/shipments/model/addEditModel.ts @@ -29,7 +29,6 @@ export interface RowVO { productNumber: number, retailPrice: number, amount: number, - remark: string } const xGrid = ref>()