index.blade.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436
  1. @extends('layouts.app')
  2. @section('title')收货表单@endsection
  3. @section('content')
  4. <div class="d-none" id="list">
  5. <!--查询 -->
  6. <div class="row m-3" style="background-color: #fff;">
  7. <div class="form-group m-2">
  8. <select class="form-control selectpicker" title="分页大小" v-model="size">
  9. <option value="50">50</option>
  10. <option value="100">100</option>
  11. <option value="200">200</option>
  12. <option value="500">500</option>
  13. <option value="1000">1000</option>
  14. </select>
  15. </div>
  16. <div class="form-group m-2" style="max-width: 200px !important;">
  17. <select v-model="search.customerId" class="selectpicker form-control" title="选择货主"
  18. data-actions-box="true"
  19. data-live-search="true"
  20. data-live-search-placeholder="搜索"
  21. >
  22. <option v-for="(v,k) of searchSelects.owners" :value="v.id" :key="v.id">@{{ v.name }}</option>
  23. </select>
  24. </div>
  25. <div class="form-group m-2" data-toggle="tooltip" data-placement="top" title="货主">
  26. <input v-model="search.receiveTaskNo" class="form-control" type="text" step="01" placeholder="收货任务号">
  27. </div>
  28. <div class="form-group m-2" data-toggle="tooltip" data-placement="top" title="货主">
  29. <input v-model="search.reservationNo" class="form-control" type="text" step="01" placeholder="预约号">
  30. </div>
  31. <div class="form-group m-2" data-toggle="tooltip" data-placement="top" title="货主">
  32. <select v-model="search.status" class="selectpicker form-control" title="选择状态"
  33. data-actions-box="true"
  34. data-live-search="true"
  35. data-live-search-placeholder="搜索"
  36. >
  37. <option v-for="v of searchSelects.statuses" :value="v" :key="v.id">@{{ v }}</option>
  38. </select>
  39. </div>
  40. <div class="form-group m-2" data-toggle="tooltip" data-placement="top" title="货主">
  41. <input v-model="search.asnNo" class="form-control" type="text" step="01" placeholder="ASN号">
  42. </div>
  43. <div class="form-group m-2" data-toggle="tooltip" data-placement="top" title="起始日期">
  44. <input v-model="search.createSingleStartTime" class="form-control" type="date" step="01">
  45. </div>
  46. <div class="form-group m-2" data-toggle="tooltip" data-placement="top" title="截止日期">
  47. <input v-model="search.createSingleEndTime" class="form-control" type="date" step="01">
  48. </div>
  49. <div class="form-group m-2">
  50. <button class="form-control btn btn-sm btn-info" @click="searchData()">查询</button>
  51. </div>
  52. </div>
  53. <!-- 表格-->
  54. <table class="table table-striped table-bordered table-hover text-nowrap waybill-table td-min-width-80"
  55. style="background: #fff;" id="table">
  56. <!-- v-if="item.asnStatus!=99"-->
  57. <tr v-for="(item,i) in resData.details.data" :key="i">
  58. <td class="td-warm text-muted"><span>@{{ i+1 }}</span></td>
  59. <td class="td-warm text-muted"><span>@{{ item.customerName }}</span></td>
  60. <td class="td-warm text-muted"><span>@{{ item.receiveTaskNo }}</span></td>
  61. <td class="td-warm text-muted"><span>@{{ item.reservationNo }}</span></td>
  62. <td class="td-warm text-muted"><span>@{{ item.status }}</span></td>
  63. <td class="td-warm text-muted">
  64. <span>@{{ item.asnNo }}</span>
  65. <span
  66. style="display: inline-block;width: 15px;height: 15px;border-radius: 50%;position: relative;top: 3px; margin-left: 3px;box-shadow: 0 0 3px #211f1f"
  67. :style="item.asnStatus!=99?'background-color:#4ed32d':'background-color:#e83939'"></span>
  68. </td>
  69. <td class="td-warm text-muted"><span>@{{ item.createSingleTime }}</span></td>
  70. <td class="td-warm text-muted"><span>@{{ item.finishedReceiveTime }}</span></td>
  71. <td class="td-warm text-muted"><span v-if="item.asnStatus==99">@{{ item.receivePerson }}</span></td>
  72. <td class="td-warm text-muted"><span>@{{ item.expectancyAmount }}</span></td>
  73. <td class="td-warm text-muted"><span>@{{ item.receivedAmount }}</span></td>
  74. <td class="td-warm text-muted"><span>@{{ item.unfinishedReceiveAmount }}</span></td>
  75. <td class="td-warm text-muted"><span>@{{ item.receiveConsumeDuration }}</span></td>
  76. <td class="td-warm text-muted">
  77. <button @click="showDetail(item)" type="button"
  78. class="btn btn-primary" data-toggle="modal"
  79. data-target="#staticBackdrop">
  80. 查看明细
  81. </button>
  82. </td>
  83. <td class="td-warm text-muted">
  84. @can('入库管理-实时收货看板-关单')
  85. <button v-if="item.asnStatus!=99" @click="closeAsn(item)" type="button"
  86. class="btn btn-success">
  87. 关单
  88. </button>
  89. @endcan
  90. </td>
  91. </tr>
  92. </table>
  93. <nav aria-label="..+.">
  94. <ul class="pagination">
  95. <li class="page-item" :class="current===1?'disabled':''">
  96. <button class="page-link" @click="pagination('pre')">上一页</button>
  97. </li>
  98. <li class="page-item" :class="current===resData.details.pages?'disabled':''">
  99. <button class="page-link" @click="pagination('next')">下一页</button>
  100. </li>
  101. </ul>
  102. </nav>
  103. <!-- Modal -->
  104. <div class="modal fade" id="staticBackdrop" tabindex="-1" aria-labelledby="staticBackdropLabel"
  105. aria-hidden="true">
  106. <div class="modal-dialog modal-xl" style="max-width:70% !important;">
  107. <div class="modal-content">
  108. <div class="modal-header">
  109. <h5 class="modal-title" id="staticBackdropLabel">明细</h5>
  110. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  111. <span aria-hidden="true">&times;</span>
  112. </button>
  113. </div>
  114. <div class="modal-body">
  115. <div class="modal-dialog-scrollable">
  116. <table class="table table-sm text-nowrap"
  117. style="background: #fff;" id="table_inner">
  118. <tr v-for="(item,i) in resData.itemDetail" :key="i">
  119. <td class="td-warm text-muted text-center"><span>@{{ i+1 }}</span></td>
  120. <td class="td-warm text-muted text-center"><span>@{{ item.receiveTaskNo }}</span></td>
  121. <td class="td-warm text-muted text-center"><span>@{{ item.asnNo }}</span></td>
  122. <td class="td-warm text-muted text-center"><span>@{{ item.reservationNo }}</span></td>
  123. <td class="td-warm text-muted text-center"><span>@{{ item.descr }}</span></td>
  124. <td class="td-warm text-muted text-center"><span>@{{ item.sku }}</span></td>
  125. <td class="td-warm text-muted text-center"><span>@{{ item.expectedQty }}</span></td>
  126. <td class="td-warm text-muted text-center"><span>@{{ item.receivedQty }}</span></td>
  127. <td class="td-warm text-muted text-center"><span>@{{ item.receivePerson }}</span></td>
  128. <td class="td-warm text-muted text-center"><span>@{{ item.putawayQty }}</span></td>
  129. <td class="td-warm text-muted text-center"><span>@{{ item.putawayPerson }}</span></td>
  130. <td class="td-warm text-muted text-center"><span>@{{ item.unfinishedReceiveQty }}</span></td>
  131. </tr>
  132. </table>
  133. <div style="width: 100%">
  134. @can('入库管理-实时收货看板-关单')
  135. <button @click="closeAsnDetail()" type="button" class="btn btn-success float-right" v-if="resData.asnStatus !== '99'">
  136. 关单
  137. </button>
  138. @endcan
  139. </div>
  140. </div>
  141. </div>
  142. </div>
  143. </div>
  144. </div>
  145. </div>
  146. @endsection
  147. @section('lastScript')
  148. <script type="text/javascript" src="{{mix('js/queryForm/header.js')}}"></script>{{--新版2--}}
  149. <script>
  150. /**
  151. * @Description: 轮询执行方法
  152. * @param {func} function 需要轮询的方法
  153. * @param {time} number 轮询间隔,默认1s
  154. * @param {endTime} number 可轮询时间, 为空时一直轮询
  155. * @param {immedaite} boolean 第一次是否立即执行
  156. * @author: XuLijuan
  157. */
  158. const pollingFunction = (func, time = 1000, endTime, immediate = false) => {
  159. immediate && func(); //是否立即执行一次,由实际决定
  160. const startTime = new Date().getTime();
  161. const pollTimer = setInterval(() => {
  162. const nowTime = new Date().getTime();
  163. if (endTime && nowTime - startTime >= endTime) {
  164. pollTimer && clearInterval(pollTimer);
  165. }
  166. func();
  167. }, time);
  168. return pollTimer;
  169. };
  170. let vue = new Vue({
  171. el: "#list",
  172. data: {
  173. user: '{!! $user !!}',
  174. timer: null,
  175. resData: {
  176. details: {
  177. data: [],
  178. total: null,
  179. current: 1,
  180. pages: null,
  181. size: 50,
  182. },
  183. asnStatus: null,
  184. asnType:null,
  185. customerId:null,
  186. asnNo:null,
  187. warehouseId:null,
  188. receiveTaskNo:null,
  189. itemDetail: null,
  190. },
  191. searchSelects: {
  192. owners: {!! $owners !!},
  193. statuses: ['创建', '进行中', '完成', '超时完成'],
  194. },
  195. selectTr: null,
  196. search: {
  197. customerId: null,
  198. receiveTaskNo: null,
  199. reservationNo: null,
  200. status: null,
  201. asnNo: null,
  202. createSingleStartTime: null,
  203. createSingleEndTime: null,
  204. sign: null,
  205. },
  206. closeAsnParam:{
  207. asnType:null,
  208. customerId:null,
  209. asnNo:null,
  210. warehouseId:null,
  211. user:null,
  212. },
  213. size: 50,
  214. current: 1,
  215. },
  216. created() {
  217. let url = this.getBaseUrl() + `/api/receiveBoard/formList?size=${this.size}&current=${this.current}`
  218. this.initSearchDate();
  219. this.getPageResult(url);
  220. },
  221. beforeDestroy() {
  222. clearInterval(this.timer)
  223. },
  224. mounted: function () {
  225. $('#list').removeClass('d-none');
  226. pollingFunction(this.searchData, 1000 * 30)
  227. let column = [
  228. {name: 'serial', value: '序号', neglect: true},
  229. {name: 'customerName', value: '货主', neglect: true},
  230. {name: 'receiveTaskNo', value: '收货任务号', neglect: true},
  231. {name: 'reservationNo', value: '预约号', neglect: true},
  232. {name: 'status', value: '状态', neglect: true},
  233. {name: 'asnNo', value: 'ASN单号', neglect: true},
  234. {name: 'createSingleTime', value: '开单时间', neglect: true},
  235. {name: 'finishedReceiveTime', value: '完成收货时间', neglect: true},
  236. {name: 'receivePerson', value: '关单员', neglect: true},
  237. {name: 'expectancyAmount', value: ' 预期数', neglect: true},
  238. {name: 'receivedAmount', value: '已收数', neglect: true},
  239. {name: 'unfinishedReceiveAmount', value: '未收数', neglect: true},
  240. {name: 'receiveConsumeDuration', value: '收货耗时', neglect: true},
  241. {name: 'action', value: '查看明细', neglect: true},
  242. @can('入库管理-实时收货看板-关单')
  243. {name: 'closeAsn', value: '关单', neglect: true},
  244. @endcan
  245. ];
  246. new Header({
  247. el: "table",
  248. name: "details",
  249. column: column,
  250. data: this.resData.details.data,
  251. restorationColumn: 'addtime',
  252. isCheckAllBox:false,
  253. fixedTop: ($('#form_div').height()) + ($('#btn').height()) + 1,
  254. }).init();
  255. let column2 = [
  256. {name: 'serial', value: '序号', neglect: true},
  257. {name: 'receiveTaskNo', value: '收货任务号', neglect: true},
  258. {name: 'asnNo', value: 'ASN号', neglect: true},
  259. {name: 'reservationNo', value: '预约号', neglect: true},
  260. {name: 'descr', value: '商品名称', neglect: true},
  261. {name: 'sku', value: 'SKU', neglect: true},
  262. {name: 'expectedQty', value: '预期数', neglect: true},
  263. {name: 'receivedQty', value: '收货数', neglect: true},
  264. {name: 'receivePerson', value: '收货人', neglect: true},
  265. {name: 'putawayQty',class:"text-danger font-weight-bold", value: '上架数', neglect: true},
  266. {name: 'putawayPerson', value: '上架人', neglect: true},
  267. {name: 'unfinishedReceiveQty',class:"text-danger font-weight-bold", value: '未收数', neglect: true},
  268. ];
  269. new Header({
  270. el: "table_inner",
  271. name: "details",
  272. column: column2,
  273. data: this.resData.details.data,
  274. restorationColumn: 'addtime',
  275. isCheckAllBox:false,
  276. fixedTop: ($('#form_div').height()) + ($('#btn').height()) + 1,
  277. }).init();
  278. },
  279. methods: {
  280. getPageResult(url) {
  281. axios.post(url, this.getSearch()).then(res => {
  282. if (res.data.code !== 200) {
  283. this.resData.details.data = [];
  284. this.resData.details.total = 0
  285. this.resData.details.current = 1
  286. this.resData.details.pages = 0
  287. this.resData.details.size = 50;
  288. } else {
  289. this.resData.details.data = res.data.data.list;
  290. this.resData.details.total = res.data.data.page.total;
  291. this.resData.details.current = res.data.data.page.pageNum;
  292. this.resData.details.pages = res.data.data.page.pages
  293. this.resData.details.size = res.data.data.page.pageSize;
  294. }
  295. });
  296. },
  297. getSearch() {
  298. if (this.search.customerId!=null ||this.search.receiveTaskNo!=null ||this.search.reservationNo!=null
  299. ||this.search.status!=null ||this.search.asnNo!=null ||this.search.createSingleStartTime!=null
  300. ||this.search.createSingleEndTime!=null){
  301. this.search.sign='有筛选';
  302. }
  303. let search = Object.assign({}, this.search);
  304. search.startTime += ' 00:00:00';
  305. search.endTime += ' 23:59:59';
  306. return search;
  307. },
  308. //初始化日期为今天和昨天
  309. initSearchDate() {
  310. let day1 = new Date();
  311. day1.setTime(day1.getTime() - 24 * 60 * 60 * 1000);
  312. let s1 = day1.getFullYear() + "-" + ((day1.getMonth() + 1) >= 10 ? (day1.getMonth() + 1) : ('0' + (day1.getMonth() + 1))) + "-" + (day1.getDate() >= 10 ? day1.getDate() : ('0' + day1.getDate()));
  313. //今天的时间
  314. let day2 = new Date();
  315. day2.setTime(day2.getTime());
  316. let s2 = day2.getFullYear() + "-" + ((day2.getMonth() + 1) >= 10 ? (day2.getMonth() + 1) : ('0' + (day2.getMonth() + 1))) + "-" + (day2.getDate() >= 10 ? day2.getDate() : ('0' + day2.getDate()));
  317. this.search.startTime = s1;
  318. this.search.endTime = s2;
  319. },
  320. searchData() {
  321. this.current = 1;
  322. this.pagination();
  323. },
  324. //根据环境获取不同的url
  325. getBaseUrl() {
  326. let url = null;
  327. let env = "{{ config('app.env') }}";
  328. if (env === 'local') {
  329. url = 'http://127.0.0.1:8116'
  330. } else if (env === 'production') {
  331. url = 'https://device.baoshi56.com'
  332. }
  333. return url;
  334. },
  335. pagination(flag) {
  336. if (flag === 'pre' && this.current > 1) {
  337. this.current--;
  338. } else if (flag === 'next' && this.current < this.resData.details.pages) {
  339. this.current++;
  340. }
  341. let url = this.getBaseUrl() + `/api/receiveBoard/formList?size=${this.size}&current=${this.current}`
  342. this.getPageResult(url);
  343. },
  344. showDetail({receiveTaskNo, reservationNo, asnNo,asnStatus,asnType,customerCode,warehouseId}) {
  345. let url = this.getBaseUrl() + `/api/receiveBoard/receiveDetail?receiveTaskNo=${receiveTaskNo}&reservationNo=${reservationNo}&asnNo=${asnNo}`
  346. axios.get(url, this.getSearch()).then(res => {
  347. if (res.data.code !== 200) {
  348. this.resData.itemDetail = null;
  349. } else {
  350. this.resData.asnStatus = asnStatus;
  351. this.resData.asnType=asnType;
  352. this.resData.customerId=customerCode;
  353. this.resData.asnNo=asnNo;
  354. this.resData.warehouseId=warehouseId;
  355. this.resData.receiveTaskNo=receiveTaskNo;
  356. this.resData.itemDetail = res.data.data;
  357. }
  358. });
  359. },
  360. getCloseAsnParam(item){
  361. this.closeAsnParam.asnType=item.asnType;
  362. this.closeAsnParam.customerId=item.customerCode;
  363. this.closeAsnParam.asnNo=item.asnNo;
  364. this.closeAsnParam.warehouseId=item.warehouseId;
  365. this.closeAsnParam.user=this.user;
  366. return Object.assign({}, this.closeAsnParam);
  367. },
  368. getCloseAsnDetailParam(){
  369. this.closeAsnParam.asnType=this.resData.asnType;
  370. this.closeAsnParam.customerId=this.resData.customerId;
  371. this.closeAsnParam.asnNo=this.resData.asnNo;
  372. this.closeAsnParam.warehouseId=this.resData.warehouseId;
  373. this.closeAsnParam.user=this.user;
  374. return Object.assign({}, this.closeAsnParam);
  375. },
  376. cleanCloseAsnParam(){
  377. this.closeAsnParam.asnNo=null;
  378. this.closeAsnParam.asnType=null;
  379. this.closeAsnParam.customerId=null;
  380. this.closeAsnParam.warehouseId=null;
  381. this.closeAsnParam.user=null;
  382. },
  383. closeAsn(item) {
  384. if(!confirm('确定要关闭ASN单号为:“'+item.asnNo+'”的订单吗?')){return};
  385. let url = this.getBaseUrl() + `/api/receiveBoard/closeAsn`
  386. axios.post(url, this.getCloseAsnParam(item)).then(res => {
  387. if (res.data.code !== 200 || !res.data.data) {
  388. window.tempTip.setDuration(2000);
  389. window.tempTip.show("关单失败!");
  390. } else {
  391. window.tempTip.setDuration(2000);
  392. window.tempTip.showSuccess("关单成功!");
  393. this.resData.details.data.forEach(i=>{
  394. if (i.receiveTaskNo===item.receiveTaskNo){
  395. i.asnStatus='99';
  396. }
  397. })
  398. this.cleanCloseAsnParam();
  399. }
  400. });
  401. },
  402. closeAsnDetail() {
  403. if(!confirm('确定要关闭ASN单号为:“'+this.resData.asnNo+'”的订单吗?')){return};
  404. let url = this.getBaseUrl() + `/api/receiveBoard/closeAsn`
  405. axios.post(url,this.getCloseAsnDetailParam()).then(res => {
  406. if (res.data.code !== 200 || !res.data.data) {
  407. window.tempTip.setDuration(2000);
  408. window.tempTip.show("关单失败!");
  409. } else {
  410. window.tempTip.setDuration(2000);
  411. window.tempTip.showSuccess("关单成功!");
  412. this.resData.details.data.forEach(i=>{
  413. if (i.receiveTaskNo===this.resData.receiveTaskNo){
  414. i.asnStatus='99';
  415. }
  416. })
  417. this.cleanCloseAsnParam();
  418. }
  419. });
  420. },
  421. },
  422. });
  423. </script>
  424. @endsection