private void btn约车_Click(object sender, EventArgs e)
        {
            string        ids  = "";
            List <string> list = new List <string>();

            for (int i = 0; i < gridView发货计划列表.RowCount; i++)
            {
                bool b = gridView发货计划列表.GetRowCellValue(i, "FCHECK").ToBool();
                if (b)
                {
                    var rowIndex = gridView发货计划列表.GetDataSourceRowIndex(i);
                    var rowData  = _dataSrouce[rowIndex];

                    //发货计划单处于草稿状态,并且约车状态为待发布的时候用户即可勾选多条记录进行约车
                    if (rowData.FSTATUS == 1 && rowData.FCAR_STATUS == 1)
                    {
                        list.Add(rowData.FID);
                    }
                }
            }

            if (list.Count > 0)
            {
                ids = string.Join(",", list.ToArray());
            }

            if (ids != "")
            {
                //_service.ContractCar(ids);
            }
            else
            {
                MsgHelper.ShowError("请选择要处理的数据!");
            }
        }
        private void btn标识批录_Click(object sender, EventArgs e)
        {
            string        ids  = "";
            List <string> list = new List <string>();

            for (int i = 0; i < gridView发货计划列表.RowCount; i++)
            {
                bool b = gridView发货计划列表.GetRowCellValue(i, "FCHECK").ToBool();
                if (b)
                {
                    var rowIndex = gridView发货计划列表.GetDataSourceRowIndex(i);
                    var rowData  = _dataSrouce[rowIndex];
                    list.Add(rowData.FID);
                }
            }

            if (list.Count > 0)
            {
                ids = string.Join(",", list.ToArray());
            }

            if (ids != "")
            {
                string centen = Interaction.InputBox("请是输入标识内容", "标题", "", -1, -1);
                if (_service.UpdateIdentification(ids, centen))
                {
                    MsgHelper.ShowError("标识保存成功!");
                    this.onSearch();
                }
            }
            else
            {
                MsgHelper.ShowError("请选择要处理的数据!");
            }
        }
Ejemplo n.º 3
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;
                ApiService.APIServiceClient service = new ApiService.APIServiceClient("BasicHttpBinding_IAPIService", Global.WcfUrl);
                User user = service.Login(txtACC.Text, txtPAS.Text);
                if (user == null)
                {
                    MsgHelper.ShowError("用户名或密码不正确!");
                    return;
                }

                Global.LoginUser = user;

                Hide();

                if (_frmMain == null)
                {
                    _frmMain = new FrmMainB(this);
                }
                {
                    IniHelper.WriteString(Global.IniUrl, "CONFIG", "username", txtACC.Text);
                    IniHelper.WriteString(Global.IniUrl, "CONFIG", "password", txtPAS.Text);
                    _frmMain.Show();
                }

                this.Cursor = Cursors.Default;
            }
            catch (Exception ex)
            {
                LogError(ex);
                MsgHelper.ShowError("登陆异常!");
            }
        }
        private void btn审核_Click(object sender, EventArgs e)
        {
            string        ids  = "";
            List <string> list = new List <string>();

            for (int i = 0; i < gridView发货计划列表.RowCount; i++)
            {
                bool b = gridView发货计划列表.GetRowCellValue(i, "FCHECK").ToBool();
                if (b)
                {
                    var rowIndex = gridView发货计划列表.GetDataSourceRowIndex(i);
                    var rowData  = _dataSrouce[rowIndex];
                    if ((rowData.FSTATUS == 1 || rowData.FSTATUS == 2) && !string.IsNullOrEmpty(rowData.FBILLNO))
                    {
                        list.Add(rowData.FID);
                    }
                }
            }

            if (list.Count > 0)
            {
                ids = string.Join(",", list.ToArray());
            }

            if (ids != "")
            {
                FrmAuditDialog dialog = new FrmAuditDialog("审核", "请选择你要做的处理", "通过", "不通过");
                DialogResult   result = dialog.ShowDialog();
                if (result == DialogResult.Yes)
                {
                    //调用发货计划审核接口
                    int res = _service.AuditDeliveryByIDs(ids, 3, Global.LoginUser);
                    MsgHelper.ShowInformation("处理成功!");
                    this.onSearch();
                }
                else if (result == DialogResult.No)
                {
                    //调用发货计划审核接口
                    int res = _service.AuditGroupByIDs(ids, 4, Global.LoginUser);
                    MsgHelper.ShowInformation("处理成功!");
                    this.onSearch();
                }

                foreach (var model in _dataSrouce)
                {
                    foreach (string id in list)
                    {
                        if (model.FID == id)
                        {
                            model.FCHECK = true;
                        }
                    }
                }
            }
            else
            {
                MsgHelper.ShowError("审核只能针对待已审核和已生成单号的数据,请确认您选择数据是否正确!");
            }
        }
