warehousing.vue 29 KB

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