warehousing.vue 26 KB

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