Esempio n. 1
0
        public static void uploadTaskFile(String taskId, String empId)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Title  = "请选择文件";
            ofd.Filter = "(*xlsx;*.xls;*.docx;*.doc;*.pdf)|*xlsx;*.xls;*.docx;*.doc;*.pdf";
            //ofd.ShowDialog();
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                Byte[] byteArray = FileBinaryConvertHelper.File2Bytes(ofd.FileName);
                String fileStr   = Convert.ToBase64String(byteArray);

                String uuid = System.Guid.NewGuid().ToString("N");
                string sql  = "insert into file (id,filename,file)"
                              + " values('" + uuid + "'"
                              + "         , '" + ofd.SafeFileName + "'"
                              + "         , '" + fileStr + "'); ";
                DBUtil.ExecuteSQL(sql);
                sql = "update custom_appointment_assignee"
                      + " set file_id = '" + uuid + "'"
                      + " , status = '" + (int)EnumAssignment.已完成 + "'"
                      + " where task_id = '" + taskId + "' and emp_id = '" + empId + "'; ";
                int i = DBUtil.ExecuteSQL(sql);
                //int i = DocService.UpdataMoBan(str, ofd.SafeFileName, fileName);
                if (i != 0)
                {
                    MessageBox.Show("上传成功");
                }
            }
        }
Esempio n. 2
0
        private void repositoryItemButtonEdit1_Click(object sender, EventArgs e)
        {
            int     handle   = this.gridView1.FocusedRowHandle;
            DataRow drhandle = this.gridView1.GetDataRow(handle);

            FolderBrowserDialog saveFileDialog1 = new FolderBrowserDialog();
            //saveFileDialog1.Title = "另存为";
            DialogResult rdr      = saveFileDialog1.ShowDialog();
            string       fileName = saveFileDialog1.SelectedPath; //  选择路径

            if (rdr == System.Windows.Forms.DialogResult.OK && !string.IsNullOrEmpty(fileName))
            {
                //DataTable dt = DBUtil.ExecuteDataTable("SELECT * FROM file");
                //DataRow drr = null;
                //foreach (DataRow ddr in dt.Rows)
                //{
                //    drr = ddr;
                //}
                //_ = drr["file"] as byte[];
                byte[] decBytes = Convert.FromBase64String(drhandle["filestream"].ToString());
                //string str2 = Convert.ToBase64String(decBytes);
                fileName = fileName + "\\" + drhandle["filename"].ToString();
                FileBinaryConvertHelper.Bytes2File(decBytes, fileName);
                MessageBox.Show("保存成功!", "提示");
            }
        }
        /// <summary>
        /// 加载文件
        /// </summary>
        private byte[] UploadFile()
        {
            using (OpenFileDialog dialog = new OpenFileDialog()) {
                dialog.Filter           = "音频文件|*.wav;*.mp3";//文件扩展名
                dialog.CheckFileExists  = true;
                dialog.Multiselect      = false;
                dialog.InitialDirectory = AppDomain.CurrentDomain.BaseDirectory;
                dialog.ShowDialog();

                if (!string.IsNullOrEmpty(dialog.FileName))
                {
                    this.btnPlay.Enabled = false;
                    try {
                        byte[] byteArray = FileBinaryConvertHelper.File2Bytes(dialog.FileName);//文件转成byte二进制数组
                        _fileName = dialog.FileName;
                        this.txtBoxFileName.Text = dialog.SafeFileName;
                        _isDirty = true;
                        return(byteArray);
                    } catch (Exception ex) {
                        MessageBox.Show(ex.Message);
                        return(null);
                    }
                }
                this.txtBoxFileName.Text = "";
            }
            return(null);
        }
        /// <summary>
        /// 将UC内容保存至dto
        /// </summary>
        public void SaveToDTO()
        {
            String file_name = @"" + this.TaskDTO.order_id + "_" + System.Guid.NewGuid().ToString("N") + ".doc";

            richEditControl备注.SaveDocument(file_name, DevExpress.XtraRichEdit.DocumentFormat.Doc);
            Byte[] byteArray = FileBinaryConvertHelper.File2Bytes(file_name);
            String str       = Convert.ToBase64String(byteArray);

            this.单据转dto转json();
            this.TaskDTO.buildForUC(str, this.TaskDTO.data, file_name);
            File.Delete(file_name);
        }
