improvedWrehousingDetail.vue 30 KB

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