Form.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395
  1. Ext.define('erp.view.scm.reserve.setBarcode.Form',{
  2. extend: 'Ext.form.Panel',
  3. alias: 'widget.erpSetBarcodeFormPanel',
  4. requires: ['Ext.tip.QuickTipManager','erp.view.core.button.Save','erp.view.core.button.GenerateBarcode','erp.view.core.trigger.DbfindTrigger',''],
  5. id: 'setBarcodeform',
  6. region: 'north',
  7. frame : true,
  8. layout : 'column',
  9. title:'条形码维护',
  10. columnWidth:0.33,
  11. padding: '0 4 0 4',
  12. autoScroll : true,
  13. defaultType : 'textfield',
  14. labelSeparator : ':',
  15. buttonAlign : 'center',
  16. fieldDefaults : {
  17. fieldStyle : "background:#FFFAFA;color:#515151;",
  18. labelAlign : "left",
  19. blankText : $I18N.common.form.blankText,
  20. labelWidth: 80
  21. },
  22. FormUtil: Ext.create('erp.util.FormUtil'),
  23. isStatic: true,
  24. initComponent : function(){
  25. Ext.tip.QuickTipManager.init();
  26. var me = this;
  27. Ext.apply(me, {
  28. items : [{
  29. id : 'bi_inoutno',
  30. name : 'bi_inoutno',
  31. fieldLabel : '出入库单号',
  32. readOnly : true,
  33. columnWidth : 0.20,
  34. fieldStyle : 'background:#f0f0f0;border: 0px solid #8B8970;font-color:blue'
  35. }, {
  36. id : 'bi_pdno',
  37. name : 'bi_pdno',
  38. fieldLabel : '行号',
  39. columnWidth : 0.10,
  40. readOnly : true,
  41. labelWidth : 40,
  42. fieldStyle : 'background:#f0f0f0;border: 0px solid #8B8970;font-color:blue'
  43. },{
  44. xtype:'tool',
  45. type:'prev',
  46. id: 'prev',
  47. tooltip: '上一条',
  48. margin:'4 6 0 0',
  49. listeners:{
  50. render: function(btn){
  51. setTimeout(function(){
  52. if(parent.Ext) {
  53. var form = Ext.getCmp('setBarcodeform');
  54. var bi_pdid = Ext.getCmp("bi_pdid").value;
  55. var datalistStore = form.getCurrentStore(bi_pdid);
  56. Ext.each(datalistStore, function(){
  57. if(this.selected == true){
  58. if(this.prev == null){
  59. btn.disable(true);
  60. }
  61. }
  62. });
  63. } else {
  64. btn.disable(true);
  65. }
  66. },100);
  67. },
  68. click: function(btn){
  69. var form = Ext.getCmp('setBarcodeform');
  70. var newId = 0;
  71. var idx = 0;
  72. var id = Ext.getCmp("bi_piid").value;
  73. var bi_pdid = Ext.getCmp("bi_pdid").value;
  74. var datalistStore = form.getCurrentStore(bi_pdid);
  75. Ext.each(datalistStore, function(s, index){
  76. if(s.selected == true){
  77. if(s.prev != null){
  78. newId = this.prev;
  79. idx = index;
  80. }
  81. }
  82. });
  83. var formCondition = "pd_id="+newId+" and pi_id='"+id+"'";
  84. var gridCondition = "bi_pdid="+newId+" and bi_piid='"+id+"'";
  85. window.location.href = basePath+'jsps/scm/reserve/setBarcode.jsp?_noc=1&whoami='+caller+'&formCondition='+formCondition+'&gridCondition='+gridCondition;
  86. }
  87. }
  88. },{
  89. xtype:'tool',
  90. type: 'next',
  91. id: 'next',
  92. tooltip: '下一条',
  93. margin:'4 8 0 6',
  94. listeners:{
  95. render: function(btn){
  96. setTimeout(function(){
  97. if(parent.Ext) {
  98. var form = Ext.getCmp('setBarcodeform');
  99. var bi_pdid = Ext.getCmp("bi_pdid").value;
  100. var datalistStore = form.getCurrentStore(bi_pdid);
  101. Ext.each(datalistStore, function(){
  102. if(this.selected == true){
  103. if(this.next == null){
  104. btn.disable(true);
  105. }
  106. }
  107. });
  108. } else {
  109. btn.disable(true);
  110. }
  111. },100);
  112. },
  113. click: function(btn){
  114. var form = Ext.getCmp('setBarcodeform');
  115. var bi_pdid = Ext.getCmp("bi_pdid").value;
  116. var datalistStore = form.getCurrentStore(bi_pdid);
  117. var idx = 0;
  118. var newId = 0;
  119. var id = Ext.getCmp("bi_piid").value;
  120. Ext.each(datalistStore, function(s, index){
  121. if(s.selected == true){
  122. if(s.next != null){
  123. newId = s.next;
  124. idx = index;
  125. }
  126. }
  127. });
  128. var formCondition = "pd_id="+newId+" and pi_id='"+id+"'";
  129. var gridCondition = "bi_pdid="+newId+" and bi_piid='"+id+"'";
  130. window.location.href = basePath+'jsps/scm/reserve/setBarcode.jsp?_noc=1&whoami='+caller+'&formCondition='+formCondition+'&gridCondition='+gridCondition;
  131. }
  132. }
  133. } ,{
  134. id : 'pd_ordercode',
  135. name : 'pd_ordercode',
  136. fieldLabel : '采购单号',
  137. readOnly : true,
  138. hidden : true,
  139. hideLabel : true,
  140. logic:'ignore'
  141. }, {
  142. id : 'bi_prodcode',
  143. name : 'bi_prodcode',
  144. fieldLabel : '物料编号',
  145. columnWidth : 0.20,
  146. readOnly : true,
  147. fieldStyle : 'background:#f0f0f0;border: 0px solid #8B8970;font-color:blue'
  148. }, {
  149. id : 'bi_prodid',
  150. name : 'bi_prodid',
  151. fieldLabel : '物料ID',
  152. readOnly : true,
  153. hidden : true,
  154. hideLabel : true
  155. }, {
  156. id : 'bi_pdid',
  157. name : 'bi_pdid',
  158. fieldLabel : '出入库单行号ID',
  159. readOnly : true,
  160. hidden : true,
  161. hideLabel : true
  162. }, {
  163. id : 'bi_piid',
  164. name : 'bi_piid',
  165. fieldLabel : '出入库单ID',
  166. readOnly : true,
  167. hidden : true,
  168. hideLabel : true
  169. },{
  170. id : 'pr_detail',
  171. name : 'pr_detail',
  172. fieldLabel : '物料名称',
  173. readOnly : true,
  174. logic:'ignore',
  175. fieldStyle : 'background:#f0f0f0;border: 0px solid #8B8970;font-color:blue',
  176. columnWidth : 0.20
  177. }, {
  178. id : 'pr_unit',
  179. name : 'pr_unit',
  180. fieldLabel : '单位',
  181. readOnly : true,
  182. logic:'ignore',
  183. fieldStyle : 'background:#f0f0f0;border: 0px solid #8B8970;font-color:blue',
  184. columnWidth : 0.15
  185. }, {
  186. id : 'pd_qty',
  187. name : 'pd_qty',
  188. fieldLabel : '来料总数',
  189. readOnly : true,
  190. logic:'ignore',
  191. fieldStyle : 'background:#f0f0f0;border: 0px solid #8B8970;font-color:blue',
  192. columnWidth : 0.15
  193. }, {
  194. id : 'pr_tracekind',
  195. name : 'pr_tracekind',
  196. xtype : 'combobox',
  197. fieldLabel : '管控类型',
  198. readOnly : true,
  199. fieldStyle : 'background:#f0f0f0;border: 0px solid #8B8970;font-color:blue',
  200. columnWidth : 0.20,
  201. store: Ext.create('Ext.data.Store', {
  202. fields: ['display', 'value'],
  203. data : [
  204. {"display": '不管控', "value": '0'},
  205. {"display": '单件管控', "value": '1'},
  206. {"display": '批管控', "value": '2'}
  207. ]
  208. }),
  209. displayField: 'display',
  210. valueField: 'value',
  211. editable: false
  212. }, {
  213. id : 'pi_cardcode',
  214. name : 'pi_cardcode',
  215. fieldLabel : '供应商编号',
  216. readOnly : true,
  217. fieldStyle : 'background:#f0f0f0;border: 0px solid #8B8970;font-color:blue',
  218. columnWidth : 0.20
  219. }, {
  220. id : 'pi_title',
  221. name : 'pi_title',
  222. fieldLabel : '供应商名称',
  223. readOnly : true,
  224. logic:'ignore',
  225. fieldStyle : 'background:#f0f0f0;border: 0px solid #8B8970;font-color:blue',
  226. columnWidth : 0.4
  227. }, {
  228. xtype : 'textfield',
  229. id : 'pd_inqty',
  230. name : 'pd_inqty',
  231. fieldLabel : '批总量',
  232. fieldStyle : "background:rgb(224, 224, 255);",
  233. labelStyle:"color:red;",
  234. columnWidth : 0.20
  235. }, {
  236. id : 'pd_outqty',
  237. name : 'pd_outqty',
  238. fieldLabel : '批总量',
  239. allowBlank:false,
  240. columnWidth : 0.20
  241. },{
  242. xtype : 'textfield',
  243. id : 'pk_qty',
  244. name : 'pk_qty',
  245. fieldLabel : '箱内总数',
  246. columnWidth : 0.15
  247. },{
  248. xtype : 'textfield',
  249. id : 'pr_zxbzs',
  250. name : 'pr_zxbzs',
  251. fieldLabel : '最小包数',
  252. columnWidth : 0.15
  253. },{
  254. xtype : 'textareatrigger',
  255. id : 'bi_bzs',
  256. name : 'bi_bzs',
  257. fieldLabel : '来料包装数',
  258. columnWidth : 0.15
  259. }, {
  260. xtype : 'textfield',
  261. id : 'bi_vendbarcode',
  262. name : 'bi_vendbarcode',
  263. fieldLabel : '供应商批号',
  264. columnWidth : 0.20
  265. }, {
  266. xtype : 'datefield',
  267. id : 'bi_madedate',
  268. name : 'bi_madedate',
  269. fieldLabel : '生产日期',
  270. columnWidth : 0.20
  271. }, {
  272. xtype : 'datefield',
  273. id : 'bi_validdate',
  274. name : 'bi_validdate',
  275. fieldLabel : '有效期',
  276. columnWidth : 0.15,
  277. labelWidth : 50
  278. }, {
  279. id : 'pl_code',
  280. xtype : 'dbfindtrigger',
  281. name : 'bi_location',
  282. fieldLabel : '仓位',
  283. fieldStyle : "background:rgb(224, 224, 255);",
  284. labelStyle:"color:red;",
  285. columnWidth : 0.15,
  286. allowBlank:false,
  287. labelWidth : 50
  288. }],
  289. dockedItems:[{
  290. xtype: 'toolbar',
  291. dock: 'bottom',
  292. layout: {
  293. pack: 'center' //放置位置
  294. },
  295. defaults: {
  296. style: {
  297. marginLeft: '10px',
  298. marginBottom:'15px'
  299. }
  300. },
  301. items:[{
  302. id : 'batchGenBarcode',
  303. cls : 'x-btn-gray',
  304. text : '批量生成条码',
  305. style : 'margin-left:20px',
  306. formBind : true,// form.isValid() == false时,按钮disabled
  307. width:100
  308. },/*{
  309. cls: 'x-btn-gray',
  310. id: 'generateBarcodebtn',
  311. text: $I18N.common.button.erpGenerateBarcodeButton,
  312. formBind : true,// form.isValid() == false时,按钮disabled
  313. style: {
  314. marginLeft: '10px'
  315. },
  316. width: 90
  317. },*/{
  318. id : 'batchGenBarOBcode',
  319. cls : 'x-btn-gray',
  320. text : '批量生成条码和箱号',
  321. style : 'margin-left:20px',
  322. formBind : true,// form.isValid() == false时,按钮disabled
  323. width:150
  324. }/*,{
  325. xtype:'erpGeneratePaCodeButton'
  326. }*/,{
  327. xtype:'erpPrintAllButton'
  328. },{
  329. xtype:'erpPrintAllPackageButton'
  330. },{
  331. id : 'save',
  332. text : '保存',
  333. width : 60,
  334. iconCls : 'x-button-icon-save',
  335. cls : 'x-btn-gray'
  336. },{
  337. xtype:'erpDeleteAllDetailsButton'
  338. },{
  339. xtype:'erpCloseButton'
  340. }]
  341. }]
  342. });
  343. formCondition = getUrlParam('formCondition');// 从url解析参数
  344. formCondition = (formCondition == null) ? "" : formCondition.replace(/IS/g,"=");
  345. this.loadStore(this,formCondition);
  346. this.callParent(arguments);
  347. },
  348. loadStore : function(form,param){
  349. var me = this;
  350. Ext.Ajax.request({
  351. url : basePath + "scm/reserve/getBarFormStore.action",
  352. params: {
  353. caller: caller,
  354. condition:param
  355. },
  356. method : 'post',
  357. callback : function(options,success,response){
  358. var res = new Ext.decode(response.responseText);
  359. if(res.exceptionInfo != null){
  360. showError(res.exceptionInfo);return;
  361. }
  362. if(res.data){
  363. var d = Ext.decode(res.data);
  364. form.getForm().setValues(d);
  365. }
  366. }
  367. });
  368. },
  369. getCurrentStore: function(value){
  370. var grid = parent.Ext.getCmp('grid');
  371. var items = grid.store.data.items;
  372. var array = new Array();
  373. var o = null;
  374. Ext.each(items, function(item, index){
  375. o = new Object();
  376. o.selected = false;
  377. if(index == 0){
  378. o.prev = null;
  379. } else {
  380. o.prev = items[index-1].data["pd_id"];
  381. }
  382. if(index == items.length - 1){
  383. o.next = null;
  384. } else {
  385. o.next = items[index+1].data["pd_id"];
  386. }
  387. var v = item.data["pd_id"];
  388. o.value = v;
  389. if(v == value)
  390. o.selected = true;
  391. array.push(o);
  392. });
  393. return array;
  394. }
  395. });