Ejemplo n.º 5
0
        private void onSearch(string keyword)
        {
            try
            {
                var list = _service.GetClientAccountList(_brandID, keyword);
                gridControl.DataSource = list;

                gridControl.Focus();
            }
            catch (Exception e)
            {
                MsgHelper.ShowError(e.Message);
            }
        }
        private void btn删除_Click(object sender, EventArgs e)
        {
            string        ids  = "";
            List <string> list = new List <string>();

            for (int i = 0; i < gridView发货计划列表.RowCount; i++)
            {
                bool b = gridView发货计划列表.GetRowCellValue(i, "FCHECK").ToBool();
                if (b)
                {
                    var rowIndex = gridView发货计划列表.GetDataSourceRowIndex(i);
                    var rowData  = _dataSrouce[rowIndex];
                    if (rowData.FSTATUS == 1 || rowData.FSTATUS == 2 || rowData.FSTATUS == 4 || rowData.FSTATUS == 6)
                    {
                        list.Add(rowData.FID);
                    }
                }
            }

            if (list.Count > 0)
            {
                ids = string.Join(",", list.ToArray());
            }

            if (ids != "")
            {
                if (MsgHelper.AskQuestion("确认要删除选中的单据,以及删除对应的其他关联信息吗?"))
                {
                    //调用发货计划删除接口
                    int res = _service.DeleteGroupByIDs(ids);
                    if (res > 0)
                    {
                        MsgHelper.ShowInformation("删除成功!");
                        this.onSearch();
                    }
                    else if (res == -1)
                    {
                        MsgHelper.ShowInformation("已经生成发货计划的组柜计划无法生成。请先删除对应的发货计划!");
                        this.onSearch();
                    }
                }
            }
            else
            {
                MsgHelper.ShowError("请选择要删除的数据,只能删除未审核的数据");
            }
        }
        private void btn反审_Click(object sender, EventArgs e)
        {
            string ids = "";

            list = new List <string>();

            for (int i = 0; i < gridView发货计划列表.RowCount; i++)
            {
                bool b = gridView发货计划列表.GetRowCellValue(i, "FCHECK").ToBool();
                if (b)
                {
                    var rowIndex = gridView发货计划列表.GetDataSourceRowIndex(i);
                    var rowData  = _dataSrouce[rowIndex];
                    if (rowData.FSYNCSTATUS < 1)
                    {
                        list.Add(rowData.FID);
                    }
                }
            }


            if (list.Count > 0)
            {
                ids_sh = string.Join(",", list.ToArray());
            }

            if (ids_sh != "")
            {
                optype = "3";



                if (MsgHelper.AskQuestion("点击确认退回到待审核状态,可修改资料!"))
                {
                    if (!backgroundWorker2.IsBusy)
                    {
                        setButton(false);
                        backgroundWorker2.RunWorkerAsync();
                    }
                }
            }
            else
            {
                MsgHelper.ShowError("反审核只能针对已审核并且未同步到厂家的数据,请先勾选您要处理的数据!");
            }
        }
        private void btn反审_Click(object sender, EventArgs e)
        {
            string        ids  = "";
            List <string> list = new List <string>();

            for (int i = 0; i < gridView发货计划列表.RowCount; i++)
            {
                bool b = gridView发货计划列表.GetRowCellValue(i, "FCHECK").ToBool();
                if (b)
                {
                    var rowIndex = gridView发货计划列表.GetDataSourceRowIndex(i);
                    var rowData  = _dataSrouce[rowIndex];
                    if (rowData.FSYNCSTATUS < 1)
                    {
                        list.Add(rowData.FID);
                    }
                }
            }


            if (list.Count > 0)
            {
                ids = string.Join(",", list.ToArray());
            }

            if (ids != "")
            {
                if (MsgHelper.AskQuestion("点击确认退回到待审核状态,可修改资料!"))
                {
                    //调用发货计划删除接口
                    int res = _service.AuditAntiGroupByIDs(ids);
                    if (res > 0)
                    {
                        MsgHelper.ShowInformation("处理成功!");
                        this.onSearch();
                    }
                }
            }
            else
            {
                MsgHelper.ShowError("反审核只能针对已审核并且未同步到厂家的数据,请先勾选您要处理的数据!");
            }
        }
Ejemplo n.º 9
0
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtOld.Text == "")
                {
                    MsgHelper.ShowInformation("请输入旧密码!");
                    return;
                }

                if (txtNew1.Text == "")
                {
                    MsgHelper.ShowInformation("请输入新密码!");
                    return;
                }

                if (txtNew1.Text != txtNew2.Text)
                {
                    MsgHelper.ShowInformation("两次输入的密码不一致!");
                    return;
                }


                JsonMessage json = JsonHelper.ConvertToObject <JsonMessage>(_service.ModifyPassword(Global.LoginUser.FID, txtOld.Text, txtNew1.Text));
                if (json.Success)
                {
                    MsgHelper.ShowInformation("密码修改成功!");
                    DialogResult = DialogResult.OK;
                }
                else
                {
                    MsgHelper.ShowError(json.Message);
                }
            }
            catch (Exception ex)
            {
                LogError(ex, GetType());
            }
        }
Ejemplo n.º 10
0
        private void btn审核_Click(object sender, EventArgs e)
        {
            string ids = "";

            list = new List <string>();

            for (int i = 0; i < gridView发货计划列表.RowCount; i++)
            {
                bool b = gridView发货计划列表.GetRowCellValue(i, "FCHECK").ToBool();
                if (b)
                {
                    var rowIndex = gridView发货计划列表.GetDataSourceRowIndex(i);
                    var rowData  = _dataSrouce[rowIndex];
                    if ((rowData.FSTATUS == 1 || rowData.FSTATUS == 2) && !string.IsNullOrEmpty(rowData.FBILLNO))
                    {
                        list.Add(rowData.FID);
                    }
                }
            }

            if (list.Count > 0)
            {
                ids_sh = string.Join(",", list.ToArray());
            }

            if (ids_sh != "")
            {
                if (!backgroundWorker2.IsBusy)
                {
                    optype = "2";
                    setButton(false);
                    backgroundWorker2.RunWorkerAsync();
                }
            }
            else
            {
                MsgHelper.ShowError("审核只能针对待已审核和已生成单号的数据,请确认您选择数据是否正确!");
            }
        }
Ejemplo n.º 11
0
        private void btn提交同步_Click(object sender, EventArgs e)
        {
            fid_tb.Clear();
            List <string> list = new List <string>();

            listModels.Clear();



            string comid = "2";

            for (int i = 0; i < gridView发货计划列表.RowCount; i++)
            {
                bool b = gridView发货计划列表.GetRowCellValue(i, "FCHECK").ToBool();
                if (b)
                {
                    var rowIndex = gridView发货计划列表.GetDataSourceRowIndex(i);
                    var rowData  = _dataSrouce[rowIndex];
                    if (rowData.FSTATUS == 3 && (rowData.FSYNCSTATUS == 0 || rowData.FSYNCSTATUS == -1))
                    {
                        listModels.Add(rowData);
                    }
                }
            }

            if (listModels.Count > 0)
            {
                if (!backgroundWorker2.IsBusy)
                {
                    optype = "4";
                    backgroundWorker2.RunWorkerAsync();
                }
            }
            else
            {
                MsgHelper.ShowError("请选中符合条件的记录!");
            }
        }
Ejemplo n.º 12
0
        private void btn约车变更_Click(object sender, EventArgs e)
        {
            if (gridView发货计划列表.FocusedRowHandle > -1)
            {
                var rowIndex = gridView发货计划列表.GetDataSourceRowIndex(gridView发货计划列表.FocusedRowHandle);
                var rowData  = _dataSrouce[rowIndex];


                List <string> list = new List <string>();
                list.Add(rowData.FID);

                if (list.Count > 0)
                {
                    _service.GroupContractCar(list.ToArray());
                    MsgHelper.ShowInformation("处理完成!");
                    this.onSearch();
                }
                else
                {
                    MsgHelper.ShowError("请选择要处理的数据!");
                }
            }
        }
