|
@@ -118,29 +118,24 @@ var Ration = {
|
|
|
};
|
|
|
|
|
|
ration.prototype.insertStdRation = function (billsID, preRation, std) {
|
|
|
- var br = this.getBillsSortRation(billsID), updateData = this.getInsertRationData(billsID, preRation);
|
|
|
+ var br = this.getBillsSortRation(billsID), updateData = this.getInsertRationData(billsID, preRation), newRation = null;
|
|
|
updateData.forEach(function (data) {
|
|
|
if (data.updateType === 'ut_create') {
|
|
|
data.updateData.code = std.code;
|
|
|
data.updateData.name = std.name;
|
|
|
data.updateData.unit = std.unit;
|
|
|
+ newRation = data.updateData;
|
|
|
}
|
|
|
});
|
|
|
this.project.pushNow('insertRation', [this.getSourceType()], [updateData]);
|
|
|
|
|
|
- var newRation = null;
|
|
|
if (preRation) {
|
|
|
var preIndex = br.indexOf(preRation), i;
|
|
|
- newRation = this.getTempRationData(this.getNewRationID(), billsID, preIndex < br.length - 1 ? br[preIndex + 1].serialNo : br[preIndex].serialNo + 1);
|
|
|
- newRation.code = std.code;
|
|
|
- newRation.name = std.name;
|
|
|
- newRation.unit = std.unit;
|
|
|
this.datas.push(newRation);
|
|
|
for (i = preIndex + 1; i < br.length; i++) {
|
|
|
br[i].serialNo = i < br.length - 1 ? br [i + 1].serialNo : br[i].serialNo + 1;
|
|
|
}
|
|
|
} else {
|
|
|
- newRation = this.getTempRationData(this.getNewRationID(), billsID, br.length > 0 ? br[br.length - 1].serialNo + 1 : 1);
|
|
|
this.datas.push(newRation);
|
|
|
}
|
|
|
return newRation;
|