improvedWrehousingDetail.vue 34 KB

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