Ejemplo n.º 13
0
        private void btn拆单_Click(object sender, EventArgs e)
        {
            if (gridView发货计划列表.FocusedRowHandle > -1)
            {
                var rowIndex = gridView发货计划列表.GetDataSourceRowIndex(gridView发货计划列表.FocusedRowHandle);
                var rowData  = _dataSrouce[rowIndex];

                string billno = gridView发货计划列表.GetRowCellValue(gridView发货计划列表.FocusedRowHandle, "FBILLNO").ToStr();
                if (!string.IsNullOrEmpty(billno) & rowData.FSTATUS == 3 && rowData.FSYNCSTATUS == 0)
                {
                    //进入发货计划编辑
                    frm发货计划拆单 frm = new frm发货计划拆单();
                    frm.IcseoutbillModel  = rowData;
                    frm.IcseoutbillEntrys = new List <V_ICSEOUTBILLENTRYMODEL>(gridControl发货计划明细.DataSource as V_ICSEOUTBILLENTRYMODEL[]);
                    frm.SaveAfter        += new EventHandler(FrmPPPImmediateSendGoods_SaveAfter);
                    frm.Show();
                }
                else
                {
                    MsgHelper.ShowError("请选择已发货、审核通过,并且未提交到厂家的的数据进行拆单");
                }
            }
        }
        private void backgroundWorker2_DoWork(object sender, DoWorkEventArgs e)
        {
            tumMessage = "";
            switch (optype)
            {
            case "0":
                try
                {
                    _dataSrouce = _service.GetDeliveryList(
                        Global.LoginUser,
                        brand,
                        xq == "全部" ? "" : xq,
                        "",
                        status,
                        car,
                        "",
                        account,
                        expresscompany,
                        txt厂家单号.Text,
                        txt发货计划单号.Text,
                        txt组柜单号.Text,
                        txt工程名称.Text,
                        startdate == "0001/01/01" ? "" : startdate,
                        enddate == "0001/01/01" ? "" : enddate,
                        !chkClose.Checked);
                }
                catch (Exception ee)
                {
                    tumMessage = ee.ToStr();
                }


                break;

            case "2":
                try
                {
                    FrmAuditDialog dialog = new FrmAuditDialog("审核", "请选择你要做的处理", "通过", "不通过");
                    DialogResult   result = dialog.ShowDialog();
                    if (result == DialogResult.Yes)
                    {
                        //调用发货计划审核接口
                        int res3 = _service.AuditDeliveryByIDs(ids_sh, 3, Global.LoginUser);
                        MsgHelper.ShowInformation("处理成功!");
                    }
                    else if (result == DialogResult.No)
                    {
                        //调用发货计划审核接口
                        int res2 = _service.AuditDeliveryByIDs(ids_sh, 4, Global.LoginUser);
                        MsgHelper.ShowInformation("处理成功!");
                    }

                    foreach (var model in _dataSrouce)
                    {
                        foreach (string id in list)
                        {
                            if (model.FID == id)
                            {
                                model.FCHECK = true;
                            }
                        }
                    }
                }
                catch (Exception ee)
                {
                    tumMessage = ee.ToStr();
                }
                break;

            case "3":
                //调用发货计划删除接口
                try
                {
                    int res = _service.AuditAntiDeliveryByIDs(ids_sh);
                    if (res > 0)
                    {
                        MsgHelper.ShowInformation("处理成功!");
                    }
                }
                catch (Exception ee)
                {
                    tumMessage = ee.ToStr();
                }
                break;

            case "4":
                //调用发货计划接口
                try
                {
                    foreach (var sub33 in fid_tb)
                    {
                        string res1 = _service.SyncDeliveryByIDsMN(JSONhelper.ToJson(sub33.Value), sub33.Key);

                        if (res1 == "1")
                        {
                            //MsgHelper.ShowInformation("处理完成!");
                        }
                        else
                        {
                            MsgHelper.ShowError(res1);
                        }
                    }
                }
                catch (Exception ee)
                {
                    tumMessage = ee.ToStr();
                }

                break;
            }
        }
