Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the UI and API for sales shipments #178

Merged
merged 4 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.wansenai.api;
package com.wansenai.api.receipt;

import com.wansenai.service.receipt.ReceiptRetailService;
import com.wansenai.utils.response.Response;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.wansenai.api;
package com.wansenai.api.receipt;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wansenai.dto.receipt.retail.QueryRetailRefundDTO;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.wansenai.api;
package com.wansenai.api.receipt;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wansenai.dto.receipt.sale.QuerySaleOrderDTO;
Expand Down Expand Up @@ -65,26 +65,26 @@

@GetMapping("/shipments/pageList")
public Response<Page<SaleShipmentsVO>> shipmentsPageList(@ModelAttribute QuerySaleShipmentsDTO shipmentsDTO) {
return receiptSaleService.getSaleShipmentsPage(shipmentsDTO);

Check warning on line 68 in core/api/src/main/java/com/wansenai/api/receipt/SalesController.java

View check run for this annotation

Codecov / codecov/patch

core/api/src/main/java/com/wansenai/api/receipt/SalesController.java#L68

Added line #L68 was not covered by tests
}

@PostMapping("/shipments/addOrUpdate")
public Response<String> addOrUpdateShipments(@RequestBody SaleShipmentsDTO shipmentsDTO) {
return receiptSaleService.addOrUpdateSaleShipments(shipmentsDTO);

Check warning on line 73 in core/api/src/main/java/com/wansenai/api/receipt/SalesController.java

View check run for this annotation

Codecov / codecov/patch

core/api/src/main/java/com/wansenai/api/receipt/SalesController.java#L73

Added line #L73 was not covered by tests
}

@GetMapping("/shipments/detail/{id}")
public Response<SaleShipmentsDetailVO> shipmentsDetail(@PathVariable("id") Long id) {
return receiptSaleService.getSaleShipmentsDetail(id);

Check warning on line 78 in core/api/src/main/java/com/wansenai/api/receipt/SalesController.java

View check run for this annotation

Codecov / codecov/patch

core/api/src/main/java/com/wansenai/api/receipt/SalesController.java#L78

Added line #L78 was not covered by tests
}

@PutMapping("/shipments/updateStatus/{ids}/{status}")
public Response<String> updateShipmentsStatus(@PathVariable("ids") List<Long> ids, @PathVariable("status") Integer status) {
return receiptSaleService.updateSaleShipmentsStatus(ids, status);

Check warning on line 83 in core/api/src/main/java/com/wansenai/api/receipt/SalesController.java

View check run for this annotation

Codecov / codecov/patch

core/api/src/main/java/com/wansenai/api/receipt/SalesController.java#L83

Added line #L83 was not covered by tests
}

