示例#1
0
文件: Form1.cs 项目: jhkmnm/Barcode
        private bool SaveOweGoods()
        {
            var postdata = string.Format("token={0}&sessionId={1}&id={2}", token, User.SessionID, CurrentData.ID);
            var htmlstr  = Html.Post(str_api + str_OweGoods, postdata);
            var result   = JsonConvert.DeserializeObject <Result>(htmlstr);

            Utilities.DataVerifier dv = new Utilities.DataVerifier();
            dv.Check(result.Status == "40000", result.Message);
            dv.ShowMsgIfFailed();
            return(dv.Pass);
        }
示例#2
0
文件: Form1.cs 项目: jhkmnm/Barcode
        private bool SaveWeight()
        {
            var weight = "";

            if (!string.IsNullOrWhiteSpace(txtWeight_2.Text))
            {
                weight = txtWeight_2.Text;
            }
            else
            {
                weight = txtWeight_1.Text;
            }
            Utilities.DataVerifier dv = new Utilities.DataVerifier();
            dv.Check(string.IsNullOrWhiteSpace(weight), "请连接电子秤称重或手动输入重量");
            if (dv.Pass)
            {
                On();
                if (Print(weight))
                {
                    CurrentData.Real_Num = weight;
                    var postdata = string.Format("token={0}&sessionId={1}&num={2}&id={3}", token, User.SessionID, weight, CurrentData.ID);
                    var htmlstr  = Html.Post(str_api + str_SaveAndPrint, postdata);
                    dv.Check(string.IsNullOrWhiteSpace(htmlstr), "保存重量失败");
                    if (dv.Pass)
                    {
                        var result = JsonConvert.DeserializeObject <Result>(htmlstr);
                        CurrentData.balance_color = result.is_red.ToString();
                        dgvData.Refresh();
                        dv.Check(result.Status == "40000", result.Message);
                        logger.Info("保存重量完成");
                    }
                }
                else
                {
                    return(false);
                }
            }
            isPrint = false;
            dv.ShowMsgIfFailed();
            return(dv.Pass);
        }