Commit 4535d683eed9beeb6a780b9424fc9bdb816dcb73

Authored by 房远帅
1 parent 6823110f

采购计划:1:新增冻结状态,计划类型;2:生成合同

... ... @@ -1925,6 +1925,8 @@ CREATE TABLE `procurement_plan`
1925 1925 `approval_status` varchar(50) DEFAULT NULL COMMENT '审核状态',
1926 1926 `process_status` varchar(50) DEFAULT NULL COMMENT '流程状态',
1927 1927 `process_node` varchar(50) DEFAULT NULL COMMENT '流程节点',
  1928 + `frozen` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否冻结 0否 1是',
  1929 + `plan_type` varchar(50) DEFAULT NULL COMMENT '计划类型: 补、变、补 变',
1928 1930 `create_by_id` varchar(32) DEFAULT NULL COMMENT '创建人ID',
1929 1931 `create_by` varchar(64) DEFAULT NULL COMMENT '创建人',
1930 1932 `update_by_id` varchar(32) DEFAULT NULL COMMENT '更新人ID',
... ...
... ... @@ -107,6 +107,19 @@ public class ProcurementPlanController extends DefaultBaseController {
107 107 }
108 108
109 109 /**
  110 + * 生成合同
  111 + */
  112 + @ApiOperation("生成合同")
  113 + @HasPermission({"procurement:plan:modify"})
  114 + @PostMapping("/generateContract")
  115 + public InvokeResult<Void> generateContract(@Valid String id) {
  116 +
  117 + procurementPlanService.generateContract(id);
  118 +
  119 + return InvokeResultBuilder.success();
  120 + }
  121 +
  122 + /**
110 123 * 删除
111 124 */
112 125 @ApiOperation("删除")
... ...
... ... @@ -273,6 +273,16 @@ public class ProcurementPlan extends BaseEntity implements BaseDto {
273 273 private String processNode;
274 274
275 275 /**
  276 + * 是否冻结 0否 1是
  277 + */
  278 + private Boolean frozen;
  279 +
  280 + /**
  281 + * 计划类型 补单 变更 补单+变更
  282 + */
  283 + private String planType;
  284 +
  285 + /**
276 286 * 创建人ID
277 287 */
278 288 @TableField(fill = FieldFill.INSERT)
... ...
... ... @@ -2,6 +2,7 @@ package com.lframework.xingyun.sc.procurement.impl.plan;
2 2
3 3 import cn.hutool.core.bean.BeanUtil;
4 4 import com.baomidou.mybatisplus.core.conditions.Wrapper;
  5 +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
5 6 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
6 7 import com.github.pagehelper.PageInfo;
7 8 import com.lframework.starter.common.exceptions.impl.DefaultClientException;
... ... @@ -18,7 +19,6 @@ import com.lframework.starter.web.core.utils.PageResultUtil;
18 19 import com.lframework.xingyun.sc.bo.procurement.GetProcurementPlanBo;
19 20 import com.lframework.xingyun.sc.procurement.entity.ProcurementPlan;
20 21 import com.lframework.xingyun.sc.procurement.entity.ProcurementPlanLine;
21   -import com.lframework.xingyun.sc.procurement.entity.SalesmanQuotation;
22 22 import com.lframework.xingyun.sc.procurement.mappers.plan.ProcurementPlanMapper;
23 23 import com.lframework.xingyun.sc.procurement.service.plan.ProcurementPlanLineService;
24 24 import com.lframework.xingyun.sc.procurement.service.plan.ProcurementPlanService;
... ... @@ -212,6 +212,21 @@ public class ProcurementPlanServiceImpl extends BaseMpServiceImpl<ProcurementPla
212 212 getBaseMapper().deleteById(id);
213 213 }
214 214
  215 + @Transactional(rollbackFor = Exception.class)
  216 + @Override
  217 + public void generateContract(String id) {
  218 + if (StringUtil.isBlank(id)) {
  219 + throw new InputErrorException("ID不能为空!");
  220 + }
  221 + //todo 后面合同模块需要补充生成合同的逻辑
  222 + LambdaUpdateWrapper<ProcurementPlan> updateWrapper = Wrappers.lambdaUpdate(ProcurementPlan.class)
  223 + .set(ProcurementPlan::getProcessNode, "GYGLKZLGLG")
  224 + .set(ProcurementPlan::getProcessStatus, "TO_SPLIT")
  225 + .eq(ProcurementPlan::getId, id);
  226 +
  227 + getBaseMapper().update(updateWrapper);
  228 + }
  229 +
