index.blade.php 26 KB

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