@PutMapping("/shipments/delete/{ids}")
public Response<String> deleteShipments(@PathVariable("ids") List<Long> ids) {
return receiptSaleService.deleteSaleShipments(ids);

Check warning on line 88 in core/api/src/main/java/com/wansenai/api/receipt/SalesController.java

View check run for this annotation

Codecov / codecov/patch

core/api/src/main/java/com/wansenai/api/receipt/SalesController.java#L88

Added line #L88 was not covered by tests
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public Response<String> addOrUpdateRetailShipments(RetailShipmentsDTO shipmentsD
var fid = new ArrayList<>();
if (!shipmentsDTO.getFiles().isEmpty()) {
var receiptMain = getById(shipmentsDTO.getId());
if (StringUtils.hasLength(receiptMain.getFileId())) {
if (receiptMain != null && StringUtils.hasLength(receiptMain.getFileId())) {
var ids = Arrays.stream(receiptMain.getFileId().split(","))
.map(Long::parseLong)
.collect(Collectors.toList());
Expand Down Expand Up @@ -660,7 +660,7 @@ public Response<String> addOrUpdateRetailRefund(RetailRefundDTO refundDTO) {

if (!refundDTO.getFiles().isEmpty()) {
var receiptMain = getById(refundDTO.getId());
if (StringUtils.hasLength(receiptMain.getFileId())) {
if (receiptMain != null && StringUtils.hasLength(receiptMain.getFileId())) {
var ids = Arrays.stream(receiptMain.getFileId().split(","))
.map(Long::parseLong)
.collect(Collectors.toList());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ public Response<String> addOrUpdateSaleOrder(SaleOrderDTO saleOrderDTO) {
var fid = new ArrayList<>();
if (!saleOrderDTO.getFiles().isEmpty()) {
var receiptMain = getById(saleOrderDTO.getId());
if (StringUtils.hasLength(receiptMain.getFileId())) {
if (receiptMain != null && StringUtils.hasLength(receiptMain.getFileId())) {
var ids = Arrays.stream(receiptMain.getFileId().split(","))
.map(Long::parseLong)
.collect(Collectors.toList());
Expand Down Expand Up @@ -677,7 +677,7 @@ public Response<String> addOrUpdateSaleShipments(SaleShipmentsDTO shipmentsDTO)
var fid = new ArrayList<>();
if (!shipmentsDTO.getFiles().isEmpty()) {
var receiptMain = getById(shipmentsDTO.getId());
if (StringUtils.hasLength(receiptMain.getFileId())) {
if (receiptMain != null && StringUtils.hasLength(receiptMain.getFileId())) {
var ids = Arrays.stream(receiptMain.getFileId().split(","))
.map(Long::parseLong)
.collect(Collectors.toList());
Expand Down Expand Up @@ -758,8 +758,8 @@ public Response<String> addOrUpdateSaleShipments(SaleShipmentsDTO shipmentsDTO)

var receiptSaleShipmentMain = ReceiptSaleMain.builder()
.id(id)
.type(ReceiptConstants.RECEIPT_TYPE_ORDER)
.subType(ReceiptConstants.RECEIPT_SUB_TYPE_SALES_ORDER)
.type(ReceiptConstants.RECEIPT_TYPE_SHIPMENT)
.subType(ReceiptConstants.RECEIPT_SUB_TYPE_SALES_SHIPMENTS)
.initReceiptNumber(shipmentsDTO.getReceiptNumber())
.receiptNumber(shipmentsDTO.getReceiptNumber())
.receiptDate(TimeUtil.parse(shipmentsDTO.getReceiptDate()))
Expand Down
49 changes: 42 additions & 7 deletions web/src/views/sales/model/addEditModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,40 @@ export interface RowVO {
taxTotalPrice: number,
remark: string,
}

interface FormState {
interface SaleOrderFormState {
id: number | string | undefined;
customerId: string;
receiptNumber: string;
otherReceipt: string;
discountRate: number;
discountAmount: number;
discountLastAmount: number | string;
deposit: number;
remark: string;
operatorIds: number[] | undefined;
receiptDate: string | undefined | Dayjs;
warehouseId: number | string;
accountId: string | undefined;
multipleAccountIds: number[] | undefined;
multipleAccountAmounts: number[] | undefined;
}

interface SaleShipmentsFormState {
id: number | string | undefined;
customerId: string;
accountId: number | string | undefined;
receiptNumber: string;
receiptDate: string | undefined | Dayjs;
otherReceipt: string;
collectOfferRate: number;
collectOfferAmount: number;
collectOfferLastAmount: number | string;
otherAmount: number;
thisCollectAmount: number;
thisArrearsAmount: number;
remark: string;
status: number | undefined;
operatorIds: number[] | undefined;
receiptDate: string | undefined | Dayjs;
warehouseId: number | string;
accountId: string | undefined;
multipleAccountIds: number[] | undefined;
multipleAccountAmounts: number[] | undefined;
}
Expand Down Expand Up @@ -220,19 +236,37 @@ const sumNum = (list: RowVO[], field: string) => {
}

const getTaxTotalPrice = ref('');
const formState = reactive<FormState>({

const formState = reactive<SaleOrderFormState>({
id: undefined,
customerId: '',
receiptNumber: '',
otherReceipt: '',
remark: '',
discountRate: 0,
discountAmount: 0,
discountLastAmount: 0,
deposit: 0,
accountId: undefined,
operatorIds: undefined,
receiptDate: '',
warehouseId: '',
multipleAccountIds: undefined,
multipleAccountAmounts: undefined,
});

const saleShipmentsFormState = reactive<SaleShipmentsFormState>({
id: undefined,
customerId: '',
receiptNumber: '',
otherReceipt: '',
remark: '',
collectOfferRate: 0,
collectOfferAmount: 0,
collectOfferLastAmount: 0,
otherAmount: 0,
thisCollectAmount: 0,
thisArrearsAmount: 0,
status: undefined,
accountId: undefined,
operatorIds: undefined,
receiptDate: '',
Expand All @@ -247,5 +281,6 @@ export {
tableData,
gridOptions,
formState,
saleShipmentsFormState,
getTaxTotalPrice,
}
Loading
Loading