diff --git a/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/CodeEnum.java b/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/CodeEnum.java index 76146ca0..8d8c3a7a 100644 --- a/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/CodeEnum.java +++ b/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/CodeEnum.java @@ -45,6 +45,7 @@ public enum CodeEnum { PROJECT_DELIVERY_ORDER("发货单", "HL", 3, "yyyyMM"), PROJECT_PLAN("生产计划", "PP",3, "yyyyMM"), MATERIAL_PLAN("物料需求计划", "PR",4, "yyyyMMdd"), + PURCHASE_ORDER("采购订单", "PO",4, "yyyyMMdd"), ; diff --git a/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/ErrorCodeConstants.java b/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/ErrorCodeConstants.java index 14817680..89ac96e5 100644 --- a/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/ErrorCodeConstants.java +++ b/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/ErrorCodeConstants.java @@ -64,4 +64,6 @@ public interface ErrorCodeConstants { /************采购管理***********/ ErrorCode MATERIAL_PLAN_NOT_EXISTS = new ErrorCode(1_008_001, "物料需求计划不存在"); ErrorCode MATERIAL_PLAN_DETAIL_NOT_EXISTS = new ErrorCode(1_008_002, "物料需求计划物料详情不存在"); + ErrorCode PURCHASE_ORDER_NOT_EXISTS = new ErrorCode(1_008_003, "采购订单不存在"); + ErrorCode PURCHASE_ORDER_MATERIAL_NOT_EXISTS = new ErrorCode(1_008_004, "采购单物料不存在"); } diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/purchaseorder/PurchaseOrderController.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/purchaseorder/PurchaseOrderController.java new file mode 100644 index 00000000..5dc7230c --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/purchaseorder/PurchaseOrderController.java @@ -0,0 +1,95 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.purchaseorder; + +import org.springframework.web.bind.annotation.*; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Operation; + +import javax.validation.constraints.*; +import javax.validation.*; +import javax.servlet.http.*; +import java.util.*; +import java.io.IOException; + +import com.chanko.yunxi.mes.framework.common.pojo.PageParam; +import com.chanko.yunxi.mes.framework.common.pojo.PageResult; +import com.chanko.yunxi.mes.framework.common.pojo.CommonResult; +import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils; +import static com.chanko.yunxi.mes.framework.common.pojo.CommonResult.success; + +import com.chanko.yunxi.mes.framework.excel.core.util.ExcelUtils; + +import com.chanko.yunxi.mes.framework.operatelog.core.annotations.OperateLog; +import static com.chanko.yunxi.mes.framework.operatelog.core.enums.OperateTypeEnum.*; + +import com.chanko.yunxi.mes.module.heli.controller.admin.purchaseorder.vo.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.purchaseorder.PurchaseOrderDO; +import com.chanko.yunxi.mes.module.heli.service.purchaseorder.PurchaseOrderService; + +@Tag(name = "管理后台 - 采购订单") +@RestController +@RequestMapping("/heli/purchase-order") +@Validated +public class PurchaseOrderController { + + @Resource + private PurchaseOrderService purchaseOrderService; + + @PostMapping("/create") + @Operation(summary = "创建采购订单") + @PreAuthorize("@ss.hasPermission('heli:purchase-order:create')") + public CommonResult createPurchaseOrder(@Valid @RequestBody PurchaseOrderSaveReqVO createReqVO) { + return success(purchaseOrderService.createPurchaseOrder(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新采购订单") + @PreAuthorize("@ss.hasPermission('heli:purchase-order:update')") + public CommonResult updatePurchaseOrder(@Valid @RequestBody PurchaseOrderSaveReqVO updateReqVO) { + purchaseOrderService.updatePurchaseOrder(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除采购订单") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('heli:purchase-order:delete')") + public CommonResult deletePurchaseOrder(@RequestParam("id") Long id) { + purchaseOrderService.deletePurchaseOrder(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得采购订单") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('heli:purchase-order:query')") + public CommonResult getPurchaseOrder(@RequestParam("id") Long id) { + PurchaseOrderDO purchaseOrder = purchaseOrderService.getPurchaseOrder(id); + return success(BeanUtils.toBean(purchaseOrder, PurchaseOrderRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得采购订单分页") + @PreAuthorize("@ss.hasPermission('heli:purchase-order:query')") + public CommonResult> getPurchaseOrderPage(@Valid PurchaseOrderPageReqVO pageReqVO) { + PageResult pageResult = purchaseOrderService.getPurchaseOrderPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, PurchaseOrderRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出采购订单 Excel") + @PreAuthorize("@ss.hasPermission('heli:purchase-order:export')") + @OperateLog(type = EXPORT) + public void exportPurchaseOrderExcel(@Valid PurchaseOrderPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = purchaseOrderService.getPurchaseOrderPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "采购订单.xls", "数据", PurchaseOrderRespVO.class, + BeanUtils.toBean(list, PurchaseOrderRespVO.class)); + } + +} \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/purchaseorder/vo/PurchaseOrderPageReqVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/purchaseorder/vo/PurchaseOrderPageReqVO.java new file mode 100644 index 00000000..56a898e6 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/purchaseorder/vo/PurchaseOrderPageReqVO.java @@ -0,0 +1,85 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.purchaseorder.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import com.chanko.yunxi.mes.framework.common.pojo.PageParam; +import java.math.BigDecimal; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +import static com.chanko.yunxi.mes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 采购订单分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class PurchaseOrderPageReqVO extends PageParam { + + @Schema(description = "自增字段,唯一") + private Long id; + + @Schema(description = "采购单号") + private String purchaseNo; + + @Schema(description = "供应商id") + private Long supplierId; + + @Schema(description = "供应商名称") + private Long supplierName; + + @Schema(description = "采购合同号") + private String contractNo; + + @Schema(description = "采购单类型,1按物料需求计划采购,2备库采购") + private Integer purchaseType; + + @Schema(description = "供应商id") + private Long projectMaterialPlanId; + + @Schema(description = "供应商id") + private Long materialPlanNo; + + @Schema(description = "采购物类型,1物料,2加工件") + private Integer goodsType; + + @Schema(description = "结算币种") + private Integer currencyType; + + @Schema(description = "税率") + private Integer taxRatio; + + @Schema(description = "暂估价金额") + private BigDecimal estimatedPrice; + + @Schema(description = "实际价金额") + private BigDecimal actualPrice; + + @Schema(description = "状态,1已保存,2已送审,3已审核,4已打回 ,默认是1") + private Integer status; + + @Schema(description = "送审人") + private Long submitUserId; + + @Schema(description = "送审时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] submitTime; + + @Schema(description = "审核人") + private Long auditor; + + @Schema(description = "审核时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] auditTime; + + @Schema(description = "备注") + private String description; + + @Schema(description = "创建者") + private String creator; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/purchaseorder/vo/PurchaseOrderRespVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/purchaseorder/vo/PurchaseOrderRespVO.java new file mode 100644 index 00000000..b85d1808 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/purchaseorder/vo/PurchaseOrderRespVO.java @@ -0,0 +1,106 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.purchaseorder.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import java.util.*; +import java.math.BigDecimal; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; +import com.alibaba.excel.annotation.*; +import com.chanko.yunxi.mes.framework.excel.core.annotations.DictFormat; +import com.chanko.yunxi.mes.framework.excel.core.convert.DictConvert; + +@Schema(description = "管理后台 - 采购订单 Response VO") +@Data +@ExcelIgnoreUnannotated +public class PurchaseOrderRespVO { + + @Schema(description = "自增字段,唯一", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("自增字段,唯一") + private Long id; + + @Schema(description = "采购单号", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("采购单号") + private String purchaseNo; + + @Schema(description = "供应商id") + @ExcelProperty("供应商id") + private Long supplierId; + + @Schema(description = "供应商名称") + @ExcelProperty("供应商") + private String supplierName; + + @Schema(description = "采购合同号") + @ExcelProperty("采购合同号") + private String contractNo; + + @Schema(description = "采购单类型,1按物料需求计划采购,2备库采购") + @ExcelProperty(value = "采购单类型,1按物料需求计划采购,2备库采购", converter = DictConvert.class) + @DictFormat("heli_project_purchase_order_type") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中 + private Integer purchaseType; + + @Schema(description = "供应商id") + @ExcelProperty("供应商id") + private Long projectMaterialPlanId; + + @Schema(description = "物料需求计划单号") + @ExcelProperty("物料需求计划单号") + private String materialPlanNp; + + @Schema(description = "采购物类型,1物料,2加工件", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty(value = "采购物类型,1物料,2加工件", converter = DictConvert.class) + @DictFormat("heli_project_purchase_goods_type") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中 + private Integer goodsType; + + @Schema(description = "结算币种") + @ExcelProperty("结算币种") + private Integer currencyType; + + @Schema(description = "税率") + @ExcelProperty("税率") + private Integer taxRatio; + + @Schema(description = "暂估价金额") + @ExcelProperty("暂估价金额") + private BigDecimal estimatedPrice; + + @Schema(description = "实际价金额") + @ExcelProperty("实际价金额") + private BigDecimal actualPrice; + + @Schema(description = "状态,1已保存,2已送审,3已审核,4已打回 ,默认是1") + @ExcelProperty(value = "状态,1已保存,2已送审,3已审核,4已打回 ,默认是1", converter = DictConvert.class) + @DictFormat("heli_purchase_order_status") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中 + private Integer status; + + @Schema(description = "送审人") + @ExcelProperty("送审人") + private Long submitUserId; + + @Schema(description = "送审时间") + @ExcelProperty("送审时间") + private LocalDateTime submitTime; + + @Schema(description = "审核人") + @ExcelProperty("审核人") + private Long auditor; + + @Schema(description = "审核时间") + @ExcelProperty("审核时间") + private LocalDateTime auditTime; + + @Schema(description = "备注") + @ExcelProperty("备注") + private String description; + + @Schema(description = "创建者") + @ExcelProperty("创建者") + private String creator; + + @Schema(description = "创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createTime; + +} \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/purchaseorder/vo/PurchaseOrderSaveReqVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/purchaseorder/vo/PurchaseOrderSaveReqVO.java new file mode 100644 index 00000000..9aacdef2 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/purchaseorder/vo/PurchaseOrderSaveReqVO.java @@ -0,0 +1,68 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.purchaseorder.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import javax.validation.constraints.*; +import java.util.*; +import java.math.BigDecimal; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 采购订单新增/修改 Request VO") +@Data +public class PurchaseOrderSaveReqVO { + + @Schema(description = "自增字段,唯一", requiredMode = Schema.RequiredMode.REQUIRED) + private Long id; + + @Schema(description = "采购单号", requiredMode = Schema.RequiredMode.REQUIRED) + private String purchaseNo; + + @Schema(description = "供应商id") + private Long supplierId; + + @Schema(description = "采购合同号") + private String contractNo; + + @Schema(description = "采购单类型,1按物料需求计划采购,2备库采购") + private Integer purchaseType; + + @Schema(description = "供应商id") + private Long projectMaterialPlanId; + + @Schema(description = "采购物类型,1物料,2加工件", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "采购物类型,1物料,2加工件不能为空") + private Integer goodsType; + + @Schema(description = "结算币种") + private Integer currencyType; + + @Schema(description = "税率") + private Integer taxRatio; + + @Schema(description = "暂估价金额") + private BigDecimal estimatedPrice; + + @Schema(description = "实际价金额") + private BigDecimal actualPrice; + + @Schema(description = "状态,1已保存,2已送审,3已审核,4已打回 ,默认是1") + private Boolean status; + + @Schema(description = "送审人") + private Long submitUserId; + + @Schema(description = "送审时间") + private LocalDateTime submitTime; + + @Schema(description = "审核人") + private Long auditor; + + @Schema(description = "审核时间") + private LocalDateTime auditTime; + + @Schema(description = "备注") + private String description; + +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/purchaseordermaterial/PurchaseOrderMaterialController.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/purchaseordermaterial/PurchaseOrderMaterialController.java new file mode 100644 index 00000000..c942b26a --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/purchaseordermaterial/PurchaseOrderMaterialController.java @@ -0,0 +1,95 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.purchaseordermaterial; + +import org.springframework.web.bind.annotation.*; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Operation; + +import javax.validation.constraints.*; +import javax.validation.*; +import javax.servlet.http.*; +import java.util.*; +import java.io.IOException; + +import com.chanko.yunxi.mes.framework.common.pojo.PageParam; +import com.chanko.yunxi.mes.framework.common.pojo.PageResult; +import com.chanko.yunxi.mes.framework.common.pojo.CommonResult; +import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils; +import static com.chanko.yunxi.mes.framework.common.pojo.CommonResult.success; + +import com.chanko.yunxi.mes.framework.excel.core.util.ExcelUtils; + +import com.chanko.yunxi.mes.framework.operatelog.core.annotations.OperateLog; +import static com.chanko.yunxi.mes.framework.operatelog.core.enums.OperateTypeEnum.*; + +import com.chanko.yunxi.mes.module.heli.controller.admin.purchaseordermaterial.vo.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.purchaseordermaterial.PurchaseOrderMaterialDO; +import com.chanko.yunxi.mes.module.heli.service.purchaseordermaterial.PurchaseOrderMaterialService; + +@Tag(name = "管理后台 - 采购单物料") +@RestController +@RequestMapping("/heli/purchase-order-material") +@Validated +public class PurchaseOrderMaterialController { + + @Resource + private PurchaseOrderMaterialService purchaseOrderMaterialService; + + @PostMapping("/create") + @Operation(summary = "创建采购单物料") + @PreAuthorize("@ss.hasPermission('heli:purchase-order-material:create')") + public CommonResult createPurchaseOrderMaterial(@Valid @RequestBody PurchaseOrderMaterialSaveReqVO createReqVO) { + return success(purchaseOrderMaterialService.createPurchaseOrderMaterial(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新采购单物料") + @PreAuthorize("@ss.hasPermission('heli:purchase-order-material:update')") + public CommonResult updatePurchaseOrderMaterial(@Valid @RequestBody PurchaseOrderMaterialSaveReqVO updateReqVO) { + purchaseOrderMaterialService.updatePurchaseOrderMaterial(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除采购单物料") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('heli:purchase-order-material:delete')") + public CommonResult deletePurchaseOrderMaterial(@RequestParam("id") Long id) { + purchaseOrderMaterialService.deletePurchaseOrderMaterial(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得采购单物料") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('heli:purchase-order-material:query')") + public CommonResult getPurchaseOrderMaterial(@RequestParam("id") Long id) { + PurchaseOrderMaterialDO purchaseOrderMaterial = purchaseOrderMaterialService.getPurchaseOrderMaterial(id); + return success(BeanUtils.toBean(purchaseOrderMaterial, PurchaseOrderMaterialRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得采购单物料分页") + @PreAuthorize("@ss.hasPermission('heli:purchase-order-material:query')") + public CommonResult> getPurchaseOrderMaterialPage(@Valid PurchaseOrderMaterialPageReqVO pageReqVO) { + PageResult pageResult = purchaseOrderMaterialService.getPurchaseOrderMaterialPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, PurchaseOrderMaterialRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出采购单物料 Excel") + @PreAuthorize("@ss.hasPermission('heli:purchase-order-material:export')") + @OperateLog(type = EXPORT) + public void exportPurchaseOrderMaterialExcel(@Valid PurchaseOrderMaterialPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = purchaseOrderMaterialService.getPurchaseOrderMaterialPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "采购单物料.xls", "数据", PurchaseOrderMaterialRespVO.class, + BeanUtils.toBean(list, PurchaseOrderMaterialRespVO.class)); + } + +} \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/purchaseordermaterial/vo/PurchaseOrderMaterialPageReqVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/purchaseordermaterial/vo/PurchaseOrderMaterialPageReqVO.java new file mode 100644 index 00000000..5cb03c7c --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/purchaseordermaterial/vo/PurchaseOrderMaterialPageReqVO.java @@ -0,0 +1,45 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.purchaseordermaterial.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import com.chanko.yunxi.mes.framework.common.pojo.PageParam; +import java.math.BigDecimal; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +import static com.chanko.yunxi.mes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 采购单物料分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class PurchaseOrderMaterialPageReqVO extends PageParam { + + @Schema(description = "采购单编号") + private Long purchaseOrderId; + + @Schema(description = "物料id") + private Long materialId; + + @Schema(description = "采购数量") + private Long purchaseAmount; + + @Schema(description = "暂估价金额") + private BigDecimal estimatedPrice; + + @Schema(description = "实际价金额") + private BigDecimal actualPrice; + + @Schema(description = "预计到期日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] arriveTime; + + @Schema(description = "备注") + private String description; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/purchaseordermaterial/vo/PurchaseOrderMaterialRespVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/purchaseordermaterial/vo/PurchaseOrderMaterialRespVO.java new file mode 100644 index 00000000..cb7081a5 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/purchaseordermaterial/vo/PurchaseOrderMaterialRespVO.java @@ -0,0 +1,53 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.purchaseordermaterial.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import java.util.*; +import java.math.BigDecimal; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; +import com.alibaba.excel.annotation.*; + +@Schema(description = "管理后台 - 采购单物料 Response VO") +@Data +@ExcelIgnoreUnannotated +public class PurchaseOrderMaterialRespVO { + + @Schema(description = "自增字段,唯一", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("自增字段,唯一") + private Long id; + + @Schema(description = "采购单编号", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("采购单编号") + private Long purchaseOrderId; + + @Schema(description = "物料id") + @ExcelProperty("物料id") + private Long materialId; + + @Schema(description = "采购数量") + @ExcelProperty("采购数量") + private Long purchaseAmount; + + @Schema(description = "暂估价金额") + @ExcelProperty("暂估价金额") + private BigDecimal estimatedPrice; + + @Schema(description = "实际价金额") + @ExcelProperty("实际价金额") + private BigDecimal actualPrice; + + @Schema(description = "预计到期日期") + @ExcelProperty("预计到期日期") + private LocalDateTime arriveTime; + + @Schema(description = "备注") + @ExcelProperty("备注") + private String description; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; + +} \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/purchaseordermaterial/vo/PurchaseOrderMaterialSaveReqVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/purchaseordermaterial/vo/PurchaseOrderMaterialSaveReqVO.java new file mode 100644 index 00000000..6f8c1006 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/purchaseordermaterial/vo/PurchaseOrderMaterialSaveReqVO.java @@ -0,0 +1,41 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.purchaseordermaterial.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import javax.validation.constraints.*; +import java.util.*; +import java.math.BigDecimal; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 采购单物料新增/修改 Request VO") +@Data +public class PurchaseOrderMaterialSaveReqVO { + + @Schema(description = "自增字段,唯一", requiredMode = Schema.RequiredMode.REQUIRED) + private Long id; + + @Schema(description = "采购单编号", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "采购单编号不能为空") + private Long purchaseOrderId; + + @Schema(description = "物料id") + private Long materialId; + + @Schema(description = "采购数量") + private Long purchaseAmount; + + @Schema(description = "暂估价金额") + private BigDecimal estimatedPrice; + + @Schema(description = "实际价金额") + private BigDecimal actualPrice; + + @Schema(description = "预计到期日期") + private LocalDateTime arriveTime; + + @Schema(description = "备注") + private String description; + +} \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/supplier/SupplierController.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/supplier/SupplierController.java index 7d1fb9f6..c40d6d5f 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/supplier/SupplierController.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/supplier/SupplierController.java @@ -1,95 +1,109 @@ -package com.chanko.yunxi.mes.module.heli.controller.admin.supplier; - -import org.springframework.web.bind.annotation.*; -import javax.annotation.Resource; -import org.springframework.validation.annotation.Validated; -import org.springframework.security.access.prepost.PreAuthorize; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.Operation; - -import javax.validation.constraints.*; -import javax.validation.*; -import javax.servlet.http.*; -import java.util.*; -import java.io.IOException; - -import com.chanko.yunxi.mes.framework.common.pojo.PageParam; -import com.chanko.yunxi.mes.framework.common.pojo.PageResult; -import com.chanko.yunxi.mes.framework.common.pojo.CommonResult; -import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils; -import static com.chanko.yunxi.mes.framework.common.pojo.CommonResult.success; - -import com.chanko.yunxi.mes.framework.excel.core.util.ExcelUtils; - -import com.chanko.yunxi.mes.framework.operatelog.core.annotations.OperateLog; -import static com.chanko.yunxi.mes.framework.operatelog.core.enums.OperateTypeEnum.*; - -import com.chanko.yunxi.mes.module.heli.controller.admin.supplier.vo.*; -import com.chanko.yunxi.mes.module.heli.dal.dataobject.supplier.SupplierDO; -import com.chanko.yunxi.mes.module.heli.service.supplier.SupplierService; - -@Tag(name = "管理后台 - 供应商") -@RestController -@RequestMapping("/heli/supplier") -@Validated -public class SupplierController { - - @Resource - private SupplierService supplierService; - - @PostMapping("/create") - @Operation(summary = "创建供应商") - @PreAuthorize("@ss.hasPermission('heli:supplier:create')") - public CommonResult createSupplier(@Valid @RequestBody SupplierSaveReqVO createReqVO) { - return success(supplierService.createSupplier(createReqVO)); - } - - @PutMapping("/update") - @Operation(summary = "更新供应商") - @PreAuthorize("@ss.hasPermission('heli:supplier:update')") - public CommonResult updateSupplier(@Valid @RequestBody SupplierSaveReqVO updateReqVO) { - supplierService.updateSupplier(updateReqVO); - return success(true); - } - - @DeleteMapping("/delete") - @Operation(summary = "删除供应商") - @Parameter(name = "id", description = "编号", required = true) - @PreAuthorize("@ss.hasPermission('heli:supplier:delete')") - public CommonResult deleteSupplier(@RequestParam("id") Long id) { - supplierService.deleteSupplier(id); - return success(true); - } - - @GetMapping("/get") - @Operation(summary = "获得供应商") - @Parameter(name = "id", description = "编号", required = true, example = "1024") - @PreAuthorize("@ss.hasPermission('heli:supplier:query')") - public CommonResult getSupplier(@RequestParam("id") Long id) { - SupplierDO supplier = supplierService.getSupplier(id); - return success(BeanUtils.toBean(supplier, SupplierRespVO.class)); - } - - @GetMapping("/page") - @Operation(summary = "获得供应商分页") - @PreAuthorize("@ss.hasPermission('heli:supplier:query')") - public CommonResult> getSupplierPage(@Valid SupplierPageReqVO pageReqVO) { - PageResult pageResult = supplierService.getSupplierPage(pageReqVO); - return success(BeanUtils.toBean(pageResult, SupplierRespVO.class)); - } - - @GetMapping("/export-excel") - @Operation(summary = "导出供应商 Excel") - @PreAuthorize("@ss.hasPermission('heli:supplier:export')") - @OperateLog(type = EXPORT) - public void exportSupplierExcel(@Valid SupplierPageReqVO pageReqVO, - HttpServletResponse response) throws IOException { - pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); - List list = supplierService.getSupplierPage(pageReqVO).getList(); - // 导出 Excel - ExcelUtils.write(response, "供应商.xls", "数据", SupplierRespVO.class, - BeanUtils.toBean(list, SupplierRespVO.class)); - } - -} \ No newline at end of file +package com.chanko.yunxi.mes.module.heli.controller.admin.supplier; + +import org.springframework.web.bind.annotation.*; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Operation; + +import javax.validation.constraints.*; +import javax.validation.*; +import javax.servlet.http.*; +import java.util.*; +import java.io.IOException; + +import com.chanko.yunxi.mes.framework.common.pojo.PageParam; +import com.chanko.yunxi.mes.framework.common.pojo.PageResult; +import com.chanko.yunxi.mes.framework.common.pojo.CommonResult; +import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils; +import static com.chanko.yunxi.mes.framework.common.pojo.CommonResult.success; + +import com.chanko.yunxi.mes.framework.excel.core.util.ExcelUtils; + +import com.chanko.yunxi.mes.framework.operatelog.core.annotations.OperateLog; +import static com.chanko.yunxi.mes.framework.operatelog.core.enums.OperateTypeEnum.*; + +import com.chanko.yunxi.mes.module.heli.controller.admin.supplier.vo.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.supplier.SupplierDO; +import com.chanko.yunxi.mes.module.heli.service.supplier.SupplierService; + +@Tag(name = "管理后台 - 供应商") +@RestController +@RequestMapping("/heli/supplier") +@Validated +public class SupplierController { + + @Resource + private SupplierService supplierService; + + @PostMapping("/create") + @Operation(summary = "创建供应商") + @PreAuthorize("@ss.hasPermission('heli:supplier:create')") + public CommonResult createSupplier(@Valid @RequestBody SupplierSaveReqVO createReqVO) { + return success(supplierService.createSupplier(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新供应商") + @PreAuthorize("@ss.hasPermission('heli:supplier:update')") + public CommonResult updateSupplier(@Valid @RequestBody SupplierSaveReqVO updateReqVO) { + supplierService.updateSupplier(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除供应商") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('heli:supplier:delete')") + public CommonResult deleteSupplier(@RequestParam("id") Long id) { + supplierService.deleteSupplier(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得供应商") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('heli:supplier:query')") + public CommonResult getSupplier(@RequestParam("id") Long id) { + SupplierDO supplier = supplierService.getSupplier(id); + return success(BeanUtils.toBean(supplier, SupplierRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得供应商分页") + @PreAuthorize("@ss.hasPermission('heli:supplier:query')") + public CommonResult> getSupplierPage(@Valid SupplierPageReqVO pageReqVO) { + PageResult pageResult = supplierService.getSupplierPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, SupplierRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出供应商 Excel") + @PreAuthorize("@ss.hasPermission('heli:supplier:export')") + @OperateLog(type = EXPORT) + public void exportSupplierExcel(@Valid SupplierPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = supplierService.getSupplierPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "供应商.xls", "数据", SupplierRespVO.class, + BeanUtils.toBean(list, SupplierRespVO.class)); + } + + @GetMapping({"/all-simples"}) + @Operation(summary = "TODO:获取供应商精简信息列表", description = "只包含被开启的供应商,主要用于前端的下拉选项") + public CommonResult> > getSimpleList() { + List> list = supplierService.getSimpleList(); + // 拼接数据 + return success(list); + } + @GetMapping({"/all-no-status-simples"}) + @Operation(summary = "TODO:获取供应商精简信息列表", description = "全部供应商,主要用于前端的下拉选项") + public CommonResult> > getSimpleNoStatusList() { + List> list = supplierService.getSimpleNoStatusList(); + // 拼接数据 + return success(list); + } +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/purchaseorder/PurchaseOrderDO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/purchaseorder/PurchaseOrderDO.java new file mode 100644 index 00000000..d7b4eb78 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/purchaseorder/PurchaseOrderDO.java @@ -0,0 +1,110 @@ +package com.chanko.yunxi.mes.module.heli.dal.dataobject.purchaseorder; + +import lombok.*; +import java.util.*; +import java.math.BigDecimal; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import com.chanko.yunxi.mes.framework.mybatis.core.dataobject.BaseDO; + +/** + * 采购订单 DO + * + * @author 管理员 + */ +@TableName("project_purchase_order") +@KeySequence("project_purchase_order_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class PurchaseOrderDO extends BaseDO { + + /** + * 自增字段,唯一 + */ + @TableId + private Long id; + /** + * 采购单号 + */ + private String purchaseNo; + /** + * 供应商id + */ + private Long supplierId; + /** + * 采购合同号 + */ + private String contractNo; + /** + * 采购单类型,1按物料需求计划采购,2备库采购 + * + * 枚举 {@link TODO heli_project_purchase_order_type 对应的类} + */ + private Integer purchaseType; + /** + * 供应商id + */ + private Long projectMaterialPlanId; + /** + * 采购物类型,1物料,2加工件 + * + * 枚举 {@link TODO heli_project_purchase_goods_type 对应的类} + */ + private Integer goodsType; + /** + * 结算币种 + */ + private Integer currencyType; + /** + * 税率 + */ + private Integer taxRatio; + /** + * 暂估价金额 + */ + private BigDecimal estimatedPrice; + /** + * 实际价金额 + */ + private BigDecimal actualPrice; + /** + * 状态,1已保存,2已送审,3已审核,4已打回 ,默认是1 + * + * 枚举 {@link TODO heli_purchase_order_status 对应的类} + */ + private Integer status; + /** + * 送审人 + */ + private Long submitUserId; + /** + * 送审时间 + */ + private LocalDateTime submitTime; + /** + * 审核人 + */ + private Long auditor; + /** + * 审核时间 + */ + private LocalDateTime auditTime; + /** + * 备注 + */ + private String description; + + @TableField(exist = false) + private String supplierName; + @TableField(exist = false) + private String materialPlanNo; + +} \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/purchaseordermaterial/PurchaseOrderMaterialDO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/purchaseordermaterial/PurchaseOrderMaterialDO.java new file mode 100644 index 00000000..f370819d --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/purchaseordermaterial/PurchaseOrderMaterialDO.java @@ -0,0 +1,62 @@ +package com.chanko.yunxi.mes.module.heli.dal.dataobject.purchaseordermaterial; + +import lombok.*; +import java.util.*; +import java.math.BigDecimal; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import com.chanko.yunxi.mes.framework.mybatis.core.dataobject.BaseDO; + +/** + * 采购单物料 DO + * + * @author 管理员 + */ +@TableName("project_purchase_order_material") +@KeySequence("project_purchase_order_material_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class PurchaseOrderMaterialDO extends BaseDO { + + /** + * 自增字段,唯一 + */ + @TableId + private Long id; + /** + * 采购单编号 + */ + private Long purchaseOrderId; + /** + * 物料id + */ + private Long materialId; + /** + * 采购数量 + */ + private Long purchaseAmount; + /** + * 暂估价金额 + */ + private BigDecimal estimatedPrice; + /** + * 实际价金额 + */ + private BigDecimal actualPrice; + /** + * 预计到期日期 + */ + private LocalDateTime arriveTime; + /** + * 备注 + */ + private String description; + +} \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/purchaseorder/PurchaseOrderMapper.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/purchaseorder/PurchaseOrderMapper.java new file mode 100644 index 00000000..aae6b0a5 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/purchaseorder/PurchaseOrderMapper.java @@ -0,0 +1,91 @@ +package com.chanko.yunxi.mes.module.heli.dal.mysql.purchaseorder; + +import java.util.*; + +import com.chanko.yunxi.mes.framework.common.pojo.PageResult; +import com.chanko.yunxi.mes.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.chanko.yunxi.mes.framework.mybatis.core.mapper.BaseMapperX; +import com.chanko.yunxi.mes.module.heli.controller.admin.materialplan.vo.MaterialPlanPageReqVO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.materialplan.MaterialPlanDO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.plan.PlanDO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.projectorder.ProjectOrderDO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.purchaseorder.PurchaseOrderDO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.supplier.SupplierDO; +import com.github.yulichang.wrapper.MPJLambdaWrapper; +import org.apache.ibatis.annotations.Mapper; +import com.chanko.yunxi.mes.module.heli.controller.admin.purchaseorder.vo.*; +import org.springframework.util.StringUtils; + +/** + * 采购订单 Mapper + * + * @author 管理员 + */ +@Mapper +public interface PurchaseOrderMapper extends BaseMapperX { + + default PageResult selectPage(PurchaseOrderPageReqVO reqVO) { + MPJLambdaWrapper query = new MPJLambdaWrapper<>(); + + query.selectAll(PurchaseOrderDO.class) + .select("s.name as supplierName","m.project_material_plan_no as materialPlanNo") + .leftJoin(SupplierDO.class, "s", SupplierDO::getId, PurchaseOrderDO::getSupplierId) + .leftJoin(MaterialPlanDO.class, "m", MaterialPlanDO::getId, PurchaseOrderDO::getProjectMaterialPlanId) + .disableSubLogicDel() + .orderByDesc(PurchaseOrderDO::getCreateTime); + query.like(!StringUtils.isEmpty(reqVO.getPurchaseNo()), PurchaseOrderDO::getPurchaseNo, reqVO.getPurchaseNo()) + .like(!StringUtils.isEmpty(reqVO.getSupplierName()), "s.name", reqVO.getSupplierName()) + .like(!StringUtils.isEmpty(reqVO.getMaterialPlanNo()), "m.project_material_plan_no", reqVO.getMaterialPlanNo()) + .apply(reqVO.getCreateTime() != null, "DATE_FORMAT(t.create_time,'%Y-%m-%d') = {0}", reqVO.getCreateTime()) + .eq(reqVO.getStatus() != null, PurchaseOrderDO::getStatus, reqVO.getStatus()) + .eq(reqVO.getPurchaseType() != null, PurchaseOrderDO::getPurchaseType, reqVO.getPurchaseType()) + .eq(reqVO.getGoodsType() != null, PurchaseOrderDO::getGoodsType, reqVO.getGoodsType()); + + return selectPage(reqVO, query); + } + + default PageResult selectListWithRatio(PurchaseOrderPageReqVO reqVO) { + MPJLambdaWrapper query = new MPJLambdaWrapper<>(); + + query.selectAll(PurchaseOrderDO.class) + .select("s.name as supplierName","m.project_material_plan_no as materialPlanNo","(case when t.tax_ratio!=Null and t.estimated_price!=null then t.estimated_price*t.tax_ratio else '' end) as estimated_price","(case when t.tax_ratio!=Null and t.actual_price!=null then t.actual_price*t.tax_ratio else '' end) as actual_price") + .leftJoin(SupplierDO.class, "s", SupplierDO::getId, PurchaseOrderDO::getSupplierId) + .leftJoin(MaterialPlanDO.class, "m", MaterialPlanDO::getId, PurchaseOrderDO::getProjectMaterialPlanId) + .disableSubLogicDel() + .orderByDesc(PurchaseOrderDO::getCreateTime); + query.like(!StringUtils.isEmpty(reqVO.getPurchaseNo()), PurchaseOrderDO::getPurchaseNo, reqVO.getPurchaseNo()) + .like(!StringUtils.isEmpty(reqVO.getSupplierName()), "s.name", reqVO.getSupplierName()) + .like(!StringUtils.isEmpty(reqVO.getMaterialPlanNo()), "m.project_material_plan_no", reqVO.getMaterialPlanNo()) + .apply(reqVO.getCreateTime() != null, "DATE_FORMAT(t.create_time,'%Y-%m-%d') = {0}", reqVO.getCreateTime()) + .eq(reqVO.getStatus() != null, PurchaseOrderDO::getStatus, reqVO.getStatus()) + .eq(reqVO.getPurchaseType() != null, PurchaseOrderDO::getPurchaseType, reqVO.getPurchaseType()) + .eq(reqVO.getGoodsType() != null, PurchaseOrderDO::getGoodsType, reqVO.getGoodsType()); + + return selectPage(reqVO, query); + } + +// default PageResult selectPage(PurchaseOrderPageReqVO reqVO) { +// return selectPage(reqVO, new LambdaQueryWrapperX() +// .eqIfPresent(PurchaseOrderDO::getId, reqVO.getId()) +// .eqIfPresent(PurchaseOrderDO::getPurchaseNo, reqVO.getPurchaseNo()) +// .eqIfPresent(PurchaseOrderDO::getSupplierId, reqVO.getSupplierId()) +// .eqIfPresent(PurchaseOrderDO::getContractNo, reqVO.getContractNo()) +// .eqIfPresent(PurchaseOrderDO::getPurchaseType, reqVO.getPurchaseType()) +// .eqIfPresent(PurchaseOrderDO::getProjectMaterialPlanId, reqVO.getProjectMaterialPlanId()) +// .eqIfPresent(PurchaseOrderDO::getGoodsType, reqVO.getGoodsType()) +// .eqIfPresent(PurchaseOrderDO::getCurrencyType, reqVO.getCurrencyType()) +// .eqIfPresent(PurchaseOrderDO::getTaxRatio, reqVO.getTaxRatio()) +// .eqIfPresent(PurchaseOrderDO::getEstimatedPrice, reqVO.getEstimatedPrice()) +// .eqIfPresent(PurchaseOrderDO::getActualPrice, reqVO.getActualPrice()) +// .eqIfPresent(PurchaseOrderDO::getStatus, reqVO.getStatus()) +// .eqIfPresent(PurchaseOrderDO::getSubmitUserId, reqVO.getSubmitUserId()) +// .betweenIfPresent(PurchaseOrderDO::getSubmitTime, reqVO.getSubmitTime()) +// .eqIfPresent(PurchaseOrderDO::getAuditor, reqVO.getAuditor()) +// .betweenIfPresent(PurchaseOrderDO::getAuditTime, reqVO.getAuditTime()) +// .eqIfPresent(PurchaseOrderDO::getDescription, reqVO.getDescription()) +// .eqIfPresent(PurchaseOrderDO::getCreator, reqVO.getCreator()) +// .betweenIfPresent(PurchaseOrderDO::getCreateTime, reqVO.getCreateTime()) +// .orderByDesc(PurchaseOrderDO::getId)); +// } + +} \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/purchaseordermaterial/PurchaseOrderMaterialMapper.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/purchaseordermaterial/PurchaseOrderMaterialMapper.java new file mode 100644 index 00000000..2e971f08 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/purchaseordermaterial/PurchaseOrderMaterialMapper.java @@ -0,0 +1,33 @@ +package com.chanko.yunxi.mes.module.heli.dal.mysql.purchaseordermaterial; + +import java.util.*; + +import com.chanko.yunxi.mes.framework.common.pojo.PageResult; +import com.chanko.yunxi.mes.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.chanko.yunxi.mes.framework.mybatis.core.mapper.BaseMapperX; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.purchaseordermaterial.PurchaseOrderMaterialDO; +import org.apache.ibatis.annotations.Mapper; +import com.chanko.yunxi.mes.module.heli.controller.admin.purchaseordermaterial.vo.*; + +/** + * 采购单物料 Mapper + * + * @author 管理员 + */ +@Mapper +public interface PurchaseOrderMaterialMapper extends BaseMapperX { + + default PageResult selectPage(PurchaseOrderMaterialPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(PurchaseOrderMaterialDO::getPurchaseOrderId, reqVO.getPurchaseOrderId()) + .eqIfPresent(PurchaseOrderMaterialDO::getMaterialId, reqVO.getMaterialId()) + .eqIfPresent(PurchaseOrderMaterialDO::getPurchaseAmount, reqVO.getPurchaseAmount()) + .eqIfPresent(PurchaseOrderMaterialDO::getEstimatedPrice, reqVO.getEstimatedPrice()) + .eqIfPresent(PurchaseOrderMaterialDO::getActualPrice, reqVO.getActualPrice()) + .betweenIfPresent(PurchaseOrderMaterialDO::getArriveTime, reqVO.getArriveTime()) + .eqIfPresent(PurchaseOrderMaterialDO::getDescription, reqVO.getDescription()) + .betweenIfPresent(PurchaseOrderMaterialDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(PurchaseOrderMaterialDO::getId)); + } + +} \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/supplier/SupplierMapper.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/supplier/SupplierMapper.java index cee100e1..61244e2e 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/supplier/SupplierMapper.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/supplier/SupplierMapper.java @@ -2,10 +2,12 @@ package com.chanko.yunxi.mes.module.heli.dal.mysql.supplier; import java.util.*; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.chanko.yunxi.mes.framework.common.pojo.PageResult; import com.chanko.yunxi.mes.framework.mybatis.core.query.LambdaQueryWrapperX; import com.chanko.yunxi.mes.framework.mybatis.core.mapper.BaseMapperX; import com.chanko.yunxi.mes.module.heli.dal.dataobject.supplier.SupplierDO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.warehouse.WarehouseDO; import org.apache.ibatis.annotations.Mapper; import com.chanko.yunxi.mes.module.heli.controller.admin.supplier.vo.*; @@ -55,5 +57,14 @@ public interface SupplierMapper extends BaseMapperX { .eqIfPresent(SupplierDO::getTaxNo, reqVO.getTaxNo()) .orderByDesc(SupplierDO::getId)); } + default List> selectSimpleList() { + return selectMaps(new QueryWrapper().select("id", "name").eq("status","1").lambda()); + + } + default List> selectSimpleNoStatusList() { + + return selectMaps(new QueryWrapper().select("id", "name").lambda()); + + } } \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/purchaseorder/PurchaseOrderService.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/purchaseorder/PurchaseOrderService.java new file mode 100644 index 00000000..bd44c727 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/purchaseorder/PurchaseOrderService.java @@ -0,0 +1,55 @@ +package com.chanko.yunxi.mes.module.heli.service.purchaseorder; + +import java.util.*; +import javax.validation.*; +import com.chanko.yunxi.mes.module.heli.controller.admin.purchaseorder.vo.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.purchaseorder.PurchaseOrderDO; +import com.chanko.yunxi.mes.framework.common.pojo.PageResult; +import com.chanko.yunxi.mes.framework.common.pojo.PageParam; + +/** + * 采购订单 Service 接口 + * + * @author 管理员 + */ +public interface PurchaseOrderService { + + /** + * 创建采购订单 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createPurchaseOrder(@Valid PurchaseOrderSaveReqVO createReqVO); + + /** + * 更新采购订单 + * + * @param updateReqVO 更新信息 + */ + void updatePurchaseOrder(@Valid PurchaseOrderSaveReqVO updateReqVO); + + /** + * 删除采购订单 + * + * @param id 编号 + */ + void deletePurchaseOrder(Long id); + + /** + * 获得采购订单 + * + * @param id 编号 + * @return 采购订单 + */ + PurchaseOrderDO getPurchaseOrder(Long id); + + /** + * 获得采购订单分页 + * + * @param pageReqVO 分页查询 + * @return 采购订单分页 + */ + PageResult getPurchaseOrderPage(PurchaseOrderPageReqVO pageReqVO); + +} \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/purchaseorder/PurchaseOrderServiceImpl.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/purchaseorder/PurchaseOrderServiceImpl.java new file mode 100644 index 00000000..9d913d49 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/purchaseorder/PurchaseOrderServiceImpl.java @@ -0,0 +1,92 @@ +package com.chanko.yunxi.mes.module.heli.service.purchaseorder; + +import com.chanko.yunxi.mes.module.heli.dal.dataobject.serialnumber.SerialNumberDO; +import com.chanko.yunxi.mes.module.heli.service.serialnumber.SerialNumberService; +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.transaction.annotation.Transactional; + +import java.text.SimpleDateFormat; +import java.util.*; +import com.chanko.yunxi.mes.module.heli.controller.admin.purchaseorder.vo.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.purchaseorder.PurchaseOrderDO; +import com.chanko.yunxi.mes.framework.common.pojo.PageResult; +import com.chanko.yunxi.mes.framework.common.pojo.PageParam; +import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils; + +import com.chanko.yunxi.mes.module.heli.dal.mysql.purchaseorder.PurchaseOrderMapper; + +import static com.chanko.yunxi.mes.framework.common.exception.util.ServiceExceptionUtil.exception; +import static com.chanko.yunxi.mes.module.heli.enums.CodeEnum.MATERIAL_PLAN; +import static com.chanko.yunxi.mes.module.heli.enums.CodeEnum.PURCHASE_ORDER; +import static com.chanko.yunxi.mes.module.heli.enums.ErrorCodeConstants.*; + +/** + * 采购订单 Service 实现类 + * + * @author 管理员 + */ +@Service +@Validated +public class PurchaseOrderServiceImpl implements PurchaseOrderService { + + @Resource + private PurchaseOrderMapper purchaseOrderMapper; + + @Resource + private SerialNumberService serialNumberService; + + @Override + public Long createPurchaseOrder(PurchaseOrderSaveReqVO createReqVO) { + // 插入 + PurchaseOrderDO purchaseOrder = BeanUtils.toBean(createReqVO, PurchaseOrderDO.class); + + + // 月度流水号 + SerialNumberDO serialNumberDO = new SerialNumberDO(); + serialNumberDO = serialNumberService.getSerialNumber(PURCHASE_ORDER.name(), new SimpleDateFormat("yyyyMMdd").format(new Date())); + serialNumberDO.setSerialNumber(serialNumberDO.getSerialNumber()+1); + + purchaseOrder.setPurchaseNo(PURCHASE_ORDER.getCode(serialNumberDO.getSerialNumber().toString())); + purchaseOrderMapper.insert(purchaseOrder); + // 回写序列记录 + serialNumberService.updateSerialNumber(serialNumberDO); + // 返回 + return purchaseOrder.getId(); + } + + @Override + public void updatePurchaseOrder(PurchaseOrderSaveReqVO updateReqVO) { + // 校验存在 + validatePurchaseOrderExists(updateReqVO.getId()); + // 更新 + PurchaseOrderDO updateObj = BeanUtils.toBean(updateReqVO, PurchaseOrderDO.class); + purchaseOrderMapper.updateById(updateObj); + } + + @Override + public void deletePurchaseOrder(Long id) { + // 校验存在 + validatePurchaseOrderExists(id); + // 删除 + purchaseOrderMapper.deleteById(id); + } + + private void validatePurchaseOrderExists(Long id) { + if (purchaseOrderMapper.selectById(id) == null) { + throw exception(PURCHASE_ORDER_NOT_EXISTS); + } + } + + @Override + public PurchaseOrderDO getPurchaseOrder(Long id) { + return purchaseOrderMapper.selectById(id); + } + + @Override + public PageResult getPurchaseOrderPage(PurchaseOrderPageReqVO pageReqVO) { + return purchaseOrderMapper.selectPage(pageReqVO); + } + +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/purchaseordermaterial/PurchaseOrderMaterialService.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/purchaseordermaterial/PurchaseOrderMaterialService.java new file mode 100644 index 00000000..c2e75dbd --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/purchaseordermaterial/PurchaseOrderMaterialService.java @@ -0,0 +1,55 @@ +package com.chanko.yunxi.mes.module.heli.service.purchaseordermaterial; + +import java.util.*; +import javax.validation.*; +import com.chanko.yunxi.mes.module.heli.controller.admin.purchaseordermaterial.vo.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.purchaseordermaterial.PurchaseOrderMaterialDO; +import com.chanko.yunxi.mes.framework.common.pojo.PageResult; +import com.chanko.yunxi.mes.framework.common.pojo.PageParam; + +/** + * 采购单物料 Service 接口 + * + * @author 管理员 + */ +public interface PurchaseOrderMaterialService { + + /** + * 创建采购单物料 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createPurchaseOrderMaterial(@Valid PurchaseOrderMaterialSaveReqVO createReqVO); + + /** + * 更新采购单物料 + * + * @param updateReqVO 更新信息 + */ + void updatePurchaseOrderMaterial(@Valid PurchaseOrderMaterialSaveReqVO updateReqVO); + + /** + * 删除采购单物料 + * + * @param id 编号 + */ + void deletePurchaseOrderMaterial(Long id); + + /** + * 获得采购单物料 + * + * @param id 编号 + * @return 采购单物料 + */ + PurchaseOrderMaterialDO getPurchaseOrderMaterial(Long id); + + /** + * 获得采购单物料分页 + * + * @param pageReqVO 分页查询 + * @return 采购单物料分页 + */ + PageResult getPurchaseOrderMaterialPage(PurchaseOrderMaterialPageReqVO pageReqVO); + +} \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/purchaseordermaterial/PurchaseOrderMaterialServiceImpl.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/purchaseordermaterial/PurchaseOrderMaterialServiceImpl.java new file mode 100644 index 00000000..bf2363ad --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/purchaseordermaterial/PurchaseOrderMaterialServiceImpl.java @@ -0,0 +1,74 @@ +package com.chanko.yunxi.mes.module.heli.service.purchaseordermaterial; + +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; +import com.chanko.yunxi.mes.module.heli.controller.admin.purchaseordermaterial.vo.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.purchaseordermaterial.PurchaseOrderMaterialDO; +import com.chanko.yunxi.mes.framework.common.pojo.PageResult; +import com.chanko.yunxi.mes.framework.common.pojo.PageParam; +import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils; + +import com.chanko.yunxi.mes.module.heli.dal.mysql.purchaseordermaterial.PurchaseOrderMaterialMapper; + +import static com.chanko.yunxi.mes.framework.common.exception.util.ServiceExceptionUtil.exception; +import static com.chanko.yunxi.mes.module.heli.enums.ErrorCodeConstants.*; + +/** + * 采购单物料 Service 实现类 + * + * @author 管理员 + */ +@Service +@Validated +public class PurchaseOrderMaterialServiceImpl implements PurchaseOrderMaterialService { + + @Resource + private PurchaseOrderMaterialMapper purchaseOrderMaterialMapper; + + @Override + public Long createPurchaseOrderMaterial(PurchaseOrderMaterialSaveReqVO createReqVO) { + // 插入 + PurchaseOrderMaterialDO purchaseOrderMaterial = BeanUtils.toBean(createReqVO, PurchaseOrderMaterialDO.class); + purchaseOrderMaterialMapper.insert(purchaseOrderMaterial); + // 返回 + return purchaseOrderMaterial.getId(); + } + + @Override + public void updatePurchaseOrderMaterial(PurchaseOrderMaterialSaveReqVO updateReqVO) { + // 校验存在 + validatePurchaseOrderMaterialExists(updateReqVO.getId()); + // 更新 + PurchaseOrderMaterialDO updateObj = BeanUtils.toBean(updateReqVO, PurchaseOrderMaterialDO.class); + purchaseOrderMaterialMapper.updateById(updateObj); + } + + @Override + public void deletePurchaseOrderMaterial(Long id) { + // 校验存在 + validatePurchaseOrderMaterialExists(id); + // 删除 + purchaseOrderMaterialMapper.deleteById(id); + } + + private void validatePurchaseOrderMaterialExists(Long id) { + if (purchaseOrderMaterialMapper.selectById(id) == null) { + throw exception(PURCHASE_ORDER_MATERIAL_NOT_EXISTS); + } + } + + @Override + public PurchaseOrderMaterialDO getPurchaseOrderMaterial(Long id) { + return purchaseOrderMaterialMapper.selectById(id); + } + + @Override + public PageResult getPurchaseOrderMaterialPage(PurchaseOrderMaterialPageReqVO pageReqVO) { + return purchaseOrderMaterialMapper.selectPage(pageReqVO); + } + +} \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/supplier/SupplierService.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/supplier/SupplierService.java index 23725a77..f81a3fcd 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/supplier/SupplierService.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/supplier/SupplierService.java @@ -1,55 +1,59 @@ -package com.chanko.yunxi.mes.module.heli.service.supplier; - -import java.util.*; -import javax.validation.*; -import com.chanko.yunxi.mes.module.heli.controller.admin.supplier.vo.*; -import com.chanko.yunxi.mes.module.heli.dal.dataobject.supplier.SupplierDO; -import com.chanko.yunxi.mes.framework.common.pojo.PageResult; -import com.chanko.yunxi.mes.framework.common.pojo.PageParam; - -/** - * 供应商 Service 接口 - * - * @author 管理员 - */ -public interface SupplierService { - - /** - * 创建供应商 - * - * @param createReqVO 创建信息 - * @return 编号 - */ - Long createSupplier(@Valid SupplierSaveReqVO createReqVO); - - /** - * 更新供应商 - * - * @param updateReqVO 更新信息 - */ - void updateSupplier(@Valid SupplierSaveReqVO updateReqVO); - - /** - * 删除供应商 - * - * @param id 编号 - */ - void deleteSupplier(Long id); - - /** - * 获得供应商 - * - * @param id 编号 - * @return 供应商 - */ - SupplierDO getSupplier(Long id); - - /** - * 获得供应商分页 - * - * @param pageReqVO 分页查询 - * @return 供应商分页 - */ - PageResult getSupplierPage(SupplierPageReqVO pageReqVO); - -} \ No newline at end of file +package com.chanko.yunxi.mes.module.heli.service.supplier; + +import java.util.*; +import javax.validation.*; +import com.chanko.yunxi.mes.module.heli.controller.admin.supplier.vo.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.supplier.SupplierDO; +import com.chanko.yunxi.mes.framework.common.pojo.PageResult; +import com.chanko.yunxi.mes.framework.common.pojo.PageParam; + +/** + * 供应商 Service 接口 + * + * @author 管理员 + */ +public interface SupplierService { + + /** + * 创建供应商 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createSupplier(@Valid SupplierSaveReqVO createReqVO); + + /** + * 更新供应商 + * + * @param updateReqVO 更新信息 + */ + void updateSupplier(@Valid SupplierSaveReqVO updateReqVO); + + /** + * 删除供应商 + * + * @param id 编号 + */ + void deleteSupplier(Long id); + + /** + * 获得供应商 + * + * @param id 编号 + * @return 供应商 + */ + SupplierDO getSupplier(Long id); + + /** + * 获得供应商分页 + * + * @param pageReqVO 分页查询 + * @return 供应商分页 + */ + PageResult getSupplierPage(SupplierPageReqVO pageReqVO); + + List> getSimpleList(); + + List> getSimpleNoStatusList(); + +} diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/supplier/SupplierServiceImpl.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/supplier/SupplierServiceImpl.java index 4354cd1c..a38221ae 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/supplier/SupplierServiceImpl.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/supplier/SupplierServiceImpl.java @@ -90,4 +90,14 @@ public class SupplierServiceImpl implements SupplierService { throw exception(CODE_REPEAT); } } + + @Override + public List> getSimpleList() { + return supplierMapper.selectSimpleList(); + } + + @Override + public List> getSimpleNoStatusList() { + return supplierMapper.selectSimpleNoStatusList(); + } } diff --git a/mes-module-heli/mes-module-heli-biz/src/main/resources/mapper/purchaseorder/PurchaseOrderMapper.xml b/mes-module-heli/mes-module-heli-biz/src/main/resources/mapper/purchaseorder/PurchaseOrderMapper.xml new file mode 100644 index 00000000..a0ceec40 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/resources/mapper/purchaseorder/PurchaseOrderMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/mes-module-heli/mes-module-heli-biz/src/main/resources/mapper/purchaseordermaterial/PurchaseOrderMaterialMapper.xml b/mes-module-heli/mes-module-heli-biz/src/main/resources/mapper/purchaseordermaterial/PurchaseOrderMaterialMapper.xml new file mode 100644 index 00000000..fd478fa7 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/resources/mapper/purchaseordermaterial/PurchaseOrderMaterialMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/mes-ui/mes-ui-admin-vue3/src/api/heli/purchaseorder/index.ts b/mes-ui/mes-ui-admin-vue3/src/api/heli/purchaseorder/index.ts new file mode 100644 index 00000000..7deb9aff --- /dev/null +++ b/mes-ui/mes-ui-admin-vue3/src/api/heli/purchaseorder/index.ts @@ -0,0 +1,51 @@ +import request from '@/config/axios' + +export interface PurchaseOrderVO { + id: number + purchaseNo: string + supplierId: number + contractNo: string + purchaseType: number + projectMaterialPlanId: number + goodsType: number + currencyType: number + taxRatio: number + estimatedPrice: number + actualPrice: number + status: boolean + submitUserId: number + submitTime: Date + auditor: number + auditTime: Date + description: string +} + +// 查询采购订单分页 +export const getPurchaseOrderPage = async (params) => { + return await request.get({ url: `/heli/purchase-order/page`, params }) +} + +// 查询采购订单详情 +export const getPurchaseOrder = async (id: number) => { + return await request.get({ url: `/heli/purchase-order/get?id=` + id }) +} + +// 新增采购订单 +export const createPurchaseOrder = async (data: PurchaseOrderVO) => { + return await request.post({ url: `/heli/purchase-order/create`, data }) +} + +// 修改采购订单 +export const updatePurchaseOrder = async (data: PurchaseOrderVO) => { + return await request.put({ url: `/heli/purchase-order/update`, data }) +} + +// 删除采购订单 +export const deletePurchaseOrder = async (id: number) => { + return await request.delete({ url: `/heli/purchase-order/delete?id=` + id }) +} + +// 导出采购订单 Excel +export const exportPurchaseOrder = async (params) => { + return await request.download({ url: `/heli/purchase-order/export-excel`, params }) +} \ No newline at end of file diff --git a/mes-ui/mes-ui-admin-vue3/src/api/heli/purchaseordermaterial/index.ts b/mes-ui/mes-ui-admin-vue3/src/api/heli/purchaseordermaterial/index.ts new file mode 100644 index 00000000..4244b9c6 --- /dev/null +++ b/mes-ui/mes-ui-admin-vue3/src/api/heli/purchaseordermaterial/index.ts @@ -0,0 +1,42 @@ +import request from '@/config/axios' + +export interface PurchaseOrderMaterialVO { + id: number + purchaseOrderId: number + materialId: number + purchaseAmount: number + estimatedPrice: number + actualPrice: number + arriveTime: Date + description: string +} + +// 查询采购单物料分页 +export const getPurchaseOrderMaterialPage = async (params) => { + return await request.get({ url: `/heli/purchase-order-material/page`, params }) +} + +// 查询采购单物料详情 +export const getPurchaseOrderMaterial = async (id: number) => { + return await request.get({ url: `/heli/purchase-order-material/get?id=` + id }) +} + +// 新增采购单物料 +export const createPurchaseOrderMaterial = async (data: PurchaseOrderMaterialVO) => { + return await request.post({ url: `/heli/purchase-order-material/create`, data }) +} + +// 修改采购单物料 +export const updatePurchaseOrderMaterial = async (data: PurchaseOrderMaterialVO) => { + return await request.put({ url: `/heli/purchase-order-material/update`, data }) +} + +// 删除采购单物料 +export const deletePurchaseOrderMaterial = async (id: number) => { + return await request.delete({ url: `/heli/purchase-order-material/delete?id=` + id }) +} + +// 导出采购单物料 Excel +export const exportPurchaseOrderMaterial = async (params) => { + return await request.download({ url: `/heli/purchase-order-material/export-excel`, params }) +} \ No newline at end of file diff --git a/mes-ui/mes-ui-admin-vue3/src/api/heli/supplier/index.ts b/mes-ui/mes-ui-admin-vue3/src/api/heli/supplier/index.ts index 2d77ffab..4b09ae8f 100644 --- a/mes-ui/mes-ui-admin-vue3/src/api/heli/supplier/index.ts +++ b/mes-ui/mes-ui-admin-vue3/src/api/heli/supplier/index.ts @@ -1,65 +1,72 @@ -import request from '@/config/axios' - -export interface SupplierVO { - id: number - code: string - brief: string - name: string - industry: string - level: number - category: number - userId: number - description: string - contact1Name: string - contact1Post: string - contact1Method: string - contact1Email: string - contact1Addr: string - contact2Name: string - contact2Post: string - contact2Method: string - contact2Email: string - contact2Addr: string - contact3Name: string - contact3Post: string - contact3Method: string - contact3Email: string - contact3Addr: string - status: number - logo: string - payType: string - accountName: string - bankNo: string - bankAddress: string - taxNo: string -} - -// 查询供应商分页 -export const getSupplierPage = async (params) => { - return await request.get({ url: `/heli/supplier/page`, params }) -} - -// 查询供应商详情 -export const getSupplier = async (id: number) => { - return await request.get({ url: `/heli/supplier/get?id=` + id }) -} - -// 新增供应商 -export const createSupplier = async (data: SupplierVO) => { - return await request.post({ url: `/heli/supplier/create`, data }) -} - -// 修改供应商 -export const updateSupplier = async (data: SupplierVO) => { - return await request.put({ url: `/heli/supplier/update`, data }) -} - -// 删除供应商 -export const deleteSupplier = async (id: number) => { - return await request.delete({ url: `/heli/supplier/delete?id=` + id }) -} - -// 导出供应商 Excel -export const exportSupplier = async (params) => { - return await request.download({ url: `/heli/supplier/export-excel`, params }) -} \ No newline at end of file +import request from '@/config/axios' + +export interface SupplierVO { + id: number + code: string + brief: string + name: string + industry: string + level: number + category: number + userId: number + description: string + contact1Name: string + contact1Post: string + contact1Method: string + contact1Email: string + contact1Addr: string + contact2Name: string + contact2Post: string + contact2Method: string + contact2Email: string + contact2Addr: string + contact3Name: string + contact3Post: string + contact3Method: string + contact3Email: string + contact3Addr: string + status: number + logo: string + payType: string + accountName: string + bankNo: string + bankAddress: string + taxNo: string +} +// 查询仓库分页 +export const getSimpNoStatusList = async () => { + return await request.get({ url: `/heli/supplier/all-no-status-simples` }) +} +// 查询仓库分页 +export const getSimpList = async () => { + return await request.get({ url: `/heli/supplier/all-simples` }) +} +// 查询供应商分页 +export const getSupplierPage = async (params) => { + return await request.get({ url: `/heli/supplier/page`, params }) +} + +// 查询供应商详情 +export const getSupplier = async (id: number) => { + return await request.get({ url: `/heli/supplier/get?id=` + id }) +} + +// 新增供应商 +export const createSupplier = async (data: SupplierVO) => { + return await request.post({ url: `/heli/supplier/create`, data }) +} + +// 修改供应商 +export const updateSupplier = async (data: SupplierVO) => { + return await request.put({ url: `/heli/supplier/update`, data }) +} + +// 删除供应商 +export const deleteSupplier = async (id: number) => { + return await request.delete({ url: `/heli/supplier/delete?id=` + id }) +} + +// 导出供应商 Excel +export const exportSupplier = async (params) => { + return await request.download({ url: `/heli/supplier/export-excel`, params }) +} diff --git a/mes-ui/mes-ui-admin-vue3/src/utils/dict.ts b/mes-ui/mes-ui-admin-vue3/src/utils/dict.ts index 0ae42d20..86b965ce 100644 --- a/mes-ui/mes-ui-admin-vue3/src/utils/dict.ts +++ b/mes-ui/mes-ui-admin-vue3/src/utils/dict.ts @@ -245,4 +245,7 @@ export enum DICT_TYPE { HELI_PROJECT_MATERIAL_PLAN_STATUS = 'heli_project_material_plan_status',//物料需求计划状态 HELI_BOM_STATUS = 'heli_bom_status', //bom状态 HELI_BOM_MATERIAL_TYPE = 'heli_bom_material_type', //bom物料类型 + HELI_PROJECT_PURCHASE_ORDER_TYPE = 'heli_project_purchase_order_type',//采购单类型 + HELI_PROJECT_PURCHASE_GOODS_TYPE = 'heli_project_purchase_goods_type',//采购物类型 + HELI_PURCHASE_ORDER_STATUS = 'heli_purchase_order_status',//采购单状态 } diff --git a/mes-ui/mes-ui-admin-vue3/src/views/heli/purchaseorder/PurchaseOrderForm.vue b/mes-ui/mes-ui-admin-vue3/src/views/heli/purchaseorder/PurchaseOrderForm.vue new file mode 100644 index 00000000..cbec8528 --- /dev/null +++ b/mes-ui/mes-ui-admin-vue3/src/views/heli/purchaseorder/PurchaseOrderForm.vue @@ -0,0 +1,202 @@ + + \ No newline at end of file diff --git a/mes-ui/mes-ui-admin-vue3/src/views/heli/purchaseorder/add.vue b/mes-ui/mes-ui-admin-vue3/src/views/heli/purchaseorder/add.vue new file mode 100644 index 00000000..a79828ab --- /dev/null +++ b/mes-ui/mes-ui-admin-vue3/src/views/heli/purchaseorder/add.vue @@ -0,0 +1,199 @@ + + \ No newline at end of file diff --git a/mes-ui/mes-ui-admin-vue3/src/views/heli/purchaseorder/detail.vue b/mes-ui/mes-ui-admin-vue3/src/views/heli/purchaseorder/detail.vue new file mode 100644 index 00000000..f985181e --- /dev/null +++ b/mes-ui/mes-ui-admin-vue3/src/views/heli/purchaseorder/detail.vue @@ -0,0 +1,594 @@ + + diff --git a/mes-ui/mes-ui-admin-vue3/src/views/heli/purchaseorder/edit.vue b/mes-ui/mes-ui-admin-vue3/src/views/heli/purchaseorder/edit.vue new file mode 100644 index 00000000..7d9b383c --- /dev/null +++ b/mes-ui/mes-ui-admin-vue3/src/views/heli/purchaseorder/edit.vue @@ -0,0 +1,626 @@ + + \ No newline at end of file diff --git a/mes-ui/mes-ui-admin-vue3/src/views/heli/purchaseorder/index.vue b/mes-ui/mes-ui-admin-vue3/src/views/heli/purchaseorder/index.vue new file mode 100644 index 00000000..0ace8d17 --- /dev/null +++ b/mes-ui/mes-ui-admin-vue3/src/views/heli/purchaseorder/index.vue @@ -0,0 +1,226 @@ + + + \ No newline at end of file diff --git a/sql/v1.3.0/1.structure.sql b/sql/v1.3.0/1.structure.sql index 94bf8efd..0b9407d1 100644 --- a/sql/v1.3.0/1.structure.sql +++ b/sql/v1.3.0/1.structure.sql @@ -265,3 +265,22 @@ CREATE TABLE `project_purchase_order` ( `tenant_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '租户编号', PRIMARY KEY (`id`) ) ENGINE=InnoDB COMMENT='采购订单'; + +DROP TABLE IF EXISTS `project_purchase_order_material`; +CREATE TABLE `project_purchase_order_material` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增字段,唯一', + `purchase_order_id` bigint(20) NOT NULL COMMENT '采购单编号', + `material_id` bigint(20) DEFAULT NULL COMMENT '物料id', + `purchase_amount` bigint(10) DEFAULT NULL COMMENT '采购数量', + `estimated_price` decimal(10,2) DEFAULT NULL COMMENT '暂估价金额', + `actual_price` decimal(10,2) DEFAULT NULL COMMENT '实际价金额', + `arrive_time` datetime DEFAULT NULL COMMENT '预计到期日期', + `description` varchar(255) DEFAULT NULL COMMENT '备注', + `creator` varchar(64) DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + `tenant_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '租户编号', + PRIMARY KEY (`id`) +) ENGINE=InnoDB COMMENT='采购单物料表'; \ No newline at end of file