123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315 |
- Ext.define('make.view.osmake.osMakePick.FormPanelController', {
- extend: 'saas.view.core.form.FormPanelController',
- alias: 'controller.osmake-osmakepick-formpanel',
- init: function (form) {
- var me = this;
- this.control({
- //放大镜赋值关系 以及 tpl模板
- 'dbfindtrigger[name=pi_vendname]':{
- beforerender:function(f){
- Ext.apply(f,{
- dbfinds:[{
- from:'id',to:'pi_vendid',ignore:true
- },{
- from:'ve_code',to:'pi_vendcode'
- },{
- from:'ve_name',to:'pi_vendname'
- },{
- from:'ve_buyerid',to:'pi_buyerid'
- },{
- from:'ve_buyercode',to:'pi_buyercode'
- },{
- from:'ve_buyername',to:'pi_buyername'
- },{
- from:'ve_currency',to:'pi_currency'
- },{
- from:'cr_rate',to:'pi_rate'
- },{
- from:'vc_name',to:'pi_contact'
- },{
- from:'vc_tel',to:'pi_tel'
- },{
- from:'ve_paymentsid',to:'pi_paymentsid'
- },{
- from:'ve_paymentscode',to:'pi_paymentscode'
- },{
- from:'ve_payments',to:'pi_payments'
- },{
- from:'ve_taxrate',to:'pi_taxrate'
- }],
- }) ;
- }
- },
- //从表多选放大镜赋值关系 以及 tpl模板
- 'multidbfindtrigger[name=pd_prodcode]':{
- beforerender:function(f){
- Ext.apply(f,{
- //放大镜赋值设置
- dbfinds:[{
- from:'id',to:'pd_prodid',ignore:true
- },{
- from:'pr_code',to:'pd_prodcode'
- },{
- from:'pr_detail',to:'pr_detail'
- },{
- from:'pr_spec',to:'pr_spec'
- },{
- from: 'pr_brand', to: 'pr_brand'
- },{
- from: 'pr_orispeccode', to: 'pr_orispeccode'
- },{
- from: 'pr_unit', to: 'pr_unit'
- }, {
- from:'pr_purcprice',to:'pd_lastprice'
- },{
- from:'pr_zxbzs',to:'pr_zxbzs'
- }],
- });
- }
- },
- 'multidbfindtrigger[name=pr_detail]': {
- beforerender: function (f) {
- Ext.apply(f, {
- dbfinds:[{
- from:'id',to:'pd_prodid',ignore:true
- },{
- from:'pr_code',to:'pd_prodcode'
- },{
- from:'pr_detail',to:'pr_detail'
- },{
- from:'pr_spec',to:'pr_spec'
- },{
- from: 'pr_brand', to: 'pr_brand'
- },{
- from: 'pr_orispeccode', to: 'pr_orispeccode'
- },{
- from: 'pr_unit', to: 'pr_unit'
- }, {
- from:'pr_purcprice',to:'pd_lastprice'
- },{
- from:'pr_zxbzs',to:'pr_zxbzs'
- }],
- });
- }
- },
- 'dbfindtrigger[name=pd_whname]':{
- beforerender:function(f){
- Ext.apply(f,{
- dbfinds:[{
- from:'id',to:'pd_whid',ignore:true
- }, {
- from:'wh_code',to:'pd_whcode'
- }, {
- from:'wh_description',to:'pd_whname'
- }]
- }) ;
- },
- beforequery: function(f) {
- var me = this,
- viewModel = me.getViewModel();
- var s= f.ownerCt.ownerCmp.getSelectionModel(),
- id = s.lastSelected.id,
- record = s.store.getById(id),
- pd_prodid = record.get("pd_prodid");
- if(pd_prodid) {
- Ext.apply(f, {
- efaultCondition:"wh_statuscode='ENABLE' and (pw_prodid ="+pd_prodid+" OR IFNULL(pw_prodid,-1) = -1)",
- queryListMode:'OUT',
- dbColumns: [{
- text: "仓库ID",
- flex: 0,
- dataIndex: "id",
- hidden:true
- }, {
- text: "仓库编号",
- dataIndex: "wh_code",
- width: 150
- }, {
- text: "仓库名称",
- dataIndex: "wh_description",
- width: 200
- }, {
- text: "仓库类型",
- dataIndex: "wh_type",
- width: 110
- }, {
- text: "库存",
- dataIndex: "pw_onhand",
- width: 100,
- xtype: 'numbercolumn',
- renderer : function(v, m, r) {
- return saas.util.BaseUtil.numberFormat(v, 6, true);
- }
- }, {
- dataIndex: '',
- flex: 1
- }]
- });
- }else{
- Ext.apply(f, {
- efaultCondition:"wh_statuscode='ENABLE'",
- queryListMode:'',
- dbColumns: [{
- text: "仓库ID",
- flex: 0,
- dataIndex: "id",
- hidden:true
- }, {
- text: "仓库编号",
- dataIndex: "wh_code",
- width: 150
- }, {
- text: "仓库名称",
- dataIndex: "wh_description",
- width: 200
- }, {
- text: "仓库类型",
- dataIndex: "wh_type",
- width: 110
- }, {
- dataIndex: '',
- flex: 1
- }]
- });
- }
- },
- beforetriggerclick: function(f) {
- var me = this,
- viewModel = me.getViewModel();
- var s= f.ownerCt.ownerCmp.getSelectionModel(),
- id = s.lastSelected.id,
- record = s.store.getById(id),
- pd_prodid = record.get("pd_prodid");
- if(pd_prodid) {
- Ext.apply(f, {
- defaultCondition:"wh_statuscode='ENABLE' and (pw_prodid ="+pd_prodid+" OR IFNULL(pw_prodid,-1) = -1)",
- queryListMode:'OUT',
- dbColumns: [{
- text: "仓库ID",
- flex: 0,
- dataIndex: "id",
- hidden:true
- }, {
- text: "仓库编号",
- dataIndex: "wh_code",
- width: 150
- }, {
- text: "仓库名称",
- dataIndex: "wh_description",
- width: 200
- }, {
- text: "仓库类型",
- dataIndex: "wh_type",
- width: 110
- }, {
- text: "库存",
- dataIndex: "pw_onhand",
- width: 100,
- xtype: 'numbercolumn',
- renderer : function(v, m, r) {
- return saas.util.BaseUtil.numberFormat(v, 6, true);
- }
- }, {
- dataIndex: '',
- flex: 1
- }]
- });
- }else{
- Ext.apply(f, {
- defaultCondition:"wh_statuscode='ENABLE'",
- queryListMode:'',
- dbColumns: [{
- text: "仓库ID",
- flex: 0,
- dataIndex: "id",
- hidden:true
- }, {
- text: "仓库编号",
- dataIndex: "wh_code",
- width: 150
- }, {
- text: "仓库名称",
- dataIndex: "wh_description",
- width: 200
- }, {
- text: "仓库类型",
- dataIndex: "wh_type",
- width: 110
- }, {
- dataIndex: '',
- flex: 1
- }]
- });
- }
- }
- }
- });
- },
- /**
- * 生成退料单
- */
- turnMakeRet: function(){
- var me = this,
- form = me.getView(),
- id = form.getForm().findField(form._idField);
- form.setLoading(true);
- saas.util.BaseUtil.request({
- url: form._turnMakeRet + '/' + id.value,
- method: 'POST',
- })
- .then(function (localJson) {
- form.setLoading(false);
- if (localJson.success) {
- var intValue = localJson.data.id,
- codeValue = localJson.data.code,
- name = '外协退料';
- saas.util.BaseUtil.openTab('osmake-osmakereturn-formpanel', name + "(" + codeValue + ")", codeValue + intValue, {
- initId: intValue
- });
- saas.util.BaseUtil.showSuccessToast('转单成功');
- saas.util.FormUtil.loadData(form);
- }
- })
- .catch(function (e) {
- form.setLoading(false);
- saas.util.BaseUtil.showErrorToast('转单失败: ' + e.message);
- });
- },
- /**
- * 生成退料单
- */
- turnScrap: function(){
- var me = this,
- form = me.getView(),
- id = form.getForm().findField(form._idField);
- form.setLoading(true);
- saas.util.BaseUtil.request({
- url: form._turnScrap + '/' + id.value,
- method: 'POST',
- })
- .then(function (localJson) {
- form.setLoading(false);
- if (localJson.success) {
- var intValue = localJson.data.id,
- codeValue = localJson.data.code,
- name = '外协报废';
- saas.util.BaseUtil.openTab('osmake-osmakescrap-formpanel', name + "(" + codeValue + ")", codeValue + intValue, {
- initId: intValue
- });
- saas.util.BaseUtil.showSuccessToast('转单成功');
- saas.util.FormUtil.loadData(form);
- }
- })
- .catch(function (e) {
- form.setLoading(false);
- saas.util.BaseUtil.showErrorToast('转单失败: ' + e.message);
- });
- }
- });
|