Browse Source

no message

wangyuanbo 2 years ago
parent
commit
d51041c198

+ 17 - 0
imcs-bt-be/imcs-authority-server/src/main/java/com/github/zuihou/api/ExternalApi.java

@@ -313,11 +313,28 @@ public class ExternalApi {
         BaseContextHandler.setTenant("0000");
         String orderId = req.get("orderId");
         String orderStatus = req.get("orderStatus");
+        String equId = req.get("equId");
+        String speId = req.get("speId");
 
         //只更新一个属性,把名字为rhb的用户年龄更新为18,其他属性不变
+
+
         UpdateWrapper<Order> updateWrapper = new UpdateWrapper<>();
         updateWrapper.eq("id", orderId).set("order_status", orderStatus);
         boolean update = orderService.update(updateWrapper);
+        if(orderStatus=="5"){
+//            生产完成,扣减物料,更新料筒和商品状态
+
+            barrelService.updateBarrel(speId,equId);
+
+
+
+
+        }
+
+
+
+
         return R.success(update);
     }
 

+ 1 - 0
imcs-bt-be/imcs-business-biz/src/main/java/com/github/zuihou/business/barrel/service/EquBarrelService.java

@@ -14,4 +14,5 @@ import com.github.zuihou.business.barrel.entity.EquBarrel;
  */
 public interface EquBarrelService extends SuperService<EquBarrel> {
 
+    void updateBarrel(String speId,String equId);
 }

+ 64 - 2
imcs-bt-be/imcs-business-biz/src/main/java/com/github/zuihou/business/barrel/service/impl/EquBarrelServiceImpl.java

@@ -1,14 +1,23 @@
 package com.github.zuihou.business.barrel.service.impl;
 
 
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.github.zuihou.base.service.SuperServiceImpl;
 import com.github.zuihou.business.barrel.dao.EquBarrelMapper;
 import com.github.zuihou.business.barrel.entity.EquBarrel;
 import com.github.zuihou.business.barrel.service.EquBarrelService;
