warehousing.vue 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950
  1. <template>
  2. <view class="warp">
  3. <view class="top">
  4. <view class="top-left">{{warehouseName}}</view>
  5. <view>{{binNumber}}仓位</view>
  6. </view>
  7. <view class="content">
  8. <view class="row">
  9. <view class="left">合同编号</view>
  10. <view @click='slectcontractNo'>{{detailData.contractNo}}</view>
  11. </view>
  12. <view class="row">
  13. <view class="left">货名</view>
  14. <view class="right">{{detailData.goodsName}}</view>
  15. </view>
  16. <view class="row">
  17. <view class="left">类型</view>
  18. <view @click='show1=true'>{{detailData.type}}</view>
  19. <u-picker :range="typeList" range-key="type" @confirm='typePicker($event)' v-model="show1"
  20. mode="selector">
  21. </u-picker>
  22. </view>
  23. <view class="row row-bottom">
  24. <view class="left">毛重(吨)</view>
  25. <input type="number" @input='calculate' v-model='detailData.grossWeight' class="right-bottom"
  26. placeholder="输入毛重"></input>
  27. </view>
  28. <view class="row row-bottom">
  29. <view class="left">皮重(吨)</view>
  30. <input type="number" @input='calculate' v-model='detailData.tare' class="right-bottom" placeholder="输入皮重"></input>
  31. </view>
  32. <view class="row row-bottom">
  33. <view class="left">扣重(吨)</view>
  34. <input type="number" @input='calculate' v-model='detailData.deductionWeight' class="right-bottom"
  35. placeholder="输入扣重"></input>
  36. </view>
  37. <view class="row row-bottom">
  38. <view class="left">净重(吨)</view>
  39. <input type="number" @input='' v-model='netWeight' class="right-bottom" placeholder="不可编辑,自动计算"
  40. :disabled="true"></input>
  41. </view>
  42. <view class="row row-bottom">
  43. <view class="left">扣款(元/吨)</view>
  44. <input type="number" @input='' v-model='detailData.deductionAmount' class="right-bottom" placeholder="输入扣款"></input>
  45. </view>
  46. <view class="row row-bottom" v-if="detailData.type=='潮粮'">
  47. <view class="left">扣重比</view>
  48. <input type="number" @input='' v-model='detailData.buckleWeightRatio' class="right-bottom" placeholder="输入扣重比"
  49. @input="pureWeightCount"></input>
  50. </view>
  51. <view class="row row-bottom" v-if="detailData.type=='潮粮'">
  52. <view class="left">干粮水分(%)</view>
  53. <input type="number" @input='' v-model='detailData.solidGrainWater' class="right-bottom" placeholder="输入干粮水分占比"
  54. @input="pureWeightCount"></input>
  55. </view>
  56. <view class="row row-bottom" v-if="detailData.type=='潮粮'">
  57. <view class="left">潮粮水分(%)</view>
  58. <input type="number" @input='' v-model='detailData.tidalGrainWater' class="right-bottom" placeholder="输入潮粮水分占比"
  59. @input="pureWeightCount"></input>
  60. </view>
  61. <view class="row row-bottom" v-if="detailData.type=='潮粮'">
  62. <view class="left">纯重(吨)</view>
  63. <input type="number" @input='calculate' v-model='detailData.pureWeight' class="right-bottom" placeholder="不可编辑,自动计算"
  64. :disabled="true"></input>
  65. </view>
  66. <view class="row">
  67. <view class="left">品级</view>
  68. <view @click='show3=true'>{{detailData.grade}}</view>
  69. <u-picker :range="pjList" range-key="grade" @confirm='pjPicker($event)' v-model="show3" mode="selector">
  70. </u-picker>
  71. </view>
  72. <view class="row">
  73. <view class="left">经办人</view>
  74. <view @click='show6=true'>{{detailData.agent}}</view>
  75. <u-picker :range="handlerList" range-key="staffName" @confirm='handlerPicker($event)' v-model="show6"
  76. mode="selector">
  77. </u-picker>
  78. </view>
  79. <view class="row">
  80. <view class="left">入库日期</view>
  81. <view @click='show4=true'>{{detailData.inOutDate}}</view>
  82. <u-picker v-model="show4" mode="time" @confirm='dateChange($event)' :params="params">
  83. </u-picker>
  84. </view>
  85. <view class="row row-bottom">
  86. <view class="left">入库类型</view>
  87. <input v-model='detailData.inOutType' class="right-bottom" :disabled="isSelectType" @click="selectType" placeholder="自动获取"></input>
  88. <u-picker :range="warehousingTypeList" range-key="constValue" @confirm='warehousingTypePicker($event)'
  89. v-model="show5" mode="selector">
  90. </u-picker>
  91. </view>
  92. <view class="row">
  93. <view class="left">入库方式</view>
  94. <view @click='show8=true'>{{detailData.outType?detailData.outType:'汽运'}}</view>
  95. <u-picker v-model="show8" mode="selector" range-key="name" :range="multiSelector" @confirm='outtypeChange($event)'>
  96. </u-picker>
  97. </view>
  98. <view class="row row-bottom">
  99. <view class="left">车牌号</view>
  100. <input v-if="!isPC" @input='' v-model='detailData.carNo' class="right-bottom"
  101. placeholder="请输入车牌号"></input>
  102. <view @click='slectCarNo' v-if="isPC">{{detailData.carNo}}</view>
  103. </view>
  104. <view v-if='detailData.outType=="集装箱船"' class="row row-bottom">
  105. <view class="left">箱号</view>
  106. <!-- <view @click='show9=true'>{{usestart?usestart:'汽运'}}</view>
  107. <u-picker v-model="show9" mode="selector" range-key="name" :range="multiSelector1" @confirm='usestartChange($event)'>
  108. </u-picker> -->
  109. <input v-model='detailData.boxNo' @input="toUpperCase" class="right-bottom" placeholder="请输入箱号"></input>
  110. <input v-model='detailData.boxNoOther' @input="toUpperCase1" class="right-bottom" placeholder="请输入箱号"></input>
  111. </view>
  112. <view v-if='detailData.outType=="火运"' class="row row-bottom">
  113. <view class="left">车厢号</view>
  114. <input v-model='detailData.boxNo' @input="toUpperCase" class="right-bottom" placeholder="请输入车厢号"></input>
  115. <input v-model='detailData.boxNoOther' @input="toUpperCase1" class="right-bottom" placeholder="请输入车厢号"></input>
  116. </view>
  117. <view v-if='detailData.outType=="散船"' class="row row-bottom">
  118. <view class="left">仓位号</view>
  119. <input v-model='detailData.binNo' class="right-bottom" placeholder="请输入仓位号"></input>
  120. </view>
  121. <view class="row row-bottom has-btn">
  122. <view class="left">成本(元/吨)</view>
  123. <input type="number" v-model='detailData.cost' class="right-bottom"
  124. placeholder="自动获取" :disabled="isEditCB"></input>
  125. <!-- <input type="number" v-if="detailData.inOutType!='采购入库'" v-model='detailData.cost' class="right-bottom"
  126. placeholder="自动获取" :disabled="isEditCB"></input> -->
  127. <u-button class="edit-btn" hover-class="none" @click="editCB">编辑</u-button>
  128. </view>
  129. <view class="row row-bottom has-btn">
  130. <view class="left">运费(元/吨)</view>
  131. <input type="number" @input='' v-model='detailData.freight' :disabled="isEditYF" class="right-bottom"
  132. placeholder="自动获取"></input>
  133. <u-button class="edit-btn" hover-class="none" @click="editYF">编辑</u-button>
  134. </view>
  135. </view>
  136. <view class="content2">
  137. <view class="left">上传磅单</view>
  138. <upload class="upload" ref="upload" :action="action" :max-size="maxSize" :max-count="1"
  139. :size-type="['compressed']" @on-success="getImgUrl" @on-error="onError" @on-remove="onRemove"
  140. @on-uploaded="isAdd = true" :before-upload="filterFileType" @on-progress="onProgress"></upload>
  141. </view>
  142. <view class="content1">
  143. <view class="title">
  144. 质检数据(选填)
  145. </view>
  146. <view class="row row-bottom">
  147. <view class="left">质检员</view>
  148. <input @input='' v-model='detailData.warehouseInOutDetail.qualityInspector' class="right-bottom"
  149. placeholder="输入质检员姓名"></input>
  150. </view>
  151. <view class="row row-bottom">
  152. <view class="left">水分(%)</view>
  153. <input type="number" @input='' v-model='detailData.warehouseInOutDetail.waterContent' class="right-bottom"
  154. placeholder="输入水分占比"></input>
  155. </view>
  156. <view class="row row-bottom">
  157. <view class="left">容重(克/升)</view>
  158. <input type="number" v-model='detailData.warehouseInOutDetail.bulkDensity' class="right-bottom"
  159. placeholder="输入容重"></input>
  160. </view>
  161. <view class="row row-bottom">
  162. <view class="left">热损伤(%)</view>
  163. <input type="number" @input='' v-model='detailData.warehouseInOutDetail.jiaorenli' class="right-bottom"
  164. placeholder="输入热损伤占比"></input>
  165. </view>
  166. <view class="row row-bottom">
  167. <view class="left">杂质(%)</view>
  168. <input type="number" @input='' v-model='detailData.warehouseInOutDetail.impurity' class="right-bottom"
  169. placeholder="输入杂质占比"></input>
  170. </view>
  171. <view class="row row-bottom">
  172. <view class="left">霉变粒(%)</view>
  173. <input type="number" @input='' v-model='detailData.warehouseInOutDetail.mildewGrain' class="right-bottom"
  174. placeholder="输入霉变粒占比"></input>
  175. </view>
  176. <view class="row row-bottom">
  177. <view class="left">不完善粒(%)</view>
  178. <input @input='' v-model='detailData.warehouseInOutDetail.imperfectGrain' class="right-bottom"
  179. placeholder="输入不完善粒占比"></input>
  180. </view>
  181. </view>
  182. <u-toast ref="uToast" />
  183. <view class="bottom-btn">
  184. <u-button type="primary" class="submit" hover-class="none" @click="submit(1)">暂存</u-button>
  185. <u-button type="primary" class="submit" hover-class="none" @click="submit(2)">提交</u-button>
  186. </view>
  187. </view>
  188. </template>
  189. <script>
  190. import {
  191. mapState
  192. } from 'vuex';
  193. import upload from '@/components/upload.vue';
  194. import helper from '@/common/helper.js';
  195. export default {
  196. components: {
  197. upload
  198. },
  199. data() {
  200. return {
  201. show: false,
  202. show1: false,
  203. show2: false,
  204. show3: false,
  205. show4: false,
  206. show5: false,
  207. show6: false,
  208. isPC: true,
  209. isSelectType:true,
  210. params: {
  211. year: true,
  212. month: true,
  213. day: true,
  214. },
  215. isEditCB: true,
  216. isEditYF: true,
  217. warehouseName: '',
  218. binNumber: '',
  219. contractNoList: [],
  220. multiSelector:[
  221. {name:'汽运',value:'0'},
  222. {name:'火运',value:'1'},
  223. {name:'集装箱船',value:'2'},
  224. {name:'散船',value:'3'},
  225. ],
  226. typeList: [{
  227. type: "干粮"
  228. },
  229. {
  230. type: "潮粮"
  231. }
  232. ],
  233. pjList: [{
  234. grade: "一等品"
  235. },
  236. {
  237. grade: "二等品"
  238. },
  239. {
  240. grade: "三等品"
  241. },
  242. {
  243. grade: "等外"
  244. }
  245. ],
  246. show8:false,
  247. handlerList: [],
  248. warehousingTypeList: [{constValue:'移库入库'},{constValue:'退库'}],
  249. action: this.$uploadUrl,
  250. maxSize: 50 * 1024 * 1024, //限制文件大小 50M
  251. btnLoading: false, //防止重复点击
  252. isAdd: true,
  253. // netWeight: 0,
  254. inOutDate1: "",
  255. detailData: {
  256. contractNo: "请选择合同编号",
  257. carNo: '请输入车牌号',
  258. type: "干粮",
  259. goodsName: "",
  260. inOutDate: '请选择入库日期',
  261. grade: "一等品",
  262. agent: '请选择经办人',
  263. inOutType: '请选择入库类型',
  264. deductionWeight: '',
  265. grossWeight: '',
  266. tare: '',
  267. deductionAmount: '',
  268. netWeight: 0,
  269. cost:0,
  270. warehouseInOutDetail: {}
  271. }
  272. }
  273. },
  274. onLoad(options) {
  275. this.binNumber = helper.erpWarehouse.binNumber
  276. this.warehouseName = helper.erpWarehouse.warehouseName
  277. this.compId = helper.erpWarehouse.compId
  278. let _day = new Date();
  279. _day.setTime(_day.getTime());
  280. this.detailData.inOutDate = _day.getFullYear() + "-" + (_day.getMonth() + 1) + "-" + _day.getDate();
  281. },
  282. computed: {
  283. ...mapState(['hasLogin', 'userInfo']),
  284. },
  285. onShow() {
  286. console.log("当前合同",uni.getStorageSync('erpContractNo'))
  287. let _data = uni.getStorageSync('erpContractNo')==''?{}:uni.getStorageSync('erpContractNo')
  288. if(helper.erpWarehouse.personCharge)
  289. this.detailData.agent = helper.erpWarehouse.personCharge
  290. this.detailData.goodsName = _data.goodsName;
  291. this.detailData.contractNo = _data.contractNo;
  292. this.detailData.goodsNameKey = _data.goodsNameKey;
  293. this.detailData.inOutType = _data.inOutType;
  294. if (this.detailData.inOutType == '采购入库') {
  295. this.detailData.inOutTypeKey = 1
  296. } else if (this.detailData.inOutType == '移库入库') {
  297. this.detailData.inOutTypeKey = 3
  298. } else if (this.detailData.inOutType == '暂存入库') {
  299. this.detailData.inOutTypeKey = 4
  300. } else if (this.detailData.inOutType == '贸易服务入库') {
  301. this.detailData.inOutTypeKey = 5
  302. } else if (this.detailData.inOutType == '退库') {
  303. this.detailData.inOutTypeKey = 6
  304. }
  305. if(_data.unitContractPrice) {
  306. this.detailData.cost = _data.unitContractPrice
  307. }
  308. if (_data.inOutType == '采购入库') {
  309. this.detailData.freight = 0
  310. }else if(_data.inOutType == '移库入库'){
  311. this.isSelectType = false
  312. }
  313. else{
  314. this.detailData.freight = uni.getStorageSync('CarFreight')
  315. this.isSelectType = true
  316. }
  317. if (!_data.tranCarInfoList){
  318. this.isPC = false
  319. // this.detailData.carNo = ""
  320. // this.detailData.cost = ""
  321. // _data.tranCarInfoList = []
  322. } else{
  323. this.isPC = true
  324. uni.setStorageSync('erpContractNoCarList', _data.tranCarInfoList);
  325. this.detailData.freight=uni.getStorageSync('erpcarNo').tranPrice
  326. if(uni.getStorageSync('ContractNoCar')){
  327. this.detailData.carNo = uni.getStorageSync('ContractNoCar')
  328. this.$api.doRequest('get', '/warehouseBaseInfo/selectCost', {
  329. contractNo: this.detailData.contractNo,
  330. carNo:this.detailData.carNo
  331. }).then(res => {
  332. if (res.data.code == 200) {
  333. this.detailData.cost = res.data.data
  334. }
  335. })
  336. }else{
  337. this.detailData.carNo = _data.tranCarInfoList[0].carNo
  338. }
  339. }
  340. if(this.detailData.carNo){
  341. for(let i = 0 ; i < uni.getStorageSync('erpContractNo').tranCarInfoList.length ;i++){
  342. if(uni.getStorageSync('erpContractNo').tranCarInfoList[i].carNo == this.detailData.carNo)
  343. this.detailData.tranCarNo = uni.getStorageSync('erpContractNo').tranCarInfoList[i].tranCarNo
  344. }
  345. }
  346. if (!this.detailData.contractNo) {
  347. this.detailData.contractNo = '请选择合同编号'
  348. }
  349. // else {
  350. // if (_data.tranCarInfoList.length == 0) {
  351. // this.isPC = false
  352. // }
  353. // }
  354. if (!this.detailData.goodsName) {
  355. this.detailData.goodsName = '货名'
  356. }
  357. // 获取入库类型
  358. // this.getrkType()
  359. //获取经办人
  360. this.getPerson()
  361. },
  362. watch: {
  363. netWeight: function(v) {
  364. this.pureWeightCount()
  365. },
  366. },
  367. methods: {
  368. toUpperCase(val){
  369. this.detailData.boxNo = val.detail.value.toUpperCase()
  370. },
  371. toUpperCase1(val){
  372. this.detailData.boxNoOther = val.detail.value.toUpperCase()
  373. },
  374. usestartChange(e){
  375. this.usestart=this.multiSelector1[e].name
  376. },
  377. outtypeChange(e){
  378. this.detailData.outType=this.multiSelector[e].name
  379. console.log(e)
  380. },
  381. selectType(){
  382. if(this.isSelectType) return
  383. this.show5 = true
  384. },
  385. //计算纯重
  386. pureWeightCount() {
  387. if (this.netWeight && this.detailData.buckleWeightRatio && this.detailData.solidGrainWater && this
  388. .detailData.tidalGrainWater) {
  389. // 纯重=净重x[100-(潮粮水分-干粮水分)x扣重比]/100
  390. this.detailData.pureWeight = 100 - (this.detailData.tidalGrainWater - this.detailData
  391. .solidGrainWater) * this.netWeight * this.detailData.buckleWeightRatio / 100
  392. this.detailData.pureWeight = this.detailData.pureWeight.toFixed(3)
  393. }
  394. },
  395. getPerson() {
  396. this.$api.doRequest('get', '/staff/query/getStaffListByCompId', {
  397. compId: this.compId
  398. }).then(res => {
  399. this.handlerList = res.data.data
  400. })
  401. },
  402. getrkType() {
  403. this.$api.doRequest('get', '/commonSysParameter/getInfo', {
  404. constId: 'CON5'
  405. }).then(res => {
  406. this.warehousingTypeList = res.data.data
  407. })
  408. },
  409. contractNopicker(e) {},
  410. typePicker(e) {
  411. console.log(e)
  412. this.detailData.type = this.typeList[e].type
  413. },
  414. pjPicker(e) {
  415. this.detailData.gradeKey = e[0]+1
  416. this.detailData.grade = this.pjList[e].grade
  417. },
  418. handlerPicker(e) {
  419. console.log(e)
  420. this.detailData.agent = this.handlerList[e].staffName
  421. },
  422. dateChange(e) {
  423. console.log(e)
  424. this.detailData.inOutDate = e.year + "-" + e.month + "-" + e.day
  425. this.inOutDate1 = 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).toFixed(2)
  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 && num == 2) {
  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 && num == 2) {
  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 && num == 2) {
  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 (Number(this.detailData.tare) > Number(this.detailData.grossWeight)) {
  567. this.$api.msg('皮重不能大于毛重')
  568. return
  569. }
  570. if (this.netWeight <= 0 && num == 2) {
  571. this.$api.msg('净重不能小于等于0')
  572. return
  573. }
  574. if (this.detailData.type == "潮粮") {
  575. if (!this.detailData.buckleWeightRatio && num == 2) {
  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 > 3
  586. ) {
  587. this.$api.msg('扣重比输入错误!')
  588. return
  589. }
  590. if (!this.detailData.solidGrainWater && num == 2) {
  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 && num == 2) {
  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 < 0 ||
  615. this.detailData.deductionAmount > 10000
  616. ) {
  617. this.$api.msg('扣款输入错误!')
  618. return
  619. }
  620. if (!this.detailData.deductionAmount && num == 2) {
  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 && num == 2) {
  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 && num == 2) {
  669. this.$api.msg('请上传磅单')
  670. return
  671. }
  672. if (!this.detailData.cost && num == 2) {
  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 && num == 2) {
  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 300rpx 20rpx;
  848. .top {
  849. border-radius: 20rpx;
  850. background: white;
  851. padding: 20rpx;
  852. display: flex;
  853. margin-bottom: 20rpx;
  854. align-items: center;
  855. .top-left {
  856. margin-right: 20rpx;
  857. }
  858. }
  859. }
  860. .content,
  861. .content1,
  862. .content2 {
  863. border-radius: 20rpx;
  864. background: white;
  865. padding: 20rpx;
  866. .title {
  867. font-size: 28rpx;
  868. font-weight: 600;
  869. color: #333333;
  870. }
  871. .row {
  872. display: flex;
  873. justify-content: space-between;
  874. border-bottom: 1px solid #EEEEEE;
  875. padding: 21rpx 0;
  876. .right,
  877. input {
  878. font-size: 28rpx;
  879. color: #333333;
  880. }
  881. }
  882. .row-bottom {
  883. // border: 0;
  884. .right-bottom {
  885. width: 280rpx;
  886. text-align: right;
  887. }
  888. }
  889. }
  890. .content1 {
  891. margin-top: 20rpx;
  892. }
  893. .content2 {
  894. margin-top: 10px;
  895. // display: flex;
  896. align-items: center;
  897. .left {
  898. margin-right: 20px;
  899. }
  900. }
  901. .submit {
  902. width: 40%;
  903. background: #22C572;
  904. border-radius: 10rpx;
  905. }
  906. .edit-btn {
  907. background: #22C572;
  908. width: 100rpx;
  909. height: 50rpx;
  910. margin: 0;
  911. color: white;
  912. }
  913. .has-btn {
  914. align-items: center;
  915. }
  916. .bottom-btn {
  917. padding: 30rpx;
  918. background: #FFFFFF;
  919. width: 92%;
  920. position: fixed;
  921. bottom: 0rpx;
  922. display: flex;
  923. z-index: 9999;
  924. }
  925. </style>