improvedWrehousingDetail.vue 35 KB

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