|
@@ -167,18 +167,39 @@ $(document).ready(() => {
|
|
|
autoFlashHeight();
|
|
|
// 清单table
|
|
|
const ledgerSpread = SpreadJsObj.createNewSpread($('#ledger-spread')[0]);
|
|
|
+ const ledgerCols = [
|
|
|
+ {title: '清单编号', colSpan: '1', rowSpan: '2', field: 'b_code', hAlign: 0, width: 90, formatter: '@'},
|
|
|
+ {title: '名称', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 220, formatter: '@'},
|
|
|
+ {title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 1, width: 80, formatter: '@'},
|
|
|
+ {title: '单价', colSpan: '1', rowSpan: '2', field: 'unit_price', hAlign: 2, width: 110, type: 'Number'},
|
|
|
+ ];
|
|
|
+ if (materialQtySource === 1) {
|
|
|
+ ledgerCols.push({title: '本期计量数量|合同', colSpan: '3|1', rowSpan: '1|1', field: 'contract_qty', hAlign: 2, width: 110, type: 'Number'});
|
|
|
+ ledgerCols.push({title: '|数量变更', colSpan: '|1', rowSpan: '|1', field: 'qc_qty', hAlign: 2, width: 110, type: 'Number'});
|
|
|
+ ledgerCols.push({title: '|小计', colSpan: '|1', rowSpan: '|1', field: 'gather_qty', hAlign: 2, width: 110, type: 'Number'});
|
|
|
+ } else if (materialQtySource === 2) {
|
|
|
+ ledgerCols.push({title: '本期计量数量|合同', colSpan: '1|1', rowSpan: '1|1', field: 'contract_qty', hAlign: 2, width: 110, type: 'Number'});
|
|
|
+ } else if (materialQtySource === 3) {
|
|
|
+ ledgerCols.push({title: '本期计量数量|合同', colSpan: '4|1', rowSpan: '1|1', field: 'contract_qty', hAlign: 2, width: 110, type: 'Number'});
|
|
|
+ ledgerCols.push({title: '|数量变更', colSpan: '|1', rowSpan: '|1', field: 'qc_qty', hAlign: 2, width: 110, type: 'Number'});
|
|
|
+ ledgerCols.push({title: '|不计价', colSpan: '|1', rowSpan: '|1', field: 'qc_minus_qty', hAlign: 2, width: 110, type: 'Number'});
|
|
|
+ ledgerCols.push({title: '|小计', colSpan: '|1', rowSpan: '|1', field: 'gather_qty', hAlign: 2, width: 110, type: 'Number', getValue: 'getValue.gather_qty'});
|
|
|
+ }
|
|
|
+ ledgerCols.push({title: '本期完成金额', colSpan: '1', rowSpan: '2', field: 'gather_tp', hAlign: 2, width: 110, type: 'Number'});
|
|
|
+ ledgerCols.push({title: '本期价差', colSpan: '1', rowSpan: '2', field: 'total_jiacha', hAlign:3, width: 110, type: 'Number'});
|
|
|
const ledgerSpreadSetting = {
|
|
|
- cols: [
|
|
|
- {title: '清单编号', colSpan: '1', rowSpan: '2', field: 'b_code', hAlign: 0, width: 90, formatter: '@'},
|
|
|
- {title: '名称', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 220, formatter: '@'},
|
|
|
- {title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 1, width: 80, formatter: '@'},
|
|
|
- {title: '单价', colSpan: '1', rowSpan: '2', field: 'unit_price', hAlign: 2, width: 110, type: 'Number'},
|
|
|
- {title: '本期计量数量|合同', colSpan: '3|1', rowSpan: '1|1', field: 'contract_qty', hAlign: 2, width: 110, type: 'Number'},
|
|
|
- {title: '|数量变更', colSpan: '|1', rowSpan: '|1', field: 'qc_qty', hAlign: 2, width: 110, type: 'Number'},
|
|
|
- {title: '|小计', colSpan: '|1', rowSpan: '|1', field: 'gather_qty', hAlign: 2, width: 110, type: 'Number'},
|
|
|
- {title: '本期完成金额', colSpan: '1', rowSpan: '2', field: 'gather_tp', hAlign: 2, width: 110, type: 'Number'},
|
|
|
- {title: '本期价差', colSpan: '1', rowSpan: '2', field: 'total_jiacha', hAlign:3, width: 110, type: 'Number'}
|
|
|
- ],
|
|
|
+ // cols: [
|
|
|
+ // {title: '清单编号', colSpan: '1', rowSpan: '2', field: 'b_code', hAlign: 0, width: 90, formatter: '@'},
|
|
|
+ // {title: '名称', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 220, formatter: '@'},
|
|
|
+ // {title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 1, width: 80, formatter: '@'},
|
|
|
+ // {title: '单价', colSpan: '1', rowSpan: '2', field: 'unit_price', hAlign: 2, width: 110, type: 'Number'},
|
|
|
+ // {title: '本期计量数量|合同', colSpan: '4|1', rowSpan: '1|1', field: 'contract_qty', hAlign: 2, width: 110, type: 'Number'},
|
|
|
+ // {title: '|数量变更', colSpan: '|1', rowSpan: '|1', field: 'qc_qty', hAlign: 2, width: 110, type: 'Number'},
|
|
|
+ // {title: '|不计价', colSpan: '|1', rowSpan: '|1', field: 'qc_minus_qty', hAlign: 2, width: 110, type: 'Number'},
|
|
|
+ // {title: '|小计', colSpan: '|1', rowSpan: '|1', field: 'gather_qty', hAlign: 2, width: 110, type: 'Number'},
|
|
|
+ // {title: '本期完成金额', colSpan: '1', rowSpan: '2', field: 'gather_tp', hAlign: 2, width: 110, type: 'Number'},
|
|
|
+ // {title: '本期价差', colSpan: '1', rowSpan: '2', field: 'total_jiacha', hAlign:3, width: 110, type: 'Number'}
|
|
|
+ // ],
|
|
|
emptyRows: 0,
|
|
|
headRows: 2,
|
|
|
headRowHeight: [25, 25],
|
|
@@ -187,6 +208,16 @@ $(document).ready(() => {
|
|
|
font: '12px 微软雅黑',
|
|
|
readOnly: true,
|
|
|
};
|
|
|
+ const ledgerCol = {
|
|
|
+ getValue: {
|
|
|
+ gather_qty: function (data) {
|
|
|
+ if (materialQtySource === 3) {
|
|
|
+ return ZhCalc.add(data.gather_qty, data.qc_minus_qty);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ledgerSpreadSetting.cols = ledgerCols;
|
|
|
// let gclGatherData = gclGatherModel.gatherGclData()
|
|
|
// 获取项目节数据
|
|
|
function loadLeafXmjData(iGclRow) {
|
|
@@ -210,24 +241,48 @@ $(document).ready(() => {
|
|
|
}
|
|
|
SpreadJsObj.initSheet(materialSpread.getActiveSheet(), materialSpreadSetting);
|
|
|
}
|
|
|
+ SpreadJsObj.initSpreadSettingEvents(ledgerSpreadSetting, ledgerCol);
|
|
|
SpreadJsObj.initSheet(ledgerSpread.getActiveSheet(), ledgerSpreadSetting);
|
|
|
|
|
|
// 项目明细table
|
|
|
const leafXmjSpread = SpreadJsObj.createNewSpread($('#leaf-xmj-spread')[0]);
|
|
|
+ const leafXmjCols = [
|
|
|
+ {title: '项目节|编号', colSpan: '2|1', rowSpan: '1|1', field: 'code', hAlign: 0, width: 80, formatter: '@'},
|
|
|
+ {title: '|项目节名称', colSpan: '|1', rowSpan: '|1', field: 'jldy', hAlign: 0, width: 100, formatter: '@'},
|
|
|
+ {title: '计量单元|计量单元', colSpan: '2|1', rowSpan: '1|1', field: 'bwmx', hAlign: 0, width: 100, formatter: '@'},
|
|
|
+ {title: '|复核数量', colSpan: '|1', rowSpan: '|1', field: 'quantity', hAlign: 0, width: 80, type: 'Number'},
|
|
|
+ {title: '部位信息|单位工程', colSpan: '3|1', rowSpan: '1|1', field: 'dwgc', hAlign: 0, width: 100, formatter: '@'},
|
|
|
+ {title: '|分部工程', colSpan: '|1', rowSpan: '|1', field: 'fbgc', hAlign: 0, width: 100, formatter: '@'},
|
|
|
+ {title: '|分项工程', colSpan: '|1', rowSpan: '|1', field: 'fxgc', hAlign: 0, width: 180, formatter: '@'},
|
|
|
+ ];
|
|
|
+ if (materialQtySource === 1) {
|
|
|
+ leafXmjCols.push({title: '本期计量数量|合同', colSpan: '3|1', rowSpan: '1|1', field: 'contract_qty', hAlign: 2, width: 60, type: 'Number'});
|
|
|
+ leafXmjCols.push({title: '|数量变更', colSpan: '|1', rowSpan: '|1', field: 'qc_qty', hAlign: 2, width: 60, type: 'Number'});
|
|
|
+ leafXmjCols.push({title: '|小计', colSpan: '|1', rowSpan: '|1', field: 'gather_qty', hAlign: 2, width: 60, type: 'Number'});
|
|
|
+ } else if (materialQtySource === 2) {
|
|
|
+ leafXmjCols.push({title: '本期计量数量|合同', colSpan: '1|1', rowSpan: '1|1', field: 'contract_qty', hAlign: 2, width: 100, type: 'Number'});
|
|
|
+ } else if (materialQtySource === 3) {
|
|
|
+ leafXmjCols.push({title: '本期计量数量|合同', colSpan: '4|1', rowSpan: '1|1', field: 'contract_qty', hAlign: 2, width: 60, type: 'Number'});
|
|
|
+ leafXmjCols.push({title: '|数量变更', colSpan: '|1', rowSpan: '|1', field: 'qc_qty', hAlign: 2, width: 60, type: 'Number'});
|
|
|
+ leafXmjCols.push({title: '|不计价', colSpan: '|1', rowSpan: '|1', field: 'qc_minus_qty', hAlign: 2, width: 60, type: 'Number'});
|
|
|
+ leafXmjCols.push({title: '|小计', colSpan: '|1', rowSpan: '|1', field: 'gather_qty', hAlign: 2, width: 60, type: 'Number', getValue: 'getValue.gather_qty'});
|
|
|
+ }
|
|
|
+ leafXmjCols.push({title: '本期价差', colSpan: '1', rowSpan: '2', field: 'jiacha', hAlign: 2, width: 80, type: 'Number'});
|
|
|
const leafXmjSpreadSetting = {
|
|
|
- cols: [
|
|
|
- {title: '项目节|编号', colSpan: '2|1', rowSpan: '1|1', field: 'code', hAlign: 0, width: 80, formatter: '@'},
|
|
|
- {title: '|项目节名称', colSpan: '|1', rowSpan: '|1', field: 'jldy', hAlign: 0, width: 100, formatter: '@'},
|
|
|
- {title: '计量单元|计量单元', colSpan: '2|1', rowSpan: '1|1', field: 'bwmx', hAlign: 0, width: 100, formatter: '@'},
|
|
|
- {title: '|复核数量', colSpan: '|1', rowSpan: '|1', field: 'quantity', hAlign: 0, width: 80, type: 'Number'},
|
|
|
- {title: '部位信息|单位工程', colSpan: '3|1', rowSpan: '1|1', field: 'dwgc', hAlign: 0, width: 100, formatter: '@'},
|
|
|
- {title: '|分部工程', colSpan: '|1', rowSpan: '|1', field: 'fbgc', hAlign: 0, width: 100, formatter: '@'},
|
|
|
- {title: '|分项工程', colSpan: '|1', rowSpan: '|1', field: 'fxgc', hAlign: 0, width: 180, formatter: '@'},
|
|
|
- {title: '本期计量数量|合同', colSpan: '3|1', rowSpan: '1|1', field: 'contract_qty', hAlign: 2, width: 60, type: 'Number'},
|
|
|
- {title: '|数量变更', colSpan: '|1', rowSpan: '|1', field: 'qc_qty', hAlign: 2, width: 80, type: 'Number'},
|
|
|
- {title: '|小计', colSpan: '|1', rowSpan: '|1', field: 'gather_qty', hAlign: 2, width: 60, type: 'Number'},
|
|
|
- {title: '本期价差', colSpan: '1', rowSpan: '2', field: 'jiacha', hAlign: 2, width: 80, type: 'Number'},
|
|
|
- ],
|
|
|
+ // cols: [
|
|
|
+ // {title: '项目节|编号', colSpan: '2|1', rowSpan: '1|1', field: 'code', hAlign: 0, width: 80, formatter: '@'},
|
|
|
+ // {title: '|项目节名称', colSpan: '|1', rowSpan: '|1', field: 'jldy', hAlign: 0, width: 100, formatter: '@'},
|
|
|
+ // {title: '计量单元|计量单元', colSpan: '2|1', rowSpan: '1|1', field: 'bwmx', hAlign: 0, width: 100, formatter: '@'},
|
|
|
+ // {title: '|复核数量', colSpan: '|1', rowSpan: '|1', field: 'quantity', hAlign: 0, width: 80, type: 'Number'},
|
|
|
+ // {title: '部位信息|单位工程', colSpan: '3|1', rowSpan: '1|1', field: 'dwgc', hAlign: 0, width: 100, formatter: '@'},
|
|
|
+ // {title: '|分部工程', colSpan: '|1', rowSpan: '|1', field: 'fbgc', hAlign: 0, width: 100, formatter: '@'},
|
|
|
+ // {title: '|分项工程', colSpan: '|1', rowSpan: '|1', field: 'fxgc', hAlign: 0, width: 180, formatter: '@'},
|
|
|
+ // {title: '本期计量数量|合同', colSpan: '4|1', rowSpan: '1|1', field: 'contract_qty', hAlign: 2, width: 60, type: 'Number'},
|
|
|
+ // {title: '|数量变更', colSpan: '|1', rowSpan: '|1', field: 'qc_qty', hAlign: 2, width: 80, type: 'Number'},
|
|
|
+ // {title: '|不计价', colSpan: '|1', rowSpan: '|1', field: 'qc_minus_qty', hAlign: 2, width: 80, type: 'Number'},
|
|
|
+ // {title: '|小计', colSpan: '|1', rowSpan: '|1', field: 'gather_qty', hAlign: 2, width: 60, type: 'Number'},
|
|
|
+ // {title: '本期价差', colSpan: '1', rowSpan: '2', field: 'jiacha', hAlign: 2, width: 80, type: 'Number'},
|
|
|
+ // ],
|
|
|
emptyRows: 0,
|
|
|
headRows: 2,
|
|
|
headRowHeight: [25, 25],
|
|
@@ -251,6 +306,16 @@ $(document).ready(() => {
|
|
|
},
|
|
|
],
|
|
|
};
|
|
|
+ leafXmjSpreadSetting.cols = leafXmjCols;
|
|
|
+ const leafXmjCol = {
|
|
|
+ getValue: {
|
|
|
+ gather_qty: function (data) {
|
|
|
+ if (materialQtySource === 3) {
|
|
|
+ return ZhCalc.add(data.gather_qty, data.qc_minus_qty);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ }
|
|
|
+ }
|
|
|
const needUpdateArray = ['quantity', 'msg_tp', 'msg_times', 'msg_spread', 'm_spread', 'm_tp', 'm_tax_tp', 'is_summary', 'remark'];
|
|
|
|
|
|
function getGclList() {
|
|
@@ -263,7 +328,7 @@ $(document).ready(() => {
|
|
|
gclGatherModel.loadLedgerData(ledger, s);
|
|
|
gclGatherModel.loadPosData(pos, posListData[index]);
|
|
|
const oneGclGatherData = gclGatherModel.gatherGclData().filter(item => {
|
|
|
- return item.qc_qty || item.contract_qty
|
|
|
+ return item.qc_qty || item.contract_qty || item.qc_minus_qty
|
|
|
});
|
|
|
newGclGatherListData.push(oneGclGatherData);
|
|
|
}
|
|
@@ -292,7 +357,7 @@ $(document).ready(() => {
|
|
|
gclGatherModel.loadLedgerData(_.cloneDeep(ledger), s);
|
|
|
gclGatherModel.loadPosData(_.cloneDeep(pos), result.posListData[index]);
|
|
|
const oneGclGatherData = gclGatherModel.gatherGclData().filter(item => {
|
|
|
- return item.qc_qty || item.contract_qty
|
|
|
+ return item.qc_qty || item.contract_qty || item.qc_minus_qty
|
|
|
});
|
|
|
newGclGatherListData.push(oneGclGatherData);
|
|
|
}
|
|
@@ -381,7 +446,7 @@ $(document).ready(() => {
|
|
|
// materialChecklistData = await postDataAsync('/tender/'+ tenderID +'/measure/material/'+ stage_order +'/checklist/save', { type: 'resetChecklist', pushData, removeData, updateData })
|
|
|
}
|
|
|
gclGatherData = gclGatherData.filter(item => {
|
|
|
- return item.qc_qty || item.contract_qty
|
|
|
+ return item.qc_qty || item.contract_qty || item.qc_minus_qty
|
|
|
});
|
|
|
// 取交集
|
|
|
const selfListGcl = _.uniq(_.map(selfList, 'gcl_id'));
|
|
@@ -403,10 +468,11 @@ $(document).ready(() => {
|
|
|
});
|
|
|
} else {
|
|
|
gclGatherData = gclGatherData.filter(item => {
|
|
|
- return item.qc_qty || item.contract_qty
|
|
|
+ return item.qc_qty || item.contract_qty || item.qc_minus_qty
|
|
|
});
|
|
|
}
|
|
|
calculateJiaCha(gclGatherData);
|
|
|
+ SpreadJsObj.initSpreadSettingEvents(leafXmjSpreadSetting, leafXmjCol);
|
|
|
SpreadJsObj.initSheet(leafXmjSpread.getActiveSheet(), leafXmjSpreadSetting);
|
|
|
// 加载清单数据
|
|
|
SpreadJsObj.loadSheetData(ledgerSpread.getActiveSheet(), SpreadJsObj.DataType.Data, gclGatherData);
|
|
@@ -423,6 +489,56 @@ $(document).ready(() => {
|
|
|
selfSheet.resumePaint();
|
|
|
checkNotJoinMaterialData();
|
|
|
first = false;
|
|
|
+
|
|
|
+ // 判断是否需要更新contract_qty、qc_qty和qc_minus_qty
|
|
|
+ if (!materialIsNewQty && !readOnly) {
|
|
|
+ let needUpdateList = [];
|
|
|
+ if (materialListData.length > 0) {
|
|
|
+ if (isStageSelf) {
|
|
|
+ for (const msIndex in materialStageData) {
|
|
|
+ const materialStageList = _.filter(materialListData, { ms_id: materialStageData[msIndex].id });
|
|
|
+ const gclIdList = _.uniq(_.map(materialListData, 'gcl_id'));
|
|
|
+ let leafXmjList = [];
|
|
|
+ for (const id of gclIdList) {
|
|
|
+ const gcl = _.find(gclGatherListData[msIndex], function (item) {
|
|
|
+ return item.leafXmjs && item.leafXmjs.length > 0 && _.findIndex(item.leafXmjs, {gcl_id: id}) !== -1;
|
|
|
+ });
|
|
|
+ if (gcl) leafXmjList = [...leafXmjList, ...gcl.leafXmjs];
|
|
|
+ }
|
|
|
+ for (const ml of materialStageList) {
|
|
|
+ const leafXmjInfo = _.find(leafXmjList, function (item) {
|
|
|
+ return item.gcl_id === ml.gcl_id && item.id === ml.xmj_id && (item.mx_id === undefined || (item.mx_id !== undefined && item.mx_id === ml.mx_id));
|
|
|
+ });
|
|
|
+ if (leafXmjInfo) {
|
|
|
+ needUpdateList.push({ id: ml.id, contract_qty: leafXmjInfo.contract_qty, qc_qty: leafXmjInfo.qc_qty, qc_minus_qty: leafXmjInfo.qc_minus_qty });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 找出所有gcl相同的,方便搜索gclGatherData值
|
|
|
+ const gclIdList = _.uniq(_.map(materialListData, 'gcl_id'));
|
|
|
+ let leafXmjList = [];
|
|
|
+ for (const id of gclIdList) {
|
|
|
+ const gcl = _.find(gclGatherData, function (item) {
|
|
|
+ return item.leafXmjs && item.leafXmjs.length > 0 && _.findIndex(item.leafXmjs, {gcl_id: id}) !== -1;
|
|
|
+ });
|
|
|
+ if (gcl) leafXmjList = [...leafXmjList, ...gcl.leafXmjs];
|
|
|
+ }
|
|
|
+ for (const ml of materialListData) {
|
|
|
+ const leafXmjInfo = _.find(leafXmjList, function (item) {
|
|
|
+ return item.gcl_id === ml.gcl_id && item.id === ml.xmj_id && (item.mx_id === undefined || (item.mx_id !== undefined && item.mx_id === ml.mx_id));
|
|
|
+ });
|
|
|
+ if (leafXmjInfo) {
|
|
|
+ needUpdateList.push({ id: ml.id, contract_qty: leafXmjInfo.contract_qty, qc_qty: leafXmjInfo.qc_qty, qc_minus_qty: leafXmjInfo.qc_minus_qty });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ console.log(needUpdateList);
|
|
|
+ // postData(window.location.pathname + '/save', needUpdateList, function (result) {
|
|
|
+ // materialListData2 = result.materialListData;
|
|
|
+ // });
|
|
|
+ }
|
|
|
});
|
|
|
} else {
|
|
|
// 解析清单汇总数据
|
|
@@ -432,7 +548,7 @@ $(document).ready(() => {
|
|
|
gclGatherData = gclGatherListData[i];
|
|
|
if (openMaterialChecklist) {
|
|
|
gclGatherData = gclGatherData.filter(item => {
|
|
|
- return item.qc_qty || item.contract_qty
|
|
|
+ return item.qc_qty || item.contract_qty || item.qc_minus_qty
|
|
|
});
|
|
|
// 取交集
|
|
|
const selfListGcl = _.uniq(_.map(selfList, 'gcl_id'));
|
|
@@ -454,7 +570,7 @@ $(document).ready(() => {
|
|
|
});
|
|
|
} else {
|
|
|
gclGatherData = gclGatherData.filter(item => {
|
|
|
- return item.qc_qty || item.contract_qty
|
|
|
+ return item.qc_qty || item.contract_qty || item.qc_minus_qty
|
|
|
});
|
|
|
}
|
|
|
if ($('#show_material_gcl').is(':checked')) {
|
|
@@ -478,6 +594,7 @@ $(document).ready(() => {
|
|
|
}
|
|
|
console.log(gclGatherData);
|
|
|
calculateJiaCha(gclGatherData);
|
|
|
+ SpreadJsObj.initSpreadSettingEvents(leafXmjSpreadSetting, leafXmjCol);
|
|
|
SpreadJsObj.initSheet(leafXmjSpread.getActiveSheet(), leafXmjSpreadSetting);
|
|
|
// 加载清单数据
|
|
|
SpreadJsObj.loadSheetData(ledgerSpread.getActiveSheet(), SpreadJsObj.DataType.Data, gclGatherData);
|
|
@@ -661,7 +778,7 @@ $(document).ready(() => {
|
|
|
// 存在单独设置的才展示,不然隐藏
|
|
|
const gcl = gclGatherData[iGclRow];
|
|
|
const leafXmjs = gcl && gcl.leafXmjs ? gcl.leafXmjs.filter(item => {
|
|
|
- return item.qc_qty || item.contract_qty
|
|
|
+ return item.qc_qty || item.contract_qty || item.qc_minus_qty
|
|
|
}) : null;
|
|
|
if (leafXmjs) {
|
|
|
const xmj = leafXmjs[iLXmjRow];
|
|
@@ -710,7 +827,7 @@ $(document).ready(() => {
|
|
|
const index = gclGatherData.indexOf(select);
|
|
|
if (index !== -1) {
|
|
|
const xmj = gclGatherData[index].leafXmjs.filter(item => {
|
|
|
- return item.qc_qty || item.contract_qty
|
|
|
+ return item.qc_qty || item.contract_qty || item.qc_minus_qty
|
|
|
});
|
|
|
const leafXmjSheet = leafXmjSpread.getActiveSheet();
|
|
|
for (const [iRow,x] of xmj.entries()) {
|
|
@@ -772,7 +889,10 @@ $(document).ready(() => {
|
|
|
xmj_id: xmj.id,
|
|
|
gcl_id: xmj.gcl_id,
|
|
|
mx_id: xmj.mx_id ? xmj.mx_id : '',
|
|
|
- gather_qty: notx2 === undefined ? xmj.gather_qty : xmj.contract_qty,
|
|
|
+ contract_qty: xmj.contract_qty,
|
|
|
+ qc_qty: xmj.qc_qty,
|
|
|
+ qc_minus_qty: xmj.qc_minus_qty,
|
|
|
+ gather_qty: xmj.gather_qty,
|
|
|
is_join: notx === undefined ? 1 : 0,
|
|
|
};
|
|
|
if (ms_id) data.ms_id = ms_id;
|
|
@@ -785,7 +905,10 @@ $(document).ready(() => {
|
|
|
if (ms.id !== ms_id) {
|
|
|
const gclOther = _.find(gclGatherListData[index], { b_code: gclData.b_code, name: gclData.name, unit: gclData.unit, unit_price: gclData.unit_price });
|
|
|
if (gclOther) {
|
|
|
- const leafXmjs = gclOther.leafXmjs.filter(item => item.gather_qty !== null && item.gather_qty !== undefined);
|
|
|
+ const leafXmjs = gclOther.leafXmjs.filter(item => {
|
|
|
+ return item.qc_qty || item.contract_qty || item.qc_minus_qty
|
|
|
+ });
|
|
|
+ // gclOther.leafXmjs.filter(item => item.gather_qty !== null && item.gather_qty !== undefined);
|
|
|
for (const xmj of leafXmjs) {
|
|
|
const notx = findNotJoinLeafXmj(xmj);
|
|
|
const notx2 = findNotChangeLeafXmj(xmj);
|
|
@@ -793,7 +916,10 @@ $(document).ready(() => {
|
|
|
xmj_id: xmj.id,
|
|
|
gcl_id: xmj.gcl_id,
|
|
|
mx_id: xmj.mx_id ? xmj.mx_id : '',
|
|
|
- gather_qty: notx2 === undefined ? xmj.gather_qty : xmj.contract_qty,
|
|
|
+ contract_qty: xmj.contract_qty,
|
|
|
+ qc_qty: xmj.qc_qty,
|
|
|
+ qc_minus_qty: xmj.qc_minus_qty,
|
|
|
+ gather_qty: xmj.gather_qty,
|
|
|
is_join: notx === undefined ? 1 : 0,
|
|
|
ms_id: ms.id,
|
|
|
};
|
|
@@ -825,7 +951,9 @@ $(document).ready(() => {
|
|
|
const index = gclGatherData.indexOf(select);
|
|
|
const leafXmjSheet = leafXmjSpread.getActiveSheet();
|
|
|
const leafXmjSelect = SpreadJsObj.getSelectObject(leafXmjSheet);
|
|
|
- const gcl = gclGatherData[index].leafXmjs.filter(item => item.gather_qty !== null && item.gather_qty !== undefined);
|
|
|
+ const gcl = gclGatherData[index].leafXmjs.filter(item => {
|
|
|
+ return item.qc_qty || item.contract_qty || item.qc_minus_qty
|
|
|
+ });
|
|
|
const leafXmjIndex = gcl.indexOf(leafXmjSelect);
|
|
|
const xmj = gcl[leafXmjIndex];
|
|
|
const notx = findNotJoinLeafXmj(xmj);
|
|
@@ -835,7 +963,10 @@ $(document).ready(() => {
|
|
|
gcl_id: xmj.gcl_id,
|
|
|
mx_id: xmj.mx_id ? xmj.mx_id : '',
|
|
|
mb_id: mb_id,
|
|
|
- gather_qty: notx2 === undefined ? xmj.gather_qty : xmj.contract_qty,
|
|
|
+ contract_qty: xmj.contract_qty,
|
|
|
+ qc_qty: xmj.qc_qty,
|
|
|
+ qc_minus_qty: xmj.qc_minus_qty,
|
|
|
+ gather_qty: xmj.gather_qty,
|
|
|
is_join: notx === undefined ? 1 : 0,
|
|
|
};
|
|
|
console.log(data);
|
|
@@ -857,7 +988,7 @@ $(document).ready(() => {
|
|
|
const leafXmjSelect = SpreadJsObj.getSelectObject(leafXmjSheet);
|
|
|
const iRow = gclGatherData[index].leafXmjs.indexOf(leafXmjSelect);
|
|
|
const leafXmjs = gclGatherData[index].leafXmjs.filter(item => {
|
|
|
- return item.qc_qty || item.contract_qty
|
|
|
+ return item.qc_qty || item.contract_qty || item.qc_minus_qty
|
|
|
});
|
|
|
const nRow = leafXmjs.indexOf(leafXmjSelect);
|
|
|
const leafXmjColor = findNotJoinLeafXmj(leafXmjSelect) ? '#d6d8db' : (findNotChangeLeafXmj(leafXmjSelect) ? '#FFE699' : '');
|
|
@@ -935,7 +1066,9 @@ $(document).ready(() => {
|
|
|
const gclOther = _.find(gclGatherListData[index], { b_code: gclData.b_code, name: gclData.name, unit: gclData.unit, unit_price: gclData.unit_price });
|
|
|
let gather_qty = null;
|
|
|
if (gclOther) {
|
|
|
- const leafXmjs = gclOther.leafXmjs.filter(item => item.gather_qty !== null && item.gather_qty !== undefined);
|
|
|
+ const leafXmjs = gclOther.leafXmjs.filter(item => {
|
|
|
+ return item.qc_qty || item.contract_qty || item.qc_minus_qty
|
|
|
+ });
|
|
|
const oneXmj = _.find(leafXmjs, function (item) {
|
|
|
return item.gcl_id === select.gcl_id && item.id === select.id && (select.mx_id === undefined || item.mx_id === select.mx_id);
|
|
|
});
|
|
@@ -1038,7 +1171,7 @@ $(document).ready(() => {
|
|
|
return false;
|
|
|
}
|
|
|
const notx2 = findNotChangeLeafXmj(select);
|
|
|
- if (!readOnly && select && notx2 === undefined) {
|
|
|
+ if (!readOnly && select && notx2 === undefined && materialQtySource !== qtySourceValueConst.contract_qty) {
|
|
|
return true;
|
|
|
} else {
|
|
|
return false;
|
|
@@ -1134,7 +1267,7 @@ $(document).ready(() => {
|
|
|
const [iGclRow, iRow, nRow, sheet, select, color] = leafXmjSpreadObj.getSelect();
|
|
|
const gcl = gclGatherData[iGclRow];
|
|
|
const leafXmjs = gcl && gcl.leafXmjs ? gcl.leafXmjs.filter(item => {
|
|
|
- return item.qc_qty || item.contract_qty
|
|
|
+ return item.qc_qty || item.contract_qty || item.qc_minus_qty
|
|
|
}) : null;
|
|
|
let flag = false;
|
|
|
if (leafXmjs) {
|
|
@@ -1186,7 +1319,9 @@ $(document).ready(() => {
|
|
|
if (ms.id !== ms_id) {
|
|
|
const gclOther = _.find(gclGatherListData[index], { b_code: gclData.b_code, name: gclData.name, unit: gclData.unit, unit_price: gclData.unit_price });
|
|
|
if (gclOther) {
|
|
|
- const leafXmjs = gclOther.leafXmjs.filter(item => item.gather_qty !== null && item.gather_qty !== undefined);
|
|
|
+ const leafXmjs = gclOther.leafXmjs.filter(item => {
|
|
|
+ return item.qc_qty || item.contract_qty || item.qc_minus_qty
|
|
|
+ });
|
|
|
for (const xmj of leafXmjs) {
|
|
|
const data = {
|
|
|
xmj_id: xmj.id,
|
|
@@ -1311,7 +1446,9 @@ $(document).ready(() => {
|
|
|
if (ms.id !== ms_id) {
|
|
|
const gclOther = _.find(gclGatherListData[index], { b_code: gclData.b_code, name: gclData.name, unit: gclData.unit, unit_price: gclData.unit_price });
|
|
|
if (gclOther) {
|
|
|
- const leafXmjs = gclOther.leafXmjs.filter(item => item.gather_qty !== null && item.gather_qty !== undefined);
|
|
|
+ const leafXmjs = gclOther.leafXmjs.filter(item => {
|
|
|
+ return item.qc_qty || item.contract_qty || item.qc_minus_qty
|
|
|
+ });
|
|
|
for (const xmj of leafXmjs) {
|
|
|
const data = {
|
|
|
xmj_id: xmj.id,
|
|
@@ -1462,9 +1599,10 @@ $(document).ready(() => {
|
|
|
for (const [index, ms] of materialStageData.entries()) {
|
|
|
if (ms.id !== ms_id) {
|
|
|
const gclOther = _.find(gclGatherListData[index], { b_code: gclData.b_code, name: gclData.name, unit: gclData.unit, unit_price: gclData.unit_price });
|
|
|
- console.log(gclOther);
|
|
|
if (gclOther) {
|
|
|
- const leafXmjs = gclOther.leafXmjs.filter(item => item.gather_qty !== null && item.gather_qty !== undefined);
|
|
|
+ const leafXmjs = gclOther.leafXmjs.filter(item => {
|
|
|
+ return item.qc_qty || item.contract_qty || item.qc_minus_qty
|
|
|
+ });
|
|
|
for (const xmj of leafXmjs) {
|
|
|
const data = {
|
|
|
xmj_id: xmj.id,
|
|
@@ -2065,7 +2203,7 @@ $(document).ready(() => {
|
|
|
gclGatherModel.loadLedgerData(_.cloneDeep(ledger), curLedgerData);
|
|
|
gclGatherModel.loadPosData(_.cloneDeep(pos), curPosData);
|
|
|
gclGatherData = gclGatherModel.gatherGclData().filter(item => {
|
|
|
- return item.qc_qty || item.contract_qty
|
|
|
+ return item.qc_qty || item.contract_qty || item.qc_minus_qty
|
|
|
});
|
|
|
}
|
|
|
if (openMaterialChecklist) {
|