明晋仓库前台
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.

storechange.vue 31KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934
  1. <template>
  2. <div style="height:100%;">
  3. <div class="searchForm-header">
  4. <el-form :model="query" label-width="100px" inline="">
  5. <el-row>
  6. <el-form-item label="库房名称" style="margin-left: -15px">
  7. <el-select v-model="query.wareName" clearable size="small" style="width:120px;margin-left: -8px">
  8. <el-option v-for="item in optionsWare" :key="item.id" :label="item.name" :value="item.name">
  9. </el-option>
  10. </el-select>
  11. </el-form-item>
  12. <el-form-item label="垛位名称" style="margin-left: -35px">
  13. <el-input v-model="query.stackName" size="small" style="width:120px;margin-left: -8px"></el-input>
  14. </el-form-item>
  15. <el-form-item label="钢板号" style="margin-left: -15px">
  16. <el-input v-model="query.plateNo" size="small" style="width:120px;margin-left: -8px" @input="getPltList">
  17. </el-input>
  18. </el-form-item>
  19. <el-form-item label="物料名称" style="margin-left: -35px">
  20. <el-input v-model="query.materialName" size="small" style="width:120px;margin-left: -8px">
  21. <el-button slot="append" icon="el-icon-search" @click="showMaterial"></el-button>
  22. </el-input>
  23. </el-form-item>
  24. <el-form-item label="钢种" style="margin-left: -35px">
  25. <el-input v-model="query.standard" size="small" style="width:150px;margin-left: -8px">
  26. <el-button slot="append" icon="el-icon-search" @click="showMaterial"></el-button>
  27. </el-input>
  28. </el-form-item>
  29. <el-form-item label="客户名称" style="margin-left: -35px">
  30. <el-select v-model="query.fkcustmerName" filterable placeholder="请选择客户名称" clearable size="small" style="margin-left: 5px; width: 170px">
  31. <el-option v-for="item in optionsCust" :key="item.name" :label="item.name" :value="item.name" >
  32. </el-option>
  33. </el-select>
  34. </el-form-item>
  35. <el-form-item label="订单客户" style="margin-left: -35px">
  36. <el-select v-model="query.customerName" filterable placeholder="请选择订单客户" clearable size="small" style="margin-left: 5px; width: 170px">
  37. <el-option v-for="item in optionsCust" :key="item.name" :label="item.name" :value="item.name" >
  38. </el-option>
  39. </el-select>
  40. </el-form-item>
  41. <el-form-item label="规格型号" style="margin-left: -15px">
  42. <el-input v-model="query.model" size="small" style="width:120px;margin-left: -8px">
  43. </el-input>
  44. </el-form-item>
  45. <el-form-item label="订单号" style="margin-left: -15px">
  46. <el-input v-model="query.ordNo" size="small" style="width:120px;margin-left: -8px" @input="getOrdList">
  47. </el-input>
  48. </el-form-item>
  49. <el-form-item label="垛位备注" style="margin-left: -15px">
  50. <el-input v-model="query.remark1" size="small" style="width:120px;margin-left: -8px">
  51. </el-input>
  52. </el-form-item>
  53. <el-form-item label="" style="margin-top: 0px;margin-left: 10px">
  54. <el-button @click="handleSearch" size="small" type="primary">查询</el-button>
  55. <el-button @click="showChangeCustomer" size="small" type="primary">货权转移</el-button>
  56. <!-- <el-button size="medium" type="primary" @click="handleImport">导入</el-button>
  57. <el-button size="medium" type="primary" @click="handleDownload">下载模板</el-button>
  58. <el-button size="medium" type="success" @click="showIn">入库</el-button>
  59. <el-button size="medium" type="danger" @click="handleInBack">取消入库</el-button> -->
  60. <el-button type="primary" size="small" @click="showDistribution">配货</el-button>
  61. <el-button type="primary" size="small" @click="showOut">出库</el-button>
  62. <el-button type="primary" size="small" @click="resetButton" :disabled="backAble">重置</el-button>
  63. <el-button type="primary" size="small" @click="handleRemark1" :disabled="backAble">修改垛位备注</el-button>
  64. <el-button type="success" size="small" @click="handleExport" >导出记录</el-button>
  65. </el-form-item>
  66. <el-form-item label="" style="margin-top: 0px;margin-left: 10px">
  67. <el-dropdown placement="bottom" trigger="click" @command="batchOperate">
  68. <el-button type="danger" size="small"> 其他操作<i class="el-icon-arrow-down el-icon--right"></i></el-button>
  69. <el-dropdown-menu slot="dropdown">
  70. <el-dropdown-item command="handleInBack" style="background-color: #f5f5f5;">取消入库</el-dropdown-item>
  71. </el-dropdown-menu>
  72. </el-dropdown>
  73. </el-form-item>
  74. <!-- <el-button type="primary" @click="showOut">出库</el-button> -->
  75. <!-- <el-form-item label=" ">
  76. <el-button @click="showChangeAddress" type="primary">修改地址</el-button>
  77. </el-form-item> -->
  78. <el-form-item label="数量" style="margin-left: -15px">
  79. <el-input v-model="sumCount" size="small" style="width:120px;margin-left: -8px">
  80. </el-input>
  81. </el-form-item>
  82. <el-form-item label="重量" style="margin-left: -15px">
  83. <el-input v-model="sumWeight" size="small" style="width:120px;margin-left: -8px">
  84. </el-input>
  85. </el-form-item>
  86. </el-row>
  87. </el-form>
  88. </div>
  89. <div class="tabledata-grid">
  90. <el-table :data="tableData" height="100%" border style="width: 97%;" v-loading="loading" ref="multipleTable" @select="handleTableSelect" @selection-change="handleSelectionChange" @select-all = "selectAll">
  91. <el-table-column type="selection" width="40" header-align="center" align="center"></el-table-column>
  92. <el-table-column prop="layer" label="层数" width="60" show-overflow-tooltip header-align="center" align="center">
  93. </el-table-column>
  94. <el-table-column prop="stack.name" label="垛位" width="120" show-overflow-tooltip header-align="center" align="center">
  95. </el-table-column>
  96. <el-table-column prop="material.name" label="货物品名" width="100" show-overflow-tooltip header-align="center" align="center">
  97. </el-table-column>
  98. <el-table-column prop="material.standard" label="材质" width="100" show-overflow-tooltip header-align="center" align="center">
  99. </el-table-column>
  100. <el-table-column prop="plateNo" label="钢板号" width="200" show-overflow-tooltip header-align="center">
  101. </el-table-column>
  102. <el-table-column prop="model" label="规格型号" width="160" show-overflow-tooltip header-align="center" align="center">
  103. </el-table-column>
  104. <el-table-column prop="count" label="数量" width="120" show-overflow-tooltip align="right" header-align="center">
  105. </el-table-column>
  106. <el-table-column prop="weight" label="重量" width="120" show-overflow-tooltip align="right" header-align="center">
  107. </el-table-column>
  108. <el-table-column prop="ordNo" label="订单号" width="180" show-overflow-tooltip header-align="center">
  109. </el-table-column>
  110. <el-table-column prop="contractNo" label="合约号" width="180" show-overflow-tooltip header-align="center">
  111. </el-table-column>
  112. <el-table-column prop="customer.name" label="订单客户" width="300" show-overflow-tooltip header-align="center">
  113. </el-table-column>
  114. <el-table-column prop="fkComponyId" label="客户名称" width="300" show-overflow-tooltip header-align="center">
  115. </el-table-column>
  116. <el-table-column prop="receiveAddress" label="收货地址" width="300" show-overflow-tooltip header-align="center">
  117. </el-table-column>
  118. <el-table-column prop="productionPlace" label="产地" width="250" show-overflow-tooltip header-align="center">
  119. </el-table-column>
  120. <el-table-column prop="remark" label="备注" width="150" show-overflow-tooltip header-align="center">
  121. </el-table-column>
  122. <el-table-column prop="remark1" label="垛位备注" width="200" show-overflow-tooltip header-align="center">
  123. </el-table-column>
  124. <el-table-column prop="addTime" label="入库时间" width="200" show-overflow-tooltip header-align="center">
  125. </el-table-column>
  126. <el-table-column prop="carNo" label="入库车号" width="200" show-overflow-tooltip header-align="center">
  127. </el-table-column>
  128. </el-table>
  129. <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
  130. :page-sizes="pageSizes" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" :total="totalRows">
  131. </el-pagination>
  132. </div>
  133. <popup-material ref="PopupMaterial" @receviceFromChild="receviceFromMaterial"></popup-material>
  134. <popup-customer ref="PopupCustomer" @receviceFromChild="receviceFromCustomer"></popup-customer>
  135. <popup-customer ref="PopupFKcustmer" @receviceFromChild="receviceFKcustmerr"></popup-customer>
  136. <popup-customer ref="PopupNewCustomer" @receviceFromChild="receviceFromNewCustomer"></popup-customer>
  137. <popup-address ref="PopupAddress" @receviceFromChild="receviceFromAddress"></popup-address>
  138. <popup-distribution ref="PopupDistribution" @receviceFromChild="receviceFromDistreibution" :selectRows="selectRows"></popup-distribution>
  139. <popup-out ref="PopupOut" @receviceFromChild="receviceFromOut"></popup-out>
  140. <popup-in ref="PopupIn" @receviceFromChild="receviceFromIn" :wares="options" :wareId="query.wareId" :stack="moveFromStack"></popup-in>
  141. <el-dialog title="货权转移" :visible.sync="customerDialogVisible" width="500px">
  142. <el-form>
  143. <el-form-item label="旧货主">
  144. <el-input v-model="oldCustomer">
  145. </el-input>
  146. </el-form-item>
  147. <el-form-item label="新货主">
  148. <el-select v-model="newCustomer.name" filterable placeholder="请选择订单客户" clearable>
  149. <el-option v-for="item in optionsCust" :key="item.id" :label="item.name" :value="item.id" >
  150. </el-option>
  151. </el-select>
  152. </el-form-item>
  153. <el-form-item label="修改地址">
  154. <el-input v-model="newAddress">
  155. <el-button slot="append" icon="el-icon-search" @click="showAddress"></el-button>
  156. </el-input>
  157. </el-form-item>
  158. <el-form-item label=" ">
  159. <el-button type="success" @click="handleCustomerSave">保存</el-button>
  160. <el-button type="danger" @click="handleCustomerCancelSave">取消</el-button>
  161. </el-form-item>
  162. </el-form>
  163. </el-dialog>
  164. <el-dialog title="垛位备注" :visible.sync="stackDialogVisible" width="500px">
  165. <el-form>
  166. <el-form-item label="库房名称" style="margin-left: -15px">
  167. <el-select v-model="newWare" clearable size="small" style="width:120px;margin-left: -8px">
  168. <el-option v-for="item in optionsWare" :key="item.id" :label="item.name" :value="item.name">
  169. </el-option>
  170. </el-select>
  171. </el-form-item>
  172. <el-form-item label="新垛位">
  173. <el-input v-model="newStack">
  174. </el-input>
  175. </el-form-item>
  176. <el-form-item label="新垛位备注">
  177. <el-input v-model="newRemark1">
  178. </el-input>
  179. </el-form-item>
  180. <el-form-item label=" ">
  181. <el-button type="success" @click="handleStackSave">保存</el-button>
  182. <el-button type="danger" @click="handleStackCancelSave">取消</el-button>
  183. </el-form-item>
  184. </el-form>
  185. </el-dialog>
  186. <el-dialog title="库房明细" :visible.sync="importDialogVisible" width="1000px">
  187. <el-upload class="upload-demo" action="" :on-change="handleChange" :on-exceed="handleExceed" :on-remove="handleRemove"
  188. ref="upload" :limit="1" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel"
  189. :auto-upload="false">
  190. <el-button slot="trigger" size="small" type="primary">选择文件</el-button>
  191. <el-button size="small" type="success" @click="inImport">保存</el-button>
  192. <!-- <div slot="tip" class="el-upload__tip">只 能 上 传 xlsx / xls 文 件</div> -->
  193. </el-upload>
  194. <el-table :data="imTableData" border>
  195. <el-table-column prop="层数" label="层数" width="60" show-overflow-tooltip header-align="center">
  196. </el-table-column>
  197. <el-table-column prop="库房" label="库房" width="100" show-overflow-tooltip header-align="center">
  198. </el-table-column>
  199. <el-table-column prop="垛位" label="垛位" width="120" show-overflow-tooltip header-align="center">
  200. </el-table-column>
  201. <el-table-column prop="物料" label="物料" width="120" show-overflow-tooltip align="center" header-align="center">
  202. </el-table-column>
  203. <el-table-column prop="钢种" label="钢种" width="120" show-overflow-tooltip align="center" header-align="center">
  204. </el-table-column>
  205. <el-table-column prop="钢板号" label="钢板号" width="200" show-overflow-tooltip header-align="center">
  206. </el-table-column>
  207. <el-table-column prop="规格型号" label="规格型号" width="120" show-overflow-tooltip header-align="center">
  208. </el-table-column>
  209. <el-table-column prop="数量" label="数量" width="120" show-overflow-tooltip align="right" header-align="center">
  210. </el-table-column>
  211. <el-table-column prop="重量" label="重量" width="120" show-overflow-tooltip align="right" header-align="center">
  212. </el-table-column>
  213. <el-table-column prop="客户" label="客户" width="300" show-overflow-tooltip header-align="center">
  214. </el-table-column>
  215. <el-table-column prop="备注" label="备注" width="150" show-overflow-tooltip header-align="center">
  216. </el-table-column>
  217. </el-table>
  218. </el-dialog>
  219. </div>
  220. </template>
  221. <script>
  222. import axios from '@/axios'
  223. import PopupStack from '@/components/PopupStack.vue'
  224. import PopupMaterial from '@/components/PopupMaterial.vue'
  225. import PopupCustomer from '@/components/PopupCustomer.vue'
  226. import PopupAddress from '@/components/PopupAddress.vue'
  227. import PopupDistribution from '@/components/PopupDistribution.vue'
  228. import PopupOut from '@/components/PopupOut.vue'
  229. import PopupIn from '@/components/PopupIn.vue'
  230. import Export2Excel from '../../excel/Export2Excel.js'
  231. import {
  232. mapState
  233. } from 'vuex'
  234. export default {
  235. components: {
  236. PopupStack,
  237. PopupMaterial,
  238. PopupCustomer,
  239. PopupAddress,
  240. PopupDistribution,
  241. PopupOut,
  242. PopupIn,
  243. },
  244. computed: {
  245. // splitCount: function() {
  246. // let result = Number(this.split.originalCount) - Number(this.split.count)
  247. // return result
  248. // },
  249. // splitWeight: function() {
  250. // let result = Number(this.split.originalWeight) - Number(this.split.weight)
  251. // return result
  252. // },
  253. ...mapState({
  254. serverName: state => state.app.serverName,
  255. // wareBackgroundColor: state => state.color.wareBackgroundColor,
  256. // stackColor: state => state.color.stackColor,
  257. // stackSelectedColor: state => state.color.stackSelectedColor,
  258. // lockColor: state => state.color.lockColor,
  259. })
  260. },
  261. data() {
  262. return {
  263. addressDialogVisible: false,
  264. customerDialogVisible: false,
  265. query: {
  266. wareName: '',
  267. stackName: '',
  268. model: '',
  269. materialName: '',
  270. standard: '',
  271. customerName: '',
  272. plateNo: [],
  273. wareId:'',
  274. ordNo:[],
  275. fkcustmerName:'',
  276. remark1:''
  277. },
  278. multipleSelection: [],
  279. tableData: [],
  280. optionsWare: [],
  281. oldCustomer:'',
  282. newCustomer: {
  283. id: '',
  284. name: ''
  285. },
  286. newAddress: '',
  287. currentPage: 1,
  288. totalRows: 0,
  289. pageSizes: [50, 100, 200,1000],
  290. pageSize: 1000,
  291. HideAndShow: 0,
  292. loading: false,
  293. importDialogVisible: false,
  294. selectRows: [],
  295. options: [],
  296. moveFromStack: {}, //移除垛位
  297. fileTemp: [],
  298. imTableData: [],
  299. moveStore: {},
  300. optionsCust: [],
  301. sumCount:'',
  302. sumWeight:'',
  303. stackDialogVisible: false,
  304. newWare:'',
  305. newStack:'',
  306. newRemark1:'',
  307. };
  308. },
  309. mounted() {
  310. this.getWare()
  311. this.getAllCustomer()
  312. //this.getTableData()
  313. },
  314. methods: {
  315. showMaterial() {
  316. this.$refs.PopupMaterial.show()
  317. },
  318. receviceFromMaterial(material) {
  319. this.query.materialName = material.name
  320. this.query.standard = material.standard
  321. },
  322. batchOperate(command) {
  323. switch (command) {
  324. case "handleInBack":
  325. this.handleInBack();
  326. break;
  327. }
  328. },
  329. showCustomer() {
  330. this.$refs.PopupCustomer.show()
  331. },
  332. receviceFromCustomer(customer) {
  333. this.query.customerName = customer.name
  334. },
  335. showFKcustmer() {
  336. this.$refs.PopupFKcustmer.show()
  337. },
  338. receviceFKcustmerr(customer) {
  339. this.query.fkcustmerName = customer.name
  340. },
  341. showNewCustomer() {
  342. this.$refs.PopupNewCustomer.show()
  343. },
  344. receviceFromNewCustomer(customer) {
  345. this.newCustomer = customer
  346. this.newAddress = customer.address
  347. },
  348. showAddress() {
  349. this.$refs.PopupAddress.show(this.newCustomer.id)
  350. },
  351. receviceFromAddress(address) {
  352. this.newAddress = address.address
  353. },
  354. handleSearch() {
  355. this.currentPage = 1
  356. this.getTableData()
  357. },
  358. handleImport() {
  359. this.importDialogVisible = true
  360. },
  361. handleDownload() {
  362. window.open(this.serverName.substr(0, this.serverName.lastIndexOf('/', this.serverName.lastIndexOf('/') - 1)) +
  363. '/import.xls')
  364. },
  365. showIn() {
  366. // if (this.query.wareId == '') {
  367. // this.$message({
  368. // type: 'error',
  369. // message: '请选择入库库房'
  370. // });
  371. // return
  372. // }
  373. // if (this.query.stackId == '') {
  374. // this.$message({
  375. // type: 'error',
  376. // message: '请选择入库垛位'
  377. // });
  378. // return
  379. // }
  380. this.$refs.PopupIn.show()
  381. },
  382. handleInBack() {
  383. this.$confirm("确认删除吗?", "提示", {
  384. confirmButtonText:'确认',
  385. cancelButtonText:'取消',
  386. type: "warning"
  387. }).then(() => {
  388. if (this.selectRows.length < 1) {
  389. this.$message({
  390. type: 'error',
  391. message: '至少选择一条数据!',
  392. });
  393. return
  394. } else {
  395. var url = 'WareIn/back.do'
  396. var param = {
  397. json: JSON.stringify(this.selectRows),
  398. }
  399. axios.post(url, param).then(response => {
  400. if (response.data.code == 0) {
  401. this.getStoreByStackId(response.data.data)
  402. } else {
  403. this.$message({
  404. type: 'error',
  405. message: '操作失败;' + response.data.msg,
  406. });
  407. }
  408. });
  409. }
  410. }).catch(() => {});
  411. },
  412. resetButton(){ //查询条件重置
  413. this.query.wareName = '',
  414. this.query.stackName = '',
  415. this.query.model = '',
  416. this.query.materialName = '',
  417. this.query.standard = '',
  418. this.query.customerName = '',
  419. this.query.plateNo = '',
  420. this.query.wareId = '',
  421. this.query.ordNo = '',
  422. this.query.fkcustmerName = ''
  423. },
  424. showDistribution() {
  425. //console.log(this.selectRows.length)
  426. if (this.selectRows.length < 1) {
  427. this.$message({
  428. type: 'warning',
  429. message: '至少选择一条数据!',
  430. });
  431. }
  432. this.$refs.PopupDistribution.show()
  433. },
  434. showOut() {
  435. this.$refs.PopupOut.show()
  436. },
  437. getWare() {
  438. var url = 'MaintWare/queryByUserId.do'
  439. var param = {}
  440. axios.get(url, param).then(response => {
  441. this.optionsWare = response.data.data
  442. if (response.data.data.length == 1) {
  443. this.wareName = response.data.data[0].name
  444. }
  445. });
  446. },
  447. getAllCustomer() {
  448. var url = 'MaintCustomer/queryByUserId.do'
  449. var param = {}
  450. axios.get(url, param).then(response => {
  451. this.optionsCust = response.data.data
  452. });
  453. },
  454. handleSizeChange(val) {
  455. this.pageSize = val
  456. this.getTableData()
  457. },
  458. handleCurrentChange(val) {
  459. this.currentPage = val
  460. this.getTableData()
  461. },
  462. search() {
  463. this.currentPage = 1
  464. this.getTableData()
  465. },
  466. getTableData() {
  467. this.loading = true
  468. var url = 'WareStore/queryStore.do'
  469. var param = {
  470. page: this.currentPage,
  471. rows: this.pageSize,
  472. wareName: this.query.wareName,
  473. stackName: this.query.stackName,
  474. model: this.query.model,
  475. materialName: this.query.materialName,
  476. standard: this.query.standard,
  477. customerName: this.query.customerName,
  478. fkcustmerName: this.query.fkcustmerName,
  479. plateNo: this.query.plateNo.length == 0 ? '' : this.query.plateNo.join(','),
  480. ordNo: this.query.ordNo == 0 ? '' : this.query.ordNo.join(','),
  481. remark1: this.query.remark1
  482. }
  483. //console.log(param);
  484. axios.get(url, param).then(response => {
  485. if (response.data.code == 0) {
  486. //console.log(response.data.data.list);
  487. this.tableData = response.data.data.list
  488. this.totalRows = response.data.data.total
  489. } else {
  490. this.$message({
  491. type: 'error',
  492. message: '操作失败;' + response.data.msg,
  493. });
  494. }
  495. this.loading = false
  496. });
  497. },
  498. handleSelectionChange(val) {
  499. this.multipleSelection = val;
  500. this.sumCount =0;
  501. this.sumWeight=0;
  502. for (var i = 0; i < this.multipleSelection.length; i++){
  503. this.sumCount = parseInt(this.multipleSelection[i].count)+parseInt(this.sumCount);
  504. this.sumWeight = parseFloat(this.multipleSelection[i].weight)+parseFloat(this.sumWeight);
  505. }
  506. this.sumWeight = this.sumWeight.toFixed(3);
  507. },
  508. showChangeCustomer() {
  509. if (this.multipleSelection.length < 1) {
  510. this.$message({
  511. type: 'error',
  512. message: '至少选择一条记录!',
  513. });
  514. return
  515. }
  516. var customerAddress = this.multipleSelection[0].customer.address
  517. var boolean = true
  518. for (var i = 0; i < this.multipleSelection.length; i++) {
  519. if (this.multipleSelection[i].customer.address == customerAddress) {
  520. } else {
  521. boolean = boolean && false
  522. customerAddress = this.multipleSelection[i].customer.address
  523. }
  524. }
  525. if (boolean) {
  526. this.oldCustomer = this.multipleSelection[0].customer.name
  527. //this.newAddress = this.multipleSelection[0].receiveAddress
  528. this.newCustomer.name = "",
  529. this.newCustomer.id = "",
  530. this.customerDialogVisible = true
  531. } else {
  532. this.$message({
  533. type: 'error',
  534. message: '请选择同一客户!',
  535. });
  536. }
  537. },
  538. handleCustomerSave() {
  539. this.newCustomer.id = this.newCustomer.name;
  540. var url = 'WareChange/changeCustomer.do'
  541. var param = {
  542. json: JSON.stringify(this.multipleSelection),
  543. customer: JSON.stringify(this.newCustomer),
  544. address: this.newAddress
  545. }
  546. axios.post(url, param).then(response => {
  547. if (response.data.code == 0) {
  548. this.getTableData()
  549. this.customerDialogVisible = false
  550. } else {
  551. this.$message({
  552. type: 'error',
  553. message: '操作失败;' + response.data.msg,
  554. });
  555. }
  556. });
  557. },
  558. handleCustomerCancelSave() {
  559. this.customerDialogVisible = false
  560. },
  561. handleRemark1(){
  562. this.stackDialogVisible= true;
  563. this.newStack='';
  564. this.newRemark1='';
  565. },
  566. handleStackSave(){
  567. var url = 'WareStore/changeStack.do'
  568. var param = {
  569. json: JSON.stringify(this.multipleSelection),
  570. newWare: this.newWare,
  571. newStack: this.newStack,
  572. newRemark1: this.newRemark1
  573. }
  574. axios.post(url, param).then(response => {
  575. if (response.data.code == 0) {
  576. this.getTableData()
  577. this.stackDialogVisible = false
  578. } else {
  579. this.$message({
  580. type: 'error',
  581. message: '操作失败;' + response.data.msg,
  582. });
  583. }
  584. });
  585. },
  586. handleStackCancelSave(){
  587. this.stackDialogVisible = false
  588. },
  589. inImport() {
  590. var url = 'WareIn/inImport.do'
  591. var json = JSON.stringify(this.imTableData)
  592. var param = {
  593. json: json
  594. }
  595. axios.post(url, param).then(response => {
  596. if (response.data.code == '0') {
  597. this.$message({
  598. type: 'success',
  599. message: '入库成功!',
  600. });
  601. this.importDialogVisible = false
  602. this.imTableData = []
  603. this.fileTemp = null
  604. } else {
  605. this.$message({
  606. type: 'error',
  607. message: '入库失败!' + response.data.msg
  608. });
  609. }
  610. });
  611. },
  612. handleTableSelectionChange(val) {
  613. this.selectRows = val
  614. this.setLayerColor()
  615. },
  616. receviceFromDistreibution() {
  617. this.getStoreByStackId(null)
  618. },
  619. getStoreByStackId(moveSelect) {
  620. this.tableDataLoading = true
  621. var url = 'WareStore/queryByWareIdStackId.do'
  622. var param = {
  623. wareId: this.query.wareId,
  624. stackId: this.moveFromStack.id
  625. }
  626. axios.get(url, param).then(response => {
  627. if (response.data.code == 0) {
  628. this.tableData = response.data.data
  629. this.selectRows = []
  630. // if (this.isLayer == '0') {
  631. // this.drawStoreNoLayer(response.data.data)
  632. // } else if (this.isLayer == '1') { //1是A开头的,2是B开头的,3是C开头的。
  633. // this.drawStoreAutoLayer(response.data.data)
  634. // } else if (this.isLayer == '2') {
  635. // this.drawStoreManulLayer(response.data.data)
  636. // }
  637. if (moveSelect) {
  638. this.$refs.multipleTable.clearSelection();
  639. for (let i = 0; i < this.tableData.length; i++) {
  640. for (let j = 0; j < moveSelect.length; j++) {
  641. if (moveSelect[j].layer === this.tableData[i].layer) {
  642. this.selectRows.push(this.tableData[i])
  643. }
  644. }
  645. }
  646. this.$nextTick(() => {
  647. this.toggleSelection(this.selectRows, true)
  648. this.setLayerColor()
  649. })
  650. }
  651. } else {
  652. this.$message({
  653. type: 'error',
  654. message: '保存失败' + response.data.msg,
  655. });
  656. }
  657. this.tableDataLoading = false
  658. });
  659. },
  660. receviceFromOut(customer) {
  661. this.getStoreByStackId()
  662. },
  663. receviceFromIn() {
  664. this.getStoreByStackId()
  665. },
  666. handleChange(file, fileList) {
  667. this.fileTemp = file.raw
  668. if (this.fileTemp) {
  669. if ((this.fileTemp.type == 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet') || (this.fileTemp.type ==
  670. 'application/vnd.ms-excel')) {
  671. this.importfxx(this.fileTemp)
  672. } else {
  673. this.$message({
  674. type: 'warning',
  675. message: '附件格式错误,请删除后重新上传!'
  676. })
  677. }
  678. } else {
  679. this.$message({
  680. type: 'warning',
  681. message: '请上传附件!'
  682. })
  683. }
  684. },
  685. handleExceed(file, fileList) {},
  686. handleRemove(file, fileList) {
  687. this.fileTemp = null
  688. },
  689. toggleSelection(rows, selected) {
  690. if (rows) {
  691. rows.forEach(row => {
  692. this.$refs.multipleTable.toggleRowSelection(row, selected); //接受两个参数,row传递被勾选行的数据,selected设置是否选中
  693. });
  694. }
  695. },
  696. setLayerColor() {
  697. if (this.selectRows.length == 0) {
  698. for (let i = 0; i < this.moveStore.storage._roots.length; i++) {
  699. if (this.tableData[i].lockFlag == '1') {
  700. this.moveStore.storage._roots[i].attr('style', {
  701. fill: this.lockColor,
  702. })
  703. } else {
  704. this.moveStore.storage._roots[i].attr('style', {
  705. fill: this.stackColor,
  706. })
  707. }
  708. }
  709. } else {
  710. for (let i = 0; i < this.moveStore.storage._roots.length; i++) {
  711. for (let j = 0; j < this.selectRows.length; j++) {
  712. if (this.tableData[i] === this.selectRows[j]) {
  713. this.moveStore.storage._roots[i].attr('style', {
  714. fill: this.stackSelectedColor,
  715. })
  716. break;
  717. } else {
  718. if (this.tableData[i].lockFlag == '1') {
  719. this.moveStore.storage._roots[i].attr('style', {
  720. fill: this.lockColor,
  721. })
  722. } else {
  723. this.moveStore.storage._roots[i].attr('style', {
  724. fill: this.stackColor,
  725. })
  726. }
  727. }
  728. }
  729. }
  730. }
  731. },
  732. handleTableSelect(selection, row) { //第一个参数是目前所有选中的数据
  733. console.log(JSON.stringify(row))
  734. if (row.lockFlag == '1') {
  735. // this.$message({
  736. // type: 'error',
  737. // message: '该行已被配货锁定',
  738. // });
  739. alert("该行已被配货锁定")
  740. this.toggleSelection([row], false)
  741. // for(let i = 0;i<selection.length;i++){
  742. // if(selection[i]==row){
  743. // selection.splice(i,1)
  744. // }
  745. // }
  746. } else {
  747. this.selectRows = selection
  748. this.setLayerColor()
  749. }
  750. },
  751. selectAll(selection){
  752. this.selectRows = selection;
  753. },
  754. getlist(){
  755. const replaceResult = this.query.plateNo.replace(/[;,,;\s\r\n]+/g, ",").split(",");
  756. this.query.plateNo = replaceResult;
  757. },
  758. getPltList(){
  759. const replaceResult = this.query.plateNo.replace(/[;,,;\s\r\n]+/g, ",").split(",");
  760. this.query.plateNo = replaceResult;
  761. },
  762. getOrdList(){
  763. const replaceResult = this.query.ordNo.replace(/[;,,;\s\r\n]+/g, ",").split(",");
  764. this.query.ordNo = replaceResult;
  765. },
  766. handleExport() {
  767. var imptData = [];
  768. var url = 'WareStore/queryStore.do'
  769. var param = {
  770. page: -1,
  771. rows: -1,
  772. wareName: this.query.wareName,
  773. stackName: this.query.stackName,
  774. model: this.query.model,
  775. materialName: this.query.materialName,
  776. standard: this.query.standard,
  777. customerName: this.query.customerName,
  778. fkcustmerName: this.query.fkcustmerName,
  779. plateNo: this.query.plateNo.length == 0 ? '' : this.query.plateNo.join(','),
  780. ordNo: this.query.ordNo == 0 ? '' : this.query.ordNo.join(','),
  781. remark1: this.query.remark1
  782. }
  783. axios.get(url, param).then(response => {
  784. if (response.data.code == 0) {
  785. console.log(response);
  786. var imptData = response.data.data;
  787. if (imptData.length == 0) {
  788. this.$alert('无法导出,没有库存', '提示', {
  789. confirmButtonText: '确定',
  790. callback: action => {}
  791. });
  792. } else {
  793. this.exportExcel(imptData)
  794. }
  795. } else {
  796. this.$message({
  797. type: 'error',
  798. message: '操作失败;' + response.data.msg,
  799. });
  800. }
  801. });
  802. },
  803. exportExcel(imptData) {
  804. // alert(JSON.stringify(imptData))
  805. const header = ["层数"
  806. ,"垛位"
  807. ,"货物品名"
  808. ,"材质"
  809. ,"钢板号"
  810. ,"规格型号"
  811. ,"数量"
  812. ,"重量"
  813. ,"订单号"
  814. ,"合约号"
  815. ,"订单客户"
  816. ,"客户名称"
  817. ,"收货地址"
  818. ,"产地"
  819. ,"备注"
  820. ,"垛位备注"
  821. ,"入库时间"
  822. ,"入库车号"
  823. ] // 导出的表头名
  824. const filterVal = ["layer"
  825. ,"stackName"
  826. ,"materialName"
  827. ,"materialStandard"
  828. ,"plateNo"
  829. ,"model"
  830. ,"count"
  831. ,"weight"
  832. ,"ordNo"
  833. ,"contractNo"
  834. ,"customerName"
  835. ,"customerName"
  836. ,"receiveAddress"
  837. ,"productionPlace"
  838. ,"remark"
  839. ,"remark1"
  840. ,"addTime"
  841. ,"carNo"
  842. ]
  843. for(var i=0;i<imptData.length;i++){
  844. imptData[i]["stackName"] = imptData[i].stack.name;
  845. imptData[i]["materialName"] = imptData[i].material.name;
  846. imptData[i]["materialStandard"] = imptData[i].material.standard;
  847. imptData[i]["customerName"] = imptData[i].customer.name;
  848. }
  849. const list = imptData
  850. const data = this.formatJson(filterVal, list)
  851. const filename = '库存信息' + (new Date()).toLocaleDateString();
  852. Export2Excel.export_json_to_excel({
  853. header,
  854. data,
  855. filename
  856. })
  857. },
  858. formatJson(filterVal, jsonData) {
  859. return jsonData.map(v => filterVal.map(j => {
  860. return v[j]
  861. }))
  862. },
  863. //showChangeAddress() {},
  864. // handleAddressSave() {
  865. // },
  866. // handleAddressCancelSave() {
  867. // this.addressDialogVisible = false
  868. // },
  869. },
  870. }
  871. </script>
  872. <style>
  873. .option_btn{
  874. margin-left: 30px
  875. }
  876. .searchForm-header{
  877. height: auto;
  878. margin-left: 10px;
  879. }
  880. .tabledata-grid{
  881. font-size: 20px;
  882. margin-left: 5px;
  883. height: calc(100% - 100px);
  884. }
  885. </style>