steel_inboundReal.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. //真实入库作业
  2. <template>
  3. <div class="steel_inbound_real">
  4. <div class="sache">
  5. <span class="text">入库时间:</span>
  6. <el-date-picker v-model="startTime" type="datetime" placeholder="选择日期">
  7. </el-date-picker>
  8. <span class="text">至</span>
  9. <el-date-picker v-model="endTime" type="datetime" placeholder="选择日期">
  10. </el-date-picker>
  11. <el-select v-model="region" placeholder="请选择班次" style="width: auto;">
  12. <el-option label="不选择班次" value="0"></el-option>
  13. <el-option label="早班" value="1"></el-option>
  14. <el-option label="中班" value="2"></el-option>
  15. <el-option label="晚班" value="3"></el-option>
  16. </el-select>
  17. <el-button type="primary" class="btn" @click="onclick">
  18. <i class="el-icon-search"></i>查询
  19. </el-button>
  20. </div>
  21. <div class="table">
  22. <dilTable v-bind.sync="options" @selection-change="selectionChange" ref="table">
  23. </dilTable>
  24. </div>
  25. </div>
  26. </template>
  27. <script>
  28. import { sjTime } from "@/utils/sharedJsFile";
  29. import { getCookie } from '@/utils/util.js';
  30. export default {
  31. data(){
  32. return{
  33. inputText:"",
  34. startTime: null,
  35. endTime: null,
  36. region: "0",
  37. options:{
  38. // first请求数据的地址
  39. requestUrl: "/api/v1/wms/getWmsInboundResults?apiId=371&warehouseId="+3,
  40. // selectionType: "select",
  41. // mapList: [],
  42. },
  43. }
  44. },
  45. methods:{
  46. // inboundDetails(scope){
  47. // this.$router.push("/inboundDetails/" + scope.row.inboundId)
  48. // },
  49. onclick(){
  50. let startTime = null;
  51. let endTime = null;
  52. // 判断用户有没有班次,有班次则提供默认时间
  53. if(this.region!=null){
  54. let date =null;
  55. let date2 =null;
  56. let year = null;
  57. let month =null;
  58. let day = null;
  59. let year2 = null;
  60. let month2 =null;
  61. let day2 = null;
  62. // 判断当前日期输入框中是否选择了时间,并且开始日期和结束日期是否是同一天
  63. if(this.startTime!=null){
  64. date = this.startTime;
  65. // 判断当前开始时间是标准时间还是字符串时间
  66. year = date.getFullYear(); // 年
  67. month = date.getMonth() + 1; // 月
  68. day = date.getDate(); // 日
  69. }
  70. if(this.endTime!=null){
  71. date2 = this.endTime;
  72. year2 = date2.getFullYear(); // 年
  73. month2 = date2.getMonth() + 1; // 月
  74. day2 = date2.getDate(); // 日 // 日
  75. }
  76. if(this.startTime==null&&this.endTime==null){
  77. // 获取当前的日期时间
  78. date = new Date();
  79. year = date.getFullYear(); // 年
  80. month = date.getMonth() + 1; // 月
  81. day = date.getDate(); // 日
  82. }
  83. // 判断开始日期和结束日期是否是同一天
  84. if(!(year==year2&&month==month2&&day==day2)&&(this.startTime!=null||this.endTime!=null)&&this.region==null){
  85. // 当不是同一天的时候,直接弹窗警告
  86. this.startTime = null;
  87. this.endTime = null;
  88. this.$message.warning("开始日期和结束日期不是同一天");
  89. }
  90. // 判断当前用户选择的具体班次
  91. if(this.region == 0){
  92. this.startTime = year+"-"+month+"-"+day+" "+"00:00:00";
  93. // 将结束时间加一
  94. day =parseInt(day) + 1;
  95. this.endTime = year+"-"+month+"-"+day+" "+"00:00:00";
  96. }else if(this.region == 1){
  97. this.startTime = year+"-"+month+"-"+day+" "+"07:30:00";
  98. this.endTime = year+"-"+month+"-"+day+" "+"15:30:00";
  99. }else if(this.region == 2){
  100. this.startTime = year+"-"+month+"-"+day+" "+"15:30:00";
  101. this.endTime = year+"-"+month+"-"+day+" "+"23:30:00";
  102. }else if(this.region == 3){
  103. this.endTime = year+"-"+month+"-"+day+" "+"07:30:00";
  104. // 将开始时间减一
  105. day =parseInt(day)-1;
  106. this.startTime = year+"-"+month+"-"+day+" "+"23:30:00";
  107. }
  108. this.startTime = new Date(this.startTime)
  109. this.endTime = new Date(this.endTime)
  110. console.log(this.startTime+"开始时间")
  111. console.log(this.endTime+"结束时间")
  112. // 将拼接好的日期转换为时间戳
  113. startTime = Date.parse(this.startTime)
  114. endTime = Date.parse(this.endTime)
  115. console.log(startTime+"开始时间2")
  116. console.log(endTime+"结束时间2")
  117. }else{
  118. if (this.startTime) {
  119. startTime = sjTime(this.startTime);
  120. }
  121. if (this.endTime) {
  122. endTime = sjTime(this.endTime);
  123. }
  124. }
  125. // console.log(startTime)
  126. // console.log(endTime)
  127. if (startTime && endTime) {
  128. if (startTime < endTime) {
  129. // if(getCookie("orgCode") == "dagangadmin" || getCookie("orgCode") == "zidonghuabu"){
  130. this.options.requestUrl = "/api/v1/wms/getWmsInboundResults?apiId=371&warehouseId="+3+"&startTime=" + startTime + "&endTime=" + endTime + "&i=" +new Date();
  131. // }else if(getCookie("orgCode") == "wuliuchuyunzhongxin"){
  132. // this.options.requestUrl = "/api/v1/wms/getWmsInboundResults?apiId=371&orderType=13&startTime=" + startTime + "&endTime=" + endTime + "&i=" +new Date();
  133. // }else{
  134. // this.options.requestUrl = '/api/v1/wms/getWmsInboundResults?apiId=371&userId=' + getCookie("orgCode") +"&startTime=" + startTime + "&endTime=" + endTime + "&i=" +new Date();
  135. // }
  136. } else {
  137. this.startTime = null;
  138. this.endTime = null;
  139. this.$message.warning("开始时间要比结束时间早");
  140. }
  141. } else {
  142. // this.getRequestUrl()
  143. }
  144. },
  145. selectionChange(selection) {
  146. this.options.mapList = selection;
  147. },
  148. onreserved(){
  149. console.log("fahaahahahaha")
  150. if (this.options.mapList.length == 0) {
  151. this.$message({
  152. type: "warning",
  153. message: "请先选择入库单!",
  154. });
  155. } else {
  156. this.$confirm("是否预留", "提示", {
  157. confirmButtonText: "确定",
  158. cancelButtonText: "取消",
  159. type: "warning",
  160. center: true,
  161. })
  162. .then(() => {
  163. //初始化maplist
  164. var mapList = [];
  165. this.options.mapList.forEach((item, i) => {
  166. //初始化mapItem
  167. var mapItem = {
  168. //入库实绩表id
  169. inboundId: 0,
  170. // 给一个标记定义其为入库变为预留
  171. status: 0,
  172. };
  173. mapItem.inboundId = item.inboundId;
  174. mapList.push(mapItem);
  175. });
  176. this.$message({
  177. type: "success",
  178. message: "预留成功!",
  179. });
  180. console.log(mapList)
  181. this.axios.post("/api/v1/wms/changeReserved", mapList).then((res) => {
  182. console.log("res.data"+res.data)
  183. if (res.data >= 1) {
  184. //改变查询条件
  185.       this.$refs.table.setDataRequestQuery({
  186. });  
  187. this.$router.go(0);
  188. }
  189. });
  190. console.log("fdagfaahh")
  191. })
  192. .catch(() => {
  193. this.$message({
  194. type: "info",
  195. message: "取消上传!",
  196. });
  197. });
  198. }
  199. }
  200. }
  201. }
  202. </script>
  203. <style lang="scss" scoped>
  204. .steel_inbound_real{
  205. margin-top: 40px;
  206. margin-left: 20px;
  207. .sache{
  208. display: flex;
  209. margin-bottom: 10px;
  210. padding-right: 10px;
  211. .text {
  212. text-align: left;
  213. line-height: 40px;
  214. }
  215. .el-date-editor {
  216. margin-right: 5px;
  217. margin-left: 5px;
  218. }
  219. .btn {
  220. margin-left: 10px;
  221. }
  222. .el-select {
  223. width: 100%;
  224. .el-input__inner {
  225. width: 150px;
  226. }
  227. }
  228. }
  229. }
  230. </style>