warehousing.vue 30 KB

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