improvedWrehousingDetail.vue 28 KB

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