www/js/prod_edit.js

changeset 649
52053730f6e1
parent 648
ee69b01fcb0e
child 651
6e89cb158153
equal deleted inserted replaced
648:ee69b01fcb0e 649:52053730f6e1
2169 totcells: totcells, 2169 totcells: totcells,
2170 growf: Round(ncells / start, 2) 2170 growf: Round(ncells / start, 2)
2171 }; 2171 };
2172 } 2172 }
2173 2173
2174 function killstep2() {
2175
2176 dataRecord.prop2_volume = 0;
2177 $('#prop2_volume').val(0);
2178 $('#prop2_tcells').val(0);
2179 $('#prop2_type,#prop2_volume,#prop2_irate,#prop2_ncells,#prop2_tcells,#prop2_growf').hide();
2180 $('#r2_pmpt').show();
2181 }
2182
2183 function killstep3() {
2184
2185 dataRecord.prop3_volume = 0;
2186 $('#prop3_volume').val(0);
2187 $('#prop3_tcells').val(0);
2188 $('#prop3_type,#prop3_volume,#prop3_irate,#prop3_ncells,#prop3_tcells,#prop3_growf').hide();
2189 $('#r3_pmpt').show();
2190 }
2191
2192 function killstep4() {
2193
2194 dataRecord.prop4_volume = 0;
2195 $('#prop4_volume').val(0);
2196 $('#prop4_tcells').val(0);
2197 $('#prop4_type,#prop4_volume,#prop4_irate,#prop4_ncells,#prop4_tcells,#prop4_growf').hide();
2198 $('#r4_pmpt').show();
2199 }
2200
2174 /* 2201 /*
2175 * Calculate all starter steps. 2202 * Calculate all starter steps.
2176 * stype: final starter type: 0 = stirred, 1 = shaked, 2 = simple. 2203 * stype: final starter type: 0 = stirred, 1 = shaked, 2 = simple.
2177 * start: initial cells in billions 2204 * start: initial cells in billions
2178 * needed: needed cells in billions 2205 * needed: needed cells in billions
2301 result = calcStep($('#prop1_volume').val() * 1000, dataRecord.prop1_type, start); 2328 result = calcStep($('#prop1_volume').val() * 1000, dataRecord.prop1_type, start);
2302 $('#prop1_irate').val(result.prate); 2329 $('#prop1_irate').val(result.prate);
2303 $('#prop1_ncells').val(result.ncells); 2330 $('#prop1_ncells').val(result.ncells);
2304 $('#prop1_tcells').val(result.totcells); 2331 $('#prop1_tcells').val(result.totcells);
2305 $('#prop1_growf').val(result.growf); 2332 $('#prop1_growf').val(result.growf);
2333 if (result.totcells > needed) {
2334 killstep2();
2335 killstep3();
2336 killstep4();
2337 } else if (dataRecord.prop2_volume == 0) {
2338 dataRecord.prop2_volume = dataRecord.prop1_volume; /* Extra step needed, start with the same size */
2339 dataRecord.prop2_type = dataRecord.prop1_type;
2340 $('#prop2_volume').val(dataRecord.prop2_volume);
2341 $('#prop2_type').val(dataRecord.prop2_type);
2342 }
2306 } 2343 }
2307 if (dataRecord.prop2_volume > 0) { 2344 if (dataRecord.prop2_volume > 0) {
2308 $('#r2_pmpt').hide(); 2345 $('#r2_pmpt').hide();
2309 $('#prop2_type,#prop2_volume,#prop2_irate,#prop2_ncells,#prop2_tcells,#prop2_growf').show(); 2346 $('#prop2_type,#prop2_volume,#prop2_irate,#prop2_ncells,#prop2_tcells,#prop2_growf').show();
2310 result = calcStep($('#prop2_volume').val() * 1000, dataRecord.prop2_type, $('#prop1_tcells').val()); 2347 result = calcStep($('#prop2_volume').val() * 1000, dataRecord.prop2_type, $('#prop1_tcells').val());
2311 $('#prop2_irate').val(result.prate); 2348 $('#prop2_irate').val(result.prate);
2312 $('#prop2_ncells').val(result.ncells); 2349 $('#prop2_ncells').val(result.ncells);
2313 $('#prop2_tcells').val(result.totcells); 2350 $('#prop2_tcells').val(result.totcells);
2314 $('#prop2_growf').val(result.growf); 2351 $('#prop2_growf').val(result.growf);
2352 if (result.totcells > needed) {
2353 killstep3();
2354 killstep4();
2355 } else if (dataRecord.prop3_volume == 0) {
2356 dataRecord.prop3_volume = dataRecord.prop2_volume; /* Extra step needed, start with the same size */
2357 dataRecord.prop3_type = dataRecord.prop2_type;
2358 $('#prop3_volume').val(dataRecord.prop3_volume);
2359 $('#prop3_type').val(dataRecord.prop3_type);
2360 }
2315 } 2361 }
2316 if (dataRecord.prop3_volume > 0) { 2362 if (dataRecord.prop3_volume > 0) {
2317 $('#r3_pmpt').hide(); 2363 $('#r3_pmpt').hide();
2318 $('#prop3_type,#prop3_volume,#prop3_irate,#prop3_ncells,#prop3_tcells,#prop3_growf').show(); 2364 $('#prop3_type,#prop3_volume,#prop3_irate,#prop3_ncells,#prop3_tcells,#prop3_growf').show();
2319 result = calcStep($('#prop3_volume').val() * 1000, dataRecord.prop3_type, $('#prop2_tcells').val()); 2365 result = calcStep($('#prop3_volume').val() * 1000, dataRecord.prop3_type, $('#prop2_tcells').val());
2320 $('#prop3_irate').val(result.prate); 2366 $('#prop3_irate').val(result.prate);
2321 $('#prop3_ncells').val(result.ncells); 2367 $('#prop3_ncells').val(result.ncells);
2322 $('#prop3_tcells').val(result.totcells); 2368 $('#prop3_tcells').val(result.totcells);
2323 $('#prop3_growf').val(result.growf); 2369 $('#prop3_growf').val(result.growf);
2370 if (result.totcells > needed) {
2371 killstep4();
2372 } else if (dataRecord.prop4_volume == 0) {
2373 dataRecord.prop4_volume = dataRecord.prop3_volume; /* Extra step needed, start with the same size */
2374 dataRecord.prop4_type = dataRecord.prop3_type;
2375 $('#prop4_volume').val(dataRecord.prop4_volume);
2376 $('#prop4_type').val(dataRecord.prop4_type);
2377 }
2324 } 2378 }
2325 if (dataRecord.prop4_volume > 0) { 2379 if (dataRecord.prop4_volume > 0) {
2326 $('#r4_pmpt').hide(); 2380 $('#r4_pmpt').hide();
2327 $('#prop4_type,#prop4_volume,#prop4_irate,#prop4_ncells,#prop4_tcells,#prop4_growf').show(); 2381 $('#prop4_type,#prop4_volume,#prop4_irate,#prop4_ncells,#prop4_tcells,#prop4_growf').show();
2328 result = calcStep($('#prop4_volume').val() * 1000, dataRecord.prop4_type, $('#prop3_tcells').val()); 2382 result = calcStep($('#prop4_volume').val() * 1000, dataRecord.prop4_type, $('#prop3_tcells').val());
3697 $('#prop3_volume').val(0); 3751 $('#prop3_volume').val(0);
3698 $('#prop4_volume').val(0); 3752 $('#prop4_volume').val(0);
3699 dataRecord.prop1_volume = dataRecord.prop2_volume = dataRecord.prop3_volume = dataRecord.prop4_volume = 0; 3753 dataRecord.prop1_volume = dataRecord.prop2_volume = dataRecord.prop3_volume = dataRecord.prop4_volume = 0;
3700 calcYeast(); 3754 calcYeast();
3701 }); 3755 });
3702 $('#starter_type').on('select', function(event) { 3756 $('#starter_type').on('change', function(event) {
3703 if (event.args) { 3757 if (event.args) {
3704 dataRecord.starter_type = event.args.index; 3758 dataRecord.starter_type = event.args.index;
3705 calcYeast(); 3759 calcYeast();
3706 } 3760 }
3707 }); 3761 });
3709 if (event.args) { 3763 if (event.args) {
3710 dataRecord.starter_sg = event.args.value; 3764 dataRecord.starter_sg = event.args.value;
3711 calcYeast(); 3765 calcYeast();
3712 } 3766 }
3713 }); 3767 });
3714 $('#prop1_type').on('select', function(event) { 3768 $('#prop1_type').on('change', function(event) {
3715 if (event.args) { 3769 if (event.args) {
3716 dataRecord.prop1_type = event.args.index; 3770 dataRecord.prop1_type = event.args.index;
3717 calcYeast(); 3771 calcYeast();
3718 } 3772 }
3719 }); 3773 });
3721 if (event.args) { 3775 if (event.args) {
3722 dataRecord.prop1_volume = event.args.value; 3776 dataRecord.prop1_volume = event.args.value;
3723 calcYeast(); 3777 calcYeast();
3724 } 3778 }
3725 }); 3779 });
3726 $('#prop2_type').on('select', function(event) { 3780 $('#prop2_type').on('change', function(event) {
3727 if (event.args) { 3781 if (event.args) {
3728 dataRecord.prop2_type = event.args.index; 3782 dataRecord.prop2_type = event.args.index;
3729 calcYeast(); 3783 calcYeast();
3730 } 3784 }
3731 }); 3785 });
3733 if (event.args) { 3787 if (event.args) {
3734 dataRecord.prop2_volume = event.args.value; 3788 dataRecord.prop2_volume = event.args.value;
3735 calcYeast(); 3789 calcYeast();
3736 } 3790 }
3737 }); 3791 });
3738 $('#prop3_type').on('select', function(event) { 3792 $('#prop3_type').on('change', function(event) {
3739 if (event.args) { 3793 if (event.args) {
3740 dataRecord.prop3_type = event.args.index; 3794 dataRecord.prop3_type = event.args.index;
3741 calcYeast(); 3795 calcYeast();
3742 } 3796 }
3743 }); 3797 });
3745 if (event.args) { 3799 if (event.args) {
3746 dataRecord.prop3_volume = event.args.value; 3800 dataRecord.prop3_volume = event.args.value;
3747 calcYeast(); 3801 calcYeast();
3748 } 3802 }
3749 }); 3803 });
3750 $('#prop4_type').on('select', function(event) { 3804 $('#prop4_type').on('change', function(event) {
3751 if (event.args) { 3805 if (event.args) {
3752 dataRecord.prop4_type = event.args.index; 3806 dataRecord.prop4_type = event.args.index;
3753 calcYeast(); 3807 calcYeast();
3754 } 3808 }
3755 }); 3809 });

mercurial