add:同步eas平库库存功能;

opt:出入库单据模块
This commit is contained in:
zhaoyf
2026-07-14 11:04:25 +08:00
parent 5ae5e1fe3a
commit c28d44fbf1
22 changed files with 881 additions and 291 deletions

View File

@@ -61,6 +61,7 @@
"normalize.css": "7.0.0",
"nprogress": "0.2.0",
"path-to-regexp": "2.4.0",
"qrcode": "^1.5.4",
"qrcodejs2": "0.0.2",
"qs": "^6.9.1",
"screenfull": "4.2.0",

View File

@@ -47,14 +47,14 @@
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<crudOperation :permission="permission">
<el-button
slot="right"
class="filter-item"
type="success"
icon="el-icon-printer"
size="mini"
@click="handlePrint"
>
打印
slot="right"
class="filter-item"
type="success"
icon="el-icon-printer"
size="mini"
@click="handlePrint"
>
打印
</el-button>
</crudOperation>
<!--表单组件-->
@@ -157,6 +157,19 @@ slot="right"
<el-button :loading="crud.cu === 2" type="primary" @click="print">打印</el-button>
</div>
</el-dialog>
<el-dialog
:close-on-click-modal="false"
title="打印预览"
:visible.sync="printPreviewVisible"
width="650px"
@close="closePrintPreview"
>
<iframe ref="printIframe" src="about:blank" style="width: 100%; height: 500px; border: 1px solid #ddd;" />
<div slot="footer" class="dialog-footer">
<el-button type="info" @click="printPreviewVisible = false">取消</el-button>
<el-button type="primary" @click="doPrint">打印</el-button>
</div>
</el-dialog>
<el-dialog
:before-close="crud.cancelCU"
:close-on-click-modal="false"
@@ -279,6 +292,7 @@ import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import { getLodop } from '@/assets/js/lodop/LodopFuncs'
import MaterDtl from '@/views/wms/basedata/material/MaterialDialog'
import QRCode from 'qrcode'
const defaultForm = {
vehicle_code: null,
@@ -333,6 +347,7 @@ export default {
}
return {
printVisible: false,
printPreviewVisible: false,
updateForm: {},
printForm: {
pageh: '40mm',
@@ -444,19 +459,60 @@ export default {
this.crud.notify('请选择一条记录', CRUD.NOTIFICATION_TYPE.INFO)
return
}
const codes = _selectData.map(item => item.storagevehicle_code).join('\n')
const ids = _selectData.map(item => item.storagevehicle_id)
this.$confirm(`确认打印以下载具编码?\n${codes}`, '打印确认', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
crudStoragevehicleinfo.printLabel(ids).then(res=>{
this.crud.notify('打印成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
})
this.printPreviewVisible = true
this.$nextTick(() => {
this.renderPrintContent(_selectData)
})
},
async renderPrintContent(selectData) {
const iframe = this.$refs.printIframe
if (!iframe) return
const doc = iframe.contentDocument || (iframe.contentWindow && iframe.contentWindow.document)
if (!doc) {
setTimeout(() => this.renderPrintContent(selectData), 100)
return
}
let html = '<!DOCTYPE html><html><head><meta charset="utf-8"><style>'
html += '*{margin:0;padding:0;box-sizing:border-box}'
html += 'body{font-family:"Microsoft YaHei",Arial,sans-serif;padding:10px}'
html += '.label{page-break-after:always;padding:10px;text-align:center}'
html += '.label:last-child{page-break-after:auto}'
html += 'h3{text-align:center;font-size:16px;margin-bottom:8px}'
html += 'table{width:100%;border-collapse:collapse;margin:0 auto;max-width:400px}'
html += 'td{padding:6px 10px;border:2px solid #333;font-size:13px}'
html += '.lbl{width:30%;text-align:right;background:#f9f9f9}'
html += '.val{width:40%;text-align:left}'
html += '.qr{width:30%;text-align:center;vertical-align:middle}'
html += '@media print{@page{size:auto;margin:5mm}}'
html += '</style></head><body>'
this.crud.toQuery()
}).catch(() => {})
for (const item of selectData) {
const code = item.storagevehicle_code || ''
const imgSrc = await QRCode.toDataURL(code, {
width: 100
})
const type = this.formattType(item) || ''
html += '<div class="label">'
html += '<h3>上海诺力</h3>'
html += '<table>'
html += '<tr><td class="lbl">载具条码</td><td class="val">' + code + '</td><td class="qr" rowspan="3"><img src="' + imgSrc + '" width="100" height="100" /></td></tr>'
html += '<tr><td class="lbl">载具类型</td><td class="val">' + type + '</td></tr>'
html += '<tr><td class="lbl">归属厂区</td><td class="val">诺力五期</td></tr>'
html += '</table></div>'
}
html += '</body></html>'
doc.open()
doc.write(html)
doc.close()
},
doPrint() {
const iframe = this.$refs.printIframe
if (!iframe) return
iframe.contentWindow.focus()
iframe.contentWindow.print()
},
closePrintPreview() {
this.printPreviewVisible = false
},
printClose() {
this.printVisible = false

View File

@@ -0,0 +1,377 @@
<template>
<div class="app-container">
<div class="head-container">
<div v-if="crud.props.searchToggle">
<el-form :inline="true" class="demo-form-inline" label-position="right" label-width="80px" label-suffix=":">
<el-form-item label="模糊查询">
<el-input
v-model="query.blurry"
size="mini"
clearable
placeholder="单据号/订单号/供应商"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<el-form-item label="单据编号">
<el-input
v-model="query.bill_id"
size="mini"
clearable
placeholder="单据编号"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<el-form-item label="订单号">
<el-input
v-model="query.order_no"
size="mini"
clearable
placeholder="订单号"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<el-form-item label="供应商">
<el-input
v-model="query.supplier_name"
size="mini"
clearable
placeholder="供应商名称"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<el-form-item label="单据状态">
<el-select
v-model="query.bill_status"
clearable
size="mini"
placeholder="全部"
class="filter-item"
@change="crud.toQuery"
>
<el-option v-for="item in billStatusOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="创建时间" prop="createTime">
<el-date-picker
v-model="query.createTime"
type="daterange"
value-format="yyyy-MM-dd HH:mm:ss"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="['00:00:00', '23:59:59']"
@change="crud.toQuery"
/>
</el-form-item>
<rrOperation />
</el-form>
</div>
<crudOperation :permission="permission">
<el-button
slot="right"
class="filter-item"
type="warning"
icon="el-icon-s-promotion"
size="mini"
:disabled="audit_flag"
@click="issueReturnBill"
>下发回传单
</el-button>
<el-button
slot="right"
class="filter-item"
type="primary"
icon="el-icon-printer"
size="mini"
:disabled="audit_flag"
@click="printBill"
>打印
</el-button>
</crudOperation>
<el-table
ref="table"
v-loading="crud.loading"
size="mini"
:data="crud.data"
highlight-current-row
style="width: 100%;"
@selection-change="crud.selectionChangeHandler"
@current-change="handleCurrentChange"
@select="handleSelectionChange"
>
<el-table-column type="selection" width="55" />
<el-table-column
v-permission="['admin','purchasemst:del','purchasemst:edit']"
label="操作"
width="115"
align="center"
fixed="right"
>
<template slot-scope="scope">
<udOperation
:data="scope.row"
:permission="permission"
:disabled-edit="canUd(scope.row)"
:disabled-dle="canUd(scope.row)"
/>
</template>
</el-table-column>
<el-table-column show-overflow-tooltip prop="bill_id" width="160" label="单据编号">
<template slot-scope="scope">
<el-link type="warning" @click="toView(scope.$index, scope.row)">{{ scope.row.bill_id }}</el-link>
</template>
</el-table-column>
<el-table-column show-overflow-tooltip prop="order_no" width="150" label="订单号" />
<el-table-column show-overflow-tooltip prop="order_type" width="100" label="订单类型" />
<el-table-column :formatter="billStatusFormat" prop="bill_status" width="100" label="单据状态" />
<el-table-column label="明细数" align="center" prop="dtl_count" width="80" />
<el-table-column label="单据总数" align="center" prop="total_qty" width="80" />
<el-table-column label="入库数量" align="center" prop="instock_qty" width="80" />
<el-table-column label="转发中鼎" align="center" prop="forwardZD" width="80">
<template slot-scope="scope">
<p v-if="scope.row.forwardZD == '0'">-</p>
<template v-else-if="scope.row.forwardZD == '1'">
<el-popconfirm
confirm-button-text=""
cancel-button-text=""
icon="el-icon-info"
icon-color="red"
title="是否重新转发中鼎?"
@confirm="toForwardZD(scope.row)"
>
<a slot="reference" style="color: red;text-decoration: underline">失败</a>
</el-popconfirm>
</template>
<p v-else>成功</p>
</template>
</el-table-column>
<el-table-column show-overflow-tooltip prop="supplier_code" width="120" label="供应商编码" />
<el-table-column show-overflow-tooltip prop="supplier_name" width="150" label="供应商名称" />
<el-table-column show-overflow-tooltip prop="creator" width="100" label="创建人" />
<el-table-column show-overflow-tooltip prop="create_time" width="150" label="创建时间">
<template slot-scope="scope">{{ formatDate(scope.row.create_time) }}</template>
</el-table-column>
<el-table-column show-overflow-tooltip prop="modify_date" width="150" label="修改时间">
<template slot-scope="scope">{{ formatDate(scope.row.modify_date) }}</template>
</el-table-column>
</el-table>
<pagination />
</div>
<AddDialog @AddChanged="querytable" />
<ViewDialog :dialog-show.sync="viewShow" :row-mst="mstrow" @AddChanged="querytable" />
<el-dialog
:close-on-click-modal="false"
title="打印预览"
:visible.sync="printPreviewVisible"
width="700px"
@close="closePrintPreview"
>
<iframe ref="printIframe" src="about:blank" style="width: 100%; height: 500px; border: 1px solid #ddd;" />
<div slot="footer" class="dialog-footer">
<el-button type="info" @click="printPreviewVisible = false">取消</el-button>
<el-button type="primary" @click="doPrint">打印</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import crudPurchase from '@/views/wms/pm_manage/allocationIn/purchase'
import CRUD, { crud, header, presenter } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import AddDialog from '@/views/wms/pm_manage/purchase/AddDialog'
import ViewDialog from '@/views/wms/pm_manage/purchase/ViewDialog'
import QRCode from 'qrcode'
export default {
name: 'AllocationIn',
components: { AddDialog, ViewDialog, crudOperation, rrOperation, udOperation, pagination },
cruds() {
return CRUD({
title: '调拨入库单',
optShow: { add: true, reset: true },
idField: 'id',
url: '/api/purchasemst/107',
crudMethod: { ...crudPurchase },
queryOnPresenterCreated: true
})
},
mixins: [presenter(), header(), crud()],
data() {
return {
permission: {
add: ['admin', 'purchasemst:add'],
edit: ['admin', 'purchasemst:edit'],
del: ['admin', 'purchasemst:del']
},
viewShow: false,
mstrow: {},
currentRow: null,
audit_flag: true,
printPreviewVisible: false,
billStatusOptions: [{ value: '0', label: '已创建' }, { value: '1', label: '执行中' }, { value: '2', label: '已完成' }]
}
},
methods: {
canUd(row) {
return row.bill_status !== '0'
},
billStatusFormat(row) {
return ({ '0': '已创建', '1': '执行中', '2': '已完成' })[row.bill_status] || row.bill_status
},
formatDate(val) {
if (!val) return ''
if (typeof val === 'string') return val
const d = new Date(val)
return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')} ${String(d.getHours()).padStart(2, '0')}:${String(d.getMinutes()).padStart(2, '0')}:${String(d.getSeconds()).padStart(2, '0')}`
},
toForwardZD(row) {
crudPurchase.pushZD({
billid: row.bill_id,
orderNo: row.order_no,
orderType: row.order_type,
red: row.red,
status: row.status
})
}, toView(index, row) {
this.mstrow = row
this.viewShow = true
},
handleSelectionChange(val, row) {
this.audit_flag = val.length == 0
},
handleCurrentChange(currentRow) {
this.currentRow = currentRow || {}
this.audit_flag = this.crud.selections.length === 0
},
querytable() {
this.crud.toQuery()
},
issueReturnBill() {
const selections = this.crud.selections
if (!selections || selections.length === 0) {
this.crud.notify('请至少选择一条单据', CRUD.NOTIFICATION_TYPE.INFO)
return
}
const ids = selections.map(s => s.id)
const billIds = selections.map(s => s.bill_id).join('、')
this.$confirm('确认下发以下单据的回传单?\n' + billIds, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
crudPurchase.issueReturnBill(ids).then(() => {
this.crud.notify('下发成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
this.crud.toQuery()
}).catch(() => {
this.crud.notify('下发失败', CRUD.NOTIFICATION_TYPE.ERROR)
})
}).catch(() => {
})
},
printBill() {
const selections = this.crud.selections
if (!selections || selections.length === 0) {
this.crud.notify('请至少选择一条单据', CRUD.NOTIFICATION_TYPE.INFO)
return
}
const billIds = selections.map(s => s.order_no).join('、')
this.$confirm('确认打印以下单据的物料标签?\n' + billIds, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.fetchDetailsAndPrint(selections)
}).catch(() => {})
},
fetchDetailsAndPrint(selections) {
const promises = selections.map(bill => {
return crudPurchase.get(bill.id).then(res => {
const dtlList = (res && res.data && res.data.tableData) || []
return dtlList.map(dtl => ({
...dtl,
order_no: bill.order_no,
bill_id: bill.bill_id
}))
})
})
Promise.all(promises).then(results => {
const allDtls = results.reduce((acc, cur) => acc.concat(cur), [])
if (allDtls.length === 0) {
this.crud.notify('未查询到明细数据', CRUD.NOTIFICATION_TYPE.INFO)
return
}
this.printPreviewVisible = true
this.$nextTick(() => {
this.renderPrintContent(allDtls)
})
}).catch(() => {
this.crud.notify('查询明细失败', CRUD.NOTIFICATION_TYPE.ERROR)
})
},
async renderPrintContent(dtlList) {
const iframe = this.$refs.printIframe
if (!iframe) return
const doc = iframe.contentDocument || (iframe.contentWindow && iframe.contentWindow.document)
if (!doc) {
setTimeout(() => this.renderPrintContent(dtlList), 100)
return
}
let html = '<!DOCTYPE html><html><head><meta charset="utf-8"><style>'
html += '*{margin:0;padding:0;box-sizing:border-box}'
html += 'body{font-family:"Microsoft YaHei",Arial,sans-serif;padding:10px}'
html += '.label{page-break-after:always;padding:10px;text-align:center}'
html += '.label:last-child{page-break-after:auto}'
html += 'h3{text-align:center;font-size:13px;margin-bottom:3px}'
html += 'table{width:100%;border-collapse:collapse;margin:0 auto;max-width:450px}'
html += 'td{padding:3px 5px;border:2px solid #333;font-size:13px}'
html += '.lbl{width:25%;text-align:right;background:#f9f9f9}'
html += '.val{width:45%;text-align:left}'
html += '.qr{width:30%;text-align:center;vertical-align:middle}'
html += '@media print{@page{size:auto;margin:5mm}}'
html += '</style></head><body>'
for (const dtl of dtlList) {
const orderNo = dtl.order_no || ''
const itemNo = dtl.item_no || ''
const skuCode = dtl.sku_code || ''
const skuName = dtl.sku_name || ''
const qty = dtl.qty || ''
const qrText = orderNo + '#' + itemNo + '#' + skuCode + '#' + skuName + '##' + qty + '#'
const imgSrc = await QRCode.toDataURL(qrText, {
width: 200
})
html += '<div class="label">'
html += '<h3>上海诺力</h3>'
html += '<table>'
html += '<tr><td class="lbl">订单号</td><td class="val">' + orderNo + '</td><td class="qr" rowspan="5"><img src="' + imgSrc + '" width="100" height="100" /></td></tr>'
html += '<tr><td class="lbl">行号</td><td class="val">' + itemNo + '</td></tr>'
html += '<tr><td class="lbl">物料编码</td><td class="val">' + skuCode + '</td></tr>'
html += '<tr><td class="lbl">物料名称</td><td class="val">' + skuName + '</td></tr>'
html += '<tr><td class="lbl">数量</td><td class="val">' + qty + '</td></tr>'
html += '</table></div>'
}
html += '</body></html>'
doc.open()
doc.write(html)
doc.close()
},
doPrint() {
const iframe = this.$refs.printIframe
if (!iframe) return
iframe.contentWindow.focus()
iframe.contentWindow.print()
},
closePrintPreview() {
this.printPreviewVisible = false
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
::v-deep .el-dialog__body {
padding-top: 10px;
}
</style>

View File

@@ -55,4 +55,4 @@ export function pushZD(data) {
})
}
export default { add, edit, del, get, issueReturnBill, print,pushZD }
export default { add, edit, del, get, issueReturnBill, print, pushZD }

View File

@@ -76,14 +76,14 @@
</template>
<script>
import crudPurchase from '@/views/wms/st/allocationOut/purchase'
import crudPurchase from '@/views/wms/pm_manage/allocationOut/purchase'
import CRUD, { crud, header, presenter } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import AddDialog from '@/views/wms/st/purchase/AddDialog'
import ViewDialog from '@/views/wms/st/purchase/ViewDialog'
import AddDialog from '@/views/wms/pm_manage/purchase/AddDialog'
import ViewDialog from '@/views/wms/pm_manage/purchase/ViewDialog'
export default {
name: 'AllocationOut',

View File

@@ -55,4 +55,4 @@ export function pushZD(data) {
})
}
export default { add, edit, del, get, issueReturnBill, print,pushZD }
export default { add, edit, del, get, issueReturnBill, print, pushZD }

View File

@@ -28,8 +28,15 @@
</div>
<crudOperation :permission="permission">
<el-button slot="right" class="filter-item" type="warning" icon="el-icon-s-promotion" size="mini" :disabled="audit_flag" @click="issueReturnBill">下发回传单</el-button>
<el-button slot="right" class="filter-item" type="primary" icon="el-icon-printer" size="mini"
:disabled="audit_flag" @click="printBill">打印
<el-button
slot="right"
class="filter-item"
type="primary"
icon="el-icon-printer"
size="mini"
:disabled="audit_flag"
@click="printBill"
>打印
</el-button>
</crudOperation>
<el-table ref="table" v-loading="crud.loading" size="mini" :data="crud.data" highlight-current-row style="width: 100%;" @selection-change="crud.selectionChangeHandler" @current-change="handleCurrentChange" @select="handleSelectionChange">
@@ -75,18 +82,32 @@
</div>
<AddDialog @AddChanged="querytable" />
<ViewDialog :dialog-show.sync="viewShow" :row-mst="mstrow" @AddChanged="querytable" />
<el-dialog
:close-on-click-modal="false"
title="打印预览"
:visible.sync="printPreviewVisible"
width="700px"
@close="closePrintPreview"
>
<iframe ref="printIframe" src="about:blank" style="width: 100%; height: 500px; border: 1px solid #ddd;" />
<div slot="footer" class="dialog-footer">
<el-button type="info" @click="printPreviewVisible = false">取消</el-button>
<el-button type="primary" @click="doPrint">打印</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import crudPurchase from '@/views/wms/st/otherIn/purchase'
import crudPurchase from '@/views/wms/pm_manage/otherIn/purchase'
import CRUD, { crud, header, presenter } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import AddDialog from '@/views/wms/st/purchase/AddDialog'
import ViewDialog from '@/views/wms/st/purchase/ViewDialog'
import AddDialog from '@/views/wms/pm_manage/purchase/AddDialog'
import ViewDialog from '@/views/wms/pm_manage/purchase/ViewDialog'
import QRCode from 'qrcode'
export default {
name: 'OtherIn',
@@ -113,6 +134,7 @@ export default {
mstrow: {},
currentRow: null,
audit_flag: true,
printPreviewVisible: false,
billStatusOptions: [
{ value: '0', label: '已创建' },
{ value: '1', label: '执行中' },
@@ -203,19 +225,94 @@ export default {
this.crud.notify('请至少选择一条单据', CRUD.NOTIFICATION_TYPE.INFO)
return
}
const ids = selections.map(s => s.id)
const billIds = selections.map(s => s.order_no).join('、')
this.$confirm('确认打印以下单据的物料标签?\n' + billIds, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
crudPurchase.print(ids).then(() => {
this.crud.notify('打印指令已发送', CRUD.NOTIFICATION_TYPE.SUCCESS)
}).catch(() => {
this.crud.notify('打印失败', CRUD.NOTIFICATION_TYPE.ERROR)
})
this.fetchDetailsAndPrint(selections)
}).catch(() => {})
},
fetchDetailsAndPrint(selections) {
const promises = selections.map(bill => {
return crudPurchase.get(bill.id).then(res => {
const dtlList = (res && res.data && res.data.tableData) || []
return dtlList.map(dtl => ({
...dtl,
order_no: bill.order_no,
bill_id: bill.bill_id
}))
})
})
Promise.all(promises).then(results => {
const allDtls = results.reduce((acc, cur) => acc.concat(cur), [])
if (allDtls.length === 0) {
this.crud.notify('未查询到明细数据', CRUD.NOTIFICATION_TYPE.INFO)
return
}
this.printPreviewVisible = true
this.$nextTick(() => {
this.renderPrintContent(allDtls)
})
}).catch(() => {
this.crud.notify('查询明细失败', CRUD.NOTIFICATION_TYPE.ERROR)
})
},
async renderPrintContent(dtlList) {
const iframe = this.$refs.printIframe
if (!iframe) return
const doc = iframe.contentDocument || (iframe.contentWindow && iframe.contentWindow.document)
if (!doc) {
setTimeout(() => this.renderPrintContent(dtlList), 100)
return
}
let html = '<!DOCTYPE html><html><head><meta charset="utf-8"><style>'
html += '*{margin:0;padding:0;box-sizing:border-box}'
html += 'body{font-family:"Microsoft YaHei",Arial,sans-serif;padding:10px}'
html += '.label{page-break-after:always;padding:10px;text-align:center}'
html += '.label:last-child{page-break-after:auto}'
html += 'h3{text-align:center;font-size:13px;margin-bottom:3px}'
html += 'table{width:100%;border-collapse:collapse;margin:0 auto;max-width:450px}'
html += 'td{padding:3px 5px;border:2px solid #333;font-size:13px}'
html += '.lbl{width:25%;text-align:right;background:#f9f9f9}'
html += '.val{width:45%;text-align:left}'
html += '.qr{width:30%;text-align:center;vertical-align:middle}'
html += '@media print{@page{size:auto;margin:5mm}}'
html += '</style></head><body>'
for (const dtl of dtlList) {
const orderNo = dtl.order_no || ''
const itemNo = dtl.item_no || ''
const skuCode = dtl.sku_code || ''
const skuName = dtl.sku_name || ''
const qty = dtl.qty || ''
const qrText = orderNo + '#' + itemNo + '#' + skuCode + '#' + skuName + '##' + qty + '#'
const imgSrc = await QRCode.toDataURL(qrText, {
width: 200
})
html += '<div class="label">'
html += '<h3>上海诺力</h3>'
html += '<table>'
html += '<tr><td class="lbl">订单号</td><td class="val">' + orderNo + '</td><td class="qr" rowspan="5"><img src="' + imgSrc + '" width="100" height="100" /></td></tr>'
html += '<tr><td class="lbl">行号</td><td class="val">' + itemNo + '</td></tr>'
html += '<tr><td class="lbl">物料编码</td><td class="val">' + skuCode + '</td></tr>'
html += '<tr><td class="lbl">物料名称</td><td class="val">' + skuName + '</td></tr>'
html += '<tr><td class="lbl">数量</td><td class="val">' + qty + '</td></tr>'
html += '</table></div>'
}
html += '</body></html>'
doc.open()
doc.write(html)
doc.close()
},
doPrint() {
const iframe = this.$refs.printIframe
if (!iframe) return
iframe.contentWindow.focus()
iframe.contentWindow.print()
},
closePrintPreview() {
this.printPreviewVisible = false
}
}
}

View File

@@ -54,4 +54,4 @@ export function pushZD(data) {
})
}
export default { add, edit, del, get, issueReturnBill, print,pushZD }
export default { add, edit, del, get, issueReturnBill, print, pushZD }

