warehousing.vue 34 KB

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