Commit 1c55d8f9 by 杨浩

销售退货单;

app个人信息
parent 46cd642f
......@@ -593,7 +593,7 @@ public class CommonUtil {
/**
* 金额单位装换 元 -->> 分
*
* @param money 金额(单位:
* @param money 金额(单位:
* @return Long 金额(单位:分)
*/
public static Long moneyUnitConversion(String money) {
......
......@@ -155,6 +155,6 @@ public class SupplierAddReqVO {
/**
* 资质证明材料
*/
private List<ErpSupplierFiles> files;
private String files;
}
......@@ -42,13 +42,13 @@ public class ErpFinancePaymentRespVO {
@Schema(description = "付款账户名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
private String accountName;
@Schema(description = "合计价格,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "13832")
@Schema(description = "合计价格,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "13832")
private BigDecimal totalPrice;
@Schema(description = "优惠金额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "11600")
@Schema(description = "优惠金额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "11600")
private BigDecimal discountPrice;
@Schema(description = "实际价格,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "10000")
@Schema(description = "实际价格,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "10000")
private BigDecimal paymentPrice;
@Schema(description = "备注", example = "你猜")
......
......@@ -32,7 +32,7 @@ public class ErpFinancePaymentSaveReqVO {
@NotNull(message = "付款账户编号不能为空")
private Long accountId;
@Schema(description = "优惠金额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "11600")
@Schema(description = "优惠金额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "11600")
@NotNull(message = "优惠金额不能为空")
private BigDecimal discountPrice;
......
......@@ -42,13 +42,13 @@ public class ErpFinanceReceiptRespVO {
@Schema(description = "收款账户名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
private String accountName;
@Schema(description = "合计价格,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "13832")
@Schema(description = "合计价格,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "13832")
private BigDecimal totalPrice;
@Schema(description = "优惠金额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "11600")
@Schema(description = "优惠金额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "11600")
private BigDecimal discountPrice;
@Schema(description = "实际价格,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "10000")
@Schema(description = "实际价格,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "10000")
private BigDecimal receiptPrice;
@Schema(description = "备注", example = "你猜")
......
......@@ -32,7 +32,7 @@ public class ErpFinanceReceiptSaveReqVO {
@NotNull(message = "收款账户编号不能为空")
private Long accountId;
@Schema(description = "优惠金额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "11600")
@Schema(description = "优惠金额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "11600")
@NotNull(message = "优惠金额不能为空")
private BigDecimal discountPrice;
......
......@@ -57,16 +57,16 @@ public class ErpProductRespVO {
@ExcelProperty("基础重量(kg)")
private BigDecimal weight;
@Schema(description = "采购价格,单位:", example = "10.30")
@ExcelProperty("采购价格,单位:")
@Schema(description = "采购价格,单位:", example = "10.30")
@ExcelProperty("采购价格,单位:")
private BigDecimal purchasePrice;
@Schema(description = "销售价格,单位:", example = "74.32")
@ExcelProperty("销售价格,单位:")
@Schema(description = "销售价格,单位:", example = "74.32")
@ExcelProperty("销售价格,单位:")
private BigDecimal salePrice;
@Schema(description = "最低价格,单位:", example = "161.87")
@ExcelProperty("最低价格,单位:")
@Schema(description = "最低价格,单位:", example = "161.87")
@ExcelProperty("最低价格,单位:")
private BigDecimal minPrice;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
......
......@@ -46,13 +46,13 @@ public class ProductSaveReqVO {
@Schema(description = "基础重量(kg)", example = "1.00")
private BigDecimal weight;
@Schema(description = "采购价格,单位:", example = "10.30")
@Schema(description = "采购价格,单位:", example = "10.30")
private BigDecimal purchasePrice;
@Schema(description = "销售价格,单位:", example = "74.32")
@Schema(description = "销售价格,单位:", example = "74.32")
private BigDecimal salePrice;
@Schema(description = "最低价格,单位:", example = "161.87")
@Schema(description = "最低价格,单位:", example = "161.87")
private BigDecimal minPrice;
}
\ No newline at end of file
......@@ -2,6 +2,7 @@ package cn.iocoder.foodnexus.module.erp.controller.admin.purchase;
import cn.hutool.core.collection.CollUtil;
import cn.iocoder.foodnexus.framework.apilog.core.annotation.ApiAccessLog;
import cn.iocoder.foodnexus.framework.common.enums.UserSystemEnum;
import cn.iocoder.foodnexus.framework.common.pojo.CommonResult;
import cn.iocoder.foodnexus.framework.common.pojo.PageParam;
import cn.iocoder.foodnexus.framework.common.pojo.PageResult;
......@@ -21,6 +22,7 @@ import cn.iocoder.foodnexus.module.erp.service.purchase.ErpSupplierService;
import cn.iocoder.foodnexus.module.erp.service.stock.ErpStockService;
import cn.iocoder.foodnexus.module.product.dal.dataobject.spu.ProductSpuDO;
import cn.iocoder.foodnexus.module.product.service.spu.ProductSpuService;
import cn.iocoder.foodnexus.module.system.annotations.AppSystemAuth;
import cn.iocoder.foodnexus.module.system.api.user.AdminUserApi;
import cn.iocoder.foodnexus.module.system.api.user.dto.AdminUserRespDTO;
import io.swagger.v3.oas.annotations.Operation;
......@@ -48,6 +50,7 @@ import static cn.iocoder.foodnexus.framework.common.util.collection.CollectionUt
@RestController
@RequestMapping("/erp/purchase-order")
@Validated
@AppSystemAuth(UserSystemEnum.SUPPLIER)
public class ErpPurchaseOrderController {
@Resource
......@@ -62,7 +65,7 @@ public class ErpPurchaseOrderController {
@Resource
private AdminUserApi adminUserApi;
@PostMapping("/create")
/*@PostMapping("/create")
@Operation(summary = "创建采购订单")
@PreAuthorize("@ss.hasPermission('erp:purchase-order:create')")
public CommonResult<Long> createPurchaseOrder(@Valid @RequestBody ErpPurchaseOrderSaveReqVO createReqVO) {
......@@ -93,7 +96,7 @@ public class ErpPurchaseOrderController {
public CommonResult<Boolean> deletePurchaseOrder(@RequestParam("ids") List<Long> ids) {
purchaseOrderService.deletePurchaseOrder(ids);
return success(true);
}
}*/
@GetMapping("/get")
@Operation(summary = "获得采购订单")
......
......@@ -52,19 +52,19 @@ public class ErpPurchaseInRespVO {
@Schema(description = "最终合计价格", requiredMode = Schema.RequiredMode.REQUIRED, example = "24906")
@ExcelProperty("最终合计价格")
private BigDecimal totalPrice;
@Schema(description = "已付款金额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
@Schema(description = "已付款金额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
private BigDecimal paymentPrice;
@Schema(description = "合计产品价格,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
@Schema(description = "合计产品价格,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
private BigDecimal totalProductPrice;
@Schema(description = "合计税额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
@Schema(description = "合计税额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
private BigDecimal totalTaxPrice;
@Schema(description = "优惠率,百分比", requiredMode = Schema.RequiredMode.REQUIRED, example = "99.88")
private BigDecimal discountPercent;
@Schema(description = "优惠金额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
@Schema(description = "优惠金额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
private BigDecimal discountPrice;
@Schema(description = "定金金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
......@@ -122,7 +122,7 @@ public class ErpPurchaseInRespVO {
@Schema(description = "税率,百分比", example = "99.88")
private BigDecimal taxPercent;
@Schema(description = "税额,单位:", example = "100.00")
@Schema(description = "税额,单位:", example = "100.00")
private BigDecimal taxPrice;
@Schema(description = "备注", example = "随便")
......
......@@ -29,7 +29,7 @@ public class ErpPurchaseInSaveReqVO {
@Schema(description = "优惠率,百分比", requiredMode = Schema.RequiredMode.REQUIRED, example = "99.88")
private BigDecimal discountPercent;
@Schema(description = "其它金额,单位:", example = "7127")
@Schema(description = "其它金额,单位:", example = "7127")
private BigDecimal otherPrice;
@Schema(description = "附件地址", example = "https://www.iocoder.cn")
......
......@@ -49,16 +49,16 @@ public class ErpPurchaseOrderRespVO {
@ExcelProperty("最终合计价格")
private BigDecimal totalPrice;
@Schema(description = "合计产品价格,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
@Schema(description = "合计产品价格,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
private BigDecimal totalProductPrice;
@Schema(description = "合计税额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
@Schema(description = "合计税额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
private BigDecimal totalTaxPrice;
@Schema(description = "优惠率,百分比", requiredMode = Schema.RequiredMode.REQUIRED, example = "99.88")
private BigDecimal discountPercent;
@Schema(description = "优惠金额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
@Schema(description = "优惠金额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
private BigDecimal discountPrice;
@Schema(description = "定金金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
......@@ -131,7 +131,7 @@ public class ErpPurchaseOrderRespVO {
@Schema(description = "税率,百分比", example = "99.88")
private BigDecimal taxPercent;
@Schema(description = "税额,单位:", example = "100.00")
@Schema(description = "税额,单位:", example = "100.00")
private BigDecimal taxPrice;
@Schema(description = "备注", example = "随便")
......
......@@ -52,19 +52,19 @@ public class ErpPurchaseReturnRespVO {
@Schema(description = "最终合计价格", requiredMode = Schema.RequiredMode.REQUIRED, example = "24906")
@ExcelProperty("最终合计价格")
private BigDecimal totalPrice;
@Schema(description = "已退款金额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
@Schema(description = "已退款金额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
private BigDecimal refundPrice;
@Schema(description = "合计产品价格,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
@Schema(description = "合计产品价格,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
private BigDecimal totalProductPrice;
@Schema(description = "合计税额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
@Schema(description = "合计税额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
private BigDecimal totalTaxPrice;
@Schema(description = "优惠率,百分比", requiredMode = Schema.RequiredMode.REQUIRED, example = "99.88")
private BigDecimal discountPercent;
@Schema(description = "优惠金额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
@Schema(description = "优惠金额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
private BigDecimal discountPrice;
@Schema(description = "定金金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
......@@ -122,7 +122,7 @@ public class ErpPurchaseReturnRespVO {
@Schema(description = "税率,百分比", example = "99.88")
private BigDecimal taxPercent;
@Schema(description = "税额,单位:", example = "100.00")
@Schema(description = "税额,单位:", example = "100.00")
private BigDecimal taxPrice;
@Schema(description = "备注", example = "随便")
......
......@@ -29,7 +29,7 @@ public class ErpPurchaseReturnSaveReqVO {
@Schema(description = "优惠率,百分比", requiredMode = Schema.RequiredMode.REQUIRED, example = "99.88")
private BigDecimal discountPercent;
@Schema(description = "其它金额,单位:", example = "7127")
@Schema(description = "其它金额,单位:", example = "7127")
private BigDecimal otherPrice;
@Schema(description = "附件地址", example = "https://www.iocoder.cn")
......
......@@ -117,7 +117,7 @@ public class ErpSupplierRespVO {
private String nonStapleSupplyCapacity;
@Schema(description = "资质证明材料")
private List<ErpSupplierFiles> files;
private String files;
@Schema(description = "审核状态")
private String auditStatus;
......
......@@ -104,7 +104,7 @@ public class ErpSupplierSaveReqVO {
private String nonStapleSupplyCapacity;
@Schema(description = "资质证明材料")
private List<ErpSupplierFiles> files;
private String files;
@Schema(description = "关联系统部门id")
private Long systemDeptId;
......
......@@ -56,19 +56,19 @@ public class ErpSaleOrderRespVO {
@ExcelProperty("最终合计价格")
private Integer totalPrice;
@Schema(description = "合计产品价格,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
@Schema(description = "合计产品价格,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
private BigDecimal totalProductPrice;
@Schema(description = "合计税额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
@Schema(description = "合计税额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
private BigDecimal totalTaxPrice;
@Schema(description = "优惠率,百分比", requiredMode = Schema.RequiredMode.REQUIRED, example = "99.88")
private BigDecimal discountPercent;
@Schema(description = "优惠金额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
@Schema(description = "优惠金额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
private BigDecimal discountPrice;
@Schema(description = "定金金额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
@Schema(description = "定金金额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
private Integer depositPrice;
@Schema(description = "附件地址", example = "https://www.iocoder.cn")
......@@ -149,7 +149,7 @@ public class ErpSaleOrderRespVO {
@Schema(description = "税率,百分比", example = "99.88")
private BigDecimal taxPercent;
@Schema(description = "税额,单位:", example = "100.00")
@Schema(description = "税额,单位:", example = "100.00")
private BigDecimal taxPrice;
@Schema(description = "备注", example = "随便")
......
......@@ -37,7 +37,7 @@ public class ErpSaleOrderSaveReqVO {
@Schema(description = "优惠率,百分比", requiredMode = Schema.RequiredMode.REQUIRED, example = "99.88")
private BigDecimal discountPercent;
@Schema(description = "定金金额,单位:", example = "7127")
@Schema(description = "定金金额,单位:", example = "7127")
private Integer depositPrice;
@Schema(description = "附件地址", example = "https://www.iocoder.cn")
......@@ -75,6 +75,9 @@ public class ErpSaleOrderSaveReqVO {
@Schema(description = "订单项编号", example = "11756")
private Long id;
@Schema(description = "客户订单子项id")
private Long customerOrderItemId;
@Schema(description = "产品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
@NotNull(message = "产品编号不能为空")
private Long productId;
......@@ -96,9 +99,6 @@ public class ErpSaleOrderSaveReqVO {
@Schema(description = "备注", example = "随便")
private String remark;
@Schema(description = "采购订单id")
private Long purchaseOrderId;
@Schema(description = "供应商id")
private Long supplierId;
......
......@@ -59,22 +59,22 @@ public class ErpSaleOutRespVO {
@Schema(description = "最终合计价格", requiredMode = Schema.RequiredMode.REQUIRED, example = "24906")
@ExcelProperty("最终合计价格")
private Integer totalPrice;
@Schema(description = "已收款金额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
@Schema(description = "已收款金额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
private BigDecimal receiptPrice;
@Schema(description = "合计产品价格,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
@Schema(description = "合计产品价格,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
private BigDecimal totalProductPrice;
@Schema(description = "合计税额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
@Schema(description = "合计税额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
private BigDecimal totalTaxPrice;
@Schema(description = "优惠率,百分比", requiredMode = Schema.RequiredMode.REQUIRED, example = "99.88")
private BigDecimal discountPercent;
@Schema(description = "优惠金额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
@Schema(description = "优惠金额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
private BigDecimal discountPrice;
@Schema(description = "其它金额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
@Schema(description = "其它金额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
private BigDecimal otherPrice;
@Schema(description = "附件地址", example = "https://www.iocoder.cn")
......@@ -148,7 +148,7 @@ public class ErpSaleOutRespVO {
@Schema(description = "税率,百分比", example = "99.88")
private BigDecimal taxPercent;
@Schema(description = "税额,单位:", example = "100.00")
@Schema(description = "税额,单位:", example = "100.00")
private BigDecimal taxPrice;
@Schema(description = "备注", example = "随便")
......
......@@ -36,7 +36,7 @@ public class ErpSaleOutSaveReqVO {
@Schema(description = "优惠率,百分比", requiredMode = Schema.RequiredMode.REQUIRED, example = "99.88")
private BigDecimal discountPercent;
@Schema(description = "其它金额,单位:", example = "7127")
@Schema(description = "其它金额,单位:", example = "7127")
private BigDecimal otherPrice;
@Schema(description = "附件地址", example = "https://www.iocoder.cn")
......
......@@ -51,31 +51,31 @@ public class ErpSaleReturnRespVO {
@Schema(description = "合计数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "15663")
@ExcelProperty("合计数量")
private BigDecimal totalCount;
private Integer totalCount;
@Schema(description = "最终合计价格", requiredMode = Schema.RequiredMode.REQUIRED, example = "24906")
@ExcelProperty("最终合计价格")
private BigDecimal totalPrice;
@Schema(description = "已退款金额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
private Integer totalPrice;
@Schema(description = "已退款金额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
private BigDecimal refundPrice;
@Schema(description = "合计产品价格,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
private BigDecimal totalProductPrice;
@Schema(description = "合计产品价格,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
private Integer totalProductPrice;
@Schema(description = "合计税额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
@Schema(description = "合计税额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
private BigDecimal totalTaxPrice;
@Schema(description = "优惠率,百分比", requiredMode = Schema.RequiredMode.REQUIRED, example = "99.88")
private BigDecimal discountPercent;
@Schema(description = "优惠金额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
@Schema(description = "优惠金额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
private BigDecimal discountPrice;
@Schema(description = "其它金额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
@Schema(description = "其它金额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
private BigDecimal otherPrice;
@Schema(description = "附件地址", example = "https://www.iocoder.cn")
@ExcelProperty("附件地址")
private String fileUrl;
private List<String> filesUrl;
@Schema(description = "备注", example = "你猜")
@ExcelProperty("备注")
......@@ -113,19 +113,19 @@ public class ErpSaleReturnRespVO {
private Long productId;
@Schema(description = "产品单位单位", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
private Long productUnitId;
private String productUnit;
@Schema(description = "产品单价", example = "100.00")
private BigDecimal productPrice;
private Integer productPrice;
@Schema(description = "产品数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
@NotNull(message = "产品数量不能为空")
private BigDecimal count;
private Integer count;
@Schema(description = "税率,百分比", example = "99.88")
private BigDecimal taxPercent;
@Schema(description = "税额,单位:", example = "100.00")
@Schema(description = "税额,单位:", example = "100.00")
private BigDecimal taxPrice;
@Schema(description = "备注", example = "随便")
......
......@@ -21,6 +21,9 @@ public class ErpSaleReturnSaveReqVO {
@Schema(description = "销售员编号", example = "1888")
private Long saleUserId;
@Schema(description = "客户id")
private Long customerId;
@Schema(description = "退货时间", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "退货时间不能为空")
private LocalDateTime returnTime;
......@@ -29,14 +32,17 @@ public class ErpSaleReturnSaveReqVO {
@NotNull(message = "销售订单编号不能为空")
private Long orderId;
@Schema(description = "客户订单")
private Long customerOrderId;
@Schema(description = "优惠率,百分比", requiredMode = Schema.RequiredMode.REQUIRED, example = "99.88")
private BigDecimal discountPercent;
@Schema(description = "其它金额,单位:", example = "7127")
@Schema(description = "其它金额,单位:", example = "7127")
private BigDecimal otherPrice;
@Schema(description = "附件地址", example = "https://www.iocoder.cn")
private String fileUrl;
private List<String> filesUrl;
@Schema(description = "备注", example = "你猜")
private String remark;
......@@ -53,6 +59,9 @@ public class ErpSaleReturnSaveReqVO {
@Schema(description = "销售订单项编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11756")
@NotNull(message = "销售订单项编号不能为空")
private Long orderItemId;
@Schema(description = "客户订单子项id")
private Long customerOrderItemId;
@Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
@NotNull(message = "仓库编号不能为空")
......@@ -64,14 +73,14 @@ public class ErpSaleReturnSaveReqVO {
@Schema(description = "产品单位单位", requiredMode = Schema.RequiredMode.REQUIRED, example = "3113")
@NotNull(message = "产品单位单位不能为空")
private Long productUnitId;
private String productUnit;
@Schema(description = "产品单价", example = "100.00")
private BigDecimal productPrice;
private Integer productPrice;
@Schema(description = "产品数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
@NotNull(message = "产品数量不能为空")
private BigDecimal count;
private Integer count;
@Schema(description = "税率,百分比", example = "99.88")
private BigDecimal taxPercent;
......@@ -79,6 +88,9 @@ public class ErpSaleReturnSaveReqVO {
@Schema(description = "备注", example = "随便")
private String remark;
@Schema(description = "供应商id")
private Long supplierId;
}
}
\ No newline at end of file
......@@ -35,7 +35,7 @@ public class ErpStockCheckRespVO {
@ExcelProperty("合计数量")
private BigDecimal totalCount;
@Schema(description = "合计金额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "24906")
@Schema(description = "合计金额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "24906")
@ExcelProperty("合计金额")
private BigDecimal totalPrice;
......
......@@ -40,7 +40,7 @@ public class ErpStockInRespVO {
@ExcelProperty("合计数量")
private BigDecimal totalCount;
@Schema(description = "合计金额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "24906")
@Schema(description = "合计金额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "24906")
@ExcelProperty("合计金额")
private BigDecimal totalPrice;
......
......@@ -34,7 +34,7 @@ public class ErpStockMoveRespVO {
@ExcelProperty("合计数量")
private BigDecimal totalCount;
@Schema(description = "合计金额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "24906")
@Schema(description = "合计金额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "24906")
@ExcelProperty("合计金额")
private BigDecimal totalPrice;
......
......@@ -40,7 +40,7 @@ public class ErpStockOutRespVO {
@ExcelProperty("合计数量")
private BigDecimal totalCount;
@Schema(description = "合计金额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "24906")
@Schema(description = "合计金额,单位:", requiredMode = Schema.RequiredMode.REQUIRED, example = "24906")
@ExcelProperty("合计金额")
private BigDecimal totalPrice;
......
......@@ -47,12 +47,12 @@ public class ErpWarehouseRespVO {
@Schema(description = "联系电话", example = "18818288888")
private String telephone;
@Schema(description = "仓储费,单位:", example = "13973")
@ExcelProperty("仓储费,单位:")
@Schema(description = "仓储费,单位:", example = "13973")
@ExcelProperty("仓储费,单位:")
private BigDecimal warehousePrice;
@Schema(description = "搬运费,单位:", example = "9903")
@ExcelProperty("搬运费,单位:")
@Schema(description = "搬运费,单位:", example = "9903")
@ExcelProperty("搬运费,单位:")
private BigDecimal truckagePrice;
@Schema(description = "开启状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
......
......@@ -38,10 +38,10 @@ public class ErpWarehouseSaveReqVO {
@Schema(description = "联系电话", example = "18818288888")
private String telephone;
@Schema(description = "仓储费,单位:", example = "13973")
@Schema(description = "仓储费,单位:", example = "13973")
private BigDecimal warehousePrice;
@Schema(description = "搬运费,单位:", example = "9903")
@Schema(description = "搬运费,单位:", example = "9903")
private BigDecimal truckagePrice;
@Schema(description = "开启状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
......
......@@ -65,11 +65,11 @@ public class ErpFinancePaymentDO extends BaseDO {
private Long accountId;
/**
* 合计价格,单位:
* 合计价格,单位:
*/
private BigDecimal totalPrice;
/**
* 优惠金额,单位:
* 优惠金额,单位:
*/
private BigDecimal discountPrice;
/**
......
......@@ -65,11 +65,11 @@ public class ErpFinanceReceiptDO extends BaseDO {
private Long accountId;
/**
* 合计价格,单位:
* 合计价格,单位:
*/
private BigDecimal totalPrice;
/**
* 优惠金额,单位:
* 优惠金额,单位:
*/
private BigDecimal discountPrice;
/**
......
......@@ -72,15 +72,15 @@ public class ErpProductDO extends BaseDO {
*/
private BigDecimal weight;
/**
* 采购价格,单位:
* 采购价格,单位:
*/
private BigDecimal purchasePrice;
/**
* 销售价格,单位:
* 销售价格,单位:
*/
private BigDecimal salePrice;
/**
* 最低价格,单位:
* 最低价格,单位:
*/
private BigDecimal minPrice;
......
......@@ -76,24 +76,24 @@ public class ErpPurchaseInDO extends BaseDO {
*/
private Integer totalCount;
/**
* 最终合计价格,单位:
* 最终合计价格,单位:
*
* totalPrice = totalProductPrice + totalTaxPrice - discountPrice + otherPrice
*/
private Integer totalPrice;
/**
* 已支付金额,单位:
* 已支付金额,单位:
*
* 目的:和 {@link cn.iocoder.foodnexus.module.erp.dal.dataobject.finance.ErpFinancePaymentDO} 结合,记录已支付金额
*/
private BigDecimal paymentPrice;
/**
* 合计产品价格,单位:
* 合计产品价格,单位:
*/
private Integer totalProductPrice;
/**
* 合计税额,单位:
* 合计税额,单位:
*/
private BigDecimal totalTaxPrice;
/**
......@@ -101,13 +101,13 @@ public class ErpPurchaseInDO extends BaseDO {
*/
private BigDecimal discountPercent;
/**
* 优惠金额,单位:
* 优惠金额,单位:
*
* discountPrice = (totalProductPrice + totalTaxPrice) * discountPercent
*/
private BigDecimal discountPrice;
/**
* 其它金额,单位:
* 其它金额,单位:
*/
private BigDecimal otherPrice;
......
......@@ -63,7 +63,7 @@ public class ErpPurchaseInItemDO extends BaseDO {
private String productUnit;
/**
* 产品单位单价,单位:
* 产品单位单价,单位:
*/
private Integer productPrice;
/**
......@@ -71,7 +71,7 @@ public class ErpPurchaseInItemDO extends BaseDO {
*/
private Integer count;
/**
* 总价,单位:
* 总价,单位:
*
* totalPrice = productPrice * count
*/
......@@ -81,7 +81,7 @@ public class ErpPurchaseInItemDO extends BaseDO {
*/
private BigDecimal taxPercent;
/**
* 税额,单位:
* 税额,单位:
*
* taxPrice = totalPrice * taxPercent
*/
......
......@@ -56,7 +56,7 @@ public class ErpPurchaseOrderItemDO extends BaseDO {
*/
private Integer count;
/**
* 总价,单位:
* 总价,单位:
*
* totalPrice = productPrice * count
*/
......
......@@ -76,24 +76,24 @@ public class ErpPurchaseReturnDO extends BaseDO {
*/
private BigDecimal totalCount;
/**
* 最终合计价格,单位:
* 最终合计价格,单位:
*
* totalPrice = totalProductPrice + totalTaxPrice - discountPrice + otherPrice
*/
private BigDecimal totalPrice;
/**
* 已退款金额,单位:
* 已退款金额,单位:
*
* 目的:和 {@link cn.iocoder.foodnexus.module.erp.dal.dataobject.finance.ErpFinancePaymentDO} 结合,记录已支付金额
*/
private BigDecimal refundPrice;
/**
* 合计产品价格,单位:
* 合计产品价格,单位:
*/
private BigDecimal totalProductPrice;
/**
* 合计税额,单位:
* 合计税额,单位:
*/
private BigDecimal totalTaxPrice;
/**
......@@ -101,13 +101,13 @@ public class ErpPurchaseReturnDO extends BaseDO {
*/
private BigDecimal discountPercent;
/**
* 优惠金额,单位:
* 优惠金额,单位:
*
* discountPrice = (totalProductPrice + totalTaxPrice) * discountPercent
*/
private BigDecimal discountPrice;
/**
* 其它金额,单位:
* 其它金额,单位:
*/
private BigDecimal otherPrice;
......
......@@ -63,7 +63,7 @@ public class ErpPurchaseReturnItemDO extends BaseDO {
private Long productUnitId;
/**
* 产品单位单价,单位:
* 产品单位单价,单位:
*/
private BigDecimal productPrice;
/**
......@@ -71,7 +71,7 @@ public class ErpPurchaseReturnItemDO extends BaseDO {
*/
private BigDecimal count;
/**
* 总价,单位:
* 总价,单位:
*
* totalPrice = productPrice * count
*/
......@@ -81,7 +81,7 @@ public class ErpPurchaseReturnItemDO extends BaseDO {
*/
private BigDecimal taxPercent;
/**
* 税额,单位:
* 税额,单位:
*
* taxPrice = totalPrice * taxPercent
*/
......
......@@ -150,8 +150,7 @@ public class ErpSupplierDO extends BaseDO {
/**
* 资质证明材料
*/
@TableField(typeHandler = ErpSupplierFilesTypeHandler.class)
private List<ErpSupplierFiles> files;
private String files;
/**
* 审核状态
......
......@@ -74,18 +74,18 @@ public class ErpSaleOrderDO extends BaseDO {
*/
private Integer totalCount;
/**
* 最终合计价格,单位:
* 最终合计价格,单位:
*
* totalPrice = totalProductPrice + totalTaxPrice - discountPrice
*/
private Integer totalPrice;
/**
* 合计产品价格,单位:
* 合计产品价格,单位:
*/
private Integer totalProductPrice;
/**
* 合计税额,单位:
* 合计税额,单位:
*/
private BigDecimal totalTaxPrice;
/**
......@@ -93,13 +93,13 @@ public class ErpSaleOrderDO extends BaseDO {
*/
private BigDecimal discountPercent;
/**
* 优惠金额,单位:
* 优惠金额,单位:
*
* discountPrice = (totalProductPrice + totalTaxPrice) * discountPercent
*/
private BigDecimal discountPrice;
/**
* 定金金额,单位:
* 定金金额,单位:
*/
private Integer depositPrice;
......
......@@ -7,6 +7,7 @@ import cn.iocoder.foodnexus.module.product.dal.dataobject.spu.ProductSpuDO;
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.math.BigDecimal;
......@@ -38,6 +39,11 @@ public class ErpSaleOrderItemDO extends BaseDO {
*/
private Long orderId;
/**
* 客户订单子项id
* @link // CustomerOrderItemDO#getId()
*/
private Long customerOrderItemId;
/**
* 产品编号
*
* 关联 {@link ProductSpuDO#getId()}
......@@ -50,7 +56,7 @@ public class ErpSaleOrderItemDO extends BaseDO {
private String productUnit;
/**
* 产品单位单价,单位:
* 产品单位单价,单位:
*/
private Integer productPrice;
/**
......@@ -58,7 +64,7 @@ public class ErpSaleOrderItemDO extends BaseDO {
*/
private Integer count;
/**
* 总价,单位:
* 总价,单位:
*
* totalPrice = productPrice * count
*/
......@@ -68,7 +74,7 @@ public class ErpSaleOrderItemDO extends BaseDO {
*/
private BigDecimal taxPercent;
/**
* 税额,单位:
* 税额,单位:
*
* taxPrice = totalPrice * taxPercent
*/
......@@ -92,11 +98,6 @@ public class ErpSaleOrderItemDO extends BaseDO {
private BigDecimal returnCount;
/**
* 采购订单id
*/
private Long purchaseOrderId;
/**
* 供应商id
*/
private Long supplierId;
......
......@@ -86,24 +86,24 @@ public class ErpSaleOutDO extends BaseDO {
*/
private Integer totalCount;
/**
* 最终合计价格,单位:
* 最终合计价格,单位:
*
* totalPrice = totalProductPrice + totalTaxPrice - discountPrice + otherPrice
*/
private Integer totalPrice;
/**
* 已收款金额,单位:
* 已收款金额,单位:
*
* 目的:和 {@link cn.iocoder.foodnexus.module.erp.dal.dataobject.finance.ErpFinanceReceiptDO} 结合,记录已收款金额
*/
private BigDecimal receiptPrice;
/**
* 合计产品价格,单位:
* 合计产品价格,单位:
*/
private Integer totalProductPrice;
/**
* 合计税额,单位:
* 合计税额,单位:
*/
private BigDecimal totalTaxPrice;
/**
......@@ -111,13 +111,13 @@ public class ErpSaleOutDO extends BaseDO {
*/
private BigDecimal discountPercent;
/**
* 优惠金额,单位:
* 优惠金额,单位:
*
* discountPrice = (totalProductPrice + totalTaxPrice) * discountPercent
*/
private BigDecimal discountPrice;
/**
* 其它金额,单位:
* 其它金额,单位:
*/
private BigDecimal otherPrice;
......
......@@ -83,7 +83,7 @@ public class ErpSaleOutItemDO extends BaseDO {
*/
private BigDecimal taxPercent;
/**
* 税额,单位:
* 税额,单位:
*
* taxPrice = totalPrice * taxPercent
*/
......
......@@ -4,19 +4,22 @@ import cn.iocoder.foodnexus.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.foodnexus.module.erp.api.enums.ErpAuditStatus;
import cn.iocoder.foodnexus.module.erp.dal.dataobject.finance.ErpAccountDO;
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import lombok.*;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
/**
* ERP 销售退货 DO
*
* @author 芋道源码
*/
@TableName(value = "erp_sale_return")
@TableName(value = "erp_sale_return", autoResultMap = true)
@KeySequence("erp_sale_return_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
......@@ -71,6 +74,12 @@ public class ErpSaleReturnDO extends BaseDO {
*/
private Long orderId;
/**
* 客户订单id
*
* 关联 {@link // CustomerOrderDO#getId()}
*/
private Long customerOrderId;
/**
* 销售订单号
*
* 冗余 {@link ErpSaleOrderDO#getNo()}
......@@ -80,26 +89,26 @@ public class ErpSaleReturnDO extends BaseDO {
/**
* 合计数量
*/
private BigDecimal totalCount;
private Integer totalCount;
/**
* 最终合计价格,单位:
* 最终合计价格,单位:
*
* totalPrice = totalProductPrice + totalTaxPrice - discountPrice + otherPrice
*/
private BigDecimal totalPrice;
private Integer totalPrice;
/**
* 已退款金额,单位:
* 已退款金额,单位:
*
* 目的:和 {@link cn.iocoder.foodnexus.module.erp.dal.dataobject.finance.ErpFinanceReceiptDO} 结合,记录已退款金额
*/
private BigDecimal refundPrice;
/**
* 合计产品价格,单位:
* 合计产品价格,单位:
*/
private BigDecimal totalProductPrice;
private Integer totalProductPrice;
/**
* 合计税额,单位:
* 合计税额,单位:
*/
private BigDecimal totalTaxPrice;
/**
......@@ -107,20 +116,21 @@ public class ErpSaleReturnDO extends BaseDO {
*/
private BigDecimal discountPercent;
/**
* 优惠金额,单位:
* 优惠金额,单位:
*
* discountPrice = (totalProductPrice + totalTaxPrice) * discountPercent
*/
private BigDecimal discountPrice;
/**
* 其它金额,单位:
* 其它金额,单位:
*/
private BigDecimal otherPrice;
/**
* 附件地址
*/
private String fileUrl;
@TableField(typeHandler = JacksonTypeHandler.class)
private List<String> filesUrl;
/**
* 备注
*/
......
......@@ -44,6 +44,10 @@ public class ErpSaleReturnItemDO extends BaseDO {
*/
private Long orderItemId;
/**
* 客户订单子项id
*/
private Long customerOrderItemId;
/**
* 仓库编号
*
* 关联 {@link ErpWarehouseDO#getId()}
......@@ -57,31 +61,29 @@ public class ErpSaleReturnItemDO extends BaseDO {
private Long productId;
/**
* 产品单位单位
*
* 冗余 {@link ErpProductDO#getUnitId()}
*/
private Long productUnitId;
private String productUnit;
/**
* 产品单位单价,单位:
* 产品单位单价,单位:
*/
private BigDecimal productPrice;
private Integer productPrice;
/**
* 数量
*/
private BigDecimal count;
private Integer count;
/**
* 总价,单位:
* 总价,单位:
*
* totalPrice = productPrice * count
*/
private BigDecimal totalPrice;
private Integer totalPrice;
/**
* 税率,百分比
*/
private BigDecimal taxPercent;
/**
* 税额,单位:
* 税额,单位:
*
* taxPrice = totalPrice * taxPercent
*/
......@@ -92,4 +94,9 @@ public class ErpSaleReturnItemDO extends BaseDO {
*/
private String remark;
/**
* 供应商
*/
private Long supplierId;
}
\ No newline at end of file
......@@ -43,7 +43,7 @@ public class ErpStockCheckDO extends BaseDO {
*/
private BigDecimal totalCount;
/**
* 合计金额,单位:
* 合计金额,单位:
*/
private BigDecimal totalPrice;
/**
......
......@@ -72,7 +72,7 @@ public class ErpStockCheckItemDO extends BaseDO {
*/
private BigDecimal count;
/**
* 合计金额,单位:
* 合计金额,单位:
*/
private BigDecimal totalPrice;
/**
......
......@@ -50,7 +50,7 @@ public class ErpStockInDO extends BaseDO {
*/
private BigDecimal totalCount;
/**
* 合计金额,单位:
* 合计金额,单位:
*/
private BigDecimal totalPrice;
/**
......
......@@ -62,7 +62,7 @@ public class ErpStockInItemDO extends BaseDO {
*/
private BigDecimal count;
/**
* 合计金额,单位:
* 合计金额,单位:
*/
private BigDecimal totalPrice;
/**
......
......@@ -43,7 +43,7 @@ public class ErpStockMoveDO extends BaseDO {
*/
private BigDecimal totalCount;
/**
* 合计金额,单位:
* 合计金额,单位:
*/
private BigDecimal totalPrice;
/**
......
......@@ -68,7 +68,7 @@ public class ErpStockMoveItemDO extends BaseDO {
*/
private BigDecimal count;
/**
* 合计金额,单位:
* 合计金额,单位:
*/
private BigDecimal totalPrice;
/**
......
......@@ -49,7 +49,7 @@ public class ErpStockOutDO extends BaseDO {
*/
private BigDecimal totalCount;
/**
* 合计金额,单位:
* 合计金额,单位:
*/
private BigDecimal totalPrice;
/**
......
......@@ -62,7 +62,7 @@ public class ErpStockOutItemDO extends BaseDO {
*/
private BigDecimal count;
/**
* 合计金额,单位:
* 合计金额,单位:
*/
private BigDecimal totalPrice;
/**
......
......@@ -57,11 +57,11 @@ public class ErpWarehouseDO extends BaseDO {
*/
private String telephone;
/**
* 仓储费,单位:
* 仓储费,单位:
*/
private BigDecimal warehousePrice;
/**
* 搬运费,单位:
* 搬运费,单位:
*/
private BigDecimal truckagePrice;
/**
......
......@@ -22,6 +22,7 @@ import cn.iocoder.foodnexus.module.erp.api.enums.ErpAuditStatus;
import cn.iocoder.foodnexus.module.erp.enums.ErrorCodeConstants;
import cn.iocoder.foodnexus.module.erp.service.finance.ErpAccountService;
import cn.iocoder.foodnexus.module.erp.service.product.ErpProductService;
import cn.iocoder.foodnexus.module.order.api.CheckTaskApi;
import cn.iocoder.foodnexus.module.order.api.CustomerOrderApi;
import cn.iocoder.foodnexus.module.order.api.CustomerOrderRecordApi;
import cn.iocoder.foodnexus.module.order.dto.CustomerOrderDTO;
......@@ -67,6 +68,9 @@ public class ErpPurchaseOrderServiceImpl implements ErpPurchaseOrderService {
@Autowired
private ErpPurchaseInService purchaseInService;
@Autowired
private CheckTaskApi checkTaskApi;
@Resource
private ErpNoRedisDAO noRedisDAO;
......@@ -373,6 +377,9 @@ public class ErpPurchaseOrderServiceImpl implements ErpPurchaseOrderService {
inSaveReqVO.setItems(CommonUtil.listConvert(purchaseOrderItems, purchaseOrderItem ->
getItem(purchaseOrderItem, customerOrderApi.queryById(purchaseOrderItem.getCustomerOrderId()))));
purchaseInService.createPurchaseIn(inSaveReqVO);
// 新增来料质检
checkTaskApi.createByPurchaseOrderId(purchaseOrder.getId());
});
}
}
......
......@@ -133,4 +133,14 @@ public interface ErpSaleOrderService {
* @param deliveryStaffId
*/
void arrival(DeliveryOrderUpdateReqVO reqVO, Long deliveryStaffId);
/**
* 根据客户订单新建配货单
* @param customerOrderId
*/
void createByCustomerOrderId(Long customerOrderId);
ErpSaleOrderDO queryByCustomerOrderId(Long customerOrderId);
ErpSaleOrderItemDO queryItemByCustomerOrderItemId(Long customerOrderItemId);
}
\ No newline at end of file
......@@ -30,10 +30,7 @@ import cn.iocoder.foodnexus.module.erp.service.purchase.ErpPurchaseOrderService;
import cn.iocoder.foodnexus.module.order.api.CustomerOrderApi;
import cn.iocoder.foodnexus.module.order.api.CustomerOrderRecordApi;
import cn.iocoder.foodnexus.module.order.api.DeliveryStaffApi;
import cn.iocoder.foodnexus.module.order.dto.CustomerOrderDTO;
import cn.iocoder.foodnexus.module.order.dto.CustomerOrderRecordEvent;
import cn.iocoder.foodnexus.module.order.dto.DeliveryOrderUpdateReqVO;
import cn.iocoder.foodnexus.module.order.dto.DeliveryStaffSimpleInfo;
import cn.iocoder.foodnexus.module.order.dto.*;
import cn.iocoder.foodnexus.module.order.enums.CustomerOrderStatus;
import cn.iocoder.foodnexus.module.product.dal.dataobject.spu.ProductSpuDO;
import cn.iocoder.foodnexus.module.product.service.spu.ProductSpuService;
......@@ -41,6 +38,7 @@ import cn.iocoder.foodnexus.module.system.api.user.AdminUserApi;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
......@@ -370,9 +368,6 @@ public class ErpSaleOrderServiceImpl implements ErpSaleOrderService {
.set(ErpSaleOrderItemDO::getPickUpStatus, SaleOrderPickUpStatus.PICK_UP.getType())
.eq(ErpSaleOrderItemDO::getId, itemId));
// 插入采购入库单
Long allCount = saleOrderItemMapper.selectCount(ErpSaleOrderItemDO::getOrderId, saleOrder.getId());
Long pickUpCount = saleOrderItemMapper.selectCount(Wrappers.<ErpSaleOrderItemDO>lambdaQuery()
......@@ -404,9 +399,10 @@ public class ErpSaleOrderServiceImpl implements ErpSaleOrderService {
if (!SaleOrderPickUpStatus.PICK_UP.equals(saleOrder.getPickUpStatus())) {
throw exception(SALE_ORDER_PICKUP_STATUS_FAIL);
}
LocalDateTime deliveryTime = LocalDateTime.now();
saleOrderMapper.update(Wrappers.<ErpSaleOrderDO>lambdaUpdate()
.set(ErpSaleOrderDO::getPickUpStatus, SaleOrderPickUpStatus.ALREADY.getType())
.set(ErpSaleOrderDO::getDeliveryTime, LocalDateTime.now())
.set(ErpSaleOrderDO::getDeliveryTime, deliveryTime)
.set(ErpSaleOrderDO::getDeliveryStaffId, deliveryStaffId)
.eq(ErpSaleOrderDO::getId, saleOrder.getId()));
saleOrderItemMapper.update(Wrappers.<ErpSaleOrderItemDO>lambdaUpdate()
......@@ -418,7 +414,7 @@ public class ErpSaleOrderServiceImpl implements ErpSaleOrderService {
ErpSaleOutSaveReqVO saleOutSaveReqVO = new ErpSaleOutSaveReqVO();
saleOutSaveReqVO.setSaleUserId(saleOrder.getSaleUserId());
saleOutSaveReqVO.setAccountId(saleOrder.getAccountId());
saleOutSaveReqVO.setOutTime(LocalDateTime.now());
saleOutSaveReqVO.setOutTime(deliveryTime);
saleOutSaveReqVO.setOrderId(saleOrder.getId());
saleOutSaveReqVO.setDiscountPercent(saleOrder.getDiscountPercent());
saleOutSaveReqVO.setFileUrl(saleOrder.getFileUrl());
......@@ -426,8 +422,8 @@ public class ErpSaleOrderServiceImpl implements ErpSaleOrderService {
saleOutSaveReqVO.setCustomerOrderId(saleOrder.getCustomerOrderId());
saleOutSaveReqVO.setDeliveryMode(saleOrder.getDeliveryMode());
saleOutSaveReqVO.setDeliveryTime(saleOrder.getDeliveryTime());
saleOutSaveReqVO.setDeliveryStaffId(saleOrder.getDeliveryStaffId());
saleOutSaveReqVO.setDeliveryTime(deliveryTime);
saleOutSaveReqVO.setDeliveryStaffId(deliveryStaffId);
saleOutSaveReqVO.setAddressId(saleOrder.getAddressId());
saleOutSaveReqVO.setAddressInfo(saleOrder.getAddressInfo());
......@@ -501,4 +497,55 @@ public class ErpSaleOrderServiceImpl implements ErpSaleOrderService {
orderRecordApi.recordEvent(event);
}
/**
* 根据客户订单新建配货单
*
* @param customerOrderId
*/
@Override
@Async
@Transactional(rollbackFor = Exception.class)
public void createByCustomerOrderId(Long customerOrderId) {
CustomerOrderDTO order = customerOrderApi.queryById(customerOrderId);
List<CustomerOrderItemDTO> orderItems = customerOrderApi.queryItemsByOrderId(customerOrderId);
if (CommonUtil.isEmpty(order) || CommonUtil.isEmpty(orderItems)) {
return ;
}
ErpSaleOrderDO erpSaleOrderDO = this.queryByCustomerOrderId(customerOrderId);
if (CommonUtil.isNotEmpty(erpSaleOrderDO)) {
return ;
}
ErpSaleOrderSaveReqVO saveReqVO = new ErpSaleOrderSaveReqVO();
saveReqVO.setCustomerId(order.getCustomerId());
saveReqVO.setOrderTime(order.getCreateTime());
saveReqVO.setDepositPrice(order.getOrderAmount());
saveReqVO.setCustomerOrderId(order.getId());
saveReqVO.setDeliveryMode(order.getDeliveryMode());
saveReqVO.setAddressId(order.getAddressId());
saveReqVO.setAddressInfo(order.getAddressInfo());
saveReqVO.setItems(CommonUtil.listConvert(orderItems, orderItem -> {
ErpSaleOrderSaveReqVO.Item item = new ErpSaleOrderSaveReqVO.Item();
item.setCustomerOrderItemId(orderItem.getId());
item.setProductId(orderItem.getProductId());
item.setProductUnit(orderItem.getProductInfo().getUnitName());
item.setProductPrice(orderItem.getOrderItemPrice());
item.setCount(orderItem.getOrderItemQuantity());
item.setSupplierId(orderItem.getSupplierId());
item.setPickUpStatus(SaleOrderPickUpStatus.TO_BE);
return item;
}));
this.createSaleOrder(saveReqVO);
}
@Override
public ErpSaleOrderDO queryByCustomerOrderId(Long customerOrderId) {
return saleOrderMapper.selectOne(ErpSaleOrderDO::getCustomerOrderId, customerOrderId);
}
@Override
public ErpSaleOrderItemDO queryItemByCustomerOrderItemId(Long customerOrderItemId) {
return saleOrderItemMapper.selectOne(ErpSaleOrderItemDO::getCustomerOrderItemId, customerOrderItemId);
}
}
......@@ -20,6 +20,9 @@ import cn.iocoder.foodnexus.module.erp.service.finance.ErpAccountService;
import cn.iocoder.foodnexus.module.erp.service.product.ErpProductService;
import cn.iocoder.foodnexus.module.erp.service.stock.ErpStockRecordService;
import cn.iocoder.foodnexus.module.erp.service.stock.bo.ErpStockRecordCreateReqBO;
import cn.iocoder.foodnexus.module.product.api.ProductSpuApi;
import cn.iocoder.foodnexus.module.product.dal.dataobject.spu.ProductSpuDO;
import cn.iocoder.foodnexus.module.product.service.spu.ProductSpuService;
import cn.iocoder.foodnexus.module.system.api.user.AdminUserApi;
import jakarta.annotation.Resource;
import org.springframework.context.annotation.Lazy;
......@@ -57,7 +60,7 @@ public class ErpSaleReturnServiceImpl implements ErpSaleReturnService {
private ErpNoRedisDAO noRedisDAO;
@Resource
private ErpProductService productService;
private ProductSpuService productService;
@Resource
@Lazy // 延迟加载,避免循环依赖
private ErpSaleOrderService saleOrderService;
......@@ -139,16 +142,16 @@ public class ErpSaleReturnServiceImpl implements ErpSaleReturnService {
}
private void calculateTotalPrice(ErpSaleReturnDO saleReturn, List<ErpSaleReturnItemDO> saleReturnItems) {
saleReturn.setTotalCount(getSumValue(saleReturnItems, ErpSaleReturnItemDO::getCount, BigDecimal::add));
saleReturn.setTotalProductPrice(getSumValue(saleReturnItems, ErpSaleReturnItemDO::getTotalPrice, BigDecimal::add, BigDecimal.ZERO));
saleReturn.setTotalCount(getSumValue(saleReturnItems, ErpSaleReturnItemDO::getCount, Integer::sum));
saleReturn.setTotalProductPrice(getSumValue(saleReturnItems, ErpSaleReturnItemDO::getTotalPrice, Integer::sum, 0));
saleReturn.setTotalTaxPrice(getSumValue(saleReturnItems, ErpSaleReturnItemDO::getTaxPrice, BigDecimal::add, BigDecimal.ZERO));
saleReturn.setTotalPrice(saleReturn.getTotalProductPrice().add(saleReturn.getTotalTaxPrice()));
saleReturn.setTotalPrice(saleReturn.getTotalProductPrice() /*+ (saleReturn.getTotalTaxPrice())*/);
// 计算优惠价格
if (saleReturn.getDiscountPercent() == null) {
saleReturn.setDiscountPercent(BigDecimal.ZERO);
}
saleReturn.setDiscountPrice(MoneyUtils.priceMultiplyPercent(saleReturn.getTotalPrice(), saleReturn.getDiscountPercent()));
saleReturn.setTotalPrice(saleReturn.getTotalPrice().subtract(saleReturn.getDiscountPrice().add(saleReturn.getOtherPrice())));
// saleReturn.setDiscountPrice(MoneyUtils.priceMultiplyPercent(saleReturn.getTotalPrice(), saleReturn.getDiscountPercent()));
saleReturn.setTotalPrice(saleReturn.getTotalPrice()/*.subtract(saleReturn.getDiscountPrice().add(saleReturn.getOtherPrice()))*/);
}
private void updateSaleOrderReturnCount(Long orderId) {
......@@ -188,9 +191,9 @@ public class ErpSaleReturnServiceImpl implements ErpSaleReturnService {
Integer bizType = approve ? ErpStockRecordBizTypeEnum.SALE_RETURN.getType()
: ErpStockRecordBizTypeEnum.SALE_RETURN_CANCEL.getType();
saleReturnItems.forEach(saleReturnItem -> {
BigDecimal count = approve ? saleReturnItem.getCount() : saleReturnItem.getCount().negate();
Integer count = approve ? saleReturnItem.getCount() : - saleReturnItem.getCount();
stockRecordService.createStockRecord(new ErpStockRecordCreateReqBO(
saleReturnItem.getProductId(), saleReturnItem.getWarehouseId(), count,
saleReturnItem.getProductId(), saleReturnItem.getWarehouseId(), BigDecimal.valueOf(count),
bizType, saleReturnItem.getReturnId(), saleReturnItem.getId(), saleReturn.getNo()));
});
}
......@@ -201,7 +204,7 @@ public class ErpSaleReturnServiceImpl implements ErpSaleReturnService {
if (saleReturn.getRefundPrice().equals(refundPrice)) {
return;
}
if (refundPrice.compareTo(saleReturn.getTotalPrice()) > 0) {
if (refundPrice.compareTo(BigDecimal.valueOf(saleReturn.getTotalPrice())) > 0) {
throw exception(SALE_RETURN_FAIL_REFUND_PRICE_EXCEED, refundPrice, saleReturn.getTotalPrice());
}
saleReturnMapper.updateById(new ErpSaleReturnDO().setId(id).setRefundPrice(refundPrice));
......@@ -209,19 +212,19 @@ public class ErpSaleReturnServiceImpl implements ErpSaleReturnService {
private List<ErpSaleReturnItemDO> validateSaleReturnItems(List<ErpSaleReturnSaveReqVO.Item> list) {
// 1. 校验产品存在
List<ErpProductDO> productList = productService.validProductList(
List<ProductSpuDO> productList = productService.getSpuList(
convertSet(list, ErpSaleReturnSaveReqVO.Item::getProductId));
Map<Long, ErpProductDO> productMap = convertMap(productList, ErpProductDO::getId);
Map<Long, ProductSpuDO> productMap = convertMap(productList, ProductSpuDO::getId);
// 2. 转化为 ErpSaleReturnItemDO 列表
return convertList(list, o -> BeanUtils.toBean(o, ErpSaleReturnItemDO.class, item -> {
item.setProductUnitId(productMap.get(item.getProductId()).getUnitId());
item.setTotalPrice(MoneyUtils.priceMultiply(item.getProductPrice(), item.getCount()));
if (item.getTotalPrice() == null) {
item.setProductUnit(productMap.get(item.getProductId()).getUnitName());
item.setTotalPrice((item.getProductPrice() * item.getCount()));
/*if (item.getTotalPrice() == null) {
return;
}
if (item.getTaxPercent() != null) {
}*/
/*if (item.getTaxPercent() != null) {
item.setTaxPrice(MoneyUtils.priceMultiplyPercent(item.getTotalPrice(), item.getTaxPercent()));
}
}*/
}));
}
......
package cn.iocoder.foodnexus.module.order.api;
/**
* @author : yanghao
* create at: 2025/9/30 14:17
* @description:
*/
public interface CheckTaskApi {
void createByPurchaseOrderId(Long purchaseOrderId);
}
package cn.iocoder.foodnexus.module.order.dto;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;
import java.util.List;
/**
* @author : yanghao
* create at: 2025/9/30 10:02
* @description: 客户订单 - 退货
*/
@Data
public class AppCustomerReturnOrderReqVO {
/**
* 客户订单ID
*/
@NotNull(message = "订单id不能为空")
private Long customerOrderId;
/**
* 说明
*/
private String remark;
/**
* 相关文件
*/
private List<String> remarkFiles;
/**
* 退货子项
*/
@NotNull(message = "退货子项不能为空")
@Size(min = 1, message = "退货子项不能为空")
private List<Item> orderItems;
@Data
public static class Item {
/**
* 客户订单子项id
*/
@NotNull(message = "客户订单子项不能为空")
private Long customerOrderItemId;
/**
* 商品id
*/
@NotNull(message = "商品不能为空")
private Long productId;
/**
* 退货数量
*/
@NotNull(message = "退货数量不能为空")
private Integer returnCount;
/**
* 备注
*/
private String remark;
}
}
......@@ -46,6 +46,14 @@ public class CustomerOrderDTO {
*/
private WarehouseInfo warehouseInfo;
/**
* 客户收货地址id
*/
private Long addressId;
/**
* 客户收货地址info
*/
private CustomerAddressInfo addressInfo;
/**
* 配送模式
*
* 枚举 {@link DeliveryMode}
......@@ -87,4 +95,9 @@ public class CustomerOrderDTO {
private String creator;
/**
* 订单备注
*/
private CustomerOrderRemark orderRemark;
}
......@@ -63,5 +63,8 @@ public class CustomerOrderItemDTO {
* 签收总价,单位:分
*/
private Integer signedTotal;
/**
* 订单备注
*/
private CustomerOrderRemark orderRemark;
}
......@@ -91,7 +91,14 @@ public enum CustomerOrderStatus implements ArrayValuable<String> {
CANCEL("取消订单", "CANCEL", 9999) {
@Override
public String getText() {
return "客户取消订单";
return "取消订单";
}
},
RETURN("退货", "RETURN", 9999) {
@Override
public String getText() {
return "退货订单";
}
},
......
......@@ -3,7 +3,7 @@ package cn.iocoder.foodnexus.module.order.controller.admin.customerorder.vo;
import cn.iocoder.foodnexus.module.erp.api.vo.warehouse.WarehouseInfo;
import cn.iocoder.foodnexus.module.order.controller.admin.customerorderrecord.vo.CustomerOrderRecordRespVO;
import cn.iocoder.foodnexus.module.order.dto.CustomerAddressInfo;
import cn.iocoder.foodnexus.module.order.dal.dataobject.customerorder.CustomerOrderRemark;
import cn.iocoder.foodnexus.module.order.dto.CustomerOrderRemark;
import cn.iocoder.foodnexus.module.order.enums.CustomerOrderStatus;
import cn.iocoder.foodnexus.module.order.enums.DeliveryMode;
import io.swagger.v3.oas.annotations.media.Schema;
......
package cn.iocoder.foodnexus.module.order.controller.admin.customerorderitem.vo;
import cn.iocoder.foodnexus.module.order.dal.dataobject.customerorder.CustomerOrderRemark;
import cn.iocoder.foodnexus.module.order.dto.CustomerOrderRemark;
import cn.iocoder.foodnexus.module.product.api.dto.ProductInfo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import cn.idev.excel.annotation.*;
......
......@@ -14,6 +14,7 @@ import cn.iocoder.foodnexus.module.order.controller.app.customerOrder.vo.AppCust
import cn.iocoder.foodnexus.module.order.controller.app.customerOrder.vo.AppCustomerOrderRemarkReqVO;
import cn.iocoder.foodnexus.module.order.controller.app.customerOrder.vo.AppCustomerOrderSaveReqVO;
import cn.iocoder.foodnexus.module.order.dal.dataobject.customerorder.CustomerOrderDO;
import cn.iocoder.foodnexus.module.order.dto.AppCustomerReturnOrderReqVO;
import cn.iocoder.foodnexus.module.order.service.customerorder.CustomerOrderService;
import cn.iocoder.foodnexus.module.order.service.customerorderrecord.CustomerOrderRecordService;
import cn.iocoder.foodnexus.module.system.annotations.AppSystemAuth;
......@@ -82,6 +83,13 @@ public class AppCustomerOrderController {
return success(Boolean.TRUE);
}
@PostMapping("/return")
@Operation(summary = "退货")
public CommonResult<Boolean> orderReturn(@Valid @RequestBody AppCustomerReturnOrderReqVO reqVO) {
customerOrderService.orderReturn(reqVO);
return success(Boolean.TRUE);
}
@DeleteMapping("/delete-list")
@Parameter(name = "ids", description = "编号", required = true)
@Operation(summary = "批量删除客户总订单")
......
......@@ -2,6 +2,7 @@ package cn.iocoder.foodnexus.module.order.dal.dataobject.customerorder;
import cn.iocoder.foodnexus.module.erp.api.vo.warehouse.WarehouseInfo;
import cn.iocoder.foodnexus.module.order.dto.CustomerAddressInfo;
import cn.iocoder.foodnexus.module.order.dto.CustomerOrderRemark;
import cn.iocoder.foodnexus.module.order.enums.CustomerOrderStatus;
import cn.iocoder.foodnexus.module.order.enums.DeliveryMode;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
......
package cn.iocoder.foodnexus.module.order.dal.dataobject.customerorderitem;
import cn.iocoder.foodnexus.module.order.dal.dataobject.customerorder.CustomerOrderRemark;
import cn.iocoder.foodnexus.module.order.dto.CustomerOrderRemark;
import cn.iocoder.foodnexus.module.product.api.dto.ProductInfo;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.foodnexus.framework.mybatis.core.dataobject.BaseDO;
......
......@@ -18,6 +18,7 @@ public interface ErrorCodeConstants {
ErrorCode CUSTOMER_ORDER_ADDRESS_NOEXISTS = new ErrorCode(1_019_100_004, "仓库不存在");
ErrorCode CUSTOMER_ORDER_STATUS_ERROR = new ErrorCode(1_019_100_005, "客户订单状态异常");
ErrorCode CUSTOMER_ORDER_OUT_ERROR = new ErrorCode(1_019_100_006, "客户订单出库环节异常");
ErrorCode CUSTOMER_ORDER_RETURN_PRODUCT_ERROR = new ErrorCode(1_019_100_006, "客户订单退货商品异常");
// ========== 客户订单-子订单 1_020_100_0001 ==========
ErrorCode CUSTOMER_ORDER_ITEM_NOT_EXISTS = new ErrorCode(1_020_100_001, "客户订单-子订单不存在");
......
package cn.iocoder.foodnexus.module.order.service.checktask;
import cn.hutool.core.collection.CollUtil;
import cn.iocoder.foodnexus.framework.common.util.CommonUtil;
import cn.iocoder.foodnexus.framework.common.util.spring.SpringUtils;
import cn.iocoder.foodnexus.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.foodnexus.module.erp.api.PurchaseOrderSplitEvent;
import cn.iocoder.foodnexus.module.erp.api.vo.warehouse.WarehouseInfo;
import cn.iocoder.foodnexus.module.erp.dal.dataobject.purchase.ErpPurchaseOrderDO;
import cn.iocoder.foodnexus.module.erp.dal.dataobject.purchase.ErpPurchaseOrderItemDO;
import cn.iocoder.foodnexus.module.erp.dal.mysql.purchase.ErpPurchaseOrderMapper;
import cn.iocoder.foodnexus.module.erp.service.purchase.ErpPurchaseOrderService;
import cn.iocoder.foodnexus.module.erp.service.sale.ErpSaleOrderService;
import cn.iocoder.foodnexus.module.order.api.CheckTaskApi;
import cn.iocoder.foodnexus.module.order.api.CustomerOrderRecordApi;
import cn.iocoder.foodnexus.module.order.dal.dataobject.checktaskitems.CheckTaskItemsDO;
import cn.iocoder.foodnexus.module.order.dal.dataobject.customerorder.CustomerOrderDO;
import cn.iocoder.foodnexus.module.order.dal.mysql.checktaskitems.CheckTaskItemsMapper;
import cn.iocoder.foodnexus.module.order.dto.CheckTaskCreateEvent;
import cn.iocoder.foodnexus.module.order.dto.CustomerOrderRecordEvent;
import cn.iocoder.foodnexus.module.order.enums.CheckTaskStatus;
import cn.iocoder.foodnexus.module.order.enums.CustomerOrderStatus;
import cn.iocoder.foodnexus.module.order.service.checktaskitems.CheckTaskItemsService;
import cn.iocoder.foodnexus.module.order.service.customerorder.CustomerOrderService;
import cn.iocoder.foodnexus.module.product.api.ProductSpuApi;
import cn.iocoder.foodnexus.module.product.api.category.ProductCategoryApi;
import cn.iocoder.foodnexus.module.product.dal.dataobject.spu.ProductSpuDO;
import cn.iocoder.foodnexus.module.product.service.category.ProductCategoryService;
import cn.iocoder.foodnexus.module.product.service.spu.ProductSpuService;
......@@ -40,14 +42,12 @@ import java.util.*;
import cn.iocoder.foodnexus.module.order.controller.admin.checktask.vo.*;
import cn.iocoder.foodnexus.module.order.dal.dataobject.checktask.CheckTaskDO;
import cn.iocoder.foodnexus.framework.common.pojo.PageResult;
import cn.iocoder.foodnexus.framework.common.pojo.PageParam;
import cn.iocoder.foodnexus.framework.common.util.object.BeanUtils;
import cn.iocoder.foodnexus.module.order.dal.mysql.checktask.CheckTaskMapper;
import static cn.iocoder.foodnexus.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.foodnexus.framework.common.util.collection.CollectionUtils.convertList;
import static cn.iocoder.foodnexus.framework.common.util.collection.CollectionUtils.diffList;
import static cn.iocoder.foodnexus.module.order.enums.ErrorCodeConstants.*;
/**
......@@ -58,7 +58,7 @@ import static cn.iocoder.foodnexus.module.order.enums.ErrorCodeConstants.*;
@Service
@Validated
@Slf4j
public class CheckTaskServiceImpl implements CheckTaskService {
public class CheckTaskServiceImpl implements CheckTaskService, CheckTaskApi {
@Resource
private CheckTaskMapper checkTaskMapper;
......@@ -74,6 +74,9 @@ public class CheckTaskServiceImpl implements CheckTaskService {
private ErpPurchaseOrderService purchaseOrderService;
@Autowired
private ErpPurchaseOrderMapper purchaseOrderMapper;
@Autowired
private ProductSpuService productSpuService;
@Autowired
......@@ -88,6 +91,9 @@ public class CheckTaskServiceImpl implements CheckTaskService {
private CustomerOrderService customerOrderService;
@Autowired
private ErpSaleOrderService saleOrderService;
@Autowired
private GenCodeUtils genCodeUtils;
@Override
......@@ -168,11 +174,22 @@ public class CheckTaskServiceImpl implements CheckTaskService {
.set(CheckTaskDO::getFiles, updateReqVO.getFiles())
.set(CheckTaskDO::getCheckTime, LocalDateTime.now())
.set(CheckTaskDO::getCheckUserId, SecurityFrameworkUtils.getLoginUserId())
.set(CheckTaskDO::getStatus, updateReqVO.getStatus())
.eq(CheckTaskDO::getId, updateReqVO.getId()));
List<CheckTaskItemsDO> updateItems = BeanUtils.toBean(updateReqVO.getItems(), CheckTaskItemsDO.class);
checkTaskItemsMapper.updateById(updateItems);
// 根据采购订单判断是否已经完成全部的质检,完成则新建配货单(销售订单)
Long purchaseOrderCount = purchaseOrderMapper.selectCount(Wrappers.<ErpPurchaseOrderDO>lambdaQuery()
.eq(ErpPurchaseOrderDO::getCustomerOrderId, checkTaskDO.getCustomerOrderId()));
Long checkTaskCount = checkTaskMapper.selectCount(Wrappers.<CheckTaskDO>lambdaQuery()
.eq(CheckTaskDO::getCustomerOrderId, checkTaskDO.getCustomerOrderId())
.eq(CheckTaskDO::getStatus, CheckTaskStatus.NORMAL));
if (Objects.equals(purchaseOrderCount, checkTaskCount)) {
saleOrderService.createByCustomerOrderId(checkTaskDO.getCustomerOrderId());
}
if (CheckTaskStatus.NORMAL.getKey().equals(updateReqVO.getStatus())) {
// 查询关联的客户订单
CustomerOrderDO customerOrder = customerOrderService.getCustomerOrder(checkTaskDO.getCustomerOrderId());
......@@ -187,16 +204,12 @@ public class CheckTaskServiceImpl implements CheckTaskService {
}
}
@Override
@Async
@TransactionalEventListener(classes = CheckTaskCreateEvent.class, phase = TransactionPhase.AFTER_COMMIT)
public void createCheckTask(CheckTaskCreateEvent event) {
log.info("来料质检创建事件:{}", event);
if (CommonUtil.isEmpty(event) || CommonUtil.isEmpty(event.getSupplierOrderId())) {
return ;
}
ErpPurchaseOrderDO purchaseOrder = purchaseOrderService.getPurchaseOrder(event.getSupplierOrderId());
List<ErpPurchaseOrderItemDO> purchaseOrderItems = purchaseOrderService.getPurchaseOrderItemListByOrderId(event.getSupplierOrderId());
public void createByPurchaseOrderId(Long purchaseOrderId) {
log.info("来料质检创建:{}", purchaseOrderId);
ErpPurchaseOrderDO purchaseOrder = purchaseOrderService.getPurchaseOrder(purchaseOrderId);
List<ErpPurchaseOrderItemDO> purchaseOrderItems = purchaseOrderService.getPurchaseOrderItemListByOrderId(purchaseOrderId);
this.createCheckTask(this.transform(purchaseOrder, purchaseOrderItems));
}
......
......@@ -6,6 +6,7 @@ import cn.iocoder.foodnexus.module.order.controller.app.customerOrder.vo.AppCust
import cn.iocoder.foodnexus.module.order.controller.app.customerOrder.vo.AppCustomerOrderRemarkReqVO;
import cn.iocoder.foodnexus.module.order.controller.app.customerOrder.vo.AppCustomerOrderSaveReqVO;
import cn.iocoder.foodnexus.module.order.controller.app.customerOrder.vo.AppCustomerOrderSaveReqVO;
import cn.iocoder.foodnexus.module.order.dto.AppCustomerReturnOrderReqVO;
import jakarta.validation.*;
import cn.iocoder.foodnexus.module.order.controller.admin.customerorder.vo.*;
import cn.iocoder.foodnexus.module.order.dal.dataobject.customerorder.CustomerOrderDO;
......@@ -89,5 +90,16 @@ public interface CustomerOrderService {
*/
void receipt(AppCustomerOrderRemarkReqVO reqVO);
/**
* 签收前查询相关信息(销售出库单)
* @param id
* @return
*/
List<AppCustomerOrderReceiptRespVO> queryReceipt(Long id);
/**
* 订单退货
* @param reqVO
*/
void orderReturn(AppCustomerReturnOrderReqVO reqVO);
}
\ No newline at end of file
......@@ -9,11 +9,16 @@ import cn.iocoder.foodnexus.module.erp.api.PurchaseOrderSplitEvent;
import cn.iocoder.foodnexus.module.erp.api.service.ErpCustomerApi;
import cn.iocoder.foodnexus.module.erp.api.service.ErpSupplierApi;
import cn.iocoder.foodnexus.module.erp.api.service.ErpWarehouseApi;
import cn.iocoder.foodnexus.module.erp.controller.admin.sale.vo.returns.ErpSaleReturnSaveReqVO;
import cn.iocoder.foodnexus.module.erp.dal.dataobject.sale.ErpSaleOrderDO;
import cn.iocoder.foodnexus.module.erp.dal.dataobject.sale.ErpSaleOrderItemDO;
import cn.iocoder.foodnexus.module.erp.dal.dataobject.sale.ErpSaleOutDO;
import cn.iocoder.foodnexus.module.erp.dal.dataobject.sale.ErpSaleOutItemDO;
import cn.iocoder.foodnexus.module.erp.service.customerwarehouse.CustomerWarehouseService;
import cn.iocoder.foodnexus.module.erp.service.purchase.ErpPurchaseOrderServiceImpl;
import cn.iocoder.foodnexus.module.erp.service.sale.ErpSaleOrderService;
import cn.iocoder.foodnexus.module.erp.service.sale.ErpSaleOutService;
import cn.iocoder.foodnexus.module.erp.service.sale.ErpSaleReturnService;
import cn.iocoder.foodnexus.module.operations.dal.dataobject.inquiresupplierpush.InquireSupplierPushDO;
import cn.iocoder.foodnexus.module.operations.service.inquiresupplierpush.InquireSupplierPushService;
import cn.iocoder.foodnexus.module.order.api.CustomerOrderApi;
......@@ -22,13 +27,10 @@ import cn.iocoder.foodnexus.module.order.controller.app.customerOrder.vo.AppCust
import cn.iocoder.foodnexus.module.order.controller.app.customerOrder.vo.AppCustomerOrderReceiptRespVO;
import cn.iocoder.foodnexus.module.order.controller.app.customerOrder.vo.AppCustomerOrderRemarkReqVO;
import cn.iocoder.foodnexus.module.order.controller.app.customerOrder.vo.AppCustomerOrderSaveReqVO;
import cn.iocoder.foodnexus.module.order.dto.CustomerAddressInfo;
import cn.iocoder.foodnexus.module.order.dal.dataobject.customerorder.CustomerOrderRemark;
import cn.iocoder.foodnexus.module.order.dto.*;
import cn.iocoder.foodnexus.module.order.dto.CustomerOrderRemark;
import cn.iocoder.foodnexus.module.order.dal.dataobject.customerorderitem.CustomerOrderItemDO;
import cn.iocoder.foodnexus.module.order.dal.mysql.customerorderitem.CustomerOrderItemMapper;
import cn.iocoder.foodnexus.module.order.dto.CustomerOrderDTO;
import cn.iocoder.foodnexus.module.order.dto.CustomerOrderItemDTO;
import cn.iocoder.foodnexus.module.order.dto.CustomerOrderRecordEvent;
import cn.iocoder.foodnexus.module.order.enums.CustomerOrderStatus;
import cn.iocoder.foodnexus.module.order.service.customeraddress.CustomerAddressService;
import cn.iocoder.foodnexus.module.order.service.customerorderitem.CustomerOrderItemService;
......@@ -111,6 +113,12 @@ public class CustomerOrderServiceImpl implements CustomerOrderService, CustomerO
private ErpSaleOutService saleOutService;
@Autowired
private ErpSaleReturnService saleReturnService;
@Autowired
private ErpSaleOrderService saleOrderService;
@Autowired
private GenCodeUtils genCodeUtils;
@Override
......@@ -376,6 +384,66 @@ public class CustomerOrderServiceImpl implements CustomerOrderService, CustomerO
}
/**
* 订单退货
*
* @param reqVO
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void orderReturn(AppCustomerReturnOrderReqVO reqVO) {
Long id = reqVO.getCustomerOrderId();
CustomerOrderDO customerOrder = getCustomerOrder(id);
if (CommonUtil.isEmpty(customerOrder)) {
throw exception(CUSTOMER_ORDER_NOT_EXISTS);
}
if (!customerOrder.getOrderStatus().equals(CustomerOrderStatus.SIGN_RECEIPT)) {
throw exception(CUSTOMER_ORDER_STATUS_ERROR);
}
// 修改客户订单状态
CustomerOrderRecordEvent event = new CustomerOrderRecordEvent();
event.setOrderStatus(CustomerOrderStatus.RETURN);
event.setCustomerOrderId(id);
event.setCopyWriter(null);
orderRecordApi.recordEvent(event);
// 添加销售退货单
List<CustomerOrderItemDO> customerOrderItems = customerOrderItemMapper.selectList(CustomerOrderItemDO::getOrderId, id);
Map<Long, CustomerOrderItemDO> orderItemMap = CommonUtil.listConvertMap(customerOrderItems, CustomerOrderItemDO::getId);
ErpSaleReturnSaveReqVO returnSaveReqVO = new ErpSaleReturnSaveReqVO();
returnSaveReqVO.setReturnTime(LocalDateTime.now());
returnSaveReqVO.setCustomerId(customerOrder.getCustomerId());
// 查询对应的销售订单
ErpSaleOrderDO saleOrderDO = saleOrderService.queryByCustomerOrderId(customerOrder.getId());
returnSaveReqVO.setOrderId(saleOrderDO.getId());
returnSaveReqVO.setCustomerOrderId(customerOrder.getId());
returnSaveReqVO.setRemark(reqVO.getRemark());
returnSaveReqVO.setFilesUrl(reqVO.getRemarkFiles());
List<ErpSaleReturnSaveReqVO.Item> items = new ArrayList<>(reqVO.getOrderItems().size());
for (AppCustomerReturnOrderReqVO.Item item : reqVO.getOrderItems()) {
CustomerOrderItemDO customerOrderItemDO = orderItemMap.get(item.getCustomerOrderItemId());
if (!Objects.equals(customerOrderItemDO.getProductId(), item.getProductId())) {
throw exception(CUSTOMER_ORDER_RETURN_PRODUCT_ERROR);
}
ErpSaleReturnSaveReqVO.Item returnItem = new ErpSaleReturnSaveReqVO.Item();
ErpSaleOrderItemDO saleOrderItemDO = saleOrderService.queryItemByCustomerOrderItemId(customerOrderItemDO.getId());
returnItem.setOrderItemId(saleOrderItemDO.getId());
returnItem.setCustomerOrderItemId(customerOrderItemDO.getId());
returnItem.setWarehouseId(customerOrder.getWarehouseAreaId());
returnItem.setProductId(item.getProductId());
returnItem.setProductUnit(customerOrderItemDO.getProductInfo().getUnitName());
returnItem.setProductPrice(customerOrderItemDO.getOrderItemPrice());
returnItem.setCount(item.getReturnCount());
returnItem.setRemark(item.getRemark());
returnItem.setSupplierId(customerOrderItemDO.getSupplierId());
items.add(returnItem);
}
returnSaveReqVO.setItems(items);
saleReturnService.createSaleReturn(returnSaveReqVO);
}
/**
* {@link ErpPurchaseOrderServiceImpl#orderSplit(PurchaseOrderSplitEvent)}
*/
private void orderSplitPurchase(Long customerOrderId) {
......
......@@ -123,9 +123,9 @@ public class ProductCategoryServiceImpl implements ProductCategoryService {
throw exception(CATEGORY_DISABLED, category.getName());
}
// 商品分类层级校验,必须使用第二级的商品分类
if (getCategoryLevel(id) < CATEGORY_LEVEL) {
/*if (getCategoryLevel(id) < CATEGORY_LEVEL) {
throw exception(SPU_SAVE_FAIL_CATEGORY_LEVEL_ERROR);
}
}*/
});
}
......
......@@ -85,9 +85,9 @@ public class ProductSpuServiceImpl implements ProductSpuService {
private void validateCategory(Long id) {
categoryService.validateCategory(id);
// 校验层级
if (categoryService.getCategoryLevel(id) < CATEGORY_LEVEL) {
/*if (categoryService.getCategoryLevel(id) < CATEGORY_LEVEL) {
throw exception(SPU_SAVE_FAIL_CATEGORY_LEVEL_ERROR);
}
}*/
}
@Override
......@@ -165,11 +165,11 @@ public class ProductSpuServiceImpl implements ProductSpuService {
// 校验存在
validateSpuExists(id);
// 校验商品状态不是回收站不能删除
ProductSpuDO spuDO = productSpuMapper.selectById(id);
// ProductSpuDO spuDO = productSpuMapper.selectById(id);
// 判断 SPU 状态是否为回收站
if (ObjectUtil.notEqual(spuDO.getStatus(), ProductSpuStatusEnum.RECYCLE.getStatus())) {
/*if (ObjectUtil.notEqual(spuDO.getStatus(), ProductSpuStatusEnum.RECYCLE.getStatus())) {
throw exception(SPU_NOT_RECYCLE);
}
}*/
// TODO 芋艿:【可选】参与活动中的商品,不允许删除???
// 删除 SPU
......
package cn.iocoder.foodnexus.module.system.controller.app.auth;
import cn.hutool.core.collection.CollUtil;
import cn.iocoder.foodnexus.framework.common.pojo.CommonResult;
import cn.iocoder.foodnexus.framework.datapermission.core.annotation.DataPermission;
import cn.iocoder.foodnexus.module.system.controller.admin.user.vo.profile.UserProfileRespVO;
import cn.iocoder.foodnexus.module.system.controller.admin.user.vo.profile.UserProfileUpdatePasswordReqVO;
import cn.iocoder.foodnexus.module.system.controller.admin.user.vo.profile.UserProfileUpdateReqVO;
import cn.iocoder.foodnexus.module.system.convert.user.UserConvert;
import cn.iocoder.foodnexus.module.system.dal.dataobject.dept.DeptDO;
import cn.iocoder.foodnexus.module.system.dal.dataobject.dept.PostDO;
import cn.iocoder.foodnexus.module.system.dal.dataobject.permission.RoleDO;
import cn.iocoder.foodnexus.module.system.dal.dataobject.user.AdminUserDO;
import cn.iocoder.foodnexus.module.system.service.dept.DeptService;
import cn.iocoder.foodnexus.module.system.service.dept.PostService;
import cn.iocoder.foodnexus.module.system.service.permission.PermissionService;
import cn.iocoder.foodnexus.module.system.service.permission.RoleService;
import cn.iocoder.foodnexus.module.system.service.user.AdminUserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import static cn.iocoder.foodnexus.framework.common.pojo.CommonResult.success;
import static cn.iocoder.foodnexus.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
@Tag(name = "APP - 用户个人中心")
@RestController
@RequestMapping("/system/user/profile")
@Validated
@Slf4j
public class UserProfileController {
@Resource
private AdminUserService userService;
@Resource
private DeptService deptService;
@Resource
private PostService postService;
@Resource
private PermissionService permissionService;
@Resource
private RoleService roleService;
@GetMapping("/get")
@Operation(summary = "获得登录用户信息")
@DataPermission(enable = false) // 关闭数据权限,避免只查看自己时,查询不到部门。
public CommonResult<UserProfileRespVO> getUserProfile() {
// 获得用户基本信息
AdminUserDO user = userService.getUser(getLoginUserId());
// 获得用户角色
List<RoleDO> userRoles = roleService.getRoleListFromCache(permissionService.getUserRoleIdListByUserId(user.getId()));
// 获得部门信息
DeptDO dept = user.getDeptId() != null ? deptService.getDept(user.getDeptId()) : null;
// 获得岗位信息
List<PostDO> posts = CollUtil.isNotEmpty(user.getPostIds()) ? postService.getPostList(user.getPostIds()) : null;
return success(UserConvert.INSTANCE.convert(user, userRoles, dept, posts));
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment