You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

564 lines
17 KiB

4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
  1. <template>
  2. <div class="customer-css">
  3. <el-form label-position="top" style="margin-top: 1px; margin-left: 0px;">
  4. <el-form-item >
  5. <el-button type="primary" @click="searchTable()">查询</el-button>
  6. <el-button v-if="searchData.orderStatus === '待包装'" type="primary" @click="newBox()">新增箱</el-button>
  7. </el-form-item>
  8. </el-form>
  9. <el-table
  10. :data="dataList"
  11. :height=searchData.height
  12. border
  13. v-loading="dataListLoading"
  14. style="width: 100%; ">
  15. <el-table-column
  16. header-align="center"
  17. align="center"
  18. width="150"
  19. label="操作">
  20. <template slot-scope="scope">
  21. <a type="text" size="small" v-if="scope.row.status!=='未封箱'" @click="boxModelOpen(scope.row)">查看</a>
  22. <template v-if="searchData.orderStatus === '待包装'">
  23. <a type="text" size="small" v-if="scope.row.status!=='已封箱'"@click="boxModelOpen(scope.row)">装箱</a>
  24. <a type="text" size="small" v-if="scope.row.status==='未封箱'" @click="fengxiang(scope.row)">封箱</a>
  25. <a type="text" size="small" v-if="scope.row.status==='已封箱'" @click="chaixiang(scope.row)">拆箱</a>
  26. <a type="text" size="small" v-if="scope.row.status!=='已封箱'" @click="deleteBox(scope.row)">删除</a>
  27. </template>
  28. </template>
  29. </el-table-column>
  30. <el-table-column
  31. v-for="(item,index) in columnList" :key="index"
  32. :sortable="item.columnSortable"
  33. :prop="item.columnProp"
  34. :header-align="item.headerAlign"
  35. :show-overflow-tooltip="item.showOverflowTooltip"
  36. :align="item.align"
  37. :fixed="item.fixed==''?false:item.fixed"
  38. :min-width="item.columnWidth"
  39. :label="item.columnLabel">
  40. <template slot-scope="scope">
  41. <span v-if="!item.columnHidden"> {{scope.row[item.columnProp]}}</span>
  42. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
  43. style="width: 100px; height: 80px"/></span>
  44. </template>
  45. </el-table-column>
  46. </el-table>
  47. <el-dialog title="卷清单" :visible.sync="boxModelFlag" width="700px" @close="searchTable" style="margin-top: 7px" v-drag :close-on-click-modal="false">
  48. <el-form class="sl" inline="inline" label-position="top" style="margin-left: 7px;margin-top: -5px;">
  49. <el-row>
  50. <el-form-item label="销售发货单号">
  51. <el-input v-model="boxData.orderNo" disabled style="width: 130px"></el-input>
  52. </el-form-item>
  53. <el-form-item label="箱号">
  54. <el-input v-model="boxData.boxNo" disabled style="width: 130px"></el-input>
  55. </el-form-item>
  56. <el-form-item label="所在仓库">
  57. <el-input v-model="boxData.wareHouseID" disabled style="width: 130px"></el-input>
  58. </el-form-item>
  59. <el-form-item label="标准装箱数量">
  60. <el-input v-model="boxData.stdPackingQty" disabled style="width: 130px" class="std-packing-qty-input"></el-input>
  61. </el-form-item>
  62. </el-row>
  63. <el-row v-if="!scanDisabled">
  64. <el-form-item label="扫描装箱">
  65. <el-input v-model="scanRollNo" ref="scanRollNo" :disabled="scanDisabled" @keyup.enter.native="handleBoxAction" style="width: 200px"></el-input>
  66. </el-form-item>
  67. <!-- <el-form-item label="操作类型">-->
  68. <!-- <el-radio-group v-model="boxActionType" size="small">-->
  69. <!-- <el-radio-button label="add">添加</el-radio-button>-->
  70. <!-- <el-radio-button label="delete">删除</el-radio-button>-->
  71. <!-- </el-radio-group>-->
  72. <!-- </el-form-item>-->
  73. <el-form-item label="操作类型" >
  74. <el-radio-group v-model="boxActionType" >
  75. <el-radio label="add" border>添加</el-radio>
  76. <el-radio label="delete" border>删除</el-radio>
  77. </el-radio-group>
  78. </el-form-item>
  79. </el-row>
  80. </el-form>
  81. <el-table
  82. :height="300"
  83. :data="modelList"
  84. stripe
  85. border
  86. style="width: 100%;">
  87. <el-table-column
  88. prop="orderId"
  89. header-align="center"
  90. align="center"
  91. min-width="60"
  92. label="序号">
  93. </el-table-column>
  94. <el-table-column
  95. prop="finalRollNo"
  96. header-align="center"
  97. align="center"
  98. min-width="100"
  99. label="卷号">
  100. </el-table-column>
  101. <el-table-column
  102. prop="partNo"
  103. header-align="center"
  104. align="left"
  105. min-width="100"
  106. label="物料编码">
  107. </el-table-column>
  108. <el-table-column
  109. prop="rollQty"
  110. header-align="center"
  111. align="right"
  112. min-width="100"
  113. label="数量">
  114. </el-table-column>
  115. <el-table-column
  116. prop="receivedDate"
  117. header-align="center"
  118. align="center"
  119. min-width="100"
  120. label="装箱日期">
  121. </el-table-column>
  122. <el-table-column
  123. prop="receivedBy"
  124. header-align="center"
  125. align="left"
  126. min-width="100"
  127. label="装箱人">
  128. </el-table-column>
  129. </el-table>
  130. <el-footer style="height:40px;margin-top: 25px;text-align:center">
  131. <el-button @click="boxModelFlag = false">关闭</el-button>
  132. </el-footer>
  133. </el-dialog>
  134. </div>
  135. </template>
  136. <script>
  137. import {
  138. deleteBoxRoll,
  139. deleteSoReceiveBoxesData,
  140. newSoReceiveBoxesData, scanBoxRoll,
  141. searchBoxDetail,
  142. searchSoReceiveBoxesData, updateBoxStatus
  143. } from '../../../api/boxManage/boxManage'
  144. export default {
  145. components: {
  146. },
  147. data() {
  148. return {
  149. dataList: [],
  150. searchData: {
  151. site: '',
  152. username: '',
  153. buNo: '',
  154. orderNo: '',
  155. boxType: '',
  156. orderStatus: '',
  157. height:'300',
  158. page: 1,
  159. limit: 1000
  160. },
  161. scanDisabled: false,
  162. dataListLoading: false,
  163. currentRow:'',
  164. columnList: [
  165. {
  166. userId: this.$store.state.user.name,
  167. functionId: this.functionId,
  168. serialNumber: '750001Table2BoxNo',
  169. tableId: "750001Table2",
  170. tableName: "装箱清单",
  171. columnProp: "boxNo",
  172. headerAlign: "center",
  173. align: "left",
  174. columnLabel: "外箱标签",
  175. columnWidth: '120',
  176. columnHidden: false,
  177. columnImage: false,
  178. columnSortable: false,
  179. sortLv: 0,
  180. status: true,
  181. fixed: false
  182. },
  183. {
  184. userId: this.$store.state.user.name,
  185. functionId: this.functionId,
  186. serialNumber: '750001Table2Status',
  187. tableId: "750001Table2",
  188. tableName: "装箱清单",
  189. columnProp: "status",
  190. headerAlign: "center",
  191. align: "center",
  192. columnLabel: "状态",
  193. columnWidth: '80',
  194. columnHidden: false,
  195. columnImage: false,
  196. columnSortable: false,
  197. sortLv: 0,
  198. status: true,
  199. fixed: false
  200. },
  201. {
  202. userId: this.$store.state.user.name,
  203. functionId: this.functionId,
  204. serialNumber: '750001Table2RollsQty',
  205. tableId: "750001Table2",
  206. tableName: "装箱清单",
  207. columnProp: "rollsQty",
  208. headerAlign: "center",
  209. align: "right",
  210. columnLabel: "卷数",
  211. columnWidth: '80',
  212. columnHidden: false,
  213. columnImage: false,
  214. columnSortable: false,
  215. sortLv: 0,
  216. status: true,
  217. fixed: false
  218. },
  219. {
  220. userId: this.$store.state.user.name,
  221. functionId: this.functionId,
  222. serialNumber: '750001Table2WareHouseID',
  223. tableId: "750001Table2",
  224. tableName: "装箱清单",
  225. columnProp: "wareHouseID",
  226. headerAlign: "center",
  227. align: "left",
  228. columnLabel: "所在仓库",
  229. columnWidth: '100',
  230. columnHidden: false,
  231. columnImage: false,
  232. columnSortable: false,
  233. sortLv: 0,
  234. status: true,
  235. fixed: false
  236. },
  237. {
  238. userId: this.$store.state.user.name,
  239. functionId: this.functionId,
  240. serialNumber: '750001Table2WareHouseName',
  241. tableId: "750001Table2",
  242. tableName: "装箱清单",
  243. columnProp: "wareHouseName",
  244. headerAlign: "center",
  245. align: "left",
  246. columnLabel: "所在仓库名称",
  247. columnWidth: '100',
  248. columnHidden: false,
  249. columnImage: false,
  250. columnSortable: false,
  251. sortLv: 0,
  252. status: true,
  253. fixed: false
  254. },
  255. {
  256. userId: this.$store.state.user.name,
  257. functionId: this.functionId,
  258. serialNumber: '750001Table2CreatedBy',
  259. tableId: "750001Table2",
  260. tableName: "装箱清单",
  261. columnProp: "createdBy",
  262. headerAlign: "center",
  263. align: "left",
  264. columnLabel: "创建人",
  265. columnWidth: '100',
  266. columnHidden: false,
  267. columnImage: false,
  268. columnSortable: false,
  269. sortLv: 0,
  270. status: true,
  271. fixed: false
  272. },
  273. {
  274. userId: this.$store.state.user.name,
  275. functionId: this.functionId,
  276. serialNumber: '750001Table2CreatedDate',
  277. tableId: "750001Table2",
  278. tableName: "装箱清单",
  279. columnProp: "createdDate",
  280. headerAlign: "center",
  281. align: "left",
  282. columnLabel: "创建时间",
  283. columnWidth: '100',
  284. columnHidden: false,
  285. columnImage: false,
  286. columnSortable: false,
  287. sortLv: 0,
  288. status: true,
  289. fixed: false
  290. },
  291. ],
  292. modelList:[],
  293. rollList:[],
  294. boxData:{
  295. site:'',
  296. orderNo:'',
  297. boxNo:'',
  298. buNo:'',
  299. wareHouseID:'',
  300. rollsQty: 0,
  301. stdPackingQty: 0, // 标准装箱数量
  302. },
  303. scanRollNo:'',
  304. boxModelFlag: false,
  305. boxActionType: 'add', // 新增:添加/删除模式
  306. }
  307. },
  308. methods: {
  309. //初始化组件的参数
  310. init(inData) {
  311. //初始化参数
  312. this.searchData = JSON.parse(JSON.stringify(inData));
  313. //刷新表格
  314. this.searchTable();
  315. },
  316. searchTable(){
  317. searchSoReceiveBoxesData(this.searchData).then(({data}) => {
  318. //区分请求成功和失败的状况
  319. if (data && data.code == 0) {
  320. this.dataList = data.rows
  321. } else {
  322. this.dataList = [];
  323. }
  324. });
  325. },
  326. newBox(){
  327. this.$confirm(`确定为此销售发货单新建箱?`, '提示', {
  328. confirmButtonText: '确定',
  329. cancelButtonText: '取消',
  330. type: 'warning'
  331. }).then(() => {
  332. let inData={
  333. site: this.searchData.site,
  334. createdBy: this.$store.state. user.name,
  335. buNo: this.searchData.buNo,
  336. orderNo: this.searchData.orderNo,
  337. boxType: this.searchData.boxType,
  338. status:'未封箱',
  339. rollsQty: 0,
  340. }
  341. newSoReceiveBoxesData(inData).then(({data}) => {
  342. if (data && data.code == 0) {
  343. this.$message.success( '操作成功')
  344. this.searchTable();
  345. let data2={
  346. site: this.searchData.site,
  347. boxNo: data.boxNo,
  348. buNo: this.searchData.buNo,
  349. }
  350. this.searchBox(data2)
  351. this.boxModelFlag = true
  352. this.boxActionType='add'
  353. this.$nextTick(() => {
  354. this.$refs.scanRollNo.focus();
  355. });
  356. } else {
  357. this.$alert(data.msg, '错误', {
  358. confirmButtonText: '确定'
  359. })
  360. }
  361. })
  362. })
  363. },
  364. boxModelOpen(row){
  365. let inData={
  366. site: row.site,
  367. boxNo: row.boxNo,
  368. buNo: row.buNo,
  369. }
  370. this.searchBox(inData)
  371. if(row.status==='未封箱'){
  372. this.scanDisabled=false
  373. }else {
  374. this.scanDisabled = true
  375. }
  376. this.scanRollNo=''
  377. this.boxModelFlag = true
  378. this.boxActionType='add'
  379. this.$nextTick(() => {
  380. this.$refs.scanRollNo.focus();
  381. });
  382. },
  383. searchBox(inData){
  384. searchBoxDetail(inData).then(({data}) => {
  385. if (data && data.code == 0) {
  386. this.modelList=data.rows
  387. this.boxData=data.row
  388. }
  389. })
  390. },
  391. deleteBox(row){
  392. this.$confirm(`确定删除此箱?`, '提示', {
  393. confirmButtonText: '确定',
  394. cancelButtonText: '取消',
  395. type: 'warning'
  396. }).then(() => {
  397. deleteSoReceiveBoxesData(row).then(({data}) => {
  398. if (data && data.code == 0) {
  399. this.$message.success( '操作成功')
  400. this.searchTable();
  401. } else {
  402. this.$message.error( data.msg)
  403. }
  404. })
  405. })
  406. },
  407. fengxiang(row){
  408. this.$confirm(`确定封箱?`, '提示', {
  409. confirmButtonText: '确定',
  410. cancelButtonText: '取消',
  411. type: 'warning'
  412. }).then(() => {
  413. let inData={
  414. site: row.site,
  415. boxNo: row.boxNo,
  416. buNo: row.buNo,
  417. id: row.id,
  418. flag:0,
  419. }
  420. updateBoxStatus(inData).then(({data}) => {
  421. if (data && data.code == 0) {
  422. this.$message.success( '操作成功')
  423. this.searchTable();
  424. }else {
  425. this.$message.error( data.msg)
  426. }
  427. })
  428. })
  429. },
  430. chaixiang(row){
  431. this.$confirm(`确定封箱?`, '提示', {
  432. confirmButtonText: '确定',
  433. cancelButtonText: '取消',
  434. type: 'warning'
  435. }).then(() => {
  436. let inData={
  437. site: row.site,
  438. boxNo: row.boxNo,
  439. buNo: row.buNo,
  440. id: row.id,
  441. flag:1,
  442. }
  443. updateBoxStatus(inData).then(({data}) => {
  444. if (data && data.code == 0) {
  445. this.$message.success( '操作成功')
  446. this.searchTable();
  447. }else {
  448. this.$message.error( data.msg)
  449. }
  450. })
  451. })
  452. },
  453. handleBoxAction() {
  454. // const arr = this.scanRollNo.split(';');
  455. // if (arr.length < 3) {
  456. // this.$message.error('扫描的标签格式不正确!');
  457. // return;
  458. // }
  459. if(this.scanRollNo==null||this.scanRollNo===''){
  460. this.$message.error('请扫描标签!');
  461. }
  462. const inData = {
  463. site: this.boxData.site,
  464. buNo: this.boxData.buNo,
  465. finalRollNo: this.scanRollNo,
  466. boxNo: this.boxData.boxNo,
  467. };
  468. if(this.boxActionType==='add'){
  469. scanBoxRoll(inData).then(({data}) => {
  470. if (data && data.code === 0) {
  471. this.$message.success('扫描成功');
  472. this.searchBox({
  473. site: this.boxData.site,
  474. boxNo: this.boxData.boxNo,
  475. buNo: this.boxData.buNo,
  476. });
  477. this.scanRollNo = '';
  478. this.$nextTick(() => {
  479. this.$refs.scanRollNo.focus();
  480. });
  481. } else {
  482. this.$message.error(data.msg || '扫描失败');
  483. this.scanRollNo = '';
  484. this.$nextTick(() => {
  485. this.$refs.scanRollNo.focus();
  486. });
  487. }
  488. }).catch(() => {
  489. this.$message.error('网络异常,扫描失败');
  490. this.scanRollNo = '';
  491. this.$nextTick(() => {
  492. this.$refs.scanRollNo.focus();
  493. });
  494. });
  495. }else {
  496. deleteBoxRoll(inData).then(({data}) => {
  497. if (data && data.code === 0) {
  498. this.$message.success('扫描成功');
  499. this.searchBox({
  500. site: this.boxData.site,
  501. boxNo: this.boxData.boxNo,
  502. buNo: this.boxData.buNo,
  503. });
  504. this.scanRollNo = '';
  505. this.$nextTick(() => {
  506. this.$refs.scanRollNo.focus();
  507. });
  508. } else {
  509. this.$message.error(data.msg || '扫描失败');
  510. this.scanRollNo = '';
  511. this.$nextTick(() => {
  512. this.$refs.scanRollNo.focus();
  513. });
  514. }
  515. }).catch(() => {
  516. this.$message.error('网络异常,扫描失败');
  517. this.scanRollNo = '';
  518. this.$nextTick(() => {
  519. this.$refs.scanRollNo.focus();
  520. });
  521. });
  522. }
  523. }
  524. },
  525. watch: {
  526. boxActionType() {
  527. this.$nextTick(() => {
  528. if (this.$refs.scanRollNo) {
  529. this.$refs.scanRollNo.focus();
  530. }
  531. });
  532. }
  533. },
  534. }
  535. </script>
  536. <style scoped lang="scss">
  537. .rq .auto /deep/ .el-form-item__content{
  538. height: auto;
  539. line-height: 1.5;
  540. }
  541. /deep/ .el-table__fixed-right-patch {
  542. display: none !important;
  543. }
  544. .sl .el-radio--medium.is-bordered {
  545. padding: 2px 5px 0px 5px;
  546. border-radius: 4px;
  547. height: 20px;
  548. }
  549. /* 标准装箱数量输入框右对齐 */
  550. .std-packing-qty-input /deep/ .el-input__inner {
  551. text-align: right;
  552. }
  553. </style>