Esempio n. 5
0
        public static void updateTempalteFile(String fileName)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Title  = "请选择文件";
            ofd.Filter = "(*xlsx;*.xls;*.docx;*.doc;*.pdf)|*xlsx;*.xls;*.docx;*.doc;*.pdf";
            //ofd.ShowDialog();
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                Byte[] byteArray = FileBinaryConvertHelper.File2Bytes(ofd.FileName);
                String str       = Convert.ToBase64String(byteArray);
                //int i = DBUtil.ExecuteSQL("UPDATE task_template SET task_template_file = '" + str + "',task_template_file_name='" + ofd.SafeFileName + "' WHERE task_template_name = '" + this.barTaskTemplate.EditValue + "'");
                int i = DocService.UpdataMoBan(str, ofd.SafeFileName, fileName);
                if (i != 0)
                {
                    MessageBox.Show("上传成功");
                }
            }
        }
Esempio n. 6
0
        private void repositoryItemButtonEdit1_Click(object sender, EventArgs e)
        {
            int     handle   = this.gridView1.FocusedRowHandle;
            DataRow drhandle = this.gridView1.GetDataRow(handle);

            FolderBrowserDialog saveFileDialog1 = new FolderBrowserDialog();
            //saveFileDialog1.Title = "另存为";
            DialogResult rdr      = saveFileDialog1.ShowDialog();
            string       fileName = saveFileDialog1.SelectedPath;

            if (rdr == System.Windows.Forms.DialogResult.OK && !string.IsNullOrEmpty(fileName))
            {
                //DataRow dr2 = DocService.Getrealdr(drhandle["field_task_template_id"].ToString());
                byte[] decBytes = Convert.FromBase64String(drhandle[2].ToString());
                fileName = fileName + "\\" + drhandle[3].ToString();
                FileBinaryConvertHelper.Bytes2File(decBytes, fileName);
                MessageBox.Show("保存成功!", "提示");
                RefrashGridcontrol();
            }
        }
Esempio n. 7
0
        private ResultVO <T> PrivateUploadFile <T>(string AllPathFileName, string FileName, string Operate, string FolderName)
        {
            List <Class_ParaArray> class_ParaArrays = new List <Class_ParaArray>();

            try
            {
                Class_ParaArray class_ParaArrayFileName = new Class_ParaArray();
                class_ParaArrayFileName.ParaName  = "fileName";
                class_ParaArrayFileName.ParaValue = FileName;
                class_ParaArrays.Add(class_ParaArrayFileName);
                if (FolderName != null)
                {
                    Class_ParaArray class_ParaArrayFolderName = new Class_ParaArray();
                    class_ParaArrayFolderName.ParaName  = "dictionary";
                    class_ParaArrayFolderName.ParaValue = FolderName;
                    class_ParaArrays.Add(class_ParaArrayFolderName);
                }

                byte[]       byteArray = FileBinaryConvertHelper.File2Bytes(AllPathFileName);
                ResultVO <T> resultVO  = new ResultVO <T>();
                string       Url       = "useAuthorityPageFeign/uploadFile";
                if (FolderName == null)
                {
                    Url = string.Format("useAuthorityPageFeign/uploadFile{0}", Operate);
                }
                string ResultValue = class_RestClient.PostBinary(Url
                                                                 , class_ParaArrays
                                                                 , byteArray, true);
                return(JsonTools.JsonToObject(ResultValue, resultVO) as ResultVO <T>);
            }
            catch (Exception error)
            {
                throw error;
            }
            finally
            {
                class_ParaArrays.Clear();
            }
        }
        /// <summary>
        /// 从dto中读取内容
        /// </summary>
        /// <param name="taskDTO"></param>
        public void ReadFromDTO()
        {
            this.richEditControl备注.ReadOnly = !this.ifedit;
            this.textBox负责人.ReadOnly        = !this.ifedit;
            this.dateEdit时间.ReadOnly        = !this.ifedit;
            if (this.TaskDTO.data == "" || this.TaskDTO.data == null)
            {
                this.textBox负责人.Text = "";
                this.dateEdit时间.Text = "";
                this.Refresh();
                //this.TaskDTO.data = "[{\"title\":\"负责人\",\"value\":\"\"},{\"title\":\"时间\",\"value\":\"\"}]";
            }
            else
            {
                foreach (UCDocument uCDocument in this.TaskDTO.uCDocuments)
                {
                    switch (uCDocument.title)
                    {
                    case "负责人":
                        this.textBox负责人.Text = uCDocument.value;
                        break;

                    case "时间":
                        this.dateEdit时间.Text = uCDocument.value;
                        break;
                    }
                }
            }
            this.richEditControl备注.Refresh();
            if (this.TaskDTO.remark != "" && this.TaskDTO.remark != null)
            {
                byte[] decBytes = Convert.FromBase64String(this.TaskDTO.remark);
                FileBinaryConvertHelper.Bytes2File(decBytes, @"" + this.TaskDTO.file_name + ".doc");
                this.richEditControl备注.LoadDocument(@"" + this.TaskDTO.file_name + ".doc");
                File.Delete(@"" + this.TaskDTO.file_name + ".doc");
            }
        }
