project_glj_spread.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  1. /**
  2. * 项目工料机相关spread
  3. *
  4. * @author CaiAoLin
  5. * @date 2017/7/19
  6. * @version
  7. */
  8. /**
  9. * 构造函数
  10. *
  11. * @return {void}
  12. */
  13. function ProjectGLJSpread() {
  14. this.isChanging = false;
  15. this.sheetObj = null;
  16. this.firstMachineRow = -1;
  17. this.firstMixRatioRow = -1;
  18. this.successCallback = null;
  19. this.supplyType = ['自行采购', '部分甲供', '完全甲供', '甲定乙供'];
  20. // 工料机类型是混凝土、砂浆、配合比、机械(不包括机械组成物)时,供货方式列只读。
  21. this.supplyReadonlyType = notEditType;
  22. }
  23. /**
  24. * 初始化
  25. *
  26. * @return {object}
  27. */
  28. ProjectGLJSpread.prototype.init = function () {
  29. // 供货方式类型
  30. let supplySelect = [];
  31. for(let index in this.supplyType) {
  32. supplySelect.push({
  33. text: this.supplyType[index],
  34. value: index
  35. });
  36. }
  37. let selectBox = new GC.Spread.Sheets.CellTypes.ComboBox();
  38. selectBox.items(supplySelect);
  39. selectBox.editorValueType(GC.Spread.Sheets.CellTypes.EditorValueType.text);
  40. let header = [
  41. {name: '编码', field: 'code', visible: true,width:80},
  42. {name: '名称', field: 'name', visible: true,width:160},
  43. {name: '规格型号', field: 'specs', visible: true,width:120},
  44. {name: '单位', field: 'unit', visible: true,width:45},
  45. {name: '类型', field: 'unit_price.short_name', visible: true,width:45},
  46. {name: 'ID', field: 'id', visible: false},
  47. {name: '类型', field: 'unit_price.type', visible: false},
  48. {name: '总消耗量', field: 'quantity', visible: true,width:100,decimalField:'glj.quantity'},
  49. {name: '总消耗量', field: 'quantity', visible: true,width:100,decimalField:'glj.quantity'},
  50. {name: '分部分项总消耗量', field: 'subdivisionQuantity', visible: true,width:100,decimalField:'glj.quantity'},
  51. {name: '技术措施项目总消耗量', field: 'techQuantity', visible: true,width:100,decimalField:'glj.quantity'},
  52. {name: '定额价', field: "base_price", visible: true,width:70,decimalField:"glj.unitPrice",validator: 'number'},//这里feiedID设置是为了在计不计取价差的时候做显示用
  53. {name: '调整价', field: 'adjust_price', visible: true,width:70,decimalField:"glj.unitPrice"},
  54. {name: '市场价', field: "unit_price.market_price", visible: true, validator: 'number',width:70,decimalField:"glj.unitPrice"},
  55. {
  56. name: '是否暂估',
  57. field: 'is_evaluate',
  58. visible: true,
  59. cellType: new GC.Spread.Sheets.CellTypes.CheckBox(),
  60. validator: 'boolean'
  61. ,width:60
  62. },
  63. {name: '供货方式', field: 'supply', visible: true, cellType: selectBox,width:80},
  64. {name: '甲供数量', field: 'supply_quantity',validator:'number', visible: true,width:100},
  65. {name: '交货方式', field: 'delivery', visible: true,width:90},
  66. {name: '送达地点', field: 'delivery_address', visible: true,width:100},
  67. {
  68. name: '不调价',
  69. field: 'is_adjust_price',
  70. visible: true,
  71. cellType: new GC.Spread.Sheets.CellTypes.CheckBox(),
  72. validator: 'boolean',
  73. width:55
  74. },
  75. {name: 'UID', field: 'unit_price.id', visible: false},
  76. {name: '工料机ID', field: 'glj_id', visible: false},
  77. {name: '组成物消耗量', field: 'consumption', visible: false},
  78. {name: '父级关联编码', field: 'connect_code', visible: false},
  79. {name: '组成物信息', field: 'ratio_data', visible: false},
  80. ];
  81. let sourceData = jsonData;
  82. this.sheetObj = new CommonSpreadJs(header);
  83. this.sheetObj.init('project-glj');
  84. // 获取列号
  85. let isEvaluateColumn = this.sheetObj.getFieldColumn('is_evaluate');
  86. let isAdjustPriceColumn = this.sheetObj.getFieldColumn('is_adjust_price');
  87. let unitColumn = this.sheetObj.getFieldColumn('unit');
  88. let quantityColumn = this.sheetObj.getFieldColumn('quantity');
  89. let basePriceColumn = this.sheetObj.getFieldColumn('base_price');
  90. let adjustPriceColumn = this.sheetObj.getFieldColumn('adjust_price');
  91. let marketPriceColumn = this.sheetObj.getFieldColumn('unit_price.market_price');
  92. let supplyColumn = this.sheetObj.getFieldColumn('supply');
  93. let shortNameColumn = this.sheetObj.getFieldColumn('unit_price.short_name');
  94. let supplyQuantity = this.sheetObj.getFieldColumn('supply_quantity');
  95. // 居中样式
  96. let centerStyleSetting = {hAlign: 1};
  97. this.sheetObj.setStyle(-1, isEvaluateColumn, centerStyleSetting);
  98. this.sheetObj.setStyle(-1, isAdjustPriceColumn, centerStyleSetting);
  99. this.sheetObj.setStyle(-1, unitColumn, centerStyleSetting);
  100. this.sheetObj.setStyle(-1, shortNameColumn, centerStyleSetting);
  101. // 向右对齐样式
  102. let rightStyleSetting = {hAlign: GC.Spread.Sheets.HorizontalAlign.right};
  103. this.sheetObj.setStyle(-1, quantityColumn, rightStyleSetting);
  104. this.sheetObj.setStyle(-1, basePriceColumn, rightStyleSetting);
  105. this.sheetObj.setStyle(-1, adjustPriceColumn, rightStyleSetting);
  106. this.sheetObj.setStyle(-1, marketPriceColumn, rightStyleSetting);
  107. this.sheetObj.setStyle(-1, supplyColumn, rightStyleSetting);
  108. this.sheetObj.setStyle(-1, supplyQuantity, rightStyleSetting);
  109. // 设置可编辑列
  110. this.sheetObj.setColumnEditable(basePriceColumn);
  111. this.sheetObj.setColumnEditable(marketPriceColumn);
  112. this.sheetObj.setColumnEditable(isEvaluateColumn);
  113. this.sheetObj.setColumnEditable(isAdjustPriceColumn);
  114. this.sheetObj.setColumnEditable(supplyColumn);
  115. this.sheetObj.setData(sourceData);
  116. // 取消正在加载字符提示
  117. $("#project-glj > p").hide();
  118. this.specialColumn(sourceData);
  119. // 绑定修改事件
  120. let self = this;
  121. this.sheetObj.bind(GC.Spread.Sheets.Events.ValueChanged, function(element, info) {
  122. self.updateProjectGLJField(info, self.successCallback);
  123. });
  124. // 绑定双击事件
  125. this.sheetObj.bind(GC.Spread.Sheets.Events.CellDoubleClick, function (element, info) {
  126. let column = info.col;
  127. let row = info.row;
  128. let field = self.sheetObj.getColumnField(column);
  129. let activeSheet = self.sheetObj.getSheet();
  130. // 获取类型
  131. let typeColumn = self.sheetObj.getFieldColumn('unit_price.type');
  132. let type = activeSheet.getValue(row, typeColumn);
  133. let ratioColumn = self.sheetObj.getFieldColumn('ratio_data');
  134. let ratioData = activeSheet.getValue(row, ratioColumn);
  135. // 如果类型为混凝土、砂浆、配合比、机械,则提示
  136. if (field === 'unit_price.market_price' && canNotChangeTypeId.indexOf(type) >= 0) {
  137. if(ratioData&&ratioData.length>0){
  138. alert('当前工料机的市场单价由组成物计算得出,不可直接修改');
  139. }
  140. }
  141. });
  142. return this.sheetObj;
  143. };
  144. /**
  145. * 更新项目工料机中的数据字段
  146. *
  147. * @param {object} info
  148. * @param {function} callback
  149. * @return {void|boolean}
  150. */
  151. ProjectGLJSpread.prototype.updateProjectGLJField = function(info, callback) {
  152. // 获取修改的数据
  153. let column = info.col;
  154. let row = info.row;
  155. let idString = 'id';
  156. let field = projectGLJSheet.getColumnField(column);
  157. if (field === '') {
  158. return false;
  159. }
  160. let activeSheet = projectGLJSheet.getSheet();
  161. // 切割字段
  162. let fieldArray = field.split('.');
  163. idString = fieldArray.length > 1 ? 'unit_price.id' : idString;
  164. // 防止快速同时提交
  165. if (isChanging) {
  166. return false;
  167. }
  168. // 校验数据
  169. let value = info.newValue;
  170. if (!projectGLJSheet.checkData(column, value)) {
  171. alert('输入的数据类型不对,请重新输入!');
  172. activeSheet.setValue(row, column, info.oldValue);
  173. return false;
  174. }
  175. // 获取id
  176. let idColumn = projectGLJSheet.getFieldColumn(idString);
  177. if (idColumn < 0) {
  178. return false;
  179. }
  180. let id = activeSheet.getValue(row, idColumn);
  181. // 直接在前端计算后传值后台改
  182. let extend = {};
  183. /* let updateRecord = jsonData[row]; 这时修改成在后端计算后直接更新,因为还要重新计算受影响的清单节点
  184. let parentMarketPrice = projectGLJSpread.compositionCalculate(updateRecord);
  185. if (parentMarketPrice !== null && Object.keys(parentMarketPrice).length > 0) {
  186. for (let activeCode in parentMarketPrice) {
  187. let tmpObject = {
  188. market_price: parentMarketPrice[activeCode],
  189. };
  190. extend[activeCode] = tmpObject;
  191. }
  192. }*/
  193. // 如果是供货方式则需要处理数据
  194. if (field === 'supply') {
  195. value = this.supplyType.indexOf(value);
  196. extend.supply_quantity = this.getSupplyQuantity(value, activeSheet, info);
  197. }
  198. if(field === 'supply_quantity'){//修改数量需做4舍5入
  199. value= value.toDecimal(getDecimal('glj.quantity'));
  200. }
  201. if(field === 'unit_price.market_price'||field === 'base_price'){
  202. value= scMathUtil.roundForObj(value,getDecimal('glj.unitPrice'));//修改市场价和修改定额价时需要重新记算很多受影响的树节点,现在改成与定字额工料机那里调相同的方法。
  203. let editField = field === 'base_price'?field:"market_price";
  204. projectObj.project.projectGLJ.updatePrice(jsonData[row],editField,value);
  205. return;
  206. }
  207. extend = Object.keys(extend).length > 0 ? JSON.stringify(extend) : '';
  208. this.postUpdate(id,field,value,info,extend,callback);
  209. };
  210. ProjectGLJSpread.prototype.postUpdate=function (id,field,value,info,extend,callback) {
  211. $.bootstrapLoading.start();
  212. $.ajax({
  213. url: '/glj/update',
  214. type: 'post',
  215. data: {id: id, field: field, value: value, extend: extend},
  216. dataType: 'json',
  217. error: function() {
  218. alert('数据传输有误!');
  219. isChanging = false;
  220. },
  221. beforeSend: function() {
  222. isChanging = true;
  223. },
  224. success: function(response) {
  225. isChanging = false;
  226. // 修改失败则恢复原值
  227. if (response.err !== 0&&info.fromRG!=true) {
  228. projectGLJSheet.getSheet().setValue(info.row, info.col, info.oldValue);
  229. alert('更改数据失败!');
  230. } else {
  231. // 成功则触发相应事件
  232. /* if (parentMarketPrice !== null) {
  233. info.parentMarketPrice = parentMarketPrice;
  234. }*/
  235. if(field !== 'supply'&&info.fromRG!=true){ //供货方式需做转换才能直接设置值, 这里设置值是为了早点更新数据,等getdata返回数据再刷新的话会有比较大的延时
  236. projectGLJSheet.getSheet().setValue(info.row, info.col, value);
  237. }
  238. callback(field, info,id);
  239. }
  240. }
  241. });
  242. }
  243. /**
  244. * 设置特殊单元格数据
  245. *
  246. * @param {object} sourceData
  247. * @return {void}
  248. */
  249. ProjectGLJSpread.prototype.specialColumn = function (sourceData) {
  250. let rowCounter = 0;
  251. // 获取列号
  252. let isEvaluateColumn = this.sheetObj.getFieldColumn('is_evaluate');
  253. let marketPriceColumn = this.sheetObj.getFieldColumn('unit_price.market_price');
  254. let basePriceColumn = this.sheetObj.getFieldColumn('base_price');
  255. let adjustPriceColumn = this.sheetObj.getFieldColumn("adjust_price");
  256. let connectCodeColumn = this.sheetObj.getFieldColumn('connect_code');
  257. let consumptionColumn = this.sheetObj.getFieldColumn('consumption');
  258. let supplyColumn = this.sheetObj.getFieldColumn('supply');
  259. let supplyQuantity = this.sheetObj.getFieldColumn('supply_quantity');
  260. let activeSheet = this.sheetObj.getSheet();
  261. for (let data of sourceData) {
  262. // 只有材料才显示是否暂估
  263. if (materialIdList.indexOf(data.unit_price.type) < 0) {
  264. let string = new GC.Spread.Sheets.CellTypes.Text();
  265. activeSheet.setCellType(rowCounter, isEvaluateColumn, string, GC.Spread.Sheets.SheetArea.viewport);
  266. // 锁定该单元格
  267. activeSheet.getCell(rowCounter, isEvaluateColumn, GC.Spread.Sheets.SheetArea.viewport).locked(true);
  268. activeSheet.setValue(rowCounter, isEvaluateColumn, '');
  269. }else {
  270. let checkBox = new GC.Spread.Sheets.CellTypes.CheckBox();
  271. activeSheet.setCellType(rowCounter, isEvaluateColumn, checkBox, GC.Spread.Sheets.SheetArea.viewport);
  272. activeSheet.getCell(rowCounter, isEvaluateColumn, GC.Spread.Sheets.SheetArea.viewport).locked(false);
  273. activeSheet.setValue(rowCounter, isEvaluateColumn, data.is_evaluate);
  274. }
  275. // 设置供货方式列是否可选
  276. if (this.supplyReadonlyType.indexOf(data.unit_price.type) >= 0) {
  277. // 锁定该单元格
  278. activeSheet.getCell(rowCounter, supplyColumn, GC.Spread.Sheets.SheetArea.viewport).locked(true);
  279. }
  280. // 如果为部分甲供则甲供数量需要可编辑
  281. if (data.supply === 1) {
  282. activeSheet.getCell(rowCounter, supplyQuantity, GC.Spread.Sheets.SheetArea.viewport).locked(false);
  283. }
  284. //供货方式为完全甲供时设置甲供数量为总消耗量
  285. if (data.supply === 2) {
  286. activeSheet.setValue(rowCounter, supplyQuantity, data.quantity);
  287. }
  288. // 供货方式数据
  289. let supplyIndex = parseInt(data.supply);
  290. supplyIndex = isNaN(supplyIndex) ? 0 : supplyIndex;
  291. let supplyText = this.supplyType[supplyIndex] !== undefined ? this.supplyType[supplyIndex] : '自行采购';
  292. activeSheet.setValue(rowCounter, supplyColumn, supplyText);
  293. // 如果类型为混凝土、砂浆、配合比、机械,则市场单价和供货方式不能修改
  294. if (canNotChangeTypeId.indexOf(data.unit_price.type) >= 0) {
  295. this.firstMixRatioRow = this.firstMixRatioRow === -1 && data.unit_price.type !== GLJTypeConst.GENERAL_MACHINE ?
  296. rowCounter : this.firstMixRatioRow;
  297. this.firstMachineRow = this.firstMachineRow === -1 && data.unit_price.type === GLJTypeConst.GENERAL_MACHINE ?
  298. rowCounter : this.firstMachineRow;
  299. // 锁定该单元格
  300. if (data.ratio_data && data.ratio_data.length > 0){//有组成物时,市场单价、定额价不可修改
  301. activeSheet.getCell(rowCounter, marketPriceColumn, GC.Spread.Sheets.SheetArea.viewport).locked(true);
  302. activeSheet.getCell(rowCounter, basePriceColumn, GC.Spread.Sheets.SheetArea.viewport).locked(true);
  303. }
  304. activeSheet.getCell(rowCounter, supplyColumn, GC.Spread.Sheets.SheetArea.viewport).locked(true);
  305. }
  306. if(data.unit_price.is_add!=1){//如果不是新增,定额价不可修改。
  307. activeSheet.getCell(rowCounter, basePriceColumn, GC.Spread.Sheets.SheetArea.viewport).locked(true);
  308. }
  309. // 处理数据
  310. if (data.ratio_data !== undefined && data.ratio_data.length > 0) {
  311. let connectCode = [];
  312. let consumption = [];
  313. for (let tmp of data.ratio_data) {
  314. connectCode.push(tmp.connect_key);
  315. consumption.push(tmp.consumption);
  316. }
  317. let connectCodeString = connectCode.join(',');
  318. let consumptionString = consumption.join(',');
  319. activeSheet.setValue(rowCounter, connectCodeColumn, connectCodeString);
  320. activeSheet.setValue(rowCounter, consumptionColumn, consumptionString);
  321. }
  322. data=this.sheetObj.setProjectGLJDiffPrice(data);
  323. activeSheet.setValue(rowCounter,basePriceColumn,data.base_price);
  324. activeSheet.setValue(rowCounter,adjustPriceColumn,data.adjust_price);
  325. rowCounter++;
  326. }
  327. };
  328. /**
  329. * 计算当前行对应组成物的市场以及基价单价价格
  330. *
  331. * @param {Number} row
  332. * @return {Object}
  333. */
  334. ProjectGLJSpread.prototype.compositionCalculate = function(updateRecord) {
  335. let gljData = projectObj.project.projectGLJ.datas;
  336. let m_index = gljOprObj.getIndex(updateRecord,gljKeyArray);
  337. let parent_connect_keys = gljData.mixRatioConnectData[m_index];
  338. if(!parent_connect_keys||parent_connect_keys.length<=0){// 不属于组成物则忽略
  339. return null;
  340. }
  341. let q_decimal = getDecimal("glj.quantity");
  342. let p_decimal = getDecimal("glj.unitPrice");
  343. let parentMarketPrice = {};
  344. for(let p of parent_connect_keys) {
  345. let mix_ratios = gljData.mixRatioMap[p];
  346. let sum = 0;
  347. for (let m of mix_ratios) {
  348. let unitPrice = this.sheetObj.getUnitPrice(m);
  349. if (unitPrice) {
  350. let com = scMathUtil.roundForObj(m.consumption, q_decimal);
  351. let marketPrice = scMathUtil.roundForObj(unitPrice.market_price, p_decimal);
  352. sum = scMathUtil.roundForObj(marketPrice * com + sum, p_decimal);
  353. }
  354. }
  355. parentMarketPrice[p]=sum;
  356. }
  357. return parentMarketPrice;
  358. };
  359. /**
  360. * 组成物父类数据更新
  361. *
  362. * @param {Object} parentMarketPrice
  363. * @return {void}
  364. */
  365. ProjectGLJSpread.prototype.compositionParentUpdate = function(parentMarketPrice) {
  366. let marketPriceColumn = this.sheetObj.getFieldColumn('unit_price.market_price');
  367. let activeSheet = this.sheetObj.getSheet();
  368. // 定位到父节点,然后更新
  369. for (let code in parentMarketPrice) {
  370. let changeRow = this.sheetObj.searchKeyword(code);
  371. activeSheet.setValue(changeRow, marketPriceColumn, parentMarketPrice[code]);
  372. }
  373. };
  374. /**
  375. * 价格计算
  376. *
  377. * @param {Object} info
  378. * @return {void}
  379. */
  380. ProjectGLJSpread.prototype.priceCalculate = function(info) {
  381. let row = info.row;
  382. let typeColumn = this.sheetObj.getFieldColumn('unit_price.type');
  383. let basePriceColumn = this.sheetObj.getFieldColumn('base_price');
  384. let adjustPriceColumn = projectGLJSheet.getFieldColumn('adjust_price');
  385. let activeSheet = this.sheetObj.getSheet();
  386. // 获取类型
  387. let type = activeSheet.getValue(row, typeColumn);
  388. /* let data = jsonData[row];
  389. if(gljOprObj.calcPriceDiff(data)==true){//是否记算价差
  390. data.base_price = data.unit_price.base_price;
  391. data.adjust_price = projectObj.project.projectGLJ.getAdjustPrice(data);
  392. }else {
  393. data.base_price = data.unit_price.market_price;
  394. data.adjust_price = data.unit_price.market_price;
  395. }
  396. activeSheet.setValue(info.row,basePriceColumn,data.base_price);
  397. activeSheet.setValue(info.row,adjustPriceColumn,data.adjust_price);*/
  398. /* // 基价单价计算
  399. switch (type) {
  400. // 主材、设备自动赋值基价单价=市场单价
  401. case GLJTypeConst.MAIN_MATERIAL:
  402. case GLJTypeConst.EQUIPMENT:
  403. activeSheet.setValue(info.row, basePriceColumn, info.newValue);
  404. break;
  405. }*/
  406. /* // 调整基价计算
  407. switch (type) {
  408. // 材料、主材、设备 调整基价=基价单价
  409. case GLJTypeConst.MAIN_MATERIAL:
  410. case GLJTypeConst.EQUIPMENT:
  411. let basePrice = activeSheet.getValue(info.row, basePriceColumn);
  412. activeSheet.setValue(info.row, adjustPriceColumn, basePrice);
  413. break;
  414. }*/
  415. // 市场单价计算
  416. switch (type) {
  417. // 人工、材料(普通材料)触发 需计算混凝土、砂浆、配合比、机械的市场单价
  418. case GLJTypeConst.LABOUR:
  419. case GLJTypeConst.GENERAL_MATERIAL:
  420. // 计算
  421. this.compositionParentUpdate(info.parentMarketPrice);
  422. break;
  423. }
  424. };
  425. /**
  426. * 更改供货方式
  427. *
  428. * @param {Object} info
  429. * @return {void}
  430. */
  431. ProjectGLJSpread.prototype.changeSupplyType = function(info) {
  432. let supply = info.newValue;
  433. let supplyNumber = this.supplyType.indexOf(supply) > -1 ? this.supplyType.indexOf(supply) : 0;
  434. let supplyQuantityColumn = this.sheetObj.getFieldColumn('supply_quantity');
  435. let activeSheet = this.sheetObj.getSheet();
  436. // 部分甲供时可更改甲供数量数据,其余则只读
  437. let locked = supplyNumber === 1 ? false : true;
  438. activeSheet.getCell(info.row, supplyQuantityColumn, GC.Spread.Sheets.SheetArea.viewport).locked(locked);
  439. let supplyQuantity = this.getSupplyQuantity(supplyNumber, activeSheet, info);
  440. activeSheet.setValue(info.row, supplyQuantityColumn, supplyQuantity);
  441. };
  442. /**
  443. * 根据供货方式获取甲供数量
  444. *
  445. * @param {Number} supplyType
  446. * @param {Object} activeSheet
  447. * @param {Object} info
  448. * @return {Number}
  449. */
  450. ProjectGLJSpread.prototype.getSupplyQuantity = function(supplyType, activeSheet, info) {
  451. let quantityColumn = this.sheetObj.getFieldColumn('quantity');
  452. // 获取总消耗量
  453. let quantity = activeSheet.getValue(info.row, quantityColumn);
  454. // 自行采购和甲定乙供则把甲供数量设置为0,其余情况则设置为当前总消耗量
  455. let supplyQuantity = supplyType === 0 || supplyType === 3 ? 0 : quantity;
  456. supplyQuantity = parseFloat(supplyQuantity);
  457. return supplyQuantity;
  458. };