215 230 /**
216 231 * 生成采购计划编号(业务要求按日期时间生成,保证唯一)
217 232 *
... ...
... ... @@ -770,27 +770,7 @@ public class SalesmanQuotationServiceImpl
770 770 vo.setMaterialConditionWhiteYellow(normalizeMaterialText(enabled, salesmanQuotation.getMaterialConditionWhiteYellow()));
771 771 vo.setMaterialConditionPhosphorCopper(normalizeMaterialText(enabled, salesmanQuotation.getMaterialConditionPhosphorCopper()));
772 772 vo.setProcessStatus("TO_SUPPLEMENT");
773   - List<SysRole> sysRoleList = sysRoleService.getByUserId(SecurityUtil.getCurrentUser().getId());
774   - if (CollectionUtil.isNotEmpty(sysRoleList)) {
775   - // 1. 提取角色列表中的所有 code,转换为 Set 集合,提升后续判断效率
776   - Set<String> roleCodeSet = sysRoleList.stream()
777   - .map(SysRole::getCode)
778   - .collect(Collectors.toSet());
779   -
780   - // 2. 判断是否包含采购主管相关的角色
781   - if (roleCodeSet.contains("htcgeczg") || roleCodeSet.contains("htcgyczg")
782   - || roleCodeSet.contains("ltcgczg") || roleCodeSet.contains("ztcgczg")) {
783   - vo.setProcessNode("CGCZG");
784   - } else if (roleCodeSet.contains("qyjl")) {
785   - // 3. 如果没有,继续判断是否包含区域经理
786   - vo.setProcessNode("QYJL");
787   - } else if (roleCodeSet.contains("nmcgkywy")) {
788   - // 4. 如果还没有,继续判断是否包含内贸采购科业务员
789   - vo.setProcessNode("YWY");
790   - } else {
791   - throw new DefaultClientException("当前角色无法生成计划!");
792   - }
793   - }
  773 + vo.setProcessNode("GYGLKJHGLY");
794 774
795 775 // 明细行:按报价明细逐行带入
796 776 List<ProcurementPlanLineVo> lineVoList = new ArrayList<>();
... ...
... ... @@ -58,4 +58,11 @@ public interface ProcurementPlanService extends BaseMpService<ProcurementPlan> {
58 58 * @param id
59 59 */
60 60 void deleteById(String id);
  61 +
  62 + /**
  63 + * 生成合同
  64 + *
  65 + * @param id
  66 + */
  67 + void generateContract(String id);
61 68 }
... ...
... ... @@ -310,6 +310,18 @@ public class CreateProcurementPlanVo implements BaseVo, Serializable {
310 310 private String processNode;
311 311
312 312 /**
  313 + * 是否冻结 0否 1是
  314 + */
  315 + @ApiModelProperty("是否冻结 0否 1是")
  316 + private Boolean frozen;
  317 +
  318 + /**
  319 + * 计划类型 正常 补单 变更 补单+变更
  320 + */
  321 + @ApiModelProperty("计划类型 补单 变更 补单+变更")
  322 + private String planType;
  323 +
  324 + /**
313 325 * 明细信息
314 326 */
315 327 @ApiModelProperty(value = "明细信息", required = true)
... ...
... ... @@ -69,4 +69,16 @@ public class QueryProcurementPlanVo extends SortPageVo {
69 69 */
70 70 @ApiModelProperty("流程节点")
71 71 private String processNode;
  72 +
  73 + /**
  74 + * 是否冻结 0否 1是
  75 + */
  76 + @ApiModelProperty("是否冻结 0否 1是")
  77 + private Boolean frozen;
  78 +
  79 + /**
  80 + * 计划类型 正常 补单 变更 补单+变更
  81 + */
  82 + @ApiModelProperty("计划类型:补、变、补 变")
  83 + private String planType;
72 84 }
... ...
... ... @@ -311,6 +311,18 @@ public class UpdateProcurementPlanVo implements BaseVo, Serializable {
311 311 private String processNode;
312 312
313 313 /**
  314 + * 是否冻结 0否 1是
  315 + */
  316 + @ApiModelProperty("是否冻结 0否 1是")
  317 + private Boolean frozen;
  318 +
  319 + /**
  320 + * 计划类型 补单 变更 补单+变更
  321 + */
  322 + @ApiModelProperty("计划类型 补单 变更 补单+变更")
  323 + private String planType;
  324 +
  325 + /**
314 326 * 明细信息
315 327 */
316 328 @ApiModelProperty(value = "明细信息", required = true)
... ...
... ... @@ -53,6 +53,8 @@
53 53 <result column="approval_status" property="approvalStatus"/>
54 54 <result column="process_status" property="processStatus"/>
55 55 <result column="process_node" property="processNode"/>
  56 + <result column="frozen" property="frozen"/>
  57 + <result column="plan_type" property="planType"/>
56 58 <result column="create_by_id" property="createById"/>
57 59 <result column="create_by" property="createBy"/>
58 60 <result column="update_by_id" property="updateById"/>
... ... @@ -113,6 +115,8 @@
113 115 pp.approval_status,
114 116 pp.process_status,
115 117 pp.process_node,
  118 + pp.frozen,
  119 + pp.plan_type,
116 120 pp.create_by_id,
117 121 pp.create_by,
118 122 pp.update_by_id,
... ... @@ -165,6 +169,12 @@
165 169 <if test="vo.processNode != null and vo.processNode != ''">
166 170 AND pp.process_node = #{vo.processNode}
167 171 </if>
  172 + <if test="vo.frozen != null">
  173 + AND pp.frozen = #{vo.frozen}
  174 + </if>
  175 + <if test="vo.planType != null and vo.planType != ''">
  176 + AND pp.plan_type LIKE CONCAT('%', #{vo.planType}, '%')
  177 + </if>
168 178 </if>
169 179 </where>
170 180 ORDER BY pp.create_time DESC
... ...