|
|
|
@ -18,7 +18,12 @@ Ext.extend(Shipping.MsSeaeOrderEdit, Ext.Panel, {
|
|
|
|
|
seaecustservice: "",
|
|
|
|
|
FORWARDER: "",
|
|
|
|
|
reason: "",
|
|
|
|
|
|
|
|
|
|
ruleList: null,
|
|
|
|
|
ruleCheckFail: false,
|
|
|
|
|
ruleCheckNames: '',
|
|
|
|
|
ruleCheckNameArr: [],
|
|
|
|
|
ruleCheckNameArr_2: [],
|
|
|
|
|
redAlertFields: [],
|
|
|
|
|
initUIComponents: function () {
|
|
|
|
|
this.serialNo = 0;
|
|
|
|
|
//this.bodyDel = [];
|
|
|
|
@ -2609,6 +2614,13 @@ DFF42726-A0BA-4264-BFDF-2500A35E89C7 isVehiclesDispatcher 是否派车调度人
|
|
|
|
|
text: "保存",
|
|
|
|
|
iconCls: "btnsave",
|
|
|
|
|
handler: function (button, event) {
|
|
|
|
|
|
|
|
|
|
this.checkRules();
|
|
|
|
|
if (this.ruleCheckFail) {
|
|
|
|
|
Ext.MessageBox.alert("提示", "表单校验不满足如下规则:<br/><b>" + this.ruleCheckNames + "</b><br/>不允许保存");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.Save('0');
|
|
|
|
|
},
|
|
|
|
|
scope: this
|
|
|
|
@ -2616,6 +2628,13 @@ DFF42726-A0BA-4264-BFDF-2500A35E89C7 isVehiclesDispatcher 是否派车调度人
|
|
|
|
|
id: 'btnESaveAndClose',
|
|
|
|
|
text: "保存并关闭",
|
|
|
|
|
handler: function (button, event) {
|
|
|
|
|
|
|
|
|
|
this.checkRules();
|
|
|
|
|
if (this.ruleCheckFail) {
|
|
|
|
|
Ext.MessageBox.alert("提示", "表单校验不满足如下规则:<br/><b>" + this.ruleCheckNames + "</b><br/>不允许保存");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.Save('1');
|
|
|
|
|
},
|
|
|
|
|
scope: this
|
|
|
|
@ -2623,6 +2642,13 @@ DFF42726-A0BA-4264-BFDF-2500A35E89C7 isVehiclesDispatcher 是否派车调度人
|
|
|
|
|
id: 'btnESaveAndNew',
|
|
|
|
|
text: "保存并新建",
|
|
|
|
|
handler: function (button, event) {
|
|
|
|
|
|
|
|
|
|
this.checkRules();
|
|
|
|
|
if (this.ruleCheckFail) {
|
|
|
|
|
Ext.MessageBox.alert("提示", "表单校验不满足如下规则:<br/><b>" + this.ruleCheckNames + "</b><br/>不允许保存");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.Save('2');
|
|
|
|
|
this.panelOcr.hide();
|
|
|
|
|
},
|
|
|
|
@ -2631,6 +2657,13 @@ DFF42726-A0BA-4264-BFDF-2500A35E89C7 isVehiclesDispatcher 是否派车调度人
|
|
|
|
|
id: 'btnECopyNew',
|
|
|
|
|
text: "复制新建",
|
|
|
|
|
handler: function (button, event) {
|
|
|
|
|
|
|
|
|
|
this.checkRules();
|
|
|
|
|
if (this.ruleCheckFail) {
|
|
|
|
|
Ext.MessageBox.alert("提示", "表单校验不满足如下规则:<br/><b>" + this.ruleCheckNames + "</b><br/>不允许保存");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var basicForm = this.formHead.getForm();
|
|
|
|
|
var editForm = this.formEdit.getForm();
|
|
|
|
|
this.opStatus = 'add';
|
|
|
|
@ -2803,7 +2836,63 @@ DFF42726-A0BA-4264-BFDF-2500A35E89C7 isVehiclesDispatcher 是否派车调度人
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
scope: this
|
|
|
|
|
}]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
, {
|
|
|
|
|
id: 'btnRuleWarning',
|
|
|
|
|
text: '0',
|
|
|
|
|
iconCls: "btn-warning",
|
|
|
|
|
handler: function (button, event) {
|
|
|
|
|
this.checkRules();
|
|
|
|
|
|
|
|
|
|
if (this.ruleCheckNameArr.length > 0) {
|
|
|
|
|
var store = Ext.data.Store({
|
|
|
|
|
fields: [{
|
|
|
|
|
name: 'Title', type: "string"
|
|
|
|
|
}],
|
|
|
|
|
data: this.ruleCheckNameArr,
|
|
|
|
|
autoLoad: true
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var grid = Ext.create('Ext.grid.Panel', {
|
|
|
|
|
store: store,
|
|
|
|
|
columns: [
|
|
|
|
|
{ text: "规则名称", flex: 1, dataIndex: 'Title', sortable: true }
|
|
|
|
|
],
|
|
|
|
|
forceFit: true,
|
|
|
|
|
split: true,
|
|
|
|
|
region: 'center'
|
|
|
|
|
});
|
|
|
|
|
this.winCheckRuleListShow = Ext.create('Ext.window.Window', {
|
|
|
|
|
title: Zi.LAN.CheckRuleNames,
|
|
|
|
|
width: 600,
|
|
|
|
|
height: 350,
|
|
|
|
|
plain: true,
|
|
|
|
|
layout: "border",
|
|
|
|
|
iconCls: "addicon",
|
|
|
|
|
resizable: false,
|
|
|
|
|
draggable: false,
|
|
|
|
|
collapsible: true,
|
|
|
|
|
closeAction: 'close',
|
|
|
|
|
closable: true,
|
|
|
|
|
modal: 'true',
|
|
|
|
|
buttonAlign: "center",
|
|
|
|
|
bodyStyle: "padding:0 0 0 0",
|
|
|
|
|
items: [grid],
|
|
|
|
|
buttons: [{
|
|
|
|
|
text: Zi.LAN.GuanBi, //"关闭",
|
|
|
|
|
minWidth: 70,
|
|
|
|
|
handler: function () {
|
|
|
|
|
me.winCheckRuleListShow.close();
|
|
|
|
|
}
|
|
|
|
|
}]
|
|
|
|
|
});
|
|
|
|
|
this.winCheckRuleListShow.show();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
scope: this
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}); //end 按钮Toolbar
|
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
@ -3080,6 +3169,7 @@ DFF42726-A0BA-4264-BFDF-2500A35E89C7 isVehiclesDispatcher 是否派车调度人
|
|
|
|
|
|
|
|
|
|
this.LoadData(this.opStatus, condition);
|
|
|
|
|
this.LoadMustBe();
|
|
|
|
|
this.loadCheckRules();
|
|
|
|
|
}, //end InitData
|
|
|
|
|
|
|
|
|
|
LoadData: function (opstatus, condition) {
|
|
|
|
@ -4582,6 +4672,224 @@ DFF42726-A0BA-4264-BFDF-2500A35E89C7 isVehiclesDispatcher 是否派车调度人
|
|
|
|
|
},
|
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
|
//#region 规则判断
|
|
|
|
|
loadCheckRules: function () {
|
|
|
|
|
var _this = this;
|
|
|
|
|
Ext.Ajax.request({
|
|
|
|
|
url: '/MvcShipping/MsOpRule/RuleListEnable',
|
|
|
|
|
method: 'POST',
|
|
|
|
|
success: function (resp, opts) {
|
|
|
|
|
var data = Ext.decode(resp.responseText);
|
|
|
|
|
_this.ruleList = data;
|
|
|
|
|
},
|
|
|
|
|
failure: function (resp, opts) {
|
|
|
|
|
Ext.Msg.alert('错误', '加载规则错误');
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
checkRules: function () {
|
|
|
|
|
this.clearRuleAlertStyle();
|
|
|
|
|
var btnWarning = Ext.getCmp('btnRuleWarning');
|
|
|
|
|
var matchCount = 0;
|
|
|
|
|
var matchRuleName = '';
|
|
|
|
|
var matchRuleNameArr = [];
|
|
|
|
|
var redAlertFields = [];
|
|
|
|
|
for (var idx = 0; idx < this.ruleList.length; idx++) {
|
|
|
|
|
var rule = this.ruleList[idx];
|
|
|
|
|
var redAlert = rule.RedAlertField;
|
|
|
|
|
var saveDisable = rule.SaveDisable;
|
|
|
|
|
var compareType = rule.CompareType;
|
|
|
|
|
|
|
|
|
|
var matchSuccess = false;
|
|
|
|
|
if (compareType == "And") {
|
|
|
|
|
//与条件下,任意一条不满足,则整条规则不满足
|
|
|
|
|
matchSuccess = true;
|
|
|
|
|
for (var itemIdx = 0; itemIdx < rule.Items.length; itemIdx++) {
|
|
|
|
|
var ruleItem = rule.Items[itemIdx];
|
|
|
|
|
var member = ruleItem.Field;
|
|
|
|
|
var found = false;
|
|
|
|
|
|
|
|
|
|
var headfield = this.formHead.getForm().findField(member);
|
|
|
|
|
if (headfield != NaN && headfield != null) {
|
|
|
|
|
found = true;
|
|
|
|
|
if (!this.isMatchRule(ruleItem, headfield)) {
|
|
|
|
|
matchSuccess = false;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
headfield = this.formEdit.getForm().findField(member);
|
|
|
|
|
if (headfield != NaN && headfield != null) {
|
|
|
|
|
found = true;
|
|
|
|
|
if (!this.isMatchRule(ruleItem, headfield)) {
|
|
|
|
|
matchSuccess = false;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
headfield = this.formBill.getForm().findField(member);
|
|
|
|
|
if (headfield != NaN && headfield != null) {
|
|
|
|
|
found = true;
|
|
|
|
|
if (!this.isMatchRule(ruleItem, headfield)) {
|
|
|
|
|
matchSuccess = false;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//字段没有找到,则不符合
|
|
|
|
|
if (!found) {
|
|
|
|
|
matchSuccess = false;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else if (compareType == "Or") {
|
|
|
|
|
//或条件下,任意一条满足,则整条规则满足
|
|
|
|
|
for (var itemIdx = 0; itemIdx < rule.Items.length; itemIdx++) {
|
|
|
|
|
var ruleItem = rule.Items[itemIdx];
|
|
|
|
|
var member = ruleItem.Field;
|
|
|
|
|
|
|
|
|
|
var headfield = this.formHead.getForm().findField(member);
|
|
|
|
|
if (headfield != NaN && headfield != null) {
|
|
|
|
|
if (this.isMatchRule(ruleItem, headfield)) {
|
|
|
|
|
matchSuccess = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
headfield = this.formEdit.getForm().findField(member);
|
|
|
|
|
if (headfield != NaN && headfield != null) {
|
|
|
|
|
if (this.isMatchRule(ruleItem, headfield)) {
|
|
|
|
|
matchSuccess = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
headfield = this.formEDI.getForm().findField(member);
|
|
|
|
|
if (headfield != NaN && headfield != null) {
|
|
|
|
|
if (this.isMatchRule(ruleItem, headfield)) {
|
|
|
|
|
matchSuccess = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (matchSuccess) {
|
|
|
|
|
matchCount++;
|
|
|
|
|
matchRuleName += rule.Title + ","
|
|
|
|
|
matchRuleNameArr.push(rule);
|
|
|
|
|
if (redAlert != null && redAlert.length > 0) {
|
|
|
|
|
var headfield = this.formHead.getForm().findField(redAlert);
|
|
|
|
|
if (headfield != NaN && headfield != null) {
|
|
|
|
|
var srcColor = this.getBackgroundColorFromStyle(headfield.getFieldStyle());
|
|
|
|
|
redAlertFields.push({ name: redAlert, color: srcColor });
|
|
|
|
|
headfield.setFieldStyle({ background: '#f00' });
|
|
|
|
|
}
|
|
|
|
|
headfield = this.formEdit.getForm().findField(redAlert);
|
|
|
|
|
if (headfield != NaN && headfield != null) {
|
|
|
|
|
var srcColor = this.getBackgroundColorFromStyle(headfield.getFieldStyle());
|
|
|
|
|
redAlertFields.push({ name: redAlert, color: srcColor });
|
|
|
|
|
headfield.setFieldStyle({ background: '#f00' });
|
|
|
|
|
}
|
|
|
|
|
headfield = this.formEDI.getForm().findField(redAlert);
|
|
|
|
|
if (headfield != NaN && headfield != null) {
|
|
|
|
|
var srcColor = this.getBackgroundColorFromStyle(headfield.getFieldStyle());
|
|
|
|
|
redAlertFields.push({ name: redAlert, color: srcColor });
|
|
|
|
|
headfield.setFieldStyle({ background: '#f00' });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (saveDisable) {
|
|
|
|
|
this.ruleCheckFail = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
btnWarning.setText(matchCount + '');
|
|
|
|
|
this.formHead.getForm().findField('WARNCOUNT').setValue(matchCount);
|
|
|
|
|
this.ruleCheckNames = matchRuleName;
|
|
|
|
|
this.ruleCheckNameArr = matchRuleNameArr;
|
|
|
|
|
this.redAlertFields = redAlertFields;
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
isMatchRule: function (ruleItem, field) {
|
|
|
|
|
var compare = ruleItem.Compare;
|
|
|
|
|
var value = ruleItem.Value;
|
|
|
|
|
var fieldValue = field.getRawValue();
|
|
|
|
|
if (compare == "Contains") {
|
|
|
|
|
if (fieldValue.indexOf(value) > -1) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
} else if (compare == "NotContains") {
|
|
|
|
|
if (fieldValue.indexOf(value) == -1) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
} else if (compare == "Large") {
|
|
|
|
|
if (fieldValue > value) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
} else if (compare == "Small") {
|
|
|
|
|
if (fieldValue < value) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
} else if (compare == "LargeEqual") {
|
|
|
|
|
if (fieldValue >= value) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
} else if (compare == "SmallEqual") {
|
|
|
|
|
if (fieldValue <= value) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
} else if (compare == "Equal") {
|
|
|
|
|
if (fieldValue == value) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
} else if (compare == "NotEqual") {
|
|
|
|
|
if (fieldValue != value) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
clearRuleAlertStyle: function () {
|
|
|
|
|
if (this.redAlertFields.length > 0) {
|
|
|
|
|
for (var idx = 0; idx < this.redAlertFields.length; idx++) {
|
|
|
|
|
var redAlert = this.redAlertFields[idx].name;
|
|
|
|
|
if (redAlert == null || redAlert.length == 0) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var headfield = this.formHead.getForm().findField(redAlert);
|
|
|
|
|
if (headfield != NaN && headfield != null) {
|
|
|
|
|
var srcColor = this.redAlertFields[idx].color;
|
|
|
|
|
headfield.setFieldStyle({ background: srcColor });
|
|
|
|
|
}
|
|
|
|
|
headfield = this.formEdit.getForm().findField(redAlert);
|
|
|
|
|
if (headfield != NaN && headfield != null) {
|
|
|
|
|
var srcColor = this.redAlertFields[idx].color;
|
|
|
|
|
headfield.setFieldStyle({ background: srcColor });
|
|
|
|
|
}
|
|
|
|
|
headfield = this.formEDI.getForm().findField(redAlert);
|
|
|
|
|
if (headfield != NaN && headfield != null) {
|
|
|
|
|
var srcColor = this.redAlertFields[idx].color;
|
|
|
|
|
headfield.setFieldStyle({ background: srcColor });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
getBackgroundColorFromStyle: function (style) {
|
|
|
|
|
var backColor = "#fff";
|
|
|
|
|
var idx = style.indexOf("background");
|
|
|
|
|
if (idx > -1) {
|
|
|
|
|
var idx1 = style.indexOf(";", idx);
|
|
|
|
|
if (idx1 > idx) {
|
|
|
|
|
backColor = style.substring(idx + "background".length + 1, idx1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return backColor;
|
|
|
|
|
},
|
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
|
//#region 打印
|
|
|
|
|
Print: function () {
|
|
|
|
|
|
|
|
|
|