diff --git a/blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/cost/pojo/entity/CostCalculationEmployeeEntity.java b/blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/cost/pojo/entity/CostCalculationEmployeeEntity.java new file mode 100644 index 000000000..5c866b428 --- /dev/null +++ b/blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/cost/pojo/entity/CostCalculationEmployeeEntity.java @@ -0,0 +1,101 @@ +/** + * BladeX Commercial License Agreement + * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. + *

+ * Use of this software is governed by the Commercial License Agreement + * obtained after purchasing a license from BladeX. + *

+ * 1. This software is for development use only under a valid license + * from BladeX. + *

+ * 2. Redistribution of this software's source code to any third party + * without a commercial license is strictly prohibited. + *

+ * 3. Licensees may copyright their own code but cannot use segments + * from this software for such purposes. Copyright of this software + * remains with BladeX. + *

+ * Using this software signifies agreement to this License, and the software + * must not be used for illegal purposes. + *

+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is + * not liable for any claims arising from secondary or illegal development. + *

+ * Author: Chill Zhuang (bladejava@qq.com) + */ +package org.springblade.desk.cost.pojo.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springblade.core.mp.base.BaseEntity; + +import java.io.Serial; + +/** + * 成本计算产值配置表 实体类 + * + * @author BladeX + * @since 2026-04-21 + */ +@Data +@TableName("MES_COST_CALCULATION_EMPLOYEE") +@Schema(description = "MesCostCalculationEmployee对象") +@EqualsAndHashCode(callSuper = true) +public class CostCalculationEmployeeEntity extends BaseEntity { + + @Serial + private static final long serialVersionUID = 1L; + + + /** + * 作业中心id + */ + @Schema(description = "作业中心id") + private Long workCenterId; + + /** + * 作业中心名称 + */ + @Schema(description = "作业中心编码") + private String workCenterCode; + + /** + * 作业中心名称 + */ + @Schema(description = "作业中心名称") + private String workCenterName; + + /** + * 员工工号 + */ + @Schema(description = "员工工号") + private String employeeCode; + + /** + * 员工姓名 + */ + @Schema(description = "员工姓名") + private String employeeName; + + + /** + * 备注 + */ + @Schema(description = "备注") + private String remarks; + + /** + * 创建人姓名 + */ + @Schema(description = "创建人姓名") + private String createUserName; + + /** + * 更新人姓名 + */ + @Schema(description = "更新人姓名") + private String updateUserName; + +} diff --git a/blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/cost/pojo/entity/CostCalculationOutputEntity.java b/blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/cost/pojo/entity/CostCalculationOutputEntity.java new file mode 100644 index 000000000..a9c50564f --- /dev/null +++ b/blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/cost/pojo/entity/CostCalculationOutputEntity.java @@ -0,0 +1,99 @@ +/** + * BladeX Commercial License Agreement + * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. + *

+ * Use of this software is governed by the Commercial License Agreement + * obtained after purchasing a license from BladeX. + *

+ * 1. This software is for development use only under a valid license + * from BladeX. + *

+ * 2. Redistribution of this software's source code to any third party + * without a commercial license is strictly prohibited. + *

+ * 3. Licensees may copyright their own code but cannot use segments + * from this software for such purposes. Copyright of this software + * remains with BladeX. + *

+ * Using this software signifies agreement to this License, and the software + * must not be used for illegal purposes. + *

+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is + * not liable for any claims arising from secondary or illegal development. + *

+ * Author: Chill Zhuang (bladejava@qq.com) + */ +package org.springblade.desk.cost.pojo.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springblade.core.mp.base.BaseEntity; + +import java.io.Serial; + +/** + * 成本计算产值配置表 实体类 + * + * @author BladeX + * @since 2026-04-21 + */ +@Data +@TableName("MES_COST_CALCULATION_OUTPUT") +@Schema(description = "MesCostCalculationOutput对象") +@EqualsAndHashCode(callSuper = true) +public class CostCalculationOutputEntity extends BaseEntity { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 月份 + */ + @Schema(description = "月份") + private String month; + + /** + * 作业中心id + */ + @Schema(description = "作业中心id") + private Long workCenterId; + + /** + * 作业中心名称 + */ + @Schema(description = "作业中心编码") + private String workCenterCode; + + /** + * 作业中心名称 + */ + @Schema(description = "作业中心名称") + private String workCenterName; + + /** + * 产值 + */ + @Schema(description = "产值") + private Double output; + + /** + * 备注 + */ + @Schema(description = "备注") + private String remarks; + + /** + * 创建人姓名 + */ + @Schema(description = "创建人姓名") + private String createUserName; + + /** + * 更新人姓名 + */ + @Schema(description = "更新人姓名") + private String updateUserName; + +} diff --git a/blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/cost/pojo/entity/CostStatisticsEntity.java b/blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/cost/pojo/entity/CostStatisticsEntity.java index 97ad66961..0ddc50fe2 100644 --- a/blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/cost/pojo/entity/CostStatisticsEntity.java +++ b/blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/cost/pojo/entity/CostStatisticsEntity.java @@ -133,4 +133,16 @@ public class CostStatisticsEntity extends BaseEntity { @Schema(description = "交付中心") private Long jcId; + /** + * 产值 + */ + @Schema(description = "产值") + private BigDecimal output; + + /** + * 成本费用率 + */ + @Schema(description = "成本费用率") + private BigDecimal costRate; + } diff --git a/blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/cost/pojo/vo/CostCalculationEmployeeVO.java b/blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/cost/pojo/vo/CostCalculationEmployeeVO.java new file mode 100644 index 000000000..aeaed2425 --- /dev/null +++ b/blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/cost/pojo/vo/CostCalculationEmployeeVO.java @@ -0,0 +1,46 @@ +/** + * BladeX Commercial License Agreement + * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. + *

+ * Use of this software is governed by the Commercial License Agreement + * obtained after purchasing a license from BladeX. + *

+ * 1. This software is for development use only under a valid license + * from BladeX. + *

+ * 2. Redistribution of this software's source code to any third party + * without a commercial license is strictly prohibited. + *

+ * 3. Licensees may copyright their own code but cannot use segments + * from this software for such purposes. Copyright of this software + * remains with BladeX. + *

+ * Using this software signifies agreement to this License, and the software + * must not be used for illegal purposes. + *

+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is + * not liable for any claims arising from secondary or illegal development. + *

+ * Author: Chill Zhuang (bladejava@qq.com) + */ +package org.springblade.desk.cost.pojo.vo; + +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springblade.desk.cost.pojo.entity.CostCalculationEmployeeEntity; + +import java.io.Serial; + +/** + * 成本计算物料配置表 视图实体类 + * + * @author BladeX + * @since 2026-04-21 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class CostCalculationEmployeeVO extends CostCalculationEmployeeEntity { + @Serial + private static final long serialVersionUID = 1L; + +} diff --git a/blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/cost/pojo/vo/CostCalculationOutputVO.java b/blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/cost/pojo/vo/CostCalculationOutputVO.java new file mode 100644 index 000000000..84cb6b64e --- /dev/null +++ b/blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/cost/pojo/vo/CostCalculationOutputVO.java @@ -0,0 +1,46 @@ +/** + * BladeX Commercial License Agreement + * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. + *

+ * Use of this software is governed by the Commercial License Agreement + * obtained after purchasing a license from BladeX. + *

+ * 1. This software is for development use only under a valid license + * from BladeX. + *

+ * 2. Redistribution of this software's source code to any third party + * without a commercial license is strictly prohibited. + *

+ * 3. Licensees may copyright their own code but cannot use segments + * from this software for such purposes. Copyright of this software + * remains with BladeX. + *

+ * Using this software signifies agreement to this License, and the software + * must not be used for illegal purposes. + *

+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is + * not liable for any claims arising from secondary or illegal development. + *

+ * Author: Chill Zhuang (bladejava@qq.com) + */ +package org.springblade.desk.cost.pojo.vo; + +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springblade.desk.cost.pojo.entity.CostCalculationOutputEntity; + +import java.io.Serial; + +/** + * 成本计算物料配置表 视图实体类 + * + * @author BladeX + * @since 2026-04-21 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class CostCalculationOutputVO extends CostCalculationOutputEntity { + @Serial + private static final long serialVersionUID = 1L; + +} diff --git a/blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/oem/pojo/entity/OemStandardProcessEntity.java b/blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/oem/pojo/entity/OemStandardProcessEntity.java index 57117a6b3..62829636c 100644 --- a/blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/oem/pojo/entity/OemStandardProcessEntity.java +++ b/blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/oem/pojo/entity/OemStandardProcessEntity.java @@ -24,10 +24,10 @@ public class OemStandardProcessEntity extends BaseEntity { private static final long serialVersionUID = 1L; /** - * 工序ID + * 工序名称 */ - @Schema(description = "工序ID") - private Long processId; + @Schema(description = "工序名称") + private String processName; /** * 镀种 */ diff --git a/blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/oem/pojo/vo/OemStandardProcessVO.java b/blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/oem/pojo/vo/OemStandardProcessVO.java index 1638eb4fe..9620581ab 100644 --- a/blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/oem/pojo/vo/OemStandardProcessVO.java +++ b/blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/oem/pojo/vo/OemStandardProcessVO.java @@ -20,9 +20,6 @@ public class OemStandardProcessVO extends OemStandardProcessEntity { @Serial private static final long serialVersionUID = 1L; - @Schema(description = "工序名称") - private String processName; - @Schema(description = "维护人") private String updateUserName; diff --git a/blade-service/blade-desk/src/main/java/org/springblade/desk/cost/controller/CostCalculationEmployeeController.java b/blade-service/blade-desk/src/main/java/org/springblade/desk/cost/controller/CostCalculationEmployeeController.java new file mode 100644 index 000000000..17178d475 --- /dev/null +++ b/blade-service/blade-desk/src/main/java/org/springblade/desk/cost/controller/CostCalculationEmployeeController.java @@ -0,0 +1,230 @@ +/** + * BladeX Commercial License Agreement + * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. + *

+ * Use of this software is governed by the Commercial License Agreement + * obtained after purchasing a license from BladeX. + *

+ * 1. This software is for development use only under a valid license + * from BladeX. + *

+ * 2. Redistribution of this software's source code to any third party + * without a commercial license is strictly prohibited. + *

+ * 3. Licensees may copyright their own code but cannot use segments + * from this software for such purposes. Copyright of this software + * remains with BladeX. + *

+ * Using this software signifies agreement to this License, and the software + * must not be used for illegal purposes. + *

+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is + * not liable for any claims arising from secondary or illegal development. + *

+ * Author: Chill Zhuang (bladejava@qq.com) + */ +package org.springblade.desk.cost.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.Valid; +import lombok.AllArgsConstructor; +import org.apache.commons.collections4.CollectionUtils; +import org.springblade.core.boot.ctrl.BladeController; +import org.springblade.core.excel.util.ExcelUtil; +import org.springblade.core.mp.base.BaseEntity; +import org.springblade.core.mp.support.Condition; +import org.springblade.core.mp.support.Query; +import org.springblade.core.secure.BladeUser; +import org.springblade.core.secure.annotation.IsAdmin; +import org.springblade.core.secure.utils.AuthUtil; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.DateUtil; +import org.springblade.core.tool.utils.Func; +import org.springblade.desk.cost.excel.CostCalculationEmployeeExcel; +import org.springblade.desk.cost.pojo.entity.CostCalculationEmployeeEntity; +import org.springblade.desk.cost.pojo.vo.CostCalculationEmployeeVO; +import org.springblade.desk.cost.service.ICostCalculationEmployeeService; +import org.springblade.desk.cost.wrapper.CostCalculationEmployeeWrapper; +import org.springblade.desk.dashboard.pojo.entity.BsWorkCenterEntity; +import org.springblade.desk.dashboard.service.IBsWorkCenterService; +import org.springblade.system.cache.UserCache; +import org.springblade.system.pojo.entity.UserInfo; +import org.springframework.beans.BeanUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * 成本计算物料配置表 控制器 + * + * @author BladeX + * @since 2026-04-21 + */ +@RestController +@AllArgsConstructor +@RequestMapping("/costCalculationEmployee") +@Tag(name = "成本计算物料配置表", description = "成本计算物料配置表接口") +public class CostCalculationEmployeeController extends BladeController { + + private final ICostCalculationEmployeeService costCalculationEmployeeService; + private final IBsWorkCenterService workCenterService; + + + /** + * 成本计算物料配置表 详情 + */ + @GetMapping("/detail") + @ApiOperationSupport(order = 1) + @Operation(summary = "详情", description = "传入CostCalculationEmployee") + public R detail(CostCalculationEmployeeEntity costCalculationEmployee) { + CostCalculationEmployeeEntity detail = costCalculationEmployeeService.getOne(Condition.getQueryWrapper(costCalculationEmployee)); + return R.data(CostCalculationEmployeeWrapper.build().entityVO(detail)); + } + /** + * 成本计算物料配置表 分页 + */ + @GetMapping("/list") + @ApiOperationSupport(order = 2) + @Operation(summary = "分页", description = "传入CostCalculationEmployee") + public R> list(@Parameter(hidden = true) @RequestParam Map costCalculationEmployee, Query query) { + IPage pages = costCalculationEmployeeService.page(Condition.getPage(query), Condition.getQueryWrapper(costCalculationEmployee, CostCalculationEmployeeEntity.class)); + return R.data(CostCalculationEmployeeWrapper.build().pageVO(pages)); + } + + /** + * 成本计算物料配置表 自定义分页 + */ + @GetMapping("/page") + @ApiOperationSupport(order = 3) + @Operation(summary = "分页", description = "传入CostCalculationEmployee") + public R> page(CostCalculationEmployeeVO costCalculationEmployee, Query query) { + IPage pages = costCalculationEmployeeService.selectCostCalculationEmployeePage(Condition.getPage(query), costCalculationEmployee); + return R.data(pages); + } + + /** + * 成本计算物料配置表 新增 + */ + @PostMapping("/save") + @ApiOperationSupport(order = 4) + @Operation(summary = "新增", description = "传入CostCalculationEmployee") + public R save(@Valid @RequestBody CostCalculationEmployeeEntity costCalculationEmployee) { + return R.status(costCalculationEmployeeService.save(costCalculationEmployee)); + } + + /** + * 成本计算物料配置表 修改 + */ + @PostMapping("/update") + @ApiOperationSupport(order = 5) + @Operation(summary = "修改", description = "传入CostCalculationEmployee") + public R update(@Valid @RequestBody CostCalculationEmployeeEntity costCalculationEmployee) { + return R.status(costCalculationEmployeeService.updateById(costCalculationEmployee)); + } + + /** + * 成本计算物料配置表 新增或修改 + */ + @PostMapping("/submit") + @ApiOperationSupport(order = 6) + @Operation(summary = "新增或修改", description = "传入CostCalculationEmployee") + public R submit(@Valid @RequestBody CostCalculationEmployeeEntity costCalculationEmployee) { + return R.status(costCalculationEmployeeService.saveOrUpdate(costCalculationEmployee)); + } + + /** + * 成本计算物料配置表 删除 + */ + @PostMapping("/remove") + @ApiOperationSupport(order = 7) + @Operation(summary = "逻辑删除", description = "传入ids") + public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) { + return R.status(costCalculationEmployeeService.deleteLogic(Func.toLongList(ids))); + } + + + /** + * 导出数据 + */ + @IsAdmin + @GetMapping("/export-costCalculationEmployee") + @ApiOperationSupport(order = 9) + @Operation(summary = "导出数据", description = "传入CostCalculationEmployee") + public void exportCostCalculationEmployee(@Parameter(hidden = true) @RequestParam Map costCalculationEmployee, BladeUser bladeUser, HttpServletResponse response) { + QueryWrapper queryWrapper = Condition.getQueryWrapper(costCalculationEmployee, CostCalculationEmployeeEntity.class); + //if (!AuthUtil.isAdministrator()) { + // queryWrapper.lambda().eq(CostCalculationEmployee::getTenantId, bladeUser.getTenantId()); + //} + //queryWrapper.lambda().eq(CostCalculationEmployeeEntity::getIsDeleted, BladeConstant.DB_NOT_DELETED); + List list = costCalculationEmployeeService.export(queryWrapper); + ExcelUtil.export(response, "成本计算员工配置表数据" + DateUtil.time(), "成本计算员工配置表数据表", list, CostCalculationEmployeeExcel.class); + } + + /** + * 导入模版 + */ + @GetMapping("/importTemplate") + @ApiOperationSupport(order = 9) + @Operation(summary = "导入模版", description = "导入模版") + public void importTemplate(HttpServletResponse response) { + List list = new ArrayList<>(); + ExcelUtil.export(response, "成本计算员工配置表数据" + DateUtil.time(), "成本计算员工配置表数据", list, CostCalculationEmployeeExcel.class); + } + + /** + * [基础分类] 导入Excel + */ + @PostMapping("/import") + @ApiOperationSupport(order = 72) + @Operation(summary = "导入Excel", description = "MultipartFile") + public R importExcel(@RequestParam("file") MultipartFile file) { + List importList = ExcelUtil.read( + file, 0, 1, CostCalculationEmployeeExcel.class + ); + if(CollectionUtils.isEmpty(importList)){ + return R.fail("无法导入空数据!"); + } + List list = new ArrayList<>(); + for(CostCalculationEmployeeExcel employExcel : importList){ + //根据作业中心查询,有则删除 + List oldList = costCalculationEmployeeService.list(Wrappers.lambdaQuery().eq(CostCalculationEmployeeEntity::getWorkCenterName,employExcel.getWorkCenterName())); + if(CollectionUtils.isNotEmpty(oldList)){ + List idList = oldList.stream().map(BaseEntity::getId).collect(Collectors.toList()); + costCalculationEmployeeService.deleteLogic(idList); + } + BsWorkCenterEntity workCenter = workCenterService.getOne(Wrappers.lambdaQuery().eq(BsWorkCenterEntity::getWcName,employExcel.getWorkCenterName())); + if(workCenter == null){ + return R.fail("作业中心[" + employExcel.getWorkCenterName() + "]不存在!"); + } + UserInfo userInfo = UserCache.getUserByCode(employExcel.getEmployeeCode()); + if(userInfo == null){ + return R.fail("员工工号[" + employExcel.getEmployeeCode() + "]不存在!"); + } + CostCalculationEmployeeEntity entity = new CostCalculationEmployeeEntity(); + BeanUtils.copyProperties(employExcel,entity); + entity.setWorkCenterName(workCenter.getWcName()); + entity.setWorkCenterCode(workCenter.getWcCode()); + entity.setWorkCenterId(workCenter.getId()); + entity.setEmployeeName(userInfo.getUser().getRealName()); + entity.setCreateUserName(UserCache.getUser(Long.valueOf(AuthUtil.getUserId())).getRealName()); + entity.setUpdateUserName(UserCache.getUser(Long.valueOf(AuthUtil.getUserId())).getRealName()); + list.add(entity); + } + if(CollectionUtils.isNotEmpty(list)){ + costCalculationEmployeeService.saveBatch(list); + } + + return R.data("导入成功"); + } +} diff --git a/blade-service/blade-desk/src/main/java/org/springblade/desk/cost/controller/CostCalculationOutputController.java b/blade-service/blade-desk/src/main/java/org/springblade/desk/cost/controller/CostCalculationOutputController.java new file mode 100644 index 000000000..46f520bfd --- /dev/null +++ b/blade-service/blade-desk/src/main/java/org/springblade/desk/cost/controller/CostCalculationOutputController.java @@ -0,0 +1,224 @@ +/** + * BladeX Commercial License Agreement + * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. + *

+ * Use of this software is governed by the Commercial License Agreement + * obtained after purchasing a license from BladeX. + *

+ * 1. This software is for development use only under a valid license + * from BladeX. + *

+ * 2. Redistribution of this software's source code to any third party + * without a commercial license is strictly prohibited. + *

+ * 3. Licensees may copyright their own code but cannot use segments + * from this software for such purposes. Copyright of this software + * remains with BladeX. + *

+ * Using this software signifies agreement to this License, and the software + * must not be used for illegal purposes. + *

+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is + * not liable for any claims arising from secondary or illegal development. + *

+ * Author: Chill Zhuang (bladejava@qq.com) + */ +package org.springblade.desk.cost.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.Valid; +import lombok.AllArgsConstructor; +import org.apache.commons.collections4.CollectionUtils; +import org.springblade.core.boot.ctrl.BladeController; +import org.springblade.core.excel.util.ExcelUtil; +import org.springblade.core.mp.support.Condition; +import org.springblade.core.mp.support.Query; +import org.springblade.core.secure.BladeUser; +import org.springblade.core.secure.annotation.IsAdmin; +import org.springblade.core.secure.utils.AuthUtil; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.DateUtil; +import org.springblade.core.tool.utils.Func; +import org.springblade.desk.cost.excel.CostCalculationOutputExcel; +import org.springblade.desk.cost.pojo.entity.CostCalculationOutputEntity; +import org.springblade.desk.cost.pojo.vo.CostCalculationOutputVO; +import org.springblade.desk.cost.service.ICostCalculationOutputService; +import org.springblade.desk.cost.wrapper.CostCalculationOutputWrapper; +import org.springblade.desk.dashboard.pojo.entity.BsWorkCenterEntity; +import org.springblade.desk.dashboard.service.IBsWorkCenterService; +import org.springblade.system.cache.UserCache; +import org.springframework.beans.BeanUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * 成本计算物料配置表 控制器 + * + * @author BladeX + * @since 2026-04-21 + */ +@RestController +@AllArgsConstructor +@RequestMapping("/costCalculationOutput") +@Tag(name = "成本计算物料配置表", description = "成本计算物料配置表接口") +public class CostCalculationOutputController extends BladeController { + + private final ICostCalculationOutputService costCalculationOutputService; + private final IBsWorkCenterService workCenterService; + + + /** + * 成本计算物料配置表 详情 + */ + @GetMapping("/detail") + @ApiOperationSupport(order = 1) + @Operation(summary = "详情", description = "传入CostCalculationOutput") + public R detail(CostCalculationOutputEntity costCalculationOutput) { + CostCalculationOutputEntity detail = costCalculationOutputService.getOne(Condition.getQueryWrapper(costCalculationOutput)); + return R.data(CostCalculationOutputWrapper.build().entityVO(detail)); + } + /** + * 成本计算物料配置表 分页 + */ + @GetMapping("/list") + @ApiOperationSupport(order = 2) + @Operation(summary = "分页", description = "传入CostCalculationOutput") + public R> list(@Parameter(hidden = true) @RequestParam Map costCalculationOutput, Query query) { + IPage pages = costCalculationOutputService.page(Condition.getPage(query), Condition.getQueryWrapper(costCalculationOutput, CostCalculationOutputEntity.class)); + return R.data(CostCalculationOutputWrapper.build().pageVO(pages)); + } + + /** + * 成本计算物料配置表 自定义分页 + */ + @GetMapping("/page") + @ApiOperationSupport(order = 3) + @Operation(summary = "分页", description = "传入CostCalculationOutput") + public R> page(CostCalculationOutputVO costCalculationOutput, Query query) { + IPage pages = costCalculationOutputService.selectCostCalculationOutputPage(Condition.getPage(query), costCalculationOutput); + return R.data(pages); + } + + /** + * 成本计算物料配置表 新增 + */ + @PostMapping("/save") + @ApiOperationSupport(order = 4) + @Operation(summary = "新增", description = "传入CostCalculationOutput") + public R save(@Valid @RequestBody CostCalculationOutputEntity costCalculationOutput) { + return R.status(costCalculationOutputService.save(costCalculationOutput)); + } + + /** + * 成本计算物料配置表 修改 + */ + @PostMapping("/update") + @ApiOperationSupport(order = 5) + @Operation(summary = "修改", description = "传入CostCalculationOutput") + public R update(@Valid @RequestBody CostCalculationOutputEntity costCalculationOutput) { + return R.status(costCalculationOutputService.updateById(costCalculationOutput)); + } + + /** + * 成本计算物料配置表 新增或修改 + */ + @PostMapping("/submit") + @ApiOperationSupport(order = 6) + @Operation(summary = "新增或修改", description = "传入CostCalculationOutput") + public R submit(@Valid @RequestBody CostCalculationOutputEntity costCalculationOutput) { + return R.status(costCalculationOutputService.saveOrUpdate(costCalculationOutput)); + } + + /** + * 成本计算物料配置表 删除 + */ + @PostMapping("/remove") + @ApiOperationSupport(order = 7) + @Operation(summary = "逻辑删除", description = "传入ids") + public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) { + return R.status(costCalculationOutputService.deleteLogic(Func.toLongList(ids))); + } + + + /** + * 导出数据 + */ + @IsAdmin + @GetMapping("/export-costCalculationOutput") + @ApiOperationSupport(order = 9) + @Operation(summary = "导出数据", description = "传入CostCalculationOutput") + public void exportCostCalculationOutput(@Parameter(hidden = true) @RequestParam Map costCalculationOutput, BladeUser bladeUser, HttpServletResponse response) { + QueryWrapper queryWrapper = Condition.getQueryWrapper(costCalculationOutput, CostCalculationOutputEntity.class); + //if (!AuthUtil.isAdministrator()) { + // queryWrapper.lambda().eq(CostCalculationOutput::getTenantId, bladeUser.getTenantId()); + //} + //queryWrapper.lambda().eq(CostCalculationOutputEntity::getIsDeleted, BladeConstant.DB_NOT_DELETED); + List list = costCalculationOutputService.export(queryWrapper); + ExcelUtil.export(response, "成本计算产值配置表数据" + DateUtil.time(), "成本计算物料产值表数据表", list, CostCalculationOutputExcel.class); + } + + /** + * 导入模版 + */ + @GetMapping("/importTemplate") + @ApiOperationSupport(order = 9) + @Operation(summary = "导入模版", description = "导入模版") + public void importTemplate(HttpServletResponse response) { + List list = new ArrayList<>(); + ExcelUtil.export(response, "成本计算产值配置表数据" + DateUtil.time(), "成本计算产值配置表数据", list, CostCalculationOutputExcel.class); + } + + /** + * [基础分类] 导入Excel + */ + @PostMapping("/import") + @ApiOperationSupport(order = 72) + @Operation(summary = "导入Excel", description = "MultipartFile") + public R importExcel(@RequestParam("file") MultipartFile file) { + List importList = ExcelUtil.read( + file, 0, 1, CostCalculationOutputExcel.class + ); + if(CollectionUtils.isEmpty(importList)){ + return R.fail("无法导入空数据!"); + } + List list = new ArrayList<>(); + for(CostCalculationOutputExcel outputExcel : importList){ + //根据月份和作业中心查询,有则删除 + CostCalculationOutputEntity old = costCalculationOutputService.getOne(Wrappers.lambdaQuery() + .eq(CostCalculationOutputEntity::getMonth,outputExcel.getMonth()) + .eq(CostCalculationOutputEntity::getWorkCenterName,outputExcel.getWorkCenterName())); + if(old != null){ + costCalculationOutputService.deleteLogic(Func.toLongList(old.getId().toString())); + } + BsWorkCenterEntity workCenter = workCenterService.getOne(Wrappers.lambdaQuery().eq(BsWorkCenterEntity::getWcName,outputExcel.getWorkCenterName())); + if(workCenter == null){ + return R.fail("作业中心[" + outputExcel.getWorkCenterName() + "]不存在!"); + } + + CostCalculationOutputEntity entity = new CostCalculationOutputEntity(); + BeanUtils.copyProperties(outputExcel,entity); + entity.setWorkCenterName(workCenter.getWcName()); + entity.setWorkCenterCode(workCenter.getWcCode()); + entity.setWorkCenterId(workCenter.getId()); + entity.setCreateUserName(UserCache.getUser(Long.valueOf(AuthUtil.getUserId())).getRealName()); + entity.setUpdateUserName(UserCache.getUser(Long.valueOf(AuthUtil.getUserId())).getRealName()); + list.add(entity); + } + if(CollectionUtils.isNotEmpty(list)){ + costCalculationOutputService.saveBatch(list); + } + + return R.data("导入成功"); + } +} diff --git a/blade-service/blade-desk/src/main/java/org/springblade/desk/cost/excel/CostCalculationEmployeeExcel.java b/blade-service/blade-desk/src/main/java/org/springblade/desk/cost/excel/CostCalculationEmployeeExcel.java new file mode 100644 index 000000000..eee779e3a --- /dev/null +++ b/blade-service/blade-desk/src/main/java/org/springblade/desk/cost/excel/CostCalculationEmployeeExcel.java @@ -0,0 +1,70 @@ +/** + * BladeX Commercial License Agreement + * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. + *

+ * Use of this software is governed by the Commercial License Agreement + * obtained after purchasing a license from BladeX. + *

+ * 1. This software is for development use only under a valid license + * from BladeX. + *

+ * 2. Redistribution of this software's source code to any third party + * without a commercial license is strictly prohibited. + *

+ * 3. Licensees may copyright their own code but cannot use segments + * from this software for such purposes. Copyright of this software + * remains with BladeX. + *

+ * Using this software signifies agreement to this License, and the software + * must not be used for illegal purposes. + *

+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is + * not liable for any claims arising from secondary or illegal development. + *

+ * Author: Chill Zhuang (bladejava@qq.com) + */ +package org.springblade.desk.cost.excel; + + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import com.alibaba.excel.annotation.write.style.ContentRowHeight; +import com.alibaba.excel.annotation.write.style.HeadRowHeight; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; + + +/** + * 成本计算物料配置表 Excel实体类 + * + * @author BladeX + * @since 2026-04-21 + */ +@Data +@ColumnWidth(25) +@HeadRowHeight(20) +@ContentRowHeight(18) +public class CostCalculationEmployeeExcel implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + + /** + * 物料编码 + */ + @ColumnWidth(20) + @ExcelProperty("作业中心名称") + private String workCenterName; + + /** + * 物料编码 + */ + @ColumnWidth(20) + @ExcelProperty("人员工号") + private String employeeCode; + + +} diff --git a/blade-service/blade-desk/src/main/java/org/springblade/desk/cost/excel/CostCalculationOutputExcel.java b/blade-service/blade-desk/src/main/java/org/springblade/desk/cost/excel/CostCalculationOutputExcel.java new file mode 100644 index 000000000..d16e34e83 --- /dev/null +++ b/blade-service/blade-desk/src/main/java/org/springblade/desk/cost/excel/CostCalculationOutputExcel.java @@ -0,0 +1,76 @@ +/** + * BladeX Commercial License Agreement + * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. + *

+ * Use of this software is governed by the Commercial License Agreement + * obtained after purchasing a license from BladeX. + *

+ * 1. This software is for development use only under a valid license + * from BladeX. + *

+ * 2. Redistribution of this software's source code to any third party + * without a commercial license is strictly prohibited. + *

+ * 3. Licensees may copyright their own code but cannot use segments + * from this software for such purposes. Copyright of this software + * remains with BladeX. + *

+ * Using this software signifies agreement to this License, and the software + * must not be used for illegal purposes. + *

+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is + * not liable for any claims arising from secondary or illegal development. + *

+ * Author: Chill Zhuang (bladejava@qq.com) + */ +package org.springblade.desk.cost.excel; + + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import com.alibaba.excel.annotation.write.style.ContentRowHeight; +import com.alibaba.excel.annotation.write.style.HeadRowHeight; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; + + +/** + * 成本计算物料配置表 Excel实体类 + * + * @author BladeX + * @since 2026-04-21 + */ +@Data +@ColumnWidth(25) +@HeadRowHeight(20) +@ContentRowHeight(18) +public class CostCalculationOutputExcel implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 物料编码 + */ + @ColumnWidth(20) + @ExcelProperty("月份") + private String month; + + /** + * 物料编码 + */ + @ColumnWidth(20) + @ExcelProperty("作业中心名称") + private String workCenterName; + + /** + * 物料编码 + */ + @ColumnWidth(20) + @ExcelProperty("产值") + private Double output; + + +} diff --git a/blade-service/blade-desk/src/main/java/org/springblade/desk/cost/mapper/CostCalculationEmployeeMapper.java b/blade-service/blade-desk/src/main/java/org/springblade/desk/cost/mapper/CostCalculationEmployeeMapper.java new file mode 100644 index 000000000..45c0aeff0 --- /dev/null +++ b/blade-service/blade-desk/src/main/java/org/springblade/desk/cost/mapper/CostCalculationEmployeeMapper.java @@ -0,0 +1,64 @@ +/** + * BladeX Commercial License Agreement + * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. + *

+ * Use of this software is governed by the Commercial License Agreement + * obtained after purchasing a license from BladeX. + *

+ * 1. This software is for development use only under a valid license + * from BladeX. + *

+ * 2. Redistribution of this software's source code to any third party + * without a commercial license is strictly prohibited. + *

+ * 3. Licensees may copyright their own code but cannot use segments + * from this software for such purposes. Copyright of this software + * remains with BladeX. + *

+ * Using this software signifies agreement to this License, and the software + * must not be used for illegal purposes. + *

+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is + * not liable for any claims arising from secondary or illegal development. + *

+ * Author: Chill Zhuang (bladejava@qq.com) + */ +package org.springblade.desk.cost.mapper; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import org.apache.ibatis.annotations.Param; +import org.springblade.desk.cost.excel.CostCalculationEmployeeExcel; +import org.springblade.desk.cost.pojo.entity.CostCalculationEmployeeEntity; +import org.springblade.desk.cost.pojo.vo.CostCalculationEmployeeVO; + +import java.util.List; + +/** + * 成本计算物料配置表 Mapper 接口 + * + * @author BladeX + * @since 2026-04-21 + */ +public interface CostCalculationEmployeeMapper extends BaseMapper { + + /** + * 自定义分页 + * + * @param page 分页参数 + * @param CostCalculationEmployee 查询参数 + * @return List + */ + List selectCostCalculationEmployeePage(IPage page, CostCalculationEmployeeVO CostCalculationEmployee); + + + /** + * 获取导出数据 + * + * @param queryWrapper 查询条件 + * @return List + */ + List export(@Param("ew") Wrapper queryWrapper); + +} diff --git a/blade-service/blade-desk/src/main/java/org/springblade/desk/cost/mapper/CostCalculationEmployeeMapper.xml b/blade-service/blade-desk/src/main/java/org/springblade/desk/cost/mapper/CostCalculationEmployeeMapper.xml new file mode 100644 index 000000000..7508b941d --- /dev/null +++ b/blade-service/blade-desk/src/main/java/org/springblade/desk/cost/mapper/CostCalculationEmployeeMapper.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/blade-service/blade-desk/src/main/java/org/springblade/desk/cost/mapper/CostCalculationOutputMapper.java b/blade-service/blade-desk/src/main/java/org/springblade/desk/cost/mapper/CostCalculationOutputMapper.java new file mode 100644 index 000000000..64c570fd2 --- /dev/null +++ b/blade-service/blade-desk/src/main/java/org/springblade/desk/cost/mapper/CostCalculationOutputMapper.java @@ -0,0 +1,64 @@ +/** + * BladeX Commercial License Agreement + * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. + *

+ * Use of this software is governed by the Commercial License Agreement + * obtained after purchasing a license from BladeX. + *

+ * 1. This software is for development use only under a valid license + * from BladeX. + *

+ * 2. Redistribution of this software's source code to any third party + * without a commercial license is strictly prohibited. + *

+ * 3. Licensees may copyright their own code but cannot use segments + * from this software for such purposes. Copyright of this software + * remains with BladeX. + *

+ * Using this software signifies agreement to this License, and the software + * must not be used for illegal purposes. + *

+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is + * not liable for any claims arising from secondary or illegal development. + *

+ * Author: Chill Zhuang (bladejava@qq.com) + */ +package org.springblade.desk.cost.mapper; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import org.apache.ibatis.annotations.Param; +import org.springblade.desk.cost.excel.CostCalculationOutputExcel; +import org.springblade.desk.cost.pojo.entity.CostCalculationOutputEntity; +import org.springblade.desk.cost.pojo.vo.CostCalculationOutputVO; + +import java.util.List; + +/** + * 成本计算物料配置表 Mapper 接口 + * + * @author BladeX + * @since 2026-04-21 + */ +public interface CostCalculationOutputMapper extends BaseMapper { + + /** + * 自定义分页 + * + * @param page 分页参数 + * @param CostCalculationOutput 查询参数 + * @return List + */ + List selectCostCalculationOutputPage(IPage page, CostCalculationOutputVO CostCalculationOutput); + + + /** + * 获取导出数据 + * + * @param queryWrapper 查询条件 + * @return List + */ + List export(@Param("ew") Wrapper queryWrapper); + +} diff --git a/blade-service/blade-desk/src/main/java/org/springblade/desk/cost/mapper/CostCalculationOutputMapper.xml b/blade-service/blade-desk/src/main/java/org/springblade/desk/cost/mapper/CostCalculationOutputMapper.xml new file mode 100644 index 000000000..5a32dad3f --- /dev/null +++ b/blade-service/blade-desk/src/main/java/org/springblade/desk/cost/mapper/CostCalculationOutputMapper.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/blade-service/blade-desk/src/main/java/org/springblade/desk/cost/mapper/CostStatisticsMapper.java b/blade-service/blade-desk/src/main/java/org/springblade/desk/cost/mapper/CostStatisticsMapper.java index efd4e3548..c7bbb564c 100644 --- a/blade-service/blade-desk/src/main/java/org/springblade/desk/cost/mapper/CostStatisticsMapper.java +++ b/blade-service/blade-desk/src/main/java/org/springblade/desk/cost/mapper/CostStatisticsMapper.java @@ -74,4 +74,8 @@ public interface CostStatisticsMapper extends BaseMapper { List exportWorkCenterMaterialCost(@Param("workCenterId")Long workCenterId, @Param("month")String month); List exportAssistantMaterialCost(@Param("month")String month); + + BigDecimal getWorkCenterMaterialCostByUser(@Param("userCodeList")List userCodeList, @Param("month")String month); + + BigDecimal getAssistantMaterialCostByUser(@Param("userCodeList")List userCodeList,@Param("month")String month); } diff --git a/blade-service/blade-desk/src/main/java/org/springblade/desk/cost/mapper/CostStatisticsMapper.xml b/blade-service/blade-desk/src/main/java/org/springblade/desk/cost/mapper/CostStatisticsMapper.xml index 3853cbb6a..c2d69046e 100644 --- a/blade-service/blade-desk/src/main/java/org/springblade/desk/cost/mapper/CostStatisticsMapper.xml +++ b/blade-service/blade-desk/src/main/java/org/springblade/desk/cost/mapper/CostStatisticsMapper.xml @@ -71,6 +71,23 @@ AND a.GOODS_ID NOT IN ( SELECT id FROM ST_GOODS WHERE GOODS_CODE IN ( SELECT GOODS_CODE FROM MES_COST_CALCULATION_GOODS ) ) + + + SELECT * FROM ( SELECT t.*, - p.NAME as PROCESS_NAME, bu.REAL_NAME as UPDATE_USER_NAME FROM MES_OEM_STANDARD_PROCESS t - INNER JOIN BS_PROCESS_SET p ON t.PROCESS_ID = p.ID AND p.IS_DELETED = 0 LEFT JOIN BLADE_USER bu ON t.update_user = bu.id t.IS_DELETED = 0 - AND p.NAME like concat(concat('%', #{oemStandardProcess.processName}),'%') + AND t.PROCESS_NAME like concat(concat('%', #{oemStandardProcess.processName}),'%') AND t.PLATE like concat(concat('%', #{oemStandardProcess.plate}),'%') diff --git a/blade-service/blade-desk/src/main/java/org/springblade/desk/oem/service/impl/OemStatementServiceImpl.java b/blade-service/blade-desk/src/main/java/org/springblade/desk/oem/service/impl/OemStatementServiceImpl.java index e433b1cb7..4f5d6a7df 100644 --- a/blade-service/blade-desk/src/main/java/org/springblade/desk/oem/service/impl/OemStatementServiceImpl.java +++ b/blade-service/blade-desk/src/main/java/org/springblade/desk/oem/service/impl/OemStatementServiceImpl.java @@ -1387,19 +1387,19 @@ public class OemStatementServiceImpl extends BaseServiceImpl settlementVOs) { // 根据工序Id分组 - Map> groupByPsId = settlementVOs.stream().collect(Collectors.groupingBy(StatementVO::getPpsId)); - Set psIds = groupByPsId.keySet(); + Map> groupByPsName = settlementVOs.stream().collect(Collectors.groupingBy(StatementVO::getPsName)); + Set psNames = groupByPsName.keySet(); final int batchSize = 500; List allStandardList = new ArrayList<>(); - List> splitPsIds = Lists.partition(new ArrayList<>(psIds), batchSize); - for (List subPsIds : splitPsIds) { - List batchList = oemStandardProcessService.list(new LambdaQueryWrapper().in(OemStandardProcessEntity::getProcessId, subPsIds)); + List> splitPsNames = Lists.partition(new ArrayList<>(psNames), batchSize); + for (List subPsNames : splitPsNames) { + List batchList = oemStandardProcessService.list(new LambdaQueryWrapper().in(OemStandardProcessEntity::getProcessName, subPsNames)); allStandardList.addAll(batchList); } - Map> standardMap = allStandardList.stream().collect(Collectors.groupingBy(OemStandardProcessEntity::getProcessId)); - for (Map.Entry> entry : groupByPsId.entrySet()) { - Long psId = entry.getKey(); - List standardProcessList = standardMap.getOrDefault(psId, Collections.emptyList()); + Map> standardMap = allStandardList.stream().collect(Collectors.groupingBy(OemStandardProcessEntity::getProcessName)); + for (Map.Entry> entry : groupByPsName.entrySet()) { + String psName = entry.getKey(); + List standardProcessList = standardMap.getOrDefault(psName, Collections.emptyList()); for (StatementVO statementVO : entry.getValue()) { OemStandardProcessEntity oemStandardProcessEntity = getStandardProcessCode(standardProcessList, statementVO); if (oemStandardProcessEntity != null) { @@ -1422,31 +1422,31 @@ public class OemStatementServiceImpl extends BaseServiceImpllambdaQuery().apply("INSTR(',' || CRAFT_ABILITY_ID || ',', ',' || {0} || ',') > 0", orderCraft.getCaId())); + if (workCenter == null) { + throw new ServiceException("工艺" + orderCraft.getCaId() + "未查询到对应作业中心"); + } + orderCraft.setWorkCenterId(workCenter.getId()); + orderCraft.setIsOutsource(Boolean.FALSE); + } else { + orderCraft.setOcId(oemCustomer.getId()); + orderCraft.setIsOutsource(Boolean.TRUE); + } } // 更新主工序工艺能力日产能信息 diff --git a/blade-service/blade-desk/src/main/java/org/springblade/desk/produce/mapper/WorkPlanMapper.xml b/blade-service/blade-desk/src/main/java/org/springblade/desk/produce/mapper/WorkPlanMapper.xml index bc5418bee..e62c5afd9 100644 --- a/blade-service/blade-desk/src/main/java/org/springblade/desk/produce/mapper/WorkPlanMapper.xml +++ b/blade-service/blade-desk/src/main/java/org/springblade/desk/produce/mapper/WorkPlanMapper.xml @@ -490,7 +490,18 @@ CASE WHEN a.BASE_AMOUNT IS NULL AND a.SUBSIDY_AMOUNT IS NULL THEN NULL ELSE NVL(a.BASE_AMOUNT, 0) + NVL(a.SUBSIDY_AMOUNT, 0) - END AS totalAmount + END AS totalAmount, + a.STANDARD_TIME as standardTime, + a.PREPARE_TIME as prepareTime, + a.HOUR_TYPE as hourType, + CASE + WHEN a.HOUR_TYPE = '0' THEN a.WORK_QTY * a.STANDARD_TIME + PREPARE_TIME + WHEN a.HOUR_TYPE = '1' THEN a.STANDARD_TIME + PREPARE_TIME + ELSE NULL END as totalHour, + CASE + WHEN a.HOUR_TYPE = '0' THEN '按件' + WHEN a.HOUR_TYPE = '1' THEN '按订单' + ELSE '' END as hourTypeValue FROM MES_WORK_PLAN a INNER JOIN BS_PROCESS_SET b ON a.PPS_ID = b.ID AND b.IS_DELETED = 0 INNER JOIN MES_MAKE_REC c ON a.ID = c.WP_ID AND c.IS_DELETED = 0 @@ -640,7 +651,18 @@ CASE WHEN a.BASE_AMOUNT IS NULL AND a.SUBSIDY_AMOUNT IS NULL THEN NULL ELSE NVL(a.BASE_AMOUNT, 0) + NVL(a.SUBSIDY_AMOUNT, 0) - END AS totalAmount + END AS totalAmount, + a.STANDARD_TIME as standardTime, + a.PREPARE_TIME as prepareTime, + a.HOUR_TYPE as hourType, + CASE + WHEN a.HOUR_TYPE = '0' THEN a.WORK_QTY * a.STANDARD_TIME + PREPARE_TIME + WHEN a.HOUR_TYPE = '1' THEN a.STANDARD_TIME + PREPARE_TIME + ELSE NULL END as totalHour, + CASE + WHEN a.HOUR_TYPE = '0' THEN '按件' + WHEN a.HOUR_TYPE = '1' THEN '按订单' + ELSE '' END as hourTypeValue FROM MES_WORK_PLAN a INNER JOIN BS_PROCESS_SET b ON a.PPS_ID = b.ID AND b.IS_DELETED = 0 INNER JOIN MES_MAKE_REC c ON a.ID = c.WP_ID AND c.IS_DELETED = 0 diff --git a/blade-service/blade-desk/src/main/java/org/springblade/desk/produce/service/impl/WorkOrderServiceImpl.java b/blade-service/blade-desk/src/main/java/org/springblade/desk/produce/service/impl/WorkOrderServiceImpl.java index 3e4683967..4c62270ed 100644 --- a/blade-service/blade-desk/src/main/java/org/springblade/desk/produce/service/impl/WorkOrderServiceImpl.java +++ b/blade-service/blade-desk/src/main/java/org/springblade/desk/produce/service/impl/WorkOrderServiceImpl.java @@ -2037,7 +2037,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl + + + UPDATE MES_WORK_ORDER + SET batch_no = #{batchNo} + WHERE ID = #{id} + + + + UPDATE MES_YIELD_ORDER + SET batch_no = #{batchNo} + WHERE ID = #{id} + diff --git a/blade-service/blade-wms/src/main/java/org/springblade/wms/service/impl/StGlassCakeOutServiceImpl.java b/blade-service/blade-wms/src/main/java/org/springblade/wms/service/impl/StGlassCakeOutServiceImpl.java index 01a6e65fc..1780f5fd3 100644 --- a/blade-service/blade-wms/src/main/java/org/springblade/wms/service/impl/StGlassCakeOutServiceImpl.java +++ b/blade-service/blade-wms/src/main/java/org/springblade/wms/service/impl/StGlassCakeOutServiceImpl.java @@ -1,6 +1,8 @@ package org.springblade.wms.service.impl; +import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -16,6 +18,7 @@ import org.springblade.wms.excel.StGlassCakeOutExcel; import org.springblade.wms.mapper.StGlassCakeOutMapper; import org.springblade.wms.mapper.StOtherReceiptRecordMapper; import org.springblade.wms.mapper.StRealtimeStockMapper; +import org.springblade.wms.mapper.StStockInoutRecordMapper; import org.springblade.wms.pojo.dto.StGlassCakeOutDTO; import org.springblade.wms.pojo.entity.*; import org.springblade.wms.pojo.vo.StGlassCakeOutVO; @@ -43,6 +46,8 @@ public class StGlassCakeOutServiceImpl extends BaseServiceImpl preOutStockList = new ArrayList<>(); + String datePrefix = DateUtil.format(new Date(), "yyyyMMdd"); + // 2. 当天最大序号 + String maxCode = stStockInoutRecordMapper.getMaxCheckCode(datePrefix); + int lastNum = 0; + if (StrUtil.isNotBlank(maxCode)) { + String number = maxCode.substring(datePrefix.length()); + lastNum = Integer.parseInt(number); + } + // 4. 遍历每个玻璃饼,单独匹配库存+判断是否生成预出库 if (!CollectionUtils.isEmpty(glassCakePartList)) { for (DsPartEntity glassCake : glassCakePartList) { @@ -269,7 +283,9 @@ public class StGlassCakeOutServiceImpl extends BaseServiceImpl