index.vue 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242
  1. <template>
  2. <el-dialog
  3. v-dialog-drag
  4. title="快速出库"
  5. :visible.sync="visible"
  6. width="85%"
  7. :append-to-body="true"
  8. :close-on-click-modal="false"
  9. :before-close="closeDialog"
  10. >
  11. <el-form :model="form" :rules="rules" label-width="80px" ref="form">
  12. <el-row>
  13. <el-col :xs="12" :sm="6">
  14. <el-form-item label="提单号" prop="fMblno">
  15. <el-input
  16. v-model="form.fMblno"
  17. placeholder="请输入提单号"
  18. clearable
  19. @change="changeMblno"
  20. style="width: 100%"
  21. />
  22. </el-form-item>
  23. </el-col>
  24. <el-col :xs="12" :sm="6">
  25. <el-form-item label="客户名称" prop="fCorpid">
  26. <el-select
  27. v-model="form.fCorpid"
  28. clearable
  29. filterable
  30. placeholder="请输入关键词"
  31. @change="changeCorp"
  32. style="width: 100%"
  33. :disabled="detailList.length > 0"
  34. >
  35. <el-option
  36. v-for="(item, index) in fMblnoOptions"
  37. :key="index.fId"
  38. :label="item.fName"
  39. :value="item.fId"
  40. ></el-option>
  41. </el-select>
  42. </el-form-item>
  43. </el-col>
  44. <el-col :xs="12" :sm="6">
  45. <el-form-item label="出库日期" prop="fBsdate">
  46. <el-date-picker
  47. type="date"
  48. v-model="form.fBsdate"
  49. value-format="timestamp"
  50. format="yyyy-MM-dd"
  51. placeholder="请选择计划日期"
  52. style="width: 100%"
  53. ></el-date-picker>
  54. </el-form-item>
  55. </el-col>
  56. <el-col :xs="12" :sm="6">
  57. <el-form-item label="出库时间" prop="fBstime">
  58. <el-time-picker
  59. v-model="form.fBstime"
  60. :picker-options="{
  61. selectableRange: '00:00:00 - 23:59:59',
  62. }"
  63. :clearable="true"
  64. value-format="timestamp"
  65. placeholder="任意时间点"
  66. style="width: 100%"
  67. ></el-time-picker>
  68. </el-form-item>
  69. </el-col>
  70. <el-col :xs="12" :sm="6">
  71. <el-form-item label="仓库" prop="fWarehouseid">
  72. <el-select
  73. v-model="form.fWarehouseid"
  74. filterable
  75. placeholder="请选择"
  76. @change="changefWarehouseid"
  77. style="width: 100%"
  78. :disabled="detailList.length > 0"
  79. >
  80. <el-option
  81. v-for="(item, index) in warehouseOptions"
  82. :key="index.fId"
  83. :label="item.fName"
  84. :value="item.fId"
  85. ></el-option>
  86. </el-select>
  87. </el-form-item>
  88. </el-col>
  89. <el-col :xs="12" :sm="6">
  90. <el-form-item label="品名" prop="fGoodsid">
  91. <el-select
  92. filterable
  93. v-model="form.fGoodsid"
  94. placeholder="请选择品名"
  95. @change="goodsChange"
  96. style="width: 100%"
  97. clearable
  98. >
  99. <el-option
  100. v-for="(item, index) in goodsOptions"
  101. :key="index.fId"
  102. :label="item.fName"
  103. :value="item.fId"
  104. ></el-option>
  105. </el-select>
  106. </el-form-item>
  107. </el-col>
  108. <el-col :xs="12" :sm="6">
  109. <el-form-item label="品名属性" prop="fGoodsType">
  110. <el-select
  111. filterable
  112. v-model="form.fGoodsType"
  113. placeholder="请选择商品属性"
  114. style="width: 100%"
  115. >
  116. <el-option
  117. v-for="(item, index) in fStorageTypeOptions"
  118. :key="index.dictValue"
  119. :label="item.dictLabel"
  120. :value="item.dictValue"
  121. />
  122. </el-select>
  123. </el-form-item>
  124. </el-col>
  125. <el-col :xs="12" :sm="6">
  126. <el-form-item label="属性内容">
  127. <el-input
  128. v-model="form.fMarks"
  129. placeholder="请填写属性描述"
  130. clearable
  131. style="width: 100%"
  132. />
  133. </el-form-item>
  134. </el-col>
  135. <el-col :xs="12" :sm="6">
  136. <el-form-item label="车号">
  137. <el-input
  138. placeholder="请输入车号"
  139. v-model="form.fTruckno"
  140. style="width: 100%"
  141. ></el-input>
  142. </el-form-item>
  143. </el-col>
  144. <el-col :xs="12" :sm="6">
  145. <el-form-item label="司机">
  146. <el-input
  147. placeholder="请输入司机姓名"
  148. v-model="form.fDriverName"
  149. style="width: 100%"
  150. ></el-input>
  151. </el-form-item>
  152. </el-col>
  153. <el-col :xs="12" :sm="6">
  154. <el-form-item label="电话">
  155. <el-input
  156. placeholder="请输入司机电话"
  157. v-model="form.fDriverTel"
  158. style="width: 100%"
  159. ></el-input>
  160. </el-form-item>
  161. </el-col>
  162. <el-col :xs="12" :sm="6">
  163. <el-form-item label="证件号">
  164. <el-input
  165. placeholder="请输入证件号"
  166. v-model="form.fDriverIdCar"
  167. style="width: 100%"
  168. ></el-input>
  169. </el-form-item>
  170. </el-col>
  171. </el-row>
  172. <div style="margin: 10px 0">
  173. <!-- 列设置-->
  174. <el-dialog title="提示" :visible.sync="showSetting" width="700px" v-dialogDrag append-to-body>
  175. <template slot="title">
  176. <div class="avue-crud__dialog__header">
  177. <span class="el-dialog__title">
  178. <span
  179. style="display:inline-block;width:3px;height:20px;margin-right:5px; float: left;margin-top:2px"></span>
  180. </span>
  181. </div>
  182. </template>
  183. <div>配置排序列数据(拖动调整顺序)</div>
  184. <div style="margin-left: 17px">
  185. <el-checkbox
  186. v-model="allCheck"
  187. label="全选"
  188. @change="allChecked"
  189. ></el-checkbox>
  190. </div>
  191. <div style="padding: 4px; display: flex; justify-content: center">
  192. <draggable
  193. v-model="setRowList"
  194. group="site"
  195. animation="300"
  196. @start="onStart"
  197. @end="onEnd"
  198. handle=".indraggable"
  199. >
  200. <transition-group>
  201. <div
  202. v-for="item in setRowList"
  203. :key="item.surface"
  204. class="listStyle"
  205. >
  206. <div style="width: 500px" class="indraggable">
  207. <div class="progress" :style="{ width: item.width + 'px' }">
  208. <el-checkbox
  209. :label="item.name"
  210. v-model="item.checked"
  211. :true-label="0"
  212. :false-label="1"
  213. >{{ item.name }}
  214. </el-checkbox>
  215. </div>
  216. </div>
  217. <el-input-number
  218. v-model.number="item.width"
  219. controls-position="right"
  220. :min="1"
  221. :max="500"
  222. size="mini"
  223. ></el-input-number>
  224. </div>
  225. </transition-group>
  226. </draggable>
  227. </div>
  228. <span slot="footer" class="dialog-footer">
  229. <el-button @click="showSetting = false">取 消</el-button>
  230. <el-button @click="delRow" type="danger">重 置</el-button>
  231. <el-button type="primary" @click="save()">确 定</el-button>
  232. </span>
  233. </el-dialog>
  234. <div style="margin: 10px 10px">
  235. <el-button
  236. size="small"
  237. style="float:left;"
  238. type="primary"
  239. @click="addList"
  240. :disabled="disabled"
  241. >
  242. 检索
  243. </el-button>
  244. <el-button
  245. size="small"
  246. style="float:left;"
  247. type="danger"
  248. :disabled="selection.length == 0"
  249. @click="batchDelete"
  250. >
  251. 批量删除
  252. </el-button>
  253. <el-button
  254. icon="el-icon-setting"
  255. size="mini"
  256. circle
  257. @click="showSetting = !showSetting"
  258. style="float: right"
  259. ></el-button>
  260. </div>
  261. <el-table
  262. :data="detailList"
  263. tooltip-effect="dark"
  264. stripe
  265. ref="detailTable"
  266. @selection-change="handleSelection"
  267. show-summary
  268. :summary-method="getSummaries"
  269. >
  270. <el-table-column type="selection" width="50" align="center" fixed/>
  271. <el-table-column
  272. label="序号"
  273. type="index"
  274. width="50"
  275. fixed
  276. align="center"
  277. />
  278. <el-table-column
  279. v-for="(item, index) in getRowList"
  280. :key="index"
  281. :label="item.name"
  282. :width="item.width"
  283. :prop="item.label"
  284. align="center"
  285. :fixed="item.fixed"
  286. :show-overflow-tooltip="true"
  287. sortable
  288. >
  289. <template slot-scope="scope">
  290. <span v-if="item.label == 'fGoodsid'">
  291. {{scope.row.fGoodsids}}
  292. </span>
  293. <!-- <span v-else-if="item.label == 'fCntrno'">-->
  294. <!-- <el-input-->
  295. <!-- v-model="scope.row.fCntrno"-->
  296. <!-- placeholder="请输入箱号"-->
  297. <!-- clearable-->
  298. <!-- ></el-input>-->
  299. <!-- </span>-->
  300. <span v-else-if="item.label == 'fSealno'">
  301. <el-input
  302. v-model="scope.row.fSealno"
  303. placeholder="请输入封号"
  304. clearable
  305. ></el-input>
  306. </span>
  307. <span v-else-if="item.label == 'fBusinessType'">
  308. <el-select
  309. v-model="scope.row.fBusinessType"
  310. filterable
  311. disabled
  312. placeholder="请选择商品属性"
  313. >
  314. <el-option
  315. v-for="(item, index) in fStorageTypeOptions"
  316. :key="index.dictValue"
  317. :label="item.dictLabel"
  318. :value="item.dictValue"
  319. />
  320. </el-select>
  321. </span>
  322. <span v-else-if="item.label == 'fQty'">
  323. <el-input
  324. v-input-limit="0"
  325. @change="qtyChange(scope.row)"
  326. v-model="scope.row.fQty"
  327. placeholder="出库件数"
  328. />
  329. </span>
  330. <span v-else-if="item.label == 'fGrossweight'">
  331. <el-input
  332. v-input-limit="2"
  333. v-model="scope.row.fGrossweight"
  334. @change="changeOutStock(scope.row)"
  335. placeholder="出库毛重"
  336. />
  337. </span>
  338. <span v-else-if="item.label == 'fNetweight'">
  339. <el-input
  340. v-input-limit="2"
  341. v-model="scope.row.fNetweight"
  342. @change="changeOutStock(scope.row)"
  343. placeholder="出库净重"
  344. />
  345. </span>
  346. <span v-else-if="item.label == 'remark'">
  347. <el-input
  348. v-model="scope.row.remark"
  349. placeholder="备注"
  350. />
  351. </span>
  352. <span v-else>{{ scope.row[item.label] }}</span>
  353. </template>
  354. </el-table-column>
  355. <el-table-column
  356. header-align="center"
  357. align="center"
  358. label="操作"
  359. width="160px"
  360. fixed="right"
  361. >
  362. <template slot-scope="scope">
  363. <el-button
  364. type="text"
  365. @click.native.prevent="wDeleteRow(scope.$index, detailList)"
  366. size="small"
  367. >移除
  368. </el-button
  369. >
  370. </template>
  371. </el-table-column>
  372. </el-table>
  373. </div>
  374. <el-row>
  375. <el-col :span="24">
  376. <el-form-item label="备注">
  377. <el-input
  378. type="textarea"
  379. :autosize="{ minRows: 2, maxRows: 4}"
  380. placeholder="请输入备注"
  381. v-model="form.remark"
  382. style="width: 100%"
  383. >
  384. </el-input>
  385. </el-form-item>
  386. </el-col>
  387. </el-row>
  388. </el-form>
  389. <!-- 打印-->
  390. <el-dialog
  391. append-to-body
  392. :close-on-click-modal="false"
  393. :modal="false"
  394. :visible.sync="printVisible"
  395. >
  396. <div id="print_ckd">
  397. <div style="text-align: center;font-size: 24px;margin-bottom: 5px;">{{ company }}出库单</div>
  398. <div class="print_table" style="display: flex">
  399. <table border="0" cellspacing="0" cellpadding="0" style="width: 100%; line-height: 30px">
  400. <tr>
  401. <td>公司名称</td>
  402. <td colspan="3" v-for="item in fMblnoOptions" v-if="item.fId == form.fCorpid">{{ item.fName }}</td>
  403. <td>出库日期</td>
  404. <td colspan="3">{{ form.fBsdate | fBsdateFormat }}</td>
  405. </tr>
  406. <tr>
  407. <td style="width: 15%">货物名称</td>
  408. <td>提单号</td>
  409. <td>箱号</td>
  410. <td>件数</td>
  411. <td>计量单位(吨)</td>
  412. <td>封号</td>
  413. <td>库位</td>
  414. <td>备注</td>
  415. </tr>
  416. <tr v-for="(item, index) in detailList" :key="index">
  417. <td v-for="row in goodsOptions" v-if="row.fId == item.fGoodsid">{{ row.fName }}</td>
  418. <td>{{ item.fMblno }}</td>
  419. <td>{{ item.fCntrno }}</td>
  420. <td>{{ item.fQty }}</td>
  421. <td>{{ (item.fGrossweight / 1000).toFixed(4) }}</td>
  422. <td>{{ item.fSealno }}</td>
  423. <td>{{ item.fWarehouseInformation }}</td>
  424. <td>{{ item.remark }}</td>
  425. </tr>
  426. <tr>
  427. <td>车号</td>
  428. <td colspan="2">{{ form.fTruckno }}</td>
  429. <td colspan="2">身份证号</td>
  430. <td colspan="3">{{ form.fDriverIdCar }}</td>
  431. </tr>
  432. <tr>
  433. <td>地址</td>
  434. <td colspan="7">{{ stockaddr }}</td>
  435. </tr>
  436. <tr>
  437. <td colspan="8">
  438. 雨/雪天装货司机自愿装车,出现货物水湿与仓库无关!数量准确无误,货物包装完好!
  439. </td>
  440. </tr>
  441. </table>
  442. </div>
  443. </div>
  444. <span slot="footer" class="dialog-footer">
  445. <el-button
  446. type="primary"
  447. @click="
  448. addprint('ckd');
  449. printVisible = false;
  450. "
  451. >打印
  452. </el-button>
  453. <el-button @click="printVisible = false">取消</el-button>
  454. </span>
  455. </el-dialog>
  456. <span slot="footer" class="dialog-footer">
  457. <el-button type="warning" @click="openPrint" :disabled="detailList.length == 0">打印</el-button>
  458. <el-button type="primary" @click="handleConfirm" :disabled="detailList.length == 0">确认出库</el-button>
  459. <el-button @click="closeDialog">取消</el-button>
  460. </span>
  461. </el-dialog>
  462. </template>
  463. <script>
  464. import Cookies from "js-cookie";
  465. import draggable from "vuedraggable";
  466. import {listCorps} from "@/api/basicdata/corps";
  467. import {
  468. treeselect,
  469. listWarehousesss,
  470. } from "@/api/basicdata/warehouse";
  471. import {listGoods} from "@/api/basicdata/goods";
  472. import {queryUserVal} from "@/api/system/user";
  473. import {listWhgenleg} from "@/api/reportManagement/whgenleg";
  474. import {addSet, resetModule, select} from '@/api/system/set';
  475. import {changeSelect,fastOutStock} from "@/api/warehouseBusiness/fastOutStock";
  476. import print from "print-js";
  477. export default {
  478. name: "fastOutStock",
  479. props: {},
  480. components: {
  481. draggable,
  482. },
  483. data() {
  484. return {
  485. disabled: false,
  486. visible: false,
  487. printVisible: false,
  488. company: '',
  489. form: {},
  490. detailList: [],
  491. fMblnoOptions: [],
  492. // 仓库
  493. warehouseOptions: [],
  494. // 品名
  495. goodsOptions: [],
  496. // 品名属性
  497. fStorageTypeOptions: [],
  498. fWarehouseidOptions: [],
  499. rules: {
  500. fCorpid: [{required: true, message: " ", trigger: "blur"}],
  501. fBsdate: [{required: true, message: " ", trigger: "blur"}],
  502. fWarehouseid: [{required: true, message: " ", trigger: "blur"}],
  503. fTruckno: [{required: true, message: " ", trigger: "blur"}],
  504. },
  505. selection:[],
  506. // 设置列开关
  507. showSetting: false,
  508. setRowList: [],
  509. getRowList: [],
  510. tableDate: [
  511. {
  512. surface: "1",
  513. label: "fMblno",
  514. name: "提单号",
  515. checked: 0,
  516. width: 100,
  517. },
  518. {
  519. surface: "2",
  520. label: "fCntrno",
  521. name: "箱号",
  522. checked: 0,
  523. width: 100,
  524. },
  525. {
  526. surface: "3",
  527. label: "fSealno",
  528. name: "封号",
  529. checked: 0,
  530. width: 100,
  531. },
  532. {
  533. surface: "4",
  534. label: "fGoodsid",
  535. name: "品名",
  536. checked: 0,
  537. width: 150,
  538. },
  539. {
  540. surface: "5",
  541. label: "fBusinessType",
  542. name: "货物属性",
  543. checked: 0,
  544. width: 100,
  545. },
  546. {
  547. surface: "6",
  548. label: "fMarks",
  549. name: "属性详情",
  550. checked: 0,
  551. width: 100,
  552. },
  553. {
  554. surface: "7",
  555. label: "fWarehouseInformation",
  556. name: "库区",
  557. checked: 0,
  558. width: 150,
  559. },
  560. {
  561. surface: "8",
  562. label: "fPlanqty",
  563. name: "结余库存",
  564. checked: 0,
  565. width: 100,
  566. },
  567. {
  568. surface: "9",
  569. label: "fPlangrossweight",
  570. name: "结余毛重(kg)",
  571. checked: 0,
  572. width: 120,
  573. },
  574. {
  575. surface: "10",
  576. label: "fPlannetweight",
  577. name: "结余净重(kg)",
  578. checked: 0,
  579. width: 120,
  580. },
  581. {
  582. surface: "11",
  583. label: "fQty",
  584. name: "件数",
  585. checked: 0,
  586. width: 100,
  587. },
  588. {
  589. surface: "12",
  590. label: "fGrossweight",
  591. name: "毛重(kg)",
  592. checked: 0,
  593. width: 120,
  594. },
  595. {
  596. surface: "13",
  597. label: "fNetweight",
  598. name: "净重(kg)",
  599. checked: 0,
  600. width: 120,
  601. },
  602. {
  603. surface: "14",
  604. label: "remark",
  605. name: "备注",
  606. checked: 0,
  607. width: 100,
  608. },
  609. ],
  610. // 库位的地址
  611. stockaddr: '',
  612. balance: 0,
  613. //自定义列宽
  614. allCheck: false,
  615. drag: false,
  616. }
  617. },
  618. created() {
  619. this.setRowList = this.tableDate;
  620. this.getRowList = this.tableDate;
  621. listCorps({type: 1}).then((response) => {
  622. this.fMblnoOptions = response.rows;
  623. });
  624. listWarehousesss({fStatus: 0, delFlag: 0}).then((response) => {
  625. this.warehouseOptions = response.rows;
  626. });
  627. listGoods({fStatus: 0, delFlag: 0}).then((response) => {
  628. this.goodsOptions = response.rows;
  629. });
  630. this.getDicts("storage_type").then((response) => {
  631. this.fStorageTypeOptions = response.data;
  632. localStorage.setItem("fStorageTypeList", JSON.stringify(response.data));
  633. });
  634. this.getRow()
  635. },
  636. filters: {
  637. fBsdateFormat(row) {
  638. if (row) {
  639. const dateMat = new Date(row);
  640. const year = dateMat.getFullYear();
  641. const month = dateMat.getMonth() + 1;
  642. const day = dateMat.getDate();
  643. const timeFormat = year + "-" + month + "-" + day;
  644. return timeFormat;
  645. }
  646. },
  647. },
  648. methods: {
  649. // 打开
  650. init() {
  651. this.queryUser();
  652. this.company = Cookies.get("companyName")
  653. this.visible = true;
  654. },
  655. // 关闭弹窗
  656. closeDialog() {
  657. this.visible = false;
  658. this.form = {}
  659. this.detailList = []
  660. this.$refs.form.clearValidate();
  661. this.$emit("closeDialog")
  662. },
  663. //获取登陆人
  664. queryUser() {
  665. queryUserVal().then((response) => {
  666. if (response.user !== null) {
  667. this.userVal = response.user;
  668. this.$set(this.form, "fDeptid", this.userVal.deptId);
  669. this.$set(this.form, "createBy", this.userVal.userName);
  670. this.$set(this.form, "fStorekeeper", this.userVal.nickName);
  671. this.$set(this.form, "fIfdamage", "1");
  672. this.$set(this.form, "fIfweigh", "1");
  673. this.$set(this.form, "fTrademodeid", "1");
  674. this.$set(this.form, "createTime", Date.parse(new Date()));
  675. this.$set(this.form, "fBstime", Date.parse(new Date()));
  676. this.$set(this.form, "fFeetUnit", "2");
  677. this.$set(this.form, "fFeetunit", 2);
  678. this.$set(this.form, "fBusinessType", "5");
  679. }
  680. if (response.dept !== null) {
  681. this.deptOptions = [];
  682. this.deptOptions.push(response.dept);
  683. }
  684. });
  685. },
  686. handleSelection(list) {
  687. this.selection = list
  688. },
  689. // 打开打印窗口
  690. openPrint() {
  691. this.balance = 0;
  692. for (let item in this.detailList) {
  693. if (!this.detailList[item].fCntrno) {
  694. return this.$message.error('第' + (Number(item) + 1) + '行箱号不能为空')
  695. }
  696. if (this.detailList[item].fPlanqty < this.detailList[item].fQty) {
  697. return this.$message.error("第" + (Number(item) + 1) + "行出库件数超出结余件数!");
  698. }
  699. this.balance = this.detailList[item].fPlanqty
  700. console.log(this.detailList[item])
  701. for (let item1 in this.detailList) {
  702. if (this.detailList[item].fSrcid == this.detailList[item1].fSrcid) {
  703. this.balance = Number(this.balance) - Number(this.detailList[item].fQty)
  704. if (this.balance < 0) {
  705. return this.$message.error("第" + (Number(item1) + 1) + "行出库件数超出结余件数!");
  706. }
  707. }
  708. }
  709. }
  710. this.warehouseOptions.map((e) => {
  711. if (e.fId == this.form.fWarehouseid) {
  712. this.stockaddr = e.fAddr;
  713. }
  714. });
  715. this.allfQty = 0;
  716. this.detailList.forEach(item => {
  717. this.allfQty += Number(item.fQty)
  718. })
  719. this.printVisible = true;
  720. },
  721. handleConfirm(){
  722. this.$refs["form"].validate(vaild => {
  723. if (vaild) {
  724. if (!this.form.fTruckno) return this.$message.error('车号不能为空')
  725. let fPlanqty = 0;
  726. let fPlannetweight = 0;
  727. let fPlangrossweight = 0;
  728. this.detailList.forEach(item => {
  729. this.$set(item, 'fBsdate', this.form.fBsdate)
  730. this.$set(item, 'fOriginalbillno', item.fMblno)
  731. this.$set(item, 'fIsPass', 'T')
  732. this.$set(item, 'fStltypeid', '1')
  733. this.$set(item, 'fTruckno', this.form.fTruckno)
  734. fPlanqty += Number(item.fQty)
  735. fPlannetweight += Number(item.fNetweight)
  736. fPlangrossweight += Number(item.fGrossweight)
  737. delete item.deleteId
  738. })
  739. this.$set(this.form, 'fStltypeid', '1')
  740. this.$set(this.form, 'fPlanqty', fPlanqty)
  741. this.$set(this.form, 'fPlannetweight', fPlannetweight)
  742. this.$set(this.form, 'fPlangrossweight', fPlangrossweight)
  743. this.$set(this.form, 'fQty', fPlanqty)
  744. this.$set(this.form, 'fNetweight', fPlannetweight)
  745. this.$set(this.form, 'fGrossweight', fPlangrossweight)
  746. this.$set(this.form, 'fChargedate', this.form.fBsdate)
  747. let fProductName = []
  748. this.detailList.map((e) => {
  749. this.goodsOptions.map((item) => {
  750. if (e.fGoodsid == item.fId) {
  751. fProductName.push(item.fName);
  752. }
  753. });
  754. });
  755. fProductName = [...new Set(fProductName)];
  756. // this.form.fProductName = fProductName.join(",");
  757. this.$set(this.form, 'fProductName', fProductName.join(","))
  758. let fMarks = []
  759. this.detailList.map((e) => {
  760. fMarks.push(e.fMarks);
  761. });
  762. fMarks = [...new Set(fMarks)];
  763. // this.form.fMarks = fMarks.join(",");
  764. this.$set(this.form, 'fMarks', fMarks.join(","))
  765. let data = {warehousebillsitemsList: this.detailList}
  766. data = Object.assign({}, data, this.form)
  767. fastOutStock(data).then(res => {
  768. this.$message.success('出库成功')
  769. this.closeDialog()
  770. })
  771. }
  772. })
  773. },
  774. addList() {
  775. this.$refs["form"].validate(valid => {
  776. if (valid) {
  777. this.getDetailsList()
  778. }
  779. })
  780. },
  781. // 查询库存总账
  782. getDetailsList() {
  783. // this.detailList = []
  784. this.disabled = true
  785. let queryParams = {
  786. fMblno: this.form.fMblno,
  787. fCorpid: this.form.fCorpid,
  788. fWarehouseid: this.form.fWarehouseid,
  789. fTrademodeid: this.form.fTrademodeid
  790. }
  791. listWhgenleg(queryParams).then((response) => {
  792. response.rows.map((e) => {
  793. e.fQtyblc2 = e.fQtyblc;
  794. e.fGrossweightblc2 = e.fGrossweightblc;
  795. e.fNetweightblc2 = e.fNetweightblc;
  796. });
  797. // this.detailList = response.rows;
  798. let arr = [];
  799. response.rows.map(e => {
  800. let index = this.detailList.findIndex(item => {
  801. return item.fSrcid === e.fId
  802. })
  803. if (index == -1) {
  804. arr.push({
  805. fId: null,
  806. fBsdate: this.form.fBsdate,
  807. fMblno: e.fMblno,
  808. fGoodsid: e.fGoodsid,
  809. fCntrtype: null,
  810. fPlanqty: e.fQtyblc,
  811. fPlannetweight: e.fNetweightblc,
  812. fPlangrossweight: e.fGrossweightblc,
  813. fWarehouseLocationids: e.fWarehouseLocationids,
  814. fGoodsids: e.fGoodsids,
  815. fBillingway: e.fBillingway,
  816. fChargedate: e.fChargedate,
  817. fMarks: e.fMarks,
  818. fOriginalbilldate: e.fOriginalbilldate,
  819. fOriginalbillno: e.fOriginalbillno,
  820. fPackagespecs: e.fPackagespecs,
  821. fGrossweight: e.fGrossweightblc2,
  822. fNetweight: e.fNetweightblc2,
  823. fQty: e.fQtyblc2,
  824. fCntqty: 1,
  825. fBillstatus: 10,
  826. fWarehouselocid: e.fWarehouseLocationid,
  827. fWarehouselocids: e.fWarehouseLocationids,
  828. fCntrno: e.fCntrno,
  829. fGoodsval: null,
  830. fTruckno: response.rows.fTruckno,
  831. remark: null,
  832. fIsPass: "T",
  833. fDriverName: response.rows.fDriverName,
  834. fDriverTel: response.rows.fDriverTel,
  835. fDriverIdCar: response.rows.fDriverIdCar,
  836. fBusinessType: e.fBusinessType ? e.fBusinessType.toString() : null,
  837. fWarehouseInformation: e.fWarehouseids,
  838. fSrcid: e.fId,
  839. fSrcBsdate: e.fBsdate,
  840. deleteId: e.fId,
  841. })
  842. }
  843. })
  844. this.detailList = this.detailList.concat(arr)
  845. console.log(this.detailList)
  846. this.disabled = false
  847. });
  848. },
  849. // 修改毛重净重
  850. changeOutStock(row) {
  851. this.$refs['detailTable'].clearSelection()
  852. let fNetweight = 0;
  853. let fGrossweight = 0;
  854. if (row.fNetweight) {
  855. fNetweight = row.fNetweight;
  856. }
  857. if (row.fGrossweight) {
  858. fGrossweight = row.fGrossweight;
  859. }
  860. if (row.fPlannetweight < fNetweight) {
  861. this.$message({message: "出库净重超出结余净重", type: "warning"});
  862. return false;
  863. }
  864. if (row.fPlangrossweight < fGrossweight) {
  865. this.$message({message: "出库毛重超出结余毛重", type: "warning"});
  866. return false;
  867. }
  868. },
  869. // 出库件数的计算
  870. qtyChange(row) {
  871. if (row.fPlanqty < row.fQty) {
  872. this.$message.error("出库件数超出结余件数!");
  873. this.$set(row, "fQty", 0);
  874. this.$set(row, "fNetweight", 0);
  875. this.$set(row, "fGrossweight", 0);
  876. return false;
  877. }
  878. if (row.fQtyblc2 > row.fQtyblc) {
  879. this.$message.error("出库件数超出结余件数!");
  880. this.$set(row, "fQtyblc2", 0);
  881. this.$set(row, "fGrossweightblc2", 0);
  882. this.$set(row, "fNetweightblc2", 0);
  883. return false;
  884. }
  885. this.$set(
  886. row,
  887. "fNetweight",
  888. parseFloat(
  889. (Number(row.fPlannetweight) / Number(row.fPlanqty)) * Number(row.fQty)
  890. ).toFixed(2)
  891. );
  892. this.$set(
  893. row,
  894. "fGrossweight",
  895. parseFloat(
  896. (Number(row.fPlangrossweight) / Number(row.fPlanqty)) *
  897. Number(row.fQty)
  898. ).toFixed(2)
  899. );
  900. this.$set(
  901. row,
  902. "fNetweightblc2",
  903. parseFloat(
  904. (Number(row.fNetweightblc) / Number(row.fQtyblc)) *
  905. Number(row.fQtyblc2)
  906. ).toFixed(2)
  907. );
  908. this.$set(
  909. row,
  910. "fGrossweightblc2",
  911. parseFloat(
  912. (Number(row.fGrossweightblc) / Number(row.fQtyblc)) *
  913. Number(row.fQtyblc2)
  914. ).toFixed(2)
  915. );
  916. },
  917. // 明细删除
  918. wDeleteRow(index, rows) {
  919. rows.splice(index, 1);
  920. },
  921. // 批量删除
  922. batchDelete() {
  923. this.$confirm('是否确认删除选中数据','提示',{
  924. confirmButtonText: '确定',
  925. cancelButtonText: '取消',
  926. type: 'warning'
  927. }).then(() => {
  928. this.selection.forEach(item => {
  929. console.log(item.deleteId)
  930. let index = this.detailList.findIndex(item1 => {
  931. return item1.deleteId == item.deleteId
  932. })
  933. this.detailList.splice(index,1)
  934. })
  935. this.$message({
  936. type: 'success',
  937. message: '删除成功!'
  938. });
  939. }).catch(() => {
  940. this.$message({
  941. type: 'info',
  942. message: '已取消删除'
  943. });
  944. });
  945. },
  946. changeMblno() {
  947. if (this.detailList.length == 0) {
  948. this.$set(this.form, "fCorpid", '')
  949. this.$set(this.form, "fWarehouseid", '')
  950. this.$set(this.form, "fGoodsid", '')
  951. if (this.form.fMblno) {
  952. let data = {
  953. type: 'mblno',
  954. fMblno: this.form.fMblno
  955. }
  956. changeSelect(data).then(res => {
  957. this.fMblnoOptions = res.data.corpsList
  958. this.warehouseOptions = res.data.warehouseList
  959. this.goodsOptions = res.data.whgenlegVOList
  960. if (this.fMblnoOptions.length > 0) {
  961. this.form.fCorpid = this.fMblnoOptions[0].fId
  962. let data1 = {
  963. type: 'corp',
  964. fMblno: this.form.fMblno,
  965. corpId: this.form.fCorpid
  966. }
  967. changeSelect(data1).then(res => {
  968. this.warehouseOptions = res.data.warehouseList
  969. this.goodsOptions = res.data.whgenlegVOList
  970. if (this.warehouseOptions.length > 0) {
  971. this.form.fWarehouseid = this.warehouseOptions[0].fId
  972. let data2 = {
  973. type: 'warehouse',
  974. fMblno: this.form.fMblno,
  975. corpId: this.form.fCorpid,
  976. warehouseId: this.form.fWarehouseid
  977. }
  978. changeSelect(data2).then(res => {
  979. this.goodsOptions = res.data.goodsVOList
  980. if (this.goodsOptions.length > 0) {
  981. this.form.fGoodsid = this.goodsOptions[0].fId
  982. }
  983. })
  984. }
  985. })
  986. }
  987. })
  988. }else {
  989. listCorps({ type: 1 }).then((response) => {
  990. this.fMblnoOptions = response.rows
  991. })
  992. listWarehousesss({ fStatus: 0, delFlag: 0 }).then((response) => {
  993. this.warehouseOptions = response.rows;
  994. })
  995. listGoods({fStatus: 0, delFlag: 0}).then((response) => {
  996. this.goodsOptions = response.rows;
  997. });
  998. }
  999. }
  1000. },
  1001. changeCorp() {
  1002. if (this.form.fMblno && this.form.fCorpid) {
  1003. this.$set(this.form, "fWarehouseid", '')
  1004. this.$set(this.form, "fGoodsid", '')
  1005. let data = {
  1006. type: 'corp',
  1007. fMblno: this.form.fMblno,
  1008. corpId: this.form.fCorpid
  1009. }
  1010. changeSelect(data).then(res => {
  1011. this.warehouseOptions = res.data.warehouseList
  1012. this.goodsOptions = res.data.whgenlegVOList
  1013. if (this.warehouseOptions.length > 0) {
  1014. this.form.fWarehouseid = this.warehouseOptions[0].fId
  1015. let data1 = {
  1016. type: 'warehouse',
  1017. fMblno: this.form.fMblno,
  1018. corpId: this.form.fCorpid,
  1019. warehouseId: this.form.fWarehouseid
  1020. }
  1021. changeSelect(data1).then(res => {
  1022. this.goodsOptions = res.data.goodsVOList
  1023. if (this.goodsOptions.length > 0) {
  1024. this.form.fGoodsid = this.goodsOptions[0].fId
  1025. }
  1026. })
  1027. }
  1028. })
  1029. } else if (this.form.fMblno && !this.form.fCorpid) {
  1030. this.$set(this.form, "fWarehouseid", '')
  1031. this.$set(this.form, "fGoodsid", '')
  1032. this.warehouseOptions = []
  1033. this.goodsOptions = []
  1034. }
  1035. },
  1036. changefWarehouseid() {
  1037. if (this.form.fMblno && this.form.fCorpid && this.form.fWarehouseid) {
  1038. this.$set(this.form, "fGoodsid", '')
  1039. let data = {
  1040. type: 'warehouse',
  1041. fMblno: this.form.fMblno,
  1042. corpId: this.form.fCorpid,
  1043. warehouseId: this.form.fWarehouseid
  1044. }
  1045. changeSelect(data).then(res => {
  1046. this.goodsOptions = res.data.goodsVOList
  1047. if (this.goodsOptions.length > 0) {
  1048. this.form.fGoodsid = this.goodsOptions[0].fId
  1049. }
  1050. })
  1051. } else if (this.form.fMblno && !this.form.fWarehouseid) {
  1052. this.$set(this.form, "fGoodsid", '')
  1053. this.goodsOptions = []
  1054. }
  1055. treeselect(this.form.fWarehouseid).then((response) => {
  1056. this.fWarehouseidOptions = response.data;
  1057. });
  1058. },
  1059. goodsChange(data) {
  1060. },
  1061. addprint(status) {
  1062. const style =
  1063. "@page { } " +
  1064. "@media print { .print-div{ padding:8px;background-color:#cccccc;} .print-title{display:flex;justify-content: center;font-size:24px} .print_form{font-size:12px} .print_table table {border-right: 1px solid #000;border-bottom: 1px solid #000;font-size:12px} .print_table table td {border-left: 1px solid #000;border-top: 1px solid #000;padding:2px;vertical-align:middle;text-align: center;}";
  1065. if (status == 'ckd') {
  1066. print({
  1067. printable: "print_ckd",
  1068. type: "html",
  1069. style: style, // 亦可使用引入的外部css;
  1070. scanStyles: false,
  1071. });
  1072. }
  1073. },
  1074. // 合计
  1075. getSummaries(param) {
  1076. const {columns, data} = param;
  1077. const sums = [];
  1078. var values = [];
  1079. columns.forEach((column, index) => {
  1080. if (index === 0) {
  1081. sums[index] = "";
  1082. return;
  1083. }
  1084. if (column.property === "fGrossweight") {
  1085. values = data.map((item) => Number(item["fGrossweight"]));
  1086. }
  1087. if (column.property === "fNetweight") {
  1088. values = data.map((item) => Number(item["fNetweight"]));
  1089. }
  1090. if (column.property === "fQty") {
  1091. values = data.map((item) => Number(item["fQty"]));
  1092. }
  1093. if (column.property === "fCntqty") {
  1094. values = data.map((item) => Number(item["fCntqty"]));
  1095. }
  1096. if (
  1097. column.property === "fGrossweight" ||
  1098. column.property === "fNetweight" ||
  1099. column.property === "fQty" ||
  1100. column.property === "fCntqty"
  1101. ) {
  1102. sums[index] = values.reduce((prev, curr) => {
  1103. const value = Number(curr);
  1104. if (!isNaN(value)) {
  1105. if (column.property === "fGrossweight") {
  1106. this.fGrossweight = prev + curr;
  1107. }
  1108. if (column.property === "fNetweight") {
  1109. this.fNetweight = prev + curr;
  1110. }
  1111. if (column.property === "fQty") {
  1112. this.fQty = prev + curr;
  1113. this.sumMum = prev + curr;
  1114. }
  1115. if (column.property === "fCntqty") {
  1116. this.fCntqty = prev + curr;
  1117. }
  1118. return prev + curr;
  1119. } else {
  1120. return prev;
  1121. }
  1122. }, 0);
  1123. if (column.property === "fGrossweight") {
  1124. sums[index] = (sums[index] / 1000).toFixed(4) + "吨";
  1125. } else if (column.property === "fNetweight") {
  1126. sums[index] = (sums[index] / 1000).toFixed(4) + "吨";
  1127. } else {
  1128. // sums[index] = sums[index].toFixed(2);
  1129. sums[index] = sums[index]
  1130. }
  1131. }
  1132. });
  1133. this.sums = sums;
  1134. return sums;
  1135. },
  1136. //列设置全选
  1137. allChecked() {
  1138. if (this.allCheck == true) {
  1139. this.setRowList.map((e) => {
  1140. return (e.checked = 0);
  1141. });
  1142. } else {
  1143. this.setRowList.map((e) => {
  1144. return (e.checked = 1);
  1145. });
  1146. }
  1147. },
  1148. //开始拖拽事件
  1149. onStart() {
  1150. this.drag = true;
  1151. },
  1152. //拖拽结束事件
  1153. onEnd() {
  1154. this.drag = false;
  1155. },
  1156. //重置列表
  1157. delRow() {
  1158. this.data = {
  1159. tableName: "快速出库明细",
  1160. userId: Cookies.get("userName"),
  1161. };
  1162. resetModule(this.data).then((res) => {
  1163. if (res.code == 200) {
  1164. this.showSetting = false;
  1165. this.setRowList = this.tableDate;
  1166. console.log(this.setRowList)
  1167. this.getRowList = this.tableDate;
  1168. }
  1169. });
  1170. },
  1171. //保存列设置
  1172. save() {
  1173. this.showSetting = false;
  1174. this.data = {
  1175. tableName: "快速出库明细",
  1176. userId: Cookies.get("userName"),
  1177. sysTableSetList: this.setRowList,
  1178. };
  1179. addSet(this.data).then((res) => {
  1180. this.getRowList = this.setRowList.filter((e) => e.checked == 0);
  1181. });
  1182. },
  1183. //查询列数据
  1184. getRow() {
  1185. let that = this;
  1186. this.data = {
  1187. tableName: "快速出库明细",
  1188. userId: Cookies.get("userName"),
  1189. };
  1190. select(this.data).then((res) => {
  1191. if (res.data.length != 0) {
  1192. this.getRowList = res.data.filter((e) => e.checked == 0);
  1193. this.setRowList = res.data;
  1194. this.setRowList = this.setRowList.reduce((res, item) => {
  1195. res.push({
  1196. surface: item.surface,
  1197. label: item.label,
  1198. name: item.name,
  1199. checked: item.checked,
  1200. width: item.width,
  1201. fixed: item.fixed,
  1202. });
  1203. return res;
  1204. }, []);
  1205. }
  1206. });
  1207. },
  1208. },
  1209. }
  1210. </script>
  1211. <style scoped lang="scss">
  1212. .print-div {
  1213. color: #000;
  1214. }
  1215. .print_table {
  1216. table {
  1217. border-right: 1px solid #000;
  1218. border-bottom: 1px solid #000;
  1219. font-size: 12px;
  1220. margin-bottom: 5px;
  1221. }
  1222. table td {
  1223. border-left: 1px solid #000;
  1224. border-top: 1px solid #000;
  1225. vertical-align: middle;
  1226. padding: 2px;
  1227. text-align: center;
  1228. }
  1229. }
  1230. .print_form {
  1231. font-size: 12px;
  1232. }
  1233. </style>