index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  1. <template>
  2. <view class="content-box">
  3. <uni-nav-bar
  4. fixed="true"
  5. statusBar="true"
  6. left-icon="back"
  7. title="入库"
  8. background-color="#F7F9FA"
  9. color="#000"
  10. @clickLeft="back"
  11. >
  12. </uni-nav-bar>
  13. <view class="list_box">
  14. <u-list @scrolltolower="scrolltolower">
  15. <view class="card_box">
  16. <workOrderBom
  17. :item="objData"
  18. v-if="objData"
  19. pType="job"
  20. @handleScan="handleScan"
  21. ></workOrderBom>
  22. <jobBom
  23. v-if="clientEnvironmentId == 2"
  24. :item="objData"
  25. ref="jobRef"
  26. :notFormed="objData.notFormedList"
  27. pType="job"
  28. @penalize="penalize"
  29. @modeNum="modeNum"
  30. ></jobBom>
  31. <view class="select_box">
  32. <zxz-uni-data-select
  33. :localdata="warehouseList"
  34. placeholder="请选择入库仓库"
  35. v-model="warehouseId"
  36. dataValue="id"
  37. dataKey="name"
  38. filterable
  39. format="{name}"
  40. ></zxz-uni-data-select>
  41. </view>
  42. <view class="select_box" v-if="clientEnvironmentId !== 3">
  43. <zxz-uni-data-select
  44. :localdata="WarehouseSpecTypeList"
  45. placeholder="请选择入库规格"
  46. v-model="inWarehouseSpecType"
  47. dataValue="value"
  48. dataKey="text"
  49. filterable
  50. format="{text}"
  51. disabled
  52. ></zxz-uni-data-select>
  53. </view>
  54. <!-- 打包信息 -->
  55. <view v-if="clientEnvironmentId == 3">
  56. <view class="list_box" v-for="(it, index) in tgList" :key="index">
  57. <view class="time">打包时间: {{ it.createTime }}</view>
  58. <packingTgBom
  59. :list="it.extInfo.pickOutInList"
  60. :isWarehousing="true"
  61. :item="it"
  62. :objData="objData"
  63. ></packingTgBom>
  64. </view>
  65. </view>
  66. <view v-else>
  67. <view v-if="clientEnvironmentId != 3 && objData.singleReport !== 1">
  68. <view class="list_box" v-for="(item, index) in List" :key="index">
  69. <view class="time" style="margin-bottom: 10rpx"
  70. >打包时间: {{ item.createTime }}</view
  71. >
  72. <!-- :item="item"
  73. :list="item.product"
  74. :equipmentList="item.equipmentList"
  75. @countNumPl="countNumPl" -->
  76. <!-- <packingBom
  77. :objData="item.extInfo"
  78. :measuringUnit="item.measuringUnit"
  79. ></packingBom> -->
  80. </view>
  81. <batchProductJobBom
  82. :item="objData"
  83. :list="objData.product"
  84. :equipmentList="objData.equipmentList"
  85. ></batchProductJobBom>
  86. </view>
  87. <view v-else>
  88. <view class="list_box" v-for="(it, index) in List" :key="index">
  89. <view class="time">打包时间: {{ it.createTime }}</view>
  90. <packingQtBom
  91. :list="it.extInfo.pickOutInList"
  92. :isWarehousing="true"
  93. :item="it"
  94. :objData="objData"
  95. ></packingQtBom>
  96. </view>
  97. </view>
  98. </view>
  99. </view>
  100. </u-list>
  101. </view>
  102. <view class="bottom-wrapper">
  103. <view class="btn_box" @click="save">一键报工</view>
  104. </view>
  105. </view>
  106. </template>
  107. <script>
  108. import { getByIdReport, jobSave } from "@/api/pda/jobBooking.js";
  109. import {
  110. getWarehouseList,
  111. listPDAToWarehouse,
  112. listPDAToWarehouseTG,
  113. productReceiveCreate,
  114. } from "@/api/pda/workOrder.js";
  115. import jobBom from "./components/jobBom.vue";
  116. import packingBom from "./components/packingBom.vue";
  117. import workOrderBom from "../feeding/components/workOrderBom.vue";
  118. import packingTgBom from "../jobBooking/components/packingTgBom.vue";
  119. import packingQtBom from "../jobBooking/components/packingQtBom.vue";
  120. import batchProductJobBom from "./components/batchProductJobBom.vue";
  121. export default {
  122. components: {
  123. workOrderBom,
  124. packingBom,
  125. packingTgBom,
  126. packingQtBom,
  127. jobBom,
  128. batchProductJobBom,
  129. },
  130. data() {
  131. return {
  132. id: null,
  133. taskId: null,
  134. objData: {
  135. workReportInfo: {
  136. formedNum: "",
  137. },
  138. },
  139. warehouseList: [],
  140. warehouseId: null,
  141. delta: -1,
  142. List: [],
  143. tgList: [],
  144. inWarehouseSpecType: "2",
  145. WarehouseSpecTypeList: [
  146. {
  147. text: "按计量入库",
  148. value: "1",
  149. },
  150. {
  151. text: "最小包装入库",
  152. value: "2",
  153. },
  154. {
  155. text: "内包装入库",
  156. value: "3",
  157. },
  158. {
  159. text: "外包装入库",
  160. value: "4",
  161. },
  162. ],
  163. clientEnvironmentId:
  164. uni.getStorageSync("userInfo") &&
  165. uni.getStorageSync("userInfo").clientEnvironmentId, // *1 主环境-601环境 2 soll-索尔环境 3 tg-碳谷环境
  166. inWarehouseType: null,
  167. };
  168. },
  169. onLoad(options) {
  170. this.id = options.workOrderId;
  171. this.taskId = options.taskId;
  172. this.workReportId = options.workReportId;
  173. this.delta = options.delta;
  174. this.getList();
  175. this.getWarehouseListFn();
  176. if (this.clientEnvironmentId == 3) {
  177. this.getTgWarehouse();
  178. } else {
  179. this.getWarehouse();
  180. }
  181. },
  182. methods: {
  183. getList() {
  184. getByIdReport(this.id, this.taskId).then((res) => {
  185. this.objData = res;
  186. // console.log(this.objData, "this.objData");
  187. if (res.workOrderType == 1) {
  188. this.inWarehouseType = 1;
  189. } else if (res.workOrderType == 2) {
  190. this.inWarehouseType = 8; // "1入库类型1生产入库2半成品入库"
  191. }
  192. // workReportInfo.formedNum
  193. this.objData.notFormedList = [
  194. {
  195. notFormedNum: null,
  196. notFormedWeight: null,
  197. weightUnit: res.weightUnit,
  198. unit: res.unit,
  199. warehouseId: null, // 处置 仓库id
  200. },
  201. ];
  202. this.objData.workReportInfo = {
  203. formingNum: null,
  204. formingWeight: null,
  205. formedNum: null,
  206. formedWeight: null,
  207. taskId: this.taskId,
  208. };
  209. const formingNum = this.objData.product.reduce((acc, pro) => {
  210. return pro.feedQuantity ? acc + Number(pro.feedQuantity) : acc;
  211. }, 0);
  212. this.objData.workReportInfo.formedNum = formingNum;
  213. this.objData.workReportInfo.formingNum = res.formingNum;
  214. this.objData.workReportInfo.formingWeight = res.formingWeight;
  215. this.objData.workReportInfo.unit = res.unit;
  216. this.objData.workReportInfo.weightUnit = res.weightUnit;
  217. this.objData.workReportInfo.workOrderId = res.workOrderId;
  218. this.$set(this, "objData", this.objData);
  219. console.log(this.objData, "222222222222222222222");
  220. });
  221. },
  222. getWarehouseListFn() {
  223. getWarehouseList().then((res) => {
  224. this.warehouseList = res;
  225. });
  226. },
  227. getWarehouse() {
  228. let param = {
  229. workOrderId: this.id,
  230. taskId: this.taskId,
  231. workReportId: this.workReportId,
  232. };
  233. listPDAToWarehouse(param).then((res) => {
  234. this.List = res;
  235. });
  236. },
  237. getTgWarehouse() {
  238. let param = {
  239. workOrderId: this.id,
  240. taskId: this.taskId,
  241. workReportId: this.workReportId,
  242. };
  243. listPDAToWarehouseTG(param).then((res) => {
  244. this.tgList = res;
  245. });
  246. },
  247. handleScan() {},
  248. scrolltolower() {},
  249. save() {
  250. if (!this.warehouseId) {
  251. uni.showToast({
  252. icon: "none",
  253. title: "请先选择入库仓库",
  254. });
  255. return false;
  256. }
  257. // if (this.clientEnvironmentId == 21) {
  258. // // /pda/mes/workreport/productReceiveCreate/{workId}
  259. // productReceiveCreate(this.objData.workOrderId).then(v=>{
  260. // uni.navigateBack();
  261. // })
  262. // } else {
  263. let categoryId = "",
  264. rootCategoryLevelId = "";
  265. if (this.objData.product.length) {
  266. categoryId = this.objData.product[0].categoryId;
  267. rootCategoryLevelId = this.objData.product[0].rootCategoryLevelId;
  268. }
  269. let storageInfo = {
  270. inWarehouseSpecType:
  271. this.clientEnvironmentId !== 3 || this.clientEnvironmentId !== 2
  272. ? Number(this.inWarehouseSpecType)
  273. : "",
  274. warehouseId: this.warehouseId,
  275. inWarehouseType: this.inWarehouseType,
  276. toWarehouseList:
  277. this.clientEnvironmentId == 3 ? this.tgList : this.List,
  278. };
  279. if (this.clientEnvironmentId == 2) {
  280. let num = "";
  281. if (
  282. this.objData.workReportInfo &&
  283. this.objData.workReportInfo?.formedNum
  284. ) {
  285. num = this.objData.workReportInfo.formedNum;
  286. }
  287. storageInfo.packingReportList = [
  288. {
  289. code: this.objData.productCode,
  290. categoryId: categoryId,
  291. workOrderId: this.objData.workOrderId,
  292. rootCategoryLevelId: rootCategoryLevelId,
  293. totalQuantity: num,
  294. quantity: num,
  295. unit: this.objData.unit,
  296. packingNum: 1,
  297. taskId: -1,
  298. },
  299. ];
  300. }
  301. this.objData["storageInfo"] = storageInfo;
  302. console.log(this.objData, "this.objData");
  303. jobSave(this.objData).then((res) => {
  304. uni.showToast({
  305. title: "入库申请成功",
  306. icon: "none",
  307. });
  308. setTimeout(() => {
  309. uni.navigateBack();
  310. }, 500);
  311. });
  312. },
  313. },
  314. };
  315. </script>
  316. <style lang="scss" scoped>
  317. .content-box {
  318. height: 100vh;
  319. overflow: hidden;
  320. display: flex;
  321. flex-direction: column;
  322. }
  323. .list_box {
  324. flex: 1;
  325. overflow: hidden;
  326. padding: 4rpx 0;
  327. .u-list {
  328. height: 100% !important;
  329. }
  330. .card_box {
  331. padding: 16rpx 24rpx;
  332. }
  333. }
  334. .bottom-wrapper {
  335. .btn_box {
  336. width: 750rpx;
  337. height: 88rpx;
  338. line-height: 88rpx;
  339. background: $theme-color;
  340. text-align: center;
  341. font-size: 36rpx;
  342. font-style: normal;
  343. font-weight: 400;
  344. color: #fff;
  345. }
  346. }
  347. .select_box {
  348. margin-top: 20rpx;
  349. }
  350. .list_box {
  351. margin-top: 40rpx;
  352. .time {
  353. font-size: 28rpx;
  354. }
  355. }
  356. </style>