-import com.github.zuihou.base.service.SuperServiceImpl;
-
+import com.github.zuihou.business.formula.entity.Formula;
+import com.github.zuihou.business.formula.service.FormulaService;
+import com.github.zuihou.business.productConfig.entity.ProductConfig;
+import com.github.zuihou.business.productConfig.service.ProductConfigService;
+import com.github.zuihou.database.mybatis.conditions.query.QueryWrap;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.math.BigDecimal;
+import java.util.List;
+
 /**
  * <p>
  * 业务实现类
@@ -22,4 +31,57 @@ import org.springframework.stereotype.Service;
 @Service
 
 public class EquBarrelServiceImpl extends SuperServiceImpl<EquBarrelMapper, EquBarrel> implements EquBarrelService {
+    @Autowired
+    private ProductConfigService productConfigService;
+    @Autowired
+    private FormulaService formulaService;
+
+    @Override
+    public void updateBarrel(String speId, String equId) {
+        QueryWrap<ProductConfig> productConfigQueryWrap = new QueryWrap<>();
+        productConfigQueryWrap.eq("pc_spe_id", speId);
+//        查询出工艺
+        ProductConfig pfg = productConfigService.getOne(productConfigQueryWrap);
+        QueryWrap<Formula> formulaQueryWrap = new QueryWrap<>();
+        formulaQueryWrap.eq("formula_pc_id", pfg.getId());
+//        查询出配方
+        List<Formula> formulaList = formulaService.list(formulaQueryWrap);
+
+        QueryWrap<EquBarrel> equBarrelQueryWrap = new QueryWrap<>();
+        equBarrelQueryWrap.eq("equ_id", equId);
+//        查询料筒信息
+        List<EquBarrel> barrelList = this.list(equBarrelQueryWrap);
+
+        //        遍历配方,扣减每种原料的余量
+
+        for (Formula f : formulaList
+        ) {
+            Long formulaId = f.getId();
+            Long formulaMtId = f.getFormulaMtId();
+            BigDecimal formulaMtQuantity = f.getFormulaMtQuantity();
+            for (EquBarrel barrel : barrelList
+            ) {
+//                查询料筒余料
+                BigDecimal mtrResidue = barrel.getMtrResidue();
+                if (barrel.getMtrId().equals(formulaMtId)) {
+                    BigDecimal subtract = mtrResidue.subtract(formulaMtQuantity);
+                    UpdateWrapper<EquBarrel> equBarrelUpdateWrapper = new UpdateWrapper<>();
+                    equBarrelUpdateWrapper.eq("mtr_residue", subtract);
+//                    扣减后,余料达到余料预警,更新料筒余料
+                    if(subtract.compareTo(barrel.getResidueWarn())==1){
+                        this.update(equBarrelUpdateWrapper);
+                    }else{
+//                        扣减后,余料小于余料预警,更新商品缺料
+
+                    }
+
+                }
+            }
+
+        }
+
+
+    }
+
+
 }

+ 2 - 1
imcs-bt-be/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/productionresource/ProductionResourceController.java

@@ -105,7 +105,7 @@ public class ProductionResourceController extends SuperController<ProductionTena
     public R<Boolean> deployAdv(@RequestBody Productionresource model) {
         QueryWrap<ProductionResource> wrap = new QueryWrap<>();
         UpdateWrapper<ProductionResource> updateWrapper = new UpdateWrapper<>();
-        updateWrapper.set("advUrl", model.getAdvUrl()).eq("id", model.getId());
+        updateWrapper.set("adv_url", model.getAdvUrl()).eq("id", model.getId());
         boolean update = baseService.update(updateWrapper);
         return success(update);
     }
@@ -149,6 +149,7 @@ public class ProductionResourceController extends SuperController<ProductionTena
 
         boolean b = equAndGoodsService.updateBatchById(equAndGoodsList);
 
+
         return success(b);
     }
 

+ 0 - 3
imcs-bt-fe/imcs-bt-fe/imcs-ui/src/components/zuihou/fileUpload.vue

@@ -20,9 +20,6 @@
       :ref="uploadRef"
       class="upload-demo"
     >
-      <video src="fileUrl" controls="controls" v-if="fileUrl">
-        您的浏览器不支持 video 标签。
-      </video>
       <el-button size="small" type="primary" v-if="isUpload"
         >点击上传</el-button
       >

+ 6 - 10
imcs-bt-fe/imcs-bt-fe/imcs-ui/src/views/zuihou/productionresource/Index.vue

@@ -261,7 +261,7 @@ import OrderMgr from "./components/OrderMgr"
 import productionResourceApi from "@/api/Productionresource.js"
 import placeApi from "@/api/Place.js"
 import {downloadFile, loadEnums, initDicts, initQueryParams} from '@/utils/commons'
-import {regionData, CodeToText, TextToCode} from 'element-china-area-data'
+import {regionData, CodeToText, } from 'element-china-area-data'
 import advertisingMgr from "./advertising"
 
 export default {
@@ -380,27 +380,23 @@ export default {
       this.productDialog.isVisible = true
     },
     editMaterialMgr(row) {
+      console.log("进入设备物料管理,传参"+JSON.stringify(row))
       this.mtrDialog.type = "materialMgr"
       this.mtrDialog.isVisible = true
-      this.$refs.materialMgr.equId = 666;
-      this.$refs.materialMgr.getBarrelList(row);
+      this.$refs.materialMgr.getBarrelList(row['id']);
 
     },
     //广告管理
     advertisingMgr(row) {
-      if(!row['advUrl']){
+      if (!row['advUrl']) {
         this.advDialog.type = "addAdv"
         this.advDialog.isVisible = true
         this.$refs.advMgr.setAdv(row);
-      }else{
-        this.advDialog.type = "updateAdv"
+      } else {
+        this.advDialog.type = "addAdv"
         this.advDialog.isVisible = true
         this.$refs.advMgr.setAdv(row);
       }
-
-      // this.$refs.advMgr.equId = row['id'];
-
-
     },
     editOrderMgr(row) {
       this.$refs.orderMgr.setTenant({row, enums: this.enums, dicts: this.dicts});

+ 43 - 111
imcs-bt-fe/imcs-bt-fe/imcs-ui/src/views/zuihou/productionresource/advertising.vue

@@ -15,31 +15,23 @@
       label-width="100px"
       ref="form"
     >
-      <el-form-item  prop="">
-
+      <el-form-item prop="">
 
 
       </el-form-item>
-      <el-form-item label="广告" prop="advurl" align="center">
-
-        <template slot-scope="scope">
-          <div v-if="scope.row.advurl">
-            <el-button
-              type="success"
-              plain
-              @click="playVideo(scope.row.advurl)"
-              ref="btn"
-              size="mini"
-            >
-              播 放
-            </el-button>
-          </div>
-          <div v-else>暂无视频</div>
-        </template>
-
-
-
-
+      <el-form-item label="广告" prop="advUrl" align="center">
+        <div v-if="equipment.advUrl">
+          <el-button
+            type="success"
+            plain
+            @click="playVideo()"
+            ref="btn"
+            size="mini"
+          >
+            播 放
+          </el-button>
+        </div>
+        <div v-else>暂无视频</div>
 
         <fileUpload :acceptSize="20*1024*1024" :auto-upload="true" :limit="1" :fileOtherData="this.videoFileData"
                     @fileLengthVaild="fileLengthVaild" @setIdAndUrl="setIdAndSubmit" ref="fileRef">
@@ -48,9 +40,6 @@
         </fileUpload>
       </el-form-item>
     </el-form>
-
-
-    地址{{ equipment }}
     <div class="dialog-footer" slot="footer">
       <el-button @click="isVisible = false" plain type="warning">{{
           $t("common.cancel")
@@ -61,17 +50,23 @@
         }}
       </el-button>
     </div>
+
+    <play-adv
+      title="广告预览" :dialog-visible="playAdvDialog.isVisible"
+      :type="playAdvDialog.type"
+      @close="playAdvClose" ref="playAdv"
+    />
   </el-dialog>
 </template>
 <script>
-import {validMobile} from "@/utils/my-validate";
 import "@riophae/vue-treeselect/dist/vue-treeselect.css";
 import fileUpload from "@/components/zuihou/fileUpload"
 import productionResourceApi from "@/api/Productionresource.js"
+import playAdv from "./playAdv"
 
 export default {
   name: "advEdit",
-  components: {fileUpload},
+  components: {fileUpload, playAdv},
   props: {
     dialogVisible: {
       type: Boolean,
@@ -84,10 +79,15 @@ export default {
   },
   data() {
     return {
-      // accept: "image/jpeg, image/gif, image/png",
+      playAdvDialog: {
+        isVisible: false,
+        type: "playAdv"
+      },
       accept: "video/mp4, video/ogg, video/flv,video/avi,video/wmv,video/rmvb,video/mov",
       // remoteStationLoading: false,
       equipment: this.initEquipment(),
+      dialogPlay: false,
+      playVidoUrl: "",
       screenWidth: 0,
       width: this.initWidth(),
       videoFileData: {
@@ -98,65 +98,7 @@ export default {
       imgFileTotal: 0,
       // 上传成功数
       successNum: 0,
-      enums: {
-        Sex: {}
-      },
-      dicts: {
-        NATION: {},
-        POSITION_STATUS: {},
-        EDUCATION: {},
-      },
-      rules: {
-        account: [
-          {
-            required: true,
-            message: this.$t("rules.require"),
-            trigger: "blur"
-          },
-          {
-            min: 1,
-            max: 255,
-            message: this.$t("rules.range4to10"),
-            trigger: "blur"
-          },
-          {
-            validator: (rule, value, callback) => {
-              if (!this.user.id) {
-
-                callback();
-              } else {
-                callback();
-              }
-            },
-            trigger: "blur"
-          }
-        ],
-        email: {
-          type: "email",
-          message: this.$t("rules.email"),
-          trigger: "blur"
-        },
-        mobile: {
-          validator: (rule, value, callback) => {
-            if (value !== "" && !validMobile(value)) {
-              callback(this.$t("rules.mobile"));
-            } else {
-              callback();
-            }
-          },
-          trigger: "blur"
-        },
-        sex: {
-          required: true,
-          message: this.$t("rules.require"),
-          trigger: "change"
-        },
-        status: {
-          required: true,
-          message: this.$t("rules.require"),
-          trigger: "blur"
-        }
-      }
+      rules: {}
     };
   },
   computed: {
@@ -193,6 +135,16 @@ export default {
         advUrl: "",
       };
     },
+    playVideo() {
+      this.playAdvDialog.isVisible = true;
+      this.$refs.playAdv.setAdvUrl(this.equipment.advUrl)
+
+
+    },
+    playAdvClose() {
+      this.playAdvDialog.isVisible = false
+    },
+
 
     // 附件长度校验
     fileLengthVaild(data) {
@@ -224,16 +176,13 @@ export default {
 
     setAdv(val) {
       const vm = this;
-      // if (val) {
-      //   vm.equipment = {...val};
-      //
-      // }
       vm.equipment.id = val['id'];
       vm.equipment.advUrl = val['advUrl'];
-      console.log()
+      vm.playVidoUrl = val['advUrl'];
       vm.videoFileData.bizId = vm.equipment["id"];
       vm.$nextTick(() => {
         vm.$refs.fileRef.init({
+          id: "",
           bizId: vm.equipment["id"],
           bizType: vm.videoFileData.bizType,
           fileUrl: vm.equipment["advUrl"],
@@ -258,6 +207,8 @@ export default {
         isSingle: true,
         isDetail: false
       });
+      this.initEquipment()
+      this.playVidoUrl = "";
     },
     submitForm() {
       const vm = this;
@@ -273,27 +224,8 @@ export default {
 
     editSubmit() {
       const vm = this;
-      // if (vm.type === "add") {
-      //   vm.save();
-      // } else {
-      //   vm.update();
-      // }
       vm.update();
     },
-    // save() {
-    //   const vm = this;
-    //   userApi.save(this.user).then(response => {
-    //     const res = response.data;
-    //     if (res.isSuccess) {
-    //       vm.isVisible = false;
-    //       vm.$message({
-    //         message: vm.$t("tips.createSuccess"),
-    //         type: "success"
-    //       });
-    //       vm.$emit("success");
-    //     }
-    //   });
-    // },
     update() {
       productionResourceApi.updateAdv(this.equipment).then(response => {
         const res = response.data;

+ 16 - 12
imcs-bt-fe/imcs-bt-fe/imcs-ui/src/views/zuihou/productionresource/components/MaterialMgr.vue

@@ -190,10 +190,6 @@ export default {
       type: String,
       default: "addEquBarrel",
     },
-    equId: {
-      type: Number,
-      def: 0
-    }
   },
   filters: {},
   data() {
@@ -224,7 +220,8 @@ export default {
       // 枚举
       enums: {},
       // 字典
-      dicts: {}
+      dicts: {},
+      equId: "",
     };
   },
   computed: {
@@ -291,10 +288,12 @@ export default {
         this.fetch()
       }
     },
-    getBarrelList(row) {
+    getBarrelList(equId) {
+      console.log("变没变" + equId)
+      this.equId = equId;
       this.loading = true;
       this.queryParams.sort = "updateTime";
-      this.queryParams.model.equId = row["equId"];
+      this.queryParams.model = {equId: equId};
       EquBarrelApi.page(this.queryParams).then(response => {
 
         let res = response.data
@@ -330,11 +329,13 @@ export default {
     editSuccess() {
       this.selection = []
       this.clearSelections();
-      this.getBarrelList({"equId": this.equId});
+      this.getBarrelList(this.equId);
     },
 
     addBarrelClose() {
       this.addBarrelDialog.isVisible = false;
+      console.log("抓到")
+      this.getBarrelList(this.equId)
     },
 
     addMtrClose() {
@@ -345,7 +346,8 @@ export default {
       this.selection = selection;
     },
     search() {
-      this.getBarrelList({"equId": this.equId})
+      console.log("抓到search")
+      this.getBarrelList(this.equId)
     },
     close() {
       this.$emit("close");
@@ -354,7 +356,8 @@ export default {
       this.queryParams = initQueryParams();
       this.$refs.table.clearSort();
       this.$refs.table.clearFilter();
-      this.search();
+      this.equId = "";
+      // this.search();
     },
     singleDelete(row) {
       this.$refs.table.clearSelection()
@@ -400,8 +403,9 @@ export default {
     addBarrel() {
       this.addBarrelDialog.type = "addBarrel";
       this.addBarrelDialog.isVisible = true;
-      this.$refs.addEquBarrel.equId = this.equId;
-      this.$refs.addEquBarrel.setBarrel({"equId": this.equId, enums: this.enums, dicts: this.dicts,});
+      // this.$refs.addEquBarrel.equId = this.equId;
+      console.log("准备添加料筒了,传值equId" + this.equId)
+      this.$refs.addEquBarrel.setBarrel(this.equId);
     },
 
     addMtrToBar() {

+ 7 - 14
imcs-bt-fe/imcs-bt-fe/imcs-ui/src/views/zuihou/productionresource/components/addEquBarrel.vue

@@ -40,10 +40,6 @@ export default {
       type: String,
       default: "add"
     },
-    equId: {
-      type: String,
-      default: ''
-    }
   },
   data() {
     return {
@@ -62,6 +58,7 @@ export default {
         exprStatus: '',
         barrelWeight: null,
       },
+      equId: "",
       screenWidth: 0,
       width: this.initWidth(),
       rules: {},
@@ -97,9 +94,8 @@ export default {
     initEquBarrel() {
       return {
         id: "",
-        equId: null,
-        // mtrId: null,
-        mtrId: this.equId,
+        equId: "",
+        mtrId: "",
         mtrName: '',
         mtrType: '',
         mtrUnit: '',
@@ -120,14 +116,10 @@ export default {
         return "800px";
       }
     },
-    setBarrel(val = {}) {
-
+    setBarrel(equId) {
+      this.equId = equId
       console.log("addMtr接到了equId并打印" + this.equId);
-      const vm = this;
-
-      vm.dicts = val['dicts'];
-      vm.enums = val['enums'];
-      vm.equBarrel.equId = val['equId']
+      this.equBarrel.equId = equId
     },
     close() {
       this.$emit("close");
@@ -137,6 +129,7 @@ export default {
       this.$refs.form.clearValidate();
       this.$refs.form.resetFields();
       this.confirmDisabled = false;
+      this.equId = "";
       this.equBarrel = this.initEquBarrel();
     },
     submitForm() {

+ 98 - 0
imcs-bt-fe/imcs-bt-fe/imcs-ui/src/views/zuihou/productionresource/playAdv.vue

@@ -0,0 +1,98 @@
+<template>
+  <el-dialog
+    :close-on-click-modal="false"
+    :close-on-press-escape="true"
+    :title="title"
+    :type="type"
+    :visible.sync="isVisible"
+    :width="width"
+    top="50px"
+  >
+    <video
+      :src="playVideoUrl"
+      controls
+      autoplay
+      class="video"
+      ref="dialogVideo"
+      width="width"
+    ></video>
+  </el-dialog>
+</template>
+<script>
+import "@riophae/vue-treeselect/dist/vue-treeselect.css";
+
+export default {
+  name: "playAdv",
+  components: {},
+  props: {
+    dialogVisible: {
+      type: Boolean,
+      default: false
+    },
+    type: {
+      type: String,
+      default: "playAdv"
+    }
+  },
+  data() {
+    return {
+      dialogPlay: false,
+      playVideoUrl: "",
+      screenWidth: 0,
+      width: this.initWidth(),
+    };
+  },
+  computed: {
+    isVisible: {
+      get() {
+        return this.dialogVisible;
+      },
+      set() {
+        this.close();
+        this.reset();
+      }
+    },
+    title() {
+      return "广告预览";
+    }
+  },
+  watch: {
+    // 监听deptId
+    // "user.org.key": "orgSelect"
+  },
+  mounted() {
+    window.onresize = () => {
+      return (() => {
+        this.width = this.initWidth();
+      })();
+    };
+  },
+  methods: {
+
+    initWidth() {
+      this.screenWidth = document.body.clientWidth;
+      if (this.screenWidth < 991) {
+        return "90%";
+      } else if (this.screenWidth < 1400) {
+        return "45%";
+      } else {
+        return "800px";
+      }
+    },
+
+    setAdvUrl(advUrl) {
+      console.log("进入预览组件了,传递广告链接"+advUrl)
+      this.playVideoUrl=advUrl
+    },
+
+    close() {
+      this.$emit("close");
+    },
+    reset() {
+      this.playVideoUrl = "";
+    },
+
+  }
+};
+</script>
+<style lang="scss" scoped></style>