Commit cbecc03f authored by 刘学辉's avatar 刘学辉

品质异常单调整

parent 0d7590b1
......@@ -47,3 +47,21 @@ ADD COLUMN `single_thickness` decimal(10, 4) NULL COMMENT '单层厚' AFTER `wid
-- 2024-09-10 异常单增加审批节点字段
ALTER TABLE topsun_dev.sap_exception_report ADD handle_node_id varchar(100) NULL COMMENT '流程处理节点';
ALTER TABLE topsun_dev.sap_exception_report ADD handle_node_name varchar(100) NULL;
--2024-09-12 异常单审批过程中增加责任人的历史记录
CREATE TABLE topsun_dev.sap_exception_responsible (
id varchar(100) NOT NULL,
exception_report_id varchar(100) NULL,
bill_code varchar(100) NULL,
duty_dept varchar(100) NULL,
duty_dept_name varchar(100) NULL,
check_operator varchar(100) NULL,
check_operator_name varchar(100) NULL,
created_id varchar(100) NULL,
created_name varchar(100) NULL,
create_date DATETIME NULL,
version INTEGER NULL,
remark varchar(100) NULL
)
ENGINE=InnoDB
DEFAULT CHARSET=utf8mb4
COLLATE=utf8mb4_general_ci;
<%--采购申请--%>
<%@ page contentType="text/html; charset=utf-8" language="java" %>
<%@ taglib uri="/WEB-INF/taglib.tld" prefix="x" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
......@@ -29,25 +28,24 @@
<x:hidden name="statusId"/>
<x:hidden name="frgdt"/>
<div class="hg-form-cols">
<c:if test="${statusId==3}">
<c:if test="${statusId==1||statusId==3}">
<div style="float: right; margin-right: 10px;" class="btn-group" id="buttonBox">
<button id="save" title="" type="button" onclick="printPage()" class="btn btn-gray"><i
class="fa fa-save"></i>打印
</button>
</div
</div>
</c:if>
<div class="hg-form-row">
<x:selectC name="exceptionType" label="异常类型" labelCol="1" fieldCol="2" required="true" dictionary="exceptionType"/>
<x:inputC name="reportDate" label="呈报日期" labelCol="1" fieldCol="2" required="true" wrapper="date"/>
<x:inputC name="werksName" required="true" label="工厂" labelCol="1" wrapper="select" fieldCol="2"/>
<x:hidden name="werks"/>
<x:inputC name="appealNo" label="客诉编号" labelCol="1" fieldCol="2" required="false"/>
</div>
<div class="hg-form-row">
<x:inputC name="customerNo" label="客户编号" labelCol="1" fieldCol="2" required="true"/>
<x:inputC name="customerOrderNo" label="客户订单号" labelCol="1" fieldCol="2" wrapper="select" required="true"/>
<x:inputC name="customerName" label="客户名称" labelCol="1" fieldCol="2" required="false" readonly="true"/>
<!--x:inputC name="customerOrderNo" label="客户单号" labelCol="1" fieldCol="2" required="true"/-->
</div>
</div>
......@@ -87,7 +85,7 @@
<x:title title="责任人信息" name="group" hideTable="#info" />
<div id="dutyPersonGrid"></div>
<div class="hg-form-row">
<x:inputC name="payMoney" label="赔付金额" labelCol="1" fieldCol="2" required="false" readonly="false" />
<x:inputC name="payMoney" label="赔付金额" labelCol="1" fieldCol="2" required="false" />
<x:inputC name="loseMoney" label="损失金额" labelCol="1" fieldCol="2" required="false" readonly="true" />
</div>
</form>
......
......@@ -29,7 +29,7 @@
<x:hidden name="exceptionType" value="out"/>
<x:hidden name="frgdt"/>
<div class="hg-form-cols">
<c:if test="${statusId==3}">
<c:if test="${statusId==1||statusId==3}">
<div style="float: right; margin-right: 10px;" class="btn-group" id="buttonBox">
<button id="save" title="" type="button" onclick="printPage()" class="btn btn-gray"><i
class="fa fa-save"></i>打印
......
......@@ -12,8 +12,8 @@ function initUI() {
function initGrid() {
var toolbarOptions = UICtrl.getDefaultToolbarOptions({
addHandler: addHandler
/*addProduceHandler: {id: 'produceException', text: '添加生产异常单', img: 'fa-music', className: 'btn-gray',
// addHandler: addHandler
addProduceHandler: {id: 'produceException', text: '添加', img: 'fa-music', className: 'btn-gray',
click: function () {
UICtrl.addTabItem({
tabid: 'addExceptionReportProduce',
......@@ -21,8 +21,8 @@ function initGrid() {
url: web_app.name + '/exceptionReport/addExceptionReportDetail.job?billType=produce'
});
}
},
addPurchaseHandler: {id: 'purchaseException', text: '添加采购异常单', img: 'fa-building-o', className: 'btn-gray',
}
/* addPurchaseHandler: {id: 'purchaseException', text: '添加采购异常单', img: 'fa-building-o', className: 'btn-gray',
click: function () {
UICtrl.addTabItem({
tabid: 'addExceptionReportPurchase',
......
......@@ -2,6 +2,7 @@ package com.huigou.topsun.sap.exceptionReport.application.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.huigou.cache.DictUtil;
......@@ -25,6 +26,7 @@ import com.huigou.topsun.sap.exceptionReport.domain.vo.PurchaseOrderItemVo;
import com.huigou.topsun.sap.exceptionReport.domain.vo.PurchaseOrderVo;
import com.huigou.topsun.sap.exceptionReport.repository.ExceptionReportPayableRepository;
import com.huigou.topsun.sap.exceptionReport.repository.ExceptionReportRepository;
import com.huigou.topsun.sap.exceptionReport.repository.ExceptionReportResponsibleRepository;
import com.huigou.topsun.sap.permit.application.SapPermitApplication;
import com.huigou.topsun.sap.permit.domain.SapPermit;
import com.huigou.topsun.sap.permit.domain.SapPermitItem;
......@@ -57,7 +59,9 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer;
import sun.applet.resources.MsgAppletViewer_es;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
......@@ -104,6 +108,8 @@ public class ExceptionReportApplicationImpl extends FlowBroker implements Except
private MannualStartWorkApplication mannualStartWorkApplication;
@Autowired
private WorkflowApplication workflowApplication;
@Autowired
private ExceptionReportResponsibleRepository exceptionReportResponsibleRepository;
@Autowired
private TaskExecutor asyncWriteExecutor;
......@@ -159,11 +165,12 @@ public class ExceptionReportApplicationImpl extends FlowBroker implements Except
if (StringUtils.isBlank(exceptionReport.getDutyDept())){
exceptionReport.setDutyDept("0");
}
/* 采购的单据 根据加减签 去更改为责任人
if (exceptionReport.getStatusId()==1&&("purchase".equals(exceptionReport.getBillType())||"outgoing".equals(exceptionReport.getBillType()))
//&&!"auditDept".equals(exceptionReport.getHandleNodeId()) //不是审计部审批的
// &&StringUtils.isBlank(exceptionReport.getDutyDept()) //责任部门是空 最后的审批人就是责任人
){
// String ds=exceptionReport.getHandleNodeId();
// String ds=exceptionReport.getHandleNodeId(); // 加减签的转为责任人
Map<String, Object> mapSigns=workflowApplication.queryCounterSignHandlers(exceptionReport.getId(),"Approve");
List <Map<String,Object>>plist=(List)mapSigns.get("Rows");
......@@ -177,9 +184,23 @@ public class ExceptionReportApplicationImpl extends FlowBroker implements Except
exceptionReport.setDutyDeptName(map.get("deptName").toString());
Org org = orgApplication.loadOrg(map.get("handlerId").toString());
exceptionReport.setDutyDept(org.getDeptId());
// }
}
}
} */
SDO params = this.getBizAndApprovalData();
if ("produce".equals(exceptionReport.getBillType())
&&"advance".equals(params.getProperty("processAction"))
) {
// Operator operator = ThreadLocalUtil.getOperator();
List <ExceptionReportResponsible>rslist=exceptionReportResponsibleRepository.findByExceptionReportId(exceptionReport.getId());
if (!ObjectUtils.isEmpty(rslist)){
ExceptionReportResponsible lastResponsible=rslist.get(rslist.size()-1);
if (!lastResponsible.getCheckOperator().equals(exceptionReport.getCheckOperator())){
saveResponsibles(params,exceptionReport);
}
} else {
saveResponsibles(params,exceptionReport);
}
}
exceptionReport = this.saveExceptionReport(exceptionReport);
if (CollectionUtil.isNotEmpty(exceptionReportItems)){
......@@ -223,6 +244,67 @@ public class ExceptionReportApplicationImpl extends FlowBroker implements Except
return exceptionReport.getId();
}
private void saveResponsibles(SDO params,ExceptionReport exceptionReport){
Operator operator = ThreadLocalUtil.getOperator();
if (StringUtils.isNotBlank(exceptionReport.getDutyDept())){ //责任部门不为空
ExceptionReportResponsible exceptionReportResponsible = new ExceptionReportResponsible();
exceptionReportResponsible.setExceptionReportId(exceptionReport.getId());
exceptionReportResponsible.setBillCode(exceptionReport.getBillCode());
exceptionReportResponsible.setDutyDept(exceptionReport.getDutyDept());
exceptionReportResponsible.setDutyDeptName(exceptionReport.getDutyDeptName());
exceptionReportResponsible.setCheckOperator(exceptionReport.getCheckOperator());
exceptionReportResponsible.setCheckOperatorName(exceptionReport.getCheckOperatorName());
exceptionReportResponsible.setCreateDate(new Date());
exceptionReportResponsible.setCreatedId(operator.getPersonMemberId());
exceptionReportResponsible.setCreatedName(operator.getPersonMemberName());
exceptionReportResponsibleRepository.save(exceptionReportResponsible);
//增加责任人的审批 params.getProperty("processAction") advance
this.saveResponsibleApprover(params,exceptionReport);
}
}
//责任人审批
private void saveResponsibleApprover( SDO params,ExceptionReport exceptionReport){
String bizId = params.getString("bizId");
String procUnitId = params.getString("procUnitId");
String currentProcUnitHandlerId = params.getString("currentHandleId");
Long version = params.getLong("hiProcUnitHandlerInstVersion");
version=params.getLong("version");
List<String> minusSignIds = params.getStringList("deleted");
List<ProcUnitHandler> countersigns = params.getList("detailData", ProcUnitHandler.class);
// if (!operator.getPersonMemberId().equals(exceptionReport.getCheckOperator())) {
ProcUnitHandler procUnitHandler = new ProcUnitHandler();
Org org = orgApplication.loadOrg(exceptionReport.getCheckOperator());
procUnitHandler.setHandlerId(exceptionReport.getCheckOperator());
procUnitHandler.setHandlerName(exceptionReport.getCheckOperatorName());
procUnitHandler.setDeptId(exceptionReport.getDutyDept());
procUnitHandler.setDeptName(exceptionReport.getDutyDeptName());
procUnitHandler.setPositionId(org.getPositionId());
procUnitHandler.setPositionName(org.getPositionName());
procUnitHandler.setFullId(org.getFullId());
procUnitHandler.setFullName(org.getFullName());
procUnitHandler.setOrgId(org.getOrgId());
procUnitHandler.setOrgName(org.getOrgName());
procUnitHandler.setSubProcUnitName(exceptionReport.getDutyDeptName());
procUnitHandler.setProcUnitId(procUnitId);
procUnitHandler.setProcUnitName("品质异常报告审批");
procUnitHandler.setBizId(bizId);
procUnitHandler.setStatus(0);
procUnitHandler.setSequence(1);
procUnitHandler.setBizCode(exceptionReport.getBillCode());
procUnitHandler.setCooperationModelId(params.getProperty("currentHandleCooperationModelId").toString());
procUnitHandler.setGroupId(Integer.parseInt(params.getProperty("currentHandleGroupId").toString()) + 10);
//System.out.print("isNew=========" + procUnitHandler.isNew());
countersigns.add(procUnitHandler);
workflowApplication.saveCounterSignHandlers(bizId, procUnitId, version, currentProcUnitHandlerId, minusSignIds, countersigns);
}
/**
* 获取流程参数
*/
......@@ -344,7 +426,7 @@ public class ExceptionReportApplicationImpl extends FlowBroker implements Except
}
this.saveExceptionReport(exceptionReport);
//采购异常单根据责任部门是采购部门则生成供应商异常单
if ("purchase".equals(exceptionReport.getBillType())
if ("produce".equals(exceptionReport.getBillType())
//&&StringUtil.isNotBlank(exceptionReport.getDutyDept())
&&!"0".equals(exceptionReport.getDutyDept())) {
Org org = orgApplication.loadOrg(exceptionReport.getDutyDept());
......
......@@ -83,13 +83,13 @@ public class ExceptionReport extends FlowBillAbstractEntity {
private String dutyDeptName;
/**
* 校验员
* 责任人
*/
@Column(name = "check_operator")
private String checkOperator;
/**
* 校验员名称
* 责任人名称
*/
@Column(name = "check_operator_name")
private String checkOperatorName;
......
package com.huigou.topsun.sap.exceptionReport.domain;
import com.huigou.data.domain.model.AbstractEntity;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.math.BigDecimal;
import java.util.Date;
/**
* @Auther: lxh
* @Date: 2024/09/12/15:05
* @Description: 品质异常报告 责任人历史记录
*/
@Data
@Entity
@Table(name = "sap_exception_responsible")
public class ExceptionReportResponsible extends AbstractEntity {
/**
* 品质异常报告id
*/
@Column(name = "exception_report_id")
private String exceptionReportId;
//单据编号
@Column(name = "bill_code")
private String billCode;
/**
* 责任部门
*/
@Column(name = "duty_dept")
private String dutyDept;
/**
* 责任部门名称
*/
@Column(name = "duty_dept_name")
private String dutyDeptName;
/**
* 责任人
*/
@Column(name = "check_operator")
private String checkOperator;
/**
* 责任人名称
*/
@Column(name = "check_operator_name")
private String checkOperatorName;
@Column(name = "created_id")
private String createdId;
@Column(name = "created_name")
private String createdName;
@Column(name = "create_date")
private Date createDate;
// @Column(name = "sequence")
// private Integer sequence;
//
/*
*备注
*/
@Column(name = "remark")
private String remark;
}
package com.huigou.topsun.sap.exceptionReport.repository;
import com.huigou.topsun.sap.exceptionReport.domain.ExceptionReportCash;
import com.huigou.topsun.sap.exceptionReport.domain.ExceptionReportResponsible;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
/**
* @Auther: lxh
* @Date: 2024/09/12/16:35
* @Description:
*/
public interface ExceptionReportResponsibleRepository extends JpaRepository<ExceptionReportResponsible,String> {
List<ExceptionReportResponsible> findByExceptionReportId(String exceptionReportId);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment