QueryPanel_1.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391
  1. Ext.define('make.view.osmake.makeDetail.QueryPanel_1', {
  2. extend: 'saas.view.core.query.QueryPanel',
  3. xtype: 'osmake-makedetail-querypanel-1',
  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-1',
  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. caller: me.caller,
  201. useGridCaller: true, //使用grid的caller
  202. defaultCondition:me.defaultCondition,
  203. toolBtns: [{
  204. text: '转领料',
  205. xtype: 'button',
  206. handler: 'turnPick'
  207. }],
  208. groupField:'ma_code',
  209. groupHeaderTpl: Ext.create('Ext.XTemplate',
  210. '<div class="groupHeaderTpl" style="margin:0px 0px 0px 100px">',
  211. '<span style="width:280px">外协厂商:{[values.rows[0].data.ma_vendname]}</span>',
  212. '<span style="width:200px">外协单号:{[values.rows[0].data.ma_code]}</span>',
  213. '<span style="width:200px">销售单号:{[values.rows[0].data.ma_salecode]}</span>',
  214. '<span style="width:200px">产品编号:{[values.rows[0].data.ma_prcode]}</span>',
  215. '<span style="width:200px">产品型号:{[values.rows[0].data.ma_prorispeccode]}</span>',
  216. '<span style="width:140px">数量:{[saas.util.BaseUtil.numberFormat(values.rows[0].data.ma_qty,3,true)]}</span>',
  217. '<span style="width:140px">已完工数:{[saas.util.BaseUtil.numberFormat(values.rows[0].data.ma_madeqty,3,true)]}</span>',
  218. '</div>'
  219. ),
  220. onGroupClick: function(view, group, idx, e){
  221. if(e.target && e.target.nodeName == 'A'){
  222. var grid = view.up('grid'),
  223. rec = e.record,
  224. idValue = rec.get('ma_id'),
  225. codeValue = rec.get('ma_code');
  226. saas.util.BaseUtil.openTab(grid.addXtype, grid.addTitle+"("+codeValue+")", grid.addXtype + '-' + idValue, {
  227. initId: idValue
  228. });
  229. }
  230. },
  231. setBackGround:function(record){
  232. return record.get('mm_thisqty') > (record.get('po_mrponhand') || 0) ? 'x-overthisline' : '';
  233. },
  234. baseColumn: [{
  235. text: 'id',
  236. dataIndex: 'id',
  237. hidden: true,
  238. xtype: 'numbercolumn'
  239. },{
  240. text: '交货日期',
  241. dataIndex: 'ma_delivery',
  242. hidden: true,
  243. },{
  244. text: '产品名称',
  245. dataIndex: 'ma_prdetail',
  246. hidden: true,
  247. },{
  248. text: '产品规格',
  249. dataIndex: 'ma_prspec',
  250. hidden: true,
  251. },{
  252. text: '本次数量',
  253. align: 'center',
  254. dataIndex: 'mm_thisqty',
  255. xtype: 'widgetcolumn',
  256. width: 110,
  257. renderer : function(v, m, r) {
  258. return saas.util.BaseUtil.numberFormat(v, 6, true);
  259. },
  260. widget: {
  261. xtype: "numberfield",
  262. cls:'widget-number',
  263. bind: '{record.mm_thisqty}',
  264. decimalPrecision: 6,
  265. minValue: 0,
  266. listeners:{
  267. blur: function(f ,event, e){
  268. var record = f.lookupViewModel().data.record,
  269. maxVal,nowVal;
  270. if(record){
  271. if(!Ext.isEmpty(record.modified['mm_thisqty'])){ //若存在修改
  272. maxVal = record.modified['mm_thisqty'];
  273. nowVal = f.value;
  274. if(Ext.isEmpty(nowVal)){
  275. record.set('mm_thisqty', maxVal)
  276. }else if(nowVal>maxVal){
  277. record.set('mm_thisqty', maxVal)
  278. saas.util.BaseUtil.showErrorToast('请不要输入超过最大数量' + maxVal + "的值!");
  279. }
  280. }
  281. }
  282. }
  283. }
  284. }
  285. },{
  286. text: '良品库存',
  287. dataIndex: 'po_mrponhand',
  288. align: 'center',
  289. xtype: 'numbercolumn',
  290. width: 110,
  291. renderer : function(v, m, r) {
  292. return saas.util.BaseUtil.numberFormat(v, 6, true);
  293. },
  294. }, {
  295. text: '工单序号',
  296. dataIndex: 'mm_detno',
  297. align: 'center',
  298. width: 80
  299. },{
  300. text: '物料编号',
  301. dataIndex: 'mm_prodcode',
  302. width: 150
  303. },{
  304. text: '物料名称',
  305. dataIndex: 'pr_detail',
  306. width: 150
  307. },{
  308. text: '物料规格',
  309. dataIndex: 'pr_desc',
  310. width: 150
  311. },{
  312. text: '单位',
  313. align: 'center',
  314. dataIndex: 'pr_unit',
  315. width: 80
  316. },{
  317. text: '单位用量',
  318. align: 'center',
  319. dataIndex: 'mm_oneuseqty',
  320. width: 80
  321. },{
  322. text: '需求数',
  323. align: 'center',
  324. dataIndex: 'ma_qty',
  325. xtype: 'numbercolumn',
  326. width: 110,
  327. renderer : function(v, m, r) {
  328. return saas.util.BaseUtil.numberFormat(v, 6, true);
  329. },
  330. },{
  331. text: '已领数',
  332. align: 'center',
  333. dataIndex: 'mm_havegetqty',
  334. xtype: 'numbercolumn',
  335. width: 110,
  336. renderer : function(v, m, r) {
  337. return saas.util.BaseUtil.numberFormat(v, 6, true);
  338. },
  339. },{
  340. text: '已转领料数',
  341. align: 'center',
  342. dataIndex: 'mm_turngetqty',
  343. xtype: 'numbercolumn',
  344. width: 110,
  345. renderer : function(v, m, r) {
  346. return saas.util.BaseUtil.numberFormat(v, 6, true);
  347. },
  348. },{
  349. text: '未领数',
  350. align: 'center',
  351. dataIndex: 'mm_restgetqty',
  352. xtype: 'numbercolumn',
  353. width: 110,
  354. renderer : function(v, m, r) {
  355. v = r.get('mm_qty') + (r.get('mm_scrapqty')||0) - (r.get('mm_havegetqty')||0)-(r.get('mm_turngetqty')||0);
  356. return saas.util.BaseUtil.numberFormat(v, 6, true);
  357. }
  358. },{
  359. text: '制程不良数',
  360. align: 'center',
  361. dataIndex: 'mm_returnmqty',
  362. xtype: 'numbercolumn',
  363. width: 110,
  364. renderer : function(v, m, r) {
  365. return saas.util.BaseUtil.numberFormat(v, 6, true);
  366. },
  367. },{
  368. text: '报废数',
  369. align: 'center',
  370. dataIndex: 'mm_turnscrapqty',
  371. xtype: 'numbercolumn',
  372. width: 110,
  373. renderer : function(v, m, r) {
  374. return saas.util.BaseUtil.numberFormat(v, 6, true);
  375. },
  376. },{
  377. text: '备注',
  378. dataIndex: 'ma_remark',
  379. width: 100
  380. }],
  381. relativeColumn: []
  382. }
  383. });
  384. this.callParent(arguments);
  385. },
  386. });