|
@@ -650,7 +650,14 @@ const stageIm = (function () {
|
|
|
}
|
|
|
let imData = _.find(ImData, {lid: d.lid, uuid: d.uuid});
|
|
|
if (!imData) {
|
|
|
- imData = _.find(ImData, {lid: d.lid, code: d.code, name: d.name, unit: d.unit, unit_price: d.unit_price});
|
|
|
+ imData = ImData.find(function (im) {
|
|
|
+ return im.lid === d.lid &&
|
|
|
+ (!im.code || im.code === d.code) &&
|
|
|
+ (!im.name || im.name === d.name) &&
|
|
|
+ (!im.unit || im.unit === d.unit) &&
|
|
|
+ checkZero(ZhCalc.sub(im.unit_price, d.unit_price)) &&
|
|
|
+ (!im.pid || im.pid === d.pid);
|
|
|
+ });
|
|
|
}
|
|
|
if (imData) {
|
|
|
_.assignInWith(imData, d, function (oV, sV, key) {
|