Ejemplo n.º 15
0
        string optType = "0";//
        private void backgroundWorker2_DoWork(object sender, DoWorkEventArgs e)
        {
            tuMessage = "";


            switch (optType)
            {
            case "0":
                try
                {
                    listSearch = _service.GetOrderList(
                        Global.LoginUser,
                        "", query.brand, int.Parse((query.t_status == null ? "0" : query.t_status)), "", query.P_BillNo,
                        query.startTime.ToString(),
                        query.endTime.ToStr(),
                        !query.bClose);
                }
                catch (Exception ee)
                {
                    tuMessage = ee.ToString();
                }
                break;

            case "1":    //shenhe
                try
                {
                    foreach (var sub111 in fid_sh)
                    {
                        var listEntry = _service.GetOrderEntryList(sub111, null);
                        List <ICPOBILLENTRYMODEL> listICPO = new List <ICPOBILLENTRYMODEL>();
                        foreach (var sub in listEntry)
                        {
                            ICPOBILLENTRYMODEL t = new ICPOBILLENTRYMODEL();
                            t.FENTRYID    = sub.FENTRYID;
                            t.FICPOBILLID = sub.FICPOBILLID;
                            t.FID         = sub.FID;

                            listICPO.Add(t);
                        }

                        if (_service.AuditSave_ICPO(listICPO.ToArray(), Global.LoginUser, ""))
                        {
                            // MsgHelper.ShowInformation("审核成功!");
                            try
                            {
                                listSearch = _service.GetOrderList(
                                    Global.LoginUser,
                                    "", query.brand, int.Parse((query.t_status == null ? "0" : query.t_status)), "", query.P_BillNo,
                                    query.startTime.ToString(),
                                    query.endTime.ToStr(),
                                    !query.bClose);
                            }
                            catch (Exception ee)
                            {
                                tuMessage = ee.ToString();
                            }
                        }
                        else
                        {
                            //MsgHelper.ShowInformation("审核失败!");
                        }
                    }
                }
                catch (Exception ee)
                {
                    tuMessage = ee.ToStr();
                }
                break;

            case "2":
                try
                {
                    foreach (var sub11 in fid_fs)
                    {
                        var listEntry1 = _service.GetOrderEntryList(sub11, null);
                        List <ICPOBILLENTRYMODEL> listICPO1 = new List <ICPOBILLENTRYMODEL>();
                        foreach (var sub in listEntry1)
                        {
                            ICPOBILLENTRYMODEL t = new ICPOBILLENTRYMODEL();
                            t.FENTRYID    = sub.FENTRYID;
                            t.FICPOBILLID = sub.FICPOBILLID;
                            t.FID         = sub.FID;
                            listICPO1.Add(t);
                        }

                        if (_service.UnAuditSave_ICPO(listICPO1.ToArray(), Global.LoginUser, ""))
                        {
                            //  MsgHelper.ShowInformation("反审成功!");
                            try
                            {
                                listSearch = _service.GetOrderList(
                                    Global.LoginUser,
                                    "", query.brand, int.Parse((query.t_status == null ? "0" : query.t_status)), "", query.P_BillNo,
                                    query.startTime.ToString(),
                                    query.endTime.ToStr(),
                                    !query.bClose);
                            }
                            catch (Exception ee)
                            {
                                tuMessage = ee.ToString();
                            }
                        }
                        else
                        {
                            MsgHelper.ShowInformation("反审失败!");
                        }
                    }
                }
                catch (Exception ee)
                {
                    tuMessage = ee.ToStr();
                }
                break;

            case "3":
                try
                {
                    ApiService.APIServiceClient mapi = new ApiService.APIServiceClient();
                    foreach (var sub22 in fid_tb)
                    {
                        string s = mapi.Remote_InsertICPOEntry(sub22.Value);

                        if (!s.Contains("error"))
                        {
                            Dictionary <int, string> dicEntryID_THDBMDetail = new Dictionary <int, string>();
                            try
                            {
                                MApiModel.api24.Rootobject api24 = new MApiModel.api24.Rootobject();
                                api24.action = "getMN_cp_24";
                                api24.token  = "";

                                DateTime theTime = DateTime.Now;
                                string   rq1     = theTime.Year + "/" + (theTime.Month < 10 ? "0" + theTime.Month.ToStr() : theTime.Month.ToStr()) + "/" + (theTime.Day < 10 ? "0" + theTime.Day.ToStr() : theTime.Day.ToStr());

                                api24.rq1       = rq1;
                                api24.rq2       = rq1;
                                api24.pageIndex = 1;
                                api24.pageSize  = 200;
                                api24.pzhm      = s;

                                MApiModel.recApi24.Rootobject r24 = new MApiModel.recApi24.Rootobject();
                                r24 = _service.Remote_Get24(api24);

                                Regex reg = new Regex("(\\d+)");

                                foreach (var subb in r24.resultInfo)
                                {
                                    if (!string.IsNullOrEmpty(subb.khhm1) && reg.IsMatch(subb.khhm1))
                                    {
                                        int iEndtry = int.Parse(reg.Match(subb.khhm1).Groups[1].Value);
                                        if (dicEntryID_THDBMDetail.ContainsKey(iEndtry))
                                        {
                                            dicEntryID_THDBMDetail.Add(iEndtry, subb.autoid);
                                        }
                                    }
                                }
                            }
                            catch (Exception ee)
                            {
                                Console.WriteLine(ee.Message);
                            }


                            _service.Update_FSYN_Remote_Status(sub22.Key, 4, s, dicEntryID_THDBMDetail);

                            MsgHelper.ShowInformation("同步完毕!");
                            try
                            {
                                listSearch = _service.GetOrderList(
                                    Global.LoginUser,
                                    "", query.brand, int.Parse((query.t_status == null ? "0" : query.t_status)), "", query.P_BillNo,
                                    query.startTime.ToString(),
                                    query.endTime.ToStr(),
                                    !query.bClose);
                            }
                            catch (Exception ee)
                            {
                                tuMessage = ee.ToString();
                            }
                        }
                        else
                        {
                            MsgHelper.ShowError(s);
                        }
                    }
                }
                catch (Exception ee)
                {
                    tuMessage = ee.ToStr();
                }

                break;

            case "4":
                var listEntry5 = _service.GetOrderEntryList(fid_close, null);
                List <ICPOBILLENTRYMODEL> listICPO5 = new List <ICPOBILLENTRYMODEL>();
                foreach (var sub in listEntry5)
                {
                    ICPOBILLENTRYMODEL t = new ICPOBILLENTRYMODEL();
                    t.FENTRYID    = sub.FENTRYID;
                    t.FICPOBILLID = sub.FICPOBILLID;
                    t.FID         = sub.FID;
                    listICPO5.Add(t);
                }

                if (_service.CloseSave_ICPO(listICPO5.ToArray(), Global.LoginUser, ""))
                {
                    MsgHelper.ShowInformation("关闭成功!");
                    try
                    {
                        listSearch = _service.GetOrderList(
                            Global.LoginUser,
                            "", query.brand, int.Parse((query.t_status == null ? "0" : query.t_status)), "", query.P_BillNo,
                            query.startTime.ToString(),
                            query.endTime.ToStr(),
                            !query.bClose);
                    }
                    catch (Exception ee)
                    {
                        tuMessage = ee.ToString();
                    }
                }
                else
                {
                    MsgHelper.ShowInformation("关闭失败!");
                }

                break;

            case "5":
                if (_service.Delete_ICPO(fid_delete))
                {
                    MsgHelper.ShowInformation("删除成功!");
                    try
                    {
                        listSearch = _service.GetOrderList(
                            Global.LoginUser,
                            "", query.brand, int.Parse((query.t_status == null ? "0" : query.t_status)), "", query.P_BillNo,
                            query.startTime.ToString(),
                            query.endTime.ToStr(),
                            !query.bClose);
                    }
                    catch (Exception ee)
                    {
                        tuMessage = ee.ToString();
                    }
                }
                else
                {
                    MsgHelper.ShowInformation("删除失败!");
                }
                break;

            case "6":
                try
                {
                    listDetail = _service.GetOrderEntryList(fid_detail, null);
                }
                catch (Exception ee)
                {
                    tuMessage = ee.ToString();
                }
                break;
            }
        }
