index.vue 11 KB

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