material_calc_view.js 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903
  1. /**
  2. * Created by zhang on 2019/3/11.
  3. */
  4. materialCalcObj = {
  5. moduleName:'materalCal',
  6. materialSpread:null,
  7. materialSheet:null,
  8. materialDatas:[],
  9. materialSetting:{
  10. header:[
  11. {headerName: "编号", headerWidth: 80, dataCode: "code", dataType: "String"},
  12. {headerName: "名称", headerWidth: 100, dataCode: "name", dataType: "String"},
  13. {headerName: "预算价", headerWidth: 70, dataCode: "marketPrice", hAlign: "right", dataType: "Number",validator:"number"},
  14. {headerName: "供应地点", headerWidth: 100, dataCode: "supplyLocation", hAlign: "left", dataType: "String"},
  15. {headerName: "原价", headerWidth: 60, dataCode: "originalPrice", hAlign: "right", dataType: "String"},
  16. {headerName: "单位运费", headerWidth: 60, dataCode: "unitFreight", hAlign: "right", dataType: "Number",validator:"number"},//,decimalField:'glj.unitPrice'
  17. {headerName: "单位毛重(吨)", headerWidth: 60, dataCode: "grossWeightCoe_n", hAlign: "right", dataType: "Number"},//,decimalField:"glj.unitPrice"
  18. {headerName: "装卸总次数", headerWidth: 60, dataCode: "totalLoadingTimes", hAlign: "right", dataType: "Number",validator:"number"},//,decimalField:"glj.unitPrice"
  19. {headerName: "每增加一次装卸损耗率", headerWidth: 80, dataCode: "handlingLossRate_n", hAlign: "right", dataType: "Number",validator:"number"},
  20. {headerName: "场外运输损耗率", headerWidth: 60, dataCode: "offSiteTransportLossRate_n", hAlign: "right", dataType: "Number"},//,decimalField:"glj.unitPrice"
  21. {headerName: "场外运输损耗", headerWidth: 60, dataCode: "offSiteTransportLoss", hAlign: "right", dataType: "Number"},//,decimalField:"glj.unitPrice"
  22. {headerName: "采购及保管费率", headerWidth: 60, dataCode: "purchaseStorageRate_n", hAlign: "right", dataType: "Number"},//,decimalField:"glj.unitPrice"
  23. {headerName: "采购及保管费", headerWidth: 60, dataCode: "purchaseStorage", hAlign: "right", dataType: "Number"},//,decimalField:"glj.unitPrice"
  24. {headerName: "包装品回收价值", headerWidth: 60, dataCode: "packageRecoverValue", hAlign: "right", dataType: "Number"}//,decimalField:"glj.unitPrice"
  25. ],
  26. view: {
  27. lockColumns: ["code","name","marketPrice",'offSiteTransportLoss','purchaseStorage'],
  28. colHeaderHeight:36
  29. }
  30. },
  31. freightSpread:null,
  32. freightSheet:null,
  33. freightDatas:[],
  34. conveyanceOptions:["自办运输","汽车","火车","船舶","马车","手推车","拖拉机"],
  35. userFreightList:[],
  36. freightSetting:{
  37. header:[
  38. {headerName: "起讫地点", headerWidth: 80, dataCode: "start", dataType: "String"},
  39. {headerName: "运输工具", headerWidth: 80, dataCode: "conveyance", dataType: "String"},
  40. {headerName: "单位运价", headerWidth: 60, dataCode: "unitFreight", hAlign: "right", dataType: "Number",validator:"number"},
  41. {headerName: "km运距", headerWidth: 60, dataCode: "kmDistance", hAlign: "right", dataType: "String",validator:"number"},
  42. {headerName: "装卸费\n单价", headerWidth: 60, dataCode: "unitLoadingFee", hAlign: "right", dataType: "String",validator:"number"},
  43. {headerName: "装卸\n次数", headerWidth: 60, dataCode: "loadingTimes", hAlign: "right", dataType: "Number",validator:"number"},//,decimalField:'glj.unitPrice'
  44. {headerName: "其它\n费用", headerWidth: 60, dataCode: "otherFee", hAlign: "right", dataType: "Number",validator:"number"},//,decimalField:"glj.unitPrice"
  45. {headerName: "运价增\n加率(%)", headerWidth: 60, dataCode: "freightIncreaseRate", hAlign: "right", dataType: "Number",validator:"number"},//,decimalField:"glj.unitPrice"
  46. {headerName: "加权\n系数", headerWidth: 60, dataCode: "weightCoe", hAlign: "right", dataType: "Number",validator:"number"},
  47. {headerName: "计算式", headerWidth: 170, dataCode: "exp", hAlign: "left", dataType: "Number",getText:'forExp'},//,decimalField:"glj.unitPrice"
  48. {headerName: "计算方式", headerWidth: 80, dataCode: "calcType", dataType: "String",cellType:"comboBox",options:["全国","内蒙古"]},
  49. {headerName: "材料类型", headerWidth: 80, dataCode: "materialType", dataType: "String",cellType:"comboBox",options:["地方材料","外购材料","沥青、燃料等"]}
  50. ],
  51. view: {
  52. lockColumns: ["exp"],
  53. colHeaderHeight:36
  54. },
  55. getText:{
  56. forExp:function (item) {
  57. let material = materialCalcObj.getMaterialSelected();
  58. if(item.calcType == "内蒙古"){
  59. let uString = materialCalcObj.getNeiMengUnitFreightString(item.kmDistance,item.materialType);
  60. return `((${uString}x(1+${item.freightIncreaseRate}%)+${item.unitLoadingFee}x${item.loadingTimes})/1.09+${item.otherFee})x${material.grossWeightCoe_n}x${item.weightCoe}`;
  61. }
  62. //(单位运价×(1+运距增加率%)+装卸费单价×装卸次数+其它费用)×单位毛重×加权系数
  63. if(item.conveyance == "自办运输") return `(${item.unitFreight}x(1+${item.freightIncreaseRate}%)+${item.unitLoadingFee}x${item.loadingTimes}+${item.otherFee})x${material.grossWeightCoe_n}x${item.weightCoe}`;
  64. //(单位运价×km运距×(1+运距增加率%)+装卸费单价×装卸次数+其它费用)×单位毛重×加权系数
  65. return `(${item.unitFreight}x${item.kmDistance}x(1+${item.freightIncreaseRate}%)+${item.unitLoadingFee}x${item.loadingTimes}+${item.otherFee})x${material.grossWeightCoe_n}x${item.weightCoe}`;
  66. }
  67. }
  68. },
  69. priceSpread:null,
  70. priceSheet:null,
  71. priceDatas:[],
  72. priceSetting:{
  73. header:[
  74. {headerName: "供应地点", headerWidth: 80, dataCode: "supplyLocation", dataType: "String"},
  75. {headerName: "供应价", headerWidth: 70, dataCode: "supplyPrice", hAlign: "right", dataType: "Number",validator:"number"},
  76. {headerName: "加权系数", headerWidth: 80, dataCode: "coe", hAlign: "right", dataType: "Number",validator:"number"},//,decimalField:'glj.unitPrice'
  77. ],
  78. view: {
  79. lockColumns: [],
  80. colHeaderHeight:36
  81. }
  82. },
  83. freightRationSpread:null,
  84. freightRationSheet:null,
  85. freightRations:[],
  86. priceRations:[],
  87. priceRationSpread:null,
  88. priceRationSheet:null,
  89. rationSetting:{
  90. header:[
  91. {headerName: "编号", headerWidth: 80, dataCode: "code", dataType: "String",formatter: "@"},
  92. {headerName: "名称", headerWidth: 160, dataCode: "name", dataType: "String"},
  93. {headerName: "单位", headerWidth: 100, dataCode: "unit", dataType: "String"},
  94. {headerName: "数量", headerWidth: 100, dataCode: "quantity", dataType: "String",hAlign: "right",validator:"number"},
  95. {headerName: "高原取费类别", headerWidth: 100, dataCode: "feeType", dataType: "String",visible: false,cellType:"comboBox",options:[]}
  96. ],
  97. view: {
  98. lockColumns: ["unit"],
  99. colHeaderHeight:36
  100. }
  101. },
  102. initMaterialSpread:function () {
  103. this.materialSpread = SheetDataHelper.createNewSpread($("#materialCalcSheet")[0]);
  104. sheetCommonObj.spreadDefaultStyle(this.materialSpread);
  105. this.materialSheet = this.materialSpread.getSheet(0);
  106. sheetCommonObj.initSheet(this.materialSheet, this.materialSetting, 30);
  107. this.materialSheet.bind(GC.Spread.Sheets.Events.ValueChanged, this.onMaterialValueChange);
  108. this.materialSheet.bind(GC.Spread.Sheets.Events.SelectionChanged,this.onMaterialSelectionChange);
  109. this.materialSheet.bind(GC.Spread.Sheets.Events.EditStarting,this.onMaterialEditStarting);
  110. this.materialSheet.name('material_calc');
  111. if(projectReadOnly){
  112. disableSpread(this.materialSpread);
  113. }else {
  114. this.initRightClick("materialCalcSheet",this.materialSpread)
  115. }
  116. },
  117. initFreightSpread:async function(){
  118. this.freightSpread = SheetDataHelper.createNewSpread($("#freightSheet")[0]);
  119. sheetCommonObj.spreadDefaultStyle(this.freightSpread);
  120. this.freightSheet = this.freightSpread.getSheet(0);
  121. sheetCommonObj.initSheet(this.freightSheet, this.freightSetting, 30);
  122. this.freightSheet.bind(GC.Spread.Sheets.Events.ValueChanged, this.onFreightValueChange);
  123. this.freightSheet.bind(GC.Spread.Sheets.Events.SelectionChanged,this.onFreightSelectionChange);
  124. this.freightSheet.bind(GC.Spread.Sheets.Events.EditStarting,this.onFreightEditStarting);
  125. this.freightSheet.name('freight_calc');
  126. if(projectReadOnly){
  127. disableSpread(this.freightSpread);
  128. }else {
  129. this.initRightClick("freightSheet",this.freightSpread)
  130. }
  131. this.userFreightList = await projectObj.project.projectGLJ.getUserFreights();
  132. },
  133. initFreightRationSpread:function () {
  134. this.freightRationSpread = SheetDataHelper.createNewSpread($("#freight_ration_sheet")[0]);
  135. sheetCommonObj.spreadDefaultStyle(this.freightRationSpread);
  136. this.freightRationSheet = this.freightRationSpread.getSheet(0);
  137. sheetCommonObj.initSheet(this.freightRationSheet, this.rationSetting, 30);
  138. this.freightRationSheet.bind(GC.Spread.Sheets.Events.ValueChanged, this.onFreightRationValueChange);
  139. this.freightRationSheet.bind(GC.Spread.Sheets.Events.SelectionChanged,this.onRationSelectionChange);
  140. this.freightRationSheet.bind(GC.Spread.Sheets.Events.EditStarting,this.onFreightRationEditStarting);
  141. this.freightRationSheet.name('freight_ration');
  142. if(projectReadOnly){
  143. disableSpread(this.freightRationSpread);
  144. }else {
  145. this.initRightClick("freight_ration_sheet",this.freightRationSpread);
  146. }
  147. },
  148. initPriceRationSpread:function () {
  149. this.priceRationSpread = SheetDataHelper.createNewSpread($("#price_ration_sheet")[0]);
  150. sheetCommonObj.spreadDefaultStyle(this.priceRationSpread);
  151. this.priceRationSheet = this.priceRationSpread.getSheet(0);
  152. sheetCommonObj.initSheet(this.priceRationSheet, this.rationSetting, 30);
  153. this.priceRationSheet.bind(GC.Spread.Sheets.Events.ValueChanged, this.onPriceRationValueChange);
  154. this.priceRationSheet.bind(GC.Spread.Sheets.Events.SelectionChanged,this.onRationSelectionChange);
  155. this.priceRationSheet.bind(GC.Spread.Sheets.Events.EditStarting,this.onPriceRationEditStarting);
  156. this.priceRationSheet.name('price_ration');
  157. if(projectReadOnly){
  158. disableSpread(this.priceRationSpread);
  159. }else {
  160. this.initRightClick("price_ration_sheet",this.priceRationSpread);
  161. }
  162. },
  163. initPriceSpread:async function(){
  164. this.priceSpread = SheetDataHelper.createNewSpread($("#priceSheet")[0]);
  165. sheetCommonObj.spreadDefaultStyle(this.priceSpread);
  166. this.priceSheet = this.priceSpread.getSheet(0);
  167. sheetCommonObj.initSheet(this.priceSheet, this.priceSetting, 30);
  168. this.priceSheet.bind(GC.Spread.Sheets.Events.ValueChanged, this.onPriceValueChange);
  169. this.priceSheet.bind(GC.Spread.Sheets.Events.SelectionChanged,this.onPriceSelectionChange);
  170. this.priceSheet.bind(GC.Spread.Sheets.Events.EditStarting,this.onPriceEditStarting);
  171. this.priceSheet.name('price_calc');
  172. if(projectReadOnly){
  173. disableSpread(this.priceSpread);
  174. }else {
  175. this.initRightClick("priceSheet",this.priceSpread)
  176. }
  177. },
  178. showFreightDatas:function () {
  179. if(!$('#freightSheet').is(':visible')) return;
  180. let sel = this.freightSheet.getSelections()[0];
  181. let oldData = sel.row<this.freightDatas.length?this.freightDatas[sel.row]:"";
  182. this.freightSheet.setRowCount(0);
  183. this.freightDatas = this.getFreightDatas();
  184. sheetCommonObj.showData(this.freightSheet, this.freightSetting,this.freightDatas);
  185. this.freightSheet.setRowCount(this.freightDatas+20);
  186. let convCol = _.findIndex(this.freightSetting.header,{'dataCode':'conveyance'});
  187. sheetCommonObj.setComboBox(-1,convCol,this.freightSheet,this.conveyanceOptions,false);
  188. let startCol = _.findIndex(this.freightSetting.header,{'dataCode':'start'});
  189. let startOptions = this.getUserFreightOptions();
  190. sheetCommonObj.setComboBox(-1,startCol,this.freightSheet,startOptions,false,true);
  191. sel.row = oldData?_.findIndex(this.freightDatas,{'ID':oldData.ID}):sel.row ;
  192. this.freightSheet.setSelection(sel.row==-1?0:sel.row,sel.col,sel.rowCount,sel.colCount);
  193. this.refreshRationView();
  194. },
  195. getUserFreightOptions :function () {
  196. let options = [];
  197. for(let uf of this.userFreightList){
  198. options.push(uf.freight.start);
  199. }
  200. return options;
  201. },
  202. showFreightRationDatas:function (freight) {
  203. let sel = this.freightRationSheet.getSelections()[0];
  204. let oldData = sel.row<this.freightRations.length?this.freightRations[sel.row]:"";
  205. this.freightRationSheet.setRowCount(0);
  206. this.freightRations = freight.rations?freight.rations:[];
  207. sheetCommonObj.showData(this.freightRationSheet, this.rationSetting,this.freightRations);
  208. this.freightRationSheet.setRowCount(this.freightRations+20);
  209. sel.row = oldData?_.findIndex(this.freightRations,{'ID':oldData.ID}):sel.row ;
  210. this.freightRationSheet.setSelection(sel.row==-1?0:sel.row,sel.col,sel.rowCount,sel.colCount);
  211. this.refreshAssView();
  212. },
  213. showPriceRationDatas:function () {
  214. let price = this.getSelectedPrice();
  215. let sel = this.priceRationSheet.getSelections()[0];
  216. let oldData = sel.row<this.priceRations.length?this.priceRations[sel.row]:"";
  217. this.priceRationSheet.setRowCount(0);
  218. this.priceRations = price&&price.rations?price.rations:[];
  219. sheetCommonObj.showData(this.priceRationSheet, this.rationSetting,this.priceRations);
  220. this.priceRationSheet.setRowCount(this.priceRations+20);
  221. sel.row = oldData?_.findIndex(this.priceRations,{'ID':oldData.ID}):sel.row ;
  222. this.priceRationSheet.setSelection(sel.row==-1?0:sel.row,sel.col,sel.rowCount,sel.colCount);
  223. this.refreshAssView();
  224. },
  225. showMaterialCalcDatas:function(){
  226. let sel = this.materialSheet.getSelections()[0];
  227. let oldData = sel.row<this.materialDatas.length?this.materialDatas[sel.row]:"";
  228. this.materialSheet.setRowCount(0);
  229. this.materialDatas = this.getMaterialCalcDatas();
  230. sheetCommonObj.showData(this.materialSheet, this.materialSetting,this.materialDatas);
  231. this.materialSheet.setRowCount(this.materialDatas.length);
  232. sel.row = oldData?_.findIndex(this.materialDatas,{'id':oldData.id}):-1;
  233. this.materialSheet.setSelection(sel.row==-1?0:sel.row,sel.col,sel.rowCount,sel.colCount);
  234. },
  235. showPriceDatas:function () {
  236. if(!$('#priceSheet').is(':visible')) return;
  237. let sel = this.priceSheet.getSelections()[0];
  238. let oldData = sel.row<this.priceDatas.length?this.priceDatas[sel.row]:"";
  239. this.priceSheet.setRowCount(0);
  240. this.priceDatas = this.getPriceDatas();
  241. sheetCommonObj.showData(this.priceSheet, this.priceSetting,this.priceDatas);
  242. this.priceSheet.setRowCount(this.priceDatas.length+20);
  243. sel.row = oldData?_.findIndex(this.priceDatas,{'ID':oldData.ID}):sel.row ;
  244. this.priceSheet.setSelection(sel.row==-1?0:sel.row,sel.col,sel.rowCount,sel.colCount);
  245. this.showPriceRationDatas();
  246. },
  247. showDatas:async function(){
  248. if(!$('#materialCalcSheet').is(':visible')) return;
  249. if(!this.materialSpread) this.initMaterialSpread();
  250. if(!this.freightSpread)await this.initFreightSpread();
  251. if(!this.priceSpread) this.initPriceSpread();
  252. if(!this.freightRationSpread) this.initFreightRationSpread();
  253. if(!this.priceRationSpread) this.initPriceRationSpread();
  254. let h =_.find(this.rationSetting.header,{"dataCode":"feeType"});
  255. if(h) h.options = projectObj.project.calcProgram.compiledTemplateNames;
  256. this.showMaterialCalcDatas();
  257. this.showFreightDatas();
  258. this.showPriceDatas();
  259. // 先试试看注释有没有bug projectGljObject.refreshSubViews();
  260. },
  261. getMaterialSelected:function () {
  262. let sel = this.materialSheet.getSelections()[0];
  263. if(sel.row != -1 && this.materialDatas.length>sel.row){
  264. return this.materialDatas[sel.row]
  265. }
  266. return null;
  267. },
  268. getPriceDatas:function () {
  269. let list = projectObj.project.projectGLJ.datas.originalList;
  270. let material = this.getMaterialSelected();
  271. return material?_.filter(list,{"connect_key":gljUtil.getIndex(material)}):[];
  272. },
  273. getFreightDatas:function () {
  274. let list = projectObj.project.projectGLJ.datas.freightList;
  275. let material = this.getMaterialSelected();
  276. return material?_.filter(list,{"connect_key":gljUtil.getIndex(material)}):[];
  277. },
  278. getMaterialCalcDatas:function () {
  279. let gljList = projectObj.project.projectGLJ.datas.gljList;
  280. let datas = [];
  281. for(let g of gljList){
  282. if(g.quantity !== 0 && g.quantity !== '0' && g.unit_price.calcMaterial == 1){
  283. let data = {
  284. id:g.id,
  285. code:g.code,
  286. name:g.name,
  287. type:g.type,
  288. unit:g.unit,
  289. specs:g.specs,
  290. unit_price:{id:g.unit_price.id,type:g.type,unit_price_file_id:g.unit_price.unit_price_file_id},//type用来排序
  291. supplyLocation:g.unit_price.supplyLocation,
  292. originalPrice:g.unit_price.originalPrice?g.unit_price.originalPrice:0,
  293. unitFreight:g.unit_price.unitFreight?g.unit_price.unitFreight:0,
  294. // unitWeight:g.unit_price.unitWeight?g.unit_price.unitWeight:0,
  295. totalLoadingTimes:g.unit_price.totalLoadingTimes?g.unit_price.totalLoadingTimes:0,
  296. handlingLossRate_n:g.unit_price.handlingLossRate_n?g.unit_price.handlingLossRate_n:0,
  297. offSiteTransportLossRate_n:g.unit_price.offSiteTransportLossRate_n?g.unit_price.offSiteTransportLossRate_n:0,
  298. offSiteTransportLoss:g.unit_price.offSiteTransportLoss?g.unit_price.offSiteTransportLoss:0,
  299. purchaseStorageRate_n:g.unit_price.purchaseStorageRate_n?g.unit_price.purchaseStorageRate_n:0,
  300. purchaseStorage:g.unit_price.purchaseStorage?g.unit_price.purchaseStorage:0,
  301. grossWeightCoe_n:g.unit_price.grossWeightCoe_n?g.unit_price.grossWeightCoe_n:0,
  302. packageRecoverValue:g.unit_price.packageRecoverValue?g.unit_price.packageRecoverValue:0
  303. };
  304. gljOprObj.setGLJPrice(data,g);
  305. datas.push(data);
  306. }
  307. }
  308. return gljUtil.sortProjectGLJ(datas);
  309. },
  310. onMaterialSelectionChange:function(sender,args){
  311. let me = materialCalcObj;
  312. let newSel = args.newSelections[0];
  313. let oldSel = args.oldSelections?args.oldSelections[0]:{};
  314. if(newSel.row != oldSel.row){
  315. me.showPriceDatas();
  316. me.showFreightDatas();
  317. }
  318. },
  319. onFreightSelectionChange:function (sender,args) {
  320. materialCalcObj.refreshRationView();
  321. args.sheet.repaint();
  322. },
  323. onRationSelectionChange:function(sender,args){
  324. materialCalcObj.refreshAssView(args);
  325. args.sheet.repaint();
  326. },
  327. onPriceSelectionChange:function (sender,args) {
  328. materialCalcObj.showPriceRationDatas();
  329. },
  330. onPriceEditStarting:function (sender,args) {
  331. let me = materialCalcObj;
  332. if(!me.getMaterialSelected()){
  333. args.cancel = true;
  334. }
  335. },
  336. onFreightEditStarting:function(sender,args){
  337. let me = materialCalcObj;
  338. if(!me.getMaterialSelected()){
  339. args.cancel = true;
  340. }else {
  341. let freigth = me.freightDatas[args.row];
  342. let dataCode = me.freightSetting.header[args.col].dataCode;
  343. if(dataCode == "calcType" || dataCode=="materialType"){
  344. if(!freigth){
  345. args.cancel = true;
  346. }else if(dataCode == "materialType" && freigth.calcType !="内蒙古"){//不是内蒙古的情况下,下拉框不可编辑
  347. args.cancel = true;
  348. }
  349. }
  350. if(freigth){
  351. if(dataCode == "kmDistance" || dataCode=="unitLoadingFee" || dataCode =="loadingTimes" || dataCode == "freightIncreaseRate"){
  352. if(freigth.conveyance == "自办运输") args.cancel = true;
  353. }
  354. if(dataCode == "unitFreight"){
  355. if(freigth.rations && freigth.rations.length > 0) args.cancel = true;
  356. if(freigth.calcType == "内蒙古") args.cancel = true;
  357. }
  358. }
  359. }
  360. },
  361. onFreightRationEditStarting:function (sender,args) {
  362. materialCalcObj.onRationEditStarting(sender,args,"freight");
  363. },
  364. onPriceRationEditStarting:function (sender,args) {
  365. materialCalcObj.onRationEditStarting(sender,args,"price");
  366. },
  367. onRationEditStarting:function(sender,args,type){
  368. let me = materialCalcObj;
  369. let dataCode = me.rationSetting.header[args.col].dataCode;
  370. let datas = type == "freight"?me.freightRations:me.priceRations;
  371. if(args.row > datas.length){
  372. args.cancel = true;
  373. }else if(args.row == datas.length && dataCode != "code"){
  374. args.cancel = true;
  375. }
  376. },
  377. onMaterialEditStarting:function (sender,args) {
  378. let me = materialCalcObj;
  379. let dataCode = me.materialSetting.header[args.col].dataCode;
  380. if(dataCode == "supplyLocation" ||dataCode == "originalPrice"){//原价计算表有数据时只读,
  381. args.cancel = me.getPriceDatas().length > 0;
  382. }
  383. if(dataCode == "unitFreight"){//当运费计算表有数据时,则只读
  384. args.cancel = me.getFreightDatas().length > 0;
  385. }
  386. },
  387. onMaterialValueChange:function (sender,args) {
  388. let me = materialCalcObj;
  389. let dataCode = me.materialSetting.header[args.col].dataCode;
  390. let value = args.newValue;
  391. if (value&&!sheetCommonObj.checkData(args.col,me.materialSetting,value)) {
  392. alert('输入的数据类型不对,请重新输入!');
  393. me.showDatas();
  394. return;
  395. }
  396. if(dataCode != 'supplyLocation'){
  397. value = value?scMathUtil.roundForObj(value,getDecimal("glj.unitPrice"))+'':'0'//4舍五入加默认为0
  398. }
  399. let recode = me.materialDatas[args.row];
  400. if(recode[dataCode] == value) return;
  401. let doc = {};
  402. doc[dataCode] = value;
  403. projectObj.project.projectGLJ.updateMaterialCalc([{id:recode.id,doc:doc}]);
  404. },
  405. getDefualtCalcType:function () {
  406. return "全国";
  407. },
  408. getNewFreightData:function (material) {
  409. let newData = {
  410. ID: uuid.v1(),
  411. start:"",//起讫地点
  412. conveyance:"汽车",//运输工具
  413. unitFreight:'0',//单位运价
  414. kmDistance:'0',//km运距
  415. unitLoadingFee:'0',//装卸费单价
  416. loadingTimes:'0',//装卸次数
  417. otherFee:'0',//其它费用
  418. freightIncreaseRate:'0',//运价增加率
  419. weightCoe:'1',//加权系数
  420. connect_key:gljUtil.getIndex(material),
  421. unit_price_file_id:material.unit_price.unit_price_file_id
  422. }
  423. return newData;
  424. },
  425. onFreightValueChange:function (sender,args) {
  426. let me = materialCalcObj;
  427. let dataCode = me.freightSetting.header[args.col].dataCode;
  428. let value = args.newValue;
  429. let material = me.getMaterialSelected();
  430. if (value&&!sheetCommonObj.checkData(args.col,me.freightSetting,value)) {
  431. alert('输入的数据类型不对,请重新输入!');
  432. me.showDatas();
  433. return;
  434. }
  435. if(dataCode != 'start'&&dataCode != 'conveyance'&&dataCode != 'calcType'&&dataCode != 'materialType'){
  436. value = value?scMathUtil.roundForObj(value,getDecimal("glj.unitPrice"))+'':'0'//4舍五入加默认为0
  437. }
  438. if(args.row >= me.freightDatas.length){//新增
  439. let newData = me.getNewFreightData(material);
  440. newData[dataCode] = value;
  441. newData.calcType = me.getDefualtCalcType();
  442. if(newData.calcType == "内蒙古") newData.materialType = "地方材料";
  443. projectObj.project.projectGLJ.addFreightCalc([newData],material.id);
  444. }else {//修改
  445. let recode = me.freightDatas[args.row];
  446. if(recode[dataCode] == value) return;
  447. let doc = {};
  448. doc[dataCode] = value;
  449. if(dataCode == "conveyance"){//如果运输方式从自办运输切换成其它的东西时,要把底下挂的定额和定额工料机都清空
  450. if(args.oldValue == "自办运输"){
  451. doc["rations"] = [];
  452. doc["ration_gljs"] = [];
  453. }
  454. if(value == "自办运输"){//当运输工具下拉选择“自办运输”时,“Km运距”、“装卸费单价”、“装卸次数”、“运价增加率(%)”列数据归0,且灰选不可编辑
  455. doc["kmDistance"] = '0';
  456. doc["unitLoadingFee"] ='0';
  457. doc["loadingTimes"] = '0';
  458. doc["freightIncreaseRate"] = '0';
  459. }
  460. }
  461. if(dataCode == "calcType"){
  462. if(value == "全国") doc["materialType"] = "";
  463. if(value == "内蒙古"){
  464. doc["materialType"] = "地方材料";
  465. doc["unitFreight"] = me.calcNeiMengUnitFreight(recode.kmDistance,"地方材料");
  466. }
  467. }
  468. if(recode.calcType == "内蒙古"){
  469. if(dataCode == "materialType") doc["unitFreight"] = me.calcNeiMengUnitFreight(recode.kmDistance,value);
  470. if(dataCode == "kmDistance") doc["unitFreight"] = me.calcNeiMengUnitFreight(value,recode.materialType);
  471. }
  472. projectObj.project.projectGLJ.updateFreightCalc([{ID:recode.ID,doc:doc}],material.id);
  473. }
  474. },
  475. calcNeiMengUnitFreight:function (tkmDistance,tmaterialType) {
  476. if(!tkmDistance||tkmDistance == '0') return "0";
  477. let decimal = getDecimal("glj.unitPrice");
  478. tkmDistance = scMathUtil.roundForObj(tkmDistance,decimal);
  479. return scMathUtil.roundForObj(this.calNeiMengTotalFreight(tkmDistance,tmaterialType)/tkmDistance,decimal);
  480. },
  481. calNeiMengTotalFreight:function (kmDistance,materialType) {
  482. if(!kmDistance||kmDistance == '0') return 0;
  483. let decimal = getDecimal("glj.unitPrice");
  484. let baseMap = {"地方材料":6,"外购材料":13,"沥青、燃料等":19};//"地方材料","外购材料","沥青、燃料等"
  485. let baseFreight = baseMap[materialType];
  486. kmDistance = scMathUtil.roundForObj(kmDistance,decimal);
  487. //用截取的方式,一段段取值
  488. let less = kmDistance - 5;//kmDistance <= 5 这段
  489. if(less <= 0) return baseFreight ; //kmDistance <= 5 的时候直接取baseFreight
  490. //5< kmDistance <= 15 每增运1km 则增加0.6
  491. less = less - 10;
  492. if(less <=0) return scMathUtil.roundForObj(baseFreight + scMathUtil.roundForObj((less + 10) * 0.6,6),decimal);//baseFreight + (less + 10) * 0.6;
  493. baseFreight = baseFreight + 10 * 0.6; //累加5到15这一段的运费;
  494. //15< kmDistance <= 100 每增运1km 则增加0.45
  495. less = less - 85;
  496. if(less <=0) return scMathUtil.roundForObj(baseFreight + scMathUtil.roundForObj((less + 85)*0.45,6),decimal);//baseFreight + (less + 85)*0.45;
  497. baseFreight = scMathUtil.roundForObj(baseFreight + scMathUtil.roundForObj(85*0.45,6),6) ; //累加15到100这一段的运费;
  498. return scMathUtil.roundForObj(baseFreight + scMathUtil.roundForObj(less * 0.35,6),decimal); // >100 的所有部分每增运1km 则增加0.35 baseFreight + less * 0.35
  499. },
  500. getNeiMengUnitFreightString:function (kmDistance,materialType) {
  501. if(!kmDistance||kmDistance == '0') return "0";
  502. let decimal = getDecimal("glj.unitPrice");
  503. let baseMap = {"地方材料":6,"外购材料":13,"沥青、燃料等":19};//"地方材料","外购材料","沥青、燃料等"
  504. let baseFreight = baseMap[materialType];
  505. kmDistance = scMathUtil.roundForObj(kmDistance,decimal);
  506. let resultString = baseFreight+"";
  507. //用截取的方式,一段段取值
  508. let less = kmDistance - 5;//kmDistance <= 5 这段
  509. if(less <= 0) return resultString ; //kmDistance <= 5 的时候直接取baseFreight
  510. //5< kmDistance <= 15 每增运1km 则增加0.6
  511. less = less - 10;
  512. if(less <=0) return `(${resultString}+0.6x${less + 10})`;//baseFreight + (less + 10) * 0.6;
  513. resultString = `${resultString}+0.6x10`;
  514. //15< kmDistance <= 100 每增运1km 则增加0.45
  515. less = less - 85;
  516. if(less <=0) return `(${resultString}+0.45x${less + 85})`; //baseFreight + (less + 85)*0.45;
  517. resultString = `${resultString}+0.45x85`;
  518. return `(${resultString}+0.35x${less})`;// >100 的所有部分每增运1km 则增加0.35 baseFreight + less * 0.35
  519. },
  520. onFreightRationValueChange:function (sender,args) {
  521. materialCalcObj.onRationValueChange(sender,args,"freight");
  522. },
  523. onPriceRationValueChange:function (sender,args) {
  524. materialCalcObj.onRationValueChange(sender,args,"price");
  525. },
  526. onRationValueChange:function (sender,args,type) {
  527. let me = materialCalcObj;
  528. let dataCode = me.rationSetting.header[args.col].dataCode;
  529. let value = args.newValue;
  530. let parent = type == "freight"? me.getSelectedFreight():me.getSelectedPrice();
  531. let dataList = type == "freight"?me.freightRations:me.priceRations;
  532. if(dataCode == "code" && args.row >= dataList.length) {//新增
  533. if(parent) projectObj.project.projectGLJ.addMaterialRation(value,type,parent.ID,parent.connect_key);
  534. }else { //修改
  535. let ration = dataList[args.row];
  536. if (value&&!sheetCommonObj.checkData(args.col,me.rationSetting,value)) {
  537. alert('输入的数据类型不对,请重新输入!');
  538. return type == "freight"?me.showFreightRationDatas(parent):me.showPriceRationDatas();
  539. }
  540. if(dataCode == 'quantity'){
  541. if(value){
  542. value = scMathUtil.roundForObj(parseFloat(value) / FilterNumberFromUnit(ration.unit),getDecimal("ration.quantity"))+"";
  543. }else {
  544. value = "0";
  545. }
  546. }
  547. let datas = {parentID:parent.ID,rationID:ration.ID,type:type,actionType:"update",field:dataCode,value:value};
  548. if(dataCode == "code"){ //这时是替换,替换比较麻烦
  549. datas.code = value;
  550. datas.row = args.row;
  551. let libIDs = rationLibObj.getStdRationLibIDs();
  552. let defaultLibID = rationLibObj.getDefaultStdRationLibID();
  553. let selectedLib = sessionStorage.getItem("stdRationLib");
  554. selectedLib&&selectedLib!='undefined'?libIDs.unshift(selectedLib):libIDs.unshift(defaultLibID);
  555. datas.userID = userID;
  556. datas.defaultLibID = defaultLibID;
  557. datas.rationRepIds = libIDs;
  558. datas.quantityDecimal = getDecimal("ration.quantity");
  559. datas.connect_key = parent.connect_key;
  560. datas.projectID = projectObj.project.ID();
  561. datas.rations = parent.rations;
  562. datas.ration_gljs = parent.ration_gljs;
  563. }
  564. projectObj.project.projectGLJ.updateMaterialRation(datas);
  565. }
  566. },
  567. onPriceValueChange:function(sender,args){
  568. let me = materialCalcObj;
  569. let dataCode = me.priceSetting.header[args.col].dataCode;
  570. let value = args.newValue;
  571. let material = me.getMaterialSelected();
  572. //输入有效性判断, to do
  573. if (value&&!sheetCommonObj.checkData(args.col,me.priceSetting,value)) {
  574. alert('输入的数据类型不对,请重新输入!');
  575. me.showDatas();
  576. return;
  577. }
  578. if(dataCode == 'coe'||dataCode == 'supplyPrice'){
  579. value = value?scMathUtil.roundForObj(value,getDecimal("glj.unitPrice"))+'':'0'//4舍五入加默认为0
  580. }
  581. if(args.row >= me.priceDatas.length){//新增
  582. let newData = {
  583. ID:uuid.v1(),
  584. supplyLocation:"",
  585. supplyPrice:'0',
  586. coe:'1',
  587. connect_key:gljUtil.getIndex(material),
  588. unit_price_file_id:material.unit_price.unit_price_file_id
  589. };
  590. newData[dataCode] = value;
  591. projectObj.project.projectGLJ.addPriceCalc([newData],material.id);
  592. }else {//修改
  593. let recode = me.priceDatas[args.row];
  594. if(recode[dataCode] == value) return;
  595. let doc = {};
  596. doc[dataCode] = value;
  597. projectObj.project.projectGLJ.updatePriceCalc([{ID:recode.ID,doc:doc}],material.id);
  598. }
  599. },
  600. deleteMaterialCal:function (row) {
  601. let record = this.materialDatas[row];//修改材料计算标记的同时还要删除原价计算,运费计算等
  602. if(record){
  603. projectObj.project.projectGLJ.updateCalcMaterial(record,'calcMaterial',0);
  604. }
  605. },
  606. deletePriceCalc:function (row) {
  607. let record = this.priceDatas[row];
  608. if(record){
  609. let material = this.getMaterialSelected();
  610. projectObj.project.projectGLJ.deletePriceCalc(record.ID,material.id);
  611. }
  612. },
  613. deleteFreightCalc:function (row) {
  614. let record = this.freightDatas[row];
  615. if(record){
  616. let material = this.getMaterialSelected();
  617. projectObj.project.projectGLJ.deleteFreightCalc(record.ID,material.id);
  618. }
  619. },
  620. deleteRation:function (row,type) {
  621. let me = this;
  622. let parent = type == "freight"?me.getSelectedFreight():me.getSelectedPrice();
  623. let ration = type == "freight"?me.freightRations[row]:me.priceRations[row];
  624. let datas = {parentID:parent.ID,rationID:ration.ID,type:type,actionType:"delete"};
  625. projectObj.project.projectGLJ.updateMaterialRation(datas);
  626. },
  627. saveFreight:function (row) {
  628. let record = this.freightDatas[row];
  629. if(record){
  630. console.log(record);
  631. //to do 检查是否已经存在,存在给出是否覆盖提示
  632. let user_freight = {rootProjectID:projectObj.project.projectInfo.property.rootProjectID};
  633. let f = {};
  634. for(let key in record){
  635. f[key] = record[key];
  636. if(key =="ration" || key == "ration_gljs")f[key] = [];//下面的定额和工料机不用保存
  637. }
  638. user_freight.freight = f;
  639. projectObj.project.projectGLJ.updateUserFreight({freights:[user_freight],action:"add"});
  640. }
  641. },
  642. getSideResize: function () {
  643. let rg_sideResizeEles = {};
  644. rg_sideResizeEles.eleObj = {
  645. module: this.moduleName,
  646. resize: $('#mrResize'),
  647. parent: $('#projectGljBottom'),
  648. left: $('#materialCalcSheet'),
  649. right: $('#calcDiv')
  650. };
  651. rg_sideResizeEles.limit = {
  652. min: 100,
  653. max: `$('#projectGljBottom').width()-100`
  654. };
  655. return rg_sideResizeEles;
  656. },
  657. initRightClick:function (id,spread) {
  658. let me = this;
  659. $.contextMenu({
  660. selector: '#'+id,
  661. build: function ($trigger, e) {
  662. me.rightClickTarget = SheetDataHelper.safeRightClickSelection($trigger, e, spread);
  663. return me.rightClickTarget.hitTestType === GC.Spread.Sheets.SheetArea.viewport ||
  664. me.rightClickTarget.hitTestType === GC.Spread.Sheets.SheetArea.rowHeader;
  665. },
  666. items: {
  667. "insertFreight":{
  668. name: "内蒙古计算",
  669. icon: 'fa-sign-in',
  670. visible:function () {
  671. return id == "freightSheet";
  672. },
  673. disabled: function (){
  674. let material = me.getMaterialSelected();
  675. return !material;
  676. },
  677. callback:function () {
  678. $("#insertNeimengDiv").modal("show");
  679. }
  680. },
  681. "saveFreight":{
  682. name: "保存运输起讫地点",
  683. icon: 'fa-sign-in',
  684. visible:function () {
  685. return id == "freightSheet";
  686. },
  687. disabled: function (){
  688. if(id == "freightSheet") return me.rightClickTarget.row >= me.freightDatas.length;
  689. return me.rightClickTarget.row === undefined;
  690. },
  691. callback:function () {
  692. let row = me.rightClickTarget.row;
  693. me.saveFreight(row);
  694. }
  695. },
  696. "delete": {
  697. name: "删除",
  698. icon: 'fa-trash-o',
  699. disabled: function () {
  700. if(id == "priceSheet") return me.rightClickTarget.row >= me.priceDatas.length;
  701. if(id == "freightSheet") return me.rightClickTarget.row >= me.freightDatas.length;
  702. if(id == "freight_ration_sheet") return me.rightClickTarget.row >= me.freightRations.length;
  703. if(id == "price_ration_sheet") return me.rightClickTarget.row >= me.priceRations.length;
  704. return me.rightClickTarget.row === undefined;
  705. },
  706. callback: function (key, opt) {
  707. let row = me.rightClickTarget.row;
  708. if (id == "materialCalcSheet") me.deleteMaterialCal(row);
  709. if (id == "priceSheet") me.deletePriceCalc(row);
  710. if (id == "freightSheet") me.deleteFreightCalc(row);
  711. if (id == "freight_ration_sheet") me.deleteRation(row,"freight");
  712. if (id == "price_ration_sheet") me.deleteRation(row,"price");
  713. }
  714. }
  715. }
  716. });
  717. },
  718. initTabWidth:function () {
  719. if($("#mix_ratio_sheet").is(':visible')) return ;//如果是组成物计算界面,返回
  720. let mr_sideResizeEles = this.getSideResize();
  721. SlideResize.loadHorizonWidth(mr_sideResizeEles.eleObj.module,
  722. [mr_sideResizeEles.eleObj.resize], [mr_sideResizeEles.eleObj.left, mr_sideResizeEles.eleObj.right],null,2);
  723. $("#spreadTabDiv").width( $('#calcDiv').width() - mr_sideResizeEles.eleObj.resize.width() - 32)
  724. },
  725. refreshRationView:function () {
  726. let freight = this.getSelectedFreight();
  727. let hide = true;
  728. let stats = $("#freight_ration").is(':visible');
  729. if(freight && freight.conveyance == "自办运输"){
  730. this.showFreightRationDatas(freight);
  731. $("#freightSheet").css("height","50%");
  732. $("#freight_ration").show();
  733. hide = false;
  734. }
  735. if(hide){
  736. $("#freightSheet").css("height","100%");
  737. $("#freight_ration").hide();
  738. }
  739. if(stats != $("#freight_ration").is(':visible')){//状态改变了才刷新
  740. this.freightSpread.refresh();
  741. this.freightRationSpread.refresh();
  742. }
  743. },
  744. refreshAssView:function () {
  745. let me = materialCalcObj;
  746. let sheet = $('#freightSheet').is(':visible')?me.freightRationSheet:me.priceRationSheet;
  747. let preString = $('#freightSheet').is(':visible')?"freight":"price";
  748. let show = false;
  749. let ass = null;
  750. let ration = me.getSelectedRation();
  751. let stats = $(`#${preString}_ration_ass`).is(':visible');
  752. if(ration && ration.rationAssList){
  753. for(let r of ration.rationAssList){
  754. if(r.name == "运距m"){//辅助定额只处理运距的情况,其它的都忽略
  755. show = true;
  756. ass = r;
  757. }
  758. }
  759. }
  760. if(show){
  761. $(`#${preString}_ration_sheet`).addClass("material-ration-left");
  762. $(`#${preString}_ration_ass`).addClass("material-ass");
  763. $(`#${preString}_ass_value`).val(ass.actualValue);
  764. $(`#${preString}_ration_ass`).show();
  765. }else {
  766. $(`#${preString}_ration_sheet`).removeClass("material-ration-left");
  767. $(`#${preString}_ration_ass`).removeClass("material-ass");
  768. $(`#${preString}_ration_ass`).hide();
  769. }
  770. if(stats != $(`#${preString}_ration_ass`).is(':visible')) sheet.parent.refresh();//状态改变了才刷新
  771. },
  772. updateMaterialRationAss:function (value,ele) {//to do 同步修改定额工料机的消耗量
  773. let parent = this.getSelectedRationParent(),ration = this.getSelectedRation();
  774. let replaceList = [];
  775. if(value && !number_util.isNum(value)){
  776. alert("输入的数据类型不对,请重新输入!");
  777. let a = _.find(ration.rationAssList,{'name':"运距m"});
  778. if(a)ele.val(a.actualValue);
  779. }
  780. for(let ass of ration.rationAssList){
  781. if(ass.name == "运距m"){
  782. ass.actualValue = value?scMathUtil.roundForObj(value,2):ass.stdValue;
  783. }
  784. replaceList.push(value);
  785. }
  786. let name = ration.caption;
  787. for(let re of replaceList){
  788. name = name.replace('%s',re);
  789. }
  790. let type = $('#freightSheet').is(':visible')?"freight":"price";
  791. //let ration_glj =
  792. let datas = {parentID:parent.ID,rationID:ration.ID,type:type,actionType:"update",field:"name",value:name,ext:{rationAssList:ration.rationAssList}};
  793. let ration_gljs = projectObj.project.projectGLJ.calcMaterialAssQuantity(parent,ration,ration.rationAssList);
  794. if(ration_gljs.length > 0) datas.ration_gljs = ration_gljs;
  795. projectObj.project.projectGLJ.updateMaterialRation(datas);
  796. },
  797. getSelectedRation:function () {
  798. if($('#freightSheet').is(':visible')){
  799. return this.getSelectedRecode(this.freightRationSheet,this.freightRations);
  800. }else {
  801. return this.getSelectedRecode(this.priceRationSheet,this.priceRations);
  802. }
  803. },
  804. getSelectedRationParent:function () {
  805. if($('#freightSheet').is(':visible')){
  806. return this.getSelectedFreight();
  807. }else {
  808. return this.getSelectedRecode(this.priceSheet,this.priceDatas);
  809. }
  810. },
  811. getSelectedFreight:function(){
  812. return this.getSelectedRecode(this.freightSheet,this.freightDatas);
  813. },
  814. getSelectedPrice:function () {
  815. return this.getSelectedRecode(this.priceSheet,this.priceDatas)
  816. },
  817. getSelectedRecode:function (sheet,datas) {
  818. let sel = sheet.getSelections()[0];
  819. let srow = sel.row == -1||sel.row == ""?0:sel.row;
  820. if(gljUtil.isDef(srow) && datas.length>srow){
  821. return datas[srow];
  822. }
  823. return null;
  824. }
  825. };
  826. $(function () {
  827. $("#calc-nav").on('shown.bs.tab', function () {
  828. materialCalcObj.initTabWidth();
  829. projectGljObject.refreshSubViews();
  830. });
  831. $("#calTab ul li a").on('shown.bs.tab', function () {
  832. materialCalcObj.showFreightDatas();
  833. materialCalcObj.showPriceDatas();
  834. projectGljObject.refreshSubViews();
  835. });
  836. $(".ration_ass_value").change(function () {
  837. let me = materialCalcObj;
  838. me.updateMaterialRationAss($(this).val(),$(this));
  839. });
  840. $('#calcCoeDiv').on('show.bs.modal', function () {
  841. $("#assistProductionFeeRate").val(scMathUtil.roundForObj(projectObj.project.projectGLJ.datas.constData.assistProductionFeeRate,getDecimal("feeRate")));
  842. })
  843. $("#calcCoeConfirm").click(function () {
  844. let feeRate = $("#assistProductionFeeRate").val();
  845. if(!number_util.isNum(feeRate)){
  846. alert("输入的数据类型不对,请重新输入!");
  847. return $("#assistProductionFeeRate").val(scMathUtil.roundForObj(projectObj.project.projectGLJ.datas.constData.assistProductionFeeRate,getDecimal("feeRate")));
  848. }
  849. feeRate = scMathUtil.roundForObj(feeRate,getDecimal("feeRate"));
  850. $("#calcCoeDiv").modal("hide");
  851. projectObj.project.projectGLJ.changeAssistProductionFeeRate(feeRate);
  852. });
  853. $("#insertFreightconfirm").click(function () {
  854. let me = materialCalcObj;
  855. let material = me.getMaterialSelected();
  856. let newData = me.getNewFreightData(material);
  857. let start = $("#freight_start").val();
  858. let kmDistance = $("#freight_kmDistance").val();
  859. let materialType = $("#freight_materialType").val();
  860. if(!number_util.isNum(kmDistance)){
  861. alert("运输距离数据类型不对,请重新输入!");
  862. return ;
  863. }
  864. kmDistance = scMathUtil.roundForObj(kmDistance,getDecimal("glj.unitPrice"))+'';
  865. newData.start = start;
  866. newData.kmDistance = kmDistance;
  867. newData.materialType = materialType;
  868. newData.calcType = "内蒙古";
  869. newData.unitFreight = me.calcNeiMengUnitFreight(kmDistance,materialType);
  870. $("#insertNeimengDiv").modal("hide");
  871. projectObj.project.projectGLJ.addFreightCalc([newData],material.id);
  872. })
  873. });
  874. let mr_sideResizeEles = materialCalcObj.getSideResize();
  875. SlideResize.horizontalSlide(mr_sideResizeEles.eleObj, mr_sideResizeEles.limit, function(){
  876. $("#spreadTabDiv").width( $('#calcDiv').width() - mr_sideResizeEles.eleObj.resize.width() - 32);
  877. projectGljObject.refreshSubViews();
  878. },2);