ProductWareHousingPlan.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. <template>
  2. <el-dialog
  3. v-dialogDrag
  4. title="入库明细"
  5. :visible.sync="open"
  6. width="1200px"
  7. append-to-body
  8. @open="dialogOpen"
  9. >
  10. <el-table v-loading="loading" :data="list" border size="mini">
  11. <el-table-column label="箱号" align="center" prop="caseNo" width="150" />
  12. <el-table-column
  13. label="产品编码"
  14. align="center"
  15. prop="productCode"
  16. width="150"
  17. show-overflow-tooltip
  18. />
  19. <el-table-column
  20. label="产品名称"
  21. align="center"
  22. prop="productName"
  23. width="120"
  24. show-overflow-tooltip
  25. />
  26. <el-table-column
  27. label="BOM版本"
  28. min-width="130"
  29. align="center"
  30. prop="mesBomVersion"
  31. />
  32. <el-table-column
  33. label="生产订单"
  34. align="center"
  35. prop="workOrderNo"
  36. show-overflow-tooltip
  37. width="130"
  38. />
  39. <el-table-column label="装箱数量" align="center" prop="inQty" />
  40. <el-table-column label="计划数量" align="center" prop="planAmount" />
  41. <el-table-column
  42. label="打包类型"
  43. align="center"
  44. prop="wmsStockLogicName"
  45. />
  46. <el-table-column
  47. label="选择仓库"
  48. align="center"
  49. width="150"
  50. prop="wmsStockName"
  51. >
  52. <template slot-scope="scope">
  53. <StockSelect
  54. :ref="`stock-${scope.$index}`"
  55. v-model="scope.row.wmsStockName"
  56. filterable
  57. @change="
  58. ($event) => {
  59. stockChange($event, scope.$index, scope.row);
  60. }
  61. "
  62. />
  63. </template>
  64. </el-table-column>
  65. <el-table-column
  66. label="选择区域"
  67. align="center"
  68. width="150"
  69. prop="wmsStoreAreaName"
  70. >
  71. <template slot-scope="scope">
  72. <AreaSelect
  73. :ref="`area-${scope.$index}`"
  74. v-model="scope.row.wmsStoreAreaId"
  75. filterable
  76. @change="
  77. ($event) => {
  78. areaChange($event, scope.$index, scope.row);
  79. }
  80. "
  81. />
  82. </template>
  83. </el-table-column>
  84. <el-table-column
  85. label="选择货位"
  86. align="center"
  87. width="150"
  88. prop="wmsStockLocationName"
  89. >
  90. <template slot-scope="scope">
  91. <LocationSelect
  92. :ref="`location-${scope.$index}`"
  93. v-model="scope.row.wmsStockLocationId"
  94. filterable
  95. @change="locationChange($event, scope.row)"
  96. />
  97. </template>
  98. </el-table-column>
  99. <!-- <el-table-column label="入库类型" align="center" prop="wmsStockLogicId">
  100. <template slot-scope="scope">
  101. <IncomingStockType ref="incomingStockType" v-model="scope.row.wmsStockLogicId" />
  102. </template>
  103. </el-table-column> -->
  104. </el-table>
  105. <div slot="footer" class="dialog-footer">
  106. <el-button
  107. v-hasPermi="['wms:incoming-produce-detail:create']"
  108. type="primary"
  109. :loading="ensureLoading"
  110. @click="handleSure"
  111. >完成入库</el-button
  112. >
  113. </div>
  114. </el-dialog>
  115. </template>
  116. <script>
  117. import {
  118. getIncomingProduceDetailPage,
  119. createBatchIncomingProduceDetail,
  120. } from "@/api/wms/incoming/production";
  121. import { getProduceStockedPage } from "@/api/wms/inquirePurchase/complexDocuments";
  122. import { deleteIncomingProduceDetail } from "@/api/wms/inquirePurchase/complexDocuments";
  123. import StockSelect from "../../wareHousing/components/StockSelect.vue";
  124. import AreaSelect from "../../wareHousing/components/AreaSelect.vue";
  125. import LocationSelect from "../../wareHousing/components/LocationSelect.vue";
  126. export default {
  127. name: "ProductWareHousingPlan",
  128. components: {
  129. StockSelect,
  130. AreaSelect,
  131. LocationSelect,
  132. },
  133. props: {
  134. currentRows: {
  135. type: Array,
  136. default: () => [],
  137. },
  138. },
  139. data() {
  140. return {
  141. // 遮罩层
  142. loading: false,
  143. ensureLoading: false,
  144. // 弹出层标题
  145. title: "",
  146. // 是否显示弹出层
  147. open: false,
  148. list: [],
  149. // 查询参数
  150. queryParams: {
  151. pageNo: 1,
  152. // pageSize: 100,
  153. // masterId: null,
  154. // warehousingOrderNo: null,
  155. // productCode: null,
  156. // planAmount: null,
  157. // workOrderNo: null,
  158. // caseNo: null,
  159. // inQty: null,
  160. // stockCode: null,
  161. // areaCode: null,
  162. // locationCode: null,
  163. // createTime: []
  164. },
  165. };
  166. },
  167. methods: {
  168. /** 查询列表 */
  169. getList() {
  170. // this.list = this.currentRows
  171. //
  172. this.loading = true;
  173. const queryParams = {
  174. ...this.queryParams,
  175. storageStatus: 0,
  176. };
  177. getIncomingProduceDetailPage(queryParams)
  178. .then((response) => {
  179. this.list = response.data.list;
  180. this.total = response.data.total;
  181. })
  182. .finally(() => {
  183. this.loading = false;
  184. });
  185. },
  186. // 完成入库
  187. handleSure() {
  188. if (this.list.length <= 0) {
  189. this.$modal.msgWarning("暂无入库数据,无法入库");
  190. return;
  191. }
  192. const isEmpty = this.list.every(
  193. (item) =>
  194. item.wmsStockId &&
  195. item.wmsStoreAreaId &&
  196. item.wmsStockLocationId &&
  197. item.workOrderNo &&
  198. item.warehousingOrderNo &&
  199. item.productCode &&
  200. item.detailErpId
  201. );
  202. if (!isEmpty) {
  203. this.$modal.msgWarning("数据不能为空");
  204. return;
  205. }
  206. this.ensureLoading = true;
  207. const wareHousingList = this.list.map((item) => {
  208. const {
  209. wmsStockId: stockCode,
  210. wmsStoreAreaId: areaCode,
  211. wmsStockLocationId: locationCode,
  212. masterId,
  213. warehousingOrderNo,
  214. detailErpId,
  215. productCode,
  216. planAmount,
  217. workOrderNo,
  218. caseNo,
  219. inQty,
  220. wmsStockLogicId,
  221. } = item;
  222. return {
  223. stockCode,
  224. areaCode,
  225. locationCode,
  226. masterId,
  227. warehousingOrderNo,
  228. detailErpId,
  229. productCode,
  230. planAmount,
  231. workOrderNo,
  232. caseNo,
  233. inQty,
  234. wmsStockLogicId,
  235. };
  236. });
  237. createBatchIncomingProduceDetail(wareHousingList)
  238. .then((res) => {
  239. this.$modal.msgSuccess("入库成功");
  240. this.open = false;
  241. this.ensureLoading = false;
  242. this.$parent.getList();
  243. this.$emit("complete");
  244. })
  245. .finally(() => {
  246. this.loading = false;
  247. this.ensureLoading = false;
  248. });
  249. },
  250. stockChange(item, index, row) {
  251. if (item) {
  252. const { id } = item;
  253. row.wmsStockId = id;
  254. row.wmsStoreAreaName = undefined;
  255. row.wmsStockLocationName = undefined;
  256. this.$refs[`area-${index}`].options = [];
  257. this.$refs[`area-${index}`].fetchAreaList(id);
  258. }
  259. },
  260. areaChange(item, index, row) {
  261. if (item) {
  262. const { id } = item;
  263. row.wmsStoreAreaId = id;
  264. row.wmsStockLocationName = undefined;
  265. this.$refs[`location-${index}`].options = [];
  266. this.$refs[`location-${index}`].fetchLocationList(id);
  267. }
  268. },
  269. locationChange(item, row) {
  270. row.wmsStockLocationId = item.id;
  271. },
  272. dialogOpen() {
  273. this.$nextTick(() => {
  274. this.getList();
  275. });
  276. },
  277. },
  278. };
  279. </script>
  280. <style></style>