Przeglądaj źródła

客户采购单

zhuth 6 lat temu
rodzic
commit
0622fe0667

+ 13 - 0
frontend/saas-web/app/model/sale/b2b/PurchaseDetail.js

@@ -0,0 +1,13 @@
+Ext.define('saas.model.sale.b2b.PurchaseDetail', {
+    extend: 'saas.model.Base',
+
+    fields: [
+        { name: 'id', type: 'int' }, // id
+        { name: 'sd_prodid', type: 'int' }, // 物料id
+        { name: 'sd_prodcode', type: 'string' }, // 物料编号
+        { name: 'sd_proddetail', type: 'string' }, // 物料名称
+        { name: 'sd_proddbrand', type: 'string' }, // 品牌
+        { name: 'sd_orispeccode', type: 'string' }, // 型号
+        { name: 'sd_prodspec', type: 'string' }, // 规格
+    ],
+});

+ 6 - 0
frontend/saas-web/app/view/document/uusetting/UUSettingController.js

@@ -68,8 +68,14 @@ Ext.define('saas.view.document.uusetting.UUSettingController', {
             kind: kind
         };
         if(kind == 'vendorkind') {
+            if(!!record.get('ve_uu')) {
+                return;
+            }
             config.cname = record.get('ve_name');
         }else {
+            if(!!record.get('cu_uu')) {
+                return;
+            }
             config.cname = record.get('cu_name');
         }
         this.getViewModel().setData(record.data);

+ 203 - 0
frontend/saas-web/app/view/sale/b2b/Purchase.js

@@ -0,0 +1,203 @@
+/**
+ * 客户采购单
+ */
+Ext.define('saas.view.sale.b2b.Purchase', {
+    extend: 'saas.view.core.base.BasePanel',
+    xtype: 'sale-b2b-purchase',
+
+    // controller: 'sale-b2b-purchase',
+    // viewModel: 'sale-b2b-purchase',
+    viewName: 'sale-b2b-purchase',
+
+
+    // dataUrl: 'http://10.1.80.35:8560/api/sale/saledown/list',
+    dataUrl: '/api/sale/saledown/list',
+    initComponent: function() {
+        var me = this;
+        Ext.apply(this, {
+            searchField: [{
+                xtype: 'textfield',
+                name: 'keyword',
+                columnWidth: 0.15,
+                emptyText:'请输入供应商名称'
+            }, {
+                xtype: 'condatefield',
+                name: 'date',
+                fieldLabel: '日期',
+                columnWidth: 0.5,
+                labelWidth: 50,
+            }, {
+                xtype: 'textfield',
+                name: 'keyword',
+                labelWidth: 0,
+                columnWidth: 0.15,
+                emptyText: '销售单号'
+            }, {
+                xtype: 'checkbox',
+                name: 'status',
+                fieldLabel: '已结案',
+                columnWidth: 0.1,
+                labelWidth: 50,
+                getCondition: function(v) {
+                    if(v) {
+                        return 'status=' + Number(v);
+                    }else {
+                        return '1=1';
+                    }
+                }
+            }, {
+                xtype: 'checkbox',
+                name: 'status',
+                fieldLabel: '待出货',
+                columnWidth: 0.1,
+                labelWidth: 50,
+                getCondition: function(v) {
+                    if(v) {
+                        return 'status=' + Number(v);
+                    }else {
+                        return '1=1';
+                    }
+                }
+            }],
+        
+            caller: null,
+            _formXtype: null,
+            _title: null,
+            _deleteUrl: null,
+            _batchOpenUrl: null,
+            _batchCloseUrl: null,
+            _batchDeleteUrl: null,
+        
+            gridConfig: {
+                idField: null,
+                codeField: null,
+                statusCodeField: null,
+                dataUrl: me.dataUrl,
+                caller: null,
+                rootProperty: 'data.list',
+                totalProperty: 'data.total',
+                actionColumn: [],
+                selModel: {
+                    type: 'cellmodel'
+                },
+                hiddenTools: true,
+                data: [{
+
+                }],
+                columns : [{
+                    text: 'ID',
+                    dataIndex: 'id',
+                    hidden: true,
+                    width: 100
+                }, {
+                    text: '转单状态',
+                    dataIndex: 'sa_trunstatus',
+                    width: 100,
+                    textAlign: 'center'
+                }, {
+                    text: '客户PO',
+                    dataIndex: 'sa_pocode',
+                    width: 160
+                }, {
+                    text: '订单日期',
+                    xtype: 'datecolumn',
+                    dataIndex: 'createTime',
+                    width: 160,
+                    format: 'Y-m-d H:i:s'
+                }, {
+                    text: '客户编号',
+                    dataIndex: 'sa_custcode',
+                    width: 120
+                }, {
+                    text: '客户名称',
+                    dataIndex: 'sa_custname',
+                    width: 200
+                }, {
+                    text: '销售单号',
+                    dataIndex: 'sa_salecode',
+                    width: 120
+                }, {
+                    text: '出货状态',
+                    dataIndex: 'sa_sendstatus',
+                    textAlign: 'center'
+                }, {
+                    text: '交货地址',
+                    dataIndex: 'sa_toplace',
+                    width: 250
+                }],
+                listeners: {
+                    itemclick: function(view, record, item, index, e, eOpts) {
+                        saas.util.BaseUtil.openTab('sale-b2b-purchasedetail', '客户采购单', 'sale-b2b-purchasedetail'+record.id, {
+                            initId: record.get('id')
+                        }); 
+                    }
+                }
+            },
+        });
+        this.callParent(arguments);
+    },
+
+    /**
+     * 处理部分字段值
+     */
+    getConditionValue: function (field, value) {
+        var me = this,
+            xtypes = field.getXTypes().split('/'),
+            conditionValue;
+        if (me.isContainsAny(xtypes, ['datefield'])) {
+            conditionValue = Ext.Date.format(new Date(from), 'Y-m-d H:i:s');
+        } else if (me.isContainsAny(xtypes, ['conmonthfield'])) {
+            var from = value.from,
+                to = value.to;
+
+            conditionValue = from + ',' + to;
+        } else if (me.isContainsAny(xtypes, ['condatefield'])) {
+            var from = value.from,
+                to = value.to;
+
+            conditionValue = Ext.Date.format(new Date(from), 'Y-m-d 00:00:00') + ',' + Ext.Date.format(new Date(to), 'Y-m-d 23:59:59');
+        } else if (me.isContainsAny(xtypes, ['dbfindtrigger'])) {
+            conditionValue = value;
+        } else if (me.isContainsAny(xtypes, ['combobox', 'combo'])) {
+            conditionValue = value;
+        } else if (me.isContainsAny(xtypes, ['multicombo'])) {
+            conditionValue = value.map ? value.map(function (v) {
+                return v.value;
+            }).join(',') : '';
+        } else {
+            conditionValue = value;
+        }
+
+        return conditionValue;
+    },
+
+    getExtraParams: function(store, op, condition) {
+        var temp = {};
+
+        for(let x = 0; x < condition.length; x++) {
+            let c = condition[x];
+            if(c.field == 'keyword') {
+                temp.keyword = c.value;
+            }else if(c.field == 'date') {
+                temp.fromDate = new Date(c.value.split(',')[0]).getTime();
+                temp.endDate = new Date(c.value.split(',')[1]).getTime();
+            }else if(c.field == 'quoted') {
+                temp.quoted = c.value == 'all' ? null : c.value;
+            }else if(c.field == 'closed') {
+                // temp.endDate = c.value == 'all' ? null : (
+                //     c.value == '0' ? 
+                // );
+            }
+        }
+        let obj = {
+            pageNumber: store.exportNumber?store.exportNumber:op._page,
+            pageSize: store.exportPageSize?store.exportPageSize:store.pageSize
+        };
+        for(let k in temp) {
+            if(!!temp[k]) {
+                obj[k] = temp[k];
+            }
+        }
+        return obj;
+     },
+});

+ 236 - 0
frontend/saas-web/app/view/sale/b2b/PurchaseDetail.js

@@ -0,0 +1,236 @@
+Ext.define('saas.view.sale.b2b.PurchaseDetail', {
+    extend: 'saas.view.core.form.FormPanel',
+    xtype: 'sale-b2b-purchasedetail',
+
+    controller: 'sale-b2b-purchasedetail',
+    viewModel: 'sale-b2b-purchasedetail',
+
+    viewName: 'sale-b2b-purchasedetail',
+
+    //字段属性
+    _title: '客户采购单',
+    _idField: 'id',
+    _codeField: 'sa_code',
+    _statusField: null,
+    _statusCodeField: null,
+    _auditmanField: 'sa_auditman',
+    _auditdateField: 'sa_auditdate',
+    _relationColumn: 'sd_puid',
+    // _readUrl: 'http://10.1.80.35:8560/api/sale/saledown/read',
+    _readUrl: '/api/sale/saledown/read',
+    // _saveUrl: 'http://10.1.80.35:8560/api/sale/saledown/update',
+    _saveUrl: '/api/sale/saledown/update',
+    // _toSaleUrl: 'http://10.1.80.35:8560/api/sale/saledown/toSale',
+    _toSaleUrl: '/api/sale/saledown/toSale',
+    initId: 0,
+
+    codeInHeader: false,
+
+    initComponent: function () {
+        Ext.apply(this, {
+            defaultItems: [{
+                xtype: 'textfield',
+                name: 'sa_pocode',
+                fieldLabel: '客户PO',
+                readOnly: true
+            }, {
+                xtype: "datefield",
+                name: "createTime",
+                fieldLabel: "单据日期",
+                readOnly: true
+            }, {
+                xtype: 'condbfindtrigger',
+                fieldLabel: '币别汇率',
+                allowBlank: false,
+                readOnly: true,
+                dbType: 'currencyDbfindTrigger',
+                dbfinds: [{
+                    from: 'cr_name', to: 'sa_currency'
+                }, {
+                    from: 'cr_rate', to: 'sa_rate'
+                }],
+                supFieldConfig: {
+                    xtype: 'numberfield',
+                    readOnly: false,
+                    defaultReadOnly: false,
+                    defaultValue: 1,
+                    decimalPrecision: 6,
+                    vtype: 'positiveNumber'
+                }
+            }, {
+                name: "sa_status",
+                xtype: "textfield",
+                fieldLabel: "单据状态",
+                readOnly: true
+            }, {
+                xtype: 'textfield',
+                name: 'sa_custname',
+                fieldLabel: '客户名称',
+                columnWidth: 0.5,
+                readOnly: true
+            }, {
+                xtype: 'textfield',
+                name: 'sa_toplace',
+                fieldLabel: '交货地址',
+                columnWidth: 0.5,
+                readOnly: true
+            }, {
+                name: "detailGridField",
+                xtype: "detailGridField",
+                detnoColumn: 'sd_detno',
+                storeModel: 'saas.model.sale.b2b.PurchaseDetail',
+                deleteDetailUrl: '/api/sale/sale/deleteDetail',
+                allowEmpty: true,
+                columns: [{
+                    text: 'id',
+                    dataIndex: 'id',
+                    hidden: true,
+                }, {
+                    text: '物料id',
+                    dataIndex: 'sd_prodid',
+                    hidden: true
+                }, {
+                    text: "物料编号",
+                    width: 150.0,
+                    dataIndex: "sd_prodcode",
+                    allowBlank: false,
+                    editor: {
+                        displayField: "display",
+                        editable: true,
+                        format: "",
+                        hideTrigger: false,
+                        maxLength: 100.0,
+                        minValue: null,
+                        positiveNum: false,
+                        queryMode: "local",
+                        store: null,
+                        valueField: "value",
+                        xtype: "productDbfindTrigger",
+                        dbfinds: [{
+                            from: 'pr_code', to: 'sd_prodcode'
+                        }, {
+                            from: 'pr_detail', to: 'sd_proddetail'
+                        }, {
+                            from: 'pr_spec', to: 'sd_prodspec'
+                        },{
+                            from: 'pr_brand', to: 'sd_proddbrand'
+                        },{
+                            from: 'pr_orispeccode', to: 'sd_orispeccode'
+                        },{
+                            from: 'id', to: 'sd_prodid'
+                        }]
+                    }
+                }, {
+                    text: "物料名称",
+                    width: 150.0,
+                    dataIndex: "sd_proddetail"
+                }, {
+                    text: "品牌",
+                    width: 100.0,
+                    dataIndex: "sd_proddbrand"
+                }, {
+                    text: "型号",
+                    width: 200.0,
+                    dataIndex: "sd_orispeccode",
+                    ignore: true
+                }, {
+                    text: "规格",
+                    width: 200,
+                    dataIndex: "sd_prodspec"
+                }, {
+                    text: '客户料号',
+                    width: 120,
+                    dataIndex: 'sd_custprodcode',
+                }, {
+                    text: '客户型号',
+                    width: 120,
+                    dataIndex: 'sd_custorispeccode',
+                }, {
+                    text: '客户规格',
+                    dataIndex: 'sd_custprodspec',
+                    width: 120
+                }, {
+                    text: "数量",
+                    dataIndex: "sd_qty",
+                    width: 110.0,
+                    xtype: 'numbercolumn',
+                    allowBlank: false,
+                    renderer: function(v, m, r) {
+                        return saas.util.BaseUtil.numberFormat(v, 3, false);
+                    },
+                    summaryType: 'sum',
+                    summaryRenderer: function(v, d, f, m) {
+                        return saas.util.BaseUtil.numberFormat(v, 3, false);
+                    }
+                }, {
+                    text: "单位",
+                    width: 65.0,
+                    dataIndex: "sd_produnit",
+                    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: "sd_price",
+                    width: 120,
+                    renderer: function(v, m, r) {
+                        return saas.util.BaseUtil.numberFormat(v, 4, true);
+                    },
+                    listeners: {
+                        edit: function (value, grid) {
+                            var r = grid.getSelection()[0],
+                                sd_taxrate = r.get('sd_taxrate');
+                            var v = value / (1 + sd_taxrate / 100);
+                            r.set('sd_netprice', Number(saas.util.BaseUtil.numberFormat(v, 4, false)));
+                        }
+                    }
+                }, {
+                    text: "税率(%)",
+                    xtype: 'numbercolumn',
+                    dataIndex: "sd_taxrate",
+                    width: 80,
+                    renderer: function(v, m, r) {
+                        return saas.util.BaseUtil.numberFormat(v, 2, false);
+                    }
+                }, {
+                    text: "价税合计(元)",
+                    xtype: 'numbercolumn',
+                    dataIndex: "sd_total",
+                    width: 120,
+                    renderer: function(v, m, r) {
+                        return saas.util.BaseUtil.numberFormat(v, 2, true);
+                    },
+                    summaryType: 'sum',
+                    summaryRenderer: function(v, d, f, m) {
+                        return saas.util.BaseUtil.numberFormat(v, 2, true);
+                    }
+                }, {
+                    text: "交货日期",
+                    dataIndex: "sd_delivery",
+                    width: 110.0,
+                    xtype: 'datecolumn',
+                }, {
+                    text: "备注",
+                    dataIndex: "sd_remark",
+                    width: 250,
+                    items: null,
+                }]
+            }],
+            toolBtns: [{
+                xtype: 'button',
+                text: '转销售',
+                handler: 'turnSale',
+            }, {
+                xtype: 'button',
+                text: '更新',
+                handler: 'onSave',
+            }]
+        });
+        this.callParent();
+    },
+});

+ 29 - 0
frontend/saas-web/app/view/sale/b2b/PurchaseDetailController.js

@@ -0,0 +1,29 @@
+Ext.define('saas.view.sale.b2b.PurchaseDetailController', {
+    extend: 'saas.view.core.form.FormPanelController',
+    alias: 'controller.sale-b2b-purchasedetail',
+
+    turnSale: function() {
+        var me = this,
+        view = me.getView(),
+        viewModel = me.getViewModel(),
+        id = viewModel.get(view._idField);
+
+        view.setLoading(true);
+        saas.util.BaseUtil.request({
+            url: view._toSaleUrl + '/' + id,
+            method: 'POST'
+        })
+        .then(function(res) {
+            view.setLoading(false);
+            var id = res.data.id;
+            var code = res.data.code;
+            saas.util.BaseUtil.showSuccessToast('转单成功');
+            saas.util.BaseUtil.openTab('sale-sale-formpanel', '销售订单' + '(' + code + ')', 'sale-sale-formpanel-' + id, {
+                initId: id
+            } )
+        })
+        .catch(function(e) {
+            saas.util.BaseUtil.showErrorToast(e.message);
+        });
+    }
+});

+ 14 - 0
frontend/saas-web/app/view/sale/b2b/PurchaseDetailModel.js

@@ -0,0 +1,14 @@
+Ext.define('saas.view.sale.b2b.PurchaseDetailModel', {
+    extend: 'saas.view.core.base.BasePanelModel',
+    alias: 'viewmodel.sale-b2b-purchasedetail',
+
+    data: {
+        showAddBtn: false, // 显示新增按钮
+        showSaveBtn: false, // 显示保存按钮
+        showDeleteBtn: false, // 显示删除按钮
+        showCopyBtn: false, // 显示复制按钮
+        showAuditBtn: false, // 显示审核、反审核按钮
+        showPrintBtn: false, // 显示打印按钮
+        configurable: true, // 显示界面设置按钮
+    }
+});

+ 5 - 0
frontend/saas-web/resources/json/navigation.json

@@ -90,6 +90,11 @@
             "id": "sale-b2b-mybusiness",
             "text": "我的商机",
             "viewType": "sale-b2b-mybusiness"
+        }, {
+            "b2b":true,
+            "id": "sale-b2b-purchase",
+            "text": "客户采购单",
+            "viewType": "sale-b2b-purchase"  
         }]
     }, {
         "text": "报表",