Esempio n. 9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        String type = Request.QueryString["type"].ToString();

        if ("save".Equals(type))
        {
            try
            {
                string imgbase64  = Request.Form["imgbase64"];  //图片
                string tisaneNum  = Request.Form["tisaneNum"];  //煎药单号
                string userNum    = Request.Form["userNum"];    //员工号
                string barcode    = Request.Form["barcode"];    //条形码
                string waterYield = Request.Form["waterYield"]; //水量
                string userName   = Request.Form["userName"];   //员工姓名
                string imgname    = null;
                string nowDate    = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                if (imgbase64 != null && imgbase64.Trim().Length > 0)
                {
                    imgbase64 = imgbase64.Replace(' ', '+');
                    Byte[] bimg = Convert.FromBase64String(imgbase64);
                    //D:\\项目\\煎药厂\\src\\web\\upload\\

                    String path = System.AppDomain.CurrentDomain.BaseDirectory.ToString() + "upload\\";
                    imgname = DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".png";
                    FileBinaryConvertHelper.Bytes2File(bimg, path + imgname);
                }
                TeModel    tm         = new TeModel();
                Bubbleinfo bl         = new Bubbleinfo();
                DataTable  dt         = tm.findTisaneinfoBybarcode(tisaneNum);
                int        result     = 0;
                string     machine    = "[]";
                string     tisaneunit = "[]";
                string     flag       = "0";
                if (dt.Rows.Count > 0)
                {
                    if ("1".Equals(dt.Rows[0]["tisanestatus"].ToString()))
                    {
                        result = 0;
                    }
                    else
                    {
                        flag   = "1";
                        result = tm.updateTisaneinfo(Convert.ToInt32(dt.Rows[0]["id"].ToString()), 1, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), tisaneNum, dt.Rows[0]["starttime"].ToString());
                    }
                }
                else
                {
                    RecipeModel rem    = new RecipeModel();
                    DataTable   dtable = rem.findBubbleFinish(Convert.ToInt32(tisaneNum));
                    if (dtable.Rows.Count > 0)
                    {
                        DataTable table = bl.findMachineByStartAndFree();
                        if (table.Rows.Count > 0)
                        {
                            machine = DataTableToJson.ToJson(table);
                        }

                        DataTable tisaneunits = bl.findTisaneunitByPid(Convert.ToInt32(tisaneNum));
                        if (tisaneunits.Rows.Count > 0)
                        {
                            tisaneunit = DataTableToJson.ToJson(tisaneunits);
                        }
                        result = 1;
                    }
                    else
                    {
                        result = 0;
                    }
                }
                if (result > 0)
                {
                    Response.Write("{\"code\":\"0\",\"msg\":\"操作成功\",\"machine\":" + machine + ",\"tisaneunit\":" + tisaneunit + ",\"flag\":" + flag + "}");
                }
                else
                {
                    Response.Write("{\"code\":\"1\",\"msg\":\"操作失败\"}");
                }
            }
            catch (Exception e1)
            {
                Response.Write("{\"code\":\"1\",\"msg\":\"操作失败\"}");
            }
        }
        else if ("get".Equals(type))
        {
            String id = Request.QueryString["id"].ToString();

            TeModel tm = new TeModel();

            RecipeModel rm        = new RecipeModel();
            string      warningid = rm.getRetentionWarning(4);

            DataTable dataTable = tm.getPreBytisaneid(Convert.ToInt32(id), DateTime.Now.ToString("yyyy-MM-dd"));
            Response.Write("{\"code\":\"0\",\"msg\":\"操作成功\",\"data\":" + DataTableToJson.ToJson(dataTable) + ",\"warning\":\"" + warningid + "\"}");
        }
        else if ("updateMachine".Equals(type))
        {
            string imgbase64  = Request.Form["imgbase64"];  //图片
            string tisaneNum  = Request.Form["tisaneNum"];  //煎药单号
            string userNum    = Request.Form["userNum"];    //员工号
            string barcode    = Request.Form["barcode"];    //条形码
            string waterYield = Request.Form["waterYield"]; //水量
            string userName   = Request.Form["userName"];   //员工姓名
            string imgname    = null;
            string nowDate    = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            if (imgbase64 != null && imgbase64.Trim().Length > 0)
            {
                imgbase64 = imgbase64.Replace(' ', '+');
                Byte[] bimg = Convert.FromBase64String(imgbase64);
                //D:\\项目\\煎药厂\\src\\web\\upload\\

                String path = System.AppDomain.CurrentDomain.BaseDirectory.ToString() + "upload\\";
                imgname = DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".png";
                FileBinaryConvertHelper.Bytes2File(bimg, path + imgname);
            }

            Bubbleinfo bi        = new Bubbleinfo();
            string     tid       = Request.Form["tid"];       //分配机组记录id
            string     machineid = Request.Form["machineid"]; //煎药机id
            bi.updateTisaneunitByMachineid(Convert.ToInt32(tid), Convert.ToInt32(machineid));
            TeModel tm = new TeModel();
            tm.addTisaneinfo(Convert.ToInt32(userNum), nowDate, barcode, "煎药", tisaneNum, imgname, waterYield, userName);
            Response.Write("{\"code\":\"0\",\"msg\":\"操作成功\"}");
        }
    }
