dytyqx
12 小时以前 b63d096b24ad28ce7c9f4dfc7112046a4f854be7
src/views/warehouse/barcodeMaster/Gy_BarCodeBill_JinLong_AutoLogin.vue
@@ -3,12 +3,13 @@
        <div style=" margin-bottom: 10px; border-bottom: 1px solid #f6f6f6;">
            <el-button type="primary" @click="onClickMethod_BarCodeProduce" :disabled="disabledFlag_BarCodeProduce">生成</el-button>
            <el-button type="primary" @click="get_PrintReport">打印</el-button>
            <!-- <el-button type="primary" @click="close">退 出</el-button> -->
            <el-button type="primary" @click="get_BarCodeBillList">条码档案</el-button>
            <el-button type="primary" @click="get_BarCodeBillHSEQ">条码行号查询</el-button>
        </div>
        <div style="margin: 10px; font-size: 28px; font-weight: bold; text-align: center;">条码生成</div>
        <el-form :model="initMainData" label-width="80px">
            <el-row>
                <el-col :span="6">
                <el-col :span="6">
                    <el-form-item label="日期">
                        <el-date-picker v-model="initMainData.HDate" type="date" placeholder="选择日期" value-format="yyyy-MM-dd" style="width: 100%"> </el-date-picker>
                    </el-form-item>
@@ -82,7 +83,7 @@
                    </el-form-item>
                </el-col>
                <el-col :span="6">
                    <el-form-item label="标准包装数">
                    <el-form-item label="数量/箱">
                        <el-input-number v-model="initMainData.HMinQty" @change="onChangeForHMinQty" />
                    </el-form-item>
                </el-col>
@@ -163,7 +164,7 @@
                </el-tab-pane>
            </el-tabs>
        </el-form>
        <!-- 打印弹窗 -->
        <el-dialog title="打印模板选择" :visible.sync="openPrintList" width="800px" append-to-body>
            <PrintList :linterid="rowSel.toString()" :MyMsg="rowSel.toString()" Type="HGy_BarCodeBill"
@@ -187,7 +188,7 @@
        return {
            baseURL: process.env.VUE_APP_BASE_API,                      //后端接口访问前缀
            HModName: "Gy_BarCodeBill_JinLong_AutoLogin",               //模块名称
            disabledFlag_BarCodeProduce:false,                          //禁用标记-生成 按钮
            disabledFlag_BarCodeProduce:false,                          //禁用标记-生成 按钮                                             // iframe URL
            rules:{                                                     //表头form 校验
            },
@@ -222,8 +223,9 @@
                ,HReInspectionDate:null                                 //复检日期
                ,HPOOrderBillMTO:""                                     //采购跟踪号
                ,HSeOrderBillNo:""                                      //客户订单号
                ,HCusModel:""                                       //产品型号
                ,HCusModel:""                                           //产品型号
                ,HMTONo:null                                            //计划跟踪号
                ,HSourceBillSEQ:0                                       //源单行号
                ,HOrganizationID:0                                      //组织ID
                ,HOrganization:""                                       //组织名称
            },
