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 8ae00de..36f2b68 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 @@ -78,6 +78,7 @@ public interface ErrorCodeConstants { ErrorCode PROCESS_BOM_CODE_IS_EMPTY= new ErrorCode(1_006_005, "工艺bom编码为空"); ErrorCode PROCESS_BOM_DETAIL_BLUE_PRINT_NO_REPEAT = new ErrorCode(1_006_006, "工艺bom明细图号重复"); ErrorCode PROCESS_BOM_DETAIL_MATERIAL_NAME_IS_NULL = new ErrorCode(1_006_007, "工艺bom明细物料名称为空"); + ErrorCode PROCESS_BOM_DETAIL_MATERIAL_AMOUNT_ILLGAL = new ErrorCode(1_006_0012, "工艺bom明细数量必须为数字!"); ErrorCode PROCESS_BOM_DETAIL_UNSTANDARD_MATERIAL_NAME_IS_NULL = new ErrorCode(1_006_008, "非标准件工艺bom明细物料名称为空"); ErrorCode PROCESS_BOM_DETAIL_UNSTANDARD_MATERIAL_NAME_IS_REPEAT= new ErrorCode(1_006_009, "非标准件工艺bom明细物料名称重复"); ErrorCode PROCESS_BOM_DETAIL_UNSTANDARD_SPEC_IS_NULL= new ErrorCode(1_006_010, "非标准件工艺bom明细规格为空"); @@ -135,7 +136,7 @@ public interface ErrorCodeConstants { ErrorCode ORDER_YF_NOT_EXISTS = new ErrorCode(1_011_001, "应付记录不存在"); ErrorCode ORDER_YS_NOT_EXISTS = new ErrorCode(1_011_001, "应收记录不存在"); - + ErrorCode ORDER_YS_DETAIL_NOT_EXISTS = new ErrorCode(1_011_001, "应收记录明细不存在"); ErrorCode SALE_ORDER_COST_DETAIL_NOT_EXISTS = new ErrorCode(1_011_001, "项目订单成本汇算明细不存在"); /************责任人管理***********/ ErrorCode OWNER_NOT_EXISTS = new ErrorCode(1_013_001, "人员配置主数据维护错误,请确认!"); diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/material/vo/MaterialRespVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/material/vo/MaterialRespVO.java index 58380b3..fb01aae 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/material/vo/MaterialRespVO.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/material/vo/MaterialRespVO.java @@ -117,7 +117,9 @@ public class MaterialRespVO { @Schema(description = "库存预警下限") @ExcelProperty("库存预警下限") private BigDecimal invLowerLimit; - + @Schema(description = "库存单价") + @ExcelProperty("库存单价") + private BigDecimal price; @Schema(description = "物料条码") @ExcelProperty("物料条码") private String barcode; diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/material/vo/MaterialSaveReqVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/material/vo/MaterialSaveReqVO.java index 6865092..d5d84fb 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/material/vo/MaterialSaveReqVO.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/material/vo/MaterialSaveReqVO.java @@ -80,7 +80,8 @@ public class MaterialSaveReqVO { @Schema(description = "库存预警上限") private BigDecimal invUpperLimit; - + @Schema(description = "库存单价") + private BigDecimal price; @Schema(description = "库存预警下限") private BigDecimal invLowerLimit; diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/orderys/vo/OrderYsSaveReqVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/orderys/vo/OrderYsSaveReqVO.java index 7c26ea8..c55474c 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/orderys/vo/OrderYsSaveReqVO.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/orderys/vo/OrderYsSaveReqVO.java @@ -1,5 +1,7 @@ package com.chanko.yunxi.mes.module.heli.controller.admin.orderys.vo; +import com.chanko.yunxi.mes.module.heli.controller.admin.orderysdetail.vo.OrderYsDetailSaveReqVO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.orderysdetail.OrderYsDetailDO; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; import java.util.*; @@ -40,5 +42,7 @@ public class OrderYsSaveReqVO { @Schema(description = "备注") private String rem; + @Schema(description = "收款明细") + private List orderYsDetails; } diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/orderysdetail/OrderYsDetailController.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/orderysdetail/OrderYsDetailController.java new file mode 100644 index 0000000..b3a145b --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/orderysdetail/OrderYsDetailController.java @@ -0,0 +1,102 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.orderysdetail; + +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.orderysdetail.vo.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.orderysdetail.OrderYsDetailDO; +import com.chanko.yunxi.mes.module.heli.service.orderysdetail.OrderYsDetailService; + +@Tag(name = "管理后台 - 应收记录表明细") +@RestController +@RequestMapping("/heli/order-ys-detail") +@Validated +public class OrderYsDetailController { + + @Resource + private OrderYsDetailService orderYsDetailService; + + @PostMapping("/create") + @Operation(summary = "创建应收记录表明细") + @PreAuthorize("@ss.hasPermission('heli:order-ys-detail:create')") + public CommonResult createOrderYsDetail(@Valid @RequestBody OrderYsDetailSaveReqVO createReqVO) { + return success(orderYsDetailService.createOrderYsDetail(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新应收记录表明细") + @PreAuthorize("@ss.hasPermission('heli:order-ys-detail:update')") + public CommonResult updateOrderYsDetail(@Valid @RequestBody OrderYsDetailSaveReqVO updateReqVO) { + orderYsDetailService.updateOrderYsDetail(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除应收记录表明细") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('heli:order-ys-detail:delete')") + public CommonResult deleteOrderYsDetail(@RequestParam("id") Integer id) { + orderYsDetailService.deleteOrderYsDetail(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得应收记录表明细") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('heli:order-ys-detail:query')") + public CommonResult getOrderYsDetail(@RequestParam("id") Integer id) { + OrderYsDetailDO orderYsDetail = orderYsDetailService.getOrderYsDetail(id); + return success(BeanUtils.toBean(orderYsDetail, OrderYsDetailRespVO.class)); + } + @GetMapping("/getOrderYsDetails") + @Operation(summary = "获得应收记录表明细") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('heli:order-ys-detail:query')") + public CommonResult> getOrderYsDetails(@RequestParam("id") Integer id) { + List orderYsDetail = orderYsDetailService.getOrderYsDetails(id); + return success(BeanUtils.toBean(orderYsDetail, OrderYsDetailRespVO.class)); + } + @GetMapping("/page") + @Operation(summary = "获得应收记录表明细分页") + @PreAuthorize("@ss.hasPermission('heli:order-ys-detail:query')") + public CommonResult> getOrderYsDetailPage(@Valid OrderYsDetailPageReqVO pageReqVO) { + PageResult pageResult = orderYsDetailService.getOrderYsDetailPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, OrderYsDetailRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出应收记录表明细 Excel") + @PreAuthorize("@ss.hasPermission('heli:order-ys-detail:export')") + @OperateLog(type = EXPORT) + public void exportOrderYsDetailExcel(@Valid OrderYsDetailPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = orderYsDetailService.getOrderYsDetailPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "应收记录表明细.xls", "数据", OrderYsDetailRespVO.class, + BeanUtils.toBean(list, OrderYsDetailRespVO.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/orderysdetail/vo/OrderYsDetailPageReqVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/orderysdetail/vo/OrderYsDetailPageReqVO.java new file mode 100644 index 0000000..dd8cda5 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/orderysdetail/vo/OrderYsDetailPageReqVO.java @@ -0,0 +1,41 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.orderysdetail.vo; + +import lombok.*; + +import java.time.LocalDate; +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 OrderYsDetailPageReqVO extends PageParam { + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + + @Schema(description = "回款金额") + private BigDecimal cgYishou; + + @Schema(description = "备注") + private String rem; + + @Schema(description = "回款日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDate[] paymentDate; + + @Schema(description = "回款类型", example = "2") + private String cgType; + + @Schema(description = "应收id", example = "30630") + private Integer cgId; + +} \ 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/orderysdetail/vo/OrderYsDetailRespVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/orderysdetail/vo/OrderYsDetailRespVO.java new file mode 100644 index 0000000..5ebd284 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/orderysdetail/vo/OrderYsDetailRespVO.java @@ -0,0 +1,47 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.orderysdetail.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +import java.time.LocalDate; +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 OrderYsDetailRespVO { + + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "2612") + @ExcelProperty("主键") + private Integer id; + + @Schema(description = "创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createTime; + + @Schema(description = "回款金额") + @ExcelProperty("回款金额") + private BigDecimal cgYishou; + + @Schema(description = "备注") + @ExcelProperty("备注") + private String rem; + + @Schema(description = "回款日期") + @ExcelProperty("回款日期") + private LocalDate paymentDate; + + @Schema(description = "回款类型", example = "2") + @ExcelProperty("回款类型") + private String cgType; + + @Schema(description = "应收id", example = "30630") + @ExcelProperty("应收id") + private Integer cgId; + +} \ 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/orderysdetail/vo/OrderYsDetailSaveReqVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/orderysdetail/vo/OrderYsDetailSaveReqVO.java new file mode 100644 index 0000000..7b86756 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/orderysdetail/vo/OrderYsDetailSaveReqVO.java @@ -0,0 +1,34 @@ +package com.chanko.yunxi.mes.module.heli.controller.admin.orderysdetail.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +import java.time.LocalDate; +import java.util.*; +import javax.validation.constraints.*; +import java.util.*; +import java.math.BigDecimal; + +@Schema(description = "管理后台 - 应收记录表明细新增/修改 Request VO") +@Data +public class OrderYsDetailSaveReqVO { + + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "2612") + private Integer id; + + @Schema(description = "回款金额") + private BigDecimal cgYishou; + + @Schema(description = "备注") + private String rem; + + @Schema(description = "回款日期") + private LocalDate paymentDate; + + @Schema(description = "回款类型", example = "2") + private String cgType; + + @Schema(description = "应收id", example = "30630") + private Integer cgId; + +} \ 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/storage/StorageController.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/storage/StorageController.java index dad0757..02b5394 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/storage/StorageController.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/storage/StorageController.java @@ -1,10 +1,18 @@ package com.chanko.yunxi.mes.module.heli.controller.admin.storage; +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.chanko.yunxi.mes.module.heli.controller.admin.outsourcestockboom.vo.OutsourceStockBoomSaveReqVO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.material.MaterialDO; import com.chanko.yunxi.mes.module.heli.dal.dataobject.storagelog.StorageLogDO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.storagelogNow.StorageLogNowDO; import com.chanko.yunxi.mes.module.heli.dal.dataobject.storagemat.StorageMatDO; +import com.chanko.yunxi.mes.module.heli.dal.mysql.material.MaterialMapper; +import com.chanko.yunxi.mes.module.heli.dal.mysql.storagelog.StorageLogNowMapper; +import com.chanko.yunxi.mes.module.heli.dal.mysql.storagemat.StorageMatMapper; import com.chanko.yunxi.mes.module.heli.service.storagelog.StorageLogService; import com.chanko.yunxi.mes.module.heli.service.storagemat.StorageMatService; +import com.fasterxml.jackson.annotation.JsonTypeInfo; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import org.springframework.validation.annotation.Validated; @@ -17,6 +25,7 @@ import javax.validation.constraints.*; import javax.validation.*; import javax.servlet.http.*; import java.math.BigDecimal; +import java.math.RoundingMode; import java.time.LocalDateTime; import java.util.*; import java.io.IOException; @@ -50,7 +59,12 @@ public class StorageController { @Resource private StorageLogService storageLogService; - + @Resource + private StorageMatMapper storageMatMapper; + @Resource + private StorageLogNowMapper storageLogNowMapper; + @Resource + private MaterialMapper materialMapper; @PostMapping("/cancelWeiWai") @Operation(summary = "委外取消提交") @PreAuthorize("@ss.hasPermission('heli:storage:create')") @@ -125,6 +139,54 @@ public class StorageController { storageService.updateStorage(updateReqVO); int status = targetDo.getStatus(); + if (updateReqVO.getStockType()==1&&updateReqVO.getStockInType()==1){ + if (status==2){ + List matList = storageMatMapper.selectMatByStorckID(targetDo.getId()); + for (StorageMatDO storageMatDO : matList) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(StorageLogNowDO::getMatCode, storageMatDO.getMatCode()); + wrapper.eq(StorageLogNowDO::getMatName,storageMatDO.getMatName()); + BigDecimal totalStorageOkQty = storageLogNowMapper.selectList(wrapper).stream() + .map(StorageLogNowDO::getStorageOkQty) + .filter(Objects::nonNull) // 确保过滤掉 null 值 + .reduce(BigDecimal.ZERO, BigDecimal::add); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(MaterialDO::getCode, storageMatDO.getMatCode()); + queryWrapper.eq(MaterialDO::getName,storageMatDO.getMatName()); + MaterialDO materialDO = materialMapper.selectOne(queryWrapper); + if (ObjectUtil.isEmpty(materialDO.getPrice())){ + materialDO.setPrice(BigDecimal.ZERO); + } + BigDecimal add = totalStorageOkQty.multiply(materialDO.getPrice()).add(storageMatDO.getPrice().multiply(storageMatDO.getStorageOkQty())); + BigDecimal divide = add.divide(totalStorageOkQty.add(storageMatDO.getStorageOkQty()),2,RoundingMode.HALF_UP); + materialDO.setPrice(divide); + materialMapper.updateById(materialDO); + } + }else if (status==3){ + List matList = storageMatMapper.selectMatByStorckID(targetDo.getId()); + for (StorageMatDO storageMatDO : matList) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(StorageLogNowDO::getMatCode, storageMatDO.getMatCode()); + wrapper.eq(StorageLogNowDO::getMatName,storageMatDO.getMatName()); + BigDecimal totalStorageOkQty = storageLogNowMapper.selectList(wrapper).stream() + .map(StorageLogNowDO::getStorageOkQty) + .filter(Objects::nonNull) // 确保过滤掉 null 值 + .reduce(BigDecimal.ZERO, BigDecimal::add); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(MaterialDO::getCode, storageMatDO.getMatCode()); + queryWrapper.eq(MaterialDO::getName,storageMatDO.getMatName()); + MaterialDO materialDO = materialMapper.selectOne(queryWrapper); + if (ObjectUtil.isEmpty(materialDO.getPrice())){ + materialDO.setPrice(BigDecimal.ZERO); + } + BigDecimal add = totalStorageOkQty.multiply(materialDO.getPrice()).subtract(storageMatDO.getPrice().multiply(storageMatDO.getStorageOkQty())); + BigDecimal divide = add.divide(totalStorageOkQty.subtract(storageMatDO.getStorageOkQty()),2,RoundingMode.HALF_UP); + materialDO.setPrice(divide); + materialMapper.updateById(materialDO); + } + } + + } //状态说明:1保存 2提交 3作废 4已审批 if(updateReqVO.getStockType() == 2){ //盘亏出库以外直接出 diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/storagelog/StorageLogController.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/storagelog/StorageLogController.java index 0af0acd..f526178 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/storagelog/StorageLogController.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/storagelog/StorageLogController.java @@ -56,7 +56,13 @@ public class StorageLogController { storageLogService.updateStorageLog(updateReqVO); return success(true); } - + @PostMapping("/updatePrice") + @Operation(summary = "更新库存单价") + @PreAuthorize("@ss.hasPermission('heli:storage-log:update')") + public CommonResult updatePrice( @RequestBody StorageLogSaveReqVO updateReqVO) { + storageLogService.updatePrice(updateReqVO); + return success(true); + } @DeleteMapping("/delete") @Operation(summary = "删除入/出库日志") @Parameter(name = "id", description = "编号", required = true) @@ -114,6 +120,13 @@ public class StorageLogController { PageResult pageResult = storageLogService.getStorageNowPage(pageReqVO); return success(pageResult); } + @GetMapping("/price") + @Operation(summary = "获得库存单价分页") + @PreAuthorize("@ss.hasPermission('heli:storage-log:query')") + public CommonResult> getStorageNowPricePage(@Valid StorageLogPageReqVO pageReqVO) { + PageResult pageResult = storageLogService.getStorageNowPricePage(pageReqVO); + return success(pageResult); + } // @GetMapping("/nowsmall") // @Operation(summary = "获得入/出库实时分页") // @PreAuthorize("@ss.hasPermission('heli:storage-log:query')") diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/storagelog/vo/StorageLogSaveReqVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/storagelog/vo/StorageLogSaveReqVO.java index 3dd4bfd..8d42824 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/storagelog/vo/StorageLogSaveReqVO.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/storagelog/vo/StorageLogSaveReqVO.java @@ -45,5 +45,9 @@ public class StorageLogSaveReqVO { @Schema(description = "状态", example = "你说的对") private Integer status; + @Schema(description = "物料编码", example = "你说的对") + private String matCode; + @Schema(description = "库存单价") + private BigDecimal price; } diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/storagemat/vo/StorageMatRespVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/storagemat/vo/StorageMatRespVO.java index c203d73..b6b5939 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/storagemat/vo/StorageMatRespVO.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/storagemat/vo/StorageMatRespVO.java @@ -41,7 +41,9 @@ public class StorageMatRespVO { @Schema(description = "库存良品数量") @ExcelProperty("库存良品数量") private BigDecimal storageOkQty; - + @Schema(description = "库存价格") + @ExcelProperty("库存价格") + private BigDecimal price; @Schema(description = "批次号") @ExcelProperty("批次号") private String lotNo; diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/storagemat/vo/StorageMatSaveReqVO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/storagemat/vo/StorageMatSaveReqVO.java index 6794e2a..df42901 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/storagemat/vo/StorageMatSaveReqVO.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/controller/admin/storagemat/vo/StorageMatSaveReqVO.java @@ -37,7 +37,8 @@ public class StorageMatSaveReqVO { @Schema(description = "库存良品数量") private BigDecimal storageOkQty; - + @Schema(description = "库存价格") + private BigDecimal price; @Schema(description = "批次号") private String lotNo; diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/deliverorder/DeliverOrderSubDO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/deliverorder/DeliverOrderSubDO.java index 8b36297..156b760 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/deliverorder/DeliverOrderSubDO.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/deliverorder/DeliverOrderSubDO.java @@ -90,7 +90,6 @@ public class DeliverOrderSubDO extends BaseDO { /** * 销售订单子项id */ - @TableField(exist = false) private Long saleOrderId; private Long saleOrderSubId; /** diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/material/MaterialDO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/material/MaterialDO.java index c04b32d..efdfeb7 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/material/MaterialDO.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/material/MaterialDO.java @@ -119,6 +119,10 @@ public class MaterialDO extends TenantBaseDO { * 库存预警上限 */ private BigDecimal invUpperLimit; + /** + * 库存单价 + */ + private BigDecimal price; /** * 库存预警下限 */ diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/orderysdetail/OrderYsDetailDO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/orderysdetail/OrderYsDetailDO.java new file mode 100644 index 0000000..5d5f859 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/orderysdetail/OrderYsDetailDO.java @@ -0,0 +1,54 @@ +package com.chanko.yunxi.mes.module.heli.dal.dataobject.orderysdetail; + +import lombok.*; + +import java.time.LocalDate; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.*; +import com.chanko.yunxi.mes.framework.mybatis.core.dataobject.BaseDO; + +/** + * 应收记录表明细 DO + * + * @author 管理员 + */ +@TableName("cg_order_ys_detail") +@KeySequence("cg_order_ys_detail_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class OrderYsDetailDO extends BaseDO { + + /** + * 主键 + */ + @TableId + private Integer id; + /** + * 回款金额 + */ + private BigDecimal cgYishou; + /** + * 备注 + */ + private String rem; + /** + * 回款日期 + */ + private LocalDate paymentDate; + /** + * 回款类型 + */ + private String cgType; + /** + * 应收id + */ + private Integer cgId; + +} \ 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/storagelogNow/StorageLogNowDO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/storagelogNow/StorageLogNowDO.java index 9677eec..8356eff 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/storagelogNow/StorageLogNowDO.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/storagelogNow/StorageLogNowDO.java @@ -30,9 +30,7 @@ public class StorageLogNowDO extends BaseDO { private Long id; private BigDecimal storageOkQty; - private String lotNo; - private String matName; private String shortName; private String matCode; @@ -51,11 +49,15 @@ public class StorageLogNowDO extends BaseDO { private Long pnId; private String pnName; private BigDecimal sumKcMoney; - + @TableField(exist = false) + private BigDecimal sumKcMoneys; @TableField(exist = false) private Long materialTypeId; - + @TableField(exist = false) + private BigDecimal price; + @TableField(exist = false) + private BigDecimal storageOkQtys; @TableField(exist = false) private Long matUnitId; diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/storagemat/StorageMatDO.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/storagemat/StorageMatDO.java index 6cb072b..05afa8b 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/storagemat/StorageMatDO.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/dataobject/storagemat/StorageMatDO.java @@ -52,6 +52,10 @@ public class StorageMatDO extends BaseDO { * 库存良品数量 */ private BigDecimal storageOkQty; + /** + * 库存价格 + */ + private BigDecimal price; /** * 批次号 */ diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/orderysdetail/OrderYsDetailMapper.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/orderysdetail/OrderYsDetailMapper.java new file mode 100644 index 0000000..33608d4 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/orderysdetail/OrderYsDetailMapper.java @@ -0,0 +1,31 @@ +package com.chanko.yunxi.mes.module.heli.dal.mysql.orderysdetail; + +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.orderysdetail.OrderYsDetailDO; +import org.apache.ibatis.annotations.Mapper; +import com.chanko.yunxi.mes.module.heli.controller.admin.orderysdetail.vo.*; + +/** + * 应收记录表明细 Mapper + * + * @author 管理员 + */ +@Mapper +public interface OrderYsDetailMapper extends BaseMapperX { + + default PageResult selectPage(OrderYsDetailPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .betweenIfPresent(OrderYsDetailDO::getCreateTime, reqVO.getCreateTime()) + .eqIfPresent(OrderYsDetailDO::getCgYishou, reqVO.getCgYishou()) + .eqIfPresent(OrderYsDetailDO::getRem, reqVO.getRem()) + .betweenIfPresent(OrderYsDetailDO::getPaymentDate, reqVO.getPaymentDate()) + .eqIfPresent(OrderYsDetailDO::getCgType, reqVO.getCgType()) + .eqIfPresent(OrderYsDetailDO::getCgId, reqVO.getCgId()) + .orderByDesc(OrderYsDetailDO::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/storagelog/StorageLogNowMapper.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/storagelog/StorageLogNowMapper.java index e9a6567..9e25312 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/storagelog/StorageLogNowMapper.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/storagelog/StorageLogNowMapper.java @@ -107,4 +107,21 @@ public interface StorageLogNowMapper extends BaseMapperX { List selectNowByMatPnId(@Param("matId")Long matId,@Param("pnId")Long pnId); + + default PageResult getStorageNowPricePage(StorageLogPageReqVO reqVO) { + MPJLambdaWrapper query = new MPJLambdaWrapper<>(); + + query.selectAll(StorageLogNowDO.class) + .select("COALESCE(SUM(storage_ok_qty), 0) as storageOkQtys,a.price as price,COALESCE(SUM(storage_ok_qty), 0) * a.price as sumKcMoneys") + .leftJoin(MaterialDO.class,"a",MaterialDO::getCode,StorageLogNowDO::getMatCode) + .groupBy(StorageLogNowDO::getMatCode) + .orderByDesc(StorageLogNowDO::getId); + + query.like(!StringUtils.isEmpty(reqVO.getMatType()),StorageLogNowDO::getMatType, reqVO.getMatType()) + .ne(true,StorageLogNowDO::getStorageOkQty,0) + .like(!StringUtils.isEmpty(reqVO.getMatName()), StorageLogNowDO::getMatName, reqVO.getMatName()) + .like(!StringUtils.isEmpty(reqVO.getMatCode()), StorageLogNowDO::getMatCode, reqVO.getMatCode()); + + return selectPage(reqVO,query); + } } diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/taskdispatch/TaskDispatchMapper.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/taskdispatch/TaskDispatchMapper.java index 1b793dc..6fa52ea 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/taskdispatch/TaskDispatchMapper.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/taskdispatch/TaskDispatchMapper.java @@ -58,6 +58,7 @@ public interface TaskDispatchMapper extends BaseMapperX { .leftJoin(PlanTaskBomDO.class, "i", wrapper -> wrapper.eq(PlanTaskBomDO::getTaskId, PlanTaskDO::getId).eq(PlanTaskBomDO::getBomDetailId, TaskDispatchDO::getBomDetailId)) .leftJoin(AdminUserDO.class, "u1", AdminUserDO::getId, PlanTaskBomDO::getOwner) .orderByDesc(TaskDispatchDO::getId) + .eq(ProjectOrderSubDO::getDeleted,0) .disableSubLogicDel(); query.like(!StringUtils.isEmpty(reqVO.getCode()), TaskDispatchDO::getCode, reqVO.getCode()) diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/manager/CrossOrderManager.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/manager/CrossOrderManager.java index 5c04e05..4edc6ae 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/manager/CrossOrderManager.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/manager/CrossOrderManager.java @@ -180,9 +180,10 @@ public class CrossOrderManager { //如果历史没发过 以本次为准 if(historyDeliveredSubList.isEmpty()) { historyDeliveredSubList = projectIdEntity.getValue(); - }else { - historyDeliveredSubList.addAll(projectIdEntity.getValue()); } + //else { +// historyDeliveredSubList.addAll(projectIdEntity.getValue()); +// } Map> historyDeliveredSubsGroupBySaleSubId = historyDeliveredSubList.stream().collect(Collectors.groupingBy(DeliverOrderSubDO::getSaleOrderSubId)); // 考虑变更订单情况 只需判断历史发货是否大于等于订单子项数量 diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/orderys/OrderYsServiceImpl.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/orderys/OrderYsServiceImpl.java index 1a0e6fa..73a9688 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/orderys/OrderYsServiceImpl.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/orderys/OrderYsServiceImpl.java @@ -2,7 +2,13 @@ package com.chanko.yunxi.mes.module.heli.service.orderys; import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.chanko.yunxi.mes.module.heli.controller.admin.orderysdetail.vo.OrderYsDetailSaveReqVO; import com.chanko.yunxi.mes.module.heli.controller.admin.projectorder.vo.ProjectOrderSaveReqVO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.orderysdetail.OrderYsDetailDO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.projectorder.ProjectOrderSubDO; +import com.chanko.yunxi.mes.module.heli.dal.mysql.orderysdetail.OrderYsDetailMapper; import com.chanko.yunxi.mes.module.heli.service.customer.CustomerService; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -12,6 +18,8 @@ import org.springframework.transaction.annotation.Transactional; import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.*; +import java.util.stream.Collectors; + import com.chanko.yunxi.mes.module.heli.controller.admin.orderys.vo.*; import com.chanko.yunxi.mes.module.heli.dal.dataobject.orderys.OrderYsDO; import com.chanko.yunxi.mes.framework.common.pojo.PageResult; @@ -36,6 +44,8 @@ public class OrderYsServiceImpl implements OrderYsService { private OrderYsMapper orderYsMapper; @Resource private CustomerService customerService; + @Resource + private OrderYsDetailMapper OrderYsDetailMapper; @Override public Integer createOrderYs(OrderYsSaveReqVO createReqVO) { @@ -53,6 +63,17 @@ public class OrderYsServiceImpl implements OrderYsService { // 更新 OrderYsDO updateObj = BeanUtils.toBean(updateReqVO, OrderYsDO.class); orderYsMapper.updateById(updateObj); + //插入子表 + createOrUpdateOrderYsDetails(updateReqVO.getOrderYsDetails()); + } + + private void createOrUpdateOrderYsDetails(List orderYsDetails) { + // 分组更新与插入 + List updateList = orderYsDetails.stream().filter(o -> o.getId() != null).collect(Collectors.toList()); + List insertList = orderYsDetails.stream().filter(o -> o.getId() == null).collect(Collectors.toList()); + + if(!updateList.isEmpty()) OrderYsDetailMapper.updateBatch(updateList); + if(!insertList.isEmpty()) OrderYsDetailMapper.insertBatch(insertList); } @Override @@ -61,6 +82,8 @@ public class OrderYsServiceImpl implements OrderYsService { validateOrderYsExists(id); // 删除 orderYsMapper.deleteById(id); + LambdaUpdateWrapper eq = new UpdateWrapper().lambda().eq(OrderYsDetailDO::getCgId, id); + OrderYsDetailMapper.delete(eq); } private void validateOrderYsExists(Integer id) { diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/orderysdetail/OrderYsDetailService.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/orderysdetail/OrderYsDetailService.java new file mode 100644 index 0000000..8e11616 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/orderysdetail/OrderYsDetailService.java @@ -0,0 +1,56 @@ +package com.chanko.yunxi.mes.module.heli.service.orderysdetail; + +import java.util.*; +import javax.validation.*; +import com.chanko.yunxi.mes.module.heli.controller.admin.orderysdetail.vo.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.orderysdetail.OrderYsDetailDO; +import com.chanko.yunxi.mes.framework.common.pojo.PageResult; +import com.chanko.yunxi.mes.framework.common.pojo.PageParam; + +/** + * 应收记录表明细 Service 接口 + * + * @author 管理员 + */ +public interface OrderYsDetailService { + + /** + * 创建应收记录表明细 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Integer createOrderYsDetail(@Valid OrderYsDetailSaveReqVO createReqVO); + + /** + * 更新应收记录表明细 + * + * @param updateReqVO 更新信息 + */ + void updateOrderYsDetail(@Valid OrderYsDetailSaveReqVO updateReqVO); + + /** + * 删除应收记录表明细 + * + * @param id 编号 + */ + void deleteOrderYsDetail(Integer id); + + /** + * 获得应收记录表明细 + * + * @param id 编号 + * @return 应收记录表明细 + */ + OrderYsDetailDO getOrderYsDetail(Integer id); + + List getOrderYsDetails(Integer id); + /** + * 获得应收记录表明细分页 + * + * @param pageReqVO 分页查询 + * @return 应收记录表明细分页 + */ + PageResult getOrderYsDetailPage(OrderYsDetailPageReqVO 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/orderysdetail/OrderYsDetailServiceImpl.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/orderysdetail/OrderYsDetailServiceImpl.java new file mode 100644 index 0000000..06d76c2 --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/orderysdetail/OrderYsDetailServiceImpl.java @@ -0,0 +1,81 @@ +package com.chanko.yunxi.mes.module.heli.service.orderysdetail; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +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.orderysdetail.vo.*; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.orderysdetail.OrderYsDetailDO; +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.orderysdetail.OrderYsDetailMapper; + +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 OrderYsDetailServiceImpl implements OrderYsDetailService { + + @Resource + private OrderYsDetailMapper orderYsDetailMapper; + + @Override + public Integer createOrderYsDetail(OrderYsDetailSaveReqVO createReqVO) { + // 插入 + OrderYsDetailDO orderYsDetail = BeanUtils.toBean(createReqVO, OrderYsDetailDO.class); + orderYsDetailMapper.insert(orderYsDetail); + // 返回 + return orderYsDetail.getId(); + } + + @Override + public void updateOrderYsDetail(OrderYsDetailSaveReqVO updateReqVO) { + // 校验存在 + validateOrderYsDetailExists(updateReqVO.getId()); + // 更新 + OrderYsDetailDO updateObj = BeanUtils.toBean(updateReqVO, OrderYsDetailDO.class); + orderYsDetailMapper.updateById(updateObj); + } + + @Override + public void deleteOrderYsDetail(Integer id) { + // 校验存在 + validateOrderYsDetailExists(id); + // 删除 + orderYsDetailMapper.deleteById(id); + } + + private void validateOrderYsDetailExists(Integer id) { + if (orderYsDetailMapper.selectById(id) == null) { + throw exception(ORDER_YS_DETAIL_NOT_EXISTS); + } + } + + @Override + public OrderYsDetailDO getOrderYsDetail(Integer id) { + return orderYsDetailMapper.selectById(id); + } + + @Override + public List getOrderYsDetails(Integer id) { + LambdaQueryWrapper eq = new LambdaQueryWrapper().eq(OrderYsDetailDO::getCgId, id); + return orderYsDetailMapper.selectList(eq); + } + + @Override + public PageResult getOrderYsDetailPage(OrderYsDetailPageReqVO pageReqVO) { + return orderYsDetailMapper.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/processbom/ProcessBomServiceImpl.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/processbom/ProcessBomServiceImpl.java index 1906b35..c35306e 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/processbom/ProcessBomServiceImpl.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/processbom/ProcessBomServiceImpl.java @@ -267,6 +267,11 @@ public class ProcessBomServiceImpl implements ProcessBomService { processBomDetailDO.setUnit(o.getUnit());//单位 processBomDetailDO.setBlueprintNo(o.getBlueprintNo());//图号 + try { + BigDecimal number = new BigDecimal(o.getAmount()); + } catch (NumberFormatException e) { + throw exception(PROCESS_BOM_DETAIL_MATERIAL_AMOUNT_ILLGAL); + } processBomDetailDO.setAmount(o.getAmount());//数量 processBomDetailDO.setBomType(1); processBomDetailDO.setUpdateTimes(LocalDateTime.now()); diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/projectorder/ProjectOrderServiceImpl.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/projectorder/ProjectOrderServiceImpl.java index 8228998..a8a6742 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/projectorder/ProjectOrderServiceImpl.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/projectorder/ProjectOrderServiceImpl.java @@ -452,6 +452,7 @@ public class ProjectOrderServiceImpl implements ProjectOrderService { deliverAmount = deliverOrderSubDOList.stream().mapToInt(DeliverOrderSubDO::getAmount).sum(); } projectOrderSubDO.setDeliverAmount(deliverAmount); + }); } diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/storagelog/StorageLogService.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/storagelog/StorageLogService.java index e198941..c70d350 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/storagelog/StorageLogService.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/storagelog/StorageLogService.java @@ -71,4 +71,7 @@ public interface StorageLogService { void createStorageLogBatch(List storageLogDOs); + PageResult getStorageNowPricePage(StorageLogPageReqVO pageReqVO); + + void updatePrice(StorageLogSaveReqVO updateReqVO); } diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/storagelog/StorageLogServiceImpl.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/storagelog/StorageLogServiceImpl.java index 044e35d..77c3d00 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/storagelog/StorageLogServiceImpl.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/storagelog/StorageLogServiceImpl.java @@ -1,5 +1,6 @@ package com.chanko.yunxi.mes.module.heli.service.storagelog; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.chanko.yunxi.mes.module.heli.dal.dataobject.bdgzsomthing.bdgzsomthingDO; import com.chanko.yunxi.mes.module.heli.dal.dataobject.material.MaterialDO; import com.chanko.yunxi.mes.module.heli.dal.dataobject.storagelogAll.StorageLogAllDO; @@ -163,6 +164,19 @@ public class StorageLogServiceImpl implements StorageLogService { + } + + @Override + public PageResult getStorageNowPricePage(StorageLogPageReqVO pageReqVO) { + return storageLogNowMapper.getStorageNowPricePage(pageReqVO); + } + + @Override + public void updatePrice(StorageLogSaveReqVO updateReqVO) { + LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper<>(); + wrapper.eq(MaterialDO::getCode,updateReqVO.getMatCode()); + wrapper.set(MaterialDO::getPrice,updateReqVO.getPrice()); + materialMapper.update(wrapper); } } diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/taskdispatch/TaskDispatchServiceImpl.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/taskdispatch/TaskDispatchServiceImpl.java index 466d381..765dc15 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/taskdispatch/TaskDispatchServiceImpl.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/taskdispatch/TaskDispatchServiceImpl.java @@ -15,6 +15,7 @@ import com.chanko.yunxi.mes.module.heli.dal.dataobject.bdgzsomthing.bdgzsomthing import com.chanko.yunxi.mes.module.heli.dal.dataobject.equipmanufacture.EquipManufactureDO; import com.chanko.yunxi.mes.module.heli.dal.dataobject.fpuserdetail.FpUserDetailDO; import com.chanko.yunxi.mes.module.heli.dal.dataobject.plan.PlanDO; +import com.chanko.yunxi.mes.module.heli.dal.dataobject.projectorder.ProjectOrderSubDO; import com.chanko.yunxi.mes.module.heli.dal.dataobject.serialnumber.SerialNumberDO; import com.chanko.yunxi.mes.module.heli.dal.dataobject.taskdispatch.TaskDispatchDO; import com.chanko.yunxi.mes.module.heli.dal.dataobject.taskdispatch.TaskDispatchDetailDO; @@ -268,7 +269,8 @@ public class TaskDispatchServiceImpl implements TaskDispatchService { for (TaskDispatchDO taskDispatchDO : list) { Integer num ; if (numMap.get(taskDispatchDO.getProjectSubId())==null){ - num = projectOrderSubMapper.selectById(taskDispatchDO.getProjectSubId()).getAmount(); + ProjectOrderSubDO projectOrderSubDO = projectOrderSubMapper.selectById(taskDispatchDO.getProjectSubId()); + num = projectOrderSubMapper.selectById(taskDispatchDO.getProjectSubId()).getAmount(); numMap.put(taskDispatchDO.getProjectSubId(),num); }else { num= numMap.get(taskDispatchDO.getProjectSubId()); diff --git a/mes-module-heli/mes-module-heli-biz/src/main/resources/mapper/orderysdetail/OrderYsDetailMapper.xml b/mes-module-heli/mes-module-heli-biz/src/main/resources/mapper/orderysdetail/OrderYsDetailMapper.xml new file mode 100644 index 0000000..3e01f2a --- /dev/null +++ b/mes-module-heli/mes-module-heli-biz/src/main/resources/mapper/orderysdetail/OrderYsDetailMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/mes-module-system/mes-module-system-biz/src/main/java/com/chanko/yunxi/mes/module/system/controller/admin/dept/vo/post/PostRespVO.java b/mes-module-system/mes-module-system-biz/src/main/java/com/chanko/yunxi/mes/module/system/controller/admin/dept/vo/post/PostRespVO.java index 7541cb4..b114384 100644 --- a/mes-module-system/mes-module-system-biz/src/main/java/com/chanko/yunxi/mes/module/system/controller/admin/dept/vo/post/PostRespVO.java +++ b/mes-module-system/mes-module-system-biz/src/main/java/com/chanko/yunxi/mes/module/system/controller/admin/dept/vo/post/PostRespVO.java @@ -38,6 +38,10 @@ public class PostRespVO { @Schema(description = "备注", example = "快乐的备注") private String remark; + @Schema(description = "层级", example = "层级") + private String grade; + @Schema(description = "岗位成本", example = "岗位成本") + private String gradeCost; @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) private LocalDateTime createTime; diff --git a/mes-module-system/mes-module-system-biz/src/main/java/com/chanko/yunxi/mes/module/system/controller/admin/dept/vo/post/PostSaveReqVO.java b/mes-module-system/mes-module-system-biz/src/main/java/com/chanko/yunxi/mes/module/system/controller/admin/dept/vo/post/PostSaveReqVO.java index d3e317c..4f974ec 100644 --- a/mes-module-system/mes-module-system-biz/src/main/java/com/chanko/yunxi/mes/module/system/controller/admin/dept/vo/post/PostSaveReqVO.java +++ b/mes-module-system/mes-module-system-biz/src/main/java/com/chanko/yunxi/mes/module/system/controller/admin/dept/vo/post/PostSaveReqVO.java @@ -36,5 +36,9 @@ public class PostSaveReqVO { @Schema(description = "备注", example = "快乐的备注") private String remark; + @Schema(description = "层级", example = "层级") + private String grade; + @Schema(description = "岗位成本", example = "岗位成本") + private String gradeCost; } \ No newline at end of file diff --git a/mes-module-system/mes-module-system-biz/src/main/java/com/chanko/yunxi/mes/module/system/dal/dataobject/dept/PostDO.java b/mes-module-system/mes-module-system-biz/src/main/java/com/chanko/yunxi/mes/module/system/dal/dataobject/dept/PostDO.java index b6c30c9..a8b01b8 100644 --- a/mes-module-system/mes-module-system-biz/src/main/java/com/chanko/yunxi/mes/module/system/dal/dataobject/dept/PostDO.java +++ b/mes-module-system/mes-module-system-biz/src/main/java/com/chanko/yunxi/mes/module/system/dal/dataobject/dept/PostDO.java @@ -46,5 +46,13 @@ public class PostDO extends BaseDO { * 备注 */ private String remark; + /** + * 层级 + */ + private String grade; + /** + * 岗位成本 + */ + private String gradeCost; } diff --git a/mes-ui/mes-ui-admin-vue3/src/api/heli/orderys/index.ts b/mes-ui/mes-ui-admin-vue3/src/api/heli/orderys/index.ts index d7dcd04..eedf5e6 100644 --- a/mes-ui/mes-ui-admin-vue3/src/api/heli/orderys/index.ts +++ b/mes-ui/mes-ui-admin-vue3/src/api/heli/orderys/index.ts @@ -10,6 +10,7 @@ export interface OrderYsVO { cgYishou: number cgTypee: number rem: string + orderYsDetails:any[]; } // 查询应收记录分页 diff --git a/mes-ui/mes-ui-admin-vue3/src/api/heli/orderysdetail/index.ts b/mes-ui/mes-ui-admin-vue3/src/api/heli/orderysdetail/index.ts new file mode 100644 index 0000000..3e14868 --- /dev/null +++ b/mes-ui/mes-ui-admin-vue3/src/api/heli/orderysdetail/index.ts @@ -0,0 +1,43 @@ +import request from '@/config/axios' + +export interface OrderYsDetailVO { + id: number + cgYishou: number + rem: string + paymentDate: localdate + cgType: string + cgId: number +} + +// 查询应收记录表明细分页 +export const getOrderYsDetailPage = async (params) => { + return await request.get({ url: `/heli/order-ys-detail/page`, params }) +} + +// 查询应收记录表明细详情 +export const getOrderYsDetail = async (id: number) => { + return await request.get({ url: `/heli/order-ys-detail/get?id=` + id }) +} +// 查询根据应收id查询应收记录表明细 +export const getOrderYsDetails = async (id: number) => { + return await request.get({ url: `/heli/order-ys-detail/getOrderYsDetails?id=` + id }) +} +// 新增应收记录表明细 +export const createOrderYsDetail = async (data: OrderYsDetailVO) => { + return await request.post({ url: `/heli/order-ys-detail/create`, data }) +} + +// 修改应收记录表明细 +export const updateOrderYsDetail = async (data: OrderYsDetailVO) => { + return await request.put({ url: `/heli/order-ys-detail/update`, data }) +} + +// 删除应收记录表明细 +export const deleteOrderYsDetail = async (id: number) => { + return await request.delete({ url: `/heli/order-ys-detail/delete?id=` + id }) +} + +// 导出应收记录表明细 Excel +export const exportOrderYsDetail = async (params) => { + return await request.download({ url: `/heli/order-ys-detail/export-excel`, params }) +} diff --git a/mes-ui/mes-ui-admin-vue3/src/api/heli/storagelog/index.ts b/mes-ui/mes-ui-admin-vue3/src/api/heli/storagelog/index.ts index 745f6c0..732495b 100644 --- a/mes-ui/mes-ui-admin-vue3/src/api/heli/storagelog/index.ts +++ b/mes-ui/mes-ui-admin-vue3/src/api/heli/storagelog/index.ts @@ -13,6 +13,7 @@ export interface StorageLogVO { noZero: number matCode: string matType:string + price:number } @@ -41,6 +42,10 @@ export const getStorageNowAllPage = async (params) => { export const getStorageNowPage = async (params) => { return await request.get({ url: `/heli/storage-log/now`, params }) } +// 查询库存单价分页 +export const getStorageNowPricePage = async (params) => { + return await request.get({ url: `/heli/storage-log/price`, params }) +} // 查询入/出库实时分页 export const getStorageNowPagesmall = async (params) => { @@ -62,7 +67,10 @@ export const getStorageLog = async (id: number) => { export const createStorageLog = async (data: StorageLogVO) => { return await request.post({ url: `/heli/storage-log/create`, data }) } - +//修改物料单价 +export const updatePrice = async (data: StorageLogVO) => { + return await request.post({ url: `/heli/storage-log/updatePrice`, data }) +} // 修改入/出库日志 export const updateStorageLog = async (data: StorageLogVO) => { return await request.put({ url: `/heli/storage-log/update`, data }) diff --git a/mes-ui/mes-ui-admin-vue3/src/api/heli/storagemat/index.ts b/mes-ui/mes-ui-admin-vue3/src/api/heli/storagemat/index.ts index ce9e950..56b2dfa 100644 --- a/mes-ui/mes-ui-admin-vue3/src/api/heli/storagemat/index.ts +++ b/mes-ui/mes-ui-admin-vue3/src/api/heli/storagemat/index.ts @@ -8,6 +8,7 @@ export interface StorageMatVO { rgId: number pnId: number storageOkQty: number + price: number lotNo: string projectNo: string description: string 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 8bce072..d7f0031 100644 --- a/mes-ui/mes-ui-admin-vue3/src/utils/dict.ts +++ b/mes-ui/mes-ui-admin-vue3/src/utils/dict.ts @@ -277,7 +277,8 @@ export enum DICT_TYPE { HELI_YINGFU_MONEY = 'heli_yingfu_money', HELI_PLANTYPE = 'heli_planType',//生产进度报表中生产状态 HELI_PG_PLANTYPE = 'heli_pg_planType',//生产进度报表中派工是否完成状态 - + HELI_GRADE='heli_grade', + HELI_CGTYPE='heli_cgType' } diff --git a/mes-ui/mes-ui-admin-vue3/src/views/heli/PriceQuoteRecord/detail.vue b/mes-ui/mes-ui-admin-vue3/src/views/heli/PriceQuoteRecord/detail.vue index 2682f62..500ef76 100644 --- a/mes-ui/mes-ui-admin-vue3/src/views/heli/PriceQuoteRecord/detail.vue +++ b/mes-ui/mes-ui-admin-vue3/src/views/heli/PriceQuoteRecord/detail.vue @@ -34,7 +34,8 @@ - @@ -311,7 +312,7 @@ const queryData = async (type: string, id?: number) => { pageNo: 1, pageSize: 99, businessId: id, - businessType: businessType + businessType: 'PROJECT_BAOJIA' } formData.value.attachments = (await getFilePage(attParams)).list } diff --git a/mes-ui/mes-ui-admin-vue3/src/views/heli/deliverorder/detail.vue b/mes-ui/mes-ui-admin-vue3/src/views/heli/deliverorder/detail.vue index 9d92b70..3bd7d2b 100644 --- a/mes-ui/mes-ui-admin-vue3/src/views/heli/deliverorder/detail.vue +++ b/mes-ui/mes-ui-admin-vue3/src/views/heli/deliverorder/detail.vue @@ -922,7 +922,7 @@ const queryData = async (type: string, id?: number) => { sub.saleOrderSubId = sub.id sub.id = '' sub.saleOrderCode = sub.projectOrderCode - sub.amounts = sub.amount - sub.deliverAmount + sub.amount = sub.amount - sub.deliverAmount }) formData.value.deliverOrderSubs = formData.value.deliverOrderSubs.concat( subList diff --git a/mes-ui/mes-ui-admin-vue3/src/views/heli/material/MaterialFormUpld.vue b/mes-ui/mes-ui-admin-vue3/src/views/heli/material/MaterialFormUpld.vue index 7811b1b..3a82b12 100644 --- a/mes-ui/mes-ui-admin-vue3/src/views/heli/material/MaterialFormUpld.vue +++ b/mes-ui/mes-ui-admin-vue3/src/views/heli/material/MaterialFormUpld.vue @@ -3,7 +3,8 @@ @@ -555,6 +555,21 @@ const formLoading = ref(false) const dialogTitle = ref('') const detailDisabled = ref(false) +const changePrepTime = (type,index,row)=>{ + if(index == 0){ + formData.value.taskDispatchDetails.forEach((item)=>{ + if(item.id == null){ + console.log('sss') + if(type == 'END'){ + item.endTime = row.endTime; + }else{ + item.startTime = row.startTime; + } + } + }) + } + +} const formatDateT = (timestamp) => { const date = new Date(timestamp);