warehouseManagementList.vue 60 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555
  1. <!--仓库管理-->
  2. <template>
  3. <div class="container">
  4. <!-- 表格 -->
  5. <div class="top_form" v-hasPermission="`warehouseManagement.warehouse.warehouseInfo.kan`">
  6. <div style='position:relative;' class="title">
  7. <span style="font-size:18px;font-weight: 600;margin-left:20px">今日储量明细</span><span style="color:#8890B1;font-size:16px">({{dateTime}})</span>
  8. <ws-button type="primary" v-hasPermission="`warehouseManagement.warehouse.warehouseInfo.kan`" @click="handleall()" style="margin-left:20px;position:absolute;right:10px;top:50%;transform: translateY(-50%);">库存明细</ws-button>
  9. </div>
  10. <el-table :data="tableData" style="width: 100%;margin-top:20px">
  11. <el-table-column :prop="item" :label="item" show-overflow-tooltip v-for="(item, index) in tableHeader" :key="index"></el-table-column>
  12. </el-table>
  13. </div>
  14. <div class='flex'>
  15. <div class='left' style='width:35%;'>
  16. <el-form class="position" ref="deptBudgetList" :rules="rules" :model="deptBudgetList">
  17. <div class="title"><span class="cangInfo">仓库信息</span></div>
  18. <!-- 仓储部负责人 -->
  19. <el-form-item label-width="120px" label="仓储部负责人" span="1" prop="acceptanceMethod">
  20. <el-input v-model="responsible" placeholder="暂无" maxlength="100" size="small" disabled/>
  21. </el-form-item>
  22. <!--仓库名称-->
  23. <el-form-item label-width="120px" label="仓库名" span="1" prop="warehouseName">
  24. <el-select v-model="warehouseInfo.warehouseName" placeholder="请选择仓库名" filterable clearable @change="selectstaff" :filter-method="warehouseQuery">
  25. <el-option v-for="item in warehouseXiaLa" :key="item.warehouseName" :label="item.warehouseName" :value="item.warehouseName" />
  26. </el-select>
  27. </el-form-item>
  28. <!--仓库所在地-->
  29. <el-form-item label-width="120px" label="仓库所在地" span="1" prop="acceptanceMethod">
  30. <el-input v-model="warehouseInfo.warehouseLocation" placeholder="暂无" maxlength="100" size="small" disabled/>
  31. </el-form-item>
  32. <!--详细地址-->
  33. <el-form-item label-width="120px" label="详细地址" span="1" prop="detailedAddress" class="readonly">
  34. <el-input v-model="warehouseInfo.detailedAddress" placeholder="暂无" maxlength="100" size="small" disabled/>
  35. </el-form-item>
  36. <!--总储量(吨)-->
  37. <el-form-item label-width="120px" label="最大容量(吨)" span="1" prop="settlementMethod" v-if="warehouseType == 1">
  38. <el-input :readonly="true" v-model="warehouseInfo.maxReserves" maxlength="100" placeholder="暂无" size="small" disabled />
  39. </el-form-item>
  40. <!--负责人-->
  41. <el-form-item label-width="120px" label="负责人" span="1" prop="personCharge">
  42. <el-input v-model="warehouseInfo.personCharge" placeholder="暂无" maxlength="100" size="small" disabled/>
  43. </el-form-item>
  44. <!--其他负责人-->
  45. <el-form-item label-width="120px" label="其他驻库人员" span="1" prop="otherPersonCharge">
  46. <!-- <el-select v-model="WarehouseInfo.otherPersonPhone" placeholder="暂无" @change="selectstaffOther" multiple filterable clearable collapse-tags disabled> -->
  47. <el-input v-model="warehouseInfo.otherPersonCharge" placeholder="暂无" maxlength="100" size="small" disabled/>
  48. </el-form-item>
  49. </el-form>
  50. </div>
  51. <div class="right" style="width:70%">
  52. <div class="position">
  53. <div class="title"><span class="cangInfo">仓库储量</span></div>
  54. <div class="weight">
  55. <el-switch style="display: block" v-model="value" active-color="#13ce66"
  56. inactive-color="#409EFF" active-text="折算纯重" inactive-text="实际重量"
  57. active-value="1" inactive-value="0" @change="changeWeight"></el-switch>
  58. <!-- <ws-button v-hasPermission="`warehouseManagement.warehouse.warehouseInfo.view` " @click="changeWeight(2)">实际重量</ws-button>
  59. <ws-button v-hasPermission="`warehouseManagement.warehouse.warehouseInfo.view` " @click="changeWeight(1)">折算纯重</ws-button> -->
  60. </div>
  61. <div class="color">
  62. <div v-for="(item , i) in totalReserves" :key="i" class="color_for">
  63. <div :style="{background:lineColor[i]}" class="color_item"></div><div class="color_goodsName">{{item.goodsName}}</div>
  64. </div>
  65. </div>
  66. <div v-for="(item , index) in totalReserves" :key="index" class="reservesInfo">
  67. <div class="reservesInfo_item" v-if="warehouseType == '1'"><div class="reservesInfo_GoodsName">{{item.goodsName}}</div>
  68. <span class="reservesInfo_Amount">{{item.stockNum == 0 ? "-":item.stockNum}}(吨)</span><br/>
  69. <span v-if="item.stockNum&&item.cost" class="reservesInfo_Amount">{{item.cost == 0 ? "-":item.cost}}(元/吨)</span>
  70. <span v-else class="reservesInfo_Amount">{{item.conversionCost == 0 ? "-":item.conversionCost}}(元/吨)</span>
  71. </div>
  72. <div class="reservesInfo_item" v-if="warehouseType == '2'"><div class="reservesInfo_GoodsName">{{item.goodsName}}(吨)</div><span class="reservesInfo_Amount">{{item.surplus == 0 ? "-":item.surplus}}</span></div>
  73. </div>
  74. <div ref="myEchart7" style="height: 250px; width:96%;border-radius: 4px; border:1px solid #D8DCE6; padding: 10px;" class="column"></div>
  75. </div>
  76. </div>
  77. </div>
  78. <div class="position">
  79. <div class="title"><span style="font-size:18px;font-weight: 600;margin-left:20px">当期储量</span></div>
  80. <ws-button type="primary" @click="handleAdd()" v-hasPermission="`warehouseManagement.warehouse.warehouseInfo.add`" style="margin-left:20px">添加</ws-button>
  81. <ws-button v-hasPermission="`warehouseManagement.warehouse.warehouseInfo.view` " @click="handleLook()">查看</ws-button>
  82. <ws-button v-hasPermission="`warehouseManagement.warehouse.warehouseInfo.edit` " @click="handleEdit()">编辑</ws-button>
  83. <ws-button v-hasPermission="`warehouseManagement.warehouse.warehouseInfo.delete`" @click="handleDelete()">删除</ws-button>
  84. <ws-button v-hasPermission=" `warehouseManagement.warehouse.warehouseInfo.view`" @click="record()">记录</ws-button>
  85. <ws-button v-if="warehouseType == '1'" v-hasPermission="`warehouseManagement.warehouse.warehouseInfo.view`" @click="loss()">盘库</ws-button>
  86. <ws-button v-if="warehouseInfo.clearStatusFlag == 1 && warehouseType == '2'" @click="clearance()">清库</ws-button>
  87. <ws-button v-if="warehouseInfo.clearStatusFlag == 3 && warehouseType == '2'" disabled> 已清库</ws-button>
  88. <!-- createType 1手动创建 2 自动创建 -->
  89. <ws-button v-if='warehouseInfo.createType==1' v-hasPermission="`warehouseManagement.warehouse.warehouseInfo.delete`" @click="indialog = true">入库量</ws-button>
  90. <ws-button v-if='list.length>0' @click="handlTask()">任务</ws-button>
  91. <ws-button v-hasPermission="`warehouseManagement.warehouse.warehouseInfo.add`" @click="outData(1)">导出</ws-button>
  92. <ws-button @click="outData(2)">打印</ws-button>
  93. <ws-button v-hasPermission="`warehouseManagement.warehouse.warehouseInfo.kan`" @click="exportHistoricalData()">导出历史库存记录</ws-button>
  94. <ws-button @click="transformation()" v-hasPermission=" `warehouseManagement.warehouse.warehouseInfo.view`">折转</ws-button>
  95. <ws-button v-hasPermission="`warehouseManagement.warehouse.warehouseInfo.kan`" @click="handleall()">全部仓库</ws-button>
  96. <ws-button v-hasPermission="`warehouseManagement.warehouse.warehouseInfo.kan`" @click="handleMintor()">查看监控</ws-button>
  97. <ws-button @click="dryClick()">烘干入库</ws-button>
  98. <ws-button @click="materialInOut()">物料出入库</ws-button>
  99. <el-table ref='table' show-summary :summary-method="getSummaries" class="wenzi setUp_css" :data="warehouseList" style="width: 100%; margin-top: 20px" height="calc(100% - 45px)" v-if="warehouseType == '1'">
  100. <el-table-column prop="warehouseName" label="仓库名">
  101. </el-table-column>
  102. <el-table-column prop="binNumber" label="仓位编号">
  103. </el-table-column>
  104. <el-table-column prop="capacity" label="容量(吨)">
  105. <template slot-scope="scope">
  106. <div v-if="scope.row.capacity != 'null' && scope.row.capacity != null">
  107. {{ scope.row.capacity }}
  108. </div>
  109. </template>
  110. </el-table-column>
  111. <el-table-column label="货名">
  112. <template slot-scope="scope">
  113. <div style="height: 24px" v-for="(item, i) in scope.row.warehouseNumViewList" :key="i">
  114. {{ item.goodsName }}
  115. </div>
  116. </template>
  117. </el-table-column>
  118. <el-table-column label="入库量(吨)">
  119. <template slot-scope="scope">
  120. <div style="height: 24px" v-for="(item, i) in scope.row.warehouseNumViewList" :key="i">
  121. {{item.inNetWeight}}
  122. </div>
  123. </template>
  124. </el-table-column>
  125. <el-table-column label="出库量(吨)">
  126. <template slot-scope="scope">
  127. <div style="height: 24px" v-for="(item, i) in scope.row.warehouseNumViewList" :key="i">
  128. {{ item.outNetWeight == 0 ? "0":Number(item.outNetWeight).toFixed(3)}}
  129. </div>
  130. </template>
  131. </el-table-column>
  132. <el-table-column label="应余量(吨)">
  133. <template slot-scope="scope">
  134. <div style="height: 24px" v-for="(item, i) in scope.row.warehouseNumViewList" :key="i">
  135. {{ item.storage}}
  136. </div>
  137. </template>
  138. </el-table-column>
  139. </el-table>
  140. <!-- 临时库 -->
  141. <el-table class="wenzi" :data="warehouseList" style="width: 100%; margin-top: 20px" height="calc(100% - 45px)" v-if="warehouseType == '2'">
  142. <el-table-column prop="warehouseName" label="仓库名">
  143. </el-table-column>
  144. <el-table-column prop="binNumber" label="仓位编号">
  145. </el-table-column>
  146. <el-table-column prop="capacity" label="容量(吨)">
  147. <template slot-scope="scope">
  148. <div v-if="scope.row.capacity != 'null' && scope.row.capacity != null">
  149. {{ scope.row.capacity }}
  150. </div>
  151. </template>
  152. </el-table-column>
  153. <el-table-column label="货名">
  154. <template slot-scope="scope">
  155. <div style="height: 24px" v-for="(item, i) in scope.row.warehouseNumViewList" :key="i">
  156. {{ item.goodsName }}
  157. </div>
  158. </template>
  159. </el-table-column>
  160. <el-table-column label="入库量(吨)">
  161. <template slot-scope="scope">
  162. <div style="height: 24px" v-for="(item, i) in scope.row.warehouseNumViewList" :key="i">
  163. {{item.inNetWeight}}
  164. </div>
  165. </template>
  166. </el-table-column>
  167. <el-table-column label="出库量(吨)">
  168. <template slot-scope="scope">
  169. <div style="height: 24px" v-for="(item, i) in scope.row.warehouseNumViewList" :key="i">
  170. {{ item.outNetWeight }}
  171. </div>
  172. </template>
  173. </el-table-column>
  174. <el-table-column label="应余量(吨)">
  175. <template slot-scope="scope">
  176. <div style="height: 24px" v-for="(item, i) in scope.row.warehouseNumViewList" :key="i">
  177. {{ item.surplus }}
  178. </div>
  179. </template>
  180. </el-table-column>
  181. </el-table>
  182. </div>
  183. <div class="map">
  184. <div class="title"><span style="font-size:18px;font-weight: 600;margin-left:20px">{{maptitle}}</span></div>
  185. <div class="map_switch">
  186. <div :class="btnCss1" @click="mapChange(1)" v-if="warehouseType == '1'">监控</div>
  187. <div :class="btnCss2" @click="mapChange(2)">定位</div>
  188. </div>
  189. <div class="map-item" v-if="mapshow && warehousePositioning.lat && warehousePositioning.lng">
  190. <map-drag @marker="marker" ref="childMap" :isShowaddress='true' v-on:addressListen='getAddress' v-on:pickedAddress='searchAddress' :warehousePositioning="warehousePositioning"></map-drag>
  191. </div>
  192. <div v-if="!mapshow && warehouseType == '1'" class="monitor">
  193. <div v-if="!monitorUrl1" class="video1">
  194. <img src="../../../public/img/quesheng@2x.png" alt="" class="img1" />
  195. <div>监控视频未连接</div>
  196. </div>
  197. <div v-else class="video1">
  198. <iframe :src="monitorUrl1" width="440" height="360" allowfullscreen="true" webkitallowfullscreen="true"
  199. mozallowfullscreen="true" allow="autoplay; fullscreen; microphone;"></iframe>
  200. </div>
  201. <div v-if="!monitorUrl2" class="video1">
  202. <img src="../../../public/img/quesheng@2x.png" alt="" class="img1" />
  203. <div>监控视频未连接</div>
  204. </div>
  205. <div v-else class="video2">
  206. <iframe :src="monitorUrl2" width="440" height="360" allowfullscreen="true" webkitallowfullscreen="true"
  207. mozallowfullscreen="true" allow="autoplay; fullscreen; microphone;"></iframe>
  208. </div>
  209. </div>
  210. </div>
  211. <el-dialog title="修改入库量" :visible.sync="indialog" width="30%" :before-close="handleClose" top="35vh">
  212. <el-form >
  213. <el-form-item label-width="120px" label="入库量(吨)" span="1" prop="acceptanceMethod">
  214. <el-input v-model="inWarehouse" placeholder="请输入入库量" maxlength="100" size="small" type="number"/>
  215. </el-form-item>
  216. </el-form>
  217. <span slot="footer" class="dialog-footer">
  218. <el-button @click="handleClose">取 消</el-button>
  219. <el-button type="primary" @click="submit">确 定</el-button>
  220. </span>
  221. </el-dialog>
  222. <div class="mask" v-show="isShowPrintType"></div>
  223. <div class="print-type" v-show="isShowPrintType">
  224. <div class="print-type-content">
  225. <div class="print-type-title">{{headerText}}</div>
  226. <div class="print-type-checkbox">
  227. <el-form ref="form" label-width="110px">
  228. <el-form-item label="类型">
  229. <el-radio-group v-model="parameter.radio">
  230. <el-radio :label="3">入库记录</el-radio>
  231. <el-radio :label="2">出库记录</el-radio>
  232. </el-radio-group>
  233. </el-form-item>
  234. <el-form-item label="起始日期">
  235. <el-date-picker type="datetime" @change="startDataChange" format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss" placeholder="请选择起始日期" v-model="parameter.printStartDate" default-time="00:00:00"></el-date-picker>
  236. <!-- <el-date-picker v-model="value3" type="datetime" placeholder="选择日期时间" default-time="12:00:00"></el-date-picker> -->
  237. </el-form-item>
  238. <el-form-item label="截止日期">
  239. <el-date-picker type="datetime" @change="endDataChange" format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss" placeholder="请选择截止日期" v-model="parameter.printEndDate" default-time="00:00:00">
  240. </el-date-picker>
  241. </el-form-item>
  242. <!-- <el-form-item label="截止日期1">
  243. <el-date-picker value-format="timestamp" type="date" placeholder="请选择截止日期" v-model="parameter.endDate1">
  244. </el-date-picker>
  245. </el-form-item> -->
  246. <!--仓库名称-->
  247. <el-form-item label="仓库名称" span="1" prop="warehouseName">
  248. <el-select @change="warehousechange" v-model="parameter.warehouseName" placeholder="请选择仓库名称" filterable clearable>
  249. <el-option v-if="headerText != '打印记录'" key="" label="全部仓库" value="全部仓库" />
  250. <el-option v-for="item in warehouseAllXiaLa" :key="item.warehouseName" :label="item.warehouseName" :value="item.warehouseName" />
  251. </el-select>
  252. </el-form-item>
  253. <el-form-item label="仓库类型" span="1" prop="warehouseName">
  254. <el-select v-model="parameter.binNumber" placeholder="请选择仓库类型" filterable clearable >
  255. <el-option v-for="item in typeList" :key="item.id" :label="item.binNumber" :value="item.binNumber" />
  256. </el-select>
  257. </el-form-item>
  258. <!-- <el-form-item label="增量比例(%)" v-if="headerText == '打印记录'">
  259. <el-input placeholder="请输入增量比例" v-model="parameter.proportion" clearable class="proportion_css">
  260. </el-input>
  261. </el-form-item> -->
  262. </el-form>
  263. </div>
  264. </div>
  265. <div class="bottom-btn">
  266. <el-button @click="submitClick()">确定</el-button>
  267. <el-button @click="removePrint">取消</el-button>
  268. </div>
  269. </div>
  270. <div class="mask" v-show="isShowPrintType1"></div>
  271. <div class="print-type" v-show="isShowPrintType1">
  272. <div class="print-type-content">
  273. <div class="print-type-title">{{headerText1}}</div>
  274. <div class="print-type-checkbox">
  275. <el-form ref="form" label-width="110px">
  276. <el-form-item label="起始日期">
  277. <el-date-picker value-format="yyyy-MM-dd" type="date" placeholder="请选择起始日期" v-model="parameter.startDate">
  278. </el-date-picker>
  279. </el-form-item>
  280. <el-form-item label="截止日期">
  281. <el-date-picker value-format="yyyy-MM-dd" type="date" placeholder="请选择截止日期" v-model="parameter.endDate">
  282. </el-date-picker>
  283. </el-form-item>
  284. <!--仓库名称-->
  285. <el-form-item label="仓库名称" span="1" prop="warehouseName">
  286. <el-select v-model="parameter.warehouseName" placeholder="请选择仓库名称" filterable clearable>
  287. <el-option key="" label="全部仓库" value="全部仓库" />
  288. <el-option v-for="item in warehouseAllXiaLa" :key="item.warehouseName" :label="item.warehouseName" :value="item.warehouseName" />
  289. </el-select>
  290. </el-form-item>
  291. </el-form>
  292. </div>
  293. </div>
  294. <div class="bottom-btn">
  295. <el-button @click="submitClick1()">确定</el-button>
  296. <el-button @click="removePrint1">取消</el-button>
  297. </div>
  298. </div>
  299. </div>
  300. </template>
  301. <script>
  302. import {
  303. getList,
  304. getsponsible,
  305. clearancee,
  306. xiala,
  307. getQualityZhe,
  308. getQualityReal,
  309. exportHistoricalInventory,
  310. postExport,
  311. addselectinfoList,
  312. printAdd,
  313. postExportOut,
  314. getreserves,
  315. getResponsible,
  316. deletewarehouse,
  317. postInWeight,
  318. getwarehousNameNew,
  319. getbintype
  320. } from '@/model/warehouse/index'
  321. import mapDrag from '@/components/mapdrag/warehouseMap'
  322. import {
  323. downloadFile
  324. } from '@/utils/batchDown'
  325. import {
  326. dayjs,
  327. EventBus
  328. } from 'base-core-lib'
  329. import Pagination from '@/components/Pagination'
  330. import WsUpload from '@/components/WsUpload'
  331. import axios from 'axios'
  332. export default {
  333. name: 'viewSpareMoney',
  334. components: {
  335. WsUpload,
  336. Pagination,
  337. mapDrag,
  338. axios
  339. },
  340. watch: {
  341. vesselId(val) {
  342. this.getList()
  343. },
  344. isShow(val) {
  345. this.showType = val
  346. },
  347. },
  348. data() {
  349. return {
  350. value: '0',
  351. rules:{},
  352. options:[],
  353. StartDate:'',
  354. compId: localStorage.getItem('ws-pf_compId'),
  355. deptBudgetList:{},
  356. dateTime:'',
  357. list:[],
  358. warehouseList:[],
  359. warehouseType:'1',
  360. totalStorage:0,
  361. radio:0,
  362. tableHeader:[],
  363. tableData: [],
  364. totalReserves:[],
  365. warehouseXiaLa:[],
  366. warehouseInfo:{
  367. warehouseName:''
  368. },
  369. lineColor:['#5878E8','#50CAD4','#FF9F24','#E87C25','#27727B','#FE8463','#9BCA63','#FAD860','#F3A43B','#60C0DD', '#D7504B','#C6E579','#F4E001','#F0805A','#26C0C0'],
  370. warehouseXiaLaCopy:[],
  371. warehouseAllXiaLa:[],
  372. responsible:'',
  373. maptitle:'库点监控',
  374. btnCss1:'btn1',
  375. btnCss2:'btn',
  376. mapshow:false,
  377. indialog:false,
  378. inWarehouse:'',
  379. parameter:{
  380. startDate:'',
  381. endDate:'',
  382. },
  383. EndDate:'',
  384. isShowPrintType: false, //打印
  385. headerText: '',
  386. typeList:[],
  387. isShowPrintType1: false,
  388. headerText1: '导出历史库存记录',
  389. date: {
  390. year: dayjs().format('YYYY'),
  391. month: dayjs().format('MM'),
  392. },
  393. warehousePositioning:{},
  394. monitorUrl1:'',
  395. monitorUrl2:''
  396. }
  397. },
  398. activated() {
  399. this.tableData = []
  400. this.getList()
  401. // this.$refs.childMap.clearVal()
  402. this.showType = this.isShow
  403. },
  404. methods: {
  405. startDataChange(e){
  406. var d = new Date(e);
  407. let year = d.getFullYear()
  408. let month = (d.getMonth() + 1)
  409. month= month<10?'0'+month:month
  410. let date = d.getDate()<10?'0'+d.getDate():d.getDate()
  411. let hours = d.getHours()<10?'0'+d.getHours():d.getHours()
  412. let minutes = d.getMinutes()<10?'0'+d.getMinutes():d.getMinutes()
  413. let seconds = d.getSeconds()<10?'0'+d.getSeconds():d.getSeconds()
  414. this.parameter.printStartDate = year + '-' + month+ '-' +date + ' '+hours+':'+minutes+':'+seconds;
  415. },
  416. endDataChange(e){
  417. var d = new Date(e);
  418. let year = d.getFullYear()
  419. let month = (d.getMonth() + 1)
  420. month= month<10?'0'+month:month
  421. let date = d.getDate()<10?'0'+d.getDate():d.getDate()
  422. let hours = d.getHours()<10?'0'+d.getHours():d.getHours()
  423. let minutes = d.getMinutes()<10?'0'+d.getMinutes():d.getMinutes()
  424. let seconds = d.getSeconds()<10?'0'+d.getSeconds():d.getSeconds()
  425. this.parameter.printEndDate = year + '-' + month+ '-' +date + ' '+hours+':'+minutes+':'+seconds;
  426. },
  427. warehousechange(e){
  428. for (let i = 0; i < this.warehouseAllXiaLa.length; i++) {
  429. if(this.warehouseAllXiaLa[i].warehouseName==e){
  430. getbintype({baseId:this.warehouseAllXiaLa[i].id}).toPromise()
  431. .then((response) => {
  432. console.log(response)
  433. this.typeList=response
  434. })
  435. }
  436. }
  437. },
  438. //导出、打印EndDate
  439. outData(index) {
  440. if (index == 1) {
  441. this.headerText = '导出记录'
  442. } else if (index == 2) {
  443. this.headerText = '打印记录'
  444. let date = new Date()
  445. var year = date.getFullYear();
  446. var month = date.getMonth() + 1;
  447. var strDate = date.getDate()
  448. if(strDate<10){
  449. strDate = '0'+strDate
  450. }
  451. var pastdate = new Date(date.getTime() - 24 * 60 * 60 * 1000)
  452. this.StartDate =pastdate.getFullYear() + '-' + (pastdate.getMonth() + 1) + '-' + (pastdate.getDate()>10?pastdate.getDate():'0'+pastdate.getDate())+' 00:00:00'
  453. // this.StartDate = new Date(pastdate.getFullYear() + '-' + (pastdate.getMonth() + 1) + '-' + (pastdate.getDate()>10?pastdate.getDate():'0'+pastdate.getDate())+' 00:00:00')
  454. this.$set(this.parameter,'printStartDate',this.StartDate)
  455. // parameter.printStartDate
  456. this.EndDate = '' + year + '-' + month + '-' + strDate+' 00:00:00'
  457. this.$set(this.parameter,'printEndDate',this.EndDate)
  458. }
  459. this.$forceUpdate();
  460. this.isShowPrintType = true
  461. },
  462. removePrint() {
  463. this.parameter.warehouseName = ''
  464. this.parameter.proportion = ''
  465. this.isShowPrintType = false
  466. },
  467. async submitClick() {
  468. if (!this.parameter.radio && this.headerText == '打印记录') {
  469. this.$message.error('请选择打印的类型')
  470. return
  471. }
  472. if (!this.parameter.printStartDate) {
  473. this.$message.error('请选择打印的起始日期')
  474. return
  475. }
  476. if (!this.parameter.printEndDate) {
  477. this.$message.error('请选择打印的截止日期')
  478. return
  479. }
  480. if (!this.parameter.warehouseName) {
  481. this.$message.error('请选择所要打印的仓库')
  482. return
  483. }
  484. if(this.parameter.warehouseName == '全部仓库'){
  485. this.parameter.warehouseName = ''
  486. }
  487. if(this.parameter.binNumber == '全部仓位'){
  488. this.parameter.binNumber = ''
  489. }
  490. // let enddate = new Date(this.parameter.endDate).toLocaleString()//将截止时间的时间戳转为时间
  491. // this.parameter.endDate = enddate.split(' ')[0].replace('/' ,'-').replace('/','-')
  492. this.parameter.warehouseName = this.parameter.warehouseName.replace('(临)','')
  493. this.isShowPrintType = false
  494. if (this.headerText == '导出记录') {
  495. if (this.parameter.radio == 3) {
  496. const {
  497. data
  498. } = await postExport({
  499. startDate: this.parameter.printStartDate,
  500. endDate: this.parameter.printEndDate,
  501. warehouseName: this.parameter.warehouseName,
  502. }, {}, {
  503. responseType: 'blob'
  504. }).toPromise()
  505. downloadFile({
  506. res: data,
  507. fileName: `${
  508. this.date.year + (this.date.month ? `-${this.date.month}` : '')
  509. }导出入库记录`,
  510. type: 'xls',
  511. })
  512. } else if (this.parameter.radio == 2) {
  513. const {
  514. data
  515. } = await postExportOut({
  516. startDate: this.parameter.printStartDate,
  517. endDate: this.parameter.printEndDate,
  518. warehouseName: this.parameter.warehouseName,
  519. }, {}, {
  520. responseType: 'blob'
  521. }).toPromise()
  522. downloadFile({
  523. res: data,
  524. fileName: `${
  525. this.date.year + (this.date.month ? `-${this.date.month}` : '')
  526. }导出出库记录`,
  527. type: 'xls',
  528. })
  529. }
  530. } else if (this.headerText == '打印记录') {
  531. if(this.parameter.binNumber=='全部合营'){
  532. this.parameter.binNumber=''
  533. }
  534. addselectinfoList({
  535. compId: localStorage.getItem('ws-pf_compId'),
  536. printStartDate: this.parameter.printStartDate,
  537. printEndDate: this.parameter.printEndDate,
  538. warehouseName: this.parameter.warehouseName,
  539. binNumber:this.parameter.binNumber,
  540. searchType: this.parameter.radio,
  541. currentPage: 1,
  542. pageSize: 999,
  543. statusFlag:3
  544. }).toPromise()
  545. .then((response) => {
  546. if (response.records.length == 0) {
  547. this.$message.error('暂未查到所要打印的出入库信息')
  548. } else {
  549. var warehousePrint = response.records
  550. if (this.parameter.proportion) {
  551. var countWeight = 0
  552. for (let i = 0; i < warehousePrint.length; i++) {
  553. countWeight += Number(warehousePrint[i].netWeight)
  554. }
  555. var increment = (countWeight * (Number(this.parameter.proportion) / 100)).toFixed(2) //所要增加的量
  556. printAdd().toPromise()
  557. .then((response1) => {
  558. // setTimeout(function(){
  559. for (let i = 0; i < response1.length; i++) {
  560. increment = Number(increment)
  561. if (increment > 0) {
  562. let index = Math.abs(Math.round(Math.random() * response1.length - 1))
  563. let pro = response1[index] //取出假数据并设定值
  564. pro.netWeight = Number((Math.random() * (70 - 10 + 1) + 10).toFixed(2))
  565. pro.tare = Number((Math.random() * (20 - 10 + 1) + 10).toFixed(2))
  566. // pro.grossWeight = Number((pro.tare + pro.netWeight).toFixed(2))
  567. if (pro.netWeight < increment) { //随机净重 小于 所要增量
  568. increment = (increment - pro.netWeight).toFixed(2) //所要增的量
  569. if (increment < 10 && pro.netWeight <= 60) {
  570. pro.netWeight += Number(increment)
  571. pro.grossWeight = Number((pro.tare + pro.netWeight).toFixed(2))
  572. increment = 0
  573. warehousePrint.push(pro)
  574. } else {
  575. increment -= pro.netWeight
  576. pro.grossWeight = Number((pro.tare + pro.netWeight).toFixed(2))
  577. warehousePrint.push(pro)
  578. }
  579. } else { //随机净重 大于 所要增量
  580. pro.netWeight = Number(increment.toFixed(2))
  581. pro.grossWeight = Number((pro.tare + pro.netWeight).toFixed(2))
  582. increment = 0
  583. warehousePrint.push(pro)
  584. }
  585. response1.splice(index, 1) //删除已添加过得假数据车牌号
  586. if (response1.length == 0) {
  587. sessionStorage.setItem('inOutWarehouse_Print', JSON.stringify(warehousePrint))
  588. let _canshu = ''
  589. _canshu = this.parameter.radio + '&warehouseName=' + this.parameter.warehouseName +
  590. '&startDate=' + this.parameter.printStartDate + '&endDate=' + this.parameter.printEndDate
  591. window.open('../../../../../static/warehousePrint.html?type=' + _canshu)
  592. }
  593. } else { //增量为0时
  594. break
  595. }
  596. }
  597. //跳转
  598. sessionStorage.setItem('inOutWarehouse_Print', JSON.stringify(warehousePrint))
  599. let _canshu = ''
  600. _canshu = this.parameter.radio + '&warehouseName=' + this.parameter.warehouseName +
  601. '&startDate=' + this.parameter.printStartDate + '&endDate=' + this.parameter.printEndDate
  602. window.open('../../../../../static/warehousePrint.html?type=' + _canshu)
  603. })
  604. } else { //没有增量比例的直接打印
  605. sessionStorage.setItem('inOutWarehouse_Print', JSON.stringify(response.records))
  606. let _canshu1 = ''
  607. _canshu1 = this.parameter.radio + '&warehouseName=' + this.parameter.warehouseName +
  608. '&startDate=' + this.parameter.printStartDate + '&endDate=' + this.parameter.printEndDate
  609. window.open('../../../../../static/warehousePrint.html?type=' + _canshu1)
  610. }
  611. }
  612. })
  613. }
  614. },
  615. //导出历史库存记录
  616. exportHistoricalData() {
  617. let date = new Date()
  618. var year = date.getFullYear();
  619. var month = date.getMonth() + 1;
  620. var strDate = date.getDate()
  621. var pastdate = new Date(date.getTime() - 24 * 60 * 60 * 1000)
  622. this.parameter.startDate = pastdate.getFullYear() + '-' + (pastdate.getMonth() + 1) + '-' + pastdate.getDate()
  623. this.parameter.endDate = '' + year + '-' + month + '-' + strDate
  624. this.$forceUpdate();
  625. this.isShowPrintType1 = true
  626. },
  627. removePrint1() {
  628. this.parameter.warehouseName = ''
  629. this.parameter.proportion = ''
  630. this.isShowPrintType1 = false
  631. },
  632. async submitClick1() {
  633. if (!this.parameter.startDate) {
  634. this.$message.error('请选择打印的起始日期')
  635. return
  636. }
  637. if (!this.parameter.endDate) {
  638. this.$message.error('请选择打印的截止日期')
  639. return
  640. }
  641. if (new Date(this.parameter.endDate).getTime() < new Date(this.parameter.startDate).getTime()) {
  642. this.$message.error('截止日期输入错误')
  643. return
  644. }
  645. if (this.parameter.warehouseName == '全部仓库') {
  646. this.parameter.warehouseName = ''
  647. }
  648. if(this.parameter.binNumber == '全部仓位'){
  649. this.parameter.binNumber = ''
  650. }
  651. const {
  652. data
  653. } = await exportHistoricalInventory({
  654. startDate: this.parameter.startDate,
  655. endDate: this.parameter.endDate,
  656. warehouseName: this.parameter.warehouseName
  657. }, {}, {
  658. responseType: 'blob'
  659. }).toPromise()
  660. downloadFile({
  661. res: data,
  662. fileName: `${this.date.year + (this.date.month ? `-${this.date.month}` : '')
  663. }导出历史库存记录`,
  664. type: 'xls',
  665. })
  666. },
  667. handleClose(){
  668. this.indialog = false
  669. },
  670. submit(){
  671. if(!this.inWarehouse){
  672. this.$message.error('请输入入库量')
  673. return
  674. }
  675. if(Number(this.warehouseInfo.warehouseNumViewList[0].outNetWeight) > Number(this.inWarehouse)){
  676. this.$message.error('入库量不可小于已出库量')
  677. return
  678. }
  679. if (String(this.inWarehouse).indexOf('.') != -1 && String(this.inWarehouse).length - (String(this.inWarehouse).indexOf('.') + 1) > 3) {
  680. this.$message.error('入库量输入错误')
  681. return
  682. }
  683. if(Number(this.warehouseInfo.maxInStorage) < Number(this.inWarehouse)){
  684. this.$message.error('入库量不可超过合同上限')
  685. return
  686. }
  687. let InnetWeight = {
  688. baseId: this.warehouseInfo.warehouseId,
  689. netWeight:this.inWarehouse
  690. }
  691. postInWeight(InnetWeight)
  692. .toPromise()
  693. .then((response) => {
  694. this.$notify.success({
  695. title: '成功',
  696. message: '修改成功',
  697. })
  698. this.indialog = false,
  699. this.inWarehouse = '',
  700. this.getList1()
  701. })
  702. .catch((response) => {
  703. // EventBus.$emit('error', this.$t('showMessage.asteriskRequired'))
  704. })
  705. },
  706. initCharts(){
  707. let _x = []
  708. let _y = []
  709. for (var i = 0; i < this.totalReserves.length; i++) {
  710. if(this.warehouseType == '1'){
  711. _x.push(this.totalReserves[i].goodsName)
  712. _y.push(this.totalReserves[i].stockNum)
  713. }else{
  714. _x.push(this.totalReserves[i].goodsName)
  715. _y.push(this.totalReserves[i].surplus)
  716. }
  717. }
  718. // 柱状图
  719. let myChart7 = this.$echarts.init(this.$refs.myEchart7);
  720. var zoption = {
  721. grid: {
  722. left: '0',
  723. right: '0',
  724. bottom: '0',
  725. top: '30',
  726. containLabel: true
  727. },
  728. // --- 提示框 ----
  729. tooltip: {
  730. show: true, // 是否显示提示框,默认为true
  731. trigger: 'item', // 数据项图形触发
  732. axisPointer: { // 指示样式
  733. type: 'shadow',
  734. axis: 'auto'
  735. },
  736. padding: 5,
  737. textStyle: { // 提示框内容的样式
  738. color: '#fff'
  739. }
  740. },
  741. // ------ X轴 ------
  742. xAxis: {
  743. axisLabel: { // 坐标轴标签
  744. show: true, // 是否显示
  745. inside: false, // 是否朝内
  746. rotate: 0, // 旋转角度
  747. margin: 10, // 刻度标签与轴线之间的距离
  748. color: '#929AB8', // 默认取轴线的颜色
  749. interval: 0,
  750. },
  751. splitArea: { // 网格区域
  752. show: false // 是否显示,默认为false
  753. },
  754. data: _x
  755. },
  756. // ------ y轴 ----------
  757. yAxis: {
  758. axisLine: { // 坐标轴 轴线
  759. show: false, // 是否显示
  760. },
  761. axisLabel: { // 坐标轴的标签
  762. show: true, // 是否显示
  763. inside: false, // 是否朝内
  764. rotate: 0, // 旋转角度
  765. margin: 8, // 刻度标签与轴线之间的距离
  766. color: '#929AB8', // 默认轴线的颜色
  767. },
  768. splitLine: { // gird 区域中的分割线
  769. show: true, // 是否显示
  770. lineStyle: {
  771. color: '#D9DDE7',
  772. width: 1,
  773. type: 'dashed'
  774. }
  775. }
  776. },
  777. // ------- 内容数据 -------
  778. series: [{
  779. name: '储量', // 序列名称
  780. type: 'bar', // 类型
  781. legendHoverLink: true, // 是否启用图列 hover 时的联动高亮
  782. // label: { // 图形上的文本标签
  783. // show: false,
  784. // position: 'insideTop', // 相对位置
  785. // rotate: 0, // 旋转角度
  786. // color: '#eee'
  787. // },
  788. itemStyle: { // 图形的形状
  789. // color: lineColor[index++]
  790. // barBorderRadius: [18, 18, 0 ,0]
  791. color: function(params) {
  792. var colorList = [ '#5878E8','#50CAD4','#FF9F24','#E87C25','#27727B','#FE8463','#9BCA63','#FAD860','#F3A43B','#60C0DD', '#D7504B','#C6E579','#F4E001','#F0805A','#26C0C0'];
  793. return colorList[params.dataIndex]
  794. },
  795. },
  796. barWidth: 20, // 柱形的宽度
  797. barCategoryGap: '20%', // 柱形的间距
  798. label: {
  799. show: true,
  800. position: 'top',
  801. color: '#000000'
  802. },
  803. data: _y
  804. }]
  805. };
  806. myChart7.setOption(zoption)
  807. },
  808. mapChange(num){
  809. if(num == 1){
  810. this.mapshow = false
  811. this.btnCss1 = 'btn1'
  812. this.btnCss2 = 'btn'
  813. this. maptitle = '库点监控'
  814. }else if(num == 2){
  815. this.mapshow = true
  816. this.btnCss1 = 'btn'
  817. this.btnCss2 = 'btn1'
  818. this. maptitle = '定位'
  819. }
  820. },
  821. getAddress(data) {
  822. this.deptBudgetList.warehousePrivate =data[0]
  823. this.deptBudgetList.warehouseCity =data[1]
  824. this.deptBudgetList.warehouseArea =data[2]
  825. },
  826. searchAddress(e) {
  827. this.deptBudgetList.warehousePositioning =e.lat + ',' + e.lng
  828. },
  829. marker: function(item) {
  830. this.deptBudgetList.warehousePositioning =
  831. item.lnglat.lat + ',' + item.lnglat.lng
  832. },
  833. handleMintor(){
  834. this.$router.push({
  835. path: 'warehouseManagementMintor'
  836. })
  837. },
  838. dryClick(){
  839. this.$router.push({
  840. path: 'dryWarehousing'
  841. })
  842. },
  843. materialInOut(){
  844. this.$router.push({
  845. path: 'materialInOutWarehouse'
  846. })
  847. },
  848. handleall(){
  849. this.$router.push({
  850. path: 'warehouseManagement'
  851. })
  852. },
  853. selectstaff(e){
  854. this.warehouseInfo.warehouseName = e
  855. for(var tmp = 0 ; tmp < this.warehouseAllXiaLa.length; tmp++){
  856. if(this.warehouseAllXiaLa[tmp].warehouseName == e){
  857. this.warehouseType = this.warehouseAllXiaLa[tmp].warehouseType
  858. this.monitorUrl1 = this.warehouseAllXiaLa[tmp].monitorUrl1
  859. this.monitorUrl2 = this.warehouseAllXiaLa[tmp].monitorUrl2
  860. if(this.warehouseType == '2'){
  861. this.maptitle = '定位'
  862. this.btnCss2 ='btn1'
  863. this.mapshow = true
  864. }else{
  865. this.maptitle = '库点监控'
  866. this.btnCss1 ='btn1'
  867. this.btnCss2 ='btn'
  868. this.mapshow = false
  869. }
  870. break
  871. }
  872. }
  873. this.warehouseXiaLa = this.warehouseXiaLaCopy
  874. if(this.warehouseInfo.warehouseName.indexOf('(临)') != -1){
  875. this.warehouseInfo.warehouseName = this.warehouseInfo.warehouseName.replace(' (临)','')
  876. }
  877. this.getList1()
  878. },
  879. warehouseQuery(query){
  880. if(query){
  881. this.warehouseXiaLa = this.warehouseAllXiaLa
  882. this.warehouseXiaLa = this.warehouseAllXiaLa.filter(item=>item.warehouseName.indexOf(query)>-1)
  883. }else{
  884. this.warehouseXiaLa = this.warehouseXiaLaCopy
  885. }
  886. },
  887. getCurrentDate(format) {
  888. var now = new Date();
  889. var year = now.getFullYear(); //得到年份
  890. var month = now.getMonth();//得到月份
  891. var date = now.getDate();//得到日期
  892. var day = now.getDay();//得到周几
  893. var hour = now.getHours();//得到小时
  894. var minu = now.getMinutes();//得到分钟
  895. var sec = now.getSeconds();//得到秒
  896. month = month + 1;
  897. if (month < 10) month = '0' + month;
  898. if (date < 10) date = '0' + date;
  899. if (hour < 10) hour = '0' + hour;
  900. if (minu < 10) minu = '0' + minu;
  901. if (sec < 10) sec = '0' + sec;
  902. var time = '';
  903. //精确到天
  904. if(format==1){
  905. time = year + '-' + month + '-' + date;
  906. }
  907. //精确到分
  908. else if(format==2){
  909. time = year + '-' + month + '-' + date+ ' ' + hour + ':' + minu + ':' + sec;
  910. }
  911. return time;
  912. },
  913. //添加
  914. handleAdd() {
  915. this.$router.push({
  916. path: 'warehouseNewManagementAdd'
  917. })
  918. },
  919. //编辑
  920. handleEdit() {
  921. this.$router.push({
  922. path: 'warehouseNewManagementEdit'
  923. })
  924. },
  925. //查看
  926. handleLook() {
  927. this.$router.push({
  928. name: 'warehouseManagementLookNew'
  929. })
  930. },
  931. //删除仓库
  932. handleDelete() {
  933. for(var num = 0 ; num < this.warehouseList.length; num++){//删除仓库前应当判断是否有库存
  934. for(var num_item = 0 ; num_item < this.warehouseList[num].warehouseNumViewList.length ; num_item++){
  935. if(this.warehouseType == 2){
  936. if(Number(this.warehouseList[num].warehouseNumViewList[num_item].surplus) > 0){
  937. this.$message.error('删除前应清空库存!')
  938. return
  939. }
  940. }else if(this.warehouseType == 1){
  941. if(Number(this.warehouseList[num].warehouseNumViewList[num_item].storage) > 0){
  942. this.$message.error('删除前应清空库存!')
  943. return
  944. }
  945. }
  946. }
  947. }
  948. this.$confirm(`确认删除`+this.warehouseInfo.warehouseName+`?`, {
  949. cancelButtonText: '取消',
  950. confirmButtonText: '确定',
  951. type: 'warning',
  952. })
  953. .then(() => {
  954. deletewarehouse({ id: this.warehouseInfo.warehouseId })
  955. .toPromise()
  956. .then((response) => {
  957. this.$notify.success({
  958. title: '成功',
  959. message: '删除成功',
  960. })
  961. this.getList1()
  962. })
  963. .catch((response) => {
  964. // EventBus.$emit('error', this.$t('showMessage.asteriskRequired'))
  965. })
  966. })
  967. .catch(() => {
  968. return false
  969. })
  970. },
  971. //记录
  972. record() {
  973. this.$router.push({
  974. path: 'warehouseNewManagementRecord',
  975. query: {
  976. baseId: this.warehouseInfo.warehouseId,
  977. positionId: this.warehouseInfo.binNumberId,
  978. warehouseName: this.warehouseInfo.warehouseName,
  979. remark: this.warehouseInfo.remark,
  980. binNumber: this.warehouseInfo.binNumber,
  981. capacity: this.warehouseInfo.capacity,
  982. warehouseType: this.warehouseType,
  983. },
  984. })
  985. },
  986. //盘损
  987. loss() {
  988. this.$router.push({
  989. path: 'warehouseNewManagementIoss',
  990. query: {
  991. baseId: this.warehouseInfo.warehouseId,
  992. positionId: this.warehouseInfo.binNumberId,
  993. warehouseName: this.warehouseInfo.warehouseName,
  994. binNumber: this.warehouseInfo.binNumber,
  995. },
  996. })
  997. },
  998. //清仓
  999. clearance() {
  1000. if (this.warehouseInfo.outNumber > 0) {
  1001. this.$confirm(`你还有未完善的出库记录,请完善提交后再进行操作`, {
  1002. cancelButtonText: '关闭',
  1003. })
  1004. .then(() => {})
  1005. .catch(() => {
  1006. return false
  1007. })
  1008. } else {
  1009. this.$confirm(
  1010. `清库操作代表库存已清零,清库后不可进行出库操作,是否确定清库`, {
  1011. confirmButtonText: '确定',
  1012. cancelButtonText: '取消',
  1013. type: 'warning',
  1014. }
  1015. )
  1016. .then(() => {
  1017. clearancee({
  1018. id: this.warehouseInfo.warehouseId
  1019. })
  1020. .toPromise()
  1021. .then((response) => {
  1022. this.$notify.success({
  1023. title: '成功',
  1024. message: '状态清库成功',
  1025. })
  1026. this.getList1()
  1027. })
  1028. .catch((response) => {})
  1029. })
  1030. .catch(() => {
  1031. return false
  1032. })
  1033. }
  1034. },
  1035. //任务
  1036. handlTask() {
  1037. var arr = []
  1038. for (let i = 0; i < this.list.length; i++) {
  1039. arr.push(this.list[i].warehouseName)
  1040. }
  1041. this.$router.push({
  1042. path: 'tranManagementWarehouseInOutTask',
  1043. query: {
  1044. // stringList: arr,
  1045. // warehouseBaseInfoList: JSON.stringify(this.list)
  1046. }
  1047. })
  1048. },
  1049. getSummaries(param) {
  1050. const {
  1051. columns,
  1052. data
  1053. } = param
  1054. const sums = []
  1055. columns.forEach((column, index) => {
  1056. if (index === 0) {
  1057. sums[index] = '合计'
  1058. } else if (
  1059. index === 4 ||
  1060. index === 5 ||
  1061. index === 6
  1062. ) {
  1063. const values = data.map((item) => {
  1064. var val = item.warehouseNumViewList.map((items) => {
  1065. if (column.label == '入库量(吨)') {
  1066. return items.inNetWeight
  1067. } else if (column.label == '出库量(吨)') {
  1068. return items.outNetWeight
  1069. } else if (column.label == '应余量(吨)') {
  1070. return items.storage
  1071. } else if (column.label == '应余量(吨)') {
  1072. return items.storage
  1073. }
  1074. })
  1075. return val
  1076. })
  1077. if (!values.every((value) => isNaN(value))) {
  1078. sums[index] = values.reduce((prev, curr) => {
  1079. if (curr.length > 1) {
  1080. var num = 0
  1081. for (let i = 0; i < curr.length; i++) {
  1082. num += Number(curr[i])
  1083. }
  1084. return Number(prev) + num
  1085. } else {
  1086. const value = Number(curr)
  1087. if (!isNaN(value)) {
  1088. return Number(prev) + Number(curr)
  1089. } else {
  1090. return Number(prev)
  1091. }
  1092. }
  1093. }, 0)
  1094. } else {
  1095. sums[index] = '--'
  1096. }
  1097. } else {
  1098. sums[index] = '--'
  1099. }
  1100. })
  1101. if (typeof sums[4] == 'number') {
  1102. sums[4] = sums[4].toFixed(3)
  1103. }
  1104. if (typeof sums[5] == 'number') {
  1105. sums[5] = sums[5].toFixed(3)
  1106. }
  1107. if (typeof sums[6] == 'number') {
  1108. sums[6] = sums[6].toFixed(3)
  1109. }
  1110. return sums
  1111. },
  1112. // 折转
  1113. transformation(){
  1114. this.$router.push({
  1115. path: 'transformation',
  1116. query:{warehouseId:this.warehouseInfo.warehouseId,warehouseName:this.warehouseInfo.warehouseName,binNumberId:this.warehouseInfo.binNumberId,warehouseType:this.warehouseType}//warehouseType 1常用 2临时
  1117. })
  1118. },
  1119. getList() {
  1120. getreserves({compId: localStorage.getItem('ws-pf_compId'),}).toPromise()
  1121. .then((response) => {
  1122. var obj={'类型':'库内储量'},obj1={'类型':'移库在途'},obj2={'类型':'采购在途'},obj3={'类型':'销售在途'},obj4={'类型':'合计'},obj5={'类型':'货值'}
  1123. var arr=response.map(item => {
  1124. obj[item.goodsName]=item.stockNum
  1125. obj1[item.goodsName]=item.moveNum
  1126. obj2[item.goodsName]=item.purchaseNum
  1127. obj3[item.goodsName]=item.saleNum
  1128. return item.goodsName
  1129. });
  1130. arr.unshift('类型')
  1131. for (const i in obj) {
  1132. if(i!='类型'){
  1133. var num=obj[i]+obj1[i]+obj2[i]+obj3[i]
  1134. obj4[i]=num.toFixed(3)
  1135. }
  1136. }
  1137. this.tableData.push(obj)
  1138. this.tableData.push(obj1)
  1139. this.tableData.push(obj2)
  1140. this.tableData.push(obj3)
  1141. this.tableData.push(obj4)
  1142. this.tableHeader=arr
  1143. })
  1144. this.dateTime=this.getCurrentDate(1)
  1145. // 仓储部负责人
  1146. getResponsible({
  1147. compId: localStorage.getItem('ws-pf_compId'),
  1148. })
  1149. .toPromise()
  1150. .then((response) => {
  1151. this.responsible = response[0].staffName
  1152. })
  1153. // 仓库名称
  1154. getwarehousNameNew({
  1155. compId: localStorage.getItem('ws-pf_compId')
  1156. })
  1157. .toPromise()
  1158. .then((response) => {
  1159. this.warehouseXiaLa = response
  1160. this.warehouseXiaLaCopy = response
  1161. this.warehouseInfo.warehouseName = this.warehouseXiaLa[0].warehouseName
  1162. this.monitorUrl1 = this.warehouseXiaLa[0].monitorUrl1
  1163. this.monitorUrl2 = this.warehouseXiaLa[0].monitorUrl2
  1164. for(var tmp = 0 ; tmp < response.length ; tmp++){
  1165. if(response[tmp].warehouseType == '2'){
  1166. response[tmp].warehouseName = response[tmp].warehouseName + ' (临)'
  1167. }
  1168. }
  1169. this.warehouseAllXiaLa = response
  1170. this.getList1()
  1171. })
  1172. getsponsible({
  1173. compId: localStorage.getItem('ws-pf_compId')
  1174. }).toPromise()
  1175. .then((response) => {
  1176. this.list = response
  1177. })
  1178. },
  1179. changeWeight(e) {
  1180. //实际重量
  1181. if(e == '0'){
  1182. getQualityReal({
  1183. compId: localStorage.getItem('ws-pf_compId'),
  1184. warehouseName: this.warehouseInfo.warehouseName
  1185. })
  1186. .toPromise()
  1187. .then((response) => {
  1188. this.totalReserves = response.warehouseNumViewList
  1189. this.initCharts()
  1190. })
  1191. }else{
  1192. getQualityZhe({
  1193. compId: localStorage.getItem('ws-pf_compId'),
  1194. baseId: this.warehouseInfo.warehouseId
  1195. }).toPromise().then((response) => {
  1196. console.log(this.totalReserves)
  1197. this.totalMoney1 = 0
  1198. this.totalMoney2 = 0
  1199. for (let j = 0; j < this.totalReserves.length; j++) {
  1200. if (this.totalReserves[j].cost && this.totalReserves[j].stockNum) {
  1201. if (this.totalReserves[j].goodsName.indexOf('玉米') != -1) {
  1202. this.totalReserves[j].totalMoney1 = (Number(this.totalReserves[j].cost) * Number(this.totalReserves[j].stockNum)).toFixed(3)
  1203. this.totalMoney1 = (Number(this.totalMoney1) + Number(this.totalReserves[j].totalMoney1)).toFixed(3)
  1204. }
  1205. else if (this.totalReserves[j].goodsName.indexOf('高粱') != -1) {
  1206. this.totalReserves[j].totalMoney2 = (Number(this.totalReserves[j].cost) * Number(this.totalReserves[j].stockNum)).toFixed(3)
  1207. this.totalMoney2 = (Number(this.totalMoney2) + Number(this.totalReserves[j].totalMoney2)).toFixed(3)
  1208. }
  1209. }
  1210. }
  1211. console.log(this.totalReserves)
  1212. if (response.warehouseNumViewList.length != 0) {
  1213. var result = []
  1214. for (let i = 0; i < response.warehouseNumViewList.length; i++) {
  1215. let param = {}
  1216. for (let num = 0; num < this.totalReserves.length; num++) {
  1217. if (response.warehouseNumViewList[i].goodsName == this.totalReserves[num].goodsName
  1218. && response.warehouseNumViewList[i].goodsName != '玉米'
  1219. && response.warehouseNumViewList[i].goodsName != '高粱') {
  1220. param.cost = this.totalReserves[num].cost
  1221. }
  1222. }
  1223. if (response.warehouseNumViewList[i].pureWeight) {
  1224. param.goodsName = response.warehouseNumViewList[i].goodsName
  1225. param.stockNum = Number(response.warehouseNumViewList[i].pureWeight).toFixed(3)
  1226. if (param.goodsName == '玉米') {
  1227. param.conversionCost = (Number(this.totalMoney1) / Number(param.stockNum)).toFixed(3)
  1228. } else if (param.goodsName == '高粱') {
  1229. param.conversionCost = (Number(this.totalMoney2) / Number(param.stockNum)).toFixed(3)
  1230. }
  1231. result.push(param)
  1232. }
  1233. }
  1234. console.log(result)
  1235. this.totalReserves = result
  1236. this.initCharts()
  1237. }
  1238. else {
  1239. // this.$message.error('当前仓库无潮粮库存,无需折算!')
  1240. // this.value = '0'
  1241. // return
  1242. }
  1243. })
  1244. }
  1245. },
  1246. getList1(){
  1247. getList({
  1248. compId: localStorage.getItem('ws-pf_compId'),
  1249. warehouseName: this.warehouseInfo.warehouseName,
  1250. warehouseType: this.warehouseType,
  1251. })
  1252. .toPromise()
  1253. .then((response) => {
  1254. for (let q = 0; q < response.warehouseViewList.length; q++) {
  1255. if (response.warehouseViewList[q].warehouseNumViewList.length > 0) {
  1256. for(let i = 0; i < response.warehouseViewList[q].warehouseNumViewList.length ; i++){
  1257. if (response.warehouseViewList[q].warehouseNumViewList[i].inNetWeight) {
  1258. response.warehouseViewList[q].warehouseNumViewList[i].inNetWeight = Number(response.warehouseViewList[q].warehouseNumViewList[i].inNetWeight).toFixed(3)
  1259. }
  1260. if (response.warehouseViewList[q].warehouseNumViewList[i].outNetWeight) {
  1261. response.warehouseViewList[q].warehouseNumViewList[i].outNetWeight = Number(response.warehouseViewList[q].warehouseNumViewList[i].outNetWeight).toFixed(3)
  1262. }
  1263. if (response.warehouseViewList[q].warehouseNumViewList[i].storage) {
  1264. response.warehouseViewList[q].warehouseNumViewList[i].storage = Number(response.warehouseViewList[q].warehouseNumViewList[i].storage).toFixed(3)
  1265. }
  1266. if (response.warehouseViewList[q].warehouseNumViewList[i].inNetWeight && response.warehouseViewList[q].warehouseNumViewList[i].outNetWeight) {
  1267. response.warehouseViewList[q].warehouseNumViewList[i].surplus = (response.warehouseViewList[q].warehouseNumViewList[i].inNetWeight - response.warehouseViewList[q].warehouseNumViewList[i].outNetWeight).toFixed(3)
  1268. } else if (response.warehouseViewList[q].warehouseNumViewList[i].inNetWeight) {
  1269. response.warehouseViewList[q].warehouseNumViewList[i].surplus = response.warehouseViewList[q].warehouseNumViewList[i].inNetWeight
  1270. }
  1271. }
  1272. }
  1273. }
  1274. if(this.warehouseType == '1'){
  1275. this.totalReserves = response.warehouseNumViewList
  1276. }else{
  1277. this.totalReserves = response.warehouseViewList[0].warehouseNumViewList
  1278. }
  1279. // this.totalMoney = Number(this.totalReserves[0].stockNum * this.totalReserves[0].cost).toFixed(3)
  1280. this.value = '0'
  1281. this.initCharts()
  1282. this.warehouseList = response.warehouseViewList
  1283. if(this.warehouseList.length>0){
  1284. this.warehouseInfo = this.warehouseList[0]
  1285. this.warehouseInfo.warehouseLocation = this.warehouseList[0].warehousePrivate + this.warehouseList[0].warehouseCity + this.warehouseList[0].warehouseArea
  1286. // this.warehouseInfo.maxReserves = 0
  1287. //经纬度
  1288. this.warehousePositioning.lat = this.warehouseInfo.warehousePositioning.split(',')[1]
  1289. this.warehousePositioning.lng = this.warehouseInfo.warehousePositioning.split(',')[0]
  1290. for(let j = 0 ; j < this.warehouseXiaLa.length ; j++){
  1291. if(this.warehouseInfo.warehouseName == this.warehouseXiaLa[j].warehouseName){
  1292. this.warehouseInfo.maxReserves = this.warehouseXiaLa[j].totalStorage
  1293. }
  1294. }
  1295. }
  1296. })
  1297. }
  1298. },
  1299. }
  1300. </script>
  1301. <style lang="scss" scoped>
  1302. .container{
  1303. background: #E8ECF6;
  1304. }
  1305. .top_form{
  1306. background: #FFFFFF;
  1307. /deep/.el-table .el-table__body .cell,/deep/.el-table .cell{
  1308. text-align: center;
  1309. }
  1310. }
  1311. .title {
  1312. position: relative;
  1313. background: #F6F7FC ;
  1314. height: 60px;
  1315. line-height: 60px;
  1316. }
  1317. .title::before {
  1318. content: '';
  1319. display: inline-block;
  1320. width: 5px;
  1321. height: 30px;
  1322. background: #5473e8;
  1323. position: absolute;
  1324. left: 0;
  1325. top: 12px;
  1326. }
  1327. .position{
  1328. border-radius: 4px;
  1329. background: #ffffff;
  1330. margin: 20px 10px;
  1331. padding-bottom: 10px;
  1332. height: 500px;
  1333. /deep/.el-table .el-table__body .cell,/deep/.el-table .cell{
  1334. text-align: center;
  1335. }
  1336. /deep/.setUp_css .cell{
  1337. display: contents !important;
  1338. }
  1339. .title {
  1340. position: relative;
  1341. background: #F6F7FC ;
  1342. height: 60px;
  1343. line-height: 60px;
  1344. margin-bottom:14px;
  1345. }
  1346. .title::before {
  1347. content: '';
  1348. display: inline-block;
  1349. width: 5px;
  1350. height: 30px;
  1351. background: #5473e8;
  1352. position: absolute;
  1353. left: 0;
  1354. top: 12px;
  1355. }
  1356. .cangInfo{
  1357. font-size: 18px;
  1358. font-weight: 600;
  1359. margin-left: 14px;
  1360. line-height: 30px;
  1361. }
  1362. .el-input{
  1363. width: 95%;
  1364. }
  1365. .el-select {
  1366. width: 95%;
  1367. }
  1368. }
  1369. .right{
  1370. .title {
  1371. position: relative;
  1372. background: #F6F7FC ;
  1373. height: 60px;
  1374. line-height: 60px;
  1375. margin-bottom:14px;
  1376. }
  1377. .title::before {
  1378. content: '';
  1379. display: inline-block;
  1380. width: 5px;
  1381. height: 30px;
  1382. background: #5473e8;
  1383. position: absolute;
  1384. left: 0;
  1385. top: 12px;
  1386. }
  1387. .cangInfo{
  1388. font-size: 18px;
  1389. font-weight: 600;
  1390. margin-left: 14px;
  1391. line-height: 30px;
  1392. }
  1393. }
  1394. .reservesInfo{
  1395. display: inline-flex;
  1396. .reservesInfo_item{
  1397. width: 120px;
  1398. background: #F5F7FA;
  1399. // height: 54px;
  1400. text-align: center;
  1401. line-height: 25px;
  1402. margin: 0 10px;
  1403. border-radius: 4px;
  1404. padding: 10px 0;
  1405. .reservesInfo_GoodsName{
  1406. font-size: 12px;
  1407. color: #8890B1;
  1408. }
  1409. .reservesInfo_Amount{
  1410. color: #323233;
  1411. font-size: 14px;
  1412. font-weight: 600;
  1413. }
  1414. }
  1415. }
  1416. .weight{
  1417. display: inline-flex;
  1418. margin-left: 11px;
  1419. }
  1420. .color{
  1421. display: inline-flex;
  1422. width: 100%;
  1423. height: 40px;
  1424. line-height: 40px;
  1425. justify-content: flex-end;
  1426. .color_for{
  1427. margin: 0 10px;
  1428. display: flex;
  1429. }
  1430. .color_for .color_goodsName{
  1431. margin-left:10px;
  1432. margin-top: -13px;
  1433. }
  1434. .color_item{
  1435. width: 15px;
  1436. height: 15px;
  1437. }
  1438. }
  1439. .column{
  1440. margin: 10px;
  1441. }
  1442. .map{
  1443. background: #ffffff;
  1444. width: 99%;
  1445. margin: 100px auto 50px;
  1446. height: 560px;
  1447. border-radius: 4px;
  1448. .map_switch{
  1449. display: flex;
  1450. border-bottom: 1px solid #D8DCE6;
  1451. .btn,.btn1{
  1452. padding: 7px 20px;
  1453. border-radius: 4px;
  1454. margin: 10px 0 10px 10px;
  1455. font-size: 14px;
  1456. cursor:pointer
  1457. }
  1458. .btn1{
  1459. background: #F0F6FF;
  1460. color: #5878E8 ;
  1461. }
  1462. }
  1463. .map-item{
  1464. width: 96%;
  1465. margin: auto;
  1466. }
  1467. .monitor{
  1468. margin-top: 30px;
  1469. display: flex;
  1470. .video1{
  1471. width: 440px;
  1472. height: 360px;
  1473. text-align: center;
  1474. .img1{
  1475. width: 440px;
  1476. height: 235px;
  1477. padding: 20px;
  1478. }
  1479. }
  1480. }
  1481. }
  1482. //打印弹窗
  1483. .mask {
  1484. background: black;
  1485. width: 100vw;
  1486. height: 100vh;
  1487. position: fixed;
  1488. top: 0;
  1489. z-index: 99;
  1490. opacity: 0.3;
  1491. }
  1492. .count {
  1493. text-align: center;
  1494. margin-bottom: 10px;
  1495. }
  1496. .print-type {
  1497. position: absolute;
  1498. top: 0;
  1499. bottom: 0;
  1500. left: 0;
  1501. right: 0;
  1502. margin: auto;
  1503. width: 340px;
  1504. height: 400px;
  1505. background: white;
  1506. border-radius: 10px;
  1507. z-index: 999;
  1508. .bottom-btn {
  1509. text-align: center;
  1510. }
  1511. }
  1512. .print-type-title {
  1513. text-align: center;
  1514. font-size: 18px;
  1515. // margin: 20px;
  1516. margin: 20px 20px 10px;
  1517. }
  1518. .print-type-checkbox {
  1519. padding-left: 20px;
  1520. .el-date-editor.el-input {
  1521. width: 85% !important;
  1522. }
  1523. .proportion_css {
  1524. width: 85%;
  1525. }
  1526. }
  1527. /deep/.el-table td,/deep/.el-table th{
  1528. text-align: center;
  1529. }
  1530. </style>