@@ -290,13 +292,13 @@
    },
    async created() {
        await this.loging();                                            //自动登录
        this.judgeIsLoging();                                           //判断是否登录,未登录则跳转回登录页面
        await this.judgeIsLoging();                                           //判断是否登录,未登录则跳转回登录页面
        await this.get_OrganizationList();                              //页面初始化 获取组织下拉列表数据
        await this.initPageData();                                      //页面初始化
    },
    methods: {
        //#region 判断是否登录,未登录则跳转回登录页面
        judgeIsLoging(){
        async judgeIsLoging(){
            if (sessionStorage["login"] != "login") {
                this.$modal.msgError("登录失效,请重新登录!!");
                this.$router.push({ path: "/" }).catch(() => { })
@@ -305,7 +307,7 @@
        //#endregion
        //#region 页面初始化
        initPageData(){
        async initPageData(){
            var params = this.get_UrlVars();
            var OperationType = params[params[0]];      //操作类型
@@ -323,7 +325,7 @@
        //#region 获取组织下拉列表数据
        async get_OrganizationList() {
            axios.get(this.baseURL + '/Web/GetOrganizations',{async:false}).then(response => {
            axios.get(this.$baseUrl + '/Web/GetOrganizations',{async:false}).then(response => {
                let result = response.data
                if (result.count == 1) {
                    var data = result.data;
@@ -428,6 +430,13 @@
                return Result = false;
            }
            var regex = /^\d{4}-\d{2}-\d{2}$/;                              //正则表达式:校验 yyyy-MM-dd
            temp = this.initMainData.HInspectionDate;
            if(!regex.test(temp)){
                this.$modal.msgError("请设置生产日期!!!");
                return Result = false;
            }
            // var HEndQty = this.initMainData.HEndQty;
            // if (HEndQty == "") {
            //     this.$modal.msgError("尾包数量不能为空!!");
@@ -472,7 +481,7 @@
                    , "HMaterNumber": this.initMainData.HMaterNumber
                    , "HMaterName": this.initMainData.HMaterName
                    , "HMaterModel": this.initMainData.HMaterModel
                    , "HCusModel": ""
                    , "HCusModel": this.initMainData.HCusModel
                    , "HCusMaterName": ""
                    , "HEmpID": 0
                    , "HEmpNumber": ""
@@ -485,6 +494,7 @@
                    , "HQty": this.initMainData.HQty_SourceBill
                    , "HMinQty": this.initMainData.HMinQty
                    , "HBQty": this.initMainData.HBQty
                    , "HSourceBillSEQ":this.initMainData.HSourceBillSEQ
                    , "HPackQty": 0
                    , "HCoilNO": ""
                    , "HFurnaceNO": ""
@@ -518,6 +528,8 @@
                    , "HInspectionCycle": this.initMainData.HInspectionCycle
                    , "HReInspectionDate": this.initMainData.HReInspectionDate
                    , "HPOOrderBillMTO": this.initMainData.HPOOrderBillMTO
                    , "HSeOrderBillNo": this.initMainData.HSeOrderBillNo
                    , "HMTONo": this.initMainData.HMTONo
                }
            ]
@@ -552,6 +564,38 @@
        },
        //#endregion
        //#region 条码档案按钮点击事件
        get_BarCodeBillList(){
            this.$router.push({ path: "/warehouse/barcodeMaster/Gy_BarCodeBillList_JinLong_AutoLogin" }).catch(() => { });
        },
        //#endregion
         //#region下推生成条码
        async get_BarCodeBillHSEQ() {
                var params = this.get_UrlVars();
                var HSourceInterID = params[params[1]];
                var HSourceEntryID = params[params[2]];
                var res1 = await this.getPushSource_POInStockBillInit1(HSourceInterID,HSourceEntryID);
                var temp = res1.data.data[0];
                var dataArray = [temp];
                var HSEQ
                if (dataArray && dataArray.length > 0 && dataArray[0]) {
                    if (dataArray[0].HSEQ == '') {
                        HSEQ = 0;
                    } else {
                        HSEQ = dataArray[0].HSEQ;
                    }
                } else {
                    HSEQ = 0;
                }
                this.$router.push({
               path: `/warehouse/barcodeMaster/Gy_BarCodeBillList_JinLong_AutoLogin?OperationType=4&HSourceInterID=${HSourceInterID}&HSourceEntryID=${HSourceEntryID}&HSEQ=${HSEQ}`
               }).catch(() => { });
        },
          //#endregion
        //#region 条码列表复选框选择状态变更监听事件
        onSelectionChange_BarCode(selection){
            this.selectedData_BarCode = selection;
@@ -576,7 +620,7 @@
            var res = "none";
            var sql = "select * from h_v_IF_POInStockBillList_Source where 1=1 and HMainID = " + HSourceInterID + " and HSubID = " + HSourceEntryID;
            var ModRightNameCheck = "";
            return axios.get(this.baseURL + '/CommonModel/searchMethod', {
            return axios.get(this.$baseUrl + '/CommonModel/searchMethod', {
                async:false,
                params: {
                    "sql": sql
@@ -585,6 +629,26 @@
                },
            })
        },
        //#endregion
       //#region 根据主内码与子内码获取源单收料通知单数据(合并版)
        async getPushSource_POInStockBillInit1(HSourceInterID, HSourceEntryID) {
            var sql = `SELECT m.*, s.*
                    FROM Cg_POInStockBillMain m
                    INNER JOIN Cg_POInStockBillSub s ON m.hinterid = s.HInterID
                    WHERE 1=1`;
            sql += ` AND m.hinterid = ${HSourceInterID}`;
            sql += ` AND s.HEntryID = ${HSourceEntryID}`;
            var ModRightNameCheck = "";
            return axios.get(this.$baseUrl + '/CommonModel/searchMethod', {
                params: {
                    "sql": sql,
                    "user": sessionStorage["HUserName"],
                    "ModRightNameCheck": ModRightNameCheck
                },
            })
        },
        //#endregion
        //#endregion
    
        //#region 下推页面初始化
@@ -599,20 +663,26 @@
            
            //获取源单信息
            var temp = null;
            var res = "none"
            var res  = "none"
            var res1 = "none"
            try{
                res = await this.getPushSource_POInStockBillInit(HSourceInterID, HSourceEntryID);
                if(res.data.code=="1"){
                    if(res.data.data.length>0){
                        res = await this.getPushSource_POInStockBillInit(HSourceInterID, HSourceEntryID);
                    }else{
                        res = "none";
                        this.$modal.msgError("未查询到当前单据!!!");
                res1 = await this.getPushSource_POInStockBillInit1(HSourceInterID,HSourceEntryID);
                if(res1.data.data.length<=0){
                    this.$modal.msgError("当前单据未同步,请返回金蝶云SRM平台送货单列表找到该单据在查看页面点击【传递WMS】按钮!!");
                }else{
                    res = await this.getPushSource_POInStockBillInit(HSourceInterID, HSourceEntryID);
                    if(res.data.code=="1"){
                        if(res.data.data.length>0){
                            res = await this.getPushSource_POInStockBillInit(HSourceInterID, HSourceEntryID);
                        }else{
                            res = "none";
                            this.$modal.msgError("单据已经全部下推,如果想继续下推,去条码档案作废对应条码");
                        }
                    }
                }
                else{
                    res = "none";
                    this.$modal.msgError(res.data.Message);
                    else{
                        res = "none";
                        this.$modal.msgError(res.data.Message);
                    }
                }
            }catch(error){
                res = "none";
@@ -654,6 +724,8 @@
            this.initMainData.HPOOrderBillMTO = dataArray[0].采购跟踪号;
            this.initMainData.HSeOrderBillNo = dataArray[0].客户订单号;
            this.initMainData.HCusModel = dataArray[0].产品型号;
            this.initMainData.HMTONo = dataArray[0].计划跟踪号;
            this.initMainData.HSourceBillSEQ =dataArray[0].源单行号;
            this.initMainData.HMinQty = 0;
            if(this.initMainData.HMinQty>0){
                this.initMainData.HBQty = (this.initMainData.HQty_SourceBill / this.initMainData.HMinQty) + (this.initMainData.HQty_SourceBill%this.initMainData.HMinQty == 0?0:1);
@@ -670,7 +742,7 @@
        SaveBarCodeCreate(sMainSub, CampanyName) {
            axios({
                method: 'post',
                url: this.baseURL + "/Sc_BarCode/Sub_SaveBill_JinLong",
                url: this.$baseUrl + "/Sc_BarCode/Sub_SaveBill_JinLong",
                data: {
                    "msg": sMainSub, "CampanyName": CampanyName
                },
@@ -709,7 +781,7 @@
            var HPwdWord = params[params[6]];               //登录密码
            var HOrgID = params[params[7]];                 //组织id
            var HOrgName = "";
            if (HOrgID == 0) {
                //判断是否登录 未登录则跳到登录页
                if (sessionStorage.login != "login") {
@@ -721,44 +793,50 @@
            var sql_getHOrgName = "select HName from Xt_Organizations where HItemID = " + HOrgID;
            var ModRightNameCheck = "";
            axios.get(this.baseURL + "/CommonModel/searchMethod", {
            try{
            let response = await axios.get(this.$baseUrl + "/CommonModel/searchMethod", {
                params: { 
                    "sql": sql_getHOrgName
                    , "user": HUserName
                    , "ModRightNameCheck": ModRightNameCheck
                }
            }).then(response => {
                var data1 = response.data
                if (data1.count == 1) {
                    if (data1.data.length > 0) {
                        HOrgName = data1.data[0]["HName"];
                    } else {
                        this.$modal.msgError("登录失败!!组织不存在,请重新登录!!");
                        this.$router.push({ path: "/" }).catch(() => { })
                    }
                }
                else {
                    this.$modal.msgError(data1.code + data1.Message);
            })
            var data1 = response.data
            if (data1.count == 1) {
                if (data1.data.length > 0) {
                    HOrgName = data1.data[0]["HName"];
                } else {
                    this.$modal.msgError("登录失败!!组织不存在,请重新登录!!");
                    this.$router.push({ path: "/" }).catch(() => { })
                }
            }).catch(error => {
            }
            else {
                this.$modal.msgError(data1.code + data1.Message);
                this.$router.push({ path: "/" }).catch(() => { })
            }
            }catch(error){
                this.$modal.msgError("接口请求失败!");
                this.$router.push({ path: "/" }).catch(() => { })
            });
            };
            // 写入sessionStorage 需要时间,后续操作需要等待 写入sessionStorage完成后再执行
            var sql_login = "select * from h_v_Gy_Czygl_Login where Czymc = '" + HUserName + "'";
            axios.get(this.baseURL + "/CommonModel/searchMethod", {
                params: {
                    "sql": sql_login
                    , "user": HUserName
                    , "ModRightNameCheck": ""
                }
            }).then(response => {
                var data1 = response.data
            try{
                let res =  await axios.get(this.$baseUrl + "/CommonModel/searchMethod", {
                    params: {
                        "sql": sql_login
                        , "user": HUserName
                        , "ModRightNameCheck": ""
                    }
                })
                var data1 = res.data
                if (data1.count == 1) {
                    if (data1.data.length > 0) {
                        HUserName = data1.data[0]["Czybm"];
                        var result = data1;
                        sessionStorage["HCloudUserName"] = result.data[0].HCloudUserName;//金蝶云账号
                        sessionStorage["HCloudUserPsd"] = result.data[0].HCloudUserPsd;
@@ -802,6 +880,7 @@
                        sessionStorage["Organization"] = HOrgName;
                        sessionStorage["HTranSlate"] = "1";
                        sessionStorage["HAutoLogin"] = "1";
                    } else {
                        this.$modal.msgError("加载失败!!账号不存在,请联系管理员维护账号信息!!");
                        this.$router.push({ path: "/" }).catch(() => { });
@@ -810,10 +889,10 @@
                    this.$modal.msgError("登录失败!!"+result.Message);
                    this.$router.push({ path: "/" }).catch(() => { })
                }
            }).catch(error => {
            }catch(error){
                this.$modal.msgError("接口请求失败!");
                this.$router.push({ path: "/" }).catch(() => { })
            });
            };
        },
        //#endregion
    }