|
@@ -187,6 +187,18 @@ let ration_glj = {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
+ ration_glj.prototype.updateGLJNodeAfterReplace = function(data){
|
|
|
|
+ if (this.needShowToTree(data)) {//当替换的是主材或设备时,刷新对应的树节点
|
|
|
|
+ var node = this.findGLJNodeByID(data.ID);
|
|
|
|
+ if (node) {
|
|
|
|
+ this.transferToNodeData(data);
|
|
|
|
+ node.source = data;
|
|
|
|
+ node.data = data;
|
|
|
|
+ }
|
|
|
|
+ return node;
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+
|
|
ration_glj.prototype.addToMainTree = function (datas) {
|
|
ration_glj.prototype.addToMainTree = function (datas) {
|
|
datas = sortRationGLJ(datas);
|
|
datas = sortRationGLJ(datas);
|
|
for (let data of datas) {
|
|
for (let data of datas) {
|
|
@@ -732,23 +744,16 @@ let ration_glj = {
|
|
}, function () {
|
|
}, function () {
|
|
$.bootstrapLoading.end();
|
|
$.bootstrapLoading.end();
|
|
});
|
|
});
|
|
-
|
|
|
|
-
|
|
|
|
};
|
|
};
|
|
|
|
|
|
- ration_glj.prototype.replaceGLJ = function (selectCode, oldData, callback) {
|
|
|
|
- let allGLJ = gljOprObj.AllRecode;
|
|
|
|
- let glj = _.find(allGLJ, function (item) {
|
|
|
|
- let i_key = gljOprObj.getIndex(item, gljLibKeyArray);
|
|
|
|
- return i_key == selectCode;
|
|
|
|
- });
|
|
|
|
- if (selectCode == gljOprObj.getIndex(oldData, gljKeyArray)) {
|
|
|
|
- return callback(null);
|
|
|
|
- }
|
|
|
|
|
|
+ ration_glj.prototype.getReplaceDataByStd = function (oldData,glj) {
|
|
if (oldData.createType===undefined || oldData.createType == 'normal') {// createTypel 默认是normal 只有是定额下带的工料机才需把类型改成替换,其它的保持不变
|
|
if (oldData.createType===undefined || oldData.createType == 'normal') {// createTypel 默认是normal 只有是定额下带的工料机才需把类型改成替换,其它的保持不变
|
|
oldData.rcode = oldData.code;
|
|
oldData.rcode = oldData.code;
|
|
oldData.createType = 'replace';
|
|
oldData.createType = 'replace';
|
|
}
|
|
}
|
|
|
|
+ if(oldData.createType == 'replace' && oldData.rcode == glj.code){//如果原数据已经是替换过的,这次替换又恢复成原数据,则把类型改回来
|
|
|
|
+ oldData.createType = 'normal'
|
|
|
|
+ }
|
|
oldData.GLJID = glj.ID;
|
|
oldData.GLJID = glj.ID;
|
|
oldData.name = glj.name;
|
|
oldData.name = glj.name;
|
|
oldData.code = glj.code;
|
|
oldData.code = glj.code;
|
|
@@ -769,6 +774,20 @@ let ration_glj = {
|
|
} else {
|
|
} else {
|
|
oldData.from = "std";
|
|
oldData.from = "std";
|
|
}
|
|
}
|
|
|
|
+ return oldData;
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ ration_glj.prototype.replaceGLJ = function (selectCode, oldData, callback) {
|
|
|
|
+ let allGLJ = gljOprObj.AllRecode;
|
|
|
|
+ let glj = _.find(allGLJ, function (item) {
|
|
|
|
+ let i_key = gljOprObj.getIndex(item, gljLibKeyArray);
|
|
|
|
+ return i_key == selectCode;
|
|
|
|
+ });
|
|
|
|
+ if (selectCode == gljOprObj.getIndex(oldData, gljKeyArray)) {
|
|
|
|
+ return callback(null);
|
|
|
|
+ }
|
|
|
|
+ oldData = this.getReplaceDataByStd(oldData,glj);
|
|
$.bootstrapLoading.start();
|
|
$.bootstrapLoading.start();
|
|
CommonAjax.post("/rationGlj/replaceGLJ", oldData, callback, function () {
|
|
CommonAjax.post("/rationGlj/replaceGLJ", oldData, callback, function () {
|
|
$.bootstrapLoading.end();
|
|
$.bootstrapLoading.end();
|