Esempio n. 10
0
        /// <summary>
        /// 读取文件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void button1_Click(object sender, RoutedEventArgs e)
        {
            if (saveres == 0)
            {
                MessageBoxResult mbr = MessageBox.Show("you have not saved the file, are you sure to create a new one before you save?", "WARNING", MessageBoxButton.YesNoCancel);

                if (mbr == MessageBoxResult.Yes)
                {
                    OpenFileDialog ofd = new OpenFileDialog();
                    ofd.Filter = @"文本文档|*.txt|批处理文件|*.bat|C/C++源文件|*.c;*.cpp|python文件|*.py;|PHP文件|*.php;|javascript文件|*.js;|网页文件|*.html;*.htm|所有文件|*.*";
                    Nullable <bool> result = ofd.ShowDialog();
                    if (result == true)
                    {
                        StreamReader sr  = new StreamReader(ofd.FileName, Encoding.Default);
                        string       str = sr.ReadToEnd();
                        textbox1.Text = str;
                        UTF8Encoding utf8 = new UTF8Encoding();
                        byte[]       buff = await FileBinaryConvertHelper.File2Bytes(ofd.FileName);

                        //byte[] buffer = utf8.GetBytes(str);
                        if (list1.Count == 0)
                        {
                            list1.Add(new files
                            {
                                content  = buff,
                                filename = ofd.FileName
                            });
                        }
                        list1[0].filename = ofd.FileName;
                        list1[0].content  = new byte[buff.Length];
                        list1[0].content  = buff;
                        string msg = "";
                        await Task.Run(() =>
                        {
                            foreach (var item in buff)
                            {
                                msg += ($"{item:X2} ");
                            }
                        });

                        //  string msg = string.Format("{0}",buffer);
                        textbox2.Text = msg;
                        saveres       = 0;
                        sr.Close();
                    }
                }
                else if (mbr == MessageBoxResult.No)
                {
                    button3_Click(sender, e);
                    OpenFileDialog ofd = new OpenFileDialog();
                    ofd.Filter = @"文本文档|*.txt|批处理文件|*.bat|C/C++源文件|*.c;*.cpp|python文件|*.py;|PHP文件|*.php;|javascript文件|*.js;|网页文件|*.html;*.htm|所有文件|*.*";
                    Nullable <bool> result = ofd.ShowDialog();
                    if (result == true)
                    {
                        StreamReader sr  = new StreamReader(ofd.FileName, Encoding.Default);
                        string       str = sr.ReadToEnd();
                        textbox1.Text = str;
                        UTF8Encoding utf8 = new UTF8Encoding();
                        byte[]       buff = await FileBinaryConvertHelper.File2Bytes(ofd.FileName);

                        //byte[] buffer = utf8.GetBytes(str);
                        if (list1.Count == 0)
                        {
                            list1.Add(new files
                            {
                                content  = buff,
                                filename = ofd.FileName
                            });
                        }
                        list1[0].filename = ofd.FileName;
                        list1[0].content  = new byte[buff.Length];
                        list1[0].content  = buff;
                        string msg = "";
                        await Task.Run(() =>
                        {
                            foreach (var item in buff)
                            {
                                msg += ($"{item:X2} ");
                            }
                        });

                        //  string msg = string.Format("{0}",buffer);
                        textbox2.Text = msg;
                        saveres       = 0;
                        sr.Close();
                    }
                }
                else if (mbr == MessageBoxResult.Cancel)
                {
                }
            }
            else
            {
                OpenFileDialog ofd = new OpenFileDialog();
                ofd.Filter = @"文本文档|*.txt|批处理文件|*.bat|C/C++源文件|*.c;*.cpp|python文件|*.py;|PHP文件|*.php;|javascript文件|*.js;|网页文件|*.html;*.htm|所有文件|*.*";
                Nullable <bool> result = ofd.ShowDialog();
                if (result == true)
                {
                    StreamReader sr  = new StreamReader(ofd.FileName, Encoding.Default);
                    string       str = sr.ReadToEnd();
                    textbox1.Text = str;
                    UTF8Encoding utf8 = new UTF8Encoding();
                    byte[]       buff = await FileBinaryConvertHelper.File2Bytes(ofd.FileName);

                    //byte[] buffer = utf8.GetBytes(str);
                    if (list1.Count == 0)
                    {
                        list1.Add(new files
                        {
                            content  = buff,
                            filename = ofd.FileName
                        });
                    }
                    list1[0].filename = ofd.FileName;
                    list1[0].content  = new byte[buff.Length];
                    list1[0].content  = buff;
                    string msg = "";
                    await Task.Run(() =>
                    {
                        foreach (var item in buff)
                        {
                            msg += ($"{item:X2} ");
                        }
                    });

                    //  string msg = string.Format("{0}",buffer);
                    textbox2.Text = msg;
                    saveres       = 0;
                    sr.Close();
                }
            }
        }