View File

@@ -76,14 +76,14 @@
</template>
<script>
import crudPurchase from '@/views/wms/st/otherOut/purchase'
import crudPurchase from '@/views/wms/pm_manage/otherOut/purchase'
import CRUD, { crud, header, presenter } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import AddDialog from '@/views/wms/st/purchase/AddDialog'
import ViewDialog from '@/views/wms/st/purchase/ViewDialog'
import AddDialog from '@/views/wms/pm_manage/purchase/AddDialog'
import ViewDialog from '@/views/wms/pm_manage/purchase/ViewDialog'
export default {
name: 'OtherOut',

View File

@@ -54,4 +54,4 @@ export function pushZD(data) {
})
}
export default { add, edit, del, get, issueReturnBill, print,pushZD }
export default { add, edit, del, get, issueReturnBill, print, pushZD }

View File

@@ -151,7 +151,7 @@
<script>
import CRUD, { crud, form } from '@crud/crud'
import crudPurchase from '@/views/wms/st/purchase/purchase'
import crudPurchase from '@/views/wms/pm_manage/purchase/purchase'
const defaultForm = {
id: '',

View File

@@ -1,7 +1,7 @@
<template>
<el-dialog
append-to-body
title="采购入库单详情"
title="单详情"
:visible.sync="dialogVisible"
destroy-on-close
fullscreen
@@ -68,7 +68,7 @@
<script>
import { crud } from '@crud/crud'
import crudPurchase from '@/views/wms/st/purchase/purchase'
import crudPurchase from '@/views/wms/pm_manage/purchase/purchase'
export default {
name: 'ViewDialog',

View File

@@ -97,18 +97,32 @@
</div>
<AddDialog @AddChanged="querytable" />
<ViewDialog :dialog-show.sync="viewShow" :row-mst="mstrow" @AddChanged="querytable" />
<el-dialog
:close-on-click-modal="false"
title="打印预览"
:visible.sync="printPreviewVisible"
width="700px"
@close="closePrintPreview"
>
<iframe ref="printIframe" src="about:blank" style="width: 100%; height: 500px; border: 1px solid #ddd;" />
<div slot="footer" class="dialog-footer">
<el-button type="info" @click="printPreviewVisible = false">取消</el-button>
<el-button type="primary" @click="doPrint">打印</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import crudPurchase from '@/views/wms/st/purchase/purchase'
import crudPurchase from '@/views/wms/pm_manage/purchase/purchase'
import CRUD, { crud, header, presenter } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import AddDialog from '@/views/wms/st/purchase/AddDialog'
import ViewDialog from '@/views/wms/st/purchase/ViewDialog'
import AddDialog from '@/views/wms/pm_manage/purchase/AddDialog'
import ViewDialog from '@/views/wms/pm_manage/purchase/ViewDialog'
import QRCode from 'qrcode'
export default {
name: 'Purchase',
@@ -135,6 +149,7 @@ export default {
mstrow: {},
currentRow: null,
audit_flag: true,
printPreviewVisible: false,
billStatusOptions: [
{ value: '0', label: '已创建' },
{ value: '1', label: '执行中' },
@@ -173,7 +188,7 @@ export default {
orderType: row.order_type,
red: row.red,
status: row.status
}).then(res=>{
}).then(res => {
this.crud.notify(res.respMsg)
this.crud.init()
})
@@ -231,19 +246,94 @@ export default {
this.crud.notify('请至少选择一条单据', CRUD.NOTIFICATION_TYPE.INFO)
return
}
const ids = selections.map(s => s.id)
const billIds = selections.map(s => s.order_no).join('、')
this.$confirm('确认打印以下单据的物料标签?\n' + billIds, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
crudPurchase.print(ids).then(() => {
this.crud.notify('打印指令已发送', CRUD.NOTIFICATION_TYPE.SUCCESS)
}).catch(() => {
this.crud.notify('打印失败', CRUD.NOTIFICATION_TYPE.ERROR)
})
this.fetchDetailsAndPrint(selections)
}).catch(() => {})
},
fetchDetailsAndPrint(selections) {
const promises = selections.map(bill => {
return crudPurchase.get(bill.id).then(res => {
const dtlList = (res && res.data && res.data.tableData) || []
return dtlList.map(dtl => ({
...dtl,
order_no: bill.order_no,
bill_id: bill.bill_id
}))
})
})
Promise.all(promises).then(results => {
const allDtls = results.reduce((acc, cur) => acc.concat(cur), [])
if (allDtls.length === 0) {
this.crud.notify('未查询到明细数据', CRUD.NOTIFICATION_TYPE.INFO)
return
}
this.printPreviewVisible = true
this.$nextTick(() => {
this.renderPrintContent(allDtls)
})
}).catch(() => {
this.crud.notify('查询明细失败', CRUD.NOTIFICATION_TYPE.ERROR)
})
},
async renderPrintContent(dtlList) {
const iframe = this.$refs.printIframe
if (!iframe) return
const doc = iframe.contentDocument || (iframe.contentWindow && iframe.contentWindow.document)
if (!doc) {
setTimeout(() => this.renderPrintContent(dtlList), 100)
return
}
let html = '<!DOCTYPE html><html><head><meta charset="utf-8"><style>'
html += '*{margin:0;padding:0;box-sizing:border-box}'
html += 'body{font-family:"Microsoft YaHei",Arial,sans-serif;padding:10px}'
html += '.label{page-break-after:always;padding:10px;text-align:center}'
html += '.label:last-child{page-break-after:auto}'
html += 'h3{text-align:center;font-size:13px;margin-bottom:3px}'
html += 'table{width:100%;border-collapse:collapse;margin:0 auto;max-width:450px}'
html += 'td{padding:3px 5px;border:2px solid #333;font-size:13px}'
html += '.lbl{width:25%;text-align:right;background:#f9f9f9}'
html += '.val{width:45%;text-align:left}'
html += '.qr{width:30%;text-align:center;vertical-align:middle}'
html += '@media print{@page{size:auto;margin:5mm}}'
html += '</style></head><body>'
for (const dtl of dtlList) {
const orderNo = dtl.order_no || ''
const itemNo = dtl.item_no || ''
const skuCode = dtl.sku_code || ''
const skuName = dtl.sku_name || ''
const qty = dtl.qty || ''
const qrText = orderNo + '#' + itemNo + '#' + skuCode + '#' + skuName + '##' + qty + '#'
const imgSrc = await QRCode.toDataURL(qrText, {
width: 200
})
html += '<div class="label">'
html += '<h3>上海诺力</h3>'
html += '<table>'
html += '<tr><td class="lbl">订单号</td><td class="val">' + orderNo + '</td><td class="qr" rowspan="5"><img src="' + imgSrc + '" width="100" height="100" /></td></tr>'
html += '<tr><td class="lbl">行号</td><td class="val">' + itemNo + '</td></tr>'
html += '<tr><td class="lbl">物料编码</td><td class="val">' + skuCode + '</td></tr>'
html += '<tr><td class="lbl">物料名称</td><td class="val">' + skuName + '</td></tr>'
html += '<tr><td class="lbl">数量</td><td class="val">' + qty + '</td></tr>'
html += '</table></div>'
}
html += '</body></html>'
doc.open()
doc.write(html)
doc.close()
},
doPrint() {
const iframe = this.$refs.printIframe
if (!iframe) return
iframe.contentWindow.focus()
iframe.contentWindow.print()
},
closePrintPreview() {
this.printPreviewVisible = false
}
}
}

