123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <!-- import CSS -->
- <link rel="stylesheet" href="../../css/index.css">
- <!-- import Vue before Element -->
- <script src="../../js/vue.js"></script>
- <!-- import JavaScript -->
- <script src="../../js/index.js"></script>
- <script src="../../js/axios.js"></script>
- </head>
- <body>
- <div id="app" v-cloak>
- <div style="padding: 20px;">
- <div>
- <div class="commonCss">
- <el-form :inline="true" :model="formInline" class="demo-form-inline">
- <el-form-item label="盘点计划名称">
- <el-input v-model="formInline.taskCode" placeholder="入库单号"></el-input>
- </el-form-item>
- <el-form-item>
- <el-button type="primary" @click="queryClick()">查询</el-button>
- </el-form-item>
- </el-form>
- </div>
- <el-table ref="singleTable" :data="migrationResultList" v-loading="loading" :border=true
- tooltip-effect="dark"
- highlight-current-row max-height="500" style="width: 100%;overflow-x: auto;"
- :default-sort="{prop: 'createDate', order: 'descending'}">
- <el-table-column prop="taskCode" label="盘点任务编码" :show-overflow-tooltip="true"></el-table-column>
- <el-table-column prop="planType" label="盘点类型" :show-overflow-tooltip="true">
- <template slot-scope="{ row }">
- <el-tag >
- {{ getInOutTypeText(row.planType) }}
- </el-tag>
- </template>
- </el-table-column>
- <el-table-column prop="status" label="状态" :show-overflow-tooltip="true">
- <template slot-scope="{ row }">
- <el-tag >
- {{ getStatusText(row.status) }}
- </el-tag>
- </template>
- </el-table-column>
- <el-table-column prop="startTime" label="开始时间" :show-overflow-tooltip="true"></el-table-column>
- <el-table-column prop="endTime" label="结束时间" :show-overflow-tooltip="true"></el-table-column>
- <el-table-column prop="plan_user" label="盘点人" :show-overflow-tooltip="true"></el-table-column>
- <el-table-column label="操作" :show-overflow-tooltip="true" fixed="right" width="430px">
- <template #default="scope">
- <!-- 这里放置操作按钮 -->
- <div class="button-group">
- <el-button type="primary" @click="toDo(scope.row.id)" icon="el-icon-check" :disabled="scope.row.status === 2">执行</el-button>
- <el-button type="danger" @click="orderDelete(scope.row)" icon="el-icon-delete" >删除</el-button>
- </div>
- </template>
- </el-table-column>
- </el-table>
- <div class="pagination-block">
- <el-pagination :current-page="currentPage" :page-sizes="pageSizes" :total="total"
- :page-size="currentPageSize"
- layout="total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange"
- @current-change="handleCurrentChange"/>
- </div>
- <el-dialog
- title="盘点"
- :visible.sync="dialogVisibleTask"
- :before-close="handleCloseTask" width="80%">
- <el-form :inline="true" :model="formInline" class="demo-form-inline">
- <el-form-item label="入库口">
- <el-select v-model="entryPoint" placeholder="请选择">
- <el-option
- v-for="item in options"
- :key="item.value"
- :label="item.label"
- :value="item.value">
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item>
- <el-input type="text" v-model="palletCode" placeholder="托盘编码" style="width: 100px;" :disabled="true"></el-input>
- </el-form-item>
- <el-form-item>
- <el-input type="text" v-model="binCode" placeholder="料箱编码" style="width: 100px;" :disabled="true"></el-input>
- </el-form-item>
- <el-form-item>
- <el-input type="text" v-model="inputCode" placeholder="扫码 托盘编码" @change="handleScan()" style="width: 300px" ></el-input>
- </el-form-item>
- </el-form-item>
- </el-form>
- <div class="table-container" style="margin-bottom: 80px;margin-top: 20px;">
- <div class="table-wrapper">
- <div class="table-title">盘点托盘</div>
- <el-table ref="singleTable" :data="detailListTask" v-loading="loading" :border=true label="需求明细"
- tooltip-effect="dark"
- highlight-current-row max-height="500" style="width: 100%;margin-right:22px"
- :default-sort="{prop: 'createDate', order: 'descending'}" @row-click="rowClick"
- >
- <el-table-column prop="palletCode" label="托盘编码" :show-overflow-tooltip="true"></el-table-column>
- <el-table-column prop="storageLocationCode" label="库位编码" :show-overflow-tooltip="true"></el-table-column>
- <el-table-column prop="status" label="盘点状态" :show-overflow-tooltip="true">
- <template slot-scope="{ row }">
- <el-tag >
- {{ getPlanStatusText(row.status) }}
- </el-tag>
- </template>
- </el-table-column>
- <el-table-column label="操作" :show-overflow-tooltip="true">
- <template #default="scope">
- <!-- 这里放置操作按钮 -->
- <div class="button-group">
- <el-button type="primary" icon="el-icon-check" :disabled="scope.row.status===2" @click="getOutPalletCode(scope.row)">出库</el-button>
- </div>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <div class="table-wrapper">
- <div class="table-title">托盘明细</div>
- <el-table ref="singleTable" :data="detailList" v-loading="loading" :border=true label="库存明细"
- tooltip-effect="dark"
- highlight-current-row max-height="500" style="width: 100%;"
- :default-sort="{prop: 'createDate', order: 'descending'}"
- >
- <el-table-column prop="materialCode" label="物料编码" :show-overflow-tooltip="true"></el-table-column>
- <el-table-column prop="storeAmount" label="库存数量" :show-overflow-tooltip="true"></el-table-column>
- <el-table-column prop="realAmount" label="盘点数量" :show-overflow-tooltip="true">
- <template slot-scope="scope">
- <el-input v-model="scope.row.realAmount" type="number" @input="handleInput(scope.row)" :disabled="inputDisabled"></el-input>
- </template>
- </el-table-column>
- <el-table-column prop="profitLossType" label="盘库状态" :show-overflow-tooltip="true">
- </el-table-column>
- <el-table-column prop="profitLossQuantity" label="盘库异常数量" :show-overflow-tooltip="true">
- </el-table-column>
- </el-table>
- </div>
- </div>
- <span slot="footer" class="dialog-footer">
- <el-button @click="handleCloseTask()">取 消</el-button>
- <el-button type="primary" @click="outSubmit()" :disabled="isViewMode">托盘回库</el-button>
- </span>
- </el-dialog>
- </div>
- </div>
- </div>
- </body>
- <style scoped>
- .table-container {
- display: flex;
- justify-content: space-between;
- width: 100%;
- }
- .table-wrapper {
- position: relative;
- width: 48%;
- }
- .table-title {
- position: absolute;
- top: -25px; /* Adjust based on your layout */
- left: 0;
- font-weight: bold;
- }
- </style>
- <script type="module">
- new Vue({
- el: '#app',
- data: function () {
- return {
- migrationResultList: [],
- detailList: [],
- detailListTask: [],
- detailListStore: [],
- detailListPallet: [],
- detailListOut: [],
- options: [],
- name: '',
- entryPoint: '',
- binCode: '',
- wPInventoryCountTaskId: '',
- createDate: '',
- currentPage: 1,
- total: 0,
- currentPageSize: 10,
- pageSizes: [10, 50, 100, 200, 300],
- loading: false,
- formInline: {
- taskCode: ''
- },
- detailType: '',
- palletCode: '',
- dialogVisible: false,
- dialogVisibleTask: false,
- inputDisabled: false,
- plan: this.initOrder(),
- rules: {
- planName: [
- {required: true, message: '必填', trigger: 'blur'},
- ],
- planType: [
- {required: true, message: '必填', trigger: 'blur'},
- ],
- planStrategy: [
- {required: true, message: '必填', trigger: 'blur'},
- ],
- planInput: [
- {required: true, message: '必填', trigger: 'blur'},
- ],
- },
- inputCode: '',
- selection: [],
- isViewMode: false,
- planId: '',
- wInventoryTransactionOrdersId: '',
- }
- },
- created() {
- console.log("初始化")
- this.queryClick();
- this.getDic();
- },
- methods: {
- handleSizeChange(pageSize, total) {
- this.currentPage = 1;
- this.currentPageSize = pageSize;
- this.queryClick();
- },
- initOrder() {
- return {
- planName: '',
- planStrategy: '',
- planInput: '',
- planTime: '',
- remarks: '',
- planType: ''
- }
- },
- handleCurrentChange(page) {
- this.currentPage = page;
- this.queryClick();
- },
- clear() {
- this.ylCard = '';
- this.master = '';
- }, getDic() {
- axios.post('/Dic/list', {
- 'dicCode': 'planType'
- })
- .then(response => {
- console.log(response)
- this.planTypeOptions = response.data;
- })
- .catch(error => {
- // 处理错误
- });
- axios.post('/Dic/list', {
- 'dicCode': 'planStrategy'
- })
- .then(response => {
- console.log(response)
- this.planStrategyOptions = response.data;
- })
- .catch(error => {
- // 处理错误
- });
- axios.post('/Dic/list', {
- 'dicCode': 'entryPoint'
- })
- .then(response => {
- console.log(response)
- this.options = response.data;
- })
- .catch(error => {
- // 处理错误
- });
- },
- queryClick() {
- this.loading = true;
- axios.get('/wPInventoryCountTask', {
- params: {
- page: this.currentPage,
- size: this.currentPageSize,
- taskCode: this.formInline.taskCode
- }
- })
- .then(response => {
- console.log(response)
- this.migrationResultList = response.data.list;
- this.total = response.data.total;
- // 处理响应
- this.loading = false;
- })
- .catch(error => {
- // 处理错误
- });
- }, getStatusText(status) {
- switch (status) {
- case 0:
- return '未开始'; // 第三种类型的文本
- case 1:
- return '进行中'; // 第四种类型的文本
- case 2:
- return '完成'; // 第四种类型的文本
- default:
- return ""
- }
- }, getPlanStatusText(status) {
- switch (status) {
- case 0:
- return '未开始'; // 第三种类型的文本
- case 1:
- return '进行中'; // 第四种类型的文本
- case 2:
- return '完成'; // 第四种类型的文本
- default:
- return '未开始'
- }
- }, getInOutTypeText(status) {
- switch (status) {
- case 1:
- return '物料'; // 第三种类型的文本
- case 2:
- return '库位'; // 第四种类型的文本
- case 3:
- return '货架'; // 第四种类型的文本
- case 4:
- return '库房'; // 第四种类型的文本
- default:
- return ""
- }
- }, getProfitLossTypeText(status) {
- /* if(status === null){
- let ag= row.realAmount - row.storeAmount;
- if(ag > 0){
- return '盘盈';
- }else if(ag = 0){
- return '正常';
- }else{
- return '盘亏';
- }
- }else{
- switch (status) {
- case 0:
- return '盘亏'; // 第三种类型的文本
- case 1:
- return '盘盈'; // 第四种类型的文本
- case 2:
- return '正常'; // 第四种类型的文本
- default:
- return ''
- }
- }
- */
- }, getPendingAmount(row) {
- return row.realAmount - row.storeAmount;
- }, handleSelectionChange(selection) {
- this.selection = selection
- }, toDo(id) {
- this.dialogVisibleTask = true;
- this.wPInventoryCountTaskId = id;
- axios.get('/wPInventoryCountPallet/getPalletList/' + id, {})
- .then(response => {
- console.log(response)
- if (response.data.success) {
- this.detailListTask = response.data.data;
- this.isViewMode = true;
- }
- })
- .catch(error => {
- // 处理错误
- });
- }, handleCloseTask() {
- this.dialogVisibleTask = false;
- this.detailListPallet = [];
- this.inputCode = '';
- this.palletCode = '';
- this.detailList = [];
- this.entryPoint = '';
- }, handleSelectChange(row) {
- console.log(row)
- row.inventoryManagementList.forEach(item => {
- if (row.outPalletCode === item.palletCode) {
- row.storageLocationCode = item.storageLocationCode;
- row.amount = item.amount;
- return
- }
- })
- },
- rowClick(row, column, event) {
- console.log(row)
- this.detailList = row.detailList;
- this.isViewMode = false;
- this.selection = row;
- this.inputDisabled = row.status === 2;
- }, orderDelete(row) {
- this.$confirm('确认删除?')
- .then(_ => {
- axios.delete('/wPInventoryCountTask', {
- params: {
- id: row.id
- }
- })
- .then(response => {
- console.log(response)
- if (response.data) {
- this.$message({
- message: '删除成功',
- type: "success"
- })
- this.queryClick();
- }
- })
- .catch(error => {
- // 处理错误
- });
- done();
- })
- .catch(_ => {
- });
- },
- handleInput(row) {
- console.log(row)
- let ag = row.realAmount - row.storeAmount;
- row.profitLossQuantity = ag
- if (ag > 0) {
- row.profitLossType = '盘盈';
- } else if (ag === 0) {
- row.profitLossType = '正常';
- } else {
- row.profitLossType = '盘亏';
- }
- }, handleScan() {
- console.log(this.inputCode)
- this.palletCode = this.inputCode;
- this.inputCode = '';
- /*axios.get('/order/verifyCode/'+this.inputCode, {
- })
- .then(response => {
- const verify=response.data.data;
- if(verify === null){
- this.$message.error('无法识别'+this.inputCode);
- this.inputCode='';
- return
- }
- if(verify === 0){
- const needFlag=this.detailListTask.some(vo=>{
- if(vo.materialCode === this.inputCode){
- return true;
- }
- return false;
- })
- if(!needFlag){
- this.$message.error('需求明细无法识别'+this.inputCode);
- this.inputCode='';
- return;
- }
- const flag =this.detailListPallet.some(vo=>{
- if(vo.materialCode === this.inputCode){
- const flag1=this.detailListOut.some(item =>{
- if(item.materialCode === this.inputCode){
- item.amount=parseInt(item.amount)+1;
- return true;
- }
- return false;
- })
- if(!flag1){
- const newRow = {
- "materialCode":this.inputCode,
- "materialName":vo.materialName,
- "amount":1
- }
- this.detailListOut.push(newRow);
- }
- return true;
- }
- return false;
- })
- if(!flag){
- this.$message.error('托盘明细中无法识别'+this.inputCode);
- }
- }else if(verify === 1){
- console.log(this.detailListTask)
- const allMaterials = this.detailListTask.reduce((accumulator, currentObject) => {
- return accumulator.concat(currentObject.inventoryManagementList);
- }, []);
- let locationCode1='';
- const hasMatchingCode = allMaterials.some(task => {
- if (task.palletCode === this.inputCode) {
- locationCode1 = task.storageLocationCode;
- return true;
- }
- return false;
- });
- if(!hasMatchingCode){
- this.$message.error("库存明细中无法识别到 " + this.inputCode);
- this.inputCode='';
- return;
- }
- axios.get('/wInventoryManagement/'+locationCode1, {
- })
- .then(response => {
- console.log(response)
- if(response.data.success){
- const res=response.data.data;
- this.detailListPallet=res;
- }
- })
- .catch(error => {
- // 处理错误
- });
- this.palletCode=this.inputCode;
- }
- this.inputCode='';
- })
- .catch(error => {
- // 处理错误
- });*/
- }, outSubmit() {
- console.log(this.selection)
- if (this.entryPoint === '') {
- this.$message({
- message: '入库口不能为空',
- type: "error"
- })
- return
- }
- if (this.selection.palletCode != this.palletCode) {
- this.$message({
- message: '选中托盘编码和扫描托盘编码不一致,请核对',
- type: "error"
- })
- return
- }
- if (this.selection.status === 2) {
- this.$message({
- message: '选中托盘已盘库完成',
- type: "error"
- })
- return
- }
- this.detailList.forEach(item => {
- if (item.realAmount === '' || item.realAmount <= 0) {
- this.$message({
- message: '盘点数量不能为空或小于等于0',
- type: "error"
- })
- return
- }
- })
- /*const remainingTasks = this.detailListTask.filter(task => !this.selection.includes(task));
- const allStatusTwo = remainingTasks.every(task => task.status === 2);*/
- axios.post('/wPInventoryCountPallet', {
- 'wPInventoryCountTaskId': this.wPInventoryCountTaskId,
- 'taskId': this.wPInventoryCountTaskId,
- 'entryPoint': this.entryPoint,
- 'palletCode': this.selection.palletCode,
- 'storageLocationCode': this.selection.storageLocationCode,
- 'status': 2,
- 'detailList': this.detailList
- })
- .then(response => {
- if (response.data.success) {
- this.$message({
- message: '操作成功',
- type: 'success'
- });
- this.entryPoint='';
- this.palletCode='';
- this.inputDisabled=true;
- this.toDo(this.wPInventoryCountTaskId);
- }
- })
- .catch(error => {
- // 处理错误
- });
- /* this.selection.forEach(item=>{
- if(item.amount === '' || item.amount <= 0){
- this.$message({
- message: '本次出库数量不能为空或小于等于0',
- type: "error"
- })
- return
- }
- })
- if(this.entryPoint ===''){
- this.$message({
- message: '入库口不能为空',
- type: "error"
- })
- return
- }
- axios.post('/wStorageLocationManagement', {
- 'startPosition':this.entryPoint,
- 'wInventoryTransactionOrdersId':this.wInventoryTransactionOrdersId,
- 'vectorCode':this.palletCode,
- 'status':0,
- 'taskType':2,//代表实际的出入库操作
- 'detailList':this.selection
- })
- .then(response => {
- if(response.data.success){
- const code=response.data.data;
- this.$message({
- message: '空托盘 '+code +' 已出库',
- type: 'success'
- });
- }else{
- this.$message.error(response.data.data);
- }
- })
- .catch(error => {
- // 处理错误
- });*/
- }, savePlanTask(row) {
- this.$confirm('确认生成盘点任务吗?')
- .then(_ => {
- axios.post('/wPInventoryCountTask', {
- id: row.id
- })
- .then(response => {
- if (response.data.success) {
- this.$message({
- message: '盘点任务生成成功',
- type: 'success'
- });
- }
- })
- .catch(error => {
- // 处理错误
- });
- done();
- })
- .catch(_ => {
- });
- }, getOutPalletCode(row) {
- //入库口 即空托盘出库的目的地
- const inCode = row.storageLocationCode;
- if (this.entryPoint === '') {
- this.$message({
- message: '请选择出入库口',
- type: 'error'
- });
- return
- }
- this.getPalletCodeCon(inCode, this.entryPoint)
- }, getPalletCodeCon(startPosition, endPosition) {
- axios.get('/wStorageLocationManagement/getPalletCode', {
- params: {
- startPosition: startPosition,
- endPosition: endPosition
- }
- })
- .then(response => {
- if (response.data.success) {
- const code = response.data.msg;
- this.$message({
- message: '托盘 ' + code + ' 已出库',
- type: 'success'
- });
- } else {
- this.$message.error(response.data.msg);
- }
- })
- .catch(error => {
- // 处理错误
- });
- }
- }
- })
- </script>
- </html>
|