You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

274 lines
8.6 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. <template>
  2. <div class="customer-css">
  3. <el-dialog :title="titleCon" v-drag v-bind="$attrs" v-on="$listeners"
  4. width="405px" style="height: 310px;" class="customer-dialog">
  5. <el-container style="height: 135px;">
  6. <el-form :inline="true" label-position="top" label-width="80px">
  7. <!-- 换材料 -->
  8. <el-container>
  9. <fieldset class="customer-fieldset" style="width: 165px;">
  10. <legend>换材料</legend>
  11. <!-- 材料卷号 序号 -->
  12. <!-- 材料卷号和BOM序号 -->
  13. <el-row>
  14. <el-col :span="16">
  15. <el-form-item :label="'材料卷号:'">
  16. <el-input ref="rmRollNo" @keyup.native="recordTime"
  17. @keyup.enter.native="checkRmRollNoBun"
  18. v-model="pageData.rmRollNo"
  19. style="width: 120px">
  20. </el-input>
  21. </el-form-item>
  22. </el-col>
  23. </el-row>
  24. <el-row>
  25. <el-col :span="16">
  26. <el-form-item :label="'BOM 序号:'">
  27. <el-input v-model="pageData.bomItemNo" readonly style="width: 120px"></el-input>
  28. </el-form-item>
  29. </el-col>
  30. </el-row>
  31. </fieldset>
  32. </el-container>
  33. <!-- 停机信息 -->
  34. <el-container style="margin-left: 170px; margin-top: -120px;">
  35. <fieldset class="customer-fieldset" style="width: 210px;">
  36. <legend>停机</legend>
  37. <!-- 原工具信息 -->
  38. <el-row>
  39. <el-col :span="12">
  40. <el-form-item class="customer-item" label="开始时间:">
  41. <el-date-picker v-model="pageData.reportDate" format="yyyy-MM-dd"
  42. value-format="yyyy-MM-dd" style="width: 100px;"></el-date-picker>
  43. </el-form-item>
  44. </el-col>
  45. <el-col :span="12">
  46. <el-form-item class="customer-item" label=" ">
  47. <el-time-picker v-model="pageData.reportTime" format="HH:mm:ss"
  48. value-format="HH:mm:ss" style="width: 80px;"></el-time-picker>
  49. </el-form-item>
  50. </el-col>
  51. </el-row>
  52. <el-row>
  53. <el-col :span="12">
  54. <el-form-item class="customer-item" label="时长:">
  55. <el-input v-model="pageData.downTimeQty" @blur="changeTimeQty"type="number" style="width: 100px;" ></el-input>
  56. </el-form-item>
  57. </el-col>
  58. </el-row>
  59. </fieldset>
  60. </el-container>
  61. </el-form>
  62. </el-container>
  63. <span slot="footer" class="dialog-footer">
  64. <el-button type="primary" @click="connectMaterialRollBun"> </el-button>
  65. <el-button type="primary" @click="closeDialog">关闭</el-button>
  66. </span>
  67. </el-dialog>
  68. </div>
  69. </template>
  70. <script>
  71. import {
  72. checkConnectMaterialRoll,
  73. connectMaterialRoll,
  74. }
  75. from '@/api/yieldReport/com_replace_material.js';
  76. export default {
  77. name: "com_defect_roll",
  78. data() {
  79. return {
  80. titleCon: '换料',
  81. timeArray: [],
  82. scheduleData: {
  83. site: this.$store.state.user.site,
  84. username: this.$store.state.user.name,
  85. seqNo: '',
  86. orderNo: '',
  87. itemNo: 0,
  88. partNo: '',
  89. workCenterNo: '',
  90. workCenterDesc: '',
  91. resourceDesc: '',
  92. rollNo: '',
  93. partDesc: '',
  94. planStartTime: '',
  95. planFinishTime: '',
  96. qtyRequiredOriginal: 0,
  97. scheduledDate: '',
  98. shiftNo: '',
  99. preItemDesc: '',
  100. nextItemDesc: '',
  101. nextItemNo: 0,
  102. operatorId: '',
  103. functionName: '',
  104. currentRollFlag: false
  105. },
  106. pageData: {
  107. site: this.$store.state.user.site,
  108. username: this.$store.state.user.name,
  109. orderNo: '',
  110. itemNo: '',
  111. seqNo: '',
  112. rollNo: '',
  113. operatorId: '',
  114. histSeqNo: 0,
  115. bomItemNo: -1,
  116. rmRollNo: '',
  117. oriRmRollNo: '',
  118. reportDate: '',
  119. reportTime: '',
  120. downTimeQty: 0,
  121. consumeQty: 0,
  122. oriConsumeQty: 0,
  123. totalConsumeQty: 0,
  124. checkFlag: false,
  125. },
  126. operatorData: {
  127. site: this.$store.state.user.site,
  128. username: this.$store.state.user.name,
  129. operatorId: '',
  130. operatorName: '',
  131. status: '',
  132. seqNo: '',
  133. showFlag: false
  134. },
  135. oriMaterialData: {
  136. site: this.$store.state.user.site,
  137. username: this.$store.state.user.name,
  138. orderNo: '',
  139. itemNo: 0,
  140. seqNo: '',
  141. histSeqNo: '',
  142. rmRollNo: '',
  143. },
  144. dataListLoading: false,
  145. }
  146. },
  147. methods: {
  148. //初始化组件的参数
  149. init(scheduleData, operatorData, oriMaterialData) {
  150. //初始化参数
  151. this.scheduleData = scheduleData;
  152. this.oriMaterialData = oriMaterialData;
  153. //初始化操作员对象
  154. this.operatorData = JSON.parse(JSON.stringify(operatorData));
  155. //设置参数
  156. this.pageData.orderNo = scheduleData.orderNo;
  157. this.pageData.itemNo = scheduleData.itemNo;
  158. this.pageData.seqNo = scheduleData.seqNo;
  159. this.pageData.rollNo = scheduleData.rollNo;
  160. this.pageData.operatorId = operatorData.operatorId;
  161. this.pageData.histSeqNo = oriMaterialData.histSeqNo;
  162. this.pageData.oriRmRollNo = oriMaterialData.rmRollNo;
  163. this.pageData.bomItemNo = oriMaterialData.sAPBOMItemNo;
  164. //重置时间
  165. this.pageData.reportDate = this.dayjs(new Date()).format('YYYY-MM-DD');
  166. this.pageData.reportTime = this.dayjs(new Date()).format('HH:mm:ss');
  167. this.pageData.downTimeQty = 0;
  168. this.pageData.rmRollNo = '';
  169. //自动获取焦点
  170. this.$nextTick(() => {
  171. this.$refs.rmRollNo.focus();
  172. });
  173. //重置校验的标记
  174. this.pageData.checkFlag = false;
  175. },
  176. /*关闭modal*/
  177. closeDialog(){
  178. //刷新报工的页面
  179. this.$emit('refreshPageData');
  180. //关闭当前的页面
  181. this.$emit('update:visible', false);
  182. },
  183. /*记录每一次录入字符串的时间*/
  184. recordTime(){
  185. //判断是否清掉所有的内容
  186. if(this.pageData.rmRollNo.trim().length === 0){
  187. this.timeArray = [];
  188. }else{
  189. this.timeArray.push(new Date().getTime());
  190. }
  191. },
  192. /*验证时长的参数*/
  193. changeTimeQty(){
  194. let downTimeQty = this.pageData.downTimeQty;
  195. if(downTimeQty <= 0){
  196. this.$message.error('时长必须大于0!');
  197. return false;
  198. }
  199. },
  200. /*检查材料卷号的数据*/
  201. checkRmRollNoBun() {
  202. //首先判断时间是否超过100毫秒
  203. let len = this.timeArray.length;
  204. let timeDiff = this.timeArray[len - 1] - this.timeArray[0];
  205. //判断时间是否在范围之内
  206. if(timeDiff > 1000){
  207. // this.$message.error('请扫码输入!');
  208. //return false;
  209. }
  210. //判断null和空字符串
  211. if (this.pageData.rmRollNo == null || this.pageData.rmRollNo === '') {
  212. this.$message.error('材料卷号不能为空!');
  213. return false;
  214. }else{
  215. this.pageData.rmRollNo = this.pageData.rmRollNo.trim();
  216. }
  217. //调用方法检查材料的数据(验证通过调用检查的方法)
  218. this.checkConnectRmRollNoOperation();
  219. },
  220. /*检查新的工具实例信息*/
  221. checkConnectRmRollNoOperation(){
  222. /*调用检查的方法检验下*/
  223. checkConnectMaterialRoll(this.pageData).then(({data}) => {
  224. //判断是否存在异常
  225. if(data.code == 500){
  226. this.$message.error(data.msg);
  227. }else{
  228. this.pageData.checkFlag = true;
  229. }
  230. });
  231. },
  232. /*接料操作*/
  233. connectMaterialRollBun(){
  234. let downTimeQty = this.pageData.downTimeQty;
  235. if(downTimeQty <= 0){
  236. this.$message.error('时长必须大于0!');
  237. return false;
  238. }
  239. connectMaterialRoll(this.pageData).then(({data}) => {
  240. //判断是否存在异常
  241. if(data.code == 500){
  242. this.$message.error(data.msg);
  243. }else{
  244. //先提示 后关闭
  245. this.$message.success(data.msg);
  246. //关闭当前的页面
  247. this.closeDialog();
  248. }
  249. });
  250. },
  251. },
  252. created() {
  253. // this.factoryList()
  254. // this.getLanguageList()
  255. }
  256. }
  257. </script>
  258. <style scoped lang="scss">
  259. </style>