View File

@@ -55,4 +55,4 @@ export function pushZD(data) {
})
}
export default { add, edit, del, get, issueReturnBill, print,pushZD }
export default { add, edit, del, get, issueReturnBill, print, pushZD }

View File

@@ -1,219 +0,0 @@
<template>
<div class="app-container">
<div class="head-container">
<div v-if="crud.props.searchToggle">
<el-form :inline="true" class="demo-form-inline" label-position="right" label-width="80px" label-suffix=":">
<el-form-item label="模糊查询">
<el-input v-model="query.blurry" size="mini" clearable placeholder="单据号/订单号/供应商"
@keyup.enter.native="crud.toQuery"/>
</el-form-item>
<el-form-item label="单据编号">
<el-input v-model="query.bill_id" size="mini" clearable placeholder="单据编号"
@keyup.enter.native="crud.toQuery"/>
</el-form-item>
<el-form-item label="订单号">
<el-input v-model="query.order_no" size="mini" clearable placeholder="订单号"
@keyup.enter.native="crud.toQuery"/>
</el-form-item>
<el-form-item label="供应商">
<el-input v-model="query.supplier_name" size="mini" clearable placeholder="供应商名称"
@keyup.enter.native="crud.toQuery"/>
</el-form-item>
<el-form-item label="单据状态">
<el-select v-model="query.bill_status" clearable size="mini" placeholder="全部" class="filter-item"
@change="crud.toQuery">
<el-option v-for="item in billStatusOptions" :key="item.value" :label="item.label" :value="item.value"/>
</el-select>
</el-form-item>
<el-form-item label="创建时间" prop="createTime">
<el-date-picker v-model="query.createTime" type="daterange" value-format="yyyy-MM-dd HH:mm:ss"
start-placeholder="开始日期" end-placeholder="结束日期"
:default-time="['00:00:00', '23:59:59']" @change="crud.toQuery"/>
</el-form-item>
<rrOperation/>
</el-form>
</div>
<crudOperation :permission="permission">
<el-button slot="right" class="filter-item" type="warning" icon="el-icon-s-promotion" size="mini"
:disabled="audit_flag" @click="issueReturnBill">下发回传单
</el-button>
<el-button slot="right" class="filter-item" type="primary" icon="el-icon-printer" size="mini"
:disabled="audit_flag" @click="printBill">打印
</el-button>
</crudOperation>
<el-table ref="table" v-loading="crud.loading" size="mini" :data="crud.data" highlight-current-row
style="width: 100%;" @selection-change="crud.selectionChangeHandler"
@current-change="handleCurrentChange" @select="handleSelectionChange">
<el-table-column type="selection" width="55"/>
<el-table-column v-permission="['admin','purchasemst:del','purchasemst:edit']" label="操作" width="115"
align="center" fixed="right">
<template slot-scope="scope">
<udOperation :data="scope.row" :permission="permission" :disabled-edit="canUd(scope.row)"
:disabled-dle="canUd(scope.row)"/>
</template>
</el-table-column>
<el-table-column show-overflow-tooltip prop="bill_id" width="160" label="单据编号">
<template slot-scope="scope">
<el-link type="warning" @click="toView(scope.$index, scope.row)">{{ scope.row.bill_id }}</el-link>
</template>
</el-table-column>
<el-table-column show-overflow-tooltip prop="order_no" width="150" label="订单号"/>
<el-table-column show-overflow-tooltip prop="order_type" width="100" label="订单类型"/>
<el-table-column :formatter="billStatusFormat" prop="bill_status" width="100" label="单据状态"/>
<el-table-column label="明细数" align="center" prop="dtl_count" width="80"/>
<el-table-column label="单据总数" align="center" prop="total_qty" width="80"/>
<el-table-column label="入库数量" align="center" prop="instock_qty" width="80"/>
<el-table-column label="转发中鼎" align="center" prop="forwardZD" width="80">
<template slot-scope="scope">
<p v-if="scope.row.forwardZD == '0'">-</p>
<template v-else-if="scope.row.forwardZD == '1'">
<el-popconfirm confirm-button-text="" cancel-button-text="" icon="el-icon-info" icon-color="red"
title="是否重新转发中鼎?" @confirm="toForwardZD(scope.row)">
<a slot="reference" style="color: red;text-decoration: underline">失败</a>
</el-popconfirm>
</template>
<p v-else>成功</p>
</template>
</el-table-column>
<el-table-column show-overflow-tooltip prop="supplier_code" width="120" label="供应商编码"/>
<el-table-column show-overflow-tooltip prop="supplier_name" width="150" label="供应商名称"/>
<el-table-column show-overflow-tooltip prop="creator" width="100" label="创建人"/>
<el-table-column show-overflow-tooltip prop="create_time" width="150" label="创建时间">
<template slot-scope="scope">{{ formatDate(scope.row.create_time) }}</template>
</el-table-column>
<el-table-column show-overflow-tooltip prop="modify_date" width="150" label="修改时间">
<template slot-scope="scope">{{ formatDate(scope.row.modify_date) }}</template>
</el-table-column>
</el-table>
<pagination/>
</div>
<AddDialog @AddChanged="querytable"/>
<ViewDialog :dialog-show.sync="viewShow" :row-mst="mstrow" @AddChanged="querytable"/>
</div>
</template>
<script>
import crudPurchase from '@/views/wms/st/allocationIn/purchase'
import CRUD, {crud, header, presenter} from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import AddDialog from '@/views/wms/st/purchase/AddDialog'
import ViewDialog from '@/views/wms/st/purchase/ViewDialog'
export default {
name: 'AllocationIn',
components: {AddDialog, ViewDialog, crudOperation, rrOperation, udOperation, pagination},
cruds() {
return CRUD({
title: '调拨入库单',
optShow: {add: true, reset: true},
idField: 'id',
url: '/api/purchasemst/107',
crudMethod: {...crudPurchase},
queryOnPresenterCreated: true
})
},
mixins: [presenter(), header(), crud()],
data() {
return {
permission: {
add: ['admin', 'purchasemst:add'],
edit: ['admin', 'purchasemst:edit'],
del: ['admin', 'purchasemst:del']
},
viewShow: false,
mstrow: {},
currentRow: null,
audit_flag: true,
billStatusOptions: [{value: '0', label: '已创建'}, {value: '1', label: '执行中'}, {value: '2', label: '已完成'}]
}
},
methods: {
canUd(row) {
return row.bill_status !== '0'
},
billStatusFormat(row) {
return ({'0': '已创建', '1': '执行中', '2': '已完成'})[row.bill_status] || row.bill_status
},
formatDate(val) {
if (!val) return '';
if (typeof val === 'string') return val;
const d = new Date(val);
return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')} ${String(d.getHours()).padStart(2, '0')}:${String(d.getMinutes()).padStart(2, '0')}:${String(d.getSeconds()).padStart(2, '0')}`
},
toForwardZD(row) {
crudPurchase.pushZD({
billid: row.bill_id,
orderNo: row.order_no,
orderType: row.order_type,
red: row.red,
status: row.status
})
}, toView(index, row) {
this.mstrow = row;
this.viewShow = true
},
handleSelectionChange(val, row) {
this.audit_flag = val.length == 0
},
handleCurrentChange(currentRow) {
this.currentRow = currentRow || {};
this.audit_flag = this.crud.selections.length === 0
},
querytable() {
this.crud.toQuery()
},
issueReturnBill() {
const selections = this.crud.selections;
if (!selections || selections.length === 0) {
this.crud.notify('请至少选择一条单据', CRUD.NOTIFICATION_TYPE.INFO);
return
}
const ids = selections.map(s => s.id);
const billIds = selections.map(s => s.bill_id).join('、')
this.$confirm('确认下发以下单据的回传单?\n' + billIds, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
crudPurchase.issueReturnBill(ids).then(() => {
this.crud.notify('下发成功', CRUD.NOTIFICATION_TYPE.SUCCESS);
this.crud.toQuery()
}).catch(() => {
this.crud.notify('下发失败', CRUD.NOTIFICATION_TYPE.ERROR)
})
}).catch(() => {
})
},
printBill() {
const selections = this.crud.selections;
if (!selections || selections.length === 0) {
this.crud.notify('请至少选择一条单据', CRUD.NOTIFICATION_TYPE.INFO);
return
}
const ids = selections.map(s => s.id);
const billIds = selections.map(s => s.order_no).join('、')
this.$confirm('确认打印以下单据的物料标签?\n' + billIds, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
crudPurchase.print(ids).then(() => {
this.crud.notify('打印指令已发送', CRUD.NOTIFICATION_TYPE.SUCCESS)
}).catch(() => {
this.crud.notify('打印失败', CRUD.NOTIFICATION_TYPE.ERROR)
})
}).catch(() => {
})
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
::v-deep .el-dialog__body {
padding-top: 10px;
}
</style>

View File

@@ -57,17 +57,17 @@
</div>
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<crudOperation :permission="permission">
<!-- <el-button
<el-button
slot="right"
class="filter-item"
type="success"
icon="el-icon-check"
type="warning"
icon="el-icon-refresh"
size="mini"
:loading="showDtlLoading"
@click="downdtl"
:loading="syncLoading"
@click="openSyncDialog"
>
导出Excel
</el-button>-->
库存同步
</el-button>
</crudOperation>
<!--表格渲染-->
<el-table
@@ -87,7 +87,7 @@
<el-table-column prop="pcsn" label="批次号" :min-width="flexWidth('pcsn',crud.data,'批次号')" />
<el-table-column prop="storagevehicle_code" label="载具号" :min-width="flexWidth('storagevehicle_code',crud.data,'载具号')" />
<el-table-column prop="qty" label="总数" :formatter="crud.formatNum3" :min-width="100" />
<el-table-column label="可用数" :min-width="100" >
<el-table-column label="可用数" :min-width="100">
<template slot-scope="scope">
<span>{{ scope.row.qty - scope.row.frozen_qty }}</span>
</template>
@@ -100,6 +100,27 @@
<!--分页组件-->
<pagination />
</div>
<el-dialog
title="库存同步"
:visible.sync="syncDialogVisible"
width="400px"
:close-on-click-modal="false"
>
<el-form label-width="80px" label-suffix=":">
<el-form-item label="仓库编码">
<el-input
v-model="syncWarehouseCode"
placeholder="请输入仓库编码"
clearable
/>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="syncDialogVisible = false">取消</el-button>
<el-button type="primary" :loading="syncLoading" @click="doSyncStock">确定</el-button>
</span>
</el-dialog>
</div>
</template>
@@ -112,6 +133,7 @@ import pagination from '@crud/Pagination'
import crudSectattr from '@/views/wms/basedata/sectattr/sectattr'
import { download } from '@/api/data'
import { downloadFile } from '@/utils'
import request from '@/utils/request'
export default {
name: 'Structivt',
@@ -135,7 +157,10 @@ export default {
return {
sects: [],
permission: {},
rules: {}
rules: {},
syncDialogVisible: false,
syncWarehouseCode: '',
syncLoading: false
}
},
created() {
@@ -179,6 +204,33 @@ export default {
this.showDtlLoading = false
})
}
},
openSyncDialog() {
this.syncWarehouseCode = ''
this.syncDialogVisible = true
},
doSyncStock() {
if (!this.syncWarehouseCode) {
this.$message.warning('请输入仓库编码')
return
}
this.syncLoading = true
request({
url: 'api/structivt/syncStock',
method: 'post',
data: { warehouseno: this.syncWarehouseCode }
}).then(res => {
const data = res.data || res
this.$message.success(
`同步完成EAS总数:${data.easTotal}, 本地总数:${data.localTotal}, 更新:${data.updateCount}, 新增:${data.addCount}, 删除:${data.deleteCount}`
)
this.syncDialogVisible = false
this.crud.refresh()
}).catch(() => {
this.$message.error('同步失败')
}).finally(() => {
this.syncLoading = false
})
}
}
}