| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396 |
- Ext.define('saas.view.stock.make.FormPanel', {
- extend: 'saas.view.core.form.FormPanel',
- xtype: 'stock-make-formpanel',
- controller: 'stock-make-formpanel',
- viewModel: 'stock-make-formpanel',
- viewName: 'stock-make-formpanel',
- caller:'Make',
-
- //字段属性
- _title:'制造单',
- _idField: 'id',
- _codeField: 'ma_code',
- _statusField: 'ma_status',
- _statusCodeField: 'ma_statuscode',
- _auditmanField: 'ma_auditman',
- _auditdateField:'ma_auditdate',
- _relationColumn: 'mm_maid',
- _readUrl:'/api/storage/make/read',
- _saveUrl:'/api/storage/make/save',
- _auditUrl:'/api/storage/make/audit',
- _unAuditUrl: '/api/storage/make/unAudit',
- _deleteUrl:'/api/storage/make/delete',
- _getBomUrl:'/api/document/bom/read',
- initId:0,
-
- toolBtns: [],
- defaultItems: [{
- xtype: 'hidden',
- name: 'id',
- fieldLabel: 'id',
- columnWidth: 0
- },{
- xtype: 'combobox',
- name: 'ma_type',
- allowBlank : false,
- columnWidth: 0.25,
- fieldLabel: '类型',
- queryMode: 'local',
- displayField: 'name',
- valueField: 'value',
- editable:false,
- allowBlank : false,
- store: Ext.create('Ext.data.ArrayStore', {
- fields: ['name', 'value'],
- data: [
- ["拆件", "拆件"],
- ["组装", "组装"],
- ]
- })
- },{
- xtype: 'hidden',
- name: 'ma_prodid',
- fieldLabel: '产品id'
- },{
- xtype : "bomDbfindTrigger",
- name : "ma_prodcode",
- fieldLabel : "产品编号",
- allowBlank : false,
- columnWidth: 0.25
- },{
- xtype : "textfield",
- name : "ma_proddetail",
- fieldLabel : "产品名称",
- readOnly:true,
- columnWidth: 0.25
- },{
- xtype : "textfield",
- name : "ma_prodorispec",
- fieldLabel : "产品型号",
- readOnly:true,
- columnWidth: 0.25,
- },{
- xtype : "textfield",
- name : "ma_prodspec",
- fieldLabel : "产品规格",
- readOnly:true,
- columnWidth: 0.25,
- },{
- xtype : "textfield",
- name : "ma_produnit",
- fieldLabel : "单位",
- readOnly:true,
- columnWidth: 0.25
- },{
- xtype : "textfield",
- name : "ma_version",
- fieldLabel : "版本号",
- readOnly:true,
- columnWidth: 0.25
- },
- {
- xtype : "numberfield",
- name : "ma_qty",
- fieldLabel : "数量",
- columnWidth: 0.25,
- allowBlank : false,
- decimalPrecision:3,
- vtype: 'positiveNumber',
- },{
- xtype : "hidden",
- name : "ma_whid",
- fieldLabel : "仓库id"
- },{
- xtype : "hidden",
- name : "ma_whcode",
- fieldLabel : "仓库编号"
- },{
- xtype : "warehouseDbfindTrigger",
- name : "ma_whname",
- fieldLabel : "仓库名称",
- allowBlank : false,
- columnWidth: 0.25
- },{
- xtype : "numberfield",
- name : "ma_price",
- fieldLabel : "单价(元)",
- readOnly:true,
- editable:false,
- decimalPrecision:4,
- columnWidth: 0.25
- },{
- xtype : "numberfield",
- name : "ma_total",
- readOnly:true,
- editable:false,
- fieldLabel : "金额",
- decimalPrecision:2,
- columnWidth: 0.25
- },
- {
- name : "detailGridField",
- xtype : "detailGridField",
- storeModel:'saas.model.stock.Makematerial',
- detnoColumn: 'mm_detno',
- deleteDetailUrl:'/api/storage/make/deleteDetail',
- columns : [
- {
- text : "id",
- dataIndex : "id",
- xtype : "numbercolumn",
- hidden:true
- }, {
- text : "mm_prodidid",
- dataIndex : "mm_prodid",
- xtype : "numbercolumn",
- hidden:true
- }, {
- text : "物料编号",
- width : 150.0,
- dataIndex : "mm_prodcode",
- allowBlank : false,
- xtype : "",
- items : null,
- editor : {
- displayField : "display",
- editable : true,
- format : "",
- hideTrigger : false,
- maxLength : 100.0,
- minValue : null,
- positiveNum : false,
- queryMode : "local",
- store : null,
- valueField : "value",
- xtype : "productMultiDbfindTrigger"
- }
- }, {
- text: 'model映射需要',
- dataIndex: 'productDTO',
- hidden: true,
- }, {
- text : "品牌",
- width : 100.0,
- dataIndex : "pr_brand",
- ignore:true,
- renderer: function (v, m, r) {
- if(!v){
- return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null;
- }
- return v;
- }
- }, {
- text : "物料名称",
- width : 200.0,
- dataIndex : "pr_detail",
- ignore:true,
- renderer: function (v, m, r) {
- if(!v){
- return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null;
- }
- return v;
- }
- }, {
- text : "型号",
- width : 200.0,
- dataIndex : "pr_orispeccode",
- ignore:true,
- renderer: function (v, m, r) {
- if(!v){
- return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null;
- }
- return v;
- }
- },{
- text : "规格",
- width : 200,
- dataIndex : "pr_spec",
- ignore:true,
- renderer: function (v, m, r) {
- if(!v){
- return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null;
- }
- return v;
- }
- },{
- text : "需求数量",
- xtype: 'numbercolumn',
- dataIndex : "mm_qty",
- width : 110.0,
- editor : {
- xtype : "numberfield",
- decimalPrecision: 3,
- minValue:0
- },
- renderer : function(v) {
- return saas.util.BaseUtil.numberFormat(v, 3, false);
- },
- summaryType: 'sum',
- summaryRenderer: function(v) {
- return saas.util.BaseUtil.numberFormat(v, 3, false);
- }
- }, {
-
- text : "单位用量",
- xtype: 'numbercolumn',
- dataIndex : "mm_oneuseqty",
- hidden:true,
- renderer : function(v) {
- return saas.util.BaseUtil.numberFormat(v, 3, false);
- },
- }, {
- text : "单位",
- dataIndex : "pr_unit",
- width : 65.0,
- ignore:true,
- renderer: function (v, m, r) {
- if(!v){
- return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null;
- }
- return v;
- }
- }, {
- text : "仓库id",
- dataIndex : "mm_whid",
- xtype : "numbercolumn",
- hidden:true
- }, {
- text : "仓库编号",
- dataIndex : "mm_whcode",
- hidden:true
- }, {
- text : "仓库",
- dataIndex : "mm_whname",
- width : 80.0,
- items : null,
- allowBlank : false,
- editor : {
- displayField : "display",
- editable : true,
- format : "",
- hideTrigger : false,
- maxLength : 100.0,
- minValue : null,
- positiveNum : false,
- queryMode : "local",
- store : null,
- valueField : "value",
- xtype : "warehouseDbfindTrigger"
- }
- }, {
- text : "成本单价(元)",
- dataIndex : "mm_price",
- xtype: 'numbercolumn',
- width : 120.0,
- editor : {
- xtype : "numberfield",
- decimalPrecision: 4,
- minValue:0
- },
- listeners:{
- edit:'price_change'
- },
- renderer : function(v) {
- return saas.util.BaseUtil.numberFormat(v, 4, true);
- }
- }, {
- text : "成本金额(元)",
- xtype: 'numbercolumn',
- dataIndex : "mm_amount",
- width : 120.0,
- editor : {
- xtype : "numberfield",
- decimalPrecision: 2,
- editable : false
- },
- renderer : function(v) {
- return saas.util.BaseUtil.numberFormat(v, 2, true);
- },
- summaryType: 'sum',
- summaryRenderer: function(v) {
- return saas.util.BaseUtil.numberFormat(v, 2, true);
- }
- }, {
- text : "备注",
- dataIndex : "mm_remark",
- width : 250,
- editor : {
- xtype : "textfield"
- },
- }]
- },{
- xtype : "hidden",
- name : "creatorId",
- fieldLabel : "录入人ID",
- readOnly:true
- },
- {
- xtype : "textfield",
- name : "creatorName",
- fieldLabel : "录入人",
- readOnly:true
- }, {
- xtype : "datefield",
- name : "createTime",
- fieldLabel : "录入日期",
- readOnly:true,
- defaultValue: new Date()
- },{
- xtype : "hidden",
- name : "updaterId",
- fieldLabel : "更新人ID",
- readOnly:true
- },{
- xtype : "hidden",
- name : "updaterName",
- fieldLabel : "更新人",
- readOnly:true
- }, {
- xtype : "hidden",
- name : "updateTime",
- fieldLabel : "更新日期",
- readOnly:true,
- defaultValue: new Date()
- }, {
- xtype : "textfield",
- name : "ma_auditman",
- fieldLabel : "审核人",
- readOnly:true
- }, {
- xtype : "datefield",
- name : "ma_auditdate",
- fieldLabel : "审核日期",
- readOnly:true
- }],
- beforeAudit:function(){
- var me = this,
- controller = me.getController(),
- viewModel = me.getViewModel(),
- grid = me.down('detailGridField'),
- data = grid.getTrueData(),
- str='',
- type = viewModel.get('ma_type');
- if ('拆件' == type) {
- Ext.Array.each(data,function(item){
- if(item.mm_price==0){
- str=str+item.mm_detno+'行'+item.mm_prodcode+'物料成本单价为0!'+'<br>'
- }
- });
- }
- if(str!=''){
- saas.util.BaseUtil.showConfirm('提示',str)
- .then(function(y) {
- if(y == 'yes') {
- controller.audit();
- }
- });
- }else{
- controller.audit();
- }
- return false;
- }
- });
|