warehouseManagementTare.vue 64 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772
  1. // 出库登记
  2. <template>
  3. <div class="container">
  4. <el-row>
  5. <el-col :span="20">
  6. <h2 class="bg-left title">{{information}}</h2>
  7. </el-col>
  8. <el-col :span="4" class="bg-right">
  9. <el-button class="bg-bottom" type="primary" size="small" @click="revert()"><img width="6" height="10"
  10. style="vertical-align: bottom; margin-right: 3px" src="../../../public/img/lujing.png" alt="" />返回
  11. </el-button>
  12. </el-col>
  13. </el-row>
  14. <ws-form ref="deptBudgetList" :model="deptBudgetList" :rules="rules">
  15. <div class="basicInformation">
  16. <h2>
  17. {{ deptBudgetList.warehouseName }}
  18. <span class="position" v-show="this.deptBudgetList.warehouseType == 1">
  19. {{ deptBudgetList.binNumber }}仓位
  20. </span>
  21. <span v-show="this.deptBudgetList.warehouseType == 2">(临)</span>
  22. </h2>
  23. <div class="small-title">基本信息</div>
  24. <ws-info-table>
  25. <!--任务编号-->
  26. <ws-form-item label="任务编号" span="1" prop="inOutTaskNo">
  27. <el-select filterable clearable v-model="deptBudgetList.inOutTaskNo" placeholder="请选择任务编号"
  28. class="typeselect" @change="contractNoChange">
  29. <el-option v-for="item in deptBudgetList1" :key="item.inOutTaskNo" :label="item.inOutTaskNo"
  30. :value="item.inOutTaskNo" />
  31. </el-select>
  32. </ws-form-item>
  33. <ws-form-item label="合同编号" span="1" prop="contractNo">
  34. <ws-select disabled v-model="deptBudgetList.contractNo" class="typeselect"
  35. @change='contractNoChange1'>
  36. <ws-option v-for="item in outContractNo" :key="item.constKey" :label="item.contractNo"
  37. :value="item.contractNo" />
  38. </ws-select>
  39. </ws-form-item>
  40. <ws-form-item label="提示" span="1" prop="tips">
  41. <ws-input onmouseover="this.title=this.value" v-model="deptBudgetList.tips"
  42. maxlength="20" size="small" />
  43. </ws-form-item>
  44. <!-- 货名 -->
  45. <ws-form-item label="货名" span="1">
  46. <ws-select disabled v-model="deptBudgetList.goodsName" placeholder class="typeselect"
  47. @change="selectgoodsName">
  48. <ws-option v-for="item in goodnameList" :key="item.constKey" :label="item.constValue"
  49. :value="item.constValue" />
  50. </ws-select>
  51. </ws-form-item>
  52. <ws-form-item label="类型" span="1" prop="type">
  53. <ws-select disabled v-model="deptBudgetList.type" @change="typeChange">
  54. <ws-option v-for="item in typeList" :key="item" :label="item" :value="item" />
  55. </ws-select>
  56. </ws-form-item>
  57. <!--毛重(公斤)-->
  58. <ws-form-item label="毛重(公斤)" span="1" prop="grossWeight">
  59. <ws-input :disabled="allowEdit" @input="grossWeightchange" v-model="deptBudgetList.grossWeight"
  60. type="number" @mousewheel.native.prevent placeholder="请输入毛重" maxlength="20" size="small" />
  61. <el-button type="primary" v-if="information == '毛重检斤'" @click="openPort">重新获取</el-button>
  62. </ws-form-item>
  63. <!--皮重(公斤)-->
  64. <ws-form-item label="皮重(公斤)" span="1" prop="tare" class="readonly">
  65. <ws-input :disabled="allowEdit" @input="tarechange" v-model="deptBudgetList.tare" type="number"
  66. @mousewheel.native.prevent placeholder="请输入皮重" maxlength="100" size="small" />
  67. <el-button type="primary" v-if="information == '皮重检斤'" @click="openPort">重新获取</el-button>
  68. </ws-form-item>
  69. <!--净重(公斤)-->
  70. <ws-form-item label="净重(公斤)" span="1" prop="netWeight">
  71. <ws-input disabled v-model="deptBudgetList.netWeight" placeholder="不可编辑,自动计算" maxlength="120"
  72. size="small" />
  73. </ws-form-item>
  74. <ws-form-item v-if='deptBudgetList.type=="潮粮"' label="扣重比" span="1" prop="buckleWeightRatio" class="readonly">
  75. <ws-input @input='pureweight' v-model="deptBudgetList.buckleWeightRatio" type="number"
  76. @mousewheel.native.prevent placeholder="请输入扣重比" maxlength="100" size="small" />
  77. </ws-form-item>
  78. <ws-form-item v-if='deptBudgetList.type=="潮粮"' label="干粮水分占比" span="1" prop="solidGrainWater"
  79. class="readonly">
  80. <ws-input @input='pureweight' v-model="deptBudgetList.solidGrainWater" type="number"
  81. @mousewheel.native.prevent placeholder="请输入干粮水分占比" maxlength="100" size="small" />
  82. </ws-form-item>
  83. <ws-form-item v-if='deptBudgetList.type=="潮粮"' label="潮粮水分占比" span="1" prop="tidalGrainWater"
  84. class="readonly">
  85. <ws-input @input='pureweight' v-model="deptBudgetList.tidalGrainWater" type="number"
  86. @mousewheel.native.prevent placeholder="请输入潮粮水分占比" maxlength="100" size="small" />
  87. </ws-form-item>
  88. <ws-form-item v-if='deptBudgetList.type=="潮粮"' label="纯重" span="1" prop="pureWeight" class="readonly">
  89. <ws-input disabled v-model="deptBudgetList.pureWeight" type="number" @mousewheel.native.prevent
  90. placeholder="不可编辑,自动计算" maxlength="100" size="small" />
  91. </ws-form-item>
  92. <!-- 品级 -->
  93. <ws-form-item label="品级" span="1" class="readonly">
  94. <ws-select v-model="deptBudgetList.grade" placeholder="" class="typeselect" @change="selectpackingMethod">
  95. <ws-option v-for="item in gradeList" :key="item.constKey" :label="item.constValue"
  96. :value="item.constValue" />
  97. </ws-select>
  98. </ws-form-item>
  99. <!--经办人-->
  100. <ws-form-item label="经办人" span="1" prop="agent">
  101. <el-select v-model="deptBudgetList.agent" placeholder="请选择经办人" filterable clearable @change="selectstaff">
  102. <el-option v-for="item in options" :key="item.value" :label="item.staffName" :value="item.staffName" />
  103. </el-select>
  104. </ws-form-item>
  105. <!--出库日期-->
  106. <ws-form-item label="出库日期" span="1" prop="inOutDate" class="deliverydate">
  107. <ws-date-picker v-model="deptBudgetList.inOutDate" type="date" placeholder="请选择出库日期"
  108. value-format="yyyy-MM-dd" />
  109. </ws-form-item>
  110. <!-- 出库类型 -->
  111. <ws-form-item label="出库类型" span="1">
  112. <ws-input v-model='deptBudgetList.inOutType' class="right-bottom" :disabled="isSelectType"
  113. placeholder='暂无' />
  114. <!-- <ws-select
  115. v-model="deptBudgetList.deliveryType"
  116. placeholder=""
  117. class="typeselect"
  118. @change="selectstorageType"
  119. >
  120. <ws-option
  121. v-for="item in deliveryType"
  122. :key="item.constKey"
  123. :label="item.constValue"
  124. :value="item.constValue"
  125. />
  126. </ws-select> -->
  127. </ws-form-item>
  128. <!--出库方式-->
  129. <ws-form-item label="出库方式" span="1" prop="outType">
  130. <el-select v-model="deptBudgetList.outType" placeholder="请选择出库方式">
  131. <el-option v-for="item in multiSelector" :key="item.value" :label="item.name" :value="item.name" />
  132. </el-select>
  133. </ws-form-item>
  134. <!--车牌号-->
  135. <ws-form-item label="车牌号" span="1" prop="carNo" v-if="deptBudgetList.outType == '汽运' || deptBudgetList.outType == '集装箱船'">
  136. <ws-input v-if="!carstatus" v-model="deptBudgetList.carNo" placeholder="请输入车牌号" maxlength="7"
  137. size="small" />
  138. <el-select v-if="carstatus" filterable clearable :filter-method="dataFilter2" v-model="deptBudgetList.carNo"
  139. placeholder="请选择车牌号" class="typeselect" @change="carChange">
  140. <el-option v-for="item in options2" :key="item.constKey" :label="item.carNo + '(' + item.tranCarNo + ')'"
  141. :value="item.carNo" />
  142. </el-select>
  143. </ws-form-item>
  144. <!--车号 -->
  145. <ws-form-item label="车号" span="1" prop="carNo" v-if="deptBudgetList.outType == '火运'">
  146. <ws-input v-model="deptBudgetList.carNo" placeholder="请输入车号" size="small"/>
  147. </ws-form-item>
  148. <ws-form-item label="箱号-1" span="1" prop="boxNo" v-if="deptBudgetList.outType == '汽运' || deptBudgetList.outType == '集装箱船'">
  149. <ws-input v-model="deptBudgetList.boxNo" placeholder="请输入箱号" maxlength="20"
  150. size="small" />
  151. </ws-form-item>
  152. <ws-form-item label="箱号-2" span="1" prop="boxNoOther" v-if="deptBudgetList.outType == '汽运' || deptBudgetList.outType == '集装箱船'">
  153. <ws-input v-model="deptBudgetList.boxNoOther" placeholder="请输入箱号" maxlength="20"
  154. size="small" />
  155. </ws-form-item>
  156. <ws-form-item label="封号-1" span="1" prop="titleNo" v-if="deptBudgetList.outType == '汽运' || deptBudgetList.outType == '集装箱船'">
  157. <ws-input v-model="deptBudgetList.titleNo" placeholder="请输入封号" maxlength="20"
  158. size="small" />
  159. </ws-form-item>
  160. <ws-form-item label="封号-2" span="1" prop="titleNoOther" v-if="deptBudgetList.outType == '汽运' || deptBudgetList.outType == '集装箱船'">
  161. <ws-input v-model="deptBudgetList.titleNoOther" placeholder="请输入封号" maxlength="20"
  162. size="small" />
  163. </ws-form-item>
  164. <ws-form-item label="车厢号-1" span="1" prop="wingNumber" v-if="deptBudgetList.outType == '火运'" >
  165. <ws-input v-model="deptBudgetList.wingNumber" placeholder="请输入车厢号" maxlength="20"
  166. size="small" />
  167. </ws-form-item>
  168. <ws-form-item label="车厢号-2" span="1" prop="wingNumberOther" v-if="deptBudgetList.outType == '火运'">
  169. <ws-input v-model="deptBudgetList.wingNumberOther" placeholder="请输入车厢号" maxlength="20"
  170. size="small" />
  171. </ws-form-item>
  172. <ws-form-item label="船名" span="1" prop="shipName" v-if="deptBudgetList.outType == '散船'">
  173. <ws-input v-model="deptBudgetList.shipName" placeholder="请输入船名" maxlength="20"
  174. size="small" />
  175. </ws-form-item>
  176. <ws-form-item label="航次" span="1" prop="shipNumber" v-if="deptBudgetList.outType == '散船'">
  177. <ws-input v-model="deptBudgetList.shipNumber" placeholder="请输入航次" maxlength="20"
  178. size="small" />
  179. </ws-form-item>
  180. </ws-info-table>
  181. </div>
  182. <!-- <div class="small-title">上传磅单照片</div>
  183. <el-upload
  184. action="https://www.zthymaoyi.com/upload/admin"
  185. :show-file-list="false"
  186. :on-success="
  187. (res) => {
  188. uploadSuccessHandle1(res)
  189. }
  190. "
  191. class="avatar-uploader"
  192. accept=".jpg, .jpeg, .png, .gif"
  193. ><el-button size="small" type="primary">点击上传</el-button>
  194. </el-upload>
  195. <div v-if='deptBudgetList.addressUrl!=""'>
  196. <img style='width:100px;height:100px;' :src="deptBudgetList.addressUrl" alt="">
  197. </div> -->
  198. <div class="small-title">化验数据(选填)</div>
  199. <div class="inspector">
  200. <!--自检员-->
  201. <!-- <ws-form-item label="质检员" span="1" prop="qualityInspector">
  202. <ws-input
  203. v-model="deptBudgetList.warehouseInOutDetail.qualityInspector"
  204. placeholder="请输入质检员姓名"
  205. maxlength="120"
  206. size="small"
  207. />
  208. </ws-form-item> -->
  209. <ws-form-item label="质检员" span="1" prop="qualityInspector">
  210. <el-select v-model="deptBudgetList.warehouseInOutDetail.qualityInspector" placeholder="请选择质检员" filterable
  211. clearable @change="qualityInspectorChange">
  212. <el-option v-for="item in qualityInspectorList" :key="item.value" :label="item.staffName"
  213. :value="item.staffName" />
  214. </el-select>
  215. </ws-form-item>
  216. </div>
  217. <div class="neifor">
  218. <ws-info-table>
  219. <!--水分(%)<=-->
  220. <ws-form-item label="水分(%)" span="1" prop="waterContent">
  221. <ws-input v-model="deptBudgetList.warehouseInOutDetail.waterContent" placeholder="请输入水分占比" maxlength="120"
  222. type="number" @mousewheel.native.prevent size="small" />
  223. </ws-form-item>
  224. <!--杂质(%)<=-->
  225. <ws-form-item label="杂质(%)" span="1" prop="impurity">
  226. <ws-input v-model="deptBudgetList.warehouseInOutDetail.impurity" placeholder="请输入杂质占比" type="number"
  227. @mousewheel.native.prevent maxlength="120" size="small" />
  228. </ws-form-item>
  229. <!--容重(克/升)>=-->
  230. <ws-form-item label="容重(克/升)" span="1" prop="bulkDensity">
  231. <ws-input v-model="deptBudgetList.warehouseInOutDetail.bulkDensity" placeholder="请输入容重" type="number"
  232. @mousewheel.native.prevent maxlength="120" size="small" />
  233. </ws-form-item>
  234. <!--霉变粒(%)<=-->
  235. <ws-form-item label="霉变粒(%)" span="1" prop="mildewGrain">
  236. <ws-input v-model="deptBudgetList.warehouseInOutDetail.mildewGrain" placeholder="请输入霉变粒占比" maxlength="120"
  237. type="number" @mousewheel.native.prevent size="small" />
  238. </ws-form-item>
  239. <!--热损伤(%)<=-->
  240. <ws-form-item label="热损伤(%)" span="1" prop="jiaorenli">
  241. <ws-input v-model="deptBudgetList.warehouseInOutDetail.jiaorenli" placeholder="请输入热损伤占比" type="number"
  242. @mousewheel.native.prevent maxlength="120" size="small" />
  243. </ws-form-item>
  244. <!--不完善粒(%)<=-->
  245. <ws-form-item label="不完善粒(%)" span="1" prop="imperfectGrain">
  246. <ws-input v-model="deptBudgetList.warehouseInOutDetail.imperfectGrain" placeholder="请输入不完善粒占比" type="number"
  247. @mousewheel.native.prevent maxlength="120" size="small" />
  248. </ws-form-item>
  249. </ws-info-table>
  250. </div>
  251. <div style="text-align: right; padding: 10px">
  252. <el-button v-if="information == '皮重检斤'" class="bg-bottom-up" size="small" @click="temporaryStorage()">保存
  253. </el-button>
  254. <el-button v-if="!allowEdit" class="bg-bottom-up" type="primary" size="small" @click="submit()">提交</el-button>
  255. </div>
  256. </ws-form>
  257. </div>
  258. </template>
  259. <script>
  260. import {
  261. pullDown,
  262. addstorageputList,
  263. goodsname,
  264. xialaNo,
  265. getstaff,
  266. goodsnameXiala,
  267. getReceiptTaskNo
  268. } from '@/model/warehouse/index'
  269. import Pagination from '@/components/Pagination'
  270. import WsUpload from '@/components/WsUpload'
  271. // import { dayjs, fmoney, EventBus } from 'base-core-lib'
  272. import {
  273. dayjs,
  274. EventBus
  275. } from 'base-core-lib'
  276. export default {
  277. name: 'viewSpareMoney',
  278. components: {
  279. WsUpload,
  280. Pagination,
  281. },
  282. watch: {
  283. isShow(val) {
  284. this.showType = val
  285. },
  286. },
  287. data() {
  288. return {
  289. deptBudgetList1: [],
  290. isSelectType: true,
  291. carstatus: false,
  292. qualityInspectorList: [],
  293. //弹出框
  294. dialogViewSpareMoney: false,
  295. dialogApproveFormVisible: false,
  296. // 船舶类型
  297. monetaryKey: null,
  298. // 表格显示数据
  299. tableDate: [],
  300. // 是否显示
  301. showType: true,
  302. readonly: true,
  303. // 年
  304. year: '',
  305. deptBudgetTotal: 0,
  306. currentPage: 1,
  307. pageSize: 10,
  308. searchType: 1,
  309. searchKeyWord: '',
  310. contractType: 2,
  311. startDate: null,
  312. endDate: null,
  313. goodnameList: {},
  314. // 提交类型
  315. submitType: true,
  316. deliveryType: [],
  317. typeList: ['干粮', '潮粮'],
  318. outContractNo: [],
  319. appendixIdsAdd: '',
  320. uploadSuccess: {},
  321. gradeList: [],
  322. agent: [],
  323. staffList: [],
  324. options: [],
  325. value: '',
  326. rules: {
  327. netWeight: [{
  328. required: true,
  329. type: 'number',
  330. message: '请输入活动名称',
  331. trigger: 'blur',
  332. }, ],
  333. },
  334. size: 10,
  335. compId: localStorage.getItem('ws-pf_compId'),
  336. skinInspector: localStorage.getItem('ws-pf_staffName'),
  337. deptCircularPage: {},
  338. packtypeList: {},
  339. date: {
  340. year: dayjs().format('YYYY'),
  341. month: dayjs().format('MM'),
  342. },
  343. contractList: [],
  344. deptBudgetList: {
  345. type: '干粮',
  346. addressUrl: '',
  347. warehouseInOutDetail: {},
  348. grossWeight: '',
  349. tare: ''
  350. },
  351. historyList: [],
  352. pickerBeginDateBefore: {
  353. disabledDate: (time) => {
  354. return time.getTime() > Date.now()
  355. },
  356. },
  357. accessoryTFs: false,
  358. allowEdit: true,
  359. param: 9600,
  360. information: '',
  361. result1: '00',
  362. multiSelector: [{
  363. name: '汽运',
  364. value: '0'
  365. },
  366. {
  367. name: '火运',
  368. value: '1'
  369. },
  370. {
  371. name: '集装箱船',
  372. value: '2'
  373. },
  374. {
  375. name: '散船',
  376. value: '3'
  377. },
  378. ],
  379. }
  380. },
  381. mounted() {
  382. this.information = this.$route.query.information
  383. if (this.$route.query.allowEdit == 1) {
  384. this.allowEdit = false
  385. } else {
  386. this.allowEdit = true
  387. }
  388. this.deptBudgetList.baseId = this.$route.query.baseId
  389. this.deptBudgetList.positionId = this.$route.query.positionId
  390. this.deptBudgetList.warehouseName = this.$route.query.warehouseName
  391. this.deptBudgetList.binNumber = this.$route.query.binNumber
  392. this.deptBudgetList.warehouseType = this.$route.query.warehouseType
  393. this.deptBudgetList.warehouseId = this.$route.query.warehouseId
  394. this.getList()
  395. getReceiptTaskNo({flag:1,warehouseName:this.deptBudgetList.warehouseName,agentKey: localStorage.getItem('ws-pf_userId')}).toPromise()
  396. .then((response) => {
  397. console.log(response)
  398. this.deptBudgetList1 = response
  399. })
  400. },
  401. methods: {
  402. async closePort() {
  403. console.log('closePort');
  404. this.reader.cancel()
  405. },
  406. async openPort() {
  407. console.log('openPort', navigator);
  408. if ('serial' in navigator) {
  409. // The Web Serial API is supported.
  410. console.log('the Web Serial API is supported.');
  411. console.log(this.param);
  412. const port = await navigator.serial.requestPort();
  413. await port.open({
  414. baudRate: this.param
  415. }); // set baud rate
  416. this.reader = port.readable.getReader();
  417. // 监听来自串行设备的数据
  418. while (true) {
  419. const {
  420. value,
  421. done
  422. } = await this.reader.read();
  423. // console.log("value",value);
  424. if (done) {
  425. // 允许稍后关闭串口。
  426. this.reader.releaseLock();
  427. break;
  428. }
  429. var result = '';
  430. //2。获取16进制字符串
  431. // var receData = HexConvert.ByteToString(value);
  432. // console.log("receData",receData);
  433. var flag = false;
  434. var flag1 = false;
  435. // for (var i = 0; i < value.length; i++) {
  436. // var tmp = String.fromCharCode(value[i])
  437. // if (tmp == '+') {
  438. // flag = true
  439. // }
  440. // if (flag && result.length < 6 && tmp != '+') {
  441. // result += tmp
  442. // }
  443. // }
  444. // if (this.information != '毛重检斤') {
  445. // if(parseInt(result)){
  446. // this.deptBudgetList.grossWeight = parseInt(result)
  447. // }
  448. // } else {
  449. // if(parseInt(result)){
  450. // this.deptBudgetList.tare = parseInt(result)
  451. // }
  452. // }
  453. if (this.deptBudgetList.warehouseName && (this.deptBudgetList.warehouseName == '山东诸城迈饶库' || this
  454. .deptBudgetList.warehouseName == '克东千红库' || this.deptBudgetList.warehouseName == '鲅鱼圈祥腾库')) {
  455. for (var i = 0; i < value.length; i++) {
  456. var tmp = String.fromCharCode(value[i])
  457. if (tmp == '+') {
  458. flag = true
  459. }
  460. if (flag && result.length < 6 && tmp != '+') {
  461. result += tmp
  462. }
  463. }
  464. if (this.information == '毛重检斤') {
  465. if (parseInt(result) || parseInt(result) == 0) {
  466. this.deptBudgetList.grossWeight = parseInt(result)
  467. }
  468. } else {
  469. if (parseInt(result) || parseInt(result) == 0) {
  470. this.deptBudgetList.tare = parseInt(result)
  471. }
  472. }
  473. }
  474. else if (this.deptBudgetList.warehouseName && (this.deptBudgetList.warehouseName == '顺诚粮库'||this.deptBudgetList.warehouseName == '鲅鱼圈金信库')) {
  475. for (var i = value.length - 1; i >= 0; i--) {
  476. var tmp = String.fromCharCode(value[i])
  477. console.log(tmp)
  478. if (String.fromCharCode(value[0]) == '.') {
  479. flag = true
  480. }
  481. if (flag && result.length < 9 && tmp != '='&& tmp != '.') {
  482. result += tmp
  483. }
  484. }
  485. if (this.information == '毛重检斤') {
  486. if (parseInt(result) || parseInt(result) == 0) {
  487. this.deptBudgetList.grossWeight = parseInt(result)
  488. }
  489. } else {
  490. if (parseInt(result) || parseInt(result) == 0) {
  491. this.deptBudgetList.tare = parseInt(result)
  492. }
  493. }
  494. }
  495. else {
  496. for (var i = 0; i < value.length; i++) {
  497. var tmp = String.fromCharCode(value[i])
  498. if ((value[0] != 49 && value[0] != 2)) {
  499. if ((value[value.length - 1] == 48 && value[value.length - 2] == 48)) {
  500. flag1 = true
  501. } else {
  502. break
  503. }
  504. }
  505. if (tmp == String.fromCharCode(32)) {
  506. flag = true
  507. }
  508. if (flag && result.length < 7 && tmp != String.fromCharCode(32) && !(value[value.length - 1] == 48 &&
  509. value[value.length - 2] == 48)) {
  510. result += tmp
  511. }
  512. if (flag1 && tmp != String.fromCharCode(32)) {
  513. if ((value[value.length - 1] == 48 && value[value.length - 2] == 48)) {
  514. if (i == 0) {
  515. this.result1 = tmp + '0'
  516. }
  517. }
  518. }
  519. }
  520. if (this.information == '毛重检斤') {
  521. if (parseInt(result) || parseInt(result) == 0) {
  522. this.deptBudgetList.grossWeight = parseInt(result + this.result1)
  523. }
  524. } else {
  525. if (parseInt(result) || parseInt(result) == 0) {
  526. this.deptBudgetList.tare = parseInt(result + this.result1)
  527. }
  528. }
  529. }
  530. // setTimeout(1000)
  531. // value 是一个 Uint8Array
  532. }
  533. await port.close();
  534. } else {
  535. console.log('the Web Serial API is not supported.', navigator);
  536. }
  537. },
  538. qualityInspectorChange(e) {
  539. console.log(e)
  540. },
  541. uploadSuccessHandle1(res) {
  542. this.deptBudgetList.addressUrl = res.url
  543. },
  544. //返回按钮
  545. revert() {
  546. this.$router.push({
  547. path: 'warehouseManagementList'
  548. })
  549. },
  550. carChange(e) {
  551. for (let i = 0; i < this.tranCarInfoList.length; i++) {
  552. if (this.tranCarInfoList[i].carNo == this.deptBudgetList.carNo) {
  553. this.deptBudgetList.tranCarNo = this.tranCarInfoList[i].tranCarNo
  554. this.deptBudgetList.carId = this.tranCarInfoList[i].id
  555. }
  556. }
  557. },
  558. typeChange(e) {
  559. },
  560. contractNoChange(e) {
  561. for (let i = 0; i < this.deptBudgetList1.length; i++) {
  562. if (this.deptBudgetList1[i].inOutTaskNo == e) {
  563. var data=this.deptBudgetList1[i]
  564. if(this.deptBudgetList1[i].contractNo){
  565. this.deptBudgetList.contractNo = this.deptBudgetList1[i].contractNo
  566. }
  567. else{
  568. this.deptBudgetList.contractNo = this.deptBudgetList1[i].moveTaskNo
  569. }
  570. }
  571. }
  572. for (var i = 0; i < this.outContractNo.length; i++) {
  573. if (this.outContractNo[i].contractNo == this.deptBudgetList.contractNo) {
  574. this.deptBudgetList.goodsName = this.outContractNo[i].goodsName
  575. this.deptBudgetList.goodsNameKey = this.outContractNo[i].goodsNameKey
  576. this.deptBudgetList.grade = this.outContractNo[i].grade
  577. this.deptBudgetList.inOutType = this.outContractNo[i].inOutType
  578. if (this.outContractNo[i].inOutType == '销售出库') {
  579. this.deptBudgetList.tips='买方'+this.outContractNo[i].buyer+ '( '+this.outContractNo[i].unitContractPrice+'元/吨)'
  580. this.deptBudgetList.inOutTypeKey = 1
  581. } else if (this.outContractNo[i].inOutType == '移库出库') {
  582. this.deptBudgetList.goodsName = data.goodsName
  583. this.deptBudgetList.goodsNameKey = data.goodsNameKey
  584. this.deptBudgetList.grade = data.grade
  585. if(this.outContractNo[i].unitContractPrice){
  586. this.deptBudgetList.tips='入货库'+data.receiveWarehouse+ '( '+this.outContractNo[i].unitContractPrice+'元/吨)'
  587. }
  588. else{
  589. this.deptBudgetList.tips='入货库'+data.receiveWarehouse
  590. }
  591. this.deptBudgetList.inOutTypeKey = 3
  592. } else if (this.outContractNo[i].inOutType == '暂存入库') {
  593. this.deptBudgetList.inOutTypeKey = 4
  594. } else if (this.outContractNo[i].inOutType == '贸易服务出库') {
  595. this.deptBudgetList.inOutTypeKey = 5
  596. } else if (this.outContractNo[i].inOutType == '采购出库') {
  597. this.deptBudgetList.inOutTypeKey = 6
  598. }
  599. if (this.outContractNo[i].deliverType == '1') {
  600. this.carstatus = true
  601. } else {
  602. this.carstatus = false
  603. }
  604. if (this.outContractNo[i].tranCarInfoList) {
  605. this.options2 = this.outContractNo[i].tranCarInfoList
  606. this.tranCarInfoList = this.outContractNo[i].tranCarInfoList
  607. this.carstatus = true
  608. }
  609. }
  610. }
  611. },
  612. contractNoChange1(e) {
  613. for (var i = 0; i < this.outContractNo.length; i++) {
  614. if (this.outContractNo[i].contractNo == e) {
  615. if (this.outContractNo[i].inOutType == '销售出库') {
  616. this.deptBudgetList.inOutTypeKey = 1
  617. } else if (this.outContractNo[i].inOutType == '移库出库') {
  618. this.deptBudgetList.inOutTypeKey = 3
  619. } else if (this.outContractNo[i].inOutType == '暂存入库') {
  620. this.deptBudgetList.inOutTypeKey = 4
  621. } else if (this.outContractNo[i].inOutType == '贸易服务出库') {
  622. this.deptBudgetList.inOutTypeKey = 5
  623. } else if (this.outContractNo[i].inOutType == '采购出库') {
  624. this.deptBudgetList.inOutTypeKey = 6
  625. }
  626. this.deptBudgetList.goodsName = this.outContractNo[i].goodsName
  627. this.deptBudgetList.goodsNameKey = this.outContractNo[i].goodsNameKey
  628. this.deptBudgetList.grade = this.outContractNo[i].grade
  629. this.deptBudgetList.inOutType = this.outContractNo[i].inOutType
  630. if (this.outContractNo[i].tranCarInfoList) {
  631. this.options2 = this.outContractNo[i].tranCarInfoList
  632. this.tranCarInfoList = this.outContractNo[i].tranCarInfoList
  633. this.carstatus = true
  634. }
  635. }
  636. }
  637. },
  638. dataFilter2(val) {
  639. this.deptBudgetList.carNo = val
  640. if (val) {
  641. //val存在
  642. this.options1 = this.outContractNo1.filter((item) => {
  643. if (
  644. !!~item.carNo.indexOf(val) ||
  645. !!~item.carNo.toUpperCase().indexOf(val.toUpperCase())
  646. ) {
  647. return true
  648. }
  649. })
  650. } else {
  651. //val为空时,还原数组
  652. this.options2 = this.tranCarInfoList
  653. }
  654. },
  655. dataFilter(val) {
  656. // console.log(val,"名")
  657. this.deptBudgetList.staffList = val
  658. if (val) {
  659. //val存在
  660. this.options = this.staffList.filter((item) => {
  661. if (
  662. !!~item.staffName.indexOf(val) ||
  663. !!~item.staffName.toUpperCase().indexOf(val.toUpperCase())
  664. ) {
  665. return true
  666. }
  667. })
  668. } else {
  669. //val为空时,还原数组
  670. this.options = this.staffList
  671. }
  672. },
  673. selectstaff(e) {
  674. for (var i = 0; i < this.staffList.length; i++) {
  675. if (this.staffList[i].staffName == e) {
  676. this.deptBudgetList.personChargeKey = this.staffList[i].staffId
  677. }
  678. }
  679. },
  680. pureweight(e) {
  681. console.log(this.deptBudgetList)
  682. if (this.deptBudgetList.netWeight && this.deptBudgetList.tidalGrainWater && this.deptBudgetList
  683. .solidGrainWater && this.deptBudgetList.buckleWeightRatio) {
  684. this.deptBudgetList.pureWeight = (this.deptBudgetList.netWeight * (100 - (this.deptBudgetList
  685. .tidalGrainWater - this.deptBudgetList.solidGrainWater) * this.deptBudgetList.buckleWeightRatio)) / 100
  686. }
  687. },
  688. temporaryStorage() {
  689. if (!this.deptBudgetList.goodsName) {
  690. this.$message({
  691. message: '货名不能为空',
  692. type: 'warning',
  693. })
  694. return
  695. }
  696. if (this.information == '毛重检斤' && !this.deptBudgetList.grossWeight) {
  697. this.$message({
  698. message: '毛重不能为空',
  699. type: 'warning',
  700. })
  701. return
  702. }
  703. if (this.information == '毛重检斤' && (
  704. this.deptBudgetList.grossWeight <= 0 ||
  705. this.deptBudgetList.grossWeight > 200000 ||
  706. (String(this.deptBudgetList.grossWeight).indexOf('.') != -1 &&
  707. String(this.deptBudgetList.grossWeight).length -
  708. (String(this.deptBudgetList.grossWeight).indexOf('.') + 1) >
  709. 3))) {
  710. this.$message({
  711. message: '毛重输入错误',
  712. type: 'warning',
  713. })
  714. return
  715. }
  716. if (this.information == '皮重检斤' && !this.deptBudgetList.tare) {
  717. this.$message({
  718. message: '皮重不能为空',
  719. type: 'warning',
  720. })
  721. return
  722. }
  723. if (this.information == '皮重检斤' && (
  724. this.deptBudgetList.tare < 0 ||
  725. this.deptBudgetList.tare > 200000 ||
  726. (String(this.deptBudgetList.tare).indexOf('.') != -1 &&
  727. String(this.deptBudgetList.tare).length -
  728. (String(this.deptBudgetList.tare).indexOf('.') + 1) >
  729. 3))) {
  730. this.$message({
  731. message: '皮重输入错误',
  732. type: 'warning',
  733. })
  734. return
  735. }
  736. if (this.deptBudgetList.carNo.length > 7) {
  737. this.$message({
  738. message: '车牌号输入错误,请输入7个字符之内',
  739. type: 'warning',
  740. })
  741. return
  742. }
  743. if (!this.deptBudgetList.contractNo) {
  744. this.$message({
  745. message: '合同编号不能为空',
  746. type: 'warning',
  747. })
  748. return
  749. }
  750. // if (
  751. // this.deptBudgetList.contractNo.length < 6 ||
  752. // this.deptBudgetList.contractNo.length > 20
  753. // ) {
  754. // this.$message({
  755. // message: '合同编号长度不符合要求,请输入6-20个字符之内',
  756. // type: 'warning',
  757. // })
  758. // return
  759. // }
  760. //自检员
  761. if (this.deptBudgetList.warehouseInOutDetail.qualityInspector) {
  762. if (
  763. this.deptBudgetList.warehouseInOutDetail.qualityInspector.length <
  764. 2 ||
  765. this.deptBudgetList.warehouseInOutDetail.qualityInspector.length > 10
  766. ) {
  767. this.$message({
  768. message: '质检员姓名长度错误!',
  769. type: 'warning',
  770. })
  771. return
  772. }
  773. }
  774. if (this.deptBudgetList.warehouseInOutDetail.waterContent) {
  775. if (isNaN(this.deptBudgetList.warehouseInOutDetail.waterContent)) {
  776. this.$message({
  777. message: '水分(%)非数字!',
  778. type: 'warning',
  779. })
  780. return
  781. }
  782. if (
  783. this.deptBudgetList.warehouseInOutDetail.waterContent < 1 ||
  784. this.deptBudgetList.warehouseInOutDetail.waterContent > 40 ||
  785. (String(
  786. this.deptBudgetList.warehouseInOutDetail.waterContent
  787. ).indexOf('.') != -1 &&
  788. String(this.deptBudgetList.warehouseInOutDetail.waterContent)
  789. .length -
  790. (String(
  791. this.deptBudgetList.warehouseInOutDetail.waterContent
  792. ).indexOf('.') +
  793. 1) >
  794. 2)
  795. ) {
  796. this.$message({
  797. message: '水分(%)输入错误! 取值范围1-40之间且可以保留2小数',
  798. type: 'warning',
  799. })
  800. return
  801. }
  802. }
  803. //杂质
  804. if (this.deptBudgetList.warehouseInOutDetail.impurity) {
  805. if (isNaN(this.deptBudgetList.warehouseInOutDetail.impurity)) {
  806. this.$message({
  807. message: '杂质(%)非数字!',
  808. type: 'warning',
  809. })
  810. return
  811. }
  812. if (
  813. this.deptBudgetList.warehouseInOutDetail.impurity < 1 ||
  814. this.deptBudgetList.warehouseInOutDetail.impurity > 40 ||
  815. (String(this.deptBudgetList.warehouseInOutDetail.impurity).indexOf(
  816. '.'
  817. ) != -1 &&
  818. String(this.deptBudgetList.warehouseInOutDetail.impurity).length -
  819. (String(
  820. this.deptBudgetList.warehouseInOutDetail.impurity
  821. ).indexOf('.') +
  822. 1) >
  823. 2)
  824. ) {
  825. this.$message({
  826. message: '杂质(%)输入错误! 取值范围1-40之间且可以保留2小数',
  827. type: 'warning',
  828. })
  829. return
  830. }
  831. }
  832. //霉变
  833. if (this.deptBudgetList.warehouseInOutDetail.mildewGrain) {
  834. if (isNaN(this.deptBudgetList.warehouseInOutDetail.mildewGrain)) {
  835. this.$message({
  836. message: '霉变粒(%)非数字!',
  837. type: 'warning',
  838. })
  839. return
  840. }
  841. if (
  842. this.deptBudgetList.warehouseInOutDetail.mildewGrain < 1 ||
  843. this.deptBudgetList.warehouseInOutDetail.mildewGrain > 40 ||
  844. (String(this.deptBudgetList.warehouseInOutDetail.mildewGrain).indexOf(
  845. '.'
  846. ) != -1 &&
  847. String(this.deptBudgetList.warehouseInOutDetail.mildewGrain)
  848. .length -
  849. (String(
  850. this.deptBudgetList.warehouseInOutDetail.mildewGrain
  851. ).indexOf('.') +
  852. 1) >
  853. 2)
  854. ) {
  855. this.$message({
  856. message: '霉变粒(%)输入错误! 取值范围1-40之间且可以保留2小数',
  857. type: 'warning',
  858. })
  859. return
  860. }
  861. }
  862. //热损伤
  863. if (this.deptBudgetList.warehouseInOutDetail.jiaorenli) {
  864. if (isNaN(this.deptBudgetList.warehouseInOutDetail.jiaorenli)) {
  865. this.$message({
  866. message: '热损伤(%)非数字!',
  867. type: 'warning',
  868. })
  869. return
  870. }
  871. if (
  872. this.deptBudgetList.warehouseInOutDetail.jiaorenli < 1 ||
  873. this.deptBudgetList.warehouseInOutDetail.jiaorenli > 40 ||
  874. (String(this.deptBudgetList.warehouseInOutDetail.jiaorenli).indexOf(
  875. '.'
  876. ) != -1 &&
  877. String(this.deptBudgetList.warehouseInOutDetail.jiaorenli).length -
  878. (String(
  879. this.deptBudgetList.warehouseInOutDetail.jiaorenli
  880. ).indexOf('.') +
  881. 1) >
  882. 2)
  883. ) {
  884. this.$message({
  885. message: '热损伤(%)输入错误! 取值范围1-40之间且可以保留2小数',
  886. type: 'warning',
  887. })
  888. return
  889. }
  890. }
  891. //不完善粒(%)
  892. if (this.deptBudgetList.warehouseInOutDetail.imperfectGrain) {
  893. if (isNaN(this.deptBudgetList.warehouseInOutDetail.imperfectGrain)) {
  894. this.$message({
  895. message: '不完善粒(%)非数字!',
  896. type: 'warning',
  897. })
  898. return
  899. }
  900. if (
  901. this.deptBudgetList.warehouseInOutDetail.imperfectGrain < 1 ||
  902. this.deptBudgetList.warehouseInOutDetail.imperfectGrain > 40 ||
  903. (String(
  904. this.deptBudgetList.warehouseInOutDetail.imperfectGrain
  905. ).indexOf('.') != -1 &&
  906. String(this.deptBudgetList.warehouseInOutDetail.imperfectGrain)
  907. .length -
  908. (String(
  909. this.deptBudgetList.warehouseInOutDetail.imperfectGrain
  910. ).indexOf('.') +
  911. 1) >
  912. 2)
  913. ) {
  914. this.$message({
  915. message: '不完善粒(%)输入错误! 取值范围1-40之间且可以保留2小数',
  916. type: 'warning',
  917. })
  918. return
  919. }
  920. }
  921. //容重
  922. if (this.deptBudgetList.warehouseInOutDetail.bulkDensity) {
  923. if (isNaN(this.deptBudgetList.warehouseInOutDetail.bulkDensity)) {
  924. this.$message({
  925. message: '容重(克/升)非数字!',
  926. type: 'warning',
  927. })
  928. return
  929. }
  930. if (
  931. (this.deptBudgetList.warehouseInOutDetail.bulkDensity &&
  932. String(this.deptBudgetList.warehouseInOutDetail.bulkDensity).indexOf('.') != -1 &&
  933. String(this.deptBudgetList.warehouseInOutDetail.bulkDensity).length -
  934. (String(this.deptBudgetList.warehouseInOutDetail.bulkDensity).indexOf('.') + 1) >
  935. 2) || this.deptBudgetList.warehouseInOutDetail.bulkDensity > 1000 || this.deptBudgetList
  936. .warehouseInOutDetail.bulkDensity < 0
  937. ) {
  938. this.$message({
  939. message: '容重输入错误',
  940. type: 'warning',
  941. })
  942. return
  943. }
  944. }
  945. console.log(this.deptBudgetList, '出库!!!!!')
  946. this.$confirm(`是否保存皮重检斤`, {
  947. cancelButtonText: '取消',
  948. confirmButtonText: '确定',
  949. type: 'warning',
  950. })
  951. .then(() => {
  952. this.$refs.deptBudgetList.validate((valid) => {
  953. if (valid) {
  954. this.deptBudgetList.compId = localStorage.getItem('ws-pf_compId')
  955. this.deptBudgetList.skinInspector = localStorage.getItem('ws-pf_staffName')
  956. this.deptBudgetList.inOutFlag = 1
  957. this.deptBudgetList.pcFlag = 1
  958. this.deptBudgetList.statusFlag = 1
  959. this.deptBudgetList.grossWeight /= 1000
  960. this.deptBudgetList.tare /= 1000
  961. this.deptBudgetList.netWeight = this.deptBudgetList.netWeight.toFixed(2)
  962. this.deptBudgetList.pureWeight /= 1000
  963. addstorageputList(this.deptBudgetList)
  964. .toPromise()
  965. .then((response) => {
  966. if(this.reader){
  967. this.reader.cancel()
  968. }
  969. this.$message.success('保存成功')
  970. this.$router.push({
  971. path: 'warehouseManagementList'
  972. })
  973. })
  974. } else {
  975. EventBus.$emit('error', this.$t('showMessage.asteriskRequired'))
  976. return false
  977. }
  978. })
  979. })
  980. .catch(() => {
  981. return false
  982. })
  983. },
  984. //提交按钮
  985. submit() {
  986. if (!this.deptBudgetList.goodsName) {
  987. this.$message({
  988. message: '货名不能为空!',
  989. type: 'warning',
  990. })
  991. return
  992. }
  993. if (!this.deptBudgetList.grossWeight) {
  994. this.$message({
  995. message: '毛重不能为空!',
  996. type: 'warning',
  997. })
  998. return
  999. }
  1000. if (
  1001. this.deptBudgetList.grossWeight <= 0 ||
  1002. this.deptBudgetList.grossWeight > 5000000 ||
  1003. (String(this.deptBudgetList.grossWeight).indexOf('.') != -1 &&
  1004. String(this.deptBudgetList.grossWeight).length -
  1005. (String(this.deptBudgetList.grossWeight).indexOf('.') + 1) >
  1006. 3)
  1007. ) {
  1008. this.$message({
  1009. message: '毛重输入错误',
  1010. type: 'warning',
  1011. })
  1012. return
  1013. }
  1014. if (!this.deptBudgetList.tare) {
  1015. this.$message({
  1016. message: '皮重不能为空!',
  1017. type: 'warning',
  1018. })
  1019. return
  1020. }
  1021. if (
  1022. this.deptBudgetList.tare < 0 ||
  1023. this.deptBudgetList.tare > 500000 ||
  1024. (String(this.deptBudgetList.tare).indexOf('.') != -1 &&
  1025. String(this.deptBudgetList.tare).length -
  1026. (String(this.deptBudgetList.tare).indexOf('.') + 1) >
  1027. 3)
  1028. ) {
  1029. this.$message({
  1030. message: '皮重输入错误',
  1031. type: 'warning',
  1032. })
  1033. return
  1034. }
  1035. if (!this.deptBudgetList.netWeight) {
  1036. this.$message({
  1037. message: '净重不能为空!',
  1038. type: 'warning',
  1039. })
  1040. return
  1041. }
  1042. if (
  1043. this.deptBudgetList.netWeight <= 0 ||
  1044. this.deptBudgetList.netWeight >= 5000000
  1045. ) {
  1046. this.$message({
  1047. message: '净重输入错误!',
  1048. type: 'warning',
  1049. })
  1050. return
  1051. }
  1052. if (!this.deptBudgetList.grade) {
  1053. this.$message({
  1054. message: '品级不能为空!',
  1055. type: 'warning',
  1056. })
  1057. return
  1058. }
  1059. if (this.deptBudgetList.type == '潮粮' && !this.deptBudgetList.buckleWeightRatio) {
  1060. this.$message({
  1061. message: '扣重比不能为空',
  1062. type: 'warning'
  1063. })
  1064. return
  1065. }
  1066. if (
  1067. this.deptBudgetList.type == '潮粮' && this.deptBudgetList.buckleWeightRatio < 0 ||
  1068. this.deptBudgetList.type == '潮粮' && this.deptBudgetList.buckleWeightRatio > 3 ||
  1069. (this.deptBudgetList.type == '潮粮' && String(this.deptBudgetList.buckleWeightRatio).indexOf('.') != -1 &&
  1070. String(this.deptBudgetList.buckleWeightRatio).length -
  1071. (String(this.deptBudgetList.buckleWeightRatio).indexOf('.') + 1) >
  1072. 2)
  1073. ) {
  1074. this.$message({
  1075. message: '扣重比输入错误',
  1076. type: 'warning'
  1077. })
  1078. return
  1079. }
  1080. if (this.deptBudgetList.type == '潮粮' && !this.deptBudgetList.tidalGrainWater) {
  1081. this.$message({
  1082. message: '潮粮水分不能为空',
  1083. type: 'warning'
  1084. })
  1085. return
  1086. }
  1087. if (
  1088. this.deptBudgetList.type == '潮粮' && this.deptBudgetList.tidalGrainWater < 1 ||
  1089. this.deptBudgetList.type == '潮粮' && this.deptBudgetList.tidalGrainWater > 40 ||
  1090. (this.deptBudgetList.type == '潮粮' && String(this.deptBudgetList.tidalGrainWater).indexOf('.') != -1 &&
  1091. String(this.deptBudgetList.tidalGrainWater).length -
  1092. (String(this.deptBudgetList.tidalGrainWater).indexOf('.') + 1) >
  1093. 2)
  1094. ) {
  1095. this.$message({
  1096. message: '潮粮水分输入错误',
  1097. type: 'warning'
  1098. })
  1099. return
  1100. }
  1101. if (this.deptBudgetList.type == '潮粮' && !this.deptBudgetList.solidGrainWater) {
  1102. this.$message({
  1103. message: '干粮水分不能为空',
  1104. type: 'warning'
  1105. })
  1106. return
  1107. }
  1108. if (
  1109. this.deptBudgetList.type == '潮粮' && this.deptBudgetList.solidGrainWater < 1 ||
  1110. this.deptBudgetList.type == '潮粮' && this.deptBudgetList.solidGrainWater > 40 ||
  1111. (this.deptBudgetList.type == '潮粮' && String(this.deptBudgetList.solidGrainWater).indexOf('.') != -1 &&
  1112. String(this.deptBudgetList.solidGrainWater).length -
  1113. (String(this.deptBudgetList.solidGrainWater).indexOf('.') + 1) >
  1114. 1)
  1115. ) {
  1116. this.$message({
  1117. message: '干粮水分输入错误',
  1118. type: 'warning'
  1119. })
  1120. return
  1121. }
  1122. if (!this.deptBudgetList.agent) {
  1123. this.$message({
  1124. message: '经办人不能为空!',
  1125. type: 'warning',
  1126. })
  1127. return
  1128. }
  1129. if (
  1130. this.deptBudgetList.agent.length < 2 ||
  1131. this.deptBudgetList.agent.length > 10
  1132. ) {
  1133. this.$message({
  1134. message: '经办人姓名输入有误!',
  1135. type: 'warning',
  1136. })
  1137. return
  1138. }
  1139. if (!this.deptBudgetList.inOutDate) {
  1140. this.$message({
  1141. message: '出库日期不能为空!',
  1142. type: 'warning',
  1143. })
  1144. return
  1145. }
  1146. if (!this.deptBudgetList.inOutType) {
  1147. this.$message({
  1148. message: '出库类型不能为空!',
  1149. type: 'warning',
  1150. })
  1151. return
  1152. }
  1153. if (this.deptBudgetList.boxNo&&this.deptBudgetList.boxNo.length > 20) {
  1154. this.$message({
  1155. message: '箱号-1输入错误',
  1156. type: 'warning',
  1157. })
  1158. return
  1159. }
  1160. if (this.deptBudgetList.boxNoOther&&this.deptBudgetList.boxNoOther.length > 20) {
  1161. this.$message({
  1162. message: '箱号-2输入错误',
  1163. type: 'warning',
  1164. })
  1165. return
  1166. }
  1167. if (this.deptBudgetList.titleNo&&this.deptBudgetList.titleNo.length > 20) {
  1168. this.$message({
  1169. message: '封号-1输入错误',
  1170. type: 'warning',
  1171. })
  1172. return
  1173. }
  1174. if (this.deptBudgetList.titleNoOther&&this.deptBudgetList.titleNoOther.length > 20) {
  1175. this.$message({
  1176. message: '封号-2输入错误',
  1177. type: 'warning',
  1178. })
  1179. return
  1180. }
  1181. if (!this.deptBudgetList.contractNo) {
  1182. this.$message({
  1183. message: '合同编号不能为空!',
  1184. type: 'warning',
  1185. })
  1186. return
  1187. }
  1188. if (
  1189. this.deptBudgetList.contractNo.length < 6 ||
  1190. this.deptBudgetList.contractNo.length > 50
  1191. ) {
  1192. this.$message({
  1193. message: '合同编号输入有误!',
  1194. type: 'warning',
  1195. })
  1196. return
  1197. }
  1198. //自检员
  1199. if (this.deptBudgetList.warehouseInOutDetail.qualityInspector) {
  1200. if (
  1201. this.deptBudgetList.warehouseInOutDetail.qualityInspector.length <
  1202. 2 ||
  1203. this.deptBudgetList.warehouseInOutDetail.qualityInspector.length > 10
  1204. ) {
  1205. this.$message({
  1206. message: '质检员姓名长度错误!',
  1207. type: 'warning',
  1208. })
  1209. return
  1210. }
  1211. }
  1212. if (this.deptBudgetList.warehouseInOutDetail.waterContent) {
  1213. if (isNaN(this.deptBudgetList.warehouseInOutDetail.waterContent)) {
  1214. this.$message({
  1215. message: '水分(%)非数字!',
  1216. type: 'warning',
  1217. })
  1218. return
  1219. }
  1220. if (
  1221. this.deptBudgetList.warehouseInOutDetail.waterContent < 1 ||
  1222. this.deptBudgetList.warehouseInOutDetail.waterContent > 40 ||
  1223. (String(
  1224. this.deptBudgetList.warehouseInOutDetail.waterContent
  1225. ).indexOf('.') != -1 &&
  1226. String(this.deptBudgetList.warehouseInOutDetail.waterContent)
  1227. .length -
  1228. (String(
  1229. this.deptBudgetList.warehouseInOutDetail.waterContent
  1230. ).indexOf('.') +
  1231. 1) >
  1232. 2)
  1233. ) {
  1234. this.$message({
  1235. message: '水分(%)输入错误! 取值范围1-40之间且可以保留2小数',
  1236. type: 'warning',
  1237. })
  1238. return
  1239. }
  1240. }
  1241. //杂质
  1242. if (this.deptBudgetList.warehouseInOutDetail.impurity) {
  1243. if (isNaN(this.deptBudgetList.warehouseInOutDetail.impurity)) {
  1244. this.$message({
  1245. message: '杂质(%)非数字!',
  1246. type: 'warning',
  1247. })
  1248. return
  1249. }
  1250. if (
  1251. this.deptBudgetList.warehouseInOutDetail.impurity < 1 ||
  1252. this.deptBudgetList.warehouseInOutDetail.impurity > 40 ||
  1253. (String(this.deptBudgetList.warehouseInOutDetail.impurity).indexOf(
  1254. '.'
  1255. ) != -1 &&
  1256. String(this.deptBudgetList.warehouseInOutDetail.impurity).length -
  1257. (String(
  1258. this.deptBudgetList.warehouseInOutDetail.impurity
  1259. ).indexOf('.') +
  1260. 1) >
  1261. 2)
  1262. ) {
  1263. this.$message({
  1264. message: '杂质(%)输入错误! 取值范围1-40之间且可以保留2小数',
  1265. type: 'warning',
  1266. })
  1267. return
  1268. }
  1269. }
  1270. //霉变
  1271. if (this.deptBudgetList.warehouseInOutDetail.mildewGrain) {
  1272. if (isNaN(this.deptBudgetList.warehouseInOutDetail.mildewGrain)) {
  1273. this.$message({
  1274. message: '霉变粒(%)非数字!',
  1275. type: 'warning',
  1276. })
  1277. return
  1278. }
  1279. if (
  1280. this.deptBudgetList.warehouseInOutDetail.mildewGrain < 1 ||
  1281. this.deptBudgetList.warehouseInOutDetail.mildewGrain > 40 ||
  1282. (String(this.deptBudgetList.warehouseInOutDetail.mildewGrain).indexOf(
  1283. '.'
  1284. ) != -1 &&
  1285. String(this.deptBudgetList.warehouseInOutDetail.mildewGrain)
  1286. .length -
  1287. (String(
  1288. this.deptBudgetList.warehouseInOutDetail.mildewGrain
  1289. ).indexOf('.') +
  1290. 1) >
  1291. 2)
  1292. ) {
  1293. this.$message({
  1294. message: '霉变粒(%)输入错误! 取值范围1-40之间且可以保留2小数',
  1295. type: 'warning',
  1296. })
  1297. return
  1298. }
  1299. }
  1300. //热损伤
  1301. if (this.deptBudgetList.warehouseInOutDetail.jiaorenli) {
  1302. if (isNaN(this.deptBudgetList.warehouseInOutDetail.jiaorenli)) {
  1303. this.$message({
  1304. message: '热损伤(%)非数字!',
  1305. type: 'warning',
  1306. })
  1307. return
  1308. }
  1309. if (
  1310. this.deptBudgetList.warehouseInOutDetail.jiaorenli < 1 ||
  1311. this.deptBudgetList.warehouseInOutDetail.jiaorenli > 40 ||
  1312. (String(this.deptBudgetList.warehouseInOutDetail.jiaorenli).indexOf(
  1313. '.'
  1314. ) != -1 &&
  1315. String(this.deptBudgetList.warehouseInOutDetail.jiaorenli).length -
  1316. (String(
  1317. this.deptBudgetList.warehouseInOutDetail.jiaorenli
  1318. ).indexOf('.') +
  1319. 1) >
  1320. 2)
  1321. ) {
  1322. this.$message({
  1323. message: '热损伤(%)输入错误! 取值范围1-40之间且可以保留2小数',
  1324. type: 'warning',
  1325. })
  1326. return
  1327. }
  1328. }
  1329. //不完善粒(%)
  1330. if (this.deptBudgetList.warehouseInOutDetail.imperfectGrain) {
  1331. if (isNaN(this.deptBudgetList.warehouseInOutDetail.imperfectGrain)) {
  1332. this.$message({
  1333. message: '不完善粒(%)非数字!',
  1334. type: 'warning',
  1335. })
  1336. return
  1337. }
  1338. if (
  1339. this.deptBudgetList.warehouseInOutDetail.imperfectGrain < 1 ||
  1340. this.deptBudgetList.warehouseInOutDetail.imperfectGrain > 40 ||
  1341. (String(
  1342. this.deptBudgetList.warehouseInOutDetail.imperfectGrain
  1343. ).indexOf('.') != -1 &&
  1344. String(this.deptBudgetList.warehouseInOutDetail.imperfectGrain)
  1345. .length -
  1346. (String(
  1347. this.deptBudgetList.warehouseInOutDetail.imperfectGrain
  1348. ).indexOf('.') +
  1349. 1) >
  1350. 2)
  1351. ) {
  1352. this.$message({
  1353. message: '不完善粒(%)输入错误! 取值范围1-40之间且可以保留2小数',
  1354. type: 'warning',
  1355. })
  1356. return
  1357. }
  1358. }
  1359. //容重
  1360. if (this.deptBudgetList.warehouseInOutDetail.bulkDensity) {
  1361. if (isNaN(this.deptBudgetList.warehouseInOutDetail.bulkDensity)) {
  1362. this.$message({
  1363. message: '容重(克/升)非数字!',
  1364. type: 'warning',
  1365. })
  1366. return
  1367. }
  1368. if (
  1369. (this.deptBudgetList.warehouseInOutDetail.bulkDensity &&
  1370. String(this.deptBudgetList.warehouseInOutDetail.bulkDensity).indexOf('.') != -1 &&
  1371. String(this.deptBudgetList.warehouseInOutDetail.bulkDensity).length -
  1372. (String(this.deptBudgetList.warehouseInOutDetail.bulkDensity).indexOf('.') + 1) >
  1373. 2) || this.deptBudgetList.warehouseInOutDetail.bulkDensity > 1000 || this.deptBudgetList
  1374. .warehouseInOutDetail.bulkDensity < 0
  1375. ) {
  1376. this.$message({
  1377. message: '容重输入错误',
  1378. type: 'warning',
  1379. })
  1380. return
  1381. }
  1382. }
  1383. this.$confirm(`确定提交出库信息`, {
  1384. cancelButtonText: '取消',
  1385. confirmButtonText: '确定',
  1386. type: 'warning',
  1387. }).then(() => {
  1388. this.$refs.deptBudgetList.validate((valid) => {
  1389. if (valid) {
  1390. this.deptBudgetList.grossWeight /= 1000
  1391. this.deptBudgetList.tare /= 1000
  1392. this.deptBudgetList.netWeight /= 1000
  1393. this.deptBudgetList.pureWeight /= 1000
  1394. this.deptBudgetList.deductionAmount *= 1000
  1395. this.deptBudgetList.deductionWeight /= 1000
  1396. this.deptBudgetList.compId = localStorage.getItem('ws-pf_compId')
  1397. this.deptBudgetList.skinInspector = localStorage.getItem('ws-pf_staffName')
  1398. this.deptBudgetList.inOutFlag = 1
  1399. this.deptBudgetList.statusFlag = 3
  1400. addstorageputList(this.deptBudgetList)
  1401. .toPromise()
  1402. .then((response) => {
  1403. if(this.reader){
  1404. this.reader.cancel()
  1405. }
  1406. this.$message.success('添加成功')
  1407. this.$router.push({
  1408. path: 'warehouseManagementList'
  1409. })
  1410. }).catch((response) => {
  1411. this.deptBudgetList.grossWeight = Math.round(this.deptBudgetList.grossWeight*1000)
  1412. this.deptBudgetList.tare = Math.round(this.deptBudgetList.tare*1000)
  1413. this.deptBudgetList.netWeight = Math.round(this.deptBudgetList.netWeight*1000)
  1414. this.deptBudgetList.pureWeight = Math.round(this.deptBudgetList.pureWeight*1000)
  1415. this.deptBudgetList.deductionAmount = Math.round(this.deptBudgetList.deductionAmount/1000)
  1416. this.deptBudgetList.deductionWeight = Math.round(this.deptBudgetList.deductionWeight*1000)
  1417. })
  1418. } else {
  1419. EventBus.$emit('error', this.$t('showMessage.asteriskRequired'))
  1420. return false
  1421. }
  1422. })
  1423. })
  1424. },
  1425. tarechange(e) {
  1426. if (this.deptBudgetList.grossWeight && this.deptBudgetList.tare) {
  1427. this.deptBudgetList.netWeight = Number(
  1428. this.deptBudgetList.grossWeight - this.deptBudgetList.tare
  1429. ).toFixed(2)
  1430. }
  1431. },
  1432. grossWeightchange(e) {
  1433. if (this.deptBudgetList.grossWeight && this.deptBudgetList.tare) {
  1434. this.deptBudgetList.netWeight = Number(
  1435. this.deptBudgetList.grossWeight - this.deptBudgetList.tare
  1436. ).toFixed(2)
  1437. }
  1438. },
  1439. selectgoodsName(e) {
  1440. for (var i = 0; i < this.goodnameList.length; i++) {
  1441. if (this.goodnameList[i].goodsName == e) {
  1442. this.deptBudgetList.goodsNameKey = this.goodnameList[i].goodsNameKey
  1443. if(e=='玉米(潮粮)'){
  1444. this.deptBudgetList.type='潮粮'
  1445. }else{
  1446. this.deptBudgetList.type='干粮'
  1447. }
  1448. }
  1449. }
  1450. },
  1451. selectpackingMethod(e) {
  1452. for (var i = 0; i < this.packtypeList.length; i++) {
  1453. if (this.packtypeList[i].constValue == e) {
  1454. this.deptBudgetList.packingMethodKey = this.packtypeList[i].constKey
  1455. }
  1456. }
  1457. },
  1458. selectstorageType(e) {
  1459. for (var i = 0; i < this.deliveryType.length; i++) {
  1460. if (this.deliveryType[i].constValue == e) {
  1461. this.deptBudgetList.inOutTypeKey = this.deliveryType[i].constKey
  1462. }
  1463. }
  1464. },
  1465. handleClose() {
  1466. this.accessoryTFs = false
  1467. },
  1468. handleSizeChange(val) {
  1469. console.log(`每页 ${val} 条`)
  1470. this.pageSize = val
  1471. this.getList()
  1472. },
  1473. handleCurrentChange(val) {
  1474. this.currentPage = val
  1475. console.log(`当前页: ${val}`)
  1476. this.getList()
  1477. },
  1478. getList() {
  1479. // 品级
  1480. pullDown({
  1481. constId: 'CON3'
  1482. })
  1483. .toPromise()
  1484. .then((response) => {
  1485. this.gradeList = response
  1486. })
  1487. // 类型
  1488. if (this.deptBudgetList.warehouseType == 1) {
  1489. // 货名
  1490. goodsname({
  1491. positionId: this.$route.query.positionId
  1492. })
  1493. .toPromise()
  1494. .then((response) => {
  1495. this.goodnameList = response
  1496. })
  1497. //类型
  1498. pullDown({
  1499. constId: 'CON6'
  1500. })
  1501. .toPromise()
  1502. .then((response) => {
  1503. this.deliveryType = response
  1504. })
  1505. } else if (this.deptBudgetList.warehouseType == 2) {
  1506. goodsnameXiala({
  1507. baseId: this.deptBudgetList.warehouseId
  1508. })
  1509. .toPromise()
  1510. .then((response) => {
  1511. this.goodnameList = response
  1512. })
  1513. pullDown({
  1514. constId: 'WARE2'
  1515. })
  1516. .toPromise()
  1517. .then((response) => {
  1518. this.deliveryType = response
  1519. })
  1520. }
  1521. //合同编号
  1522. xialaNo({
  1523. compId: localStorage.getItem('ws-pf_compId'),
  1524. flag: 5
  1525. })
  1526. .toPromise()
  1527. .then((response) => {
  1528. this.outContractNo = response
  1529. })
  1530. //经办人
  1531. getstaff({
  1532. compId: localStorage.getItem('ws-pf_compId'),
  1533. warehouseId: this.deptBudgetList.baseId
  1534. })
  1535. .toPromise()
  1536. .then((response) => {
  1537. // this.agent = response
  1538. this.qualityInspectorList = response
  1539. this.options = response
  1540. this.staffList = response
  1541. })
  1542. },
  1543. selecttaskType(e) {
  1544. for (var i = 0; i < this.taskTypeList.length; i++) {
  1545. if (this.taskTypeList[i].value == e) {
  1546. this.searchType = this.taskTypeList[i].type
  1547. }
  1548. }
  1549. },
  1550. fujian(row) {
  1551. if (
  1552. row.receiveAttachmentPath === null ||
  1553. row.receiveAttachmentPath === ''
  1554. ) {
  1555. EventBus.$emit(
  1556. 'warning',
  1557. this.$t('system.noticeCircular.NoInformation')
  1558. )
  1559. } else {
  1560. this.accessoryTFs = true
  1561. }
  1562. this.appendixIdss = row.receiveAttachmentPath
  1563. },
  1564. handleExamine(row) {
  1565. this.$router.push({
  1566. name: 'salesContractExamine',
  1567. query: {
  1568. id: row.id
  1569. },
  1570. })
  1571. },
  1572. //删除
  1573. approve() {},
  1574. listQuery() {},
  1575. total() {},
  1576. clearfiltQuery() {},
  1577. selectCrtDuty() {},
  1578. },
  1579. }
  1580. </script>
  1581. <style lang="scss" scoped>
  1582. /deep/.basicInformation {
  1583. .ws-info-table {
  1584. border: none;
  1585. }
  1586. .el-form-item {
  1587. width: 33.3333%;
  1588. border: none;
  1589. .el-form-item__label {
  1590. background: transparent;
  1591. border: none;
  1592. }
  1593. .el-form-item__content {
  1594. border: none;
  1595. }
  1596. }
  1597. }
  1598. .el-button--default {
  1599. color: #5473e8;
  1600. border-color: #5473e8;
  1601. }
  1602. .title {
  1603. position: relative;
  1604. padding-left: 10px;
  1605. }
  1606. .title::before {
  1607. content: '';
  1608. display: inline-block;
  1609. width: 5px;
  1610. height: 30px;
  1611. background: #5473e8;
  1612. position: absolute;
  1613. left: 0;
  1614. }
  1615. .el-form {
  1616. padding: 0 10%;
  1617. }
  1618. .el-button--primary {
  1619. background-color: #5878e8;
  1620. border-color: #5878e8;
  1621. }
  1622. .el-col {
  1623. background: #f6f7fc;
  1624. }
  1625. .bg-right {
  1626. text-align: right;
  1627. padding: 16px 20px;
  1628. }
  1629. .center {
  1630. position: relative;
  1631. top: 50px;
  1632. width: 40%;
  1633. height: 2000px;
  1634. margin: 0 auto;
  1635. }
  1636. //选填
  1637. /deep/.el-form-item {
  1638. width: 50%;
  1639. }
  1640. .container {
  1641. overflow: scroll;
  1642. height: 120vh;
  1643. }
  1644. /deep/.ws-info-table .el-form-item .el-form-item__label {
  1645. text-align: center;
  1646. }
  1647. .deliverydate {
  1648. display: inline-block;
  1649. width: 10%;
  1650. }
  1651. .center {
  1652. margin-top: -60px;
  1653. width: 80%;
  1654. }
  1655. //仓位
  1656. .position {
  1657. background: #afb5cb;
  1658. border-radius: 2px;
  1659. font-size: 12px;
  1660. color: #ffffff;
  1661. line-height: 20px;
  1662. padding: 2px 4px;
  1663. position: relative;
  1664. top: -2px;
  1665. }
  1666. .neifor /deep/.ws-info-table .el-form-item .el-form-item__label {
  1667. background: #f6f7fc;
  1668. }
  1669. .neifor .ws-info-table {
  1670. border-left: 1px solid #cdd2dc;
  1671. border-top: 1px solid #cdd2dc;
  1672. }
  1673. .neifor .ws-info-table .el-form-item {
  1674. border-right: 1px solid #cdd2dc;
  1675. border-bottom: 1px solid #cdd2dc;
  1676. }
  1677. .inspector /deep/.ws-info-table .el-form-item .el-form-item__label {
  1678. width: 59px;
  1679. }
  1680. //表格文字
  1681. /deep/.ws-info-table .el-form-item .el-form-item__label {
  1682. text-align: center;
  1683. font-size: 14px;
  1684. font-family: PingFangSC-Regular, PingFang SC;
  1685. font-weight: 400;
  1686. color: #8890b1;
  1687. line-height: 16px;
  1688. }
  1689. .inspector {
  1690. width: 50%;
  1691. }
  1692. //质检员
  1693. .inspector .el-form-item__content {
  1694. text-align: left;
  1695. margin-left: 0px;
  1696. }
  1697. .small-title {
  1698. position: relative;
  1699. padding: 10px;
  1700. font-weight: 600;
  1701. }
  1702. .small-title::before {
  1703. position: absolute;
  1704. content: '';
  1705. display: block;
  1706. background: #5473e8;
  1707. width: 4px;
  1708. height: 14px;
  1709. left: 0px;
  1710. top: 13px;
  1711. }
  1712. //下面列表
  1713. .neifor {
  1714. width: 80%;
  1715. background-color: #f6f7fc;
  1716. }
  1717. /deep/.neifor .ws-info-table .el-form-item .el-form-item__label {
  1718. width: 35%;
  1719. text-align: center;
  1720. }
  1721. /deep/.neifor .ws-info-table .el-form-item .el-form-item__content {
  1722. width: 60%;
  1723. background-color: #f6f7fc;
  1724. }
  1725. /deep/.neifor .el-input--small .el-input__inner {
  1726. width: 100%;
  1727. }
  1728. </style>