|
@@ -0,0 +1,70 @@
|
|
|
+package com.fjhx.mes.flow;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.fjhx.common.enums.FlowStatusEnum1;
|
|
|
+import com.fjhx.common.utils.Assert;
|
|
|
+import com.fjhx.flow.core.FlowDelegate;
|
|
|
+import com.fjhx.flow.enums.FlowStatusEnum;
|
|
|
+import com.fjhx.flow.enums.NodeTypeEnum;
|
|
|
+import com.fjhx.mes.entity.production.dto.ProductionBeginConfirmDto;
|
|
|
+import com.fjhx.mes.entity.production.po.ProductionBeginConfirm;
|
|
|
+import com.fjhx.mes.entity.production.po.ProductionOrder;
|
|
|
+import com.fjhx.mes.service.production.ProduceOrderService;
|
|
|
+import com.fjhx.mes.service.production.ProductionBeginConfirmService;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+
|
|
|
+@Component
|
|
|
+public class ProdBeginConfirmFlow extends FlowDelegate {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private ProduceOrderService produceOrderService;
|
|
|
+ @Resource
|
|
|
+ private ProductionBeginConfirmService productionBeginConfirmService;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String getFlowKey() {
|
|
|
+ return "prod_begin_confirm_flow";
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Long start(Long flowId, JSONObject submitData) {
|
|
|
+ ProductionBeginConfirmDto dto = submitData.toJavaObject(ProductionBeginConfirmDto.class);
|
|
|
+ Assert.notEmpty(dto.getProdOrderId(), "生产订单Id不能为空!");
|
|
|
+ ProductionOrder orderById = produceOrderService.getById(dto.getProdOrderId());
|
|
|
+ Assert.notEmpty(orderById, "查询不到生产信息!");
|
|
|
+
|
|
|
+ dto.setFlowId(flowId);
|
|
|
+ dto.setStatus(FlowStatusEnum1.UNDER_REVIEW.getKey());
|
|
|
+
|
|
|
+ //回填单号
|
|
|
+ submitData.put("orderCode", orderById.getCode());
|
|
|
+
|
|
|
+ productionBeginConfirmService.save(dto);
|
|
|
+ return dto.getId();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void defaultMethod(Long flowId, Long businessId, NodeTypeEnum handleNodeType, FlowStatusEnum flowStatus, JSONObject submitData) {
|
|
|
+ ProductionBeginConfirmDto dto = submitData.toJavaObject(ProductionBeginConfirmDto.class);
|
|
|
+ productionBeginConfirmService.updateById(dto);
|
|
|
+ super.defaultMethod(flowId, businessId, handleNodeType, flowStatus, submitData);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void end(Long flowId, Long businessId, JSONObject submitData) {
|
|
|
+ ProductionBeginConfirm pbcById = productionBeginConfirmService.getById(businessId);
|
|
|
+ productionBeginConfirmService.update(q -> q
|
|
|
+ .eq(ProductionBeginConfirm::getId, businessId)
|
|
|
+ .set(ProductionBeginConfirm::getStatus, FlowStatusEnum1.PASS.getKey())
|
|
|
+ );
|
|
|
+ produceOrderService.update(q -> q
|
|
|
+ .eq(ProductionOrder::getId, pbcById.getProdOrderId())
|
|
|
+ .set(ProductionOrder::getIsAgreeWork, pbcById.getIsAgreeWork())
|
|
|
+ .set(ProductionOrder::getProdBeginConfirmId, businessId)
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|