index.vue 11 KB

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