Esempio n. 11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        String type = Request.QueryString["type"].ToString();

        if ("save".Equals(type))
        {
            try
            {
                //   string strName = System.Web.HttpUtility.UrlDecode(Request["txtData"]);

                //  byte[] bt = Convert.FromBase64String(base64string);
                string imgbase64 = Request.Form["imgbase64"];
                // string imgbase64 = Request.QueryString["imgbase64"].ToString();

                // string tisaneNum = Request.QueryString["tisaneNum"].ToString();
                string tisaneNum = Request.Form["tisaneNum"];

                //  string userNum = Request.QueryString["userNum"].ToString();
                string userNum  = Request.Form["userNum"];
                string barcode  = Request.Form["barcode"];
                string userName = Request.Form["userName"];//员工姓名
                // string userName = Request.QueryString["userName"].ToString();
                //   string userName = Request.Form["userName"];
                // imgbase64 = imgbase64.Replace("+", "%2B");
                string imgname = null;
                if (imgbase64 != null && imgbase64.Trim().Length > 0)
                {
                    imgbase64 = imgbase64.Replace(' ', '+');
                    Byte[] bimg = Convert.FromBase64String(imgbase64);
                    //D:\\项目\\煎药厂\\src\\web\\upload\\

                    String path = System.AppDomain.CurrentDomain.BaseDirectory.ToString() + "upload\\";
                    imgname = DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".png";
                    FileBinaryConvertHelper.Bytes2File(bimg, path + imgname);
                }



                AdjustModel am     = new AdjustModel();
                DataTable   dt     = am.findAdjustBybarcode(tisaneNum);
                int         result = 0;
                if (dt.Rows.Count > 0)
                {
                    if ("1".Equals(dt.Rows[0]["status"].ToString()))
                    {
                        result = 0;
                    }
                    else
                    {
                        result = am.updateAdjust(Convert.ToInt32(dt.Rows[0]["id"].ToString()), 1, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), userName, tisaneNum);
                    }
                }
                else
                {
                    RecipeModel rm     = new RecipeModel();
                    DataTable   dtable = rm.findRecipeInfoByCheckId(Convert.ToInt32(tisaneNum));
                    if (dtable.Rows.Count > 0)
                    {
                        result = am.addAdjust(Convert.ToInt32(userNum), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), barcode, "调剂", tisaneNum, imgname, userName);
                    }
                    else
                    {
                        result = 0;
                    }
                }
                if (result > 0)
                {
                    Response.Write("{\"code\":\"0\",\"msg\":\"操作成功\"}");
                }
                else
                {
                    Response.Write("{\"code\":\"1\",\"msg\":\"操作失败\"}");
                }
            }
            catch (Exception e1)
            {
                Response.Write("{\"code\":\"1\",\"msg\":\"操作失败\"}");
            }
        }
        else if ("get".Equals(type))
        {
            String id = Request.QueryString["id"].ToString();

            RecipeModel rm        = new RecipeModel();
            DataTable   dataTable = rm.findAdjustRecipeInfo(Convert.ToInt32(id), DateTime.Now.ToString("yyyy-MM-dd"));

            string adjustwarning = rm.getRetentionWarning(1);
            Response.Write("{\"code\":\"0\",\"msg\":\"操作成功\",\"data\":" + DataTableToJson.ToJson(dataTable) + ",\"warning\":\"" + adjustwarning + "\"}");
        }



        //  Response.Write(imgbase64 + "," + tisaneNum + "," + userNum + "," + userName);
    }
