12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- /**
- * 自动获取包装箱号的trigger
- */
- Ext.define('erp.view.core.trigger.BoxCodeTrigger', {
- extend: 'Ext.form.field.Trigger',
- alias: 'widget.boxcodetrigger',
- triggerCls: 'x-form-autocode-trigger',
- afterrender: function() {
- this.addEvent({
- 'beforetrigger': true
- });
- },
- onTriggerClick: function() {
- warnMsg('确定生成包装箱号?', function(btn){
- if(btn == 'yes'){
- var pa_totalqty = Ext.getCmp("pa_totalqty").value, mc_makecode = Ext.getCmp("mc_makecode").value,
- mc_prodcode = Ext.getCmp("mc_prodcode").value , pr_id = Ext.getCmp("pr_id").value,
- sc_code = Ext.getCmp("sc_code").value,result = Ext.getCmp('t_result');
- if(Ext.isEmpty(sc_code)){
- showError('请先指定资源编号!');
- return ;
- }else if(Ext.isEmpty(mc_makecode)){
- showError('请先指定制造单号!');
- return ;
- }else if(Ext.isEmpty(pa_totalqty) || pa_totalqty == 0 || pa_totalqty == '0'){
- showError("箱内容量不允许为空或者零!");
- return ;
- }
- Ext.Ajax.request({//拿到grid的columns
- url : basePath + "pm/mes/generatePackage.action",
- params: {
- pa_totalqty : pa_totalqty, //箱内容量
- pa_prodcode : mc_prodcode, //物料编号
- pr_id : pr_id, //物料ID
- pa_makecode : mc_makecode //制造单号
- },
- method : 'post',
- callback : function(options,success,response){
- var res = new Ext.decode(response.responseText);
- if(res.exceptionInfo){
- result.append(res.exceptionInfo,'error');
- showError(res.exceptionInfo);return;
- }
- var data = res.data;
- if(data ){//设置包装箱号
- result.append('生成箱号:'+data['pa_code']+'成功!');
- Ext.MessageBox.alert('系统提示', '生成箱号成功!');
- Ext.getCmp("pa_code").setValue(data.pa_code);
- Ext.getCmp("pa_restqty").setValue(data['pa_totalqty']);
- }
- }
- });
- } else {
- return;
- }
- });
- }
- });
|