mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
预料管理修改1
This commit is contained in:
+7
-4
@@ -655,13 +655,16 @@ public class OrderServiceImpl implements OrderService {
|
||||
case "配件汇总1-模板.xlsx":// 配件汇总
|
||||
map.put(orderDO, orderPartsMapper.selectPartAll(orderDO.getId(), SecurityFrameworkUtils.getLoginUser().getOrganId()));
|
||||
break;
|
||||
case "板材明细-按房间-模板.xlsx"://
|
||||
case "板材明细-按房间-模板.xlsx":
|
||||
break;
|
||||
case "板材明细-按板材-模板.xlsx"://
|
||||
case "板材明细-按板材-模板.xlsx":
|
||||
map.put(orderDO, plateMapper.selectPlateGoodsList(orderDO.getId(), SecurityFrameworkUtils.getLoginUser().getOrganId()));
|
||||
|
||||
break;
|
||||
case "板材汇总-按房间-模板.xlsx"://
|
||||
case "板材汇总-按房间-模板.xlsx":
|
||||
break;
|
||||
case "板材汇总-按板材-模板.xlsx"://
|
||||
case "板材汇总-按板材-模板.xlsx":
|
||||
map.put(orderDO, plateMapper.selectPlateGoodsList(orderDO.getId(), SecurityFrameworkUtils.getLoginUser().getOrganId()));
|
||||
break;
|
||||
default:
|
||||
// 处理默认情况,可以选择忽略或者做其他处理
|
||||
|
||||
+1
-1
@@ -498,7 +498,7 @@ public class ApiTypeRealize {
|
||||
.groupId(0L)
|
||||
.partsId(0L)
|
||||
.plateId(plateId)
|
||||
.num(0.0)
|
||||
.num(1.0)
|
||||
.build();
|
||||
|
||||
if (plateDetail.get(plate.getInteger("BlockNo")) != null) {
|
||||
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
+11
@@ -0,0 +1,11 @@
|
||||
package com.cf.imes.module.manage.enums;
|
||||
|
||||
/**
|
||||
* Manage 字典类型的枚举类
|
||||
*
|
||||
* @author 晨丰科技
|
||||
*/
|
||||
public interface DictTypeConstants {
|
||||
|
||||
String SYNTHESIS_TYPE = "synthesisType";//加工组类型
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package com.cf.imes.module.manage.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum RemainPlateStatusEnum {
|
||||
UNUSED(0, "未使用"),
|
||||
IN_USE(1, "使用中");
|
||||
|
||||
private final Integer status;
|
||||
private String description;
|
||||
|
||||
public boolean equals(Integer status) {
|
||||
return this.status .equals(status) ;
|
||||
}
|
||||
|
||||
public boolean equals(RemainPlateStatusEnum enableStatusEnum) {
|
||||
return enableStatusEnum != null && enableStatusEnum.status .equals(this.getStatus()) ;
|
||||
}
|
||||
}
|
||||
+40
-9
@@ -5,6 +5,7 @@ import com.cf.imes.module.manage.controller.admin.plate.vo.remain.RemainPlateRes
|
||||
import com.cf.imes.module.manage.controller.admin.plate.vo.remain.RemainPlateSaveReqVO;
|
||||
import com.cf.imes.module.manage.dal.dataobject.remainplaten.RemainPlateDO;
|
||||
import com.cf.imes.module.manage.service.remainplaten.RemainPlateService;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -30,7 +31,7 @@ import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
|
||||
@Tag(name = "管理后台 - 生产单余料板表 order_remain_plate_{N}")
|
||||
@Tag(name = "管理后台 - 生产单余料板表")
|
||||
@RestController
|
||||
@RequestMapping("/manage/remain-plate")
|
||||
@Validated
|
||||
@@ -40,31 +41,61 @@ public class RemainPlateController {
|
||||
private RemainPlateService remainPlateService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建生产单余料板表 order_remain_plate_{N}")
|
||||
@Operation(summary = "创建生产单余料板表")
|
||||
@PreAuthorize("@ss.hasPermission('manage:remain-plate:create')")
|
||||
public CommonResult<Long> createRemainPlate(@Valid @RequestBody RemainPlateSaveReqVO createReqVO) {
|
||||
return success(remainPlateService.createRemainPlate(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新生产单余料板表 order_remain_plate_{N}")
|
||||
@Operation(summary = "更新生产单余料板表")
|
||||
@PreAuthorize("@ss.hasPermission('manage:remain-plate:update')")
|
||||
public CommonResult<Boolean> updateRemainPlate(@Valid @RequestBody RemainPlateSaveReqVO updateReqVO) {
|
||||
remainPlateService.updateRemainPlate(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PutMapping("/updateStatus")
|
||||
@Operation(summary = "余料板批量核销")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "余料板id集", required = true),
|
||||
@Parameter(name = "status", description = "修改的状态", required = true , example = "1"),
|
||||
@Parameter(name = "useType", description = "使用类型,0核销,1排单,2补板", required = true , example = "1"),
|
||||
@Parameter(name = "planId", description = "排单 ID", example = "1")
|
||||
})
|
||||
@PreAuthorize("@ss.hasPermission('manage:remain-plate:update')")
|
||||
public CommonResult<Boolean> updateRemainPlate(@RequestParam("id") Set<Long> ids,
|
||||
@RequestParam("status") Integer status,
|
||||
@RequestParam("useType") Integer useType,
|
||||
@RequestParam("planId") Long planId) {
|
||||
remainPlateService.updateRemainPlateStatus(ids,status,useType,planId);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PutMapping("/revertUpdate")
|
||||
@Operation(summary = "余料板批量释放")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "余料板id集", required = true),
|
||||
@Parameter(name = "status", description = "修改的状态", required = true , example = "1")
|
||||
})
|
||||
@PreAuthorize("@ss.hasPermission('manage:remain-plate:update')")
|
||||
public CommonResult<Boolean> updateRemainPlate(@RequestParam("id") Set<Long> ids,
|
||||
@RequestParam("status") Integer status) {
|
||||
remainPlateService.revertRemainPlateStatus(ids,status);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除生产单余料板表 order_remain_plate_{N}")
|
||||
@Operation(summary = "删除生产单余料板表")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('manage:remain-plate:delete')")
|
||||
public CommonResult<Boolean> deleteRemainPlate(@RequestParam("id") Long id) {
|
||||
remainPlateService.deleteRemainPlate(id);
|
||||
public CommonResult<Boolean> deleteRemainPlate(@RequestParam("id") Set<Long> ids) {
|
||||
remainPlateService.deleteRemainPlate(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得生产单余料板表 order_remain_plate_{N}")
|
||||
@Operation(summary = "获得生产单余料板表")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('manage:remain-plate:query')")
|
||||
public CommonResult<RemainPlateRespVO> getRemainPlate(@RequestParam("id") Long id) {
|
||||
@@ -73,7 +104,7 @@ public class RemainPlateController {
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得生产单余料板表 order_remain_plate_{N}分页")
|
||||
@Operation(summary = "获得生产单余料板表分页")
|
||||
@PreAuthorize("@ss.hasPermission('manage:remain-plate:query')")
|
||||
public CommonResult<PageResult<RemainPlateRespVO>> getRemainPlatePage(@Valid RemainPlatePageReqVO pageReqVO) {
|
||||
PageResult<RemainPlateDO> pageResult = remainPlateService.getRemainPlatePage(pageReqVO);
|
||||
@@ -81,7 +112,7 @@ public class RemainPlateController {
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出生产单余料板表 order_remain_plate_{N} Excel")
|
||||
@Operation(summary = "导出生产单余料板表Excel")
|
||||
@PreAuthorize("@ss.hasPermission('manage:remain-plate:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportRemainPlateExcel(@Valid RemainPlatePageReqVO pageReqVO,
|
||||
|
||||
+13
-4
@@ -19,12 +19,21 @@ public class RemainPlatePageReqVO extends PageParam {
|
||||
@Schema(description = "排单 ID", example = "16628")
|
||||
private Long planId;
|
||||
|
||||
@Schema(description = "组织id", example = "1")
|
||||
private Long organId;
|
||||
|
||||
@Schema(description = "初始排单 ID", example = "6628")
|
||||
private Long initPlanId;
|
||||
|
||||
@Schema(description = "余料板状态,0未使用,1使用中,2已使用", example = "1")
|
||||
@Schema(description = "余料板状态,0未使用,1使用中", example = "0")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "是否为开料添加,0否,1是", example = "0")
|
||||
private Boolean isCutting;
|
||||
|
||||
@Schema(description = "使用类型,0核销,1排单,2补板", example = "0")
|
||||
private Integer useType;
|
||||
|
||||
@Schema(description = "商品 ID", example = "7425")
|
||||
private String goodsId;
|
||||
|
||||
@@ -38,10 +47,10 @@ public class RemainPlatePageReqVO extends PageParam {
|
||||
private String color;
|
||||
|
||||
@Schema(description = "宽度")
|
||||
private BigDecimal width;
|
||||
private BigDecimal[] width;
|
||||
|
||||
@Schema(description = "长度")
|
||||
private BigDecimal length;
|
||||
private BigDecimal[] length;
|
||||
|
||||
@Schema(description = "厚度")
|
||||
private BigDecimal thickness;
|
||||
@@ -62,7 +71,7 @@ public class RemainPlatePageReqVO extends PageParam {
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "轮廊数据,Json 串")
|
||||
private String outline;
|
||||
private String outLineJson;
|
||||
|
||||
@Schema(description = "创建日期")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
|
||||
+15
-3
@@ -16,6 +16,10 @@ public class RemainPlateRespVO {
|
||||
@ExcelProperty("余料板 ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "组织id", example = "1")
|
||||
@ExcelIgnore
|
||||
private Long organId;
|
||||
|
||||
@Schema(description = "排单 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "16628")
|
||||
@ExcelProperty("排单 ID")
|
||||
private Long planId;
|
||||
@@ -24,10 +28,18 @@ public class RemainPlateRespVO {
|
||||
@ExcelProperty("初始排单 ID")
|
||||
private Long initPlanId;
|
||||
|
||||
@Schema(description = "余料板状态,0未使用,1使用中,2已使用", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@ExcelProperty("余料板状态,0未使用,1使用中,2已使用")
|
||||
@Schema(description = "余料板状态,0未使用,1使用中", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@ExcelProperty("余料板状态,0未使用,1使用中")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "是否为开料添加,0否,1是", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@ExcelProperty("是否为开料添加,0否,1是")
|
||||
private Boolean isCutting;
|
||||
|
||||
@Schema(description = "使用类型,0核销,1排单,2补板", example = "0")
|
||||
@ExcelProperty("使用类型,0核销,1排单,2补板")
|
||||
private Integer useType;
|
||||
|
||||
@Schema(description = "商品 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "7425")
|
||||
@ExcelProperty("商品 ID")
|
||||
private String goodsId;
|
||||
@@ -78,7 +90,7 @@ public class RemainPlateRespVO {
|
||||
|
||||
@Schema(description = "轮廊数据,Json 串", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("轮廊数据,Json 串")
|
||||
private String outline;
|
||||
private String outLineJson;
|
||||
|
||||
@Schema(description = "创建日期", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建日期")
|
||||
|
||||
+15
-6
@@ -1,5 +1,6 @@
|
||||
package com.cf.imes.module.manage.controller.admin.plate.vo.remain;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
@@ -10,21 +11,29 @@ import java.math.BigDecimal;
|
||||
@Data
|
||||
public class RemainPlateSaveReqVO {
|
||||
|
||||
@Schema(description = "余料板 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "16470")
|
||||
@Schema(description = "余料板 ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "排单 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "16628")
|
||||
@NotNull(message = "排单 ID不能为空")
|
||||
@Schema(description = "组织id", example = "1")
|
||||
private Long organId;
|
||||
|
||||
@Schema(description = "排单 ID")
|
||||
private Long planId;
|
||||
|
||||
@Schema(description = "初始排单 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "6628")
|
||||
@NotNull(message = "初始排单 ID不能为空")
|
||||
@Schema(description = "初始排单 ID")
|
||||
private Long initPlanId;
|
||||
|
||||
@Schema(description = "余料板状态,0未使用,1使用中,2已使用", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "余料板状态,0未使用,1使用中,2已使用不能为空")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "是否为开料添加,0否,1是", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "是否为开料添加,0否,1是")
|
||||
private Boolean isCutting;
|
||||
|
||||
@Schema(description = "使用类型,0核销,1排单,2补板", example = "0")
|
||||
private Integer useType;
|
||||
|
||||
@Schema(description = "商品 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "7425")
|
||||
@NotEmpty(message = "商品 ID不能为空")
|
||||
private String goodsId;
|
||||
@@ -71,6 +80,6 @@ public class RemainPlateSaveReqVO {
|
||||
|
||||
@Schema(description = "轮廊数据,Json 串", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "轮廊数据,Json 串不能为空")
|
||||
private String outline;
|
||||
private String outLineJson;
|
||||
|
||||
}
|
||||
+9
-1
@@ -42,6 +42,14 @@ public class RemainPlateDO extends BaseDO {
|
||||
* 余料板状态,0未使用,1使用中,2已使用
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 是否为开料添加,0否,1是
|
||||
*/
|
||||
private Boolean isCutting;
|
||||
/**
|
||||
* 使用类型,0核销,1排单,2补板
|
||||
*/
|
||||
private Integer useType;
|
||||
/**
|
||||
* 商品 ID
|
||||
*/
|
||||
@@ -93,6 +101,6 @@ public class RemainPlateDO extends BaseDO {
|
||||
/**
|
||||
* 轮廊数据,Json 串
|
||||
*/
|
||||
private String outline;
|
||||
private String outLineJson;
|
||||
|
||||
}
|
||||
+18
-3
@@ -1,5 +1,6 @@
|
||||
package com.cf.imes.module.manage.dal.mysql.remainplaten;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||
@@ -7,6 +8,8 @@ import com.cf.imes.module.manage.controller.admin.plate.vo.remain.RemainPlatePag
|
||||
import com.cf.imes.module.manage.dal.dataobject.remainplaten.RemainPlateDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 生产单余料板表 order_remain_plate_{N} Mapper
|
||||
*
|
||||
@@ -21,20 +24,32 @@ public interface RemainPlateMapper extends BaseMapperX<RemainPlateDO> {
|
||||
.eqIfPresent(RemainPlateDO::getInitPlanId, reqVO.getInitPlanId())
|
||||
.eqIfPresent(RemainPlateDO::getStatus, reqVO.getStatus())
|
||||
.eqIfPresent(RemainPlateDO::getGoodsId, reqVO.getGoodsId())
|
||||
.eqIfPresent(RemainPlateDO::getIsCutting, reqVO.getIsCutting())
|
||||
.likeIfPresent(RemainPlateDO::getName, reqVO.getName())
|
||||
.eqIfPresent(RemainPlateDO::getMaterial, reqVO.getMaterial())
|
||||
.eqIfPresent(RemainPlateDO::getColor, reqVO.getColor())
|
||||
.eqIfPresent(RemainPlateDO::getWidth, reqVO.getWidth())
|
||||
.eqIfPresent(RemainPlateDO::getLength, reqVO.getLength())
|
||||
.eqIfPresent(RemainPlateDO::getThickness, reqVO.getThickness())
|
||||
.eqIfPresent(RemainPlateDO::getBrand, reqVO.getBrand())
|
||||
.eqIfPresent(RemainPlateDO::getPlaceStyle, reqVO.getPlaceStyle())
|
||||
.eqIfPresent(RemainPlateDO::getStore, reqVO.getStore())
|
||||
.eqIfPresent(RemainPlateDO::getCount, reqVO.getCount())
|
||||
.eqIfPresent(RemainPlateDO::getRemark, reqVO.getRemark())
|
||||
.eqIfPresent(RemainPlateDO::getOutline, reqVO.getOutline())
|
||||
.eqIfPresent(RemainPlateDO::getUseType, reqVO.getUseType())
|
||||
.eqIfPresent(RemainPlateDO::getOrganId, reqVO.getOrganId())
|
||||
.eqIfPresent(RemainPlateDO::getOutLineJson, reqVO.getOutLineJson())
|
||||
.betweenIfPresent(RemainPlateDO::getWidth, reqVO.getWidth())
|
||||
.betweenIfPresent(RemainPlateDO::getLength, reqVO.getLength())
|
||||
.betweenIfPresent(RemainPlateDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(RemainPlateDO::getId));
|
||||
}
|
||||
|
||||
// 批量修改状态
|
||||
default void updateRemainPlateStatus(Set<Long> ids, Integer status, Integer useType,Long organId,Long planId) {
|
||||
update(new UpdateWrapper<RemainPlateDO>()
|
||||
.set("status", status)
|
||||
.set("use_type", useType)
|
||||
.set("plan_id",planId)
|
||||
.eq("organ_id",organId)
|
||||
.in("id", ids));
|
||||
}
|
||||
}
|
||||
+29
-10
@@ -6,16 +6,17 @@ import com.cf.imes.module.manage.controller.admin.plate.vo.remain.RemainPlateSav
|
||||
import com.cf.imes.module.manage.dal.dataobject.remainplaten.RemainPlateDO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 生产单余料板表 order_remain_plate_{N} Service 接口
|
||||
* 生产单余料板表 Service 接口
|
||||
*
|
||||
* @author 晨丰科技
|
||||
*/
|
||||
public interface RemainPlateService {
|
||||
|
||||
/**
|
||||
* 创建生产单余料板表 order_remain_plate_{N}
|
||||
* 创建生产单余料板表
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
@@ -23,32 +24,50 @@ public interface RemainPlateService {
|
||||
Long createRemainPlate(@Valid RemainPlateSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新生产单余料板表 order_remain_plate_{N}
|
||||
* 批量核销
|
||||
*
|
||||
* @param ids 编号
|
||||
* @param status 状态
|
||||
* @param useType 使用类型
|
||||
* @param planId 排单id
|
||||
*/
|
||||
void updateRemainPlateStatus(Set<Long> ids, Integer status,Integer useType,Long planId);
|
||||
|
||||
/**
|
||||
* 更新生产单余料板表
|
||||
*
|
||||
* @param ids 编号
|
||||
* @param status 状态
|
||||
*/
|
||||
void revertRemainPlateStatus(Set<Long> ids, Integer status);
|
||||
|
||||
/**
|
||||
* 核销板材库
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateRemainPlate(@Valid RemainPlateSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除生产单余料板表 order_remain_plate_{N}
|
||||
* 删除生产单余料板表
|
||||
*
|
||||
* @param id 编号
|
||||
* @param ids 编号
|
||||
*/
|
||||
void deleteRemainPlate(Long id);
|
||||
void deleteRemainPlate(Set<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得生产单余料板表 order_remain_plate_{N}
|
||||
* 获得生产单余料板表
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 生产单余料板表 order_remain_plate_{N}
|
||||
* @return 生产单余料板表
|
||||
*/
|
||||
RemainPlateDO getRemainPlate(Long id);
|
||||
|
||||
/**
|
||||
* 获得生产单余料板表 order_remain_plate_{N}分页
|
||||
* 获得生产单余料板表
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 生产单余料板表 order_remain_plate_{N}分页
|
||||
* @return 生产单余料板表
|
||||
*/
|
||||
PageResult<RemainPlateDO> getRemainPlatePage(RemainPlatePageReqVO pageReqVO);
|
||||
|
||||
|
||||
+60
-7
@@ -1,9 +1,11 @@
|
||||
package com.cf.imes.module.manage.service.remainplaten;
|
||||
|
||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||
import com.cf.imes.module.manage.controller.admin.plate.vo.remain.RemainPlatePageReqVO;
|
||||
import com.cf.imes.module.manage.controller.admin.plate.vo.remain.RemainPlateSaveReqVO;
|
||||
import com.cf.imes.module.manage.dal.dataobject.remainplaten.RemainPlateDO;
|
||||
import com.cf.imes.module.manage.dal.mysql.remainplaten.RemainPlateMapper;
|
||||
import com.cf.imes.module.manage.enums.RemainPlateStatusEnum;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
@@ -13,8 +15,10 @@ import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.REMAIN_PLATE_NOT_EXISTS;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 生产单余料板表 order_remain_plate_{N} Service 实现类
|
||||
@@ -37,21 +41,58 @@ public class RemainPlateServiceImpl implements RemainPlateService {
|
||||
return remainPlate.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateRemainPlateStatus(Set<Long> ids, Integer status, Integer useType,Long planId) {
|
||||
//判断是否符合核销标准
|
||||
validateRemainPlateStatus(ids,RemainPlateStatusEnum.UNUSED.getStatus());
|
||||
//以id为条件批量修改余料库中的状态
|
||||
remainPlateMapper.updateRemainPlateStatus(ids, status, useType, OrganContextHolder.getOrganId(),planId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void revertRemainPlateStatus(Set<Long> ids, Integer status) {
|
||||
// 判断余料的状态 为使用中
|
||||
validateRemainPlateStatus(ids,RemainPlateStatusEnum.IN_USE.getStatus());
|
||||
remainPlateMapper.updateRemainPlateStatus(ids, status, null, OrganContextHolder.getOrganId(),null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateRemainPlate(RemainPlateSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateRemainPlateExists(updateReqVO.getId());
|
||||
// 更新
|
||||
RemainPlateDO updateObj = BeanUtils.toBean(updateReqVO, RemainPlateDO.class);
|
||||
// 是否使用
|
||||
if (validateRemainPlateStatus(updateReqVO.getId()) == RemainPlateStatusEnum.IN_USE.getStatus()){
|
||||
throw exception(REMAIN_PLATE_STATUS_USED);
|
||||
}
|
||||
// 判断是否为开料添加
|
||||
RemainPlateDO updateObj = new RemainPlateDO();
|
||||
if (validateRemainPlateIsCutting(updateReqVO.getId())){
|
||||
updateObj.setRemark(updateReqVO.getRemark());
|
||||
}else {
|
||||
// 更新
|
||||
updateObj = BeanUtils.toBean(updateReqVO, RemainPlateDO.class);
|
||||
}
|
||||
remainPlateMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteRemainPlate(Long id) {
|
||||
// 校验存在
|
||||
validateRemainPlateExists(id);
|
||||
public void deleteRemainPlate(Set<Long> ids) {
|
||||
// 判断余料的状态 为使用中
|
||||
validateRemainPlateStatus(ids,RemainPlateStatusEnum.IN_USE.getStatus());
|
||||
// 删除
|
||||
remainPlateMapper.deleteById(id);
|
||||
remainPlateMapper.deleteBatchIds(ids);
|
||||
}
|
||||
|
||||
// 判断余料板是否正在使用
|
||||
private void validateRemainPlateStatus(Set<Long> ids, Integer status) {
|
||||
for (Long id : ids) {
|
||||
if (validateRemainPlateStatus(id) == status) {
|
||||
if (status == RemainPlateStatusEnum.IN_USE.getStatus())
|
||||
throw exception(REMAIN_PLATE_STATUS_USED);
|
||||
if (status == RemainPlateStatusEnum.UNUSED.getStatus())
|
||||
throw exception(REMAIN_PLATE_STATUS_NO_USED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void validateRemainPlateExists(Long id) {
|
||||
@@ -60,6 +101,18 @@ public class RemainPlateServiceImpl implements RemainPlateService {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean validateRemainPlateIsCutting(Long id) {
|
||||
return remainPlateMapper.selectById(id).getIsCutting();
|
||||
}
|
||||
|
||||
private Integer validateRemainPlateStatus(Long id) {
|
||||
return remainPlateMapper.selectById(id).getStatus();
|
||||
}
|
||||
|
||||
private Integer validateRemainPlateUseType(Long id) {
|
||||
return remainPlateMapper.selectById(id).getUseType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public RemainPlateDO getRemainPlate(Long id) {
|
||||
return remainPlateMapper.selectById(id);
|
||||
|
||||
+3
@@ -256,4 +256,7 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode APPLICATION_LOGIN_USER_DISABLED = new ErrorCode(1_002_037_001, "应用登陆失败");
|
||||
|
||||
ErrorCode ERR = new ErrorCode(1_002_038_001, "未知错误");
|
||||
|
||||
ErrorCode REMAIN_PLATE_STATUS_USED = new ErrorCode(1_002_038_001, "余料板正在使用中,禁止修改");
|
||||
ErrorCode REMAIN_PLATE_STATUS_NO_USED = new ErrorCode(1_002_038_001, "余料板未使用");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user