exWarehousing.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533
  1. <template>
  2. <view class="warp">
  3. <view class="top">
  4. <view class="top-left">{{warehouseName}}</view>
  5. <view>{{binNumber}}仓位</view>
  6. </view>
  7. <view class="content">
  8. <view class="row">
  9. <view class="left">合同编号</view>
  10. <view @click='slectcontractNo'>{{detailData.contractNo}}</view>
  11. </view>
  12. <view class="row">
  13. <view class="left">货名</view>
  14. <view class="right">{{detailData.goodsName ? detailData.goodsName : "选择合同,自动获取"}}
  15. </view>
  16. </view>
  17. <view class="row">
  18. <view class="left">类型</view>
  19. <view @click='show1=true'>{{detailData.type}}</view>
  20. <u-picker :range="typeList" range-key="type" @confirm='typePicker($event)' v-model="show1"
  21. mode="selector">
  22. <view class="">{{detailData.type}}</view>
  23. </u-picker>
  24. </view>
  25. <view class="row row-bottom">
  26. <view class="left">毛重(吨)</view>
  27. <input @input='calculate' v-model='detailData.grossWeight' class="right-bottom"
  28. placeholder="输入毛重"></input>
  29. </view>
  30. <view class="row row-bottom">
  31. <view class="left">皮重(吨)</view>
  32. <input @input='calculate' v-model='detailData.tare' class="right-bottom" placeholder="输入皮重"></input>
  33. </view>
  34. <view class="row row-bottom">
  35. <view class="left">净重(吨)</view>
  36. <input v-model='netWeight' disabled class="right-bottom" placeholder="不可编辑,自动计算"></input>
  37. </view>
  38. <view class="row row-bottom" v-if="detailData.type == '潮粮'">
  39. <view class="left">扣重比</view>
  40. <input v-model='detailData.buckleWeightRatio' class="right-bottom" placeholder="输入扣重比"
  41. @input="pureWeightCount"></input>
  42. </view>
  43. <view class="row row-bottom" v-if="detailData.type == '潮粮'">
  44. <view class="left">干粮水分(%)</view>
  45. <input v-model='detailData.solidGrainWater' class="right-bottom" placeholder="输入干粮水分占比"
  46. @input="pureWeightCount"></input>
  47. </view>
  48. <view class="row row-bottom" v-if="detailData.type == '潮粮'">
  49. <view class="left">潮粮水分(%)</view>
  50. <input v-model='detailData.tidalGrainWater' class="right-bottom" placeholder="输入潮粮水分占比"
  51. @input="pureWeightCount"></input>
  52. </view>
  53. <view class="row row-bottom" v-if="detailData.type == '潮粮'">
  54. <view class="left">纯重(吨)</view>
  55. <input v-model='detailData.pureWeight' class="right-bottom" placeholder="不可编辑,自动计算"></input>
  56. </view>
  57. <view class="row">
  58. <view class="left">品级</view>
  59. <view @click='show3=true'>{{detailData.grade}}</view>
  60. <u-picker :range="pjList" range-key="type" @confirm='pjPicker($event)' v-model="show3" mode="selector">
  61. </u-picker>
  62. </view>
  63. <view class="row">
  64. <view class="left">经办人</view>
  65. <view @click='show6=true'>{{detailData.agent}}</view>
  66. <u-picker :range="handlerList" range-key="staffName" @confirm='handlerPicker($event)' v-model="show6"
  67. mode="selector">
  68. </u-picker>
  69. </view>
  70. <view class="row">
  71. <view class="left">出库日期</view>
  72. <view @click='show7=true'>{{detailData.inOutDate}}</view>
  73. <u-picker v-model="show7" mode="time" @confirm='dateChange($event)' :params="params">
  74. </u-picker>
  75. </view>
  76. <view class="row">
  77. <view class="left">出库类型</view>
  78. <view @click='show5=true'>{{detailData.inOutType}}</view>
  79. <u-picker :range="warehousingTypeList" range-key="constValue" @confirm='warehousingTypePicker($event)'
  80. v-model="show5" mode="selector">
  81. </u-picker>
  82. </view>
  83. <view class="row row-bottom">
  84. <view class="left">车牌号</view>
  85. <input v-if="!isPC" v-model='detailData.carNo' class="right-bottom" placeholder="请输入车牌号"></input>
  86. <view @click='slectCarNo' v-if="isPC">{{detailData.carNo}}</view>
  87. </view>
  88. </view>
  89. <view class="content2">
  90. <view class="left">上传磅单</view>
  91. <upload class="upload" ref="upload" :action="action" :max-size="maxSize" :max-count="1"
  92. :size-type="['compressed']" @on-success="getImgUrl" @on-error="onError" @on-remove="onRemove"
  93. @on-uploaded="isAdd = true" :before-upload="filterFileType" @on-progress="onProgress"></upload>
  94. </view>
  95. <view class="content1">
  96. <view class="title">
  97. 质检数据(选填)
  98. </view>
  99. <view class="row row-bottom">
  100. <view class="left">质检员</view>
  101. <input v-model='detailData.warehouseInOutDetail.qualityInspector' class="right-bottom"
  102. placeholder="输入质检员姓名"></input>
  103. </view>
  104. <view class="row row-bottom">
  105. <view class="left">水分(%)</view>
  106. <input v-model='detailData.warehouseInOutDetail.waterContent' class="right-bottom"
  107. placeholder="输入水分占比"></input>
  108. </view>
  109. <view class="row row-bottom">
  110. <view class="left">容重(克/升)</view>
  111. <input v-model='detailData.warehouseInOutDetail.bulkDensity' class="right-bottom"
  112. placeholder="输入容重"></input>
  113. </view>
  114. <view class="row row-bottom">
  115. <view class="left">热损伤(%)</view>
  116. <input v-model='detailData.warehouseInOutDetail.jiaorenli' class="right-bottom"
  117. placeholder="输入热损伤占比"></input>
  118. </view>
  119. <view class="row row-bottom">
  120. <view class="left">杂质(%)</view>
  121. <input v-model='detailData.warehouseInOutDetail.impurity' class="right-bottom"
  122. placeholder="输入杂质占比"></input>
  123. </view>
  124. <view class="row row-bottom">
  125. <view class="left">霉变粒(%)</view>
  126. <input v-model='detailData.warehouseInOutDetail.mildewGrain' class="right-bottom"
  127. placeholder="输入霉变粒占比"></input>
  128. </view>
  129. <view class="row row-bottom">
  130. <view class="left">不完善粒(%)</view>
  131. <input v-model='detailData.warehouseInOutDetail.imperfectGrain' class="right-bottom"
  132. placeholder="输入不完善粒占比"></input>
  133. </view>
  134. </view>
  135. <u-toast ref="uToast" />
  136. <view class="bottom-btn">
  137. <u-button type="primary" class="submit" hover-class="none" @click="submit(1)">暂存</u-button>
  138. <u-button type="primary" class="submit" hover-class="none" @click="submit(2)">提交</u-button>
  139. </view>
  140. </view>
  141. </template>
  142. <script>
  143. import upload from '@/components/upload.vue';
  144. import helper from '@/common/helper.js';
  145. import {
  146. mapState
  147. } from 'vuex';
  148. export default {
  149. components: {
  150. upload
  151. },
  152. data() {
  153. return {
  154. show: false,
  155. show1: false,
  156. show2: false,
  157. show3: false,
  158. show4: false,
  159. show5: false,
  160. show6: false,
  161. show7: false,
  162. isPC: true,
  163. contractNoList: [{
  164. contractNo: ""
  165. }],
  166. typeList: [{
  167. type: "干粮"
  168. },
  169. {
  170. type: "潮粮"
  171. }
  172. ],
  173. pjList: [{
  174. type: "一等品"
  175. },
  176. {
  177. type: "二等品"
  178. },
  179. {
  180. type: "三等品"
  181. },
  182. {
  183. type: "等外"
  184. }
  185. ],
  186. handlerList: [{
  187. name: "张三"
  188. },
  189. {
  190. name: "二等"
  191. },
  192. {
  193. name: "三等"
  194. },
  195. {
  196. name: "等外"
  197. }
  198. ],
  199. warehousingTypeList: [],
  200. action: this.$uploadUrl,
  201. maxSize: 50 * 1024 * 1024, //限制文件大小 50M
  202. btnLoading: false, //防止重复点击
  203. isAdd: true,
  204. warehouseName: '',
  205. binNumber: '',
  206. detailData: {
  207. contractNo: "请选择合同编号或移库任务编号",
  208. type: "请选择类型",
  209. grade: "请输入品级",
  210. agent: "请选择经办人",
  211. inOutDate: "请选择出库日期",
  212. inOutType: "请选择出库类型",
  213. warehouseInOutDetail: {},
  214. gradeKey: "",
  215. },
  216. params: {
  217. year: true,
  218. month: true,
  219. day: true,
  220. hour: true,
  221. minute: true,
  222. second: true
  223. },
  224. inOutDate1: "",
  225. netWeight: ""
  226. }
  227. },
  228. computed: {
  229. ...mapState(['hasLogin', 'userInfo'])
  230. },
  231. watch: {
  232. netWeight: function(v) {
  233. this.pureWeightCount()
  234. },
  235. },
  236. onLoad(options) {
  237. this.id = options.id
  238. this.cangId = options.cangId
  239. },
  240. onShow() {
  241. this.binNumber = helper.erpWarehouse.binNumber
  242. this.warehouseName = helper.erpWarehouse.warehouseName
  243. this.detailData.goodsName = uni.getStorageSync('erpContractNo').goodsName;
  244. this.detailData.contractNo = uni.getStorageSync('erpContractNo').contractNo;
  245. this.detailData.goodsNameKey = uni.getStorageSync('erpContractNo').goodsNameKey;
  246. if (!uni.getStorageSync('erpContractNo').tranCarInfoList) uni.getStorageSync('erpContractNo')
  247. .tranCarInfoList = []
  248. if (!this.detailData.contractNo) {
  249. this.detailData.contractNo = '请选择合同编号'
  250. } else {
  251. if(uni.getStorageSync('erpContractNo').tranCarInfoList){
  252. if (uni.getStorageSync('erpContractNo').tranCarInfoList.length == 0) {
  253. this.isPC = false
  254. }}
  255. }
  256. if (!this.detailData.goodsName) {
  257. this.detailData.goodsName = '货名'
  258. }
  259. //出库类型
  260. this.outWarehouse()
  261. //经办人
  262. this.handler()
  263. },
  264. methods: {
  265. //计算纯重
  266. pureWeightCount() {
  267. if (this.netWeight && this.detailData.buckleWeightRatio && this.detailData.solidGrainWater && this
  268. .detailData.tidalGrainWater) {
  269. // 纯重=净重x[100-(潮粮水分-干粮水分)x扣重比]/100
  270. this.detailData.pureWeight = 100 - (this.detailData.tidalGrainWater - this.detailData
  271. .solidGrainWater) * this.netWeight * this.detailData.buckleWeightRatio / 100
  272. this.detailData.pureWeight = this.detailData.pureWeight.toFixed(3)
  273. }
  274. },
  275. outWarehouse() {
  276. this.$api.doRequest('get', '/commonSysParameter/getInfo', {
  277. constId: 'CON6'
  278. }).then(res => {
  279. this.warehousingTypeList = res.data.data
  280. })
  281. },
  282. handler() {
  283. this.$api.doRequest('get', '/staff/query/getStaffListByCompIdAndWarehouseId', {
  284. compId: helper.erpWarehouse.compId,
  285. warehouseId: helper.erpWarehouse.warehouseId
  286. }).then(res => {
  287. this.handlerList = res.data.data
  288. })
  289. },
  290. contractNopicker(e) {
  291. },
  292. typePicker(e) {
  293. this.detailData.type = this.typeList[e].type
  294. },
  295. pjPicker(e) {
  296. this.detailData.gradeKey = e[0]
  297. this.detailData.grade = this.pjList[e].type
  298. },
  299. handlerPicker(e) {
  300. this.detailData.agentKey = e[0]
  301. this.detailData.agent = this.handlerList[e].staffName
  302. },
  303. dateChange(e) {
  304. this.detailData.inOutDate = e.year + "-" + e.month + "-" + e.day
  305. this.inOutDate1 = e.year + "-" + e.month + "-" + e.day + " " + e.hour + ":" + e.minute
  306. },
  307. warehousingTypePicker(e) {
  308. this.detailData.inOutType = this.warehousingTypeList[e].constValue
  309. },
  310. filterFileType(index, lists) {
  311. if (lists[index].fileType != 'jpg' && lists[index].fileType != 'png' && lists[index].fileType != 'gif') {
  312. lists.splice(index, 1);
  313. // 当前文件不支持
  314. uni.showModal({
  315. title: '暂不支持当前图片类型',
  316. showCancel: false
  317. });
  318. } else {
  319. this.isAdd = false;
  320. }
  321. },
  322. calculate() {
  323. if (this.detailData.grossWeight && this.detailData.tare) {
  324. this.netWeight = this.detailData.grossWeight - this.detailData.tare
  325. }
  326. },
  327. getImgUrl(res) {
  328. this.detailData.addressUrl = res
  329. console.log(res)
  330. console.log('------------res-----------')
  331. },
  332. onError(error) {
  333. alert(error)
  334. console.log('------------error-----------')
  335. console.log(error)
  336. },
  337. binNumberpicker(e) {
  338. this.detailData.binNumber = this.positionList[e[0]].binNumber
  339. },
  340. // getWeighingManagement() {
  341. // this.$api.doRequest('get', '/weighingManagement/getWeighingManagement', {
  342. // id: this.id
  343. // }).then(res => {
  344. // if (res.data.code == 200) {
  345. // this.detailData = res.data.data
  346. // }
  347. // })
  348. // this.$api.doRequest('get', '/warehouseBaseInfo/getWarehouse', {
  349. // id: this.cangId
  350. // }).then(res => {
  351. // if (res.data.code == 200) {
  352. // this.positionList = res.data.data.warehousePositionInfoList
  353. // }
  354. // })
  355. // this.$api.doRequest('get', '/warehouseBaseInfo/selectContractNoList', {
  356. // compId: '',
  357. // flag: 5
  358. // }).then(res => {
  359. // if (res.data.code == 200) {
  360. // this.contractNoList = res.data.data
  361. // }
  362. // })
  363. // },
  364. onProgress(e) {},
  365. onRemove(index) {},
  366. submit(num) {
  367. if (!this.detailData.grossWeight) {
  368. this.$api.msg('毛重不能为空')
  369. return
  370. }
  371. if (!this.detailData.grossWeight) {
  372. this.$api.msg('毛重不能为空')
  373. return
  374. }
  375. if (isNaN(this.detailData.grossWeight) ||
  376. (String(this.detailData.grossWeight).indexOf('.') != -1 &&
  377. String(this.detailData.grossWeight).length -
  378. (String(this.detailData.grossWeight).indexOf('.') + 1) >
  379. 1) ||
  380. this.detailData.grossWeight < 1 ||
  381. this.detailData.grossWeight > 100000
  382. ) {
  383. this.$api.msg('毛重输入错误!')
  384. return
  385. }
  386. this.detailData.baseId = helper.erpWarehouse.warehouseId
  387. this.detailData.warehouseName = helper.erpWarehouse.warehouseName
  388. this.detailData.positionId = helper.erpWarehouse.positionId
  389. this.detailData.binNumber = this.binNumber
  390. this.detailData.goodsNameKey = uni.getStorageSync('erpContractNo').goodsNameKey;
  391. this.detailData.compId = helper.erpWarehouse.compId
  392. this.detailData.netWeight = this.netWeight
  393. this.detailData.inOutFlag = 1
  394. this.detailData.taskType = "出库任务"
  395. this.detailData.pcFlag = 0
  396. let title = ""
  397. if (num == 1) {
  398. this.detailData.statusFlag = 1
  399. this.detailData.inOutDate = this.inOutDate1
  400. this.detailData.backOffice = this.userInfo.userName
  401. this.detailData.backOfficeId = this.userInfo.id
  402. title = "暂存成功"
  403. } else if (num == 2) {
  404. this.detailData.statusFlag = 3
  405. title = "提交成功"
  406. }
  407. let that = this
  408. uni.showModal({
  409. content: "确定提交出库信息?",
  410. success(res) {
  411. if (res.confirm) {
  412. that.$api.doRequest('post', '/warehouseInOutInfo/InOutWarehouse',
  413. that.detailData).then(res => {
  414. if (res.data.code == 200) {
  415. that.$api.msg(title)
  416. uni.navigateBack()
  417. }
  418. })
  419. }
  420. }
  421. })
  422. },
  423. slectcontractNo() {
  424. uni.navigateTo({
  425. url: '/pages/erp/warehousing/selectContractNo?flag=' + 5
  426. })
  427. },
  428. slectCarNo() {
  429. uni.navigateTo({
  430. url: '/pages/erp/exWarehousing/selectCarNo'
  431. })
  432. },
  433. }
  434. }
  435. </script>
  436. <style scoped lang="scss">
  437. uni-page-body {
  438. overflow: hidden;
  439. }
  440. .warp {
  441. margin: 10rpx;
  442. padding: 20rpx 20rpx 140rpx 20rpx;
  443. .top {
  444. display: flex;
  445. margin-bottom: 20rpx;
  446. .top-left {
  447. margin-right: 20rpx;
  448. }
  449. }
  450. }
  451. .content,
  452. .content1,
  453. .content2 {
  454. border-radius: 20rpx;
  455. background: white;
  456. padding: 20rpx;
  457. .title {
  458. font-size: 28rpx;
  459. font-weight: 600;
  460. color: #333333;
  461. }
  462. .row {
  463. display: flex;
  464. justify-content: space-between;
  465. border-bottom: 1px solid #EEEEEE;
  466. padding: 21rpx 0;
  467. .right,
  468. input {
  469. font-size: 28rpx;
  470. color: #333333;
  471. }
  472. }
  473. .row-bottom {
  474. // border: 0;
  475. .right-bottom {
  476. width: 300rpx;
  477. text-align: right;
  478. }
  479. }
  480. }
  481. .content1 {
  482. margin-top: 20rpx;
  483. }
  484. .content2 {
  485. margin-top: 10px;
  486. // display: flex;
  487. align-items: center;
  488. .left {
  489. margin-right: 20px;
  490. }
  491. }
  492. .submit {
  493. width: 40%;
  494. background: #22C572;
  495. border-radius: 10rpx;
  496. }
  497. .edit-btn {
  498. background: #22C572;
  499. width: 100rpx;
  500. height: 50rpx;
  501. margin: 0;
  502. color: white;
  503. }
  504. .has-btn {
  505. align-items: center;
  506. }
  507. .bottom-btn {
  508. width: 92%;
  509. position: fixed;
  510. bottom: 40rpx;
  511. display: flex;
  512. z-index: 2;
  513. }
  514. </style>