Esempio n. 12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        String type = Request.QueryString["type"].ToString();

        if ("save".Equals(type))
        {
            try
            {
                string imgbase64 = Request.Form["imgbase64"]; //图片
                string tisaneNum = Request.Form["tisaneNum"]; //煎药单号
                string userNum   = Request.Form["userNum"];   //员工号
                string barcode   = Request.Form["barcode"];   //条形码
                string userName  = Request.Form["userName"];  //员工姓名
                string imgname   = null;
                string nowDate   = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                if (imgbase64 != null && imgbase64.Trim().Length > 0)
                {
                    imgbase64 = imgbase64.Replace(' ', '+');
                    Byte[] bimg = Convert.FromBase64String(imgbase64);
                    //D:\\项目\\煎药厂\\src\\web\\upload\\

                    String path = System.AppDomain.CurrentDomain.BaseDirectory.ToString() + "upload\\";
                    imgname = DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".png";
                    FileBinaryConvertHelper.Bytes2File(bimg, path + imgname);
                }
                DeliveryHandler dh     = new DeliveryHandler();
                RecipeModel     rm     = new RecipeModel();
                DataTable       dtable = rm.findPackingFinish(Convert.ToInt32(tisaneNum));
                int             result = 0;
                if (dtable.Rows.Count > 0)
                {
                    DataTable dtables = rm.findDeliveryFinish(Convert.ToInt32(tisaneNum));
                    if (dtables.Rows.Count > 0)
                    {
                        //  result = dh.AddDelivery(Convert.ToInt32(userNum), nowDate, barcode, tisaneNum, imgname, userName);
                        result = dh.AddDelivery(Convert.ToInt32(userNum), nowDate, barcode, tisaneNum, imgname, userName);
                    }
                    else
                    {
                        result = 0;
                    }
                }

                if (result > 0)
                {
                    Response.Write("{\"code\":\"0\",\"msg\":\"操作成功\"}");
                }
                else
                {
                    Response.Write("{\"code\":\"1\",\"msg\":\"操作失败\"}");
                }
            }
            catch (Exception e1)
            {
                Response.Write("{\"code\":\"1\",\"msg\":\"操作失败\"}");
            }
        }
        else if ("get".Equals(type))
        {
            String      id  = Request.QueryString["id"].ToString();
            RecipeModel rm2 = new RecipeModel();

            string        warningid = rm2.getRetentionWarning(6);
            DeliveryModel rm        = new DeliveryModel();

            DataTable dataTable = rm.findDeliveryInfo(Convert.ToInt32(id), DateTime.Now.ToString("yyyy-MM-dd"));
            Response.Write("{\"code\":\"0\",\"msg\":\"操作成功\",\"data\":" + DataTableToJson.ToJson(dataTable) + ",\"warning\":\"" + warningid + "\"}");
        }
    }