zhao
2021-07-19 8347f2fbddbd25369359dcb2da1233ac48a19fdc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
@{
    ViewBag.Title = "Location";
    Layout = "~/Views/Shared/_LayoutVue.cshtml";
}
 
<div id="list" v-cloak>
    <el-card class="box-card">
        <el-form label-width="90px" v-bind:model="formData" class="demo-ruleForm" v-bind:inline="true">
            <el-form-item label="仓库名:">
                <hh-select-url v-model="formData.stockCode"
                               url="/Basic/Common/StockList"
                               valuefield="CN_S_STOCK_CODE"
                               textfield="CN_S_STOCK_NAME"
                               datafield="Data">
                </hh-select-url>
            </el-form-item>
            <el-form-item label="库区名:">
                <hh-select-url v-model="formData.stockArea"
                               v-bind:url="areaUrl"
                               valuefield="CN_S_AREA_CODE"
                               textfield="CN_S_AREA_NAME"
                               datafield="Data">
                </hh-select-url>
            </el-form-item>
            <el-form-item label="货位:">
                <el-input v-model="formData.locationCode" size="mini"></el-input>
            </el-form-item>
            <el-form-item label="货主:" prop="CN_S_OWNER">
                <hh-select-url v-model="formData.owner"
                               url="/Basic/Common/GetOwner"
                               valuefield="CN_S_OWNER"
                               textfield="CN_S_OWNER"
                               datafield="Data"
                               v-bind:disabled="readOnly"></hh-select-url>
            </el-form-item>
            <el-form-item label="物料编号:">
                <el-input v-model="formData.itemCode" size="mini"></el-input>
            </el-form-item>
            <el-form-item label="物料名称:">
                <el-input v-model="formData.itemName" size="mini"></el-input>
            </el-form-item>
            <el-form-item label="规格型号:">
                    <el-input v-model="formData.model" size="mini"></el-input>
                </el-form-item>
            <el-button style="margin-top:2px;" size="mini" type="primary" v-on:click="search">查 询</el-button>
        </el-form>
        <el-row style="padding-left: 10px; margin-top: 7px;">
            <el-button size="mini" type="primary" v-on:click="exportExecl">导 出</el-button>
        </el-row>
    </el-card>
    <hh-table v-bind:coloptions="outCols"
              v-bind:paging="true"
              v-bind:check="false"
              v-bind:where="formData"
              v-bind:rowno="true"
              dh="145"
              url="@Url.Action("GetLocationInventoryList")"
              ref="inventorylist"></hh-table>
</div>
@section scripts{
    <script>
        var outList = new Vue({
            data: {
                formData: {
                    stockCode: "",
                    stockArea: "",
                    locationCode: "",
                    itemCode: "",
                    itemName: "",
                    model: "",
                    state:"",
                    owner:""
                },
                where: {},
                outCols: [
                    { f: "CN_S_STOCK_CODE", n: "仓库", w: 80 },
                    { f: "CN_S_STOCK_AREA", n: "库区", w: 80 },
                    { f: "CN_S_LOCATION_CODE", n: "货位号", w: 120 },
                    { f: "CN_S_ITEM_CODE", n: "物料编码", w: 120 },
                    { f: "CN_S_ITEM_NAME", n: "物料名称", w: 120 },
                    { f: "CN_S_MODEL", n: "规格型号", w: 120 },
                    { f: "CN_S_ITEM_STATE", n: "物料状态", w: 80 },
                    { f: "CN_S_OWNER", n: "货主", w: 100 },
                    { f: "CN_S_PRODUCTION_BATCH", n: "生产批次", w: 120 },
                    { f: "CN_S_LOT_NO", n: "到货批次", w: 120 },
                    { f: "CN_F_QUANTITY", n: "库存数量", w: 80 },
                    { f: "CN_F_ALLOC_QTY", n: "分配量", w: 80 },
                    {
                        f: "STOCKQTY", n: "可用库存", w: 80, format: function (row, column) {
                            return (parseFloat(row.CN_F_QUANTITY) - parseFloat(row.CN_F_ALLOC_QTY));
                        }
                    }
                ]
            },
            methods: {
                search: function () {
                    var $this = this;
                    this.$refs.inventorylist.loadData($this.formData);
                },
                exportExecl: function () {
                    $this = this;
                    var v = { formData: $this.formData, columns: $this.outCols };
                    ajaxManage({
                        url: "@Url.Action("ExportLocationInventory")",
                        data: JSON.stringify(v),
                    success: function (result) {
                        if (result.Success) 
                            location.href = "/Basic/Common/GetFile?fileName=" + result.Data.fileName
                        else
                            wms.error(result.Msg);
                    }
                });
        }
            },
            watch: {
                deep: true,
                "formData.showArea": function () {
                    $this = this;
                    if ($this.formData.showArea) {
                        $this.outCols.unshift({ f: "CN_S_AREA_NAME", n: "库区", w: 100 });
                        this.$refs.inventorylist.loadData($this.formData);
                    }
                    else {
                        $this.outCols.shift();
                        this.$refs.inventorylist.loadData($this.formData);
                    }
                }
            },
            computed: {
                areaUrl: function () {
                    var $this = this;
                    return '/Basic/Common/AreaList?stockCode=' + $this.formData.stockCode + "&include=1";
                }
            },
            el: '#list'
        });
    </script>
}