exWarehousing.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534
  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. if(uni.getStorageSync('erpContractNo').contractNo){
  245. this.detailData.contractNo = uni.getStorageSync('erpContractNo').contractNo;
  246. }
  247. this.detailData.goodsNameKey = uni.getStorageSync('erpContractNo').goodsNameKey;
  248. if (!uni.getStorageSync('erpContractNo').tranCarInfoList)
  249. uni.getStorageSync('erpContractNo').tranCarInfoList = []
  250. if (!this.detailData.contractNo) {
  251. this.detailData.contractNo = '请选择合同编号'
  252. } else {
  253. if(uni.getStorageSync('erpContractNo').tranCarInfoList){
  254. if (uni.getStorageSync('erpContractNo').tranCarInfoList.length == 0) {
  255. this.isPC = false
  256. }}
  257. }
  258. if (!this.detailData.goodsName) {
  259. this.detailData.goodsName = '货名'
  260. }
  261. //出库类型
  262. this.outWarehouse()
  263. //经办人
  264. this.handler()
  265. },
  266. methods: {
  267. //计算纯重
  268. pureWeightCount() {
  269. if (this.netWeight && this.detailData.buckleWeightRatio && this.detailData.solidGrainWater && this
  270. .detailData.tidalGrainWater) {
  271. // 纯重=净重x[100-(潮粮水分-干粮水分)x扣重比]/100
  272. this.detailData.pureWeight = 100 - (this.detailData.tidalGrainWater - this.detailData
  273. .solidGrainWater) * this.netWeight * this.detailData.buckleWeightRatio / 100
  274. this.detailData.pureWeight = this.detailData.pureWeight.toFixed(3)
  275. }
  276. },
  277. outWarehouse() {
  278. this.$api.doRequest('get', '/commonSysParameter/getInfo', {
  279. constId: 'CON6'
  280. }).then(res => {
  281. this.warehousingTypeList = res.data.data
  282. })
  283. },
  284. handler() {
  285. this.$api.doRequest('get', '/staff/query/getStaffListByCompIdAndWarehouseId', {
  286. compId: helper.erpWarehouse.compId,
  287. warehouseId: helper.erpWarehouse.warehouseId
  288. }).then(res => {
  289. this.handlerList = res.data.data
  290. })
  291. },
  292. contractNopicker(e) {
  293. },
  294. typePicker(e) {
  295. this.detailData.type = this.typeList[e].type
  296. },
  297. pjPicker(e) {
  298. this.detailData.gradeKey = e[0]
  299. this.detailData.grade = this.pjList[e].type
  300. },
  301. handlerPicker(e) {
  302. this.detailData.agentKey = e[0]
  303. this.detailData.agent = this.handlerList[e].staffName
  304. },
  305. dateChange(e) {
  306. this.detailData.inOutDate = e.year + "-" + e.month + "-" + e.day + " " + e.hour + ":" + e.minute +":" + e.second
  307. // this.inOutDate1 = e.year + "-" + e.month + "-" + e.day + " " + e.hour + ":" + e.minute
  308. },
  309. warehousingTypePicker(e) {
  310. this.detailData.inOutType = this.warehousingTypeList[e].constValue
  311. },
  312. filterFileType(index, lists) {
  313. if (lists[index].fileType != 'jpg' && lists[index].fileType != 'png' && lists[index].fileType != 'gif') {
  314. lists.splice(index, 1);
  315. // 当前文件不支持
  316. uni.showModal({
  317. title: '暂不支持当前图片类型',
  318. showCancel: false
  319. });
  320. } else {
  321. this.isAdd = false;
  322. }
  323. },
  324. calculate() {
  325. if (this.detailData.grossWeight && this.detailData.tare) {
  326. this.netWeight = this.detailData.grossWeight - this.detailData.tare
  327. }
  328. },
  329. getImgUrl(res) {
  330. this.detailData.addressUrl = res
  331. console.log(res)
  332. console.log('------------res-----------')
  333. },
  334. onError(error) {
  335. alert(error)
  336. console.log('------------error-----------')
  337. console.log(error)
  338. },
  339. binNumberpicker(e) {
  340. this.detailData.binNumber = this.positionList[e[0]].binNumber
  341. },
  342. // getWeighingManagement() {
  343. // this.$api.doRequest('get', '/weighingManagement/getWeighingManagement', {
  344. // id: this.id
  345. // }).then(res => {
  346. // if (res.data.code == 200) {
  347. // this.detailData = res.data.data
  348. // }
  349. // })
  350. // this.$api.doRequest('get', '/warehouseBaseInfo/getWarehouse', {
  351. // id: this.cangId
  352. // }).then(res => {
  353. // if (res.data.code == 200) {
  354. // this.positionList = res.data.data.warehousePositionInfoList
  355. // }
  356. // })
  357. // this.$api.doRequest('get', '/warehouseBaseInfo/selectContractNoList', {
  358. // compId: '',
  359. // flag: 5
  360. // }).then(res => {
  361. // if (res.data.code == 200) {
  362. // this.contractNoList = res.data.data
  363. // }
  364. // })
  365. // },
  366. onProgress(e) {},
  367. onRemove(index) {},
  368. submit(num) {
  369. if (!this.detailData.grossWeight) {
  370. this.$api.msg('毛重不能为空')
  371. return
  372. }
  373. if (!this.detailData.grossWeight) {
  374. this.$api.msg('毛重不能为空')
  375. return
  376. }
  377. if (isNaN(this.detailData.grossWeight) ||
  378. (String(this.detailData.grossWeight).indexOf('.') != -1 &&
  379. String(this.detailData.grossWeight).length -
  380. (String(this.detailData.grossWeight).indexOf('.') + 1) >
  381. 1) ||
  382. this.detailData.grossWeight < 1 ||
  383. this.detailData.grossWeight > 100000
  384. ) {
  385. this.$api.msg('毛重输入错误!')
  386. return
  387. }
  388. this.detailData.baseId = helper.erpWarehouse.warehouseId
  389. this.detailData.warehouseName = helper.erpWarehouse.warehouseName
  390. this.detailData.positionId = helper.erpWarehouse.positionId
  391. this.detailData.binNumber = this.binNumber
  392. this.detailData.goodsNameKey = uni.getStorageSync('erpContractNo').goodsNameKey;
  393. this.detailData.compId = helper.erpWarehouse.compId
  394. this.detailData.netWeight = this.netWeight
  395. this.detailData.inOutFlag = 1
  396. this.detailData.taskType = "出库任务"
  397. this.detailData.pcFlag = 0
  398. let title = ""
  399. if (num == 1) {
  400. this.detailData.statusFlag = 1
  401. this.detailData.backOffice = this.userInfo.userName
  402. this.detailData.backOfficeId = this.userInfo.id
  403. title = "暂存成功"
  404. } else if (num == 2) {
  405. this.detailData.statusFlag = 3
  406. title = "提交成功"
  407. }
  408. let that = this
  409. uni.showModal({
  410. content: "确定提交出库信息?",
  411. success(res) {
  412. if (res.confirm) {
  413. that.$api.doRequest('post', '/warehouseInOutInfo/InOutWarehouse',
  414. that.detailData).then(res => {
  415. if (res.data.code == 200) {
  416. that.$api.msg(title)
  417. uni.navigateBack()
  418. }
  419. })
  420. }
  421. }
  422. })
  423. },
  424. slectcontractNo() {
  425. uni.navigateTo({
  426. url: '/pages/erp/warehousing/selectContractNo?flag=' + 5
  427. })
  428. },
  429. slectCarNo() {
  430. uni.navigateTo({
  431. url: '/pages/erp/exWarehousing/selectCarNo'
  432. })
  433. },
  434. }
  435. }
  436. </script>
  437. <style scoped lang="scss">
  438. uni-page-body {
  439. overflow: hidden;
  440. }
  441. .warp {
  442. margin: 10rpx;
  443. padding: 20rpx 20rpx 140rpx 20rpx;
  444. .top {
  445. display: flex;
  446. margin-bottom: 20rpx;
  447. .top-left {
  448. margin-right: 20rpx;
  449. }
  450. }
  451. }
  452. .content,
  453. .content1,
  454. .content2 {
  455. border-radius: 20rpx;
  456. background: white;
  457. padding: 20rpx;
  458. .title {
  459. font-size: 28rpx;
  460. font-weight: 600;
  461. color: #333333;
  462. }
  463. .row {
  464. display: flex;
  465. justify-content: space-between;
  466. border-bottom: 1px solid #EEEEEE;
  467. padding: 21rpx 0;
  468. .right,
  469. input {
  470. font-size: 28rpx;
  471. color: #333333;
  472. }
  473. }
  474. .row-bottom {
  475. // border: 0;
  476. .right-bottom {
  477. width: 300rpx;
  478. text-align: right;
  479. }
  480. }
  481. }
  482. .content1 {
  483. margin-top: 20rpx;
  484. }
  485. .content2 {
  486. margin-top: 10px;
  487. // display: flex;
  488. align-items: center;
  489. .left {
  490. margin-right: 20px;
  491. }
  492. }
  493. .submit {
  494. width: 40%;
  495. background: #22C572;
  496. border-radius: 10rpx;
  497. }
  498. .edit-btn {
  499. background: #22C572;
  500. width: 100rpx;
  501. height: 50rpx;
  502. margin: 0;
  503. color: white;
  504. }
  505. .has-btn {
  506. align-items: center;
  507. }
  508. .bottom-btn {
  509. width: 92%;
  510. position: fixed;
  511. bottom: 40rpx;
  512. display: flex;
  513. z-index: 2;
  514. }
  515. </style>