赫艾前端
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.

268 lines
8.1 KiB

  1. <script >
  2. import {
  3. checkIsPacking,
  4. getPackagePrintDataList,
  5. getSOScheduleRoutingDataPrint
  6. } from "../../../api/production/generateReport";
  7. import {printPackageLabel} from "../print/print_package_label";
  8. export default {
  9. data(){
  10. return{
  11. searchData:{
  12. seqNo:undefined,
  13. flag:'',
  14. },
  15. soScheduleRouting:{
  16. }
  17. }
  18. },
  19. mounted() {
  20. this.$refs.focusInput.focus()
  21. },
  22. activated() {
  23. this.$refs.focusInput.focus()
  24. },
  25. computed:{
  26. seqNo:function (){
  27. return this.searchData.seqNo;
  28. }
  29. },
  30. watch:{
  31. },
  32. methods:{
  33. selectBySeqNo(){
  34. // 查询数据
  35. this.getSOScheduleRoutingData();
  36. },
  37. getSOScheduleRoutingData(){
  38. if (!this.searchData.seqNo){
  39. this.$message.warning("派工单号为空")
  40. return
  41. }
  42. let params = {
  43. seqNo:this.searchData.seqNo,
  44. userId:this.$store.state.user.name
  45. };
  46. getSOScheduleRoutingDataPrint(params).then(({data})=>{
  47. if (data && data.code === 0){
  48. if (data.total === 0){
  49. this.$message.warning("派工单不存在")
  50. }else if (data.total === 1){
  51. this.soScheduleRouting = data.rows[0];
  52. this.checkIsPacking()
  53. }else {
  54. this.soScheduleRouting = data.rows.find((item)=>item.site===this.$store.state.user.site && item.seqNo === this.searchData.seqNo)
  55. this.checkIsPacking()
  56. }
  57. }else {
  58. this.$message.warning(data.msg)
  59. }
  60. }).catch((error)=>{
  61. this.$message.error(error);
  62. })
  63. },
  64. checkIsPacking(){
  65. let params = {
  66. site:this.soScheduleRouting.site,
  67. workCenterNo:this.soScheduleRouting.sWorkCenterNo,
  68. }
  69. checkIsPacking(params).then(({data})=>{
  70. this.soScheduleRouting={};
  71. if (data && data.code === 0){
  72. }else {
  73. this.$message.warning(data.msg)
  74. this.searchData = {
  75. seqNo: undefined,
  76. flag: '',
  77. }
  78. }
  79. }).catch((error)=>{
  80. this.$message.error(error)
  81. this.searchData = {
  82. seqNo: undefined,
  83. flag: '',
  84. }
  85. this.soScheduleRouting={};
  86. })
  87. },
  88. printLabel(){
  89. if (!this.soScheduleRouting.site){
  90. this.$message.warning("请先扫描派工单号")
  91. return
  92. }
  93. let params = {
  94. previousSeqNo:this.soScheduleRouting.previousSeqNo,
  95. site:this.soScheduleRouting.site,
  96. orderNo:this.soScheduleRouting.orderNo
  97. }
  98. if (this.searchData.flag === 'Y'){
  99. this.$prompt('请输入数量', '提示', {
  100. confirmButtonText: '确定',
  101. cancelButtonText: '取消',
  102. inputPattern: /^(0|[1-9][0-9]*)(\.\d+)?$/,
  103. inputErrorMessage: '请输入正数'
  104. }).then(({ value }) => {
  105. params.number = value;
  106. this.printPackageLabel(params)
  107. }).catch(() => {
  108. this.searchData.flag = '';
  109. });
  110. return;
  111. }
  112. this.printPackageLabel(params)
  113. },
  114. printPackageLabel(params){
  115. if (!params){
  116. this.$message.warning("参数为空")
  117. return
  118. }
  119. // 发起请求
  120. getPackagePrintDataList(params).then(({data})=>{
  121. if (data && data.code === 0){
  122. printPackageLabel(data.rows);
  123. this.searchData.flag = '';
  124. }else {
  125. this.$message.warning(data.msg)
  126. }
  127. }).catch((error)=>{
  128. this.$message.error(error)
  129. })
  130. }
  131. },
  132. }
  133. </script>
  134. <template>
  135. <div style="padding: 5px">
  136. <el-form size="medium" class="title" :model="seqNo" label-position="top" :inline="true" >
  137. <el-form-item label="派工单号">
  138. <el-input-number size="medium" style="width: 100%;margin-top: -5px;" :controls="false" ref="focusInput" :min="0" v-model="searchData.seqNo" @keyup.enter.native="selectBySeqNo"></el-input-number>
  139. </el-form-item>
  140. <el-form-item label=" ">
  141. <el-select v-model="searchData.flag" clearable>
  142. <el-option value="" label="标准袋数"></el-option>
  143. <el-option value="Y" label="零数袋"></el-option>
  144. </el-select>
  145. </el-form-item>
  146. <el-form-item label=" ">
  147. <el-button type="primary" @click="printLabel">打印标签</el-button>
  148. </el-form-item>
  149. </el-form>
  150. <div class="content">
  151. <el-card style="height: 80vh;margin-top: 20px">
  152. <el-form :model="soScheduleRouting" label-position="top">
  153. <el-row :gutter="20">
  154. <el-col :span="6">
  155. <el-form-item label="派工单号">
  156. <el-input v-model="soScheduleRouting.seqNo" readonly></el-input>
  157. </el-form-item>
  158. </el-col>
  159. <el-col :span="6">
  160. <el-form-item label="工厂编码">
  161. <el-input v-model="soScheduleRouting.site" readonly></el-input>
  162. </el-form-item>
  163. </el-col>
  164. <el-col :span="6">
  165. <el-form-item label="生产订单号">
  166. <el-input v-model="soScheduleRouting.orderNo" readonly></el-input>
  167. </el-form-item>
  168. </el-col>
  169. <el-col :span="6">
  170. <el-form-item label=" ">
  171. </el-form-item>
  172. </el-col>
  173. <el-col :span="6">
  174. <el-form-item label="产品编码">
  175. <el-input v-model="soScheduleRouting.partNo" readonly></el-input>
  176. </el-form-item>
  177. </el-col>
  178. <el-col :span="6">
  179. <el-form-item label="产品名称">
  180. <el-input v-model="soScheduleRouting.partDesc" readonly></el-input>
  181. </el-form-item>
  182. </el-col>
  183. <el-col :span="6">
  184. <el-form-item label="派工单类型">
  185. <el-input v-model="soScheduleRouting.scheduleType" readonly></el-input>
  186. </el-form-item>
  187. </el-col>
  188. <el-col :span="6">
  189. <el-form-item label="派工日期">
  190. <el-input v-model="soScheduleRouting.sScheduledDate" readonly></el-input>
  191. </el-form-item>
  192. </el-col>
  193. <el-col :span="6">
  194. <el-form-item label="工序号">
  195. <el-input v-model="soScheduleRouting.itemNo" readonly></el-input>
  196. </el-form-item>
  197. </el-col>
  198. <el-col :span="6">
  199. <el-form-item label="工序名称">
  200. <el-input v-model="soScheduleRouting.itemDesc" readonly></el-input>
  201. </el-form-item>
  202. </el-col>
  203. <el-col :span="12">
  204. <el-form-item label=" ">
  205. </el-form-item>
  206. </el-col>
  207. <el-col :span="6">
  208. <el-form-item label="机台ID">
  209. <el-input v-model="soScheduleRouting.sResourceID" readonly></el-input>
  210. </el-form-item>
  211. </el-col>
  212. <el-col :span="6">
  213. <el-form-item label="班次">
  214. <el-input v-model="soScheduleRouting.sShiftNo" readonly></el-input>
  215. </el-form-item>
  216. </el-col>
  217. <el-col :span="6">
  218. <el-form-item label="加工中心编码">
  219. <el-input v-model="soScheduleRouting.sWorkCenterNo" readonly></el-input>
  220. </el-form-item>
  221. </el-col>
  222. <el-col :span="6">
  223. <el-form-item label="操作员姓名">
  224. <el-input v-model="soScheduleRouting.operatorName" readonly></el-input>
  225. </el-form-item>
  226. </el-col>
  227. </el-row>
  228. </el-form>
  229. </el-card>
  230. </div>
  231. </div>
  232. </template>
  233. <style scoped>
  234. .title .el-input-number /deep/ .el-input__inner{
  235. text-align: left;
  236. margin-top: 5px;
  237. padding-right: 5px !important;
  238. padding-left: 5px !important;
  239. }
  240. .el-form-item--medium /deep/ .el-form-item__label{
  241. font-size: 16px;
  242. line-height: 30px;
  243. height: 30px;
  244. }
  245. .el-form-item--medium /deep/ .el-form-item__content{
  246. margin-bottom: 5px;
  247. }
  248. .el-form-item--medium /deep/ .el-form-item__content .el-button{
  249. width: 80px;
  250. height: 30px;
  251. }
  252. .el-form-item--medium /deep/ .el-form-item__content .el-input .el-input__inner{
  253. font-size: 16px;
  254. line-height: 30px;
  255. height: 30px !important;
  256. }
  257. </style>