Skip to content

Commit

Permalink
Merge pull request #265 from Jzow/master
Browse files Browse the repository at this point in the history
fetch: add check product barcode
  • Loading branch information
wansenai-bot authored Dec 7, 2023
2 parents 4854b16 + a9a4e5b commit 4680410
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,7 @@
import java.io.IOException;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -422,8 +419,13 @@ public Response<String> addOrUpdateRetailShipments(RetailShipmentsDTO shipmentsD
return Response.responseMsg(RetailCodeEnum.UPDATE_RETAIL_SHIPMENTS_ERROR);
}
} else {
var id = SnowflakeIdUtil.nextId();

for (ShipmentsDataBO check : shipmentsDTO.getTableData()) {
if (check.getProductId() == null) {
return Response.responseMsg(BaseCodeEnum.QUERY_DATA_EMPTY.getCode(), "条码没有找到对应的商品,请检查条码是否正确");
}
}
var id = SnowflakeIdUtil.nextId();
var receiptMain = ReceiptRetailMain.builder()
.id(id)
.type(ReceiptConstants.RECEIPT_TYPE_SHIPMENT)
Expand Down Expand Up @@ -468,7 +470,7 @@ public Response<String> addOrUpdateRetailShipments(RetailShipmentsDTO shipmentsD
var account = accountService.getById(shipmentsDTO.getAccountId());
if (account != null) {
// 更新余额
var accountBalance = account.getCurrentAmount();
var accountBalance = Optional.ofNullable(account.getCurrentAmount()).orElse(BigDecimal.ZERO);
var changeAmount = shipmentsDTO.getReceiptAmount();
if (changeAmount != null) {
accountBalance = accountBalance.add(changeAmount);
Expand Down Expand Up @@ -718,8 +720,12 @@ public Response<String> addOrUpdateRetailRefund(RetailRefundDTO refundDTO) {
return Response.responseMsg(RetailCodeEnum.UPDATE_RETAIL_REFUND_ERROR);
}
} else {
for (ShipmentsDataBO check : refundDTO.getTableData()) {
if (check.getProductId() == null) {
return Response.responseMsg(BaseCodeEnum.QUERY_DATA_EMPTY.getCode(), "条码没有找到对应的商品,请检查条码是否正确");
}
}
var id = SnowflakeIdUtil.nextId();

var receiptMain = ReceiptRetailMain.builder()
.id(id)
.type(ReceiptConstants.RECEIPT_TYPE_STORAGE)
Expand Down
2 changes: 1 addition & 1 deletion web/src/layouts/default/footer/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<a @click="openWindow(DOC_URL)">{{ t('layout.footer.onlineDocument') }}</a>
</div>
<div>Copyright &copy;2020 Vben Admin</div>
<div>Copyright &copy;2023 WanSen ERP</div>
</Footer>
</template>

Expand Down
6 changes: 3 additions & 3 deletions web/src/settings/siteSetting.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// github repo url
export const GITHUB_URL = 'https://github.com/wansenai/eairp-web';
export const GITHUB_URL = 'https://github.com/wansenai';

// doc
export const DOC_URL = 'https://github.com/wansenai/eairp-web';
export const DOC_URL = 'https://wansenai.com';

// site url
export const SITE_URL = 'https://github.com/wansenai/eairp-web';
export const SITE_URL = 'https://wansenai.com';
14 changes: 10 additions & 4 deletions web/src/views/retail/refund/components/AddEditModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
@pressEnter="scanPressEnter" ref="scanBarCode"/>
<a-button v-if="showScanPressEnter" style="margin-right: 10px" @click="stopScan">收起扫码</a-button>
<a-button @click="productModal" style="margin-right: 10px">选择添加退货商品</a-button>
<a-button @click="addRowData" style="margin-right: 10px">添加一行</a-button>
<a-button @click="deleteRowData" style="margin-right: 10px">删除选中行</a-button>
</template>
<template #product_number_edit="{ row }">
Expand Down Expand Up @@ -521,17 +522,22 @@ export default defineComponent({
async function handleOk(type: number) {
const table = xGrid.value
if (!formState.receiptDate) {
createMessage.error('请选择单据日期');
createMessage.warn('请选择单据日期');
return;
}
if (!formState.accountId) {
createMessage.error('请选择付款账户');
createMessage.warn('请选择付款账户');
return;
}
if(table) {
const insertRecords = table.getInsertRecords()
if(insertRecords.length === 0) {
createMessage.error("请添加一行数据")
createMessage.warn("请添加一行数据")
return;
}
const isBarCodeEmpty = insertRecords.some(item => !item.barCode)
if(isBarCodeEmpty) {
createMessage.warn("请录入条码或者选择产品")
return;
}
}
Expand Down Expand Up @@ -589,7 +595,7 @@ export default defineComponent({
status: type,
}
const result = await addOrUpdateRefund(params)
if (result.code === 'R0004' || 'R0005') {
if (result.code === 'R0004' || result.code === 'R0005') {
handleCancelModal();
}
}
Expand Down
13 changes: 9 additions & 4 deletions web/src/views/retail/shipments/components/AddEditModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -519,17 +519,22 @@ export default defineComponent({
async function handleOk(type: number) {
const table = xGrid.value
if (!formState.receiptDate) {
createMessage.error('请选择单据日期');
createMessage.warn('请选择单据日期');
return;
}
if (!formState.accountId) {
createMessage.error('请选择收款账户');
createMessage.warn('请选择收款账户');
return;
}
if(table) {
const insertRecords = table.getInsertRecords()
if(insertRecords.length === 0) {
createMessage.error("请添加一行数据")
createMessage.warn("请添加一行数据")
return;
}
const isBarCodeEmpty = insertRecords.some(item => !item.barCode)
if(isBarCodeEmpty) {
createMessage.warn("请录入条码或者选择产品")
return;
}
}
Expand Down Expand Up @@ -586,7 +591,7 @@ export default defineComponent({
status: type,
}
const result = await addOrUpdateShipments(params)
if (result.code === 'R0001' || 'R0002') {
if (result.code === 'R0001' || result.code === 'R0002') {
handleCancelModal();
}
}
Expand Down
3 changes: 1 addition & 2 deletions web/src/views/retail/shipments/model/addEditModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,7 @@ const gridOptions = reactive<VxeGridProps<RowVO>>({
width:160,
title: '条码',
slots: { edit: 'barCode_edit' },
sortable: true,
titlePrefix: { content: '输入条码商品信息自动带出!' },
titlePrefix: { content: '需要在商品管理添加商品' },
editRender: { name: 'input', attrs: { placeholder: '请输入条码并回车' } }
},
{
Expand Down

0 comments on commit 4680410

Please sign in to comment.