StockOutPrepareApproved.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499
  1. <template>
  2. <a-layout>
  3. <a-layout-header class="header">
  4. <Navbar title="领料清单" :is-go-back="false">
  5. <a-space>
  6. <a-button type="link" title="仓库库存" @click="stockOutPrepareLine">
  7. <template #icon><HomeOutlined /></template>
  8. </a-button>
  9. <a-button type="link" title="领料车" @click="openStockOutCar">
  10. <template #icon><ShoppingCartOutlined /></template>
  11. <a-badge :count="count" :number-style="{ marginTop: '-2px' }" />
  12. </a-button>
  13. </a-space>
  14. </Navbar>
  15. </a-layout-header>
  16. <a-layout-content class="content">
  17. <a-form layout="inline" class="search-form">
  18. <a-form-item label="项目事件" required>
  19. <a-select
  20. v-model:value="projectItemName"
  21. style="width: 220px"
  22. show-search
  23. @change="projectHandleChange"
  24. >
  25. <a-select-option v-for="item in projectList" :key="item.id" :value="item.name">
  26. {{ item.name }}
  27. </a-select-option>
  28. </a-select>
  29. </a-form-item>
  30. <a-form-item>
  31. <a-space>
  32. <a-button type="primary" @click="getStockOutPrepareDatas">查询</a-button>
  33. <a-button danger @click="deleteStockOutPrepare">删除</a-button>
  34. </a-space>
  35. </a-form-item>
  36. </a-form>
  37. <a-layout class="main-layout">
  38. <a-layout-sider width="300px" class="sider">
  39. <a-space direction="vertical" class="pagination-controls">
  40. <a-button-group>
  41. <a-button @click="previousPage">上一页</a-button>
  42. <a-button @click="nextPage">下一页</a-button>
  43. </a-button-group>
  44. <a-list item-layout="horizontal" :data-source="stockOutPrepares">
  45. <template #renderItem="{ item }">
  46. <a-list-item
  47. :class="{ 'selected-list-item': item === selectedStockOutPrepare }"
  48. @click="setStockOutPrepare(item)"
  49. >
  50. {{ item.documentNo }}({{ item.warehouseName }},{{ item.status }})
  51. </a-list-item>
  52. </template>
  53. </a-list>
  54. </a-space>
  55. </a-layout-sider>
  56. <a-layout-content>
  57. <a-table
  58. :columns="columns"
  59. :data-source="stockOutPrepareLines"
  60. :scroll="{ x: 1500, y: '60vh' }"
  61. size="small"
  62. bordered
  63. row-key="inventoryId"
  64. >
  65. <template #bodyCell="{ column, record }">
  66. <template v-if="column.dataIndex === 'image'">
  67. <a-image
  68. :src="Common.getThumbnailImageSrc(className, record.imageName)"
  69. width="40"
  70. :preview="false"
  71. @click="$refs.imagePreview.preview(className, record.imageName)"
  72. />
  73. </template>
  74. <template v-if="column.dataIndex === 'inventoryStatus'">
  75. <a-tag :color="record.inventoryStatus === 2 ? 'blue' : 'red'">
  76. {{ record.inventoryStatus === 2 ? '已拣货' : '未拣货' }}
  77. </a-tag>
  78. </template>
  79. </template>
  80. </a-table>
  81. </a-layout-content>
  82. </a-layout>
  83. <div class="flex-footer">
  84. <a-space>
  85. <span>第{{ (pagination.current_page - 1) * pagination.per_page + 1 }}-{{
  86. pagination.current_page * pagination.per_page
  87. }}条,共计{{ pagination.total }}条</span>
  88. <a-select
  89. v-model:value="pagination.per_page"
  90. style="width: 90px"
  91. @change="gridSizeSelect"
  92. >
  93. <a-select-option :value="20">20</a-select-option>
  94. <a-select-option :value="50">50</a-select-option>
  95. <a-select-option :value="100">100</a-select-option>
  96. </a-select>
  97. <a-pagination
  98. v-model:current="pagination.current_page"
  99. :total="pagination.total"
  100. :page-size="pagination.per_page"
  101. show-less-items
  102. @change="getStockOutPrepareLineDatas"
  103. />
  104. </a-space>
  105. </div>
  106. </a-layout-content>
  107. <ImagePreview ref="imagePreview" />
  108. <Loading v-if="loading" />
  109. </a-layout>
  110. </template>
  111. <script>
  112. import { HomeOutlined, ShoppingCartOutlined } from '@ant-design/icons-vue';
  113. import Common from '../common/Common.js';
  114. import StockOutPrepareResource from '../api/wms/StockOutPrepareResource.js';
  115. import StockOutPrepareLineResource from '../api/wms/StockOutPrepareLineResource.js';
  116. import PickingCarResource from '../api/wms/PickingCarResource.js';
  117. export default {
  118. components: {
  119. HomeOutlined,
  120. ShoppingCartOutlined,
  121. },
  122. data: function () {
  123. this.Common = Common;
  124. return {
  125. stockOutPrepareLines: [], //详单对应的数据
  126. stockOutPrepares: [], //领料主单数据
  127. projectList:[],//项目事件数据
  128. documentType: 0, //手工单据
  129. documentStatus: 'PROCESSING', //查询全部单据
  130. projectItemId: undefined,
  131. stockOutPrepareId: undefined,
  132. selectedStockOutPrepare: null,
  133. userId: null,
  134. pagination: {
  135. total: 0,
  136. per_page: Common.pageSize, // required
  137. current_page: 1, // required
  138. last_page: 0, // required
  139. },
  140. pagination2: {
  141. total: 0,
  142. per_page: Common.pageSize, // required
  143. current_page: 1, // required
  144. last_page: 0, // required
  145. },
  146. hot: '',
  147. className: 'com.leanwo.prodog.model.common.Inventory',
  148. bomInventoryNo: undefined,
  149. bomInventoryName: undefined,
  150. bomInventoryType: undefined,
  151. selectedBom: '',
  152. bomDtoList: [], // BOM清单
  153. bomInventoryId: undefined,
  154. count: 0,
  155. loading: false,
  156. columns: [
  157. { title: '序号', dataIndex: 'index', width: 80 },
  158. { title: '图片', dataIndex: 'image', width: 100 },
  159. { title: '物料编码', dataIndex: 'inventoryNo', width: 150 },
  160. { title: '物料名称', dataIndex: 'inventoryName', width: 200 },
  161. { title: '规格型号', dataIndex: 'inventoryType', width: 150 },
  162. { title: '需求模板', dataIndex: 'stockOutPrepateTemplateName', width: 120 },
  163. { title: '需求数量', dataIndex: 'needQuantity', width: 120 },
  164. { title: '领用数量', dataIndex: 'quantity', width: 120 },
  165. { title: '状态', dataIndex: 'inventoryStatus', width: 100 },
  166. ],
  167. };
  168. },
  169. watch: {
  170. },
  171. created: function () {
  172. if (!window.localStorage) {
  173. alert('浏览器不支持localstorage');
  174. } else {
  175. var storage = window.localStorage;
  176. if (storage.getItem('projectItemId') != 'null') {
  177. this.projectItemId = storage.getItem('projectItemId');
  178. this.projectItemName = storage.getItem('projectItemName');
  179. }
  180. }
  181. },
  182. mounted: function () {
  183. this.getLocalStorage();
  184. this.loadSelectProjectItem();
  185. this.queryPickingCarCount();
  186. },
  187. methods: {
  188. // 项目事件
  189. projectHandleChange:function (_,{key,value}) {
  190. var _self = this;
  191. console.log(key,value);
  192. this.projectItemId = key;
  193. this.projectItemName = value;
  194. localStorage.setItem('projectItemId',key);
  195. localStorage.setItem('projectItemName',value);
  196. _self.getStockOutPrepareDatas();
  197. },
  198. /**
  199. * 查询领料车中的数量
  200. */
  201. queryPickingCarCount: function () {
  202. var _self = this;
  203. PickingCarResource.queryPickingCarCount().then(successData => {
  204. if(successData.errorCode == 0) {
  205. _self.count = successData.data;
  206. }
  207. }, errorData => {
  208. Common.processException(errorData);
  209. });
  210. },
  211. /**
  212. * 打开加入领料车页面
  213. */
  214. stockOutPrepareLine: function () {
  215. var _self = this;
  216. _self.$router.push('/wms/stockOutPrepareLine');
  217. },
  218. /**
  219. * 打开领料车页面
  220. */
  221. openStockOutCar: function () {
  222. var _self = this;
  223. _self.$router.push('/wms/pickingCar');
  224. },
  225. // 获取localStorage
  226. getLocalStorage: function () {
  227. var storage = localStorage;
  228. if (!storage) {
  229. alert('浏览器不支持localstorage');
  230. } else {
  231. var json = storage.getItem('#LoginInfo');
  232. this.loginInfo = JSON.parse(json);
  233. this.userId = this.loginInfo.userId;
  234. }
  235. },
  236. /**
  237. * 点击选择领料单事件
  238. */
  239. setStockOutPrepare: function (item) {
  240. var _self = this;
  241. _self.selectedStockOutPrepare = item;
  242. _self.stockOutPrepareId = item.stockOutPrepareId;
  243. _self.pagination.current_page = 1; // 当主单选择改变时。详单页数改为第一个
  244. //_self.stockOutPrepareLines = _self.stockOutPrepares[index].stockOutPrepareLineDtos;
  245. //查询对应详单数据
  246. _self.getStockOutPrepareLineDatas();
  247. },
  248. /**
  249. * 项目事件
  250. */
  251. loadSelectProjectItem: function () {
  252. var _self = this;
  253. $.ajax({
  254. type: 'get',
  255. dataType: 'json',
  256. url: Common.getApiURL('ProjectItemResource/queryByCondition'),
  257. contentType: 'application/json',
  258. beforeSend: function (request) {
  259. Common.addTokenToRequest(request);
  260. },
  261. success: function ({datas,errorCode,errorMessage}) {
  262. if (errorCode == 0) {
  263. _self.projectList = datas;
  264. }else{
  265. alert(errorMessage);
  266. }
  267. },
  268. error: function (XMLHttpRequest, textStatus, errorThrown) {
  269. Common.processException(XMLHttpRequest, textStatus, errorThrown);
  270. },
  271. });
  272. },
  273. /**
  274. * 修改领料详情每页显示的数量
  275. * @param {Object} newPageSize
  276. */
  277. gridSizeSelect: function (newPageSize) {
  278. this.pagination.per_page = newPageSize;
  279. this.pagination.current_page = 1;
  280. // 刷新界面
  281. this.getStockOutPrepareLineDatas();
  282. },
  283. /**
  284. * 领料主单上一页
  285. */
  286. previousPage: function () {
  287. var _self = this;
  288. if (_self.pagination2.current_page == 1) {
  289. Common.showDialog('提示', '已经是第一页了', 'error');
  290. return;
  291. }
  292. _self.pagination2.current_page = _self.pagination2.current_page - 1;
  293. _self.getStockOutPrepareDatas();
  294. },
  295. /**
  296. * 领料主单下一页
  297. */
  298. nextPage: function () {
  299. var _self = this;
  300. console.log('总条数:' + _self.pagination2.total + '总页数:' + _self.pagination2.last_page + '当前页数:' + _self.pagination2.current_page);
  301. if (_self.pagination2.current_page == _self.pagination2.last_page || _self.pagination2.last_page == 1 || _self.pagination2.last_page == 0) {
  302. Common.showDialog('提示', '已经是最后一页了', 'error');
  303. return;
  304. }
  305. _self.pagination2.current_page = _self.pagination2.current_page + 1;
  306. _self.getStockOutPrepareDatas();
  307. },
  308. //查询领料主单数据
  309. getStockOutPrepareDatas: function () {
  310. var _self = this;
  311. var param = {
  312. start: (_self.pagination2.current_page - 1) * _self.pagination2.per_page,
  313. length: _self.pagination2.per_page,
  314. projectItemId: _self.projectItemId,
  315. documentType: _self.documentType,
  316. userId: _self.userId,
  317. documentStatus: _self.documentStatus,
  318. loadLines: false,
  319. };
  320. _self.loading=true;
  321. StockOutPrepareResource.list(param).then(successData => {
  322. if(successData.errorCode == 0) {
  323. _self.loading=false;
  324. _self.pagination2.total = successData.total;
  325. _self.stockOutPrepares = successData.datas;
  326. _self.frist();
  327. _self.stockOutPrepareLines = [];
  328. _self.pagination2.last_page = Math.ceil(successData.total / successData.length);
  329. } else {
  330. Notify.error('提示', successData.errorMessage, false);
  331. }
  332. }, errorData => {
  333. _self.loading=false;
  334. Common.processException(errorData);
  335. });
  336. },
  337. /**
  338. * 首次进入此页面显示第一个的详情
  339. */
  340. frist: function () {
  341. var _self = this;
  342. if (_self.stockOutPrepares != null && _self.stockOutPrepares.length > 0) {
  343. _self.setStockOutPrepare(_self.stockOutPrepares[0]);
  344. }
  345. },
  346. /**
  347. * 删除领料单
  348. */
  349. deleteStockOutPrepare: function () {
  350. var _self = this;
  351. if (_self.selectedStockOutPrepare == null) {
  352. Common.showDialog('提示', '请选择要删除的领料单', 'error');
  353. return;
  354. }
  355. var status = _self.selectedStockOutPrepare.status;
  356. if (status != '编辑中') {
  357. Common.showDialog('提示', '当前选择要删除的领料单已经开始拣货或已经完成拣货,不能删除', 'error');
  358. return;
  359. }
  360. Notify.show({
  361. title: '确认要删除已选择的领料单',
  362. message: '您确定要将选择的领料单,单据号:' + _self.selectedStockOutPrepare.documentNo + '(' + status + ')' + '删除吗?如果\\"是\\"的话,请点击\\"确定\\"按钮,否则点击\\"取消\\"按钮',
  363. buttons: [
  364. {
  365. label: '确定',
  366. cssClass: 'btn-primary',
  367. action: function (dialogItself) {
  368. dialogItself.close();
  369. _self.loading=true;
  370. StockOutPrepareResource.deleteStockOutPrepare(_self.stockOutPrepareId).then(successData => {
  371. if(successData.errorCode == 0) {
  372. var message = successData.data.errorMessage;
  373. Notify.success('成功', message, 4000);
  374. _self.getStockOutPrepareDatas();
  375. _self.loading=false;
  376. } else {
  377. Notify.error('提示', successData.errorMessage, false);
  378. return;
  379. }
  380. }, errorData => {
  381. _self.loading=false;
  382. Common.processException(errorData);
  383. });
  384. },
  385. }, {
  386. label: '取消',
  387. action: function (dialogItself) {
  388. dialogItself.close();
  389. },
  390. }],
  391. });
  392. },
  393. //查询领料详单数据
  394. getStockOutPrepareLineDatas: function () {
  395. var _self = this;
  396. if (_self.stockOutPrepareId == undefined) {
  397. Common.showDialog('提示', '请选择要查看的领料主单', 'error');
  398. return;
  399. }
  400. var param = {
  401. start: (_self.pagination.current_page - 1) * _self.pagination.per_page,
  402. length: _self.pagination.per_page,
  403. stockOutPrepareId: _self.stockOutPrepareId,
  404. };
  405. _self.loading=true;
  406. StockOutPrepareLineResource.queryByStockoutPrepare(param).then(successData => {
  407. if(successData.errorCode == 0) {
  408. _self.loading=false;
  409. _self.pagination.total = successData.total;
  410. _self.stockOutPrepareLines = successData.datas;
  411. _self.pagination.last_page = Math.ceil(successData.total / successData.length);
  412. } else {
  413. Notify.error('提示', successData.errorMessage, false);
  414. return;
  415. }
  416. }, errorData => {
  417. _self.loading=false;
  418. Common.processException(errorData);
  419. });
  420. },
  421. },
  422. };
  423. </script>
  424. <style scoped>
  425. .header {
  426. background: #fff;
  427. padding: 0;
  428. }
  429. .main-layout {
  430. margin-top: 16px;
  431. background: #fff;
  432. padding: 16px;
  433. }
  434. .sider {
  435. background: #fff;
  436. border-right: 1px solid #f0f0f0;
  437. padding-right: 16px;
  438. }
  439. .selected-list-item {
  440. background-color: #e6f7ff;
  441. border-right: 3px solid #1890ff;
  442. }
  443. .flex-footer {
  444. padding: 12px 0;
  445. border-top: 1px solid #f0f0f0;
  446. margin-top: 16px;
  447. }
  448. .pagination-controls {
  449. width: 100%;
  450. }
  451. </style>