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

outrecord.vue 28KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837
  1. <template>
  2. <div style="height:100%;">
  3. <div class="searchForm-header">
  4. <el-row>
  5. <el-form :model="query" label-width="100px" inline="">
  6. <el-row>
  7. <el-form-item label="库房名称">
  8. <el-select size="small" v-model="query.wareName" clearable style="width: 140px;" @change="changeWare">
  9. <el-option v-for="item in optionsWare" :key="item.id" :label="item.name" :value="item.name">
  10. </el-option>
  11. </el-select>
  12. </el-form-item>
  13. <el-form-item label="垛位名称" style="margin-left: -35px">
  14. <el-input v-model="query.stackName" size="small" style="width:100px;margin-left: -8px"></el-input>
  15. </el-form-item>
  16. <el-form-item label="物料名称" style="margin-left: -35px">
  17. <el-input v-model="query.materialName" size="small" style="width:130px;margin-left: -8px">
  18. <el-button slot="append" icon="el-icon-search" @click="showMaterial"></el-button>
  19. </el-input>
  20. </el-form-item>
  21. <el-form-item label="钢种" style="margin-left: -35px">
  22. <el-input v-model="query.standard" size="small" style="width:130px;margin-left: -8px">
  23. <el-button slot="append" icon="el-icon-search" @click="showMaterial"></el-button>
  24. </el-input>
  25. </el-form-item>
  26. <el-form-item label="客户名称" style="margin-left: -35px">
  27. <el-select v-model="query.customerName" filterable placeholder="请选择上游客户" clearable size="small" style="margin-left: 5px; width: 170px">
  28. <el-option v-for="item in optionsCust" :key="item.name" :label="item.name" :value="item.name" >
  29. </el-option>
  30. </el-select>
  31. </el-form-item>
  32. <el-form-item label="付款单位" style="margin-left: -35px">
  33. <el-select v-model="query.fkComponyName" filterable placeholder="请选择上游客户" clearable size="small" style="margin-left: 5px; width: 170px">
  34. <el-option v-for="item in optionsCust" :key="item.name" :label="item.name" :value="item.name" >
  35. </el-option>
  36. </el-select>
  37. </el-form-item>
  38. <el-form-item label="车号" style="margin-left: -35px">
  39. <el-input v-model="query.carNo" size="small" style="width:100px;margin-left: -8px"></el-input>
  40. </el-form-item>
  41. <el-form-item label="规格型号" style="margin-left: 0px;">
  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: -35px;">
  46. <el-input v-model="query.plateNo" size="small" style="width:120px;margin-left: -8px" @input="getPltList">
  47. </el-input>
  48. </el-form-item>
  49. <el-form-item label="出库时间" style="margin-left: -35px">
  50. <el-date-picker v-model="query.RecordDate" style="width:330px;margin-left: -8px" size="small" type="datetimerange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期">
  51. </el-date-picker>
  52. </el-form-item>
  53. <el-form-item label="理货人员" >
  54. <el-select v-model="query.tallyPeople" size="small" style="margin-left: 10px;margin-top: -15px" clearable placeholder="理货人员">
  55. <el-option v-for="item in tallyPeopleOption" :key="item.id" :label="item.dicName" :value="item.dicCode">
  56. </el-option>
  57. </el-select>
  58. </el-form-item>
  59. <el-form-item label="订单号" style="margin-left: -25px">
  60. <el-input v-model="query.ordNo" size="small" style="width:120px;margin-left: -8px" @input="getOrdList">
  61. </el-input>
  62. </el-form-item>
  63. <el-form-item label="垛位备注" style="margin-left: -25px">
  64. <el-input v-model="query.remark1" size="small" style="width:120px;margin-left: -8px" @input="getOrdList">
  65. </el-input>
  66. </el-form-item>
  67. <el-form-item label=" " style="margin-left: -60px">
  68. <el-button @click="handleSearch" type="primary" size="small">查询</el-button>
  69. <el-button @click="handlePrintOut" type="primary" size="small" style="width:90px;text-align: left">打印出库单</el-button>
  70. <el-button @click="handleOutBack" type="danger" size="small" style="width:70px">取消出库</el-button>
  71. <el-button @click="handleVerifyAcc" type="primary" size="small" style="width:70px">对账</el-button>
  72. <el-button @click="handleModifyPrice" type="primary" size="small" >批量改价</el-button>
  73. <el-button type="primary" size="small" @click="resetButton" :disabled="backAble">重置</el-button>
  74. </el-form-item>
  75. <el-form-item label="" >
  76. <el-upload class="upload-demo" action=""
  77. ref="upload" :limit="1" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel"
  78. :auto-upload="false" >
  79. <el-button plain slot="trigger" type="success" v-show="false" style= "margin-left: 5px" size="small">询单导入</el-button>
  80. <el-button type="success" @click="handleExport" style="margin-left: 2px" size="small">导出记录</el-button>
  81. </el-upload>
  82. </el-form-item>
  83. </el-row>
  84. </el-form>
  85. </el-row>
  86. <total-block style="margin-top: -15px" ref="totalBlock" v-bind:childParam="childParam" v-bind:childUrl = 'childUrl'></total-block>
  87. </div>
  88. <div class="tabledata-grid">
  89. <el-table v-loading="loading" :data="tableData" @selection-change="handleSelectionChange" @select="handleTableSelect" height="100%" stripe border style="width: 97%;font-size: 13px;margin-top: -50px;margin-left: 25px" :header-cell-style="{'text-align':'center'}">
  90. <el-table-column type="selection" width="40" header-align="center" align="center"></el-table-column>
  91. <el-table-column prop="id" label="编号" min-width="10%" v-if="false">
  92. </el-table-column>
  93. <el-table-column prop="distributionId" label="配车号" min-width="10%" v-if="false">
  94. </el-table-column>
  95. <el-table-column prop="wareName" label="仓库名称" width="150px" show-overflow-tooltip header-align="center">
  96. </el-table-column>
  97. <el-table-column prop="stackName" label="垛位" width="60px" show-overflow-tooltip header-align="center" align="center">
  98. </el-table-column>
  99. <el-table-column prop="layer" label="层号" show-overflow-tooltip width="60px" header-align="center" align="center">
  100. </el-table-column>
  101. <el-table-column prop="materialName" label="品名" show-overflow-tooltip width="100px" header-align="center" align="center">
  102. </el-table-column>
  103. <el-table-column prop="ordNo" label="订单号" width="180px" show-overflow-tooltip align="left">
  104. </el-table-column>
  105. <el-table-column prop="inUser" label="入库人" width="100px" show-overflow-tooltip align="left">
  106. </el-table-column>
  107. <el-table-column prop="inCarNo" label="入库车号" width="120px" show-overflow-tooltip align="left">
  108. </el-table-column>
  109. <el-table-column prop="inTime" label="入库时间" width="200px" show-overflow-tooltip align="left">
  110. </el-table-column>
  111. <el-table-column prop="model" label="规格" show-overflow-tooltip width="180px" align="center">
  112. </el-table-column>
  113. <el-table-column prop="standard" label="钢种" show-overflow-tooltip width="80px" align="center">
  114. </el-table-column>
  115. <el-table-column prop="count" label="出库数量" width="100px" show-overflow-tooltip align="right">
  116. </el-table-column>
  117. <el-table-column prop="weight" label="出库重量" width="100px" show-overflow-tooltip align="right">
  118. </el-table-column>
  119. <el-table-column prop="invoicePrice" label="基价" width="100px" show-overflow-tooltip align="right">
  120. </el-table-column>
  121. <el-table-column prop="unitPrice" label="结算价格" width="100px" show-overflow-tooltip align="right">
  122. </el-table-column>
  123. <el-table-column prop="plateNo" label="钢板号" width="200px" show-overflow-tooltip align="center">
  124. </el-table-column>
  125. <el-table-column prop="customerName" label="订单客户" width="200px" show-overflow-tooltip align="center">
  126. </el-table-column> <!-- 原客户名称 -->
  127. <el-table-column prop="fkComponyName" label="客户名称" width="200px" show-overflow-tooltip align="center">
  128. </el-table-column> <!-- 新增 -->
  129. <el-table-column prop="receiveAddress" label="收货地址" width="300" show-overflow-tooltip align="left">
  130. </el-table-column>
  131. <el-table-column prop="wgtDcnMtcCd" label="计量方式" width="100" show-overflow-tooltip header-align="center">
  132. </el-table-column>
  133. <el-table-column prop="edgeTy" label="切边类型" width="100" show-overflow-tooltip header-align="center">
  134. </el-table-column>
  135. <el-table-column prop="productionPlace" label="产地" width="250" show-overflow-tooltip header-align="center">
  136. </el-table-column>
  137. <el-table-column prop="outCarNo" label="出库车号" width="100px" show-overflow-tooltip align="left">
  138. </el-table-column>
  139. <el-table-column prop="tallyPeople" label="出库理货人员" width="180px" show-overflow-tooltip align="left">
  140. </el-table-column>
  141. <el-table-column prop="addId" label="出库操作人" width="120px" show-overflow-tooltip align="left">
  142. </el-table-column>
  143. <el-table-column prop="addTime" label="出库时间" width="200px" show-overflow-tooltip align="left">
  144. </el-table-column>
  145. <el-table-column prop="remark" label="备注" width="100px" show-overflow-tooltip align="left">
  146. </el-table-column>
  147. <el-table-column prop="remark1" label="垛位备注" width="100px" show-overflow-tooltip align="left">
  148. </el-table-column>
  149. <el-table-column prop="recordType" label="类型" width="100px" show-overflow-tooltip align="center" :formatter="typeFormatter">
  150. </el-table-column>
  151. <el-table-column prop="verifyAccountId" v-if="false" label="对账ID" width="100px" show-overflow-tooltip align="center" >
  152. </el-table-column>
  153. <el-table-column prop="backFlag" label="取消标记" show-overflow-tooltip width="100px" align="center">
  154. </el-table-column>
  155. </el-table>
  156. <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
  157. :page-sizes="pageSizes" style="margin-left: 25px" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" :total="totalRows">
  158. </el-pagination>
  159. </div>
  160. <el-dialog title="对账信息" :visible.sync="popupVerifyAcc" width="780px">
  161. <el-form label-width="150px" inline="">
  162. <el-row>
  163. <el-col :span="10">
  164. <el-form-item label="对账日期:" style="">
  165. <el-date-picker
  166. v-model="accData.accDate"
  167. type="date"
  168. placeholder="选择日期"
  169. style="width: 150px;margin-left: -8px">
  170. </el-date-picker>
  171. </el-form-item>
  172. </el-col>
  173. <el-col :span="12">
  174. <el-form-item label="总吨位:" style="">
  175. <el-input v-model="accData.accWgt" :disabled="true" size="small" style="width:150px;margin-left: -8px"></el-input>
  176. </el-form-item>
  177. </el-col>
  178. </el-row>
  179. <el-row>
  180. <el-col :span="10">
  181. <el-form-item label="总金额:" style="">
  182. <el-input v-model="accData.accAmt" :disabled="true" size="small" style="width:150px;margin-left: -8px"></el-input>
  183. </el-form-item>
  184. </el-col>
  185. <el-col :span="12">
  186. <el-form-item label="扣零:" style="">
  187. <el-input v-model="accData.accReminder" size="small" style="width:150px;margin-left: -8px"></el-input>
  188. </el-form-item>
  189. </el-col>
  190. </el-row>
  191. <el-row>
  192. <el-col :span="10">
  193. <el-form-item label="结算金额:" style="">
  194. <el-input v-model="accData.invoiceAmt" :disabled="true" size="small" style="width:150px;margin-left: -8px"></el-input>
  195. </el-form-item>
  196. </el-col>
  197. <el-col :span="12" :offset="2" >
  198. <el-button size="small" type="primary" style="margin-left: 30px;" @click="handleSaveVerifyAcc">提交</el-button>
  199. </el-col>
  200. </el-row>
  201. </el-form>
  202. </el-dialog>
  203. <el-dialog title="批量改价" :visible.sync="popupModPrice" width="780px">
  204. <el-form label-width="150px" inline="">
  205. <el-row>
  206. <el-col :span="12">
  207. <el-form-item label="总吨位:" style="">
  208. <el-input v-model="modifyWgt" :disabled="true" size="small" style="width:150px;margin-left: -8px"></el-input>
  209. </el-form-item>
  210. </el-col>
  211. <el-col :span="12">
  212. <el-form-item label="价格:" style="">
  213. <el-input v-model="modifyPrice" size="small" style="width:150px;margin-left: -8px"></el-input>
  214. </el-form-item>
  215. </el-col>
  216. </el-row>
  217. <el-row>
  218. <el-col :span="24" :offset="10" >
  219. <el-button size="small" type="primary" style="margin-left: 30px;" @click="handleSavePriceMod">提交</el-button>
  220. </el-col>
  221. </el-row>
  222. </el-form>
  223. </el-dialog>
  224. <popup-stack-with-select-ware :selectVareName="optionsWare" ref="PopupStackWithSelectWare" @receviceFromChild="receviceFromWareStack"></popup-stack-with-select-ware>
  225. <popup-material ref="PopupMaterial" @receviceFromChild="receviceFromMaterial"></popup-material>
  226. <popup-customer ref="PopupCustomer" @receviceFromChild="receviceFromCustomer"></popup-customer>
  227. <popup-customer ref="PopupFkCompony" @receviceFromChild="receviceFromFkCompony"></popup-customer>
  228. </div>
  229. </template>
  230. <script>
  231. import axios from '@/axios'
  232. //import PopupStack from '@/components/PopupStack.vue'
  233. import PopupMaterial from '@/components/PopupMaterial.vue'
  234. import PopupCustomer from '@/components/PopupCustomer.vue'
  235. import PopupStackWithSelectWare from '@/components/PopupStackWithSelectWare.vue'
  236. import TotalBlock from '@/components/TotalBlock.vue'
  237. import Export2Excel from '../../excel/Export2Excel.js'
  238. import {
  239. mapState
  240. } from 'vuex'
  241. export default {
  242. computed: {
  243. ...mapState({
  244. serverName: state => state.app.serverName
  245. })
  246. },
  247. components: {
  248. PopupStackWithSelectWare,
  249. PopupMaterial,
  250. PopupCustomer,
  251. TotalBlock
  252. },
  253. data() {
  254. return {
  255. query: {
  256. wareName: '',
  257. stackName: '',
  258. model: '',
  259. materialName: '',
  260. standard: '',
  261. customerName: '',
  262. plateNo: [],
  263. RecordDate:[],
  264. carNo:'',
  265. tallyPeople:'',
  266. ordNo:[],
  267. fkComponyName:'',
  268. remark1:''
  269. },
  270. accData:{
  271. accDate:'',
  272. accWgt:0,
  273. accAmt:0,
  274. accReminder:0,
  275. invoiceAmt:0
  276. },
  277. tableData: [],
  278. currentPage: 1,
  279. totalRows: 0,
  280. pageSizes: [50, 100, 200,500,1000],
  281. pageSize: 50,
  282. HideAndShow: 0,
  283. optionsWare: [],
  284. dialogVisible: false,
  285. selectRows: [],
  286. moveFromStack: null,
  287. childParam:{
  288. page: '',
  289. rows: '',
  290. wareName: '',
  291. stackName: '',
  292. model: '',
  293. materialName: '',
  294. standard: '',
  295. customerName: '',
  296. plateNo: '',
  297. remark1:'',
  298. },
  299. childUrl:'WareOutRecord/queryTotal.do',
  300. time:"",
  301. tallyPeopleOption:[],
  302. loading: false,
  303. popupVerifyAcc:false,
  304. popupModPrice:false,
  305. modifyWgt:0,
  306. modifyPrice:0,
  307. optionsCust:[],
  308. };
  309. },
  310. //页面加载完成渲染
  311. mounted() {
  312. this.getWare()
  313. // this.getTableData()
  314. this.getSearchItem();
  315. this.setSearchTime();
  316. this.getAllCustomer();
  317. },
  318. methods: {
  319. setSearchTime(){
  320. var now = new Date();
  321. this.query.RecordDate = [new Date(now.getFullYear(), now.getMonth(), now.getDate()),new Date(now.getFullYear(), now.getMonth(), now.getDate()+1)];
  322. },
  323. typeFormatter: function(row, column) {
  324. switch (row.recordType) {
  325. case "0":
  326. return "出库取消";
  327. break;
  328. default:
  329. return "出库";
  330. break;
  331. }
  332. },
  333. getAllCustomer() {
  334. var url = 'MaintCustomer/queryByUserId.do'
  335. var param = {}
  336. axios.get(url, param).then(response => {
  337. this.optionsCust = response.data.data
  338. });
  339. },
  340. handleSavePriceMod(){
  341. var url = 'WareOutRecord/savePriceMod.do'
  342. var param = {
  343. json: JSON.stringify(this.selectRows),
  344. modPrice:this.modifyPrice,
  345. }
  346. axios.post(url, param).then(response => {
  347. if (response.data.code == 0) {
  348. this.$message({
  349. type: 'success',
  350. message: '保存成功',
  351. });
  352. this.popupModPrice = false
  353. this.getTableData();
  354. } else {
  355. this.$message({
  356. type: 'error',
  357. message: '保存失败!' + response.data.msg,
  358. });
  359. }
  360. });
  361. },
  362. handleSaveVerifyAcc() {
  363. var url = 'WareOutRecord/saveVerifyAcc.do'
  364. var param = {
  365. json: JSON.stringify(this.selectRows),
  366. accWgt:this.accData.accWgt,
  367. accAmt:this.accData.accAmt,
  368. invoiceAmt:this.accData.invoiceAmt,
  369. accDate:this.accData.accDate.Format("yyyyMMdd"),
  370. accReminder:this.accData.accReminder,
  371. }
  372. axios.post(url, param).then(response => {
  373. if (response.data.code == 0) {
  374. this.$message({
  375. type: 'success',
  376. message: '保存成功',
  377. });
  378. this.popupVerifyAcc = false
  379. this.getTableData();
  380. } else {
  381. this.$message({
  382. type: 'error',
  383. message: '保存失败!' + response.data.msg,
  384. });
  385. }
  386. });
  387. },
  388. handleModifyPrice(){
  389. if (this.selectRows.length < 1) {
  390. this.$message({
  391. type: 'warning',
  392. message: '至少选择一条数据!',
  393. });
  394. return;
  395. }
  396. var wgt = 0;
  397. for(var i = 0;i < this.selectRows.length;i++){
  398. wgt += parseFloat(this.selectRows[i]["weight"]);
  399. }
  400. this.modifyWgt = wgt;
  401. this.popupModPrice = true;
  402. },
  403. handleVerifyAcc(){
  404. if (this.selectRows.length < 1) {
  405. this.$message({
  406. type: 'warning',
  407. message: '至少选择一条数据!',
  408. });
  409. return;
  410. }
  411. // accData:{
  412. // accDate:'',
  413. // accWgt:'',
  414. // accAmt:'',
  415. // accReminder:0,
  416. // invoiceAmt:''
  417. // },
  418. var wgt = 0;
  419. var amt = 0;
  420. var invAmt = 0;
  421. var fkcpy = this.selectRows[0]["fkComponyName"];
  422. var flag = true;
  423. for(var i = 0;i < this.selectRows.length;i++){
  424. if(this.selectRows[i]["fkComponyName"] != fkcpy){
  425. flag = false;
  426. }
  427. wgt += parseFloat(this.selectRows[i]["weight"]);
  428. amt = this.numSub(amt,this.numMulti(this.selectRows[i]["invoicePrice"] , this.selectRows[i]["weight"]));
  429. }
  430. if(!flag){
  431. this.$message({
  432. type: 'warning',
  433. message: '付款单位不同,无法对账',
  434. });
  435. return;
  436. }
  437. this.accData.accWgt = wgt;
  438. this.accData.accAmt = amt;
  439. this.accData.invoiceAmt = amt;
  440. var now = new Date();
  441. this.accData.accDate = new Date(now.getFullYear(), now.getMonth(), now.getDate());
  442. this.popupVerifyAcc = true;
  443. },
  444. resetButton(){ //查询条件重置
  445. this.query.wareName= '',
  446. this.query.stackName= '',
  447. this.query.model= '',
  448. this.query.materialName= '',
  449. this.query.standard= '',
  450. this.query.customerName= '',
  451. this.query.plateNo= [],
  452. this.query.RecordDate=[],
  453. this.query.carNo='',
  454. this.query.tallyPeople='',
  455. this.query.ordNo=[],
  456. this.query.fkComponyName='',
  457. this.query.remark1='';
  458. this.setSearchTime()
  459. },
  460. numSub(num1, num2) {
  461. var baseNum, baseNum1, baseNum2;
  462. var precision;// 精度
  463. try {
  464. baseNum1 = num1.toString().split(".")[1].length;
  465. } catch (e) {
  466. baseNum1 = 0;
  467. }
  468. try {
  469. baseNum2 = num2.toString().split(".")[1].length;
  470. } catch (e) {
  471. baseNum2 = 0;
  472. }
  473. baseNum = Math.pow(10, Math.max(baseNum1, baseNum2));
  474. precision = (baseNum1 >= baseNum2) ? baseNum1 : baseNum2;
  475. return ((num1 * baseNum + num2 * baseNum) / baseNum).toFixed(precision);
  476. },
  477. numMulti(arg1,arg2){
  478. var m=0,s1=arg1.toString(),s2=arg2.toString();
  479. try{m+=s1.split(".")[1].length}catch(e){}
  480. try{m+=s2.split(".")[1].length}catch(e){}
  481. return Number(s1.replace(".",""))*Number(s2.replace(".",""))/Math.pow(10,m);
  482. },
  483. getSearchItem(){
  484. var url = 'Common/querySelector.do'
  485. var param = {
  486. type: 'TALLY_PEOPLE',
  487. }
  488. axios.get(url, param).then(response => {
  489. // alert(JSON.stringify(response))
  490. this.tallyPeopleOption = response.data.data;
  491. });
  492. },
  493. getWare() {
  494. var url = 'MaintWare/queryByUserId.do'
  495. var param = {}
  496. axios.get(url, param).then(response => {
  497. // console.log(response)
  498. this.optionsWare = response.data.data
  499. if (response.data.data.length == 1) {
  500. this.wareName = response.data.data[0].name
  501. // this.getStack()
  502. }
  503. });
  504. },
  505. handleTableSelectionChange(val) {
  506. this.selectRows = val
  507. },
  508. // 修改每页行数
  509. handleSizeChange(val) {
  510. this.pageSize = val
  511. this.getTableData()
  512. },
  513. // 修改当前页事件
  514. handleCurrentChange(val) {
  515. this.currentPage = val
  516. this.getTableData()
  517. },
  518. //点击查询
  519. handleSearch() {
  520. this.currentPage = 1
  521. this.getTableData()
  522. },
  523. showMaterial() {
  524. this.$refs.PopupMaterial.show()
  525. },
  526. receviceFromMaterial(material) {
  527. this.query.materialName = material.name
  528. this.query.standard = material.standard
  529. },
  530. showCustomer() {
  531. this.$refs.PopupCustomer.show()
  532. },
  533. showFkCompony(){
  534. this.$refs.PopupFkCompony.show()
  535. },
  536. receviceFromCustomer(customer) {
  537. this.query.customerName = customer.name
  538. },
  539. receviceFromFkCompony(customer) {
  540. this.query.fkComponyName = customer.name
  541. },
  542. getTableData() {
  543. var url = 'WareOutRecord/query.do'
  544. if(this.query.RecordDate == null){
  545. this.query.RecordDate = [false,false];
  546. }
  547. this.loading = true
  548. var param = {
  549. page: this.currentPage,
  550. rows: this.pageSize,
  551. wareName: this.query.wareName,
  552. stackName: this.query.stackName,
  553. model: this.query.model,
  554. materialName: this.query.materialName,
  555. standard: this.query.standard,
  556. customerName: this.query.customerName,
  557. plateNo: this.query.plateNo.length == 0 ? '' : this.query.plateNo.join(','),
  558. pFromDate:(!this.query.RecordDate[0]) ? "1970-01-01 00:00:00" : this.query.RecordDate[0].Format("yyyy-MM-dd HH:mm:ss"), //date类型
  559. pToDate :(!this.query.RecordDate[1]) ? new Date().Format("yyyy-MM-dd HH:mm:ss") :this.query.RecordDate[1].Format("yyyy-MM-dd HH:mm:ss"),
  560. carNo:this.query.carNo,
  561. tallyPeople:this.query.tallyPeople,
  562. ordNo: this.query.ordNo == 0 ? '' : this.query.ordNo.join(','),
  563. fkComponyName:this.query.fkComponyName,
  564. remark1 : this.query.remark1
  565. }
  566. this.childParam = param;
  567. console.log(param);
  568. console.log(this.childParam);
  569. axios.get(url, param).then(response => {
  570. if (response.data.code == 0) {
  571. this.tableData = response.data.data.list
  572. // console.log(JSON.stringify(response))
  573. this.totalRows = response.data.data.total
  574. // console.log(JSON.stringify(this.tableData[0]))
  575. this.$refs.totalBlock.getTotalData();
  576. } else {
  577. this.$message({
  578. type: 'error',
  579. message: '操作失败;' + response.data.msg,
  580. });
  581. }
  582. this.loading = false;
  583. });
  584. },
  585. handleSelectionChange(val) {
  586. this.selectRows = val
  587. },
  588. handleOutBack() {
  589. // if (this.selectRows.length != 1) {
  590. // this.$message({
  591. // type: 'error',
  592. // message: '只能选择一条数据取消出库!',
  593. // });
  594. // return
  595. // }
  596. if (this.selectRows[0].recordType == '0') {
  597. this.$message({
  598. type: 'error',
  599. message: '取消记录不能再次取消出库!',
  600. });
  601. return
  602. }
  603. if (this.selectRows[0].backFlag == '1') {
  604. this.$message({
  605. type: 'error',
  606. message: '该记录不能再次取消出库!',
  607. });
  608. return
  609. }
  610. // alert("1")
  611. this.$refs.PopupStackWithSelectWare.show()
  612. },
  613. receviceFromWareStack(stack) {
  614. var url = 'WareOut/back.do'
  615. var param = {
  616. json: JSON.stringify(this.selectRows),
  617. to: JSON.stringify(stack),
  618. }
  619. axios.post(url, param).then(response => {
  620. if (response.data.code == 0) {
  621. this.getTableData()
  622. } else {
  623. this.$message({
  624. type: 'error',
  625. message: '操作失败;' + response.data.msg,
  626. });
  627. }
  628. });
  629. },
  630. changeWare(){
  631. //this.getTableData()
  632. },
  633. getPltList(){
  634. const replaceResult = this.query.plateNo.replace(/[;,,;\s\r\n]+/g, ",").split(",");
  635. this.query.plateNo = replaceResult;
  636. },
  637. getOrdList(){
  638. const replaceResult = this.query.ordNo.replace(/[;,,;\s\r\n]+/g, ",").split(",");
  639. this.query.ordNo = replaceResult;
  640. },
  641. handlePrintOut(){
  642. if(this.selectRows.length > 1){
  643. this.$message({
  644. type: 'warning',
  645. message: '操作失败,请选择一条数据进行操作' ,
  646. });
  647. return;
  648. }
  649. // console.log(JSON.stringify(this.selectRows[0]))
  650. var distId = this.selectRows[0].distributionId;
  651. if( typeof(distId) == "undefined"||!distId){
  652. this.$message({
  653. type: 'warning',
  654. message: '操作失败,请选择正确的出库记录' ,
  655. });
  656. return;
  657. }
  658. window.open(this.serverName + 'ureport/preview?_u=file:out.ureport.xml&id=' + distId +
  659. '&time=' + this.time)
  660. },
  661. getTime() {
  662. var date = new Date();
  663. var year = date.getFullYear();
  664. var month = date.getMonth();
  665. var day = date.getDate();
  666. var hour = date.getHours();
  667. var minute = date.getMinutes();
  668. var second = date.getSeconds();
  669. month = Number(month) < 10 ? '0' + month : month
  670. day = Number(day) < 10 ? '0' + day : day
  671. hour = Number(hour) < 10 ? '0' + hour : hour
  672. minute = Number(minute) < 10 ? '0' + minute : minute
  673. second = Number(second) < 10 ? '0' + second : second
  674. this.time = year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second
  675. },
  676. handleExport() {
  677. var imptData = [];
  678. var url = 'WareOutRecord/query.do'
  679. var param = {
  680. page: -1,
  681. rows: -1,
  682. wareName: this.query.wareName,
  683. stackName: this.query.stackName,
  684. model: this.query.model,
  685. materialName: this.query.materialName,
  686. standard: this.query.standard,
  687. customerName: this.query.customerName,
  688. plateNo: this.query.plateNo.length == 0 ? '' : this.query.plateNo.join(','),
  689. pFromDate:(!this.query.RecordDate[0]) ? "1970-01-01 00:00:00" : this.query.RecordDate[0].Format("yyyy-MM-dd HH:mm:ss"), //date类型
  690. pToDate :(!this.query.RecordDate[1]) ? new Date().Format("yyyy-MM-dd HH:mm:ss") :this.query.RecordDate[1].Format("yyyy-MM-dd HH:mm:ss"),
  691. carNo:this.query.carNo,
  692. tallyPeople:this.query.tallyPeople,
  693. ordNo: this.query.ordNo == 0 ? '' : this.query.ordNo.join(','),
  694. fkComponyName:this.query.fkComponyName,
  695. remark1:this.query.remark1
  696. }
  697. // alert(JSON.stringify(param))
  698. axios.get(url, param).then(response => {
  699. // alert(JSON.stringify(response))
  700. if (response.data.code == 0) {
  701. var imptData = response.data.data;
  702. if (imptData.length == 0) {
  703. this.$alert('无法导出,选择时间段无记录', '提示', {
  704. confirmButtonText: '确定',
  705. callback: action => {}
  706. });
  707. } else {
  708. this.exportExcel(imptData)
  709. }
  710. } else {
  711. this.$message({
  712. type: 'error',
  713. message: '操作失败;' + response.data.msg,
  714. });
  715. }
  716. });
  717. },
  718. exportExcel(imptData) {
  719. console.log(JSON.stringify(imptData))
  720. const header = ["仓库名称"
  721. ,"垛位"
  722. ,"层号"
  723. ,"品名"
  724. ,"订单号"
  725. ,"入库人"
  726. ,"入库车号"
  727. ,"入库时间"
  728. ,"规格"
  729. ,"钢种"
  730. ,"出库数量"
  731. ,"出库重量"
  732. ,"钢板号"
  733. ,"货权单位"
  734. ,"付款单位"
  735. ,"收货地址"
  736. ,"计量方式"
  737. ,"切边类型"
  738. ,"产地"
  739. ,"出库车号"
  740. ,"出库理货人员"
  741. ,"出库操作人"
  742. ,"出库时间"
  743. ,"备注"
  744. ,"类型"
  745. ] // 导出的表头名
  746. const filterVal = [
  747. "wareName"
  748. ,"stackName"
  749. ,"layer"
  750. ,"materialName"
  751. ,"ordNo"
  752. ,"inUser"
  753. ,"inCarNo"
  754. ,"inTime"
  755. ,"model"
  756. ,"standard"
  757. ,"count"
  758. ,"weight"
  759. ,"plateNo"
  760. ,"customerName"
  761. ,"fkComponyName"
  762. ,"receiveAddress"
  763. ,"wgtDcnMtcCd"
  764. ,"edgeTy"
  765. ,"productionPlace"
  766. ,"outCarNo"
  767. ,"tallyPeople"
  768. ,"addId"
  769. ,"addTime"
  770. ,"remark"
  771. ,"recordType"
  772. ]
  773. for(var i=0;i<imptData.length;i++){
  774. /*imptData[i]["addUserUserDesc"] = imptData[i].addUser.userDesc;
  775. imptData[i]["distributionTruckNo"] = imptData[i].distribution.truckNo;*/
  776. imptData[i]["recordType"] = imptData[i]["recordType"] == 0 ? "出库取消" : "出库";
  777. }
  778. const list = imptData
  779. const data = this.formatJson(filterVal, list)
  780. const filename = '出库单' + (new Date()).toLocaleDateString();
  781. Export2Excel.export_json_to_excel({
  782. header,
  783. data,
  784. filename
  785. })
  786. },
  787. formatJson(filterVal, jsonData) {
  788. return jsonData.map(v => filterVal.map(j => {
  789. return v[j]
  790. }))
  791. },
  792. },
  793. }
  794. </script>
  795. <style>
  796. .searchForm-header{
  797. /*background-color: red;*/
  798. height: auto;
  799. /*;*/
  800. margin-left: 10px;
  801. }
  802. .tabledata-grid{
  803. /*margin-left: 100px;*/
  804. font-size: 20px;
  805. height: calc(100% - 230px);
  806. /*background-color: #000;*/
  807. }
  808. </style>