SearchForm.js 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. Ext.define('make.view.make.bomComposite.SearchForm', {
  2. extend: 'Ext.form.Panel',
  3. xtype: 'make-query-searchform',
  4. controller: 'make-query-searchform',
  5. name: 'bomcomposite1',
  6. width: '100%',
  7. minHeight: 100,
  8. bodyPadding: '10 10 0 10',
  9. margin: '0 0 12 0',
  10. layout: 'column',
  11. viewModel: {
  12. formulas: {
  13. //总在途
  14. onOrder: function (get) {
  15. var a = get('noComplete'),
  16. b = get('purchase'),
  17. i = Number(get('application'));
  18. return Number(a) + Number(b) + Number(i);
  19. },
  20. //总库存
  21. onHand: function (get) {
  22. var a = get('greattotal'),
  23. b = get('badtotal');
  24. return Number(a) + Number(b);
  25. },
  26. //总需求
  27. onNeed: function (get) {
  28. var a = get('noShipment'),
  29. b = get('noPicking'),
  30. c = get('safeInventory'),
  31. d = get('safeForecastUnClash');
  32. return Number(a) + Number(b) + Number(c) + Number(d);
  33. },
  34. //净需求
  35. realNeed: function (get) {
  36. var a = Number(get('noShipment')),
  37. b = Number(get('noPicking')),
  38. c = Number(get('safeInventory')),
  39. d = Number(get('greattotal')),
  40. e = Number(get('noComplete')),
  41. f = Number(get('purchase')),
  42. g = Number(get('safeForecastUnClash')),
  43. i = Number(get('application'));
  44. return a + b + c + g + i - d - e - f;
  45. }
  46. }
  47. },
  48. initComponent: function () {
  49. var me = this;
  50. Ext.apply(this, {
  51. items: [{
  52. xtype: "productDbfindTrigger",
  53. name: 'pr_code',
  54. allowBlank: false,
  55. emptyText: '请选择物料',
  56. width: 200,
  57. columnWidth: 0.25
  58. }, {
  59. xtype: 'displayfield',
  60. name: 'pr_detail',
  61. fieldLabel: '名称',
  62. labelWidth: 50,
  63. width: 200,
  64. columnWidth: 0.25,
  65. margin: '0 0 0 10'
  66. }, {
  67. xtype: 'displayfield',
  68. name: 'pr_orispeccode',
  69. fieldLabel: '型号',
  70. labelWidth: 50,
  71. width: 200,
  72. columnWidth: 0.25,
  73. margin: '0 0 0 10'
  74. }, {
  75. xtype: 'displayfield',
  76. name: 'pr_unit',
  77. fieldLabel: '单位',
  78. labelWidth: 50,
  79. width: 200,
  80. columnWidth: 0.25,
  81. margin: '0 0 0 10'
  82. }, {
  83. xtype: 'button',
  84. text: '查询',
  85. handler: 'onQuery'
  86. }, {
  87. xtype: 'form',
  88. columnWidth: 1,
  89. layout: 'column',
  90. margin: '0 0 10 0',
  91. bodyStyle: 'background:#f6f6f6; padding:10px;',
  92. defaults: {
  93. columnWidth: 0.25,
  94. layout: 'vbox',
  95. xtype: 'form',
  96. cls: 'bomcomposite-form',
  97. bodyStyle: 'background:#f7f7f7;',
  98. defaults: {
  99. xtype: 'displayfield',
  100. labelStyle: 'color:#505363;font-size: 13px;',
  101. thousandSeparator: ',',
  102. renderer: function (v) {
  103. if (!v) {
  104. v = 0;
  105. }
  106. return saas.util.BaseUtil.numberFormat(v, 6, true)
  107. }
  108. }
  109. },
  110. items: [{
  111. items: [{
  112. fieldLabel: '总需求量(+)',
  113. labelStyle: 'color:#505363;font-size: 13px; font-weight: bold;',
  114. bind: '{onNeed}',
  115. renderer: function (v) {
  116. if (!v) {
  117. v = 0;
  118. }
  119. return '<font><B>' + saas.util.BaseUtil.numberFormat(v, 6, true) + '</font>'
  120. }
  121. }, {
  122. name: 'noShipment',
  123. fieldLabel: '订单未发货',
  124. bind: '{noShipment}'
  125. }, {
  126. name: 'noPicking',
  127. fieldLabel: '工单未领料',
  128. bind: '{noPicking}'
  129. }, {
  130. name: 'safeInventory',
  131. fieldLabel: '安全库存',
  132. bind: '{safeInventory}'
  133. }, {
  134. name: 'safeForecastUnClash',
  135. fieldLabel: '备货未核销',
  136. bind: '{safeForecastUnClash}'
  137. }]
  138. }, {
  139. items: [{
  140. fieldLabel: '现有库存量(-)',
  141. labelStyle: 'color:#505363;font-size: 13px; font-weight: bold;',
  142. bind: '{greattotal}',
  143. renderer: function (v) {
  144. if (!v) {
  145. v = 0;
  146. }
  147. return '<font><B>' + saas.util.BaseUtil.numberFormat(v, 6, true) + '</font>'
  148. }
  149. }, {
  150. name: 'greattotal',
  151. fieldLabel: '良品库存',
  152. bind: '{greattotal}'
  153. }, {
  154. name: 'badtotal',
  155. fieldLabel: '不良品库存',
  156. bind: '{badtotal}'
  157. }, {
  158. name: 'total',
  159. fieldLabel: '总库存',
  160. bind: '{onHand}'
  161. }]
  162. }, {
  163. items: [{
  164. fieldLabel: '在途库存量(-)',
  165. labelStyle: 'color:#505363;font-size: 13px; font-weight: bold;',
  166. bind: '{onOrder}',
  167. renderer: function (v) {
  168. if (!v) {
  169. v = 0;
  170. }
  171. return '<font><B>' + saas.util.BaseUtil.numberFormat(v, 6, true) + '</font>'
  172. }
  173. }, {
  174. name: 'purchase',
  175. fieldLabel: '采购未交',
  176. bind: '{purchase}'
  177. }, {
  178. name: 'noComplete',
  179. fieldLabel: '工单未完工',
  180. bind: '{noComplete}'
  181. }, {
  182. name: 'application',
  183. fieldLabel: '请购未转',
  184. bind: '{application}'
  185. }]
  186. }, {
  187. items: [{
  188. fieldLabel: '净需求',
  189. labelWidth: 60,
  190. labelStyle: 'color:#505363;font-size: 13px; font-weight: bold;',
  191. thousandSeparator: ',',
  192. bind: '{realNeed}',
  193. renderer: function (v) {
  194. if (!v) {
  195. v = 0;
  196. }
  197. return '<font color="red"><B>' + saas.util.BaseUtil.numberFormat(v, 6, true) + '</font>'
  198. },
  199. }]
  200. }]
  201. }]
  202. });
  203. this.callParent(arguments);
  204. },
  205. });