improvedWrehousingDetail.vue 31 KB

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