Ext.define('make.view.make.makeDetail.QueryPanel_2', { extend: 'saas.view.core.query.QueryPanel', xtype: 'make-makedetail-querypanel-2', controller: 'make-makedetail-querypanel', viewModel: { extend: 'saas.view.core.query.QueryPanelModel', data: { form: {}, // 查询字段记录 addEnable: false, // 显示新增按钮 auditEnable: false, // 显示审核按钮 printEnable: false, // 显示打印按钮 importEnable: false, // 显示导入按钮 exportEnable: true, // 显示导出按钮 closeEnable: false, // 显示关闭按钮 deleteEnable: false, // 显示删除按钮 deleteDisable:false, //删除按钮是否可使用 openAudit:false,//单独显示审核按钮 openUnAudit:false,//单独显示反审核按钮 openEnable:false, //显示开启 针对已取消列表 configurable: true, // 允许列设置 } }, viewName: 'make-makedetail-querypanel-2', caller: 'MakeSetPick', //importUploadPath: '/api/purchse/makereturn/saveToFormal', initComponent: function () { var me = this ; Ext.apply(this, { queryFormItems: [{ xtype: 'condatefield', name: 'make.createTime', fieldLabel: '日期', columnWidth: 0.5, operation: 'between', },{ xtype: 'multiqueryField', columnWidth: 0.4, name: 'multi_query', querys: { "MakeCode": {"field": "ma_code" ,"desc": "制造单号"}, "BillCode": {"field": "ma_salecode" ,"desc": "订单号"}, "Cust": {"field": "ma_custcode" ,"desc": "客户"}, "Prod": {"field": "ma_prodcode", "dbfinds": [{//物料 from: 'pr_code', to: 'ma_prodcode' },{ from: 'pr_detail', to: 'pr_detail' }]}, "Emp":{"field": "prodinout.creatorName", "dbfinds": [{ from: 'em_name', to: 'prodinout.creatorName' }]}, }, setShowDetail: function(v){ this.showDetail = false; } }], moreQueryFormItems: [{ xtype: 'saledetailDbfindTrigger', name: 'ma_salecode', fieldLabel: '订单编号' },{ xtype: "customerDbfindTrigger", name: "ma_custname", fieldLabel: "客户名称", },{ xtype: 'condatefield', name: 'ma_delivery', fieldLabel: '交货日期', value:7, columnWidth: 1 },{ xtype: 'productDbfindTrigger', name: 'ma_prodcode', fieldLabel: '物料编号' },{ xtype: 'textfield', name: 'pr_detail', fieldLabel: '产品名称', readOnly: true, }, { xtype: 'textfield', name: 'pr_orispeccode', fieldLabel: '产品型号', readOnly: true, }, { xtype: "remotecombo", name: "pr_brand", fieldLabel: "厂家/品牌", storeUrl: '/api/document/productbrand/getCombo', editable: false, hiddenBtn:true },{ xtype: "remotecombo", name: "ma_kind", fieldLabel: "制造类型", storeUrl:'/api/make/kind/list/make', valueField:'mk_name', displayField: 'mk_name', editable: false, hiddenBtn:true },{ xtype: 'remotecombo', name: "ma_wcname", fieldLabel: "工作中心", storeUrl: '/api/document/workcenter/getCombo', editable: false, hiddenBtn:true },{ xtype: 'combobox', name: 'ma_statuscode', fieldLabel: '审核状态', queryMode: 'local', displayField: 'ma_status', valueField: 'ma_statuscode', emptyText :'全部', editable:false, store: Ext.create('Ext.data.ArrayStore', { fields: ['ma_statuscode', 'ma_status'], data: [ ["ALL", "全部"], ["AUDITED", "已审核"], ["UNAUDITED", "未审核"] ] }), getCondition: function(value) { if(value == 'ALL') { return '1=1'; }else { return 'ma_statuscode=\'' + value + '\''; } } }, { xtype: 'employeeDbfindTrigger', name: 'creatorName', fieldLabel: '录入人', emptyText:'请输入账户名称或姓名', getCondition: function(value) { if(!value) { return '1=1'; }else { return 'make.creatorName like\'%' + value + '%\''; } } },{ xtype: 'condatefield', name: 'ma_planbegindate', fieldLabel: '计划开工日期', value:7, columnWidth: 1 },{ xtype: 'condatefield', name: 'ma_planenddate', fieldLabel: '计划完工日期', value:7, columnWidth: 1 },{ xtype: 'condatefield', name: 'make.createTime', fieldLabel: '录入日期', value:7, columnWidth: 1 }, { xtype: 'employeeDbfindTrigger', name: 'ma_auditman', fieldLabel: '审核人', emptyText:'请输入账户名称或姓名', }], queryGridConfig: { idField: 'ma_id', codeField: 'ma_code', mainIdField:'ma_id', detailIdField:'mm_id', addTitle: '制造单', addXtype: 'make-makebase-formpanel', baseVastUrl: me.baseVastUrl, turnQtyField: 'ma_thisqty', caller: me.caller, useGridCaller: true, //使用grid的caller defaultCondition:me.defaultCondition, toolBtns: [{ text: '转领料', xtype: 'button', handler: 'turnSetPick' }], baseColumn: [{ text: 'id', dataIndex: 'ma_id', hidden: true, xtype: 'numbercolumn' },{ text: '本次套数', align: 'center', dataIndex: 'ma_thisqty', xtype: 'widgetcolumn', width: 110, renderer : function(val, meta, record, x, y, store, view) { var data = record.data; v = data.ma_qty-data.ma_turnsetqty; if(!val){ val=v; } //工单数量ma_qty -已转齐套数 ma_turnsetqty record.data['ma_thisqty'] = val; return val; }, widget: { xtype: "numberfield", cls:'widget-number', bind: '{record.ma_thisqty}', decimalPrecision: 6, minValue: 0, listeners:{ blur: function(f ,event, e){ var record = f.lookupViewModel().data.record; if(record){ var v=saas.util.NumberUtil.accSub(record.get('ma_qty'),record.get('ma_turnsetqty')), val = record.get('ma_thisqty'); if(!val){ val=v; } var maxValue=saas.util.NumberUtil.accSub(record.get('ma_qty'),record.get('ma_turnsetqty')); val =Ext.Number.from(val,maxValue); if(val> maxValue){ val = maxValue; saas.util.BaseUtil.showErrorToast('请不要输入超过最大数量' + maxValue + "的值!"); } record.set('ma_thisqty', val); //每日产能不为0时,领料天数默认为 round(本次套数/每日产能,2) var data = record.data; if(null != data.ma_prdailycapacity && data.ma_prdailycapacity >0){ record.set('getDays',(data.ma_thisqty/data.ma_prdailycapacity).toFixed(2)); }else{ record.set('getDays',0); } } } } } },{ text: '领料天数', dataIndex: 'getDays', xtype: 'widgetcolumn', renderer:function(val, meta, record, x, y, store, view) { var data = record.data; //每日产能不为0时,领料天数默认为 round(本次套数/每日产能,2) if(null != data.ma_prdailycapacity && data.ma_prdailycapacity >0){ val = (data.ma_thisqty/data.ma_prdailycapacity).toFixed(2); }else{ val = 0; } record.set('getDays',val); return val; }, widget: { xtype: "numberfield", cls:'widget-number', bind: '{record.getDays}', decimalPrecision: 6, minValue: 0, listeners:{ blur: function(f ,event, e){ var record = f.lookupViewModel().data.record; if(record){ //输入领料天数则自动计算本次套料(本次套料=min(floor(领料天数*每日产能,1),(工单数量-已转套料数))) if(null != data.ma_prdailycapacity && data.ma_prdailycapacity >0){ var data = record.data; var dayThis = Math.floor(data.getDays*data.ma_prdailycapacity * 10) / 10; var v = saas.util.NumberUtil.accSub(data.ma_qty,data.ma_turnsetqty); if(dayThis > v){ record.set('ma_thisqty', v); }else{ record.set('ma_thisqty', dayThis); } } } }, } } },{ text: '每日产能', dataIndex: 'ma_prdailycapacity', xtype: 'numbercolumn', align: 'center', width: 110, renderer : function(val, meta, record, x, y, store, view) { return saas.util.BaseUtil.numberFormat(val, 6, true); }, },{ text: 'id', dataIndex: 'ma_id', hidden: true, xtype: 'numbercolumn' },{ text: '工单数量', align: 'center', dataIndex: 'ma_qty', xtype: 'numbercolumn', width: 110, renderer : function(v, m, r) { return saas.util.BaseUtil.numberFormat(v, 6, true); }, },{ text: '已转套料数', align: 'center', dataIndex: 'ma_turnsetqty', width: 110 },{ text: '已领齐套数', align: 'center', dataIndex: 'ma_setqty', width: 110 },{ text: '销售单号', dataIndex: 'ma_salecode', width: 0 }, { text: '制造单号', dataIndex: 'ma_code', width: 150 }, { text: '客户名称', dataIndex: 'ma_custname', width: 150 }, { text: '交货日期', align: 'center', dataIndex: 'ma_delivery', width: 100, xtype:'datecolumn' },{ text: '产品编号', dataIndex: 'ma_prodcode', width: 150 },{ text: '产品名称', dataIndex: 'ma_prdetail', width: 150 },{ text: '产品型号', dataIndex: 'ma_prorispeccode', width: 150, renderer : saas.util.RenderUtil['renderer_makeprod'] },{ text: '已完工数', align: 'center', dataIndex: 'ma_madeqty', xtype: 'numbercolumn', width: 110, renderer : function(v, m, r) { return saas.util.BaseUtil.numberFormat(v, 6, true); }, },{ text: '已转完工数', align: 'center', dataIndex: 'ma_turnmadeqty', xtype: 'numbercolumn', width: 110, renderer : function(v, m, r) { return saas.util.BaseUtil.numberFormat(v, 6, true); }, },{ text: '可完工数', align: 'center', dataIndex: 'ma_canmadeqty', xtype: 'numbercolumn', width: 110, renderer : function(v, m, r) { return saas.util.BaseUtil.numberFormat(v, 6, true); }, },{ text: '制造类型', dataIndex: 'ma_kind', width: 100, },{ text: '工作中心', dataIndex: 'ma_wcname', width: 100, },{ text: '审核状态', dataIndex: 'ma_status', width: 100, },{ text: '领料状态', dataIndex: 'ma_getstatus', width: 100, },{ text: '完工状态', dataIndex: 'ma_finishstatus', width: 100, },{ text: '制单人', dataIndex: 'creatorName', width: 100, },{ text: '计划开工日期', dataIndex: 'ma_planbegindate', width: 130, xtype:'datecolumn' },{ text: '计划完工日期', dataIndex: 'ma_planenddate', width: 130, xtype:'datecolumn' },{ text: '备注', dataIndex: 'ma_remark', width: 100 }], relativeColumn: [] } }); this.callParent(arguments); }, });