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

品质异常单审批节点控制

parent 785440cc
......@@ -81,3 +81,11 @@ ALTER TABLE topsun_dev.sap_exception_report MODIFY COLUMN exception_reason varch
ALTER TABLE topsun_dev.sap_exception_report MODIFY COLUMN deal_method varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '改善措施';
ALTER TABLE topsun_dev.sap_exception_report MODIFY COLUMN deal_result varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '处理结果';
ALTER TABLE topsun_dev.sap_exception_report MODIFY COLUMN remark varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '备注';
--2024-10-12 异常单支付明细增加字段
ALTER TABLE topsun_dev.sap_exception_report_payable ADD product_code varchar(100) NULL COMMENT '产品编码';
ALTER TABLE topsun_dev.sap_exception_report_payable ADD product_name varchar(200) NULL COMMENT '产品名称';
ALTER TABLE topsun_dev.sap_exception_report_payable ADD number DECIMAL(10,2) NULL COMMENT '数量';
ALTER TABLE topsun_dev.sap_exception_report_payable ADD unit varchar(100) NULL COMMENT '单位';
ALTER TABLE topsun_dev.sap_exception_report_payable ADD unit_name varchar(100) NULL;
ALTER TABLE topsun_dev.sap_exception_duty_person CHANGE remark duty_remark varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '备注';
ALTER TABLE topsun_dev.sap_exception_report_item ADD reason_type varchar(10) NULL COMMENT '异常原因类型';
......@@ -51,14 +51,14 @@ function initialize() {
if ($('#exceptionType').val()=="in"){
Public.tip("供应商原料问题的异常类型只能是外部!");
clearExceptionType();
return false;
//return false;
}
showPurchaseDiv();
} else {
if ($('#exceptionType').val()=="out"){
Public.tip("生产和客户异常的异常类型只能是内部!");
clearExceptionType();
return false;
// return false;
}
showProduceDiv();
}
......@@ -92,7 +92,11 @@ function showProduceDiv() {
$("#purchaseDiv").hide();
$("#produceDiv").show();
try {
itemGridManager.loadData();
} catch(e){
// alert(e.error);
}
setPurchaseMustInput(false);
setProduceMustInput(true);
}
......@@ -103,8 +107,11 @@ function showPurchaseDiv() {
// for (var u = 0; u < row.length; u++) {
// purchaseGridManager.deleteRow(purchaseGridManager.rows[u]);
// }
purchaseGridManager.loadData();
try {
purchaseGridManager.loadData();
} catch(e){
// alert(e.error);
}
$("#purchaseDiv").show();
setPurchaseMustInput(true);
......@@ -190,9 +197,9 @@ function initProduceGrid() {
UICtrl.addGridRow(itemGridManager);
},
deleteHandler: function () {
var _grid = UICtrl.getGridManager('#maingrid');
var _grid = UICtrl.getGridManager('#producegrid');
DataUtil.delSelectedRows({
action: 'exceptionReport/deleteExceptionReport.ajax',
action: 'exceptionReport/deleteExceptionReportItem.ajax',
param: {},
gridManager: _grid,
idFieldName: 'id',
......@@ -203,11 +210,11 @@ function initProduceGrid() {
});
},
});
itemGridManager = UICtrl.grid('#maingrid', {
itemGridManager = UICtrl.grid('#producegrid', {
columns: getGridColumns(),
dataAction: 'server',
url: web_app.name + '/exceptionReport/slicedExceptionReportItemList.ajax',
parms: {exceptionReportId: getId()},
parms: {exceptionReportId: getId(),exceptionReasonType:"2"},
height:'auto', // colRowNum*35+90
heightDiff: -4,
sortName: 'id',
......@@ -368,7 +375,7 @@ function initPurchaseToolBar(){
deleteHandler: function () {
var _grid = UICtrl.getGridManager('#purchasegrid');
DataUtil.delSelectedRows({
action: 'exceptionReport/deleteExceptionReport.ajax',
action: 'exceptionReport/deleteExceptionReportItem.ajax',
param: {},
gridManager: _grid,
idFieldName: 'id',
......@@ -389,7 +396,7 @@ function initPurchaseGrid() {
deleteHandler: function () {
var _grid = UICtrl.getGridManager('#purchasegrid');
DataUtil.delSelectedRows({
action: 'exceptionReport/deleteExceptionReport.ajax',
action: 'exceptionReport/deleteExceptionReportItem.ajax',
param: {},
gridManager: _grid,
idFieldName: 'id',
......@@ -405,7 +412,7 @@ function initPurchaseGrid() {
columns: getPurchaseGridColumns(),
dataAction: 'server',
url: web_app.name + '/exceptionReport/slicedExceptionReportItemList.ajax',
parms: {exceptionReportId: getId()},
parms: {exceptionReportId: getId(),exceptionReasonType:"1"},
height: 'auto',
heightDiff: -2,
sortName: 'id',
......@@ -577,7 +584,7 @@ function getDutyPersonGridColumns() {
editor: {type: "text", mask: '9999999.999'}
},
{
display: "备注", name: "remark", width: "300", align: "left", type: "string",
display: "备注", name: "dutyRemark", width: "300", align: "left", type: "string",
editor: {type: "text"}
},
]
......@@ -594,7 +601,7 @@ function getExtendedData(processAction) {
$('#submitForm').attr('check', false);
}
var extendedData = {};
var _grid = UICtrl.getGridManager('#maingrid');
var _grid = UICtrl.getGridManager('#producegrid');
if ($('#exceptionReasonType').val() == "1") { //供应商材料问题
_grid = UICtrl.getGridManager('#purchasegrid');
}
......@@ -629,7 +636,7 @@ function getId() {
function setId(value) {
$("#id").val(value);
var _grid = UICtrl.getGridManager('#maingrid');
var _grid = UICtrl.getGridManager('#producegrid');
_grid.options.parms.exceptionReportId = value;
var _purchasegrid = UICtrl.getGridManager('#purchasegrid');
......
......@@ -44,7 +44,7 @@
<x:selectC name="exceptionReasonType" label="异常原因分类" labelCol="1" fieldCol="2" required="true" dictionary="exceptionReasonType"/>
<x:inputC name="productType" label="产品类别" labelCol="1" fieldCol="2" required="false"/>
<x:inputC name="appealNo" label="客诉编号" labelCol="1" fieldCol="2" required="false"/>
<!--x:inputC name="appealNo" label="客诉编号" labelCol="1" fieldCol="2" required="false"/-->
<x:inputC name="exceptionDate" label="异常日期" labelCol="1" fieldCol="2" required="false" wrapper="date"/>
</div>
......@@ -69,12 +69,12 @@
<x:inputC name="customerName" label="客户名称" labelCol="1" fieldCol="2" required="false" readonly="true"/>
</div>
<x:title title="单号信息" name="group" hideTable="#info" />
<div id="maingrid"></div>
<div id="producegrid"></div>
</div>
<div class="hg-form-cols">
<div style="padding-top: 15px;">
<x:fileList bizCode="exceptionStateInfo" bizId="attbizId" id="exceptionStateInfoList" title="相关资料" />
<x:fileList bizCode="exceptionStateInfo" bizId="attbizId" id="exceptionStateInfoList" title="相关资料" isWrap="45" />
</div>
<div class="hg-form-row">
<x:textareaC name="exceptionState" required="false" label="异常陈诉" maxLength="2500" labelCol="1" fieldCol="11" rows="3"/>
......@@ -88,7 +88,7 @@
<div class="hg-form-row">
<x:inputC name="dutyDeptName" label="责任部门" labelCol="1" fieldCol="2" required="false" wrapper="tree"/>
<x:hidden name="dutyDept"/>
<x:inputC name="checkOperatorName" label="责任人" labelCol="1" fieldCol="2" required="false" wrapper="tree"/>
<x:inputC name="checkOperatorName" label="负责人" labelCol="1" fieldCol="2" required="false" wrapper="tree"/>
<x:hidden name="checkOperator"/>
</div>
<div class="hg-form-row">
......
......@@ -106,7 +106,7 @@
<x:textareaC name="remark" required="false" label="备注" maxLength="800" labelCol="1" fieldCol="11" rows="2"/>
</div>
<div style="padding-top: 15px;">
<x:fileList bizCode="exceptionStateInfo" bizId="attbizId" id="exceptionStateInfoList" title="相关资料" />
<x:fileList bizCode="exceptionStateInfo" bizId="attbizId" id="exceptionStateInfoList" title="相关资料"/>
</div>
</div>
......
......@@ -29,4 +29,6 @@ public interface ExceptionReportApplication {
ByteArrayOutputStream printInfo(HttpServletResponse response, String id);
List<Map<String,Object>> getCustomerOrders(String customerNo);
String getResponsibleTimes(String id);
}
......@@ -15,7 +15,7 @@ public interface ExceptionReportItemApplication {
public static final String QUERY_XML_FILE_PATH = "config/topsun/sap/exceptionReport/exceptionReport.xml";
List<ExceptionReportItem> findByExceptionReportId(String exceptionReportId);
void saveExceptionReportItemList(String exceptionReportId,List<ExceptionReportItem> exceptionReportItems);
void saveExceptionReportItemList(String exceptionReportId,String reasonType,List<ExceptionReportItem> exceptionReportItems);
Map<String,Object> slicedExceptionReportItemList(ExceptionReportQueryRequest queryRequest);
......
......@@ -47,6 +47,7 @@ import com.huigou.uasp.bpm.ProcessAction;
import com.huigou.uasp.bpm.ProcessStartModel;
import com.huigou.uasp.bpm.engine.application.WorkflowApplication;
import com.huigou.uasp.bpm.engine.domain.model.ProcUnitHandler;
import com.huigou.uasp.bpm.engine.domain.model.RuntimeTaskExtension;
import com.huigou.uasp.bpm.engine.domain.model.TaskExtension;
import com.huigou.util.*;
import freemarker.template.Template;
......@@ -193,13 +194,15 @@ public class ExceptionReportApplicationImpl extends FlowBroker implements Except
exceptionReport.setDutyDept(org.getDeptId());
}
} */
//
SDO params = this.getBizAndApprovalData();
if ("produce".equals(exceptionReport.getBillType())
&&"advance".equals(params.getProperty("processAction")) // 提交
) {
Operator operator = ThreadLocalUtil.getOperator();
if (StringUtil.isNotBlank(exceptionReport.getDutyDept())&&StringUtil.isBlank(exceptionReport.getCheckOperator())){
throw new IllegalArgumentException("指定责任部门同时必须指定负责人!");
}
//当前操作人 不是责任人
if (!exceptionReport.getCheckOperator().equals(operator.getPersonMemberId())) {
saveResponsibleToApprover(params, exceptionReport);
......@@ -209,7 +212,7 @@ public class ExceptionReportApplicationImpl extends FlowBroker implements Except
exceptionReport = this.saveExceptionReport(exceptionReport);
if (CollectionUtil.isNotEmpty(exceptionReportItems)){
this.exceptionReportItemApplication.saveExceptionReportItemList(exceptionReport.getId(), exceptionReportItems);
this.exceptionReportItemApplication.saveExceptionReportItemList(exceptionReport.getId(),exceptionReport.getExceptionReasonType(), exceptionReportItems);
}
if (CollectionUtil.isNotEmpty(exceptionReportDutyPersonList)) {
this.exceptionReportDutyPersonApplication.saveExceptionReportDutyPersonList(exceptionReport.getId(), exceptionReportDutyPersonList);
......@@ -249,11 +252,52 @@ public class ExceptionReportApplicationImpl extends FlowBroker implements Except
}
return exceptionReport.getId();
}
@Override
public String getResponsibleTimes(String id){
String str="0";
List<ExceptionReportResponsible> rslist = exceptionReportResponsibleRepository.findByExceptionReportId(id);
if (!ObjectUtils.isEmpty(rslist)) {
if (rslist.size() > 3) {
str="1";
}
}
return str;
}
private void saveResponsibleToApprover(SDO params,ExceptionReport exceptionReport){
List <ExceptionReportResponsible>rslist=exceptionReportResponsibleRepository.findByExceptionReportId(exceptionReport.getId());
if (!ObjectUtils.isEmpty(rslist)){
ExceptionReportResponsible lastResponsible=rslist.get(rslist.size()-1);
Operator operator = ThreadLocalUtil.getOperator();
boolean currOperatorIsResponse=false; //当前操作人是否是责任人
for (ExceptionReportResponsible responsible:rslist) {
if (responsible.getCheckOperator().equals(operator.getPersonMemberId())){
currOperatorIsResponse=true;
break;
}
}
//String procUnitId = params.getString("procUnitId");
//if ("responsibleAudit".equals(procUnitId)){ //是责任人审批时 ,才做限制
// }
RuntimeTaskExtension runtimeTaskExtension = actApplication.loadRuntimeTaskExtension(params.getString("taskId"));
ProcUnitHandler procUnitHandler = procUnitHandlerApplication.loadProcUnitHandler(runtimeTaskExtension.getProcUnitHandlerId());
String nodeCode=procUnitHandler.getSubProcUnitId();
params.putProperty("subProcUnitId",nodeCode);
//责任人审批阶段 更换责任人不能超过三次
if ("responsibleAudit".equals(nodeCode)&&currOperatorIsResponse&&rslist.size()>=3&&!lastResponsible.getCheckOperator().equals(exceptionReport.getCheckOperator())){
throw new RuntimeException("责任人的更换不能超过三次!");
}
boolean currResponseExist=false; //当前操作部门是否已经被指定过
for (int i=0;i<rslist.size()-1;i++) {
if (rslist.get(i).getDutyDept().equals(exceptionReport.getDutyDept())){
currResponseExist=true;
break;
}
}
if ("responsibleAudit".equals(nodeCode)&&currResponseExist){
throw new RuntimeException("责任部门:"+exceptionReport.getDutyDeptName()+"已经被指定过!");
}
if (!lastResponsible.getCheckOperator().equals(exceptionReport.getCheckOperator())){
saveResponsibles(params,exceptionReport);
}
......@@ -267,7 +311,9 @@ public class ExceptionReportApplicationImpl extends FlowBroker implements Except
if (StringUtils.isNotBlank(exceptionReport.getDutyDept())){ //责任部门不为空
//增加责任人的审批 params.getProperty("processAction") advance
saveHistoryCheckOperator(exceptionReport);
this.saveResponsibleApprover(params,exceptionReport);
if ("responsibleAudit".equals(params.getString("subProcUnitId"))) { //是责任人审批,才产生待办任务
this.saveResponsibleApprover(params, exceptionReport);
}
}
}
......@@ -287,7 +333,7 @@ public class ExceptionReportApplicationImpl extends FlowBroker implements Except
exceptionReportResponsibleRepository.save(exceptionReportResponsible);
}
//责任人审批
private void saveResponsibleApprover( SDO params,ExceptionReport exceptionReport){
private void saveResponsibleApprover(SDO params,ExceptionReport exceptionReport){
String bizId = params.getString("bizId");
String procUnitId = params.getString("procUnitId");
String currentProcUnitHandlerId = params.getString("currentHandleId");
......
......@@ -30,9 +30,13 @@ public class ExceptionReportItemApplicationImpl extends BaseApplication implemen
}
@Override
public void saveExceptionReportItemList(String exceptionReportId, List<ExceptionReportItem> exceptionReportItems) {
public void saveExceptionReportItemList(String exceptionReportId,String reasonType, List<ExceptionReportItem> exceptionReportItems) {
for (ExceptionReportItem exceptionReportItem : exceptionReportItems) {
exceptionReportItem.setExceptionReportId(exceptionReportId);
if ("3".equals(reasonType)){
reasonType="2";
}
exceptionReportItem.setReasonType(reasonType);
exceptionReportItemRepository.save(exceptionReportItem);
}
}
......
......@@ -4,6 +4,7 @@ import com.huigou.context.Operator;
import com.huigou.context.OrgUnit;
import com.huigou.topsun.sap.exceptionReport.application.*;
import com.huigou.topsun.sap.exceptionReport.domain.ExceptionReport;
import com.huigou.topsun.sap.exceptionReport.domain.ExceptionReportResponsible;
import com.huigou.topsun.sap.exceptionReport.domain.query.ExceptionReportQueryRequest;
import com.huigou.uasp.annotation.ControllerMapping;
import com.huigou.uasp.bmp.common.BizBillStatus;
......@@ -12,6 +13,7 @@ import com.huigou.util.CommonUtil;
import com.huigou.util.SDO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.ObjectUtils;
import java.util.HashMap;
import java.util.List;
......@@ -104,6 +106,8 @@ public class ExceptionReportController extends CommonController {
}
}
/**
* 跳转到品质异常报告详情页面
* @return
......@@ -124,7 +128,12 @@ public class ExceptionReportController extends CommonController {
return forward("exceptionReportDetail", exceptionReport);
}
}
//获取责任人变更次数
public String getResponsibleTimes() {
SDO sdo = this.getSDO();
String id = sdo.getString("id");
return this.exceptionReportApplication.getResponsibleTimes(id);
}
/**
* 删除品质异常报告
* @return
......
......@@ -65,7 +65,7 @@ public class ExceptionReportDutyPerson extends AbstractEntity {
/**
* 备注
*/
@Column(name = "remark")
private String remark;
@Column(name = "duty_remark")
private String dutyRemark;
}
......@@ -95,11 +95,14 @@ public class ExceptionReportItem extends AbstractEntity {
@Column(name = "rmb_money")
private BigDecimal rmbMoney;
/**
* 出货日期
*/
@Column(name = "send_date")
private Date sendDate;
//异常原因类型 用于区分是生产 2 还是供应商原材料的明细 1
@Column(name = "reason_type")
private String reasonType;
}
......@@ -30,8 +30,23 @@ public class ExceptionReportPayable extends AbstractEntity {
*/
@Column(name = "purchase_no")
private String purchaseNo;
//产品编码
@Column(name = "product_code")
private String productCode;
//产品名称
@Column(name = "product_name")
private String productName;
//数量
@Column(name = "number")
private BigDecimal number;
//单位
@Column(name = "unit")
private String unit;
//单位名称
@Column(name = "unit_name")
private String unitName;
/**
* 金额
*/
......
......@@ -23,7 +23,8 @@
<sql-query>
select t.* from sap_exception_report_item t
</sql-query>
<condition column="exception_report_id" name="exceptionReportId" type="java.lang.String" symbol="like" alias="t"/>
<condition column="exception_report_id" name="exceptionReportId" type="java.lang.String" symbol="=" alias="t"/>
<condition column="reason_type" name="exceptionReasonType" type="java.lang.String" symbol="=" alias="t"/>
</query>
<query name="exceptionReportDutyPersons" label="品质异常报告责任人" table="sap_exception_duty_person">
......
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