warehousing.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857
  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}}</view>
  15. </view>
  16. <view class="row">
  17. <view class="left">类型</view>
  18. <view @click='show1=true'>{{detailData.type}}</view>
  19. <u-picker :range="typeList" range-key="type" @confirm='typePicker($event)' v-model="show1"
  20. mode="selector">
  21. </u-picker>
  22. </view>
  23. <view class="row row-bottom">
  24. <view class="left">毛重(吨)</view>
  25. <input @input='calculate' v-model='detailData.grossWeight' class="right-bottom"
  26. placeholder="输入毛重"></input>
  27. </view>
  28. <view class="row row-bottom">
  29. <view class="left">皮重(吨)</view>
  30. <input @input='calculate' v-model='detailData.tare' class="right-bottom" placeholder="输入皮重"></input>
  31. </view>
  32. <view class="row row-bottom">
  33. <view class="left">扣重(吨)</view>
  34. <input @input='calculate' v-model='detailData.deductionWeight' class="right-bottom"
  35. placeholder="输入扣重"></input>
  36. </view>
  37. <view class="row row-bottom">
  38. <view class="left">净重(吨)</view>
  39. <input @input='' v-model='netWeight' class="right-bottom" placeholder="不可编辑,自动计算"
  40. :disabled="true"></input>
  41. </view>
  42. <view class="row row-bottom">
  43. <view class="left">扣款(元/吨)</view>
  44. <input @input='' v-model='detailData.deductionAmount' class="right-bottom" placeholder="输入扣款"></input>
  45. </view>
  46. <view class="row row-bottom" v-if="detailData.type=='潮粮'">
  47. <view class="left">扣重比</view>
  48. <input @input='' v-model='detailData.buckleWeightRatio' class="right-bottom" placeholder="输入扣重比"
  49. @input="pureWeightCount"></input>
  50. </view>
  51. <view class="row row-bottom" v-if="detailData.type=='潮粮'">
  52. <view class="left">干粮水分(%)</view>
  53. <input @input='' v-model='detailData.solidGrainWater' class="right-bottom" placeholder="输入干粮水分占比"
  54. @input="pureWeightCount"></input>
  55. </view>
  56. <view class="row row-bottom" v-if="detailData.type=='潮粮'">
  57. <view class="left">潮粮水分(%)</view>
  58. <input @input='' v-model='detailData.tidalGrainWater' class="right-bottom" placeholder="输入潮粮水分占比"
  59. @input="pureWeightCount"></input>
  60. </view>
  61. <view class="row row-bottom" v-if="detailData.type=='潮粮'">
  62. <view class="left">纯重(吨)</view>
  63. <input @input='calculate' v-model='detailData.pureWeight' class="right-bottom" placeholder="不可编辑,自动计算"
  64. :disabled="true"></input>
  65. </view>
  66. <view class="row">
  67. <view class="left">品级</view>
  68. <view @click='show3=true'>{{detailData.grade}}</view>
  69. <u-picker :range="pjList" range-key="grade" @confirm='pjPicker($event)' v-model="show3" mode="selector">
  70. </u-picker>
  71. </view>
  72. <view class="row">
  73. <view class="left">经办人</view>
  74. <view @click='show6=true'>{{detailData.agent}}</view>
  75. <u-picker :range="handlerList" range-key="staffName" @confirm='handlerPicker($event)' v-model="show6"
  76. mode="selector">
  77. </u-picker>
  78. </view>
  79. <view class="row">
  80. <view class="left">入库日期</view>
  81. <view @click='show4=true'>{{detailData.inOutDate}}</view>
  82. <u-picker v-model="show4" mode="time" @confirm='dateChange($event)' :params="params">
  83. </u-picker>
  84. </view>
  85. <view class="row">
  86. <view class="left">入库类型</view>
  87. <view @click='show5=true'>{{detailData.inOutType}}</view>
  88. <u-picker :range="warehousingTypeList" range-key="constValue" @confirm='warehousingTypePicker($event)'
  89. v-model="show5" mode="selector">
  90. </u-picker>
  91. </view>
  92. <view class="row row-bottom">
  93. <view class="left">车牌号</view>
  94. <input v-if="!isPC" @input='' v-model='detailData.carNo' class="right-bottom"
  95. placeholder="请输入车牌号"></input>
  96. <view @click='slectCarNo' v-if="isPC">{{detailData.carNo}}</view>
  97. </view>
  98. <view class="row row-bottom has-btn">
  99. <view class="left">成本(元/吨)</view>
  100. <input v-model='detailData.cost' class="right-bottom"
  101. placeholder="自动获取" :disabled="isEditCB"></input>
  102. <!-- <input v-if="detailData.inOutType!='采购入库'" v-model='detailData.cost' class="right-bottom"
  103. placeholder="自动获取" :disabled="isEditCB"></input> -->
  104. <u-button class="edit-btn" hover-class="none" @click="editCB">编辑</u-button>
  105. </view>
  106. <view class="row row-bottom has-btn">
  107. <view class="left">运费(元/吨)</view>
  108. <input @input='' v-model='detailData.freight' :disabled="isEditYF" class="right-bottom"
  109. placeholder="自动获取"></input>
  110. <u-button class="edit-btn" hover-class="none" @click="editYF">编辑</u-button>
  111. </view>
  112. </view>
  113. <view class="content2">
  114. <view class="left">上传磅单</view>
  115. <upload class="upload" ref="upload" :action="action" :max-size="maxSize" :max-count="1"
  116. :size-type="['compressed']" @on-success="getImgUrl" @on-error="onError" @on-remove="onRemove"
  117. @on-uploaded="isAdd = true" :before-upload="filterFileType" @on-progress="onProgress"></upload>
  118. </view>
  119. <view class="content1">
  120. <view class="title">
  121. 质检数据(选填)
  122. </view>
  123. <view class="row row-bottom">
  124. <view class="left">质检员</view>
  125. <input @input='' v-model='detailData.warehouseInOutDetail.qualityInspector' class="right-bottom"
  126. placeholder="输入质检员姓名"></input>
  127. </view>
  128. <view class="row row-bottom">
  129. <view class="left">水分(%)</view>
  130. <input @input='' v-model='detailData.warehouseInOutDetail.waterContent' class="right-bottom"
  131. placeholder="输入水分占比"></input>
  132. </view>
  133. <view class="row row-bottom">
  134. <view class="left">容重(克/升)</view>
  135. <input v-model='detailData.warehouseInOutDetail.bulkDensity' class="right-bottom"
  136. placeholder="输入容重"></input>
  137. </view>
  138. <view class="row row-bottom">
  139. <view class="left">热损伤(%)</view>
  140. <input @input='' v-model='detailData.warehouseInOutDetail.jiaorenli' class="right-bottom"
  141. placeholder="输入热损伤占比"></input>
  142. </view>
  143. <view class="row row-bottom">
  144. <view class="left">杂质(%)</view>
  145. <input @input='' v-model='detailData.warehouseInOutDetail.impurity' class="right-bottom"
  146. placeholder="输入杂质占比"></input>
  147. </view>
  148. <view class="row row-bottom">
  149. <view class="left">霉变粒(%)</view>
  150. <input @input='' v-model='detailData.warehouseInOutDetail.mildewGrain' class="right-bottom"
  151. placeholder="输入霉变粒占比"></input>
  152. </view>
  153. <view class="row row-bottom">
  154. <view class="left">不完善粒(%)</view>
  155. <input @input='' v-model='detailData.warehouseInOutDetail.imperfectGrain' class="right-bottom"
  156. placeholder="输入不完善粒占比"></input>
  157. </view>
  158. </view>
  159. <u-toast ref="uToast" />
  160. <view class="bottom-btn">
  161. <u-button type="primary" class="submit" hover-class="none" @click="submit(1)">暂存</u-button>
  162. <u-button type="primary" class="submit" hover-class="none" @click="submit(2)">提交</u-button>
  163. </view>
  164. </view>
  165. </template>
  166. <script>
  167. import {
  168. mapState
  169. } from 'vuex';
  170. import upload from '@/components/upload.vue';
  171. import helper from '@/common/helper.js';
  172. export default {
  173. components: {
  174. upload
  175. },
  176. data() {
  177. return {
  178. show: false,
  179. show1: false,
  180. show2: false,
  181. show3: false,
  182. show4: false,
  183. show5: false,
  184. show6: false,
  185. isPC: true,
  186. params: {
  187. year: true,
  188. month: true,
  189. day: true,
  190. },
  191. isEditCB: 'false',
  192. isEditYF: 'false',
  193. warehouseName: '',
  194. binNumber: '',
  195. contractNoList: [],
  196. typeList: [{
  197. type: "干粮"
  198. },
  199. {
  200. type: "潮粮"
  201. }
  202. ],
  203. pjList: [{
  204. grade: "一等品"
  205. },
  206. {
  207. grade: "二等品"
  208. },
  209. {
  210. grade: "三等品"
  211. },
  212. {
  213. grade: "等外"
  214. }
  215. ],
  216. handlerList: [],
  217. warehousingTypeList: [],
  218. action: this.$uploadUrl,
  219. maxSize: 50 * 1024 * 1024, //限制文件大小 50M
  220. btnLoading: false, //防止重复点击
  221. isAdd: true,
  222. netWeight: 0,
  223. inOutDate1: "",
  224. detailData: {
  225. contractNo: "请选择合同编号",
  226. carNo: '请输入车牌号',
  227. type: "干粮",
  228. goodsName: "",
  229. inOutDate: '请选择入库日期',
  230. grade: "一等品",
  231. agent: '请选择经办人',
  232. inOutType: '请选择入库类型',
  233. deductionWeight: 0,
  234. grossWeight: 0,
  235. tare: 0,
  236. deductionAmount: 0,
  237. netWeight: 0,
  238. cost:0,
  239. warehouseInOutDetail: {}
  240. }
  241. }
  242. },
  243. onLoad(options) {
  244. this.binNumber = helper.erpWarehouse.binNumber
  245. this.warehouseName = helper.erpWarehouse.warehouseName
  246. this.compId = helper.erpWarehouse.compId
  247. },
  248. computed: {
  249. ...mapState(['hasLogin', 'userInfo']),
  250. },
  251. onShow() {
  252. let _data = uni.getStorageSync('erpContractNo')==''?{}:uni.getStorageSync('erpContractNo')
  253. if(helper.erpWarehouse.personCharge)
  254. this.detailData.agent = helper.erpWarehouse.personCharge
  255. this.detailData.goodsName = _data.goodsName;
  256. this.detailData.contractNo = _data.contractNo;
  257. this.detailData.goodsNameKey = _data.goodsNameKey;
  258. if(_data.unitContractPrice) {
  259. this.detailData.cost = _data.unitContractPrice
  260. }
  261. let _day = new Date();
  262. _day.setTime(_day.getTime());
  263. this.detailData.inOutDate = _day.getFullYear() + "-" + (_day.getMonth() + 1) + "-" + _day.getDate();
  264. if (_data.inOutType == '采购入库') {
  265. this.detailData.freight = 0
  266. }
  267. this.detailData.freight = uni.getStorageSync('CarFreight')
  268. if (!_data.tranCarInfoList){
  269. this.isPC = false
  270. this.detailData.carNo = ""
  271. this.detailData.cost = ""
  272. _data.tranCarInfoList = []
  273. } else{
  274. this.isPC = true
  275. if(uni.getStorageSync('ContractNoCar')){
  276. this.detailData.carNo = uni.getStorageSync('ContractNoCar')
  277. this.$api.doRequest('get', '/warehouseBaseInfo/selectCost', {
  278. contractNo: this.detailData.contractNo,
  279. carNo:this.detailData.carNo
  280. }).then(res => {
  281. if (res.data.code == 200) {
  282. this.detailData.cost = res.data.data
  283. }
  284. })
  285. }else{
  286. this.detailData.carNo = _data.tranCarInfoList[0].carNo
  287. }
  288. }
  289. if (!this.detailData.contractNo) {
  290. this.detailData.contractNo = '请选择合同编号'
  291. }
  292. // else {
  293. // if (_data.tranCarInfoList.length == 0) {
  294. // this.isPC = false
  295. // }
  296. // }
  297. if (!this.detailData.goodsName) {
  298. this.detailData.goodsName = '货名'
  299. }
  300. // 获取入库类型
  301. this.getrkType()
  302. //获取经办人
  303. this.getPerson()
  304. },
  305. watch: {
  306. netWeight: function(v) {
  307. this.pureWeightCount()
  308. },
  309. },
  310. methods: {
  311. //计算纯重
  312. pureWeightCount() {
  313. if (this.netWeight && this.detailData.buckleWeightRatio && this.detailData.solidGrainWater && this
  314. .detailData.tidalGrainWater) {
  315. // 纯重=净重x[100-(潮粮水分-干粮水分)x扣重比]/100
  316. this.detailData.pureWeight = 100 - (this.detailData.tidalGrainWater - this.detailData
  317. .solidGrainWater) * this.netWeight * this.detailData.buckleWeightRatio / 100
  318. this.detailData.pureWeight = this.detailData.pureWeight.toFixed(3)
  319. }
  320. },
  321. getPerson() {
  322. this.$api.doRequest('get', '/staff/query/getStaffListByCompId', {
  323. compId: this.compId
  324. }).then(res => {
  325. this.handlerList = res.data.data
  326. })
  327. },
  328. getrkType() {
  329. this.$api.doRequest('get', '/commonSysParameter/getInfo', {
  330. constId: 'CON5'
  331. }).then(res => {
  332. this.warehousingTypeList = res.data.data
  333. })
  334. },
  335. contractNopicker(e) {},
  336. typePicker(e) {
  337. console.log(e)
  338. this.detailData.type = this.typeList[e].type
  339. },
  340. pjPicker(e) {
  341. console.log(e)
  342. this.detailData.gradeKey = e[0]
  343. this.detailData.grade = this.pjList[e].grade
  344. },
  345. handlerPicker(e) {
  346. console.log(e)
  347. this.detailData.agent = this.handlerList[e].staffName
  348. },
  349. dateChange(e) {
  350. console.log(e)
  351. this.detailData.inOutDate = e.year + "-" + e.month + "-" + e.day
  352. this.inOutDate1 = e.year + "-" + e.month + "-" + e.day + "-" + e.hour + "-" + e.minute + "-" + e.second
  353. },
  354. warehousingTypePicker(e) {
  355. this.detailData.inOutType = this.warehousingTypeList[e].constValue
  356. },
  357. filterFileType(index, lists) {
  358. if (lists[index].fileType != 'jpg' && lists[index].fileType != 'png' && lists[index].fileType != 'gif') {
  359. lists.splice(index, 1);
  360. // 当前文件不支持
  361. uni.showModal({
  362. title: '暂不支持当前图片类型',
  363. showCancel: false
  364. });
  365. } else {
  366. this.isAdd = false;
  367. }
  368. },
  369. calculate() {
  370. this.netWeight = this.detailData.grossWeight - this.detailData.tare - this.detailData.deductionWeight
  371. },
  372. getImgUrl(res) {
  373. this.detailData.addressUrl = res
  374. console.log(res)
  375. console.log('------------res-----------')
  376. },
  377. onError(error) {
  378. alert(error)
  379. console.log('------------error-----------')
  380. console.log(error)
  381. },
  382. contractNopicker(e) {
  383. // this.detailData.goodsName=this.contractNoList[e[0]].goodsName
  384. // this.detailData.contractNo=this.contractNoList[e[0]].contractNo
  385. },
  386. binNumberpicker(e) {
  387. this.detailData.binNumber = this.positionList[e[0]].binNumber
  388. },
  389. getWeighingManagement() {
  390. this.$api.doRequest('get', '/weighingManagement/getWeighingManagement', {
  391. id: this.id
  392. }).then(res => {
  393. if (res.data.code == 200) {
  394. console.log(res)
  395. this.detailData = res.data.data
  396. }
  397. })
  398. this.$api.doRequest('get', '/warehouseBaseInfo/getWarehouse', {
  399. id: this.cangId
  400. }).then(res => {
  401. if (res.data.code == 200) {
  402. this.positionList = res.data.data.warehousePositionInfoList
  403. }
  404. })
  405. this.$api.doRequest('get', '/warehouseBaseInfo/selectContractNoList', {
  406. compId: '',
  407. flag: 5
  408. }).then(res => {
  409. if (res.data.code == 200) {
  410. this.contractNoList = res.data.data
  411. }
  412. })
  413. },
  414. onProgress(e) {
  415. console.log(e)
  416. },
  417. onRemove(index) {},
  418. editCB() {
  419. this.isEditCB = false
  420. },
  421. editYF() {
  422. this.isEditYF = false
  423. },
  424. submit(num) {
  425. if (!this.detailData.contractNo) {
  426. this.$api.msg('合同编号不能为空')
  427. return
  428. }
  429. if (!this.detailData.goodsName) {
  430. this.$api.msg('货名不能为空')
  431. return
  432. }
  433. if (!this.detailData.grossWeight) {
  434. this.$api.msg('毛重不能为空')
  435. return
  436. }
  437. if (isNaN(this.detailData.grossWeight) ||
  438. (String(this.detailData.grossWeight).indexOf('.') != -1 &&
  439. String(this.detailData.grossWeight).length -
  440. (String(this.detailData.grossWeight).indexOf('.') + 1) >
  441. 1) ||
  442. this.detailData.grossWeight < 1 ||
  443. this.detailData.grossWeight > 100000
  444. ) {
  445. this.$api.msg('毛重输入错误!')
  446. return
  447. }
  448. if (!this.detailData.tare) {
  449. this.$api.msg('皮重不能为空')
  450. return
  451. }
  452. if (isNaN(this.detailData.tare) ||
  453. (String(this.detailData.tare).indexOf('.') != -1 &&
  454. String(this.detailData.tare).length -
  455. (String(this.detailData.tare).indexOf('.') + 1) >
  456. 3) ||
  457. this.detailData.tare < 0 ||
  458. this.detailData.tare > 10
  459. ) {
  460. this.$api.msg('皮重输入错误!')
  461. return
  462. }
  463. if (!this.detailData.deductionWeight) {
  464. this.$api.msg('扣重不能为空')
  465. return
  466. }
  467. if (isNaN(this.detailData.deductionWeight) ||
  468. (String(this.detailData.deductionWeight).indexOf('.') != -1 &&
  469. String(this.detailData.deductionWeight).length -
  470. (String(this.detailData.deductionWeight).indexOf('.') + 1) >
  471. 1) ||
  472. this.detailData.deductionWeight < 1 ||
  473. this.detailData.deductionWeight > 100000
  474. ) {
  475. this.$api.msg('扣重输入错误!')
  476. return
  477. }
  478. if (this.detailData.tare > this.detailData.grossWeight) {
  479. this.$api.msg('皮重不能大于毛重')
  480. return
  481. }
  482. if (this.netWeight <= 0) {
  483. this.$api.msg('净重不能小于等于0')
  484. return
  485. }
  486. if (this.detailData.type == "潮粮") {
  487. if (!this.detailData.buckleWeightRatio) {
  488. this.$api.msg('扣重比不能为空')
  489. return
  490. }
  491. if (isNaN(this.detailData.buckleWeightRatio) ||
  492. (String(this.detailData.buckleWeightRatio).indexOf('.') != -1 &&
  493. String(this.detailData.buckleWeightRatio).length -
  494. (String(this.detailData.buckleWeightRatio).indexOf('.') + 1) >
  495. 2) ||
  496. this.detailData.buckleWeightRatio < 0 ||
  497. this.detailData.buckleWeightRatio > 2
  498. ) {
  499. this.$api.msg('扣重比输入错误!')
  500. return
  501. }
  502. if (!this.detailData.solidGrainWater) {
  503. this.$api.msg('干粮水分不能为空')
  504. return
  505. }
  506. if (isNaN(this.detailData.solidGrainWater) ||
  507. (String(this.detailData.solidGrainWater).indexOf('.') != -1 &&
  508. String(this.detailData.solidGrainWater).length -
  509. (String(this.detailData.solidGrainWater).indexOf('.') + 1) >
  510. 1) ||
  511. this.detailData.solidGrainWater < 1 ||
  512. this.detailData.solidGrainWater > 40
  513. ) {
  514. this.$api.msg('干粮水分输入错误!')
  515. return
  516. }
  517. if (!this.detailData.tidalGrainWater) {
  518. this.$api.msg('潮粮水分不能为空')
  519. return
  520. }
  521. if (isNaN(this.detailData.deductionAmount) ||
  522. (String(this.detailData.deductionAmount).indexOf('.') != -1 &&
  523. String(this.detailData.deductionAmount).length -
  524. (String(this.detailData.deductionAmount).indexOf('.') + 1) >
  525. 2) ||
  526. this.detailData.deductionAmount < 1 ||
  527. this.detailData.deductionAmount > 10000
  528. ) {
  529. this.$api.msg('扣款输入错误!')
  530. return
  531. }
  532. if (!this.detailData.deductionAmount) {
  533. this.$api.msg('扣款不能为空')
  534. return
  535. }
  536. if (isNaN(this.detailData.tidalGrainWater) ||
  537. (String(this.detailData.tidalGrainWater).indexOf('.') != -1 &&
  538. String(this.detailData.tidalGrainWater).length -
  539. (String(this.detailData.tidalGrainWater).indexOf('.') + 1) >
  540. 1) ||
  541. this.detailData.tidalGrainWater < 1 ||
  542. this.detailData.tidalGrainWater > 40
  543. ) {
  544. this.$api.msg('潮粮水分输入错误!')
  545. return
  546. }
  547. if (this.detailData.tidalGrainWater < this.detailData.solidGrainWater) {
  548. this.$api.msg('潮粮水分输入错误!')
  549. return
  550. }
  551. if (!this.detailData.pureWeight) {
  552. this.$api.msg('纯重不能为空')
  553. return
  554. }
  555. }
  556. if (this.detailData.grade == "请输入品级") {
  557. this.$api.msg('品级不能为空')
  558. return
  559. }
  560. if (this.detailData.agent == "请选择经办人") {
  561. this.$api.msg('经办人不能为空')
  562. return
  563. }
  564. if (this.detailData.inOutDate == "请选择入库日期") {
  565. this.$api.msg('入库日期不能为空')
  566. return
  567. }
  568. if (this.detailData.inOutType == "请选择入库类型") {
  569. this.$api.msg('入库类型不能为空')
  570. return
  571. }
  572. if (!this.detailData.carNo) {
  573. this.$api.msg('车牌号不能为空')
  574. return
  575. }
  576. if (this.detailData.carNo.length != 7) {
  577. this.$api.msg('车牌号输入有误!')
  578. return
  579. }
  580. if (!this.detailData.addressUrl) {
  581. this.$api.msg('请上传磅单')
  582. return
  583. }
  584. if (!this.detailData.cost) {
  585. this.$api.msg('未获取到成本,请编辑后提交')
  586. return
  587. }
  588. if (String(this.detailData.cost).indexOf('.') != -1 && String(this.detailData
  589. .cost).length - (String(
  590. this.detailData.cost).indexOf('.') + 1) > 2) {
  591. this.$api.msg('成本输入错误')
  592. return
  593. }
  594. if (this.detailData.cost < 0 || this.detailData.cost > 20000) {
  595. this.$api.msg('成本输入错误')
  596. return
  597. }
  598. if (!this.detailData.freight) {
  599. this.$api.msg('运费不能为空')
  600. return
  601. }
  602. if (this.detailData.warehouseInOutDetail.qualityInspector) {
  603. if (this.detailData.warehouseInOutDetail.qualityInspector < 2 || this.detailData
  604. .warehouseInOutDetail
  605. .qualityInspector > 10) {
  606. this.$api.msg('质检员姓名需要2-10个字')
  607. return
  608. }
  609. }
  610. if (this.detailData.warehouseInOutDetail.waterContent) {
  611. if (this.detailData.type == "潮粮" && this.detailData.warehouseInOutDetail.waterContent != this
  612. .detailData.tidalGrainWater) {
  613. this.$api.msg('水分占比与潮粮水分不一致')
  614. return
  615. }
  616. if (this.detailData.type == "干粮") {
  617. if (this.detailData.warehouseInOutDetail.waterContent < 0 || this.detailData
  618. .warehouseInOutDetail
  619. .waterContent > 40) {
  620. this.$api.msg('热损伤占比输入错误')
  621. return
  622. }
  623. if (String(this.detailData.warehouseInOutDetail.waterContent).indexOf('.') != -1 && String(this
  624. .detailData.warehouseInOutDetail.jiaorenli).length - (String(
  625. this.detailData.warehouseInOutDetail.waterContent).indexOf('.') + 1) > 1) {
  626. this.$api.msg('热损伤占比输入错误')
  627. return
  628. }
  629. }
  630. }
  631. if (this.detailData.warehouseInOutDetail.bulkDensity) {
  632. if (this.detailData.warehouseInOutDetail.bulkDensity < 500 || this.detailData.warehouseInOutDetail
  633. .bulkDensity > 1000) {
  634. this.$api.msg('容重输入错误')
  635. return
  636. }
  637. if (String(this.detailData.warehouseInOutDetail.bulkDensity).indexOf('.') != -1 && String(this
  638. .detailData.warehouseInOutDetail.bulkDensity).length - (
  639. String(this.detailData.warehouseInOutDetail.bulkDensity).indexOf('.') + 1) > 0) {
  640. this.$api.msg('容重输入错误')
  641. return
  642. }
  643. }
  644. if (this.detailData.warehouseInOutDetail.jiaorenli) {
  645. if (this.detailData.warehouseInOutDetail.jiaorenli < 0 || this.detailData.warehouseInOutDetail
  646. .jiaorenli > 40) {
  647. this.$api.msg('热损伤占比输入错误')
  648. return
  649. }
  650. if (String(this.detailData.warehouseInOutDetail.jiaorenli).indexOf('.') != -1 && String(this
  651. .detailData
  652. .warehouseInOutDetail.jiaorenli).length - (String(
  653. this.detailData.warehouseInOutDetail.jiaorenli).indexOf('.') + 1) > 1) {
  654. this.$api.msg('热损伤占比输入错误')
  655. return
  656. }
  657. }
  658. if (this.detailData.warehouseInOutDetail.impurity) {
  659. if (this.detailData.warehouseInOutDetail.impurity < 0 || this.detailData.warehouseInOutDetail
  660. .impurity > 40) {
  661. this.$api.msg('杂质占比输入错误')
  662. return
  663. }
  664. if (String(this.detailData.warehouseInOutDetail.impurity).indexOf('.') != -1 && String(this
  665. .detailData
  666. .warehouseInOutDetail.impurity).length - (String(
  667. this.detailData.warehouseInOutDetail.impurity).indexOf('.') + 1) > 1) {
  668. this.$api.msg('杂质占比输入错误')
  669. return
  670. }
  671. }
  672. if (this.detailData.warehouseInOutDetail.mildewGrain) {
  673. if (this.detailData.warehouseInOutDetail.mildewGrain < 0 || this.detailData.warehouseInOutDetail
  674. .mildewGrain > 40) {
  675. this.$api.msg('霉变粒占比输入错误')
  676. return
  677. }
  678. if (String(this.detailData.warehouseInOutDetail.mildewGrain).indexOf('.') != -1 && String(this
  679. .detailData
  680. .warehouseInOutDetail.mildewGrain).length - (String(
  681. this.detailData.warehouseInOutDetail.mildewGrain).indexOf('.') + 1) > 1) {
  682. this.$api.msg('霉变粒占比输入错误')
  683. return
  684. }
  685. }
  686. if (this.detailData.warehouseInOutDetail.imperfectGrain) {
  687. if (this.detailData.warehouseInOutDetail.imperfectGrain < 0 || this.detailData.warehouseInOutDetail
  688. .imperfectGrain > 40) {
  689. this.$api.msg('不完善粒占比输入错误')
  690. return
  691. }
  692. if (String(this.detailData.warehouseInOutDetail.imperfectGrain).indexOf('.') != -1 && String(this
  693. .detailData
  694. .warehouseInOutDetail.imperfectGrain).length - (String(
  695. this.detailData.warehouseInOutDetail.imperfectGrain).indexOf('.') + 1) > 1) {
  696. this.$api.msg('不完善粒占比输入错误')
  697. return
  698. }
  699. }
  700. this.detailData.baseId = helper.erpWarehouse.warehouseId
  701. this.detailData.warehouseName = helper.erpWarehouse.warehouseName
  702. this.detailData.positionId = helper.erpWarehouse.positionId
  703. this.detailData.binNumber = this.binNumber
  704. this.detailData.goodsNameKey = uni.getStorageSync('erpContractNo').goodsNameKey;
  705. this.detailData.compId = helper.erpWarehouse.compId
  706. this.detailData.netWeight = this.netWeight
  707. this.detailData.backOffice = this.userInfo.userName
  708. this.detailData.backOfficeId = this.userInfo.id
  709. this.detailData.inOutFlag = 2
  710. this.detailData.taskType = "入库任务"
  711. this.detailData.pcFlag = 0
  712. let title = ""
  713. if (num == 1) {
  714. this.detailData.statusFlag = 1
  715. title = "暂存成功"
  716. } else if (num == 2) {
  717. this.detailData.statusFlag = 3
  718. title = "提交成功"
  719. }
  720. let that = this
  721. uni.showModal({
  722. content: "确定提交入库信息?",
  723. success(res) {
  724. if (res.confirm) {
  725. that.$api.doRequest('post', '/warehouseInOutInfo/InOutWarehouse',
  726. that.detailData).then(res => {
  727. if (res.data.code == 200) {
  728. that.$api.msg(title)
  729. setTimeout(() => {
  730. uni.navigateBack()
  731. }, 1000)
  732. }else{
  733. that.$api.msg(res.data.message)
  734. }
  735. })
  736. }
  737. }
  738. })
  739. },
  740. slectcontractNo() {
  741. uni.navigateTo({
  742. url: '/pages/erp/warehousing/selectContractNo?compId=' + this.compId
  743. })
  744. },
  745. slectCarNo() {
  746. uni.navigateTo({
  747. url: '/pages/erp/warehousing/selectCarNo'
  748. })
  749. },
  750. }
  751. }
  752. </script>
  753. <style scoped lang="scss">
  754. uni-page-body {
  755. overflow: hidden;
  756. }
  757. .warp {
  758. margin: 10rpx;
  759. padding: 20rpx 20rpx 140rpx 20rpx;
  760. .top {
  761. border-radius: 20rpx;
  762. background: white;
  763. padding: 20rpx;
  764. display: flex;
  765. margin-bottom: 20rpx;
  766. align-items: center;
  767. .top-left {
  768. margin-right: 20rpx;
  769. }
  770. }
  771. }
  772. .content,
  773. .content1,
  774. .content2 {
  775. border-radius: 20rpx;
  776. background: white;
  777. padding: 20rpx;
  778. .title {
  779. font-size: 28rpx;
  780. font-weight: 600;
  781. color: #333333;
  782. }
  783. .row {
  784. display: flex;
  785. justify-content: space-between;
  786. border-bottom: 1px solid #EEEEEE;
  787. padding: 21rpx 0;
  788. .right,
  789. input {
  790. font-size: 28rpx;
  791. color: #333333;
  792. }
  793. }
  794. .row-bottom {
  795. // border: 0;
  796. .right-bottom {
  797. width: 300rpx;
  798. text-align: right;
  799. }
  800. }
  801. }
  802. .content1 {
  803. margin-top: 20rpx;
  804. }
  805. .content2 {
  806. margin-top: 10px;
  807. // display: flex;
  808. align-items: center;
  809. .left {
  810. margin-right: 20px;
  811. }
  812. }
  813. .submit {
  814. width: 40%;
  815. background: #22C572;
  816. border-radius: 10rpx;
  817. }
  818. .edit-btn {
  819. background: #22C572;
  820. width: 100rpx;
  821. height: 50rpx;
  822. margin: 0;
  823. color: white;
  824. }
  825. .has-btn {
  826. align-items: center;
  827. }
  828. .bottom-btn {
  829. width: 92%;
  830. position: fixed;
  831. bottom: 40rpx;
  832. display: flex;
  833. z-index: 2;
  834. }
  835. </style>