MakePrepare2.js 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  1. Ext.define('erp.view.pm.mes.MakePrepare2',{
  2. extend: 'Ext.Viewport',
  3. layout: 'anchor',
  4. hideBorders: true,
  5. initComponent : function(){
  6. var me = this;
  7. Ext.apply(me, {
  8. items: [{
  9. xtype: 'erpFormPanel',
  10. anchor: '100% 25%',
  11. saveUrl: 'pm/mes/saveMakePrepare2.action',
  12. updateUrl: 'pm/mes/updateMakePrepare2.action',
  13. deleteUrl:'pm/mes/deleteMakePrepare.action',
  14. getIdUrl: 'common/getId.action?seq=MakePrepare_SEQ',
  15. submitUrl: 'pm/mes/submitMakePrepare.action',
  16. resSubmitUrl: 'pm/mes/resSubmitMakePrepare.action',
  17. auditUrl: 'pm/mes/auditMakePrepare.action',
  18. resAuditUrl: 'pm/mes/resAuditMakePrepare.action',
  19. keyField: 'mp_id',
  20. codeField: 'mp_code',
  21. statusField: 'mp_status',
  22. statuscodeField: 'mp_statuscode'
  23. },{
  24. xtype:'tabpanel',
  25. anchor: '100% 55%',
  26. id:"mpTabpanel",
  27. items:[{
  28. anchor: '100% 55%',
  29. xtype: 'erpGridPanel2',
  30. title:'备料任务清单',
  31. id: 'grid',
  32. mainField:'md_mpid',
  33. keyField:'mp_id',
  34. detno:'md_detno',
  35. buffered: true,
  36. sync: true ,
  37. headerCt: Ext.create("Ext.grid.header.Container",{
  38. forceFit: false,
  39. sortable: true,
  40. enableColumnMove:true,
  41. enableColumnResize:true,
  42. enableColumnHide: true
  43. }),
  44. plugins: [Ext.create('erp.view.core.plugin.CopyPasteMenu'),Ext.create('erp.view.core.grid.HeaderFilter'),
  45. Ext.create('Ext.grid.plugin.CellEditing', {
  46. clicksToEdit: 1,
  47. listeners:{
  48. beforeedit:function(e){
  49. var g=e.grid,r=e.record,f=e.field;
  50. if(g.binds){
  51. var bool=true;
  52. Ext.Array.each(g.binds,function(item){
  53. if(Ext.Array.contains(item.fields,f)){
  54. Ext.each(item.refFields,function(field){
  55. if(r.get(field)!=null && r.get(field)!=0 && r.get(field)!='' && r.get(field)!='0'){
  56. bool=false;
  57. }
  58. });
  59. }
  60. });
  61. return bool;
  62. }
  63. }
  64. }
  65. })],
  66. invalidateScrollerOnRefresh: false,
  67. listeners: {
  68. 'headerfiltersapply': function(grid, filters) {
  69. if(this.allowFilter){
  70. var condition = null;
  71. for(var fn in filters){
  72. var value = filters[fn],f = grid.getHeaderFilterField(fn);
  73. if(!Ext.isEmpty(value)){
  74. if(f.filtertype) {
  75. if (f.filtertype == 'numberfield') {
  76. value = fn + "=" + value + " ";
  77. }
  78. } else {
  79. if(Ext.isDate(value)){
  80. value = Ext.Date.toString(value);
  81. value = "to_char(" + fn + ",'yyyy-MM-dd')='" + value + "' ";
  82. } else {
  83. var exp_t = /^(\d{4})\-(\d{2})\-(\d{2}) (\d{2}):(\d{2}):(\d{2})$/,
  84. exp_d = /^(\d{4})\-(\d{2})\-(\d{2})$/;
  85. if(exp_d.test(value)){
  86. value = "to_char(" + fn + ",'yyyy-MM-dd')='" + value + "' ";
  87. } else if(exp_t.test(value)){
  88. value = "to_char(" + fn + ",'yyyy-MM-dd')='" + value.substr(0, 10) + "' ";
  89. } else{
  90. if (f.xtype == 'combo' || f.xtype == 'combofield') {
  91. if (value == '-所有-') {
  92. continue;
  93. } else if (value == '-无-') {
  94. value = 'nvl(' + fn + ',\' \')=\' \'';
  95. } else {
  96. value = fn + " LIKE '" + value + "%' ";
  97. }
  98. } else {
  99. //**字符串转换下简体*//*
  100. var SimplizedValue=this.BaseUtil.Simplized(value);
  101. //可能就是按繁体筛选
  102. if(f.ignoreCase) {// 忽略大小写
  103. fn = 'upper(' + fn + ')';
  104. value = value.toUpperCase();
  105. }
  106. if(!f.autoDim) {
  107. if(SimplizedValue!=value){
  108. value = "("+fn + " LIKE '" + value + "%' or "+fn+" LIKE '"+SimplizedValue+"%')";
  109. }else value = fn + " LIKE '" + value + "%' ";
  110. } else if(f.exactSearch){
  111. value=fn+"='"+value+"'";
  112. }else {
  113. if(SimplizedValue!=value){
  114. value = "("+fn + " LIKE '%" + value + "%' or "+fn+" LIKE '%"+SimplizedValue+"%')";
  115. }else value = fn + " LIKE '%" + value + "%' ";
  116. }
  117. }
  118. }
  119. }
  120. }
  121. if(condition == null){
  122. condition = value;
  123. } else {
  124. condition = condition + " AND " + value;
  125. }
  126. }
  127. }
  128. this.filterCondition = condition;
  129. var grid=Ext.getCmp('grid');
  130. if(grid.store.data!=grid.store.prefetchData){
  131. grid.store.loadData(grid.store.prefetchData.items);
  132. }
  133. } else {
  134. this.allowFilter = true;
  135. }
  136. return false;
  137. }
  138. },
  139. viewConfig: {
  140. trackOver: false
  141. }
  142. },{
  143. title:'已备料任务清单',
  144. anchor: '100% 55%',
  145. xtype : 'makePrepareGrid',
  146. mainField:'md_mpid',
  147. keyField:'mp_id',
  148. detno:'md_detno',
  149. caller:'makePrepareGrid',
  150. buffered: true,
  151. sync: true,
  152. headerCt: Ext.create("Ext.grid.header.Container",{
  153. forceFit: false,
  154. sortable: true,
  155. enableColumnMove:true,
  156. enableColumnResize:true,
  157. enableColumnHide: true
  158. }),
  159. plugins: [Ext.create('erp.view.core.plugin.CopyPasteMenu'),Ext.create('erp.view.core.grid.HeaderFilter'),
  160. Ext.create('Ext.grid.plugin.CellEditing', {
  161. clicksToEdit: 1,
  162. listeners:{
  163. beforeedit:function(e){
  164. var g=e.grid,r=e.record,f=e.field;
  165. if(g.binds){
  166. var bool=true;
  167. Ext.Array.each(g.binds,function(item){
  168. if(Ext.Array.contains(item.fields,f)){
  169. Ext.each(item.refFields,function(field){
  170. if(r.get(field)!=null && r.get(field)!=0 && r.get(field)!='' && r.get(field)!='0'){
  171. bool=false;
  172. }
  173. });
  174. }
  175. });
  176. return bool;
  177. }
  178. }
  179. }
  180. })],
  181. invalidateScrollerOnRefresh: false,
  182. listeners: {
  183. 'headerfiltersapply': function(grid, filters) {
  184. if(this.allowFilter){
  185. var condition = null;
  186. for(var fn in filters){
  187. var value = filters[fn],f = grid.getHeaderFilterField(fn);
  188. if(!Ext.isEmpty(value)){
  189. if(f.filtertype) {
  190. if (f.filtertype == 'numberfield') {
  191. value = fn + "=" + value + " ";
  192. }
  193. } else {
  194. if(Ext.isDate(value)){
  195. value = Ext.Date.toString(value);
  196. value = "to_char(" + fn + ",'yyyy-MM-dd')='" + value + "' ";
  197. } else {
  198. var exp_t = /^(\d{4})\-(\d{2})\-(\d{2}) (\d{2}):(\d{2}):(\d{2})$/,
  199. exp_d = /^(\d{4})\-(\d{2})\-(\d{2})$/;
  200. if(exp_d.test(value)){
  201. value = "to_char(" + fn + ",'yyyy-MM-dd')='" + value + "' ";
  202. } else if(exp_t.test(value)){
  203. value = "to_char(" + fn + ",'yyyy-MM-dd')='" + value.substr(0, 10) + "' ";
  204. } else{
  205. if (f.xtype == 'combo' || f.xtype == 'combofield') {
  206. if (value == '-所有-') {
  207. continue;
  208. } else if (value == '-无-') {
  209. value = 'nvl(' + fn + ',\' \')=\' \'';
  210. } else {
  211. value = fn + " LIKE '" + value + "%' ";
  212. }
  213. } else {
  214. //**字符串转换下简体*//*
  215. var SimplizedValue=this.BaseUtil.Simplized(value);
  216. //可能就是按繁体筛选
  217. if(f.ignoreCase) {// 忽略大小写
  218. fn = 'upper(' + fn + ')';
  219. value = value.toUpperCase();
  220. }
  221. if(!f.autoDim) {
  222. if(SimplizedValue!=value){
  223. value = "("+fn + " LIKE '" + value + "%' or "+fn+" LIKE '"+SimplizedValue+"%')";
  224. }else value = fn + " LIKE '" + value + "%' ";
  225. } else if(f.exactSearch){
  226. value=fn+"='"+value+"'";
  227. }else {
  228. if(SimplizedValue!=value){
  229. value = "("+fn + " LIKE '%" + value + "%' or "+fn+" LIKE '%"+SimplizedValue+"%')";
  230. }else value = fn + " LIKE '%" + value + "%' ";
  231. }
  232. }
  233. }
  234. }
  235. }
  236. if(condition == null){
  237. condition = value;
  238. } else {
  239. condition = condition + " AND " + value;
  240. }
  241. }
  242. }
  243. this.filterCondition = condition;
  244. var grid=Ext.getCmp('makePrepareGrid');
  245. if(grid.store.data!=grid.store.prefetchData){
  246. grid.store.loadData(grid.store.prefetchData.items);
  247. }
  248. } else {
  249. this.allowFilter = true;
  250. }
  251. return false;
  252. }
  253. },
  254. viewConfig: {
  255. trackOver: false
  256. }
  257. }]
  258. },{
  259. xtype: 'form',
  260. anchor: '100% 20%',
  261. bodyStyle: 'background: #f1f1f1;',
  262. layout: 'border',
  263. items: [{
  264. xtype: 'fieldcontainer',
  265. region: 'center',
  266. autoScroll: true,
  267. scrollable: true,
  268. defaults: {
  269. width: 300
  270. },
  271. items: [{
  272. xtype: 'textfield',
  273. fieldLabel: '操作人员',
  274. readOnly:true,
  275. id:'man',
  276. allowBlank: false,
  277. value: em_name
  278. },{
  279. xtype: 'fieldcontainer',
  280. fieldLabel : '操作',
  281. defaultType: 'radiofield',
  282. layout: 'hbox',
  283. colspan: 2,
  284. defaults: {
  285. flex: 1
  286. },
  287. items: [{
  288. boxLabel : '备料',
  289. inputValue: 'get',
  290. name: 'operator',
  291. id : 'get',
  292. checked: true
  293. }, {
  294. boxLabel : '退回',
  295. inputValue: 'back',
  296. name: 'operator',
  297. id : 'back'
  298. }]
  299. },{
  300. xtype: 'textfield',
  301. fieldLabel: '料卷编号',
  302. readOnly:false,
  303. id:'code',
  304. colspan: 1,
  305. emptyText: '请采集料卷编号',
  306. allowBlank: false
  307. }]
  308. },{
  309. xtype: 'dataview',
  310. region : 'east',
  311. width: 500,
  312. id: 't_result',
  313. store: new Ext.data.Store({
  314. fields: ['type', 'text']
  315. }),
  316. cls: 'msg-body',
  317. tpl: new Ext.XTemplate(
  318. '<audio id="audio-success" src="' + basePath + 'resource/audio/success.wav"></audio>',
  319. '<audio id="audio-error" src="' + basePath + 'resource/audio/error.wav"></audio>',
  320. '<tpl for=".">',
  321. '<div class="msg-item">',
  322. '<tpl if="type == \'success\'"><span class="text-info">{text}</span></tpl>',
  323. '<tpl if="type == \'error\'"><span class="text-warning">{text}</span></tpl>',
  324. '</div>',
  325. '</tpl>'
  326. ),
  327. itemSelector: 'div.msg-item',
  328. emptyText: '提示信息',
  329. deferEmptyText: false,
  330. autoScroll: true,
  331. append: function(text, type) {
  332. type = type || 'success';
  333. this.getStore().add({text: text, type: type});
  334. this.getEl().scroll("b", this.getEl().getHeight(), true);
  335. var el = Ext.get('audio-' + type).dom;
  336. el.play();
  337. }
  338. }],
  339. buttonAlign: 'center',
  340. buttons: [{
  341. xtype: 'button',
  342. id : 'confirm',
  343. text: $I18N.common.button.erpConfirmButton,
  344. cls: 'x-btn-gray',
  345. style: {
  346. marginLeft: '10px'
  347. },
  348. width: 80
  349. }]
  350. }]
  351. });
  352. me.callParent(arguments);
  353. }
  354. });