Ejemplo n.º 16
0
        private void btn保存_Click(object sender, EventArgs e)
        {
            if (cbo品牌.SelectedItem == null)
            {
                MsgHelper.ShowError("请选择品牌/厂家!");
                return;
            }

            if (string.IsNullOrEmpty(sr厂家账户.Text))
            {
                MsgHelper.ShowError("请选择厂家账户!");
                return;
            }

            if (string.IsNullOrEmpty(sr二级销区.Text))
            {
                MsgHelper.ShowError("请选择二级销区!");
                return;
            }

            if (string.IsNullOrEmpty(txt车牌号.Text))
            {
                MsgHelper.ShowError("请输入车牌号!");
                return;
            }

            if (gridView发货计划明细.RowCount == 0)
            {
                MsgHelper.ShowError("没有发货明细,无法保存!");
                return;
            }

            ICSEOUTBILLMODEL model = new ICSEOUTBILLMODEL();

            if (IcseoutbillModel != null)
            {
                //model.FID = IcseoutbillModel.FID;
                model.FPREMISEID = IcseoutbillModel.FPREMISEID;
                model.FCLIENTID  = IcseoutbillModel.FCLIENTID;
                model.FBRANDID   = IcseoutbillModel.FBRANDID;
                //model.FBILLNO = IcseoutbillModel.FBILLNO;
                model.FCARNUMBER        = IcseoutbillModel.FCARNUMBER;
                model.FLOADCAPACITY     = IcseoutbillModel.FLOADCAPACITY;
                model.FDELIVERER        = IcseoutbillModel.FDELIVERER;
                model.FDELIVERERTEL     = IcseoutbillModel.FDELIVERERTEL;
                model.FDELIVERERIDNO    = IcseoutbillModel.FDELIVERERIDNO;
                model.FDELIVERERADDR    = IcseoutbillModel.FDELIVERERADDR;
                model.FRECEIVER         = IcseoutbillModel.FRECEIVER;
                model.FRECEIVERTEL      = IcseoutbillModel.FRECEIVERTEL;
                model.FRECEIVERADDR     = IcseoutbillModel.FRECEIVERADDR;
                model.FALLWEIGHT        = IcseoutbillModel.FALLWEIGHT;
                model.FALLVOLUME        = IcseoutbillModel.FALLVOLUME;
                model.FBILLERID         = IcseoutbillModel.FBILLERID;
                model.FBILLDATE         = IcseoutbillModel.FBILLDATE;
                model.FSTATUS           = IcseoutbillModel.FSTATUS;
                model.FCHECKERID        = IcseoutbillModel.FCHECKERID;
                model.FCHECKDATE        = IcseoutbillModel.FCHECKDATE;
                model.FREMARK           = IcseoutbillModel.FREMARK;
                model.FTRANSTYPE        = IcseoutbillModel.FTRANSTYPE;
                model.FTRANSID          = IcseoutbillModel.FTRANSID;
                model.FDELIVERDATE      = IcseoutbillModel.FDELIVERDATE;
                model.FFACTORYSTATUS    = IcseoutbillModel.FFACTORYSTATUS;
                model.FSYNCSTATUS       = IcseoutbillModel.FSYNCSTATUS;
                model.FCENTER_WAREHOUSE = IcseoutbillModel.FCENTER_WAREHOUSE;
                model.FIS_CONSIGN       = IcseoutbillModel.FIS_CONSIGN;
                model.FDELIVERY_METHOD  = IcseoutbillModel.FDELIVERY_METHOD;
                model.FEXPRESSCOMPANYID = IcseoutbillModel.FEXPRESSCOMPANYID;
                model.FPROJECTNAME      = IcseoutbillModel.FPROJECTNAME;
                model.FPURCHASE_NO      = IcseoutbillModel.FPURCHASE_NO;
                model.FPLANDESC         = IcseoutbillModel.FPLANDESC;
                model.FSRCBILLNO        = IcseoutbillModel.FSRCBILLNO;
                model.FBILLING_TYPE     = IcseoutbillModel.FBILLING_TYPE;
                model.FGROUP_NO         = IcseoutbillModel.FGROUP_NO;
                model.FBRAND_DEPART     = IcseoutbillModel.FBRAND_DEPART;
            }

            model.FBILLNO = txt发货计划号.Text;
            if (string.IsNullOrEmpty(model.FGROUP_NO))
            {
                model.FGROUP_NO = model.FBILLNO;
            }
            model.FBRANDID   = ((TB_BrandModel)cbo品牌.SelectedItem).FID;
            model.FCLIENTID  = sr厂家账户.Tag.ToStr();
            model.FPREMISEID = sr二级销区.Tag.ToStr();
            if (cbo运输方式.SelectedItem != null)
            {
                model.FTRANSID = ((SYS_SUBDICSMODEL)cbo运输方式.SelectedItem).FID;
            }
            model.FCARNUMBER        = txt车牌号.Text;
            model.FLOADCAPACITY     = txt车型载重.Text;
            model.FDELIVERDATE      = txt发货日期.DateTime;
            model.FDELIVERER        = txt提货人.Text;
            model.FDELIVERERTEL     = txt提货人电话.Text;
            model.FRECEIVERADDR     = txt收货方.Text;
            model.FALLWEIGHT        = txt汇总重量.Text.ToDecimal();
            model.FALLVOLUME        = txt汇总体积.Text.ToDecimal();
            model.FCENTER_WAREHOUSE = txt中心仓.Text;
            if (cbo发货方式.SelectedItem != null)
            {
                model.FDELIVERY_METHOD = ((SYS_SUBDICSMODEL)cbo发货方式.SelectedItem).FID;
            }
            model.FDELIVERERADDR = txt发货地点.Text;
            model.FPURCHASE_NO   = txt采购订单.Text;
            //model.FEETOTAL = txt标准运费.Text;
            model.FPLANDESC         = txt描述.Text;
            model.FEXPRESSCOMPANYID = sr承运公司.Tag.ToStr();
            model.FPROJECTNAME      = txt工程名称.Text;
            model.FREMARK           = txt其他.Text;
            if (cbo开单类型.SelectedItem != null)
            {
                model.FBILLING_TYPE = ((CodeValueClass)cbo开单类型.SelectedItem).value.ToInt();
            }
            model.FIS_CONSIGN       = chk是否托管.Checked ? 1 : 0;
            model.FBILLERID         = Global.LoginUser.FID;
            model.FBILLDATE         = DateTime.Now;
            model.FDELIVERY_REQUIRE = txt销区发货要求.Text;
            model.FBRAND_DEPART     = txt品牌部.Text;

            List <ICSEOUTBILLENTRYMODEL> entrys = new List <ICSEOUTBILLENTRYMODEL>();
            var datasource = gridControl发货计划明细.DataSource as List <V_ICSEOUTBILLENTRYMODEL>;
            int index      = 1;

            foreach (V_ICSEOUTBILLENTRYMODEL entry in datasource)
            {
                //if (model.FBILLING_TYPE == 1 && entry.FTRUSTEESHIP == "Y")
                //{
                //    MsgHelper.ShowError("普通开单,明细项目不允许有托管库开单的数据,请检查您的输入!");
                //    return;
                //}

                if (entry.FDISMANTLING.ToDecimal() > 0)
                {
                    _service.UpdateGetDeliveryEntryData(entry.FID, entry.FCOMMITQTY - entry.FDISMANTLING);

                    entrys.Add(new ICSEOUTBILLENTRYMODEL()
                    {
                        FID                 = entry.FID,
                        FICSEOUTID          = entry.FICSEOUTID,
                        FSRCID              = entry.FSRCID,
                        FPRICEPOLICYENTRYID = entry.FPRICEPOLICYENTRYID,
                        FICPRID             = entry.FICPRID,
                        FENTRYID            = index,
                        FCOMMITQTY          = entry.FDISMANTLING,
                        FHNAMOUNT           = entry.FHNAMOUNT,
                        FSTOCKNUMBER        = entry.FSTOCKNUMBER,
                        FSTOCK              = entry.FSTOCK,
                        FSTOCKPLACE         = entry.FSTOCKPLACE,
                        FWEIGHT             = entry.FWEIGHT,
                        FVOLUME             = entry.FVOLUME,
                        FREMARK             = entry.FREMARK,
                        FBATCHNO            = entry.FBATCHNO,
                        FCOLORNO            = entry.FCOLORNO,
                        FLEVEL              = entry.FLEVEL,
                        FWDR                = entry.FWDR,
                        FITEMID             = entry.FITEMID,
                        FPRICE              = entry.FPRICE,
                        FAMOUNT             = entry.FAMOUNT,
                        FERR_MESSAGE        = entry.FERR_MESSAGE,
                        FNEEDDATE           = entry.FNEEDDATE,
                        FORDERREMARK1       = entry.FORDERREMARK1,
                        FORDERREMARK2       = entry.FORDERREMARK2,
                        FDESCRIPTION        = entry.FDESCRIPTION,
                        FBRAND              = entry.FBRAND,
                        FLOCATION_NO        = entry.FLOCATION_NO
                    });

                    index++;
                }
            }

            _service.DeliveryBillSave(model, entrys.ToArray(), true);

            MsgHelper.ShowInformation("保存成功!");

            if (SaveAfter != null)
            {
                SaveAfter(null, null);
            }

            this.Close();
        }
Ejemplo n.º 17
0
        private void backgroundWorker2_DoWork(object sender, DoWorkEventArgs e)
        {
            tumMessage = "";
            switch (optype)
            {
            case "0":
                try
                {
                    _dataSrouce = _service.GetDeliveryList(
                        Global.LoginUser,
                        brand,
                        xq == "全部" ? "" : xq,
                        "",
                        status,
                        car,
                        "",
                        account,
                        expresscompany,
                        txt厂家单号.Text,
                        txt发货计划单号.Text,
                        txt组柜单号.Text,
                        txt工程名称.Text,
                        startdate == "0001/01/01" ? "" : startdate,
                        enddate == "0001/01/01" ? "" : enddate,
                        !chkClose.Checked);
                }
                catch (Exception ee)
                {
                    tumMessage = ee.ToStr();
                }


                break;

            case "2":
                try
                {
                    FrmAuditDialog dialog = new FrmAuditDialog("审核", "请选择你要做的处理", "通过", "不通过");
                    DialogResult   result = dialog.ShowDialog();
                    if (result == DialogResult.Yes)
                    {
                        //调用发货计划审核接口
                        int res3 = _service.AuditDeliveryByIDs(ids_sh, 3, Global.LoginUser);
                        MsgHelper.ShowInformation("处理成功!");
                    }
                    else if (result == DialogResult.No)
                    {
                        //调用发货计划审核接口
                        int res2 = _service.AuditDeliveryByIDs(ids_sh, 4, Global.LoginUser);
                        MsgHelper.ShowInformation("处理成功!");
                    }

                    foreach (var model in _dataSrouce)
                    {
                        foreach (string id in list)
                        {
                            if (model.FID == id)
                            {
                                model.FCHECK = true;
                            }
                        }
                    }
                }
                catch (Exception ee)
                {
                    tumMessage = ee.ToStr();
                }
                break;

            case "3":
                //调用发货计划删除接口
                try
                {
                    int res = _service.AuditAntiDeliveryByIDs(ids_sh);
                    if (res > 0)
                    {
                        MsgHelper.ShowInformation("处理成功!");
                    }
                }
                catch (Exception ee)
                {
                    tumMessage = ee.ToStr();
                }
                break;

            case "4":
                //调用发货计划接口
                try
                {
                    fid_tb.Clear();
                    for (int k = 0; k < listModels.Count; k++)
                    {
                        V_ICSEOUTBILLMODEL           rowData = listModels[k];
                        List <MApiModel.api12.Datum> LItem   = new List <MApiModel.api12.Datum>();
                        var entryList = _service.GetDeliveryEntryList(rowData.FID);

                        foreach (var sub22 in entryList)
                        {
                            v_thdModel v = _service.getTHD(sub22.thdbm);
                            sub22.khmc = v.khmc;
                            sub22.khhm = v.khhm;
                            sub22.gg   = v.cpgg;
                            sub22.xh   = v.cpxh;
                            sub22.pz   = v.cppz;
                            sub22.dw   = v.dw;
                            sub22.dj   = v.dj;
                            sub22.pz   = v.cppz;
                            sub22.xh   = v.cpxh;
                            sub22.gg   = v.cpgg;
                            sub22.khhm = v.khhm;
                            sub22.khmc = v.khmc;
                            sub22.cpdj = v.cpdj;
                            sub22.pzhm = v.pzhm;
                            sub22.kdrq = v.rq.ToString("yyyy-MM-dd");
                            sub22.cpcm = v.cpcm;
                            sub22.cpsh = v.cpsh;
                        }

                        string comid = "2";

                        foreach (var subEntry in entryList)
                        {
                            v_thdModel vTHD = _service.getTHD(subEntry.thdbm);
                            comid = vTHD.DB;

                            //list.Add(rowData.FID);
                            MApiModel.api12.Datum subItem = new MApiModel.api12.Datum();
                            subItem.pzhm = rowData.FBILLNO.Replace("DP", "");
                            subItem.rq   = rowData.FBILLDATE.Year + "/" + (rowData.FBILLDATE.Month < 10 ? "0" + rowData.FBILLDATE.Month.ToStr() : rowData.FBILLDATE.Month.ToStr()) + "/" + (rowData.FBILLDATE.Day < 10 ? "0" + rowData.FBILLDATE.Day.ToStr() : rowData.FBILLDATE.Day.ToStr());
                            subItem.khhm = vTHD.khhm;
                            subItem.khmc = vTHD.khmc;

                            subItem.pzlb = "";
                            subItem.cplb = 0;
                            //subItem.pjhm = string.IsNullOrEmpty(rowData.thdbm)?"":rowData.thdbm;
                            subItem.zdr  = "300384";
                            subItem.pjhm = string.IsNullOrEmpty(vTHD.pzhm) ? "" : vTHD.pzhm;

                            // string[] strArr = pro.FSRCCODE.Split(new string[] { "||" }, StringSplitOptions.RemoveEmptyEntries);
                            //产品品种

                            subItem.cppz = vTHD.cppz;
                            //产品规格
                            subItem.cpgg = vTHD.cpgg;
                            //产品型号
                            subItem.cpxh = vTHD.cpxh;


                            subItem.cpdj    = vTHD.cpdj;
                            subItem.cpsh    = string.IsNullOrEmpty(vTHD.cpsh) ? "" : vTHD.cpsh; // string.IsNullOrEmpty(subEntry.FCOLORNO)?"":subEntry.FCOLORNO;
                            subItem.cpcm    = string.IsNullOrEmpty(vTHD.cpcm) ? "" : vTHD.cpcm; // string.IsNullOrEmpty(subEntry.FSTOCKNUMBER)?0:int.Parse(subEntry.FSTOCKNUMBER);
                            subItem.package = vTHD.tpackage;
                            subItem.dw      = vTHD.dw;
                            subItem.ks      = int.Parse(vTHD.ks);
                            subItem.sl      = (int)subEntry.FCOMMITQTY;
                            subItem.bz      = string.IsNullOrEmpty(subEntry.FREMARK) ? "" : subEntry.FREMARK;
                            subItem.gg      = vTHD.gg == null ? "" : vTHD.gg;

                            try
                            {
                                decimal dGGS = subItem.ks * subItem.sl * decimal.Parse(vTHD.gg);
                                subItem.ggs = dGGS.ToStr();
                            }
                            catch
                            {
                                subItem.ggs = vTHD.GGS == null ? "" : vTHD.GGS;
                            }


                            subItem.pjhm1 = "";
                            //
                            //subItem.package = vTHD.tpackage;
                            subItem.pjhm2    = "";
                            subItem.telphone = string.IsNullOrEmpty(rowData.FDELIVERERTEL) ? "123456789" : rowData.FDELIVERERTEL;

                            string strCarno = "";
                            strCarno += string.IsNullOrEmpty(rowData.FCARNUMBER) ? "" : rowData.FCARNUMBER;
                            strCarno += string.IsNullOrEmpty(rowData.FDELIVERER) ? "" : " 司机:" + rowData.FDELIVERER;
                            strCarno += string.IsNullOrEmpty(rowData.FDELIVERERTEL) ? "" : " 电话:" + rowData.FDELIVERERTEL;

                            decimal dLength = decimal.Parse(IniHelper.ReadString(Global.IniUrl, "CONFIG", "cph", "40"));

                            if (strCarno.Length > (int)dLength)
                            {
                                strCarno = strCarno.Substring(0, (int)dLength - 1);
                            }

                            subItem.carno = strCarno.Trim().Replace("  ", "");


                            subItem.jsdz     = string.IsNullOrEmpty(rowData.FRECEIVER_DISTRICT_NAME) ? "广东省" : rowData.FRECEIVER_DISTRICT_NAME;
                            subItem.jsr      = subItem.telphone;
                            subItem.pjhm3    = rowData.FBILLNO.Replace("DP", "");
                            subItem.ysfs     = string.IsNullOrEmpty(rowData.FDELIVERY_METHODNAME) ? "" : rowData.FDELIVERY_METHODNAME;
                            subItem.jsfs     = "";
                            subItem.Province = string.IsNullOrEmpty(rowData.FRECEIVER_PROVINCE_NAME) ? "广东省" : rowData.FRECEIVER_PROVINCE_NAME;
                            subItem.City     = string.IsNullOrEmpty(rowData.FRECEIVER_CITY_NAME) ? "佛山市" : rowData.FRECEIVER_CITY_NAME;
                            subItem.Region   = "南海区";
                            subItem.bz       = string.IsNullOrEmpty(rowData.FREMARK) ? "" : rowData.FREMARK;
                            LItem.Add(subItem);
                        }

                        if (LItem.Count > 0)
                        {
                            MApiModel.api12.Rootobject getapi6 = new MApiModel.api12.Rootobject();
                            getapi6.data  = LItem.ToArray();
                            getapi6.comid = int.Parse(comid);
                            string fid = rowData.FID;

                            if (!fid_tb.ContainsKey(fid) && fid != "")
                            {
                                fid_tb.Add(fid, getapi6);
                            }
                        }
                    }


                    List <string> listFalse = new List <string>();
                    int           iIndex    = 0;
                    List <string> listKeys  = new List <string>();
                    foreach (var sub333 in fid_tb)
                    {
                        listKeys.Add(sub333.Key);
                    }
                    foreach (string sub33 in listKeys)
                    {
                        if (!fid_tb.ContainsKey(sub33))
                        {
                            continue;
                        }
                        iIndex++;
                        string k = sub33;

                        MApiModel.api12.Rootobject v = fid_tb[sub33];
                        var    jsonData = JsonHelper.ToJson(v);
                        string res1     = _service.SyncDeliveryByIDsMN(jsonData, k);
                        if (res1 == "1")
                        {
                            //MsgHelper.ShowInformation("处理完成!");
                        }
                        else
                        {
                            listFalse.Add("第" + iIndex + "条发生错误:" + res1);
                        }
                    }

                    if (listFalse.Count > 0)
                    {
                        string mes = "";
                        foreach (var sub in listFalse)
                        {
                            mes += sub + "\r\n";
                        }

                        MsgHelper.ShowError(mes);
                    }
                }
                catch (Exception ee)
                {
                    tumMessage = ee.ToStr();
                }

                break;
            }
        }
        private void btn提交同步_Click(object sender, EventArgs e)
        {
            fid_tb.Clear();
            List <string> list = new List <string>();

            //int[] rownumber = this.gridView发货计划列表.GetSelectedRows();
            //foreach (int number in rownumber)
            //{
            //    var rowIndex = gridView发货计划列表.GetDataSourceRowIndex(number);
            //    var rowData = _dataSrouce[rowIndex];
            //    if (rowData.FSTATUS == 3 && (rowData.FSYNCSTATUS == 0 || rowData.FSYNCSTATUS == -1))
            //    {
            //        list.Add(rowData.FID);
            //    }
            //}

            List <MApiModel.api12.Datum> LItem = new List <MApiModel.api12.Datum>();
            string comid = "2";

            for (int i = 0; i < gridView发货计划列表.RowCount; i++)
            {
                bool b = gridView发货计划列表.GetRowCellValue(i, "FCHECK").ToBool();
                if (b)
                {
                    var rowIndex = gridView发货计划列表.GetDataSourceRowIndex(i);
                    var rowData  = _dataSrouce[rowIndex];
                    if (rowData.FSTATUS == 3 && (rowData.FSYNCSTATUS == 0 || rowData.FSYNCSTATUS == -1))
                    {
                        var entryList = gridControl发货计划明细.DataSource as V_ICSEOUTBILLENTRYMODEL[];
                        foreach (var subEntry in entryList)
                        {
                            v_thdModel vTHD = _service.getTHD(subEntry.thdbm);
                            comid = vTHD.DB;
                            ProductViewModel pro = _service.getProductView(subEntry.FITEMID);

                            //list.Add(rowData.FID);
                            MApiModel.api12.Datum subItem = new MApiModel.api12.Datum();
                            subItem.pzhm = rowData.FBILLNO.Replace("DP", "");
                            subItem.rq   = rowData.FBILLDATE.Year + "/" + (rowData.FBILLDATE.Month < 10 ? "0" + rowData.FBILLDATE.Month.ToStr() : rowData.FBILLDATE.Month.ToStr()) + "/" + (rowData.FBILLDATE.Day < 10 ? "0" + rowData.FBILLDATE.Day.ToStr() : rowData.FBILLDATE.Day.ToStr());
                            subItem.khhm = vTHD.khhm;
                            subItem.khmc = vTHD.khmc;

                            subItem.pzlb = "";
                            subItem.cplb = 0;
                            //subItem.pjhm = string.IsNullOrEmpty(rowData.thdbm)?"":rowData.thdbm;
                            subItem.zdr  = "300384";
                            subItem.pjhm = string.IsNullOrEmpty(vTHD.pzhm) ? "" : vTHD.pzhm;

                            // string[] strArr = pro.FSRCCODE.Split(new string[] { "||" }, StringSplitOptions.RemoveEmptyEntries);
                            //产品品种

                            subItem.cppz = vTHD.cppz;
                            //产品规格
                            subItem.cpgg = vTHD.cpgg;
                            //产品型号
                            subItem.cpxh = vTHD.cpxh;


                            subItem.cpdj    = vTHD.cpdj;
                            subItem.cpsh    = string.IsNullOrEmpty(vTHD.cpsh) ? "" : vTHD.cpsh; // string.IsNullOrEmpty(subEntry.FCOLORNO)?"":subEntry.FCOLORNO;
                            subItem.cpcm    = string.IsNullOrEmpty(vTHD.cpcm) ? "" : vTHD.cpcm; // string.IsNullOrEmpty(subEntry.FSTOCKNUMBER)?0:int.Parse(subEntry.FSTOCKNUMBER);
                            subItem.package = vTHD.tpackage;
                            subItem.dw      = vTHD.dw;
                            subItem.ks      = int.Parse(vTHD.ks);
                            subItem.sl      = (int)subEntry.FCOMMITQTY;
                            subItem.bz      = string.IsNullOrEmpty(subEntry.FREMARK) ? "" : subEntry.FREMARK;
                            subItem.gg      = pro.FWEIGHT.ToStr();
                            subItem.ggs     = ((int)subEntry.FCOMMITQTY * pro.FWEIGHT).ToStr();
                            subItem.pjhm1   = "";
                            //
                            //subItem.package = vTHD.tpackage;
                            subItem.pjhm2    = "";
                            subItem.telphone = string.IsNullOrEmpty(rowData.FDELIVERERTEL) ? "123456789" : rowData.FDELIVERERTEL;

                            string strCarno = "";
                            strCarno += string.IsNullOrEmpty(rowData.FCARNUMBER) ? "" : "车号:" + rowData.FCARNUMBER;
                            strCarno += string.IsNullOrEmpty(rowData.FDELIVERER) ? "" : " 司机:" + rowData.FDELIVERER;
                            strCarno += string.IsNullOrEmpty(rowData.FDELIVERERTEL) ? "" : " 联系电话:" + rowData.FDELIVERERTEL;

                            subItem.carno = strCarno;

                            subItem.jsdz     = string.IsNullOrEmpty(rowData.FRECEIVER_DISTRICT_NAME) ? "广东省" : rowData.FRECEIVER_DISTRICT_NAME;
                            subItem.jsr      = subItem.telphone;
                            subItem.pjhm3    = rowData.FBILLNO.Replace("DP", "");
                            subItem.ysfs     = string.IsNullOrEmpty(rowData.FDELIVERY_METHODNAME) ? "" : rowData.FDELIVERY_METHODNAME;
                            subItem.jsfs     = "";
                            subItem.Province = string.IsNullOrEmpty(rowData.FRECEIVER_PROVINCE_NAME) ? "广东省" : rowData.FRECEIVER_PROVINCE_NAME;
                            subItem.City     = string.IsNullOrEmpty(rowData.FRECEIVER_CITY_NAME) ? "佛山市" : rowData.FRECEIVER_CITY_NAME;
                            subItem.Region   = "南海区";
                            subItem.bz       = rowData.FREMARK;
                            LItem.Add(subItem);
                        }
                    }


                    if (LItem.Count > 0)
                    {
                        // if (MsgHelper.AskQuestion("点击确认开始提交数据到厂家系统!"))
                        {
                            MApiModel.api12.Rootobject getapi6 = new MApiModel.api12.Rootobject();
                            getapi6.data  = LItem.ToArray();
                            getapi6.comid = int.Parse(comid);
                            string fid = rowData.FID;

                            if (!fid_tb.ContainsKey(fid))
                            {
                                fid_tb.Add(fid, getapi6);
                            }
                        }
                    }
                    else
                    {
                        MsgHelper.ShowError("请勾选要上传的数据。");
                    }

                    // break;
                }
            }

            if (fid_tb.Count > 0)
            {
                if (!backgroundWorker2.IsBusy)
                {
                    optype = "4";
                    backgroundWorker2.RunWorkerAsync();
                }
            }
            else
            {
                MsgHelper.ShowError("请选中符合条件的记录!");
            }
        }
Ejemplo n.º 19
0
        /// <summary>
        /// 判断是否需要更新程序
        /// </summary>
        /// <returns></returns>
        private static bool Update()
        {
            VerModel verModel = null;
            string   error    = "";
            bool     isUpdate = false;

            if (GetVersion(out verModel, out error))
            {
                if (verModel != null && verModel.VerCode > Global.VersionInterior) //是否内部版本号比当前的大
                {
                    if (verModel.IsMustUpdate)                                     //是否是强制更新
                    {
                        isUpdate = true;
                    }
                    else
                    {
                        if (MsgHelper.AskQuestion("有新的版本发布,是否下载更新?"))
                        {
                            isUpdate = true;
                        }
                        else
                        {
                            return(true);
                        }
                    }

                    if (isUpdate)
                    {
                        //获取需要更新的文件,并且记录在Update.txt文件夹中
                        List <string> list = null;
                        if (GetUpdateFiles(out list, out error))
                        {
                            if (list == null || list.Count == 0)
                            {
                                MsgHelper.ShowError("获取更新文件为空!");
                                return(false);
                            }

                            string path     = Application.ExecutablePath;
                            char   strSplit = '\\';
                            if (path.Contains("\\"))
                            {
                                strSplit = '\\';
                            }
                            else if (path.Contains("/"))
                            {
                                strSplit = '/';
                            }
                            string[] array = path.Split(strSplit);
                            string   name  = array[array.Length - 1].Split('.')[0];
                            using (StreamWriter sw = File.CreateText(Global.UpdatePath))
                            {
                                sw.WriteLine(name);
                                foreach (string str in list)
                                {
                                    sw.WriteLine(str);
                                }
                            }

                            IniHelper.WriteString(Global.IniUrl, "CONFIG", "VerName", verModel.VerName);

                            Process p = new Process();
                            p.StartInfo.UseShellExecute = false;
                            p.StartInfo.FileName        = Application.StartupPath + "\\AutoUpdate.exe";
                            p.Start();
                            Environment.Exit(0);
                            return(false);
                        }
                        else
                        {
                            MsgHelper.ShowError("获取更新文件失败!/r/n" + error);
                        }
                    }
                }
                else
                {
                    return(true);
                }
            }
            else
            {
                MsgHelper.ShowError(error);
            }
            return(false);
        }