QueryPanel_3.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  1. Ext.define('make.view.osmake.makeDetail.QueryPanel_3', {
  2. extend: 'saas.view.core.query.QueryPanel',
  3. xtype: 'osmake-makedetail-querypanel-3',
  4. controller: 'osmake-makedetail-querypanel',
  5. viewModel: {
  6. extend: 'saas.view.core.query.QueryPanelModel',
  7. data: {
  8. form: {}, // 查询字段记录
  9. addEnable: false, // 显示新增按钮
  10. auditEnable: false, // 显示审核按钮
  11. printEnable: false, // 显示打印按钮
  12. importEnable: false, // 显示导入按钮
  13. exportEnable: true, // 显示导出按钮
  14. closeEnable: false, // 显示关闭按钮
  15. deleteEnable: false, // 显示删除按钮
  16. deleteDisable:false, //删除按钮是否可使用
  17. openAudit:false,//单独显示审核按钮
  18. openUnAudit:false,//单独显示反审核按钮
  19. openEnable:false, //显示开启 针对已取消列表
  20. configurable: true, // 允许列设置
  21. }
  22. },
  23. viewName: 'osmake-makedetail-querypanel-3',
  24. caller: 'OsMakeDetail',
  25. //importUploadPath: '/api/purchse/makereturn/saveToFormal',
  26. initComponent: function () {
  27. var me = this ;
  28. Ext.apply(this, {
  29. queryFormItems: [{
  30. xtype: 'condatefield',
  31. name: 'make.createTime',
  32. fieldLabel: '日期',
  33. columnWidth: 0.5,
  34. operation: 'between',
  35. },{
  36. xtype: 'multiqueryField',
  37. columnWidth: 0.4,
  38. name: 'multi_query',
  39. querys: {
  40. "MakeCode": {"field": "ma_code" ,"desc": "外协单号"},
  41. "BillCode": {"field": "ma_salecode" ,"desc": "订单号"},
  42. "Vend": {"field": "ma_vendcode" ,"desc": "外协厂商"},
  43. "Prod": {"field": "ma_prodcode", "dbfinds": [{//物料
  44. from: 'pr_code',
  45. to: 'ma_prodcode'
  46. },{
  47. from: 'pr_detail',
  48. to: 'pr_detail'
  49. }]},
  50. "Emp":{"field": "make.creatorName", "dbfinds": [{
  51. from: 'em_name',
  52. to: 'make.creatorName'
  53. }]},
  54. },
  55. setShowDetail: function(v){
  56. this.showDetail = false;
  57. }
  58. }],
  59. moreQueryFormItems: [{
  60. xtype: 'saledetailDbfindTrigger',
  61. name: 'ma_salecode',
  62. fieldLabel: '订单编号'
  63. }, {
  64. xtype: 'customerDbfindTrigger',
  65. name: 'ma_custname',
  66. fieldLabel: '客户名称'
  67. }, {
  68. xtype: 'condatefield',
  69. name: 'ma_delivery',
  70. fieldLabel: '交货日期',
  71. columnWidth: 1
  72. }, {
  73. xtype: 'productMDbfindTrigger',
  74. name: 'ma_prodcode',
  75. fieldLabel: '物料编号'
  76. }, {
  77. xtype: 'textfield',
  78. name: 'pr_detail',
  79. fieldLabel: '产品名称',
  80. readOnly: true,
  81. }, {
  82. xtype: 'textfield',
  83. name: 'pr_orispeccode',
  84. fieldLabel: '产品型号',
  85. readOnly: true,
  86. }, {
  87. editable: false,
  88. xtype: "remotecombo",
  89. storeUrl: '/api/document/productbrand/getCombo',
  90. name: "pr_brand",
  91. fieldLabel: "厂家/品牌",
  92. hiddenBtn: true,
  93. }, {
  94. xtype: 'vendorDbfindTrigger',
  95. name: 'ma_vendname',
  96. fieldLabel: '外协厂商'
  97. }, {
  98. xtype: 'combobox',
  99. name: 'ma_currency',
  100. fieldLabel: '币别',
  101. queryMode: 'local',
  102. displayField: 'ma_currency',
  103. valueField: 'ma_currency',
  104. emptyText: '',
  105. editable: false,
  106. store: Ext.create('Ext.data.ArrayStore', {
  107. fields: ['ma_currency'],
  108. data: [
  109. ["RMB", "RMB"],
  110. ["USD", "USD"],
  111. ["HKD", "HKD"]
  112. ]
  113. }),
  114. getCondition: function (value) {
  115. if (!value) {
  116. return '1=1';
  117. } else {
  118. return 'ma_currency=\'' + value + '\'';
  119. }
  120. }
  121. }, {
  122. xtype: "remotecombo",
  123. name: "ma_kind",
  124. fieldLabel: "外协类型",
  125. storeUrl: '/api/make/kind/list/osmake',
  126. valueField: 'mk_name',
  127. displayField: 'mk_name',
  128. hiddenBtn: true,
  129. }, {
  130. xtype: 'remotecombo',
  131. storeUrl: '/api/document/workcenter/getCombo',
  132. name: "ma_wcname",
  133. fieldLabel: "工作中心",
  134. hiddenBtn: true,
  135. }, {
  136. xtype: 'combobox',
  137. name: 'ma_statuscode',
  138. fieldLabel: '审核状态',
  139. queryMode: 'local',
  140. displayField: 'ma_status',
  141. valueField: 'ma_statuscode',
  142. emptyText: '全部',
  143. editable: false,
  144. store: Ext.create('Ext.data.ArrayStore', {
  145. fields: ['ma_statuscode', 'ma_status'],
  146. data: [
  147. ["ALL", "全部"],
  148. ["AUDITED", "已审核"],
  149. ["UNAUDITED", "未审核"]
  150. ]
  151. }),
  152. getCondition: function (value) {
  153. if (value == 'ALL') {
  154. return '1=1';
  155. } else {
  156. return 'ma_statuscode=\'' + value + '\'';
  157. }
  158. }
  159. }, {
  160. xtype: 'employeeDbfindTrigger',
  161. name: 'creatorName',
  162. fieldLabel: '录入人',
  163. emptyText: '请输入账户名称或姓名',
  164. getCondition: function (value) {
  165. if (!value) {
  166. return '1=1';
  167. } else {
  168. return 'make.creatorName like\'%' + value + '%\'';
  169. }
  170. }
  171. }, {
  172. xtype: 'condatefield',
  173. name: 'ma_planbegindate',
  174. fieldLabel: '计划开工日期',
  175. columnWidth: 1
  176. }, {
  177. xtype: 'condatefield',
  178. name: 'ma_planenddate',
  179. fieldLabel: '计划完工日期',
  180. columnWidth: 1
  181. }, {
  182. xtype: 'condatefield',
  183. name: 'make.createTime',
  184. fieldLabel: '单据日期',
  185. columnWidth: 1
  186. }, {
  187. xtype: 'employeeDbfindTrigger',
  188. name: 'ma_auditman',
  189. fieldLabel: '审核人',
  190. emptyText: '请输入账户名称或姓名',
  191. }],
  192. queryGridConfig: {
  193. idField: 'ma_id',
  194. codeField: 'ma_code',
  195. mainIdField:'ma_id',
  196. detailIdField:'mm_id',
  197. addTitle: '外协工单',
  198. addXtype: 'osmake-osmake-formpanel',
  199. baseVastUrl:me.baseVastUrl,
  200. defaultCondition: me.defaultCondition,
  201. caller: me.caller,
  202. useGridCaller :true,
  203. toolBtns: [{
  204. text: '转退料',
  205. xtype: 'button',
  206. handler: 'turnBack'
  207. },{
  208. text: '转报废',
  209. xtype: 'button',
  210. handler: 'turnScrap'
  211. }],
  212. groupField:'ma_code',
  213. groupHeaderTpl: Ext.create('Ext.XTemplate',
  214. '<div class="groupHeaderTpl" style="margin:0px 0px 0px 100px">',
  215. '<span style="width:280px">外协厂商{[values.rows[0].data.ma_vendname]}</span>',
  216. '<span style="width:200px">外协单号:{[values.rows[0].data.ma_code]}</span>',
  217. '<span style="width:200px">销售单号:{[values.rows[0].data.ma_salecode]}</span>',
  218. '<span style="width:200px">产品编号:{[values.rows[0].data.ma_prcode]}</span>',
  219. '<span style="width:200px">产品型号:{[values.rows[0].data.ma_prorispeccode]}</span>',
  220. '<span style="width:140px">数量:{[values.rows[0].data.ma_qty]}</span>',
  221. '<span style="width:140px">已完工数:{[values.rows[0].data.ma_madeqty]}</span>',
  222. '</div>'
  223. ),
  224. onGroupClick: function(view, group, idx, e){
  225. if(e.target && e.target.nodeName == 'A'){
  226. var grid = view.up('grid'),
  227. rec = e.record,
  228. idValue = rec.get('ma_id'),
  229. codeValue = rec.get('ma_code');
  230. saas.util.BaseUtil.openTab(grid.addXtype, grid.addTitle+"("+codeValue+")", grid.addXtype + '-' + idValue, {
  231. initId: idValue
  232. });
  233. }
  234. },
  235. baseColumn: [{
  236. text: 'id',
  237. dataIndex: 'ma_id',
  238. hidden: true,
  239. xtype: 'numbercolumn'
  240. },{
  241. text: '交货日期',
  242. dataIndex: 'ma_delivery',
  243. hidden: true,
  244. },{
  245. text: '产品名称',
  246. dataIndex: 'ma_prdetail',
  247. hidden: true,
  248. },{
  249. text: '产品规格',
  250. dataIndex: 'ma_prspec',
  251. hidden: true,
  252. },{
  253. text: '本次数量',
  254. align: 'center',
  255. dataIndex: 'mm_thisqty',
  256. xtype: 'widgetcolumn',
  257. width: 110,
  258. renderer : function(v, m, r) {
  259. return saas.util.BaseUtil.numberFormat(v, 6, true);
  260. },
  261. widget: {
  262. xtype: "numberfield",
  263. cls:'widget-number',
  264. bind: '{record.mm_thisqty}',
  265. decimalPrecision: 6,
  266. minValue: 0,
  267. listeners:{
  268. blur: function(f ,event, e){
  269. var record = f.lookupViewModel().data.record,
  270. maxVal,nowVal;
  271. if(record){
  272. if(!Ext.isEmpty(record.modified['mm_thisqty'])){ //若存在修改
  273. maxVal = record.modified['mm_thisqty'];
  274. nowVal = f.value;
  275. if(Ext.isEmpty(nowVal)){
  276. record.set('mm_thisqty', maxVal)
  277. }else if(nowVal>maxVal){
  278. record.set('mm_thisqty', maxVal)
  279. saas.util.BaseUtil.showErrorToast('请不要输入超过最大数量' + maxVal + "的值!");
  280. }
  281. }
  282. }
  283. }
  284. }
  285. }
  286. }, {
  287. text: '工单序号',
  288. dataIndex: 'mm_detno',
  289. align: 'center',
  290. width: 80
  291. },{
  292. text: '物料编号',
  293. dataIndex: 'mm_prodcode',
  294. width: 150
  295. },{
  296. text: '物料名称',
  297. dataIndex: 'pr_detail',
  298. width: 150
  299. },{
  300. text: '物料规格',
  301. dataIndex: 'pr_desc',
  302. width: 150
  303. },{
  304. text: '单位',
  305. align: 'center',
  306. dataIndex: 'pr_unit',
  307. width: 80
  308. },{
  309. text: '单位用量',
  310. align: 'center',
  311. dataIndex: 'mm_oneuseqty',
  312. width: 80
  313. },{
  314. text: '需求数',
  315. align: 'center',
  316. dataIndex: 'ma_qty',
  317. xtype: 'numbercolumn',
  318. width: 110,
  319. renderer : function(v, m, r) {
  320. return saas.util.BaseUtil.numberFormat(v, 6, true);
  321. },
  322. },{
  323. text: '已领数',
  324. align: 'center',
  325. dataIndex: 'mm_havegetqty',
  326. xtype: 'numbercolumn',
  327. width: 110,
  328. renderer : function(v, m, r) {
  329. return saas.util.BaseUtil.numberFormat(v, 6, true);
  330. },
  331. },{
  332. text: '未领数',
  333. align: 'center',
  334. dataIndex: 'mm_restgetqty',
  335. xtype: 'numbercolumn',
  336. width: 110,
  337. renderer : function(v, m, r) {
  338. v = r.get('mm_qty') + (r.get('mm_scrapqty')||0) - (r.get('mm_havegetqty')||0);
  339. return saas.util.BaseUtil.numberFormat(v, 6, true);
  340. }
  341. },{
  342. text: '制程不良数',
  343. align: 'center',
  344. dataIndex: 'mm_returnmqty',
  345. xtype: 'numbercolumn',
  346. width: 110,
  347. renderer : function(v, m, r) {
  348. return saas.util.BaseUtil.numberFormat(v, 6, true);
  349. },
  350. },{
  351. text: '已转退料数',
  352. align: 'center',
  353. dataIndex: 'mm_turnbackqty',
  354. xtype: 'numbercolumn',
  355. width: 110,
  356. renderer : function(v, m, r) {
  357. return saas.util.BaseUtil.numberFormat(v, 6, true);
  358. },
  359. },{
  360. text: '报废数',
  361. align: 'center',
  362. dataIndex: 'mm_turnscrapqty',
  363. xtype: 'numbercolumn',
  364. width: 110,
  365. renderer : function(v, m, r) {
  366. return saas.util.BaseUtil.numberFormat(v, 6, true);
  367. },
  368. },{
  369. text: '已转报废数',
  370. align: 'center',
  371. dataIndex: 'mm_turnscrapqty',
  372. xtype: 'numbercolumn',
  373. width: 110,
  374. renderer : function(v, m, r) {
  375. return saas.util.BaseUtil.numberFormat(v, 6, true);
  376. },
  377. },{
  378. text: '备注',
  379. dataIndex: 'ma_remark',
  380. width: 100
  381. }],
  382. relativeColumn: []
  383. }
  384. });
  385. this.callParent(